Module: Buildozer::Dsl::Compiler
- Defined in:
- lib/buildozer/dsl/compiler.rb,
lib/buildozer/dsl/compiler/validator.rb,
lib/buildozer/dsl/compiler/exceptions.rb
Defined Under Namespace
Modules: Validator Classes: InvalidDslDefinition, InvalidDslFragment, InvalidDslPackage
Class Method Summary collapse
- .compile(fragment) ⇒ Object
-
.compile_definition(definition) ⇒ Object
Function that receives a dsl definition and compile it to a model definition.
-
.compile_package(package) ⇒ Object
Function that receives a dsl package and compile it to a model package.
Class Method Details
.compile(fragment) ⇒ Object
9 10 11 12 13 |
# File 'lib/buildozer/dsl/compiler.rb', line 9 def self.compile(fragment) Validator.validate_fragment(fragment); send("compile_#{fragment.type()}", fragment) end |
.compile_definition(definition) ⇒ Object
Function that receives a dsl definition and compile it to a model definition. This compilation is done mainly to report user-friendly error when dsl definition is invalid
20 21 22 23 24 25 26 27 |
# File 'lib/buildozer/dsl/compiler.rb', line 20 def self.compile_definition(definition) Validator.validate_definition(definition); = definition.() return Model::Definition.new({ :packages => [:packages].map { |package| compile(package) } }) end |
.compile_package(package) ⇒ Object
Function that receives a dsl package and compile it to a model package. This compilation is done mainly to report user-friendly error when dsl package is invalid
34 35 36 37 38 |
# File 'lib/buildozer/dsl/compiler.rb', line 34 def self.compile_package(package) Validator.validate_package(package); return Model::Package.new(package.()) end |