Class: Aspector::DeferredOption

Inherits:
Object
  • Object
show all
Defined in:
lib/aspector/deferred_option.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(key = nil) ⇒ DeferredOption

Returns a new instance of DeferredOption.



6
7
8
# File 'lib/aspector/deferred_option.rb', line 6

def initialize key = nil
  @key = key
end

Instance Attribute Details

#keyObject (readonly)

Returns the value of attribute key.



4
5
6
# File 'lib/aspector/deferred_option.rb', line 4

def key
  @key
end

Instance Method Details

#[](key) ⇒ Object



10
11
12
13
# File 'lib/aspector/deferred_option.rb', line 10

def [] key
  @key = key
  self
end

#to_sObject



15
16
17
18
19
20
21
# File 'lib/aspector/deferred_option.rb', line 15

def to_s
  if key
    "options[#{key.inspect}]"
  else
    "options[?]"
  end
end