Class: BundleHack::Gem

Inherits:
Object
  • Object
show all
Defined in:
lib/bundle_hack/gem.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(definitions, options = {}) ⇒ Gem

Returns a new instance of Gem.



7
8
9
10
11
12
13
# File 'lib/bundle_hack/gem.rb', line 7

def initialize(definitions, options = {})
  @definitions = definitions
  @name = options.fetch(:name)
  @full_name = options.fetch(:full_name)
  @version = normalized_version(options.fetch(:version))
  @path = Pathname.new(options.fetch(:path))
end

Instance Attribute Details

#full_nameObject (readonly)

Returns the value of attribute full_name.



5
6
7
# File 'lib/bundle_hack/gem.rb', line 5

def full_name
  @full_name
end

#nameObject (readonly)

Returns the value of attribute name.



5
6
7
# File 'lib/bundle_hack/gem.rb', line 5

def name
  @name
end

#pathObject (readonly)

Returns the value of attribute path.



5
6
7
# File 'lib/bundle_hack/gem.rb', line 5

def path
  @path
end

#versionObject (readonly)

Returns the value of attribute version.



5
6
7
# File 'lib/bundle_hack/gem.rb', line 5

def version
  @version
end

Instance Method Details

#locationsObject



15
16
17
# File 'lib/bundle_hack/gem.rb', line 15

def locations
  @definitions.map { |definition| definition[:locations] }.flatten
end

#paramsObject



19
20
21
# File 'lib/bundle_hack/gem.rb', line 19

def params
  find_params || {}
end