Class: ToolVersion::Tool

Inherits:
Object
  • Object
show all
Includes:
Comparable
Defined in:
lib/tool_version/tool.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, version, path) ⇒ Tool

Returns a new instance of Tool.



9
10
11
12
13
14
# File 'lib/tool_version/tool.rb', line 9

def initialize(name, version, path)
  @name = name
  @version = version
  @path = path
  @directory = extract_directory(path)
end

Instance Attribute Details

#directoryObject (readonly)

Returns the value of attribute directory.



7
8
9
# File 'lib/tool_version/tool.rb', line 7

def directory
  @directory
end

#nameObject (readonly)

Returns the value of attribute name.



7
8
9
# File 'lib/tool_version/tool.rb', line 7

def name
  @name
end

#pathObject (readonly)

Returns the value of attribute path.



7
8
9
# File 'lib/tool_version/tool.rb', line 7

def path
  @path
end

#versionObject (readonly)

Returns the value of attribute version.



7
8
9
# File 'lib/tool_version/tool.rb', line 7

def version
  @version
end

Instance Method Details

#<=>(other) ⇒ Object



16
17
18
# File 'lib/tool_version/tool.rb', line 16

def <=>(other)
  (name <=> other.name) && (version <=> other.version) && (directory <=> other.directory) && (path <=> other.path)
end