Class: Massa::Tool

Inherits:
Object
  • Object
show all
Defined in:
lib/massa/tool.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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

#commandObject (readonly)

Returns the value of attribute command.



5
6
7
# File 'lib/massa/tool.rb', line 5

def command
  @command
end

#descriptionObject (readonly)

Returns the value of attribute description.



5
6
7
# File 'lib/massa/tool.rb', line 5

def description
  @description
end

#gemObject (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

#nameObject (readonly)

Returns the value of attribute name.



5
6
7
# File 'lib/massa/tool.rb', line 5

def name
  @name
end

#requiredObject (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

.listObject



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