Module: Resource::WithKey

Defined in:
lib/rbbt/resource/with_key.rb

Class Method Summary collapse

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args) ⇒ Object



10
11
12
13
14
15
16
17
# File 'lib/rbbt/resource/with_key.rb', line 10

def method_missing(name, *args)
  return old_method_missing(name, *args) if name.to_s =~ /^to_/
  if key
    klass.send(name, key, *args)
  else
    klass.send(name, *args)
  end
end

Class Method Details

.extended(base) ⇒ Object



3
4
5
6
7
# File 'lib/rbbt/resource/with_key.rb', line 3

def self.extended(base)
  class << base
    attr_accessor :klass, :key
  end
end

Instance Method Details

#old_method_missingObject



9
# File 'lib/rbbt/resource/with_key.rb', line 9

alias :old_method_missing :method_missing