Class: Waves::Configurations::Base
- Defined in:
- lib/runtime/configuration.rb
Direct Known Subclasses
Class Method Summary collapse
-
.[](name) ⇒ Object
Get the value of the given attribute.
-
.[]=(name, val) ⇒ Object
Set the given attribute with the given value.
-
.attribute(name) ⇒ Object
Define a new attribute.
Class Method Details
.[](name) ⇒ Object
Get the value of the given attribute. Typically, you wouldn’t use this directly.
123 |
# File 'lib/runtime/configuration.rb', line 123 def self.[]( name ) ; send "_#{name}" ; end |
.[]=(name, val) ⇒ Object
Set the given attribute with the given value. Typically, you wouldn’t use this directly.
117 118 119 |
# File 'lib/runtime/configuration.rb', line 117 def self.[]=( name, val ) ("_#{name}") { val } end |
.attribute(name) ⇒ Object
Define a new attribute. After calling this, you can get and set the value using the attribute name as the method
127 128 129 130 131 132 133 |
# File 'lib/runtime/configuration.rb', line 127 def self.attribute( name ) (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 |