Class: Massa::Tool
- Inherits:
-
Object
- Object
- Massa::Tool
- Defined in:
- lib/massa/tool.rb
Instance Attribute Summary collapse
-
#command ⇒ Object
readonly
Returns the value of attribute command.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#gem ⇒ Object
(also: #gem?)
readonly
Returns the value of attribute gem.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#required ⇒ Object
(also: #required?)
readonly
Returns the value of attribute required.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(name, attributes) ⇒ Tool
constructor
A new instance of Tool.
Constructor Details
#initialize(name, attributes) ⇒ Tool
Returns a new instance of Tool.
7 8 9 10 11 12 13 |
# File 'lib/massa/tool.rb', line 7 def initialize(name, attributes) @name = name @description = attributes['description'] @gem = attributes['gem'].nil? ? true : attributes['gem'] @command = attributes['command'] @required = attributes['required'].nil? ? true : attributes['required'] end |
Instance Attribute Details
#command ⇒ Object (readonly)
Returns the value of attribute command.
5 6 7 |
# File 'lib/massa/tool.rb', line 5 def command @command end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
5 6 7 |
# File 'lib/massa/tool.rb', line 5 def description @description end |
#gem ⇒ Object (readonly) Also known as: gem?
Returns the value of attribute gem.
5 6 7 |
# File 'lib/massa/tool.rb', line 5 def gem @gem end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/massa/tool.rb', line 5 def name @name end |
#required ⇒ Object (readonly) Also known as: required?
Returns the value of attribute required.
5 6 7 |
# File 'lib/massa/tool.rb', line 5 def required @required end |
Class Method Details
.list ⇒ Object
19 20 21 22 23 |
# File 'lib/massa/tool.rb', line 19 def list tools = custom_tools.any? ? custom_tools : default_tools tools.map { |name, attributes| new(name, attributes) } end |