module RgGen::Core::Utility::AttributeSetter::Extension
Constants
- DEFAULT_VALUE
Public Instance Methods
attributes()
click to toggle source
# File lib/rggen/core/utility/attribute_setter.rb, line 8 def attributes @attributes ||= [] end
Private Instance Methods
define_attribute(name, default_value = nil)
click to toggle source
# File lib/rggen/core/utility/attribute_setter.rb, line 16 def define_attribute(name, default_value = nil) attributes << name.to_sym variable_name = "@#{name}" define_method(name) do |value = DEFAULT_VALUE| if value.equal?(DEFAULT_VALUE) attribute_value_get(variable_name, default_value) else instance_variable_set(variable_name, value) end end end
inherited(subclass)
click to toggle source
Calls superclass method
# File lib/rggen/core/utility/attribute_setter.rb, line 28 def inherited(subclass) super export_instance_variable(:@attributes, subclass, &:dup) end