class Devbootcamp::Model

Attributes

attributes[R]

Public Class Methods

attributes(*attributes) click to toggle source
# File lib/devbootcamp/model.rb, line 4
def self.attributes *attributes
  @attributes ||= []
  if !attributes.empty?
    @attributes += attributes.map(&:to_sym).each do |attribute|
      define_method(attribute){ @attributes[attribute] }
    end
  end
  @attributes
end
new(attributes={}) click to toggle source
# File lib/devbootcamp/model.rb, line 14
def initialize(attributes={})
  @attributes = attributes.with_indifferent_access
end

Public Instance Methods

as_json(options=nil) click to toggle source
# File lib/devbootcamp/model.rb, line 24
def as_json(options=nil)
  attributes
end
serializable_hash(options=nil) click to toggle source
# File lib/devbootcamp/model.rb, line 20
def serializable_hash(options=nil)
  attributes
end