Class: Avm::EacRubyBase1::Rubygems::Gemspec

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

Defined Under Namespace

Classes: AddOrReplaceGemLine, Dependency

Constant Summary collapse

DEPENDENCY_LINE_PARSER =
/s\.add([a-zA-Z0-9_]*)_dependency\s*'(\S+)'/
.to_parser { |m| [m[2], m[1]] }

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.from_file(path) ⇒ Object



14
15
16
# File 'lib/avm/eac_ruby_base1/rubygems/gemspec.rb', line 14

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

Instance Method Details

#dependenciesArray<Avm::EacRubyBase1::Bundler::Gemfile::Dependency>



28
29
30
# File 'lib/avm/eac_ruby_base1/rubygems/gemspec.rb', line 28

def dependencies
  dependencies_hash.values
end

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

Parameters:

  • gem_name (String)

Returns:



23
24
25
# File 'lib/avm/eac_ruby_base1/rubygems/gemspec.rb', line 23

def dependency(gem_name)
  dependencies_hash.fetch(gem_name)
end

#to_textObject



36
37
38
# File 'lib/avm/eac_ruby_base1/rubygems/gemspec.rb', line 36

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

#write(path) ⇒ Object



32
33
34
# File 'lib/avm/eac_ruby_base1/rubygems/gemspec.rb', line 32

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