Class: Bundler::PubGrub::Package

Inherits:
Object
  • Object
show all
Defined in:
lib/bundler/vendor/pub_grub/lib/pub_grub/package.rb

Constant Summary collapse

ROOT =
Package.new(:root)
ROOT_VERSION =
0

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ Package

Returns a new instance of Package.



8
9
10
# File 'lib/bundler/vendor/pub_grub/lib/pub_grub/package.rb', line 8

def initialize(name)
  @name = name
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



6
7
8
# File 'lib/bundler/vendor/pub_grub/lib/pub_grub/package.rb', line 6

def name
  @name
end

Class Method Details

.rootObject



23
24
25
# File 'lib/bundler/vendor/pub_grub/lib/pub_grub/package.rb', line 23

def self.root
  ROOT
end

.root?(package) ⇒ Boolean

Returns:

  • (Boolean)


31
32
33
34
35
36
37
# File 'lib/bundler/vendor/pub_grub/lib/pub_grub/package.rb', line 31

def self.root?(package)
  if package.respond_to?(:root?)
    package.root?
  else
    package == root
  end
end

.root_versionObject



27
28
29
# File 'lib/bundler/vendor/pub_grub/lib/pub_grub/package.rb', line 27

def self.root_version
  ROOT_VERSION
end

Instance Method Details

#<=>(other) ⇒ Object



16
17
18
# File 'lib/bundler/vendor/pub_grub/lib/pub_grub/package.rb', line 16

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

#inspectObject



12
13
14
# File 'lib/bundler/vendor/pub_grub/lib/pub_grub/package.rb', line 12

def inspect
  "#<#{self.class} #{name.inspect}>"
end

#to_sObject



39
40
41
# File 'lib/bundler/vendor/pub_grub/lib/pub_grub/package.rb', line 39

def to_s
  name.to_s
end