Module: Representable::ClassMethods

Defined in:
lib/representable.rb

Defined Under Namespace

Modules: Declarations

Instance Method Summary collapse

Instance Method Details

#create_represented(document, *args) ⇒ Object

Create and yield object and options. Called in .from_json and friends.



87
88
89
90
91
# File 'lib/representable.rb', line 87

def create_represented(document, *args)
  new.tap do |represented|
    yield represented, *args if block_given?
  end
end

#prepare(represented) ⇒ Object



93
94
95
# File 'lib/representable.rb', line 93

def prepare(represented)
  represented.extend(self)  # was: PrepareStrategy::Extend.
end