Module: RemoteResource::Dsl
- Included in:
- Base
- Defined in:
- lib/remote_resource/base/dsl.rb
Overview
Our humble DSL
Instance Attribute Summary collapse
-
#client_proc ⇒ Object
readonly
Returns the value of attribute client_proc.
-
#resources ⇒ Object
readonly
Returns the value of attribute resources.
Instance Method Summary collapse
- #attribute(method, named_resource = :default) ⇒ Object
- #attributes ⇒ Object
- #client(&block) ⇒ Object
- #resource(name = :default, &block) ⇒ Object
Instance Attribute Details
#client_proc ⇒ Object (readonly)
Returns the value of attribute client_proc.
4 5 6 |
# File 'lib/remote_resource/base/dsl.rb', line 4 def client_proc @client_proc end |
#resources ⇒ Object (readonly)
Returns the value of attribute resources.
4 5 6 |
# File 'lib/remote_resource/base/dsl.rb', line 4 def resources @resources end |
Instance Method Details
#attribute(method, named_resource = :default) ⇒ Object
19 20 21 |
# File 'lib/remote_resource/base/dsl.rb', line 19 def attribute(method, named_resource = :default) attributes[method] = named_resource end |
#attributes ⇒ Object
23 24 25 |
# File 'lib/remote_resource/base/dsl.rb', line 23 def attributes @attributes ||= {} end |
#client(&block) ⇒ Object
6 7 8 |
# File 'lib/remote_resource/base/dsl.rb', line 6 def client(&block) @client_proc = block if block end |
#resource(name = :default, &block) ⇒ Object
10 11 12 13 14 15 16 17 |
# File 'lib/remote_resource/base/dsl.rb', line 10 def resource(name = :default, &block) if block @resources ||= {} @resources[name] = block else fail ArgumentError, 'must supply a block' end end |