Module: Cardiac::DeclarationMethods
- Included in:
- Declarations, Cardiac::Declarations::ClassMethods
- Defined in:
- lib/cardiac/declarations.rb
Instance Method Summary collapse
-
#resource(base, &declaration) ⇒ Object
Declares a new resource off of the given base, using the given extension block.
-
#with_resource(at = nil) {|OperationProxy.new(at ? Subresource.new(base_resource).at(at) : base_resource)| ... } ⇒ Object
Dynamically declares a new subresource (optionally targetting a given sub-url), and yields a new OperationProxy which targets that subresource.
Instance Method Details
#resource(base, &declaration) ⇒ Object
Declares a new resource off of the given base, using the given extension block.
30 31 32 |
# File 'lib/cardiac/declarations.rb', line 30 def resource base, &declaration DeclarationBuilder.new(base).extension_eval(&declaration) end |
#with_resource(at = nil) {|OperationProxy.new(at ? Subresource.new(base_resource).at(at) : base_resource)| ... } ⇒ Object
Dynamically declares a new subresource (optionally targetting a given sub-url), and yields a new OperationProxy which targets that subresource.
36 37 38 |
# File 'lib/cardiac/declarations.rb', line 36 def with_resource(at=nil) yield OperationProxy.new(at ? Subresource.new(base_resource).at(at) : base_resource) end |