Class: Nelumba::Collection
- Inherits:
-
Object
- Object
- Nelumba::Collection
- Includes:
- Object
- Defined in:
- lib/nelumba/collection.rb
Direct Known Subclasses
Constant Summary
Constants included from Object
Object::USERNAME_REGULAR_EXPRESSION
Instance Attribute Summary collapse
-
#items ⇒ Object
readonly
Returns the value of attribute items.
-
#total_items ⇒ Object
readonly
Returns the value of attribute total_items.
Attributes included from Object
#author, #content, #display_name, #html, #image, #published, #summary, #text, #title, #uid, #updated, #url
Instance Method Summary collapse
- #init(options = {}, &blk) ⇒ Object
-
#initialize(options = {}, &blk) ⇒ Collection
constructor
A new instance of Collection.
- #to_hash ⇒ Object
- #to_json_hash ⇒ Object
Methods included from Object
#mentions, #reply_to, #to_as1, #to_html, #to_json, #to_text
Constructor Details
#initialize(options = {}, &blk) ⇒ Collection
Returns a new instance of Collection.
8 9 10 |
# File 'lib/nelumba/collection.rb', line 8 def initialize( = {}, &blk) init(, &blk) end |
Instance Attribute Details
#items ⇒ Object (readonly)
Returns the value of attribute items.
5 6 7 |
# File 'lib/nelumba/collection.rb', line 5 def items @items end |
#total_items ⇒ Object (readonly)
Returns the value of attribute total_items.
6 7 8 |
# File 'lib/nelumba/collection.rb', line 6 def total_items @total_items end |
Instance Method Details
#init(options = {}, &blk) ⇒ Object
12 13 14 15 16 17 |
# File 'lib/nelumba/collection.rb', line 12 def init( = {}, &blk) super(, &blk) @items = [:items] || [] @total_items = [:total_items] || @items.count end |
#to_hash ⇒ Object
19 20 21 22 23 24 |
# File 'lib/nelumba/collection.rb', line 19 def to_hash { :items => (self.items || []).dup, :total_items => self.total_items || self.items.count }.merge(super) end |
#to_json_hash ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/nelumba/collection.rb', line 26 def to_json_hash { :objectType => "collection", :items => (self.items || []).dup, :totalItems => self.total_items || self.items.count }.merge(super) end |