Module: Ruckus::StructureDetectFactory

Defined in:
lib/ruckus/structure/factory.rb

Instance Method Summary collapse

Instance Method Details

#factory?Boolean

Returns:

  • (Boolean)


3
4
5
6
7
# File 'lib/ruckus/structure/factory.rb', line 3

def factory?
    # self.respond_to? :factory
    # self.structure_field_names.try(:has_key?, :decides)
    @factory ||=false
end

#structure_field_def_hook(*a) ⇒ Object



9
10
11
12
13
14
15
16
17
# File 'lib/ruckus/structure/factory.rb', line 9

def structure_field_def_hook(*a)
    args = a[0]
    opts = args[0].respond_to?(:has_key?) ? args[0] : args[1]
    if opts.try(:has_key?, :decides)
      include StructureFactory
      self.instance_eval{@factory = true}
    end
    super
end