Class: Adva::Generators::Gemfile
- Inherits:
-
Object
- Object
- Adva::Generators::Gemfile
- Defined in:
- lib/adva/generators/gemfile.rb
Instance Attribute Summary collapse
-
#engines ⇒ Object
readonly
Returns the value of attribute engines.
-
#source ⇒ Object
readonly
Returns the value of attribute source.
-
#target ⇒ Object
readonly
Returns the value of attribute target.
Instance Method Summary collapse
-
#initialize(target, options = {}) ⇒ Gemfile
constructor
A new instance of Gemfile.
- #write ⇒ Object
Constructor Details
#initialize(target, options = {}) ⇒ Gemfile
Returns a new instance of Gemfile.
6 7 8 9 10 11 |
# File 'lib/adva/generators/gemfile.rb', line 6 def initialize(target, = {}) self.engines = [:engines] @target = Pathname.new(target) @source = [:source] || raise('no source given') # TODO [cli] should bubble up to find the current Gemfile @engines = engines end |
Instance Attribute Details
#engines ⇒ Object
Returns the value of attribute engines.
4 5 6 |
# File 'lib/adva/generators/gemfile.rb', line 4 def engines @engines end |
#source ⇒ Object (readonly)
Returns the value of attribute source.
4 5 6 |
# File 'lib/adva/generators/gemfile.rb', line 4 def source @source end |
#target ⇒ Object (readonly)
Returns the value of attribute target.
4 5 6 |
# File 'lib/adva/generators/gemfile.rb', line 4 def target @target end |
Instance Method Details
#write ⇒ Object
13 14 15 |
# File 'lib/adva/generators/gemfile.rb', line 13 def write File.open(target, 'w+') { |f| f.write(with_engines) } end |