Class: MVCLI::Cortex
Instance Method Summary collapse
- #<<(core) ⇒ Object
- #activate! ⇒ Object
- #each(&block) ⇒ Object
- #exists?(extension_point, extension_name) ⇒ Boolean
-
#initialize {|_self| ... } ⇒ Cortex
constructor
A new instance of Cortex.
- #read(extension_point, extension_name) ⇒ Object
Constructor Details
#initialize {|_self| ... } ⇒ Cortex
Returns a new instance of Cortex.
7 8 9 10 |
# File 'lib/mvcli/cortex.rb', line 7 def initialize @cores = [] yield self if block_given? end |
Instance Method Details
#<<(core) ⇒ Object
16 17 18 19 20 |
# File 'lib/mvcli/cortex.rb', line 16 def <<(core) tap do @cores << core end end |
#activate! ⇒ Object
12 13 14 |
# File 'lib/mvcli/cortex.rb', line 12 def activate! each(&:activate!) end |
#each(&block) ⇒ Object
22 23 24 |
# File 'lib/mvcli/cortex.rb', line 22 def each(&block) @cores.each &block end |
#exists?(extension_point, extension_name) ⇒ Boolean
26 27 28 |
# File 'lib/mvcli/cortex.rb', line 26 def exists?(extension_point, extension_name) @cores.detect {|core| core.exists? extension_point, extension_name } end |
#read(extension_point, extension_name) ⇒ Object
30 31 32 33 34 35 36 |
# File 'lib/mvcli/cortex.rb', line 30 def read(extension_point, extension_name) if core = exists?(extension_point, extension_name) core.read extension_point, extension_name else fail MVCLI::ExtensionNotFound, "unable to find #{extension_point} '#{extension_name}'" end end |