Class: CloudConvert::Collection
- Inherits:
-
Array
- Object
- Array
- CloudConvert::Collection
- Defined in:
- lib/cloudconvert/collection.rb
Instance Attribute Summary collapse
-
#links ⇒ Object
readonly
Returns the value of attribute links.
-
#meta ⇒ Object
readonly
Returns the value of attribute meta.
Instance Method Summary collapse
-
#initialize(items = [], links = {}, meta = {}) ⇒ Collection
constructor
A new instance of Collection.
- #where(attrs) ⇒ Object
Constructor Details
#initialize(items = [], links = {}, meta = {}) ⇒ Collection
Returns a new instance of Collection.
5 6 7 8 9 |
# File 'lib/cloudconvert/collection.rb', line 5 def initialize(items = [], links = {}, = {}) super(items) @links = links @meta = end |
Instance Attribute Details
#links ⇒ Object (readonly)
Returns the value of attribute links.
3 4 5 |
# File 'lib/cloudconvert/collection.rb', line 3 def links @links end |
#meta ⇒ Object (readonly)
Returns the value of attribute meta.
3 4 5 |
# File 'lib/cloudconvert/collection.rb', line 3 def @meta end |
Instance Method Details
#where(attrs) ⇒ Object
11 12 13 |
# File 'lib/cloudconvert/collection.rb', line 11 def where(attrs) self.class.new select { |item| attrs.map { |k, v| item.send(k) == v ? true : nil }.compact.length == attrs.length } end |