Module: ModelPresenter::AsJson

Defined in:
lib/model_presenter/as_json.rb

Instance Method Summary collapse

Instance Method Details

#json_properties(*properties) ⇒ Object


3
4
5
6
7
8
9
# File 'lib/model_presenter/as_json.rb', line 3

def json_properties(*properties)
  self.send :define_method, :as_json do |options = {}|
    properties.inject({}) do |results, property|
      results.merge! property => send(property)
    end
  end
end