Class: K8::ActionMethodMapping

Inherits:
Object
  • Object
show all
Defined in:
lib/keight.rb

Instance Method Summary collapse

Constructor Details

#initializeActionMethodMapping

Returns a new instance of ActionMethodMapping.



1156
1157
1158
# File 'lib/keight.rb', line 1156

def initialize
  @mappings = []
end

Instance Method Details

#eachObject



1185
1186
1187
1188
1189
1190
1191
# File 'lib/keight.rb', line 1185

def each
  #; [!62y5q] yields each urlpath pattern and action methods.
  @mappings.each do |urlpath_pattern, action_methods|
    yield urlpath_pattern, action_methods
  end
  self
end

#map(urlpath_pattern, action_methods = {}) ⇒ Object

ex:

map '/',         :GET=>:do_index, :POST=>:do_create
map '/{id:\d+}', :GET=>:do_show, :PUT=>:do_update, :DELETE=>:do_delete


1165
1166
1167
1168
1169
1170
1171
# File 'lib/keight.rb', line 1165

def map(urlpath_pattern, action_methods={})
  action_methods = _normalize(action_methods)
  #; [!s7cs9] maps urlpath and methods.
  #; [!o6cxr] returns self.
  @mappings << [urlpath_pattern, action_methods]
  return self
end