Class: Cucumber::The::Registry

Inherits:
Object
  • Object
show all
Defined in:
lib/cucumber-the/registry.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args) ⇒ Object



16
17
18
19
20
21
22
23
# File 'lib/cucumber-the/registry.rb', line 16

def method_missing(name, *args)
  key_name = name.to_s
  if key_name.chomp! '='
    self[key_name.to_sym] = args.first
  else
    self[name]
  end
end

Instance Method Details

#[](name) ⇒ Object



8
9
10
# File 'lib/cucumber-the/registry.rb', line 8

def [](name)
  thread_registry[name] || raise_error(name)
end

#[]=(name, value) ⇒ Object



4
5
6
# File 'lib/cucumber-the/registry.rb', line 4

def []=(name, value)
  thread_registry[name] = value
end

#clearObject



12
13
14
# File 'lib/cucumber-the/registry.rb', line 12

def clear
  thread_registry.clear
end

#responds_to(name) ⇒ Object



25
26
27
# File 'lib/cucumber-the/registry.rb', line 25

def responds_to(name, *)
  true
end