lib/gorillib/model/base.rb in gorillib-0.4.2 vs lib/gorillib/model/base.rb in gorillib-0.5.0
- old
+ new
@@ -29,10 +29,11 @@
# person.attributes # => { :name => "Emmet Brown", :title => "Dr" }
#
# @return [{Symbol => Object}] The Hash of all attributes
def attributes
self.class.field_names.inject(Hash.new) do |hsh, fn|
+ # hsh[fn] = attribute_set?(fn) ? read_attribute(fn) : nil
hsh[fn] = read_attribute(fn)
hsh
end
end
@@ -197,20 +198,23 @@
str << '(' << attrs.map{|attr, val| "#{attr}=#{val.respond_to?(:inspect_compact) ? val.inspect_compact : val.inspect}" }.join(", ") << ')'
end
str << '>'
end
+ def to_s
+ inspect
+ end
+
def inspect_compact
str = "#<#{self.class.name.to_s}>"
end
# assembles just the given attributes into the inspect string.
# @return [String] Human-readable presentation of the attributes
def to_inspectable
compact_attributes
end
- private :to_inspectable
protected
module ClassMethods
@@ -258,9 +262,10 @@
self.included do |base|
base.instance_eval do
extend Gorillib::Model::NamedSchema
extend Gorillib::Model::ClassMethods
+ self.meta_module
@_own_fields ||= {}
end
end
end