Class: Feedlr::Mapper

Inherits:
Object
  • Object
show all
Defined in:
lib/feedlr/mapper.rb

Overview

The generalized pseudo-object that is returned for all query requests. http://martinfowler.com/eaaCatalog/dataMapper.html

Class Method Summary collapse

Class Method Details

.build(data) ⇒ Feedlr::Base, ...

Build the proper object depending on the response



14
15
16
17
18
19
20
21
22
23
# File 'lib/feedlr/mapper.rb', line 14

def self.build(data)
  case data
  when Hash
    (data.size > 0) ? Feedlr::Base.new(data) : Feedlr::Success.new
  when Array
    Feedlr::Collection.new(data)
  else
    Feedlr::Success.new
  end
end