Module: ProjectStore::Entity::PropertyBinder

Included in:
CommonProperties, MandatoryProperties
Defined in:
lib/project_store/entity/property_binder.rb

Instance Method Summary collapse

Instance Method Details

#mandatory_propertiesObject



33
34
35
# File 'lib/project_store/entity/property_binder.rb', line 33

def mandatory_properties
  @mandatory_properties ||= []
end

#mandatory_property(*properties) ⇒ Object



37
38
39
40
41
# File 'lib/project_store/entity/property_binder.rb', line 37

def mandatory_property(*properties)
  properties.each do |property|
    mandatory_properties << property
  end
end

#yaml_accessor(*yaml_properties) ⇒ Object



6
7
8
9
10
11
# File 'lib/project_store/entity/property_binder.rb', line 6

def yaml_accessor(*yaml_properties)
  yaml_properties.each do |yaml_property|
    yaml_reader yaml_property
    yaml_writer yaml_property
  end
end

#yaml_reader(*yaml_properties) ⇒ Object



13
14
15
16
17
18
19
20
21
# File 'lib/project_store/entity/property_binder.rb', line 13

def yaml_reader(*yaml_properties)
  yaml_properties.each do |yaml_property|
    self.class_eval do
      define_method yaml_property do
        self[yaml_property]
      end
    end
  end
end

#yaml_writer(*yaml_properties) ⇒ Object



23
24
25
26
27
28
29
30
31
# File 'lib/project_store/entity/property_binder.rb', line 23

def yaml_writer(*yaml_properties)
  yaml_properties.each do |yaml_property|
    self.class_eval do
      define_method "#{yaml_property}=" do |val|
        self[yaml_property] = val
      end
    end
  end
end