lib/glue/property.rb in glue-0.29.0 vs lib/glue/property.rb in glue-0.30.0

- old
+ new

@@ -1,22 +1,28 @@ require 'facet/annotation' require 'facet/inheritor' require 'facet/dictionary' +require 'facets/core/module/on_included' +require 'facets/more/aspects' -require 'glue/on_included' require 'glue/validation' -require 'glue/aspects' require 'og/entity' require 'og/relation/all' # A convienience structure that holds property -# metadata. +# metadata. A property is a special type of class annotation. +# Typically used in Og managed classes (ie Entities), but it +# is *not* Og specific. #-- # TODO: reimplement type checking. +# TODO: try to clean this up. #++ class Property + + # The hash used to store the property options. + attr_accessor :hash def initialize(hash) @hash = hash @hash = @hash.to_h unless @hash.is_a?(Hash) @@ -37,17 +43,15 @@ def to_s @hash[:symbol].to_s end alias_method :name, :to_s -end -# Property related utils and helpers. + # :section: Property related utils and helpers. -class Property class << self - + # Populate an object from a hash of values. # This is a truly dangerous method. # # === Options: # * name @@ -258,11 +262,11 @@ properties![a] = Property.new(ah) Property.eval_helpers(#{writer}, self, a, harg[:klass]) } end end - + Module.__add_prop_hook__(self) end } module_eval(code) @@ -273,10 +277,10 @@ # TODO: factor in eval_helpers into the hook! def self.__add_prop_hook__(m) m.send(:include, Og::EntityMixin) unless m.ancestors.include?(Og::EntityMixin) m.send(:include, Glue::Validation) unless m.ancestors.include?(Glue::Validation) - m.send(:include, Glue::Aspects) unless m.ancestors.include?(Glue::Aspects) + m.send(:include, ::Aspects) unless m.ancestors.include?(::Aspects) end end # * George Moschovitis <gm@navel.gr>