Class: ParseGemspec::Specification

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/parse_gemspec/specification.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(spec) ⇒ Specification

Returns a new instance of Specification.



13
14
15
# File 'lib/parse_gemspec/specification.rb', line 13

def initialize(spec)
  @spec = spec
end

Class Method Details

.load(file) ⇒ Object



6
7
8
9
10
11
# File 'lib/parse_gemspec/specification.rb', line 6

def self.load(file)
  fail GemspecFileNotFoundError, "file: #{file}" unless File.file?(file)
  spec = Gem::Specification.load(file)
  fail ParseGemspecError, "file: #{file}" unless spec
  new(spec)
end

Instance Method Details

#to_hash_objectObject



17
18
19
20
21
22
23
# File 'lib/parse_gemspec/specification.rb', line 17

def to_hash_object
  {
    name: name,
    version: version.version,
    homepage: homepage
  }
end