Module: Wires
- Defined in:
- lib/wires/base.rb
Class Method Summary collapse
- .current_network ⇒ Object
- .current_network_name ⇒ Object
- .network(id = :main) ⇒ Object
- .replicate ⇒ Object
- .set_current_network(*args) ⇒ Object
Class Method Details
.current_network ⇒ Object
26 27 28 |
# File 'lib/wires/base.rb', line 26 def self.current_network @current_network ||= network end |
.current_network_name ⇒ Object
22 23 24 |
# File 'lib/wires/base.rb', line 22 def self.current_network_name @networks.each_pair.select{ |k,v| v==@current_network }.first.first end |
.network(id = :main) ⇒ Object
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/wires/base.rb', line 7 def self.network(id=:main) @networks ||= {main:Wires} @networks[id] = Module.new \ unless @networks.has_key? id @networks[id].const_set :Namespace, @networks[id] \ unless @networks[id].const_defined? :Namespace return @networks[id] end |
.replicate ⇒ Object
30 31 32 33 34 35 36 37 38 |
# File 'lib/wires/base.rb', line 30 def self.replicate save_name = Wires.current_network_name other = Wires.set_current_network Object.new load __FILE__ Wires.set_current_network save_name return other end |
.set_current_network(*args) ⇒ Object
18 19 20 |
# File 'lib/wires/base.rb', line 18 def self.set_current_network(*args) @current_network = network(*args) end |