Class: Gitabu::Builder
- Inherits:
-
Object
- Object
- Gitabu::Builder
- Includes:
- ERB::Util
- Defined in:
- lib/gitabu/builder.rb
Overview
Builder class for files given target and template.
Instance Attribute Summary collapse
-
#class_name ⇒ Object
Returns the value of attribute class_name.
-
#items ⇒ Object
Returns the value of attribute items.
-
#target ⇒ Object
Returns the value of attribute target.
-
#template ⇒ Object
Returns the value of attribute template.
-
#version ⇒ Object
Returns the value of attribute version.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(class_name, items, target, template, version) ⇒ Builder
constructor
A new instance of Builder.
- #save ⇒ Object
Constructor Details
#initialize(class_name, items, target, template, version) ⇒ Builder
Returns a new instance of Builder.
17 18 19 20 21 22 23 |
# File 'lib/gitabu/builder.rb', line 17 def initialize(class_name, items, target, template, version) @class_name = class_name @items = items @target = target @template = template @version = version end |
Instance Attribute Details
#class_name ⇒ Object
Returns the value of attribute class_name.
11 12 13 |
# File 'lib/gitabu/builder.rb', line 11 def class_name @class_name end |
#items ⇒ Object
Returns the value of attribute items.
11 12 13 |
# File 'lib/gitabu/builder.rb', line 11 def items @items end |
#target ⇒ Object
Returns the value of attribute target.
11 12 13 |
# File 'lib/gitabu/builder.rb', line 11 def target @target end |
#template ⇒ Object
Returns the value of attribute template.
11 12 13 |
# File 'lib/gitabu/builder.rb', line 11 def template @template end |
#version ⇒ Object
Returns the value of attribute version.
11 12 13 |
# File 'lib/gitabu/builder.rb', line 11 def version @version end |
Class Method Details
.save(class_name:, items:, target:, template:, version:) ⇒ Object
13 14 15 |
# File 'lib/gitabu/builder.rb', line 13 def self.save(class_name:, items:, target:, template:, version:) new(class_name, items, target, template, version).save end |
Instance Method Details
#save ⇒ Object
25 26 27 28 29 |
# File 'lib/gitabu/builder.rb', line 25 def save File.open(target, "w+") do |f| f.write(render) end end |