Class: Gem::Prune::Version

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(gem, raw) ⇒ Version

Returns a new instance of Version.



9
10
11
12
13
14
15
# File 'lib/gem/prune/version.rb', line 9

def initialize(gem, raw)
  @gem = gem
  @raw = raw
  @keep = false

  clear_relationships
end

Instance Attribute Details

#dependantsObject (readonly)

Returns the value of attribute dependants.



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

def dependants
  @dependants
end

#dependenciesObject (readonly)

Returns the value of attribute dependencies.



6
7
8
# File 'lib/gem/prune/version.rb', line 6

def dependencies
  @dependencies
end

#gemObject (readonly)

Returns the value of attribute gem.



3
4
5
# File 'lib/gem/prune/version.rb', line 3

def gem
  @gem
end

#keepObject

Returns the value of attribute keep.



7
8
9
# File 'lib/gem/prune/version.rb', line 7

def keep
  @keep
end

#rawObject (readonly)

Returns the value of attribute raw.



4
5
6
# File 'lib/gem/prune/version.rb', line 4

def raw
  @raw
end

Instance Method Details

#<=>(other) ⇒ Object



39
40
41
# File 'lib/gem/prune/version.rb', line 39

def <=>(other)
  version <=> other.version
end

#clear_relationshipsObject



34
35
36
37
# File 'lib/gem/prune/version.rb', line 34

def clear_relationships
  @dependants   = []
  @dependencies = []
end

#inspectObject



17
18
19
20
21
22
23
24
# File 'lib/gem/prune/version.rb', line 17

def inspect
  pretty  = %{<Gem::Prune::Version }
  pretty << %{@name="#{name}" }
  pretty << %{@version="#{version}" }
  pretty << %{@dependants="#{dependants.map { |d| "#{d.name}-#{d.version}" }.join(' ') }" }
  pretty << %{@dependencies="#{dependencies.map { |d| "#{d.name}-#{d.version}" }.join(' ') }"}
  pretty << %{>}
end

#nameObject



26
27
28
# File 'lib/gem/prune/version.rb', line 26

def name
  raw.name
end

#versionObject



30
31
32
# File 'lib/gem/prune/version.rb', line 30

def version
  raw.version
end