module Silueta

Constants

VERSION

Public Class Methods

included(base) click to toggle source
# File lib/silueta.rb, line 4
def self.included(base)
  base.extend(ClassMethods)
end
new(attrs = {}) click to toggle source
# File lib/silueta.rb, line 36
def initialize(attrs = {})
  @attributes = {}

  update(attrs)
end

Public Instance Methods

attributes() click to toggle source
# File lib/silueta.rb, line 48
def attributes
  return slice(*self.class.attributes)
end
slice(*attrs) click to toggle source
# File lib/silueta.rb, line 52
def slice(*attrs)
  return attrs.each_with_object({}) do |att, hash|
    hash[att] = send(att)
  end
end
update(attrs) click to toggle source
# File lib/silueta.rb, line 42
def update(attrs)
  attrs.each do |attr, value|
    public_send(:"#{ attr }=", value) if respond_to?(:"#{ attr }=")
  end
end