Module | Hobix::BaseProperties |
In: |
lib/hobix/base.rb
|
# File lib/hobix/base.rb, line 286 286: def self.append_features klass 287: super 288: klass.extend ClassMethods 289: end
Build a simple map of properties
# File lib/hobix/base.rb, line 264 264: def property_map 265: self.class.properties.map do |name, opts| 266: if opts 267: yreq = opts[:req] ? :req : :opt 268: ["@#{ name }", yreq] if yreq 269: end 270: end.compact 271: end
Build a property map for the YAML module
# File lib/hobix/base.rb, line 273 273: def to_yaml_properties 274: property_map.find_all do |prop, req| 275: case req 276: when :opt 277: not instance_variable_get( prop ).nil? 278: when :req 279: true 280: end 281: end. 282: collect do |prop, req| 283: prop 284: end 285: end