Class: Ruport::Controller::Options

Inherits:
OpenStruct
  • Object
show all
Defined in:
lib/ruport/controller.rb

Overview

Structure for holding controller options.

Simplified version of HashWithIndifferentAccess

Direct Known Subclasses

Formatter::Template

Instance Method Summary collapse

Instance Method Details

#[](key) ⇒ Object

Indifferent lookup of an attribute, e.g.

options[:foo] == options["foo"]


41
42
43
# File 'lib/ruport/controller.rb', line 41

def [](key)
  send(key)
end

#[]=(key, value) ⇒ Object

Sets an attribute, with indifferent access.

options[:foo] = "bar"  

options[:foo] == options["foo"] #=> true
options["foo"] == options.foo #=> true
options.foo #=> "bar"


52
53
54
# File 'lib/ruport/controller.rb', line 52

def []=(key,value)
  send("#{key}=",value)
end

#to_hashObject

Returns a Hash object. Use this if you need methods other than []



35
36
37
# File 'lib/ruport/controller.rb', line 35

def to_hash
  @table
end