Module: Whiskey::Server::Control::ClassMethods
- Defined in:
- lib/whiskey/server/control.rb
Instance Method Summary collapse
Instance Method Details
#actions ⇒ Object
25 26 27 28 29 |
# File 'lib/whiskey/server/control.rb', line 25 def actions constants.select do |constant| constant.to_s.end_with?("Action") end.map(&method(:const_get)) end |
#controls ⇒ Object
19 20 21 22 23 |
# File 'lib/whiskey/server/control.rb', line 19 def controls constants.select do |constant| constant.to_s.end_with?("Control") end.map(&method(:const_get)) end |
#to_resource ⇒ Object
9 10 11 |
# File 'lib/whiskey/server/control.rb', line 9 def to_resource name.demodulize.downcase.gsub(/control/, '') end |
#to_route ⇒ Object
13 14 15 16 17 |
# File 'lib/whiskey/server/control.rb', line 13 def to_route { to_resource => actions.map(&:to_verb) } end |