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.



83
84
85
86
87
# File 'lib/representable.rb', line 83

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

#prepare(represented) ⇒ Object



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

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