Class: MVCLI::Core
Defined Under Namespace
Classes: Std
Class Attribute Summary collapse
-
.identifier ⇒ Object
Returns the value of attribute identifier.
-
.namespace ⇒ Object
Returns the value of attribute namespace.
-
.path ⇒ Object
Returns the value of attribute path.
-
.version ⇒ Object
Returns the value of attribute version.
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#namespace ⇒ Object
Returns the value of attribute namespace.
-
#path ⇒ Object
Returns the value of attribute path.
Class Method Summary collapse
- .<<(base) ⇒ Object
- .all ⇒ Object
- .drain(&visitor) ⇒ Object
- .each(&visitor) ⇒ Object
- .inherited(base) ⇒ Object
Instance Method Summary collapse
- #activate! ⇒ Object
- #exists?(extension_type, name) ⇒ Boolean
-
#initialize(options = {}) ⇒ Core
constructor
A new instance of Core.
- #read(extension_type, name, options = {}) ⇒ Object
- #version ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Core
Returns a new instance of Core.
14 15 16 17 18 19 |
# File 'lib/mvcli/core.rb', line 14 def initialize( = {}) = Map @path = [:path] @name = [:name] @namespace = [:namespace] end |
Class Attribute Details
.identifier ⇒ Object
Returns the value of attribute identifier.
72 73 74 |
# File 'lib/mvcli/core.rb', line 72 def identifier @identifier end |
.namespace ⇒ Object
Returns the value of attribute namespace.
72 73 74 |
# File 'lib/mvcli/core.rb', line 72 def namespace @namespace end |
.path ⇒ Object
Returns the value of attribute path.
72 73 74 |
# File 'lib/mvcli/core.rb', line 72 def path @path end |
.version ⇒ Object
Returns the value of attribute version.
72 73 74 |
# File 'lib/mvcli/core.rb', line 72 def version @version end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
12 13 14 |
# File 'lib/mvcli/core.rb', line 12 def name @name end |
#namespace ⇒ Object
Returns the value of attribute namespace.
12 13 14 |
# File 'lib/mvcli/core.rb', line 12 def namespace @namespace end |
#path ⇒ Object
Returns the value of attribute path.
12 13 14 |
# File 'lib/mvcli/core.rb', line 12 def path @path end |
Class Method Details
.<<(base) ⇒ Object
82 83 84 |
# File 'lib/mvcli/core.rb', line 82 def <<(base) all << base end |
.all ⇒ Object
78 79 80 |
# File 'lib/mvcli/core.rb', line 78 def all @all ||= [] end |
.drain(&visitor) ⇒ Object
90 91 92 93 |
# File 'lib/mvcli/core.rb', line 90 def drain(&visitor) each &visitor all.clear end |
.each(&visitor) ⇒ Object
86 87 88 |
# File 'lib/mvcli/core.rb', line 86 def each(&visitor) all.each &visitor end |
Instance Method Details
#activate! ⇒ Object
21 22 |
# File 'lib/mvcli/core.rb', line 21 def activate! end |
#exists?(extension_type, name) ⇒ Boolean
43 44 45 |
# File 'lib/mvcli/core.rb', line 43 def exists?(extension_type, name) loader.exists? path, extension_type, name end |
#read(extension_type, name, options = {}) ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/mvcli/core.rb', line 47 def read(extension_type, name, = {}) unless exists? extension_type, name fail ExtensionNotFound, "unable to locate #{extension_type} '#{name}'" end this = self loader.read(path, extension_type, name, namespace).tap do |ext| [ext, ext.singleton_class].each do |cls| cls.send(:define_method, :core) { this } if cls.respond_to?(:define_method, true) end end end |
#version ⇒ Object
38 39 40 41 |
# File 'lib/mvcli/core.rb', line 38 def version spec = Gem::Specification.load path.nearest('.gemspec$').to_s spec.version end |