Class: Fvm::CLI::Installation

Inherits:
Object
  • Object
show all
Includes:
Comparable
Defined in:
lib/fvm/cli/installation.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(dir) ⇒ Installation

Returns a new instance of Installation.



10
11
12
# File 'lib/fvm/cli/installation.rb', line 10

def initialize( dir )
  @dir = Pathname.new( dir ).expand_path
end

Instance Attribute Details

#dirObject (readonly)

Returns the value of attribute dir.



9
10
11
# File 'lib/fvm/cli/installation.rb', line 9

def dir
  @dir
end

Instance Method Details

#<=>(other) ⇒ Object



28
29
30
# File 'lib/fvm/cli/installation.rb', line 28

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

#active?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/fvm/cli/installation.rb', line 18

def active?
  Fvm::System.active?( self )
end

#to_menuObject



22
23
24
25
26
# File 'lib/fvm/cli/installation.rb', line 22

def to_menu
  out = [ version ]
  out.unshift '*' if active?
  out.join ' '
end

#versionObject



14
15
16
# File 'lib/fvm/cli/installation.rb', line 14

def version
  @dir.basename.to_s.sub( /^flex_sdk_/, '' )
end