class Tinybucket::Model::Base
Public Class Methods
concern_included?(concern_name)
click to toggle source
# File lib/tinybucket/model/base.rb, line 12 def self.concern_included?(concern_name) mod_name = "Tinybucket::Model::Concerns::#{concern_name}".constantize ancestors.include?(mod_name) end
new(json)
click to toggle source
# File lib/tinybucket/model/base.rb, line 17 def initialize(json) self.attributes = json @_loaded = !json.empty? end
Public Instance Methods
attributes()
click to toggle source
# File lib/tinybucket/model/base.rb, line 32 def attributes acceptable_attributes.map do |key| { key => send(key.intern) } end.reduce(&:merge) end
attributes=(hash)
click to toggle source
# File lib/tinybucket/model/base.rb, line 22 def attributes=(hash) hash.each_pair do |key, value| if acceptable_attribute?(key) send("#{key}=".intern, value) else logger.warn("Ignored '#{key}' attribute (value: #{value}). [#{self.class}]") end end end
Protected Instance Methods
logger()
click to toggle source
# File lib/tinybucket/model/base.rb, line 40 def logger Tinybucket.logger end