class Boxxspring::Abstract
Public Class Methods
new( attributes = {} )
click to toggle source
# File lib/boxxspring/abstract.rb, line 5 def initialize( attributes = {} ) @attributes = {} attributes.each_pair do | key, value | self.send( key, value ) end end
Public Instance Methods
include?( name )
click to toggle source
# File lib/boxxspring/abstract.rb, line 16 def include?( name ) @attributes.include?( name ) end
method_missing( method, *arguments, &block )
click to toggle source
Calls superclass method
# File lib/boxxspring/abstract.rb, line 20 def method_missing( method, *arguments, &block ) result = nil if arguments.length == 0 result = @attributes[ method.to_sym ] if result.nil? result = Abstract.new result.instance_eval( &block ) unless block.nil? @attributes[ method.to_sym ] = result end elsif arguments.length == 1 method = method.to_s.gsub( /=$/, '' ) result = arguments[ 0 ] @attributes[ method.to_sym ] = result else result = super end result end
to_hash()
click to toggle source
# File lib/boxxspring/abstract.rb, line 12 def to_hash return @attributes end