Class: Gemgate::GemWrapper

Inherits:
Object
  • Object
show all
Defined in:
lib/gemgate/gem_wrapper.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#pathObject

Returns the value of attribute path.



10
11
12
# File 'lib/gemgate/gem_wrapper.rb', line 10

def path
  @path
end

#specObject

Returns the value of attribute spec.



10
11
12
# File 'lib/gemgate/gem_wrapper.rb', line 10

def spec
  @spec
end

Class Method Details

.from_path(path) ⇒ Object



3
4
5
6
7
8
# File 'lib/gemgate/gem_wrapper.rb', line 3

def self.from_path(path)
  new.tap do |gem_wrapper|
    gem_wrapper.spec = Gem::Package.open(File.open(path)) {|p| p. }
    gem_wrapper.path = path
  end
end

Instance Method Details

#dataObject



38
39
40
# File 'lib/gemgate/gem_wrapper.rb', line 38

def data
  File.open(path)
end

#filenameObject



12
13
14
# File 'lib/gemgate/gem_wrapper.rb', line 12

def filename
  spec.file_name
end

#nameObject



20
21
22
# File 'lib/gemgate/gem_wrapper.rb', line 20

def name
  spec.name
end

#platformObject



32
33
34
35
36
# File 'lib/gemgate/gem_wrapper.rb', line 32

def platform
  platform = spec.original_platform
  platform = Gem::Platform::RUBY if platform.nil? or platform.empty?
  platform
end

#prerelease?Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/gemgate/gem_wrapper.rb', line 28

def prerelease?
  spec.version.prerelease?
end

#spec_filenameObject



16
17
18
# File 'lib/gemgate/gem_wrapper.rb', line 16

def spec_filename
  spec.spec_name
end

#versionObject



24
25
26
# File 'lib/gemgate/gem_wrapper.rb', line 24

def version
  spec.version
end