Class: Travis::Client::Namespace::Curry
- Inherits:
-
Module
- Object
- Module
- Travis::Client::Namespace::Curry
- Defined in:
- lib/travis/client/namespace.rb
Instance Attribute Summary collapse
-
#namespace ⇒ Object
Returns the value of attribute namespace.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
- #clear_cache ⇒ Object
- #clear_cache! ⇒ Object
- #current ⇒ Object
- #find_many(params = {}) ⇒ Object (also: #find_all)
- #find_one(id = nil) ⇒ Object (also: #find)
-
#initialize(namespace, type) ⇒ Curry
constructor
A new instance of Curry.
Constructor Details
#initialize(namespace, type) ⇒ Curry
Returns a new instance of Curry.
9 10 11 |
# File 'lib/travis/client/namespace.rb', line 9 def initialize(namespace, type) @namespace, @type = namespace, type end |
Instance Attribute Details
#namespace ⇒ Object
Returns the value of attribute namespace.
7 8 9 |
# File 'lib/travis/client/namespace.rb', line 7 def namespace @namespace end |
#type ⇒ Object
Returns the value of attribute type.
7 8 9 |
# File 'lib/travis/client/namespace.rb', line 7 def type @type end |
Instance Method Details
#clear_cache ⇒ Object
34 35 36 |
# File 'lib/travis/client/namespace.rb', line 34 def clear_cache session.clear_cache end |
#clear_cache! ⇒ Object
38 39 40 |
# File 'lib/travis/client/namespace.rb', line 38 def clear_cache! session.clear_cache! end |
#current ⇒ Object
19 20 21 22 23 |
# File 'lib/travis/client/namespace.rb', line 19 def current result = session.find_one_or_many(type) Array(result).each { |e| e.curry = self } result end |
#find_many(params = {}) ⇒ Object Also known as: find_all
25 26 27 28 29 |
# File 'lib/travis/client/namespace.rb', line 25 def find_many(params = {}) session.find_many(type, params).each do |entity| entity.curry = self end end |
#find_one(id = nil) ⇒ Object Also known as: find
13 14 15 16 17 |
# File 'lib/travis/client/namespace.rb', line 13 def find_one(id = nil) result = session.find_one(type, id) result.curry = self result end |