Class: Pairs::CleanRoom

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

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *args, &block) ⇒ Object



57
58
59
60
61
62
# File 'lib/pairs.rb', line 57

def method_missing(method_name, *args, &block)
  return super unless args.count == 1

  __items__[method_name] ||= []
  __items__[method_name] << args.first
end

Instance Method Details

#__constraints__Object



45
46
47
# File 'lib/pairs.rb', line 45

def __constraints__
  @__constraints__ ||= []
end

#__items__Object



49
50
51
# File 'lib/pairs.rb', line 49

def __items__
  @__items__ ||= {}
end

#constraint(&block) ⇒ Object



53
54
55
# File 'lib/pairs.rb', line 53

def constraint(&block)
  __constraints__ << block
end