Class: Brandish::Configure::DSL
- Inherits:
-
Object
- Object
- Brandish::Configure::DSL
- Defined in:
- lib/brandish/configure/dsl.rb,
lib/brandish/configure/dsl/form.rb
Overview
The DSL for configuration files for Brandish. This is used to construct a configure object.
Defined Under Namespace
Classes: Form
Class Method Summary collapse
-
.call(configure = Configure.new) ⇒ DSL
Creates a new DSL object with the given configuration object, and yields it.
Instance Method Summary collapse
-
#form(*arguments) {|form| ... } ⇒ void
Creates a new form for the configuration object.
-
#get(name) ⇒ ::Object
(also: #[])
Retrives a given option key.
-
#initialize(configure = Configure.new) ⇒ DSL
constructor
Creates a DSL object with the given configuration object.
-
#output ⇒ ::Pathname
(also: #output_path)
Retrieves the output directory of the Brandish project.
-
#output=(output) ⇒ void
(also: #output_path=)
Sets the output directory of the Brandish project.
-
#root ⇒ ::Pathname
(also: #root_path)
Retrieves the root path of the Brandish project.
-
#root=(root) ⇒ void
(also: #root_path=)
Sets the root path of the Brandish project.
-
#set(name, value) ⇒ void
(also: #[]=)
Sets a given option key to a value.
-
#sources ⇒ ::Pathname
(also: #source_paths)
Retrives the source directories of the Brandish project.
-
#templates ⇒ ::Pathname
(also: #template_paths)
Retrieves the template directory of the Brandish project.
Constructor Details
Class Method Details
Instance Method Details
#form(*arguments) {|form| ... } ⇒ void
This method returns an undefined value.
Creates a new form for the configuration object. This takes arguments and a block. The block is yielded the form instance.
120 121 122 123 124 125 126 |
# File 'lib/brandish/configure/dsl.rb', line 120 def form(*arguments) instance = DSL::Form.new(*arguments) yield instance form = Configure::Form.new(*instance.data) @configure.forms << form form end |
#get(name) ⇒ ::Object Also known as: []
Retrives a given option key. The name is interned, making it a symbol.
43 44 45 |
# File 'lib/brandish/configure/dsl.rb', line 43 def get(name) @configure..fetch(name) end |
#output ⇒ ::Pathname Also known as: output_path
Retrieves the output directory of the Brandish project. This is where all
of the outputs are placed. This is normally "./output"
.
85 86 87 |
# File 'lib/brandish/configure/dsl.rb', line 85 def output self[:output] end |
#output=(output) ⇒ void Also known as: output_path=
This method returns an undefined value.
Sets the output directory of the Brandish project. This is where all
of the outputs are placed. This is normally "./output"
.
76 77 78 79 |
# File 'lib/brandish/configure/dsl.rb', line 76 def output=(output) path = (output, root) self[:output] = path end |
#root ⇒ ::Pathname Also known as: root_path
Retrieves the root path of the Brandish project. This is where all of
the important files are located. Very rarely should this be set to
anything other than "."
.
64 65 66 |
# File 'lib/brandish/configure/dsl.rb', line 64 def root self[:root] end |
#root=(root) ⇒ void Also known as: root_path=
This method returns an undefined value.
Sets the root path of the Brandish project. This is where all of the
important files are located. Very rarely should this be set to
anything other than "."
.
54 55 56 57 |
# File 'lib/brandish/configure/dsl.rb', line 54 def root=(root) path = (root, Dir.pwd) self[:root] = path end |
#set(name, value) ⇒ void Also known as: []=
This method returns an undefined value.
Sets a given option key to a value. The name is interned, making it a symbol.
34 35 36 |
# File 'lib/brandish/configure/dsl.rb', line 34 def set(name, value) @configure.[name.intern] = value end |
#sources ⇒ ::Pathname Also known as: source_paths
Retrives the source directories of the Brandish project. This is where
all of the sources are located. This is normally "./source"
.
96 97 98 |
# File 'lib/brandish/configure/dsl.rb', line 96 def sources self[:sources] end |
#templates ⇒ ::Pathname Also known as: template_paths
Retrieves the template directory of the Brandish project. This is
where all of the templates are placed. This is normally "./template"
.
106 107 108 |
# File 'lib/brandish/configure/dsl.rb', line 106 def templates self[:templates] end |