Class: Biran::ERBConfig
- Inherits:
-
Object
- Object
- Biran::ERBConfig
- Defined in:
- lib/biran/erb_config.rb
Constant Summary collapse
- DEFAULT_TEMPLATE_CONFIG_INDEX =
1
Instance Attribute Summary collapse
-
#bindings ⇒ Object
Returns the value of attribute bindings.
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#extension ⇒ Object
readonly
Returns the value of attribute extension.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#output_dir ⇒ Object
readonly
Returns the value of attribute output_dir.
-
#output_name ⇒ Object
Returns the value of attribute output_name.
-
#source_dir ⇒ Object
readonly
Returns the value of attribute source_dir.
-
#template_config_index ⇒ Object
Returns the value of attribute template_config_index.
-
#template_contents ⇒ Object
readonly
Returns the value of attribute template_contents.
Instance Method Summary collapse
-
#initialize(config, name, extension, source, output_dir, output_name) ⇒ ERBConfig
constructor
A new instance of ERBConfig.
- #save! ⇒ Object
Constructor Details
#initialize(config, name, extension, source, output_dir, output_name) ⇒ ERBConfig
Returns a new instance of ERBConfig.
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/biran/erb_config.rb', line 8 def initialize(config, name, extension, source, output_dir, output_name) before_process_erb do @name = name @extension = extension @config = config @source_dir = source @output_dir = output_dir @output_name = output_name end end |
Instance Attribute Details
#bindings ⇒ Object
Returns the value of attribute bindings.
4 5 6 |
# File 'lib/biran/erb_config.rb', line 4 def bindings @bindings end |
#config ⇒ Object (readonly)
Returns the value of attribute config.
3 4 5 |
# File 'lib/biran/erb_config.rb', line 3 def config @config end |
#extension ⇒ Object (readonly)
Returns the value of attribute extension.
3 4 5 |
# File 'lib/biran/erb_config.rb', line 3 def extension @extension end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/biran/erb_config.rb', line 3 def name @name end |
#output_dir ⇒ Object (readonly)
Returns the value of attribute output_dir.
3 4 5 |
# File 'lib/biran/erb_config.rb', line 3 def output_dir @output_dir end |
#output_name ⇒ Object
Returns the value of attribute output_name.
4 5 6 |
# File 'lib/biran/erb_config.rb', line 4 def output_name @output_name end |
#source_dir ⇒ Object (readonly)
Returns the value of attribute source_dir.
3 4 5 |
# File 'lib/biran/erb_config.rb', line 3 def source_dir @source_dir end |
#template_config_index ⇒ Object
Returns the value of attribute template_config_index.
4 5 6 |
# File 'lib/biran/erb_config.rb', line 4 def template_config_index @template_config_index end |
#template_contents ⇒ Object (readonly)
Returns the value of attribute template_contents.
3 4 5 |
# File 'lib/biran/erb_config.rb', line 3 def template_contents @template_contents end |
Instance Method Details
#save! ⇒ Object
19 20 21 22 23 |
# File 'lib/biran/erb_config.rb', line 19 def save! File.open(File.join(output_dir, "#{output_name}#{extension}"), 'w') do |f| f.print template_contents.result(build_erb_env.call) end end |