Sha256: 6152fa7d6e0adc2e221ae6f1168e009764fa74d27283b0ac5aec2b79bcf19210

Contents?: true

Size: 751 Bytes

Versions: 1

Compression:

Stored size: 751 Bytes

Contents

require "mvcli/core"

module MVCLI
  class Cortex
    include Enumerable

    def initialize
      @cores = []
      yield self if block_given?
    end

    def activate!
      each(&:activate!)
    end

    def <<(core)
      tap do
        @cores << core
      end
    end

    def each(&block)
      @cores.each &block
    end

    def exists?(extension_point, extension_name)
      @cores.detect {|core| core.exists? extension_point, extension_name }
    end

    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
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mvcli-0.1.0 lib/mvcli/cortex.rb