module RgGen::Core::Utility::AttributeSetter

Public Class Methods

included(class_or_module) click to toggle source
# File lib/rggen/core/utility/attribute_setter.rb, line 34
def self.included(class_or_module)
  class_or_module.extend(Extension)
end

Public Instance Methods

apply_attributes(**attributes) click to toggle source
# File lib/rggen/core/utility/attribute_setter.rb, line 38
def apply_attributes(**attributes)
  attributes.each do |name, value|
    __send__(name, value) if self.class.attributes.include?(name)
  end
end

Private Instance Methods

attribute_value_get(variable_name, default_value) click to toggle source
# File lib/rggen/core/utility/attribute_setter.rb, line 46
def attribute_value_get(variable_name, default_value)
  if instance_variable_defined?(variable_name)
    instance_variable_get(variable_name)
  elsif default_value.is_a?(Proc)
    instance_exec(&default_value)
  else
    default_value
  end
end