Class: Bitreserve::Entities::BaseEntity
- Inherits:
-
Object
- Object
- Bitreserve::Entities::BaseEntity
- Defined in:
- lib/bitreserve/entities/base_entity.rb
Defined Under Namespace
Classes: PaginatedCollection
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ BaseEntity
constructor
A new instance of BaseEntity.
Constructor Details
#initialize(attributes = {}) ⇒ BaseEntity
Returns a new instance of BaseEntity.
13 14 15 |
# File 'lib/bitreserve/entities/base_entity.rb', line 13 def initialize(attributes = {}) super(Bitreserve::Helpers.underscored_hash(attributes)) end |
Class Method Details
.from_collection(entities, content_range) ⇒ Object
6 7 8 9 10 11 |
# File 'lib/bitreserve/entities/base_entity.rb', line 6 def self.from_collection(entities, content_range) total_size = (content_range && content_range.split('/')[1]) || entities.size items = entities.map { |entity| new(entity) } PaginatedCollection.new(items, total_size) end |