Module: Plotrb::Base::ClassMethods

Defined in:
lib/plotrb/base.rb

Instance Method Summary collapse

Instance Method Details

#add_attributes(*vars) ⇒ Object

add setter methods to attributes



13
14
15
16
17
18
19
20
21
# File 'lib/plotrb/base.rb', line 13

def add_attributes(*vars)
  @attributes ||= []
  @attributes.concat(vars)
  vars.each do |var|
    define_method("#{var}=") { |value|
      instance_variable_set("@#{var}", value)
    }
  end
end

#attributesObject



23
24
25
# File 'lib/plotrb/base.rb', line 23

def attributes
  @attributes
end