Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why sinatra is a DSL?

Tags:

ruby

sinatra

The very first line written about sinatra is it is DSL for quickly creating web applications in Ruby with minimal effort. I can understand it is light weight, very flexible, quick for creating web apps and with minimal effort but not able to understand how it is a DSL?

like image 565
Manoj Sehrawat Avatar asked Dec 06 '14 20:12

Manoj Sehrawat


1 Answers

One reason is that it defines actions ("verbs") within its domain as methods, for example:

get '/hi' do
  "Hello World!"
end

Here Sinatra has incorporated an action from its domain--namely the HTTP request method "GET"--into its "vocabulary."

(Similar to building a library around banking and defining methods like account or customer.)

Is this more about the true definition of DSL?

like image 156
TK-421 Avatar answered Oct 04 '22 03:10

TK-421