Class: ComponentizeAny::Witty
- Inherits:
-
Object
- Object
- ComponentizeAny::Witty
- Defined in:
- lib/componentize_any/dsl.rb
Defined Under Namespace
Classes: Interface, Member, Package
Class Attribute Summary collapse
-
.global_wit ⇒ Object
Returns the value of attribute global_wit.
Instance Attribute Summary collapse
-
#exports ⇒ Object
readonly
Returns the value of attribute exports.
-
#imports ⇒ Object
readonly
Returns the value of attribute imports.
-
#packages ⇒ Object
readonly
Returns the value of attribute packages.
Instance Method Summary collapse
- #export(name) ⇒ Object
-
#initialize ⇒ Witty
constructor
A new instance of Witty.
- #package(name, &blk) ⇒ Object
- #world(&blk) ⇒ Object
Constructor Details
#initialize ⇒ Witty
Returns a new instance of Witty.
79 80 81 82 83 |
# File 'lib/componentize_any/dsl.rb', line 79 def initialize @packages = {} @exports = [] @imports = [] end |
Class Attribute Details
.global_wit ⇒ Object
Returns the value of attribute global_wit.
3 4 5 |
# File 'lib/componentize_any/dsl.rb', line 3 def global_wit @global_wit end |
Instance Attribute Details
#exports ⇒ Object (readonly)
Returns the value of attribute exports.
54 55 56 |
# File 'lib/componentize_any/dsl.rb', line 54 def exports @exports end |
#imports ⇒ Object (readonly)
Returns the value of attribute imports.
55 56 57 |
# File 'lib/componentize_any/dsl.rb', line 55 def imports @imports end |
#packages ⇒ Object (readonly)
Returns the value of attribute packages.
53 54 55 |
# File 'lib/componentize_any/dsl.rb', line 53 def packages @packages end |
Instance Method Details
#export(name) ⇒ Object
61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/componentize_any/dsl.rb', line 61 def export(name) export = nil re = /^(\w+):(\w+)\/(\w+)@(\d+\.\d+\.\d+)$/ re.match(name)&.tap do |re| export = ExportName.new re[1], re[2], re[3], re[4] end if export.nil? raise "invalid export name: #{name}" end @exports << export end |
#package(name, &blk) ⇒ Object
73 74 75 76 77 |
# File 'lib/componentize_any/dsl.rb', line 73 def package(name, &blk) pkg = Package.new @packages[name] = pkg pkg.instance_eval(&blk) end |
#world(&blk) ⇒ Object
57 58 59 |
# File 'lib/componentize_any/dsl.rb', line 57 def world(&blk) instance_eval(&blk) end |