Class: Waves::Configurations::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/runtime/configuration.rb

Direct Known Subclasses

Default

Class Method Summary collapse

Class Method Details

.[](name) ⇒ Object

Get the value of the given attribute. Typically, you wouldn’t use this directly.



126
# File 'lib/runtime/configuration.rb', line 126

def self.[]( name ) ; send "_#{name}" ; end

.[]=(name, val) ⇒ Object

Set the given attribute with the given value. Typically, you wouldn’t use this directly.



120
121
122
# File 'lib/runtime/configuration.rb', line 120

def self.[]=( name, val )
  meta_def("_#{name}") { val }
end

.attribute(name) ⇒ Object

Define a new attribute. After calling this, you can get and set the value.



129
130
131
132
133
134
135
# File 'lib/runtime/configuration.rb', line 129

def self.attribute( name )
  meta_def(name) do |*args|
    raise ArgumentError.new('Too many arguments.') if args.length > 1
    args.length == 1 ? self[ name ] = args.first : self[ name ]
  end
  self[ name ] = nil
end