Class: Gemnasium::Parser::Gemfile

Inherits:
Object
  • Object
show all
Defined in:
lib/gemnasium/parser/gemfile.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(content) ⇒ Gemfile

Returns a new instance of Gemfile.



9
10
11
# File 'lib/gemnasium/parser/gemfile.rb', line 9

def initialize(content)
  @content = content
end

Instance Attribute Details

#contentObject (readonly)

Returns the value of attribute content.



7
8
9
# File 'lib/gemnasium/parser/gemfile.rb', line 7

def content
  @content
end

Instance Method Details

#dependenciesObject



13
14
15
16
17
18
19
20
# File 'lib/gemnasium/parser/gemfile.rb', line 13

def dependencies
  @dependencies ||= [].tap do |deps|
    gem_matches.each do |match|
      dep = dependency(match)
      deps << dep if dep
    end
  end
end

#gemspecObject



22
23
24
25
26
27
28
29
# File 'lib/gemnasium/parser/gemfile.rb', line 22

def gemspec
  @gemspec = if gemspec_match
    opts = Patterns.options(gemspec_match["opts"])
    path = opts["path"]
    name = opts["name"] || "*"
    File.join(*[path, "#{name}.gemspec"].compact)
  end
end

#gemspec?Boolean

Returns:

  • (Boolean)


31
32
33
# File 'lib/gemnasium/parser/gemfile.rb', line 31

def gemspec?
  !!gemspec
end