Class: Avm::EacRubyBase1::Bundler::Gemfile

Inherits:
Object
  • Object
show all
Defined in:
lib/avm/eac_ruby_base1/bundler/gemfile.rb,
lib/avm/eac_ruby_base1/bundler/gemfile/dependency.rb,
lib/avm/eac_ruby_base1/bundler/gemfile/add_or_replace_gem_line.rb

Defined Under Namespace

Classes: AddOrReplaceGemLine, Dependency

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.from_file(path) ⇒ Object



10
11
12
# File 'lib/avm/eac_ruby_base1/bundler/gemfile.rb', line 10

def from_file(path)
  new(path.read.each_line.map(&:rstrip))
end

Instance Method Details

#dependency(gem_name) ⇒ Avm::EacRubyBase1::Bundler::Gemfile::Dependency



18
19
20
# File 'lib/avm/eac_ruby_base1/bundler/gemfile.rb', line 18

def dependency(gem_name)
  ::Avm::EacRubyBase1::Bundler::Gemfile::Dependency.new(self, gem_name)
end

#to_textObject



26
27
28
# File 'lib/avm/eac_ruby_base1/bundler/gemfile.rb', line 26

def to_text
  lines.map { |line| "#{line}\n" }.join
end

#write(path) ⇒ Object



22
23
24
# File 'lib/avm/eac_ruby_base1/bundler/gemfile.rb', line 22

def write(path)
  path.to_pathname.write(to_text)
end