Class: Wombat::DSL::PropertyGroup

Inherits:
Hash
  • Object
show all
Defined in:
lib/wombat/dsl/property_group.rb

Direct Known Subclasses

Follower, Headers, Iterator, Metadata

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name = nil) ⇒ PropertyGroup

Returns a new instance of PropertyGroup.



8
9
10
# File 'lib/wombat/dsl/property_group.rb', line 8

def initialize(name = nil)
  @wombat_property_name = name
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/wombat/dsl/property_group.rb', line 12

def method_missing(method, *args, &block)
  property_name = method.to_s

  if args.empty? && block
    # TODO: Verify if another property with same name already exists
    # before overwriting
    property_group = self[property_name] || PropertyGroup.new(property_name)
    self[property_name] = property_group
    property_group.instance_eval(&block)
  else
    it = build_property(property_name, *args, &block)
    self[property_name] = it
    it.instance_eval(&block) if block_given? && !it.instance_of?(Property)
  end
end

Instance Attribute Details

#wombat_property_nameObject

Returns the value of attribute wombat_property_name.



6
7
8
# File 'lib/wombat/dsl/property_group.rb', line 6

def wombat_property_name
  @wombat_property_name
end

Instance Method Details

#to_aryObject



28
29
# File 'lib/wombat/dsl/property_group.rb', line 28

def to_ary
end

#wombat_property_formatObject



31
32
33
# File 'lib/wombat/dsl/property_group.rb', line 31

def wombat_property_format
  :container
end

#wombat_property_namespacesObject



35
36
37
# File 'lib/wombat/dsl/property_group.rb', line 35

def wombat_property_namespaces
  nil
end