Class: AcceptableApi::Builder
- Inherits:
-
Object
- Object
- AcceptableApi::Builder
- Defined in:
- lib/acceptable_api/builder.rb
Instance Method Summary collapse
- #expose(controller_action, options = {}) ⇒ Object
-
#initialize ⇒ Builder
constructor
A new instance of Builder.
- #register(from_to, &map_block) ⇒ Object
- #to_app ⇒ Object
Constructor Details
Instance Method Details
#expose(controller_action, options = {}) ⇒ Object
21 22 23 24 |
# File 'lib/acceptable_api/builder.rb', line 21 def expose controller_action, = {} route = Route.new , controller_action self.routes << route end |
#register(from_to, &map_block) ⇒ Object
14 15 16 17 18 19 |
# File 'lib/acceptable_api/builder.rb', line 14 def register from_to, &map_block from = from_to.keys[0] to = from_to.values[0] mapper = Mapper.new from, to, &map_block self.mappers << mapper end |
#to_app ⇒ Object
26 27 28 |
# File 'lib/acceptable_api/builder.rb', line 26 def to_app Application.new mappers, routes end |