language specialized to a particular application domain. This is in contrast to a general-purpose language (GPL), which is broadly applicable across domains, and lacks specialized features for a particular domain.
= {}) puts "Map a URL of '/' to controller and action in options" end def get(*args, &block) puts "Map a URL given in args to controller and action in args" end def resources(*resources, &block) puts "Map multiple URLs for #{resources.first} to the associated controller and actions" end end
do root to: 'welcome#home' resources :posts get '/login', to: 'sessions#new' end class Mapper def root(options = {}) puts "Map a URL of '/' to controller and action in options" end def get(*args, &block) puts "Map a URL given in args to controller and action in args" end def resources(*resources, &block) puts "Map multiple URLs for #{resources.first} to the associated controller and actions" end end
= {}) puts "Map a URL of '/' to controller and action in options" end def get(*args, &block) puts "Map a URL given in args to controller and action in args" end def resources(*resources, &block) puts "Map multiple URLs for #{resources.first} to the associated controller and actions" end end class RouteSet def draw(&block) mapper = Mapper.new(self) mapper.instance_eval(&block) end end
'welcome#home' resources :posts get '/login', to: 'sessions#new' end class RouteSet def draw(&block) mapper = Mapper.new(self) mapper.instance_eval(&block) end end class Mapper def root(options = {}) puts "Map a URL of '/' to controller and action in options" end def get(*args, &block) puts "Map a URL given in args to controller and action in args" end def resources(*resources, &block) puts "Map multiple URLs for #{resources.first} to the associated controller and actions" end end