Class: Bandoleer::Outfitter
- Inherits:
-
Thor::Group
- Object
- Thor::Group
- Bandoleer::Outfitter
- Includes:
- ErbHelper, Thor::Actions
- Defined in:
- lib/bandoleer/outfitter.rb
Overview
Generator for bandoleer template files.
Instance Attribute Summary collapse
-
#const_arr ⇒ Object
readonly
Returns the value of attribute const_arr.
-
#content ⇒ Object
readonly
Returns the value of attribute content.
-
#file_name ⇒ Object
readonly
Returns the value of attribute file_name.
-
#vials ⇒ Object
readonly
Returns the value of attribute vials.
Instance Method Summary collapse
-
#craft_bandoleer ⇒ Object
Create and populate a bandoleer template file using assigned variables.
-
#prepare_materials ⇒ Object
Assign instance variables needed for crafting a fresh bandoleer.
Methods included from ErbHelper
Instance Attribute Details
#const_arr ⇒ Object (readonly)
Returns the value of attribute const_arr.
11 12 13 |
# File 'lib/bandoleer/outfitter.rb', line 11 def const_arr @const_arr end |
#content ⇒ Object (readonly)
Returns the value of attribute content.
11 12 13 |
# File 'lib/bandoleer/outfitter.rb', line 11 def content @content end |
#file_name ⇒ Object (readonly)
Returns the value of attribute file_name.
11 12 13 |
# File 'lib/bandoleer/outfitter.rb', line 11 def file_name @file_name end |
#vials ⇒ Object (readonly)
Returns the value of attribute vials.
11 12 13 |
# File 'lib/bandoleer/outfitter.rb', line 11 def vials @vials end |
Instance Method Details
#craft_bandoleer ⇒ Object
Create and populate a bandoleer template file using assigned variables.
23 24 25 26 27 28 |
# File 'lib/bandoleer/outfitter.rb', line 23 def craft_bandoleer @vials = format_vials @content = fill_erb_template('vials') wrap_content template '%file_name%.rb.tt' end |
#prepare_materials ⇒ Object
Assign instance variables needed for crafting a fresh bandoleer.
16 17 18 19 20 |
# File 'lib/bandoleer/outfitter.rb', line 16 def prepare_materials @const_arr = const_name.split('/') @file_name = const_arr.last @const_arr.map! {|const| const.split('_').map(&:capitalize).join } end |