module Dataflow::PropertiesMixin::ClassMethods

Public Instance Methods

add_property(name, opts) click to toggle source
# File lib/dataflow/properties_mixin.rb, line 18
def add_property(name, opts)
  # skip properties that start by underscore
  return if name =~ /^_/
  @properties ||= {}
  @properties[name] ||= {}
  @properties[name].merge!(opts)
end
field(name, opts = {}) click to toggle source

Override the mongoid `field` method to produce a list of properties for each node.

Calls superclass method
# File lib/dataflow/properties_mixin.rb, line 9
def field(name, opts = {})
  add_property(name, opts)
  # make sure we pass mongoid-only keys to the superclass
  opts.delete(:editable)
  opts.delete(:required_for_computing)
  opts.delete(:values)
  super
end
properties() click to toggle source
# File lib/dataflow/properties_mixin.rb, line 26
def properties
  @properties ||= {}
  @properties.merge(superclass.properties)
rescue NoMethodError => e
  # handle cases where we're already on top of the hierarchy.
  @properties
end