Class: Class

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

Instance Method Summary collapse

Instance Method Details

#interchangeable_describe(description) ⇒ Object



7
8
9
# File 'lib/interchangeable.rb', line 7

def interchangeable_describe description
  @interchangeable_description = description
end

#interchangeable_method(*args, &block) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/interchangeable.rb', line 11

def interchangeable_method *args, &block
  description = @interchangeable_description
  @interchangeable_description = nil
  entry = Struct.new(:method_name, :target, :implemented, :default, :description)
                .new(args[0], self, false, false, description)
  Interchangeable.methods << entry
  if block
    Interchangeable.define self, args[0], &block
    entry.default = true
  end
end