Class: Palmade::Cableguy::Cable
- Inherits:
-
Object
- Object
- Palmade::Cableguy::Cable
show all
- Defined in:
- lib/palmade/cableguy/cable.rb
Constant Summary
collapse
- @@builders =
{ }
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(*args, &block) ⇒ Cable
Returns a new instance of Cable.
30
31
32
33
|
# File 'lib/palmade/cableguy/cable.rb', line 30
def initialize(*args, &block)
@args = args
@block = block
end
|
Instance Attribute Details
#args ⇒ Object
Returns the value of attribute args.
3
4
5
|
# File 'lib/palmade/cableguy/cable.rb', line 3
def args
@args
end
|
Class Method Details
.add_as(key, klass = nil) ⇒ Object
10
11
12
|
# File 'lib/palmade/cableguy/cable.rb', line 10
def self.add_as(key, klass = nil)
builders[key] = klass || self
end
|
.build(what, *args, &block) ⇒ Object
18
19
20
21
22
23
24
|
# File 'lib/palmade/cableguy/cable.rb', line 18
def self.build(what, *args, &block)
if builders.include?(what)
builders[what].new(*args, &block)
else
raise ArgumentError, "Unknown builder: #{what} -- supports: #{supported_builders.join(', ')}"
end
end
|
.build_key(klass = nil) ⇒ Object
14
15
16
|
# File 'lib/palmade/cableguy/cable.rb', line 14
def self.build_key(klass = nil)
builders.index(klass || self)
end
|
.builders ⇒ Object
6
7
8
|
# File 'lib/palmade/cableguy/cable.rb', line 6
def self.builders
@@builders
end
|
.supported_builders ⇒ Object
26
27
28
|
# File 'lib/palmade/cableguy/cable.rb', line 26
def self.supported_builders
builders.keys
end
|
Instance Method Details
35
36
37
|
# File 'lib/palmade/cableguy/cable.rb', line 35
def configure(cabler, cabling, target, &block)
puts "Not implemented: #{self.class.build_key}"
end
|