module Modis::Attribute
Constants
- TYPES
Public Class Methods
included(base)
click to toggle source
# File lib/modis/attribute.rb, line 13 def self.included(base) base.extend ClassMethods base.instance_eval do bootstrap_attributes end end
Public Instance Methods
assign_attributes(hash)
click to toggle source
# File lib/modis/attribute.rb, line 78 def assign_attributes(hash) hash.each do |k, v| setter = "#{k}=" send(setter, v) if respond_to?(setter) end end
attributes()
click to toggle source
# File lib/modis/attribute.rb, line 74 def attributes @modis_attributes end
read_attribute(key)
click to toggle source
# File lib/modis/attribute.rb, line 89 def read_attribute(key) attributes[key.to_s] end
write_attribute(key, value)
click to toggle source
# File lib/modis/attribute.rb, line 85 def write_attribute(key, value) attributes[key.to_s] = value end
Protected Instance Methods
apply_defaults()
click to toggle source
# File lib/modis/attribute.rb, line 101 def apply_defaults @modis_attributes = Hash[self.class.attributes_with_defaults] end
set_sti_type()
click to toggle source
# File lib/modis/attribute.rb, line 95 def set_sti_type return unless self.class.sti_child? write_attribute(:type, self.class.name) end