Class: Asdf::Tool
- Inherits:
-
Object
- Object
- Asdf::Tool
- Defined in:
- lib/asdf/tool.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#versions ⇒ Object
Returns the value of attribute versions.
Instance Method Summary collapse
- #default_tool_version ⇒ Object
- #default_version ⇒ Object
-
#initialize(name, versions) ⇒ Tool
constructor
A new instance of Tool.
- #tool_versions ⇒ Object
Constructor Details
#initialize(name, versions) ⇒ Tool
Returns a new instance of Tool.
8 9 10 11 |
# File 'lib/asdf/tool.rb', line 8 def initialize(name, versions) @name = name @versions = versions end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/asdf/tool.rb', line 5 def name @name end |
#versions ⇒ Object
Returns the value of attribute versions.
6 7 8 |
# File 'lib/asdf/tool.rb', line 6 def versions @versions end |
Instance Method Details
#default_tool_version ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/asdf/tool.rb', line 17 def default_tool_version # tool_versions.first is in the format of the following, where we only # want the instance of ToolVersion: # # {"version" => Asdf::ToolVersion} # tool_versions.first[1] end |
#default_version ⇒ Object
13 14 15 |
# File 'lib/asdf/tool.rb', line 13 def default_version default_tool_version.version end |
#tool_versions ⇒ Object
26 27 28 29 30 |
# File 'lib/asdf/tool.rb', line 26 def tool_versions @tool_versions ||= versions.each_with_object({}) do |version, all| all[version] = ToolVersion.new(name, version) end end |