Class: Hardhat::Dependency

Inherits:
Object
  • Object
show all
Defined in:
lib/hardhat/dependency.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, options = {}) ⇒ Dependency

Returns a new instance of Dependency.



5
6
7
8
9
10
11
12
13
# File 'lib/hardhat/dependency.rb', line 5

def initialize(name, options={})
  unless options.is_a? Hash
    raise ArgumentError.new "options should be a hash"
  end
  @name = name
  @installers = ([] << options[:installer]).flatten.compact
  @sudo = options[:sudo]
  @flags = options[:flags]
end

Instance Attribute Details

#flagsObject (readonly)

Returns the value of attribute flags.



3
4
5
# File 'lib/hardhat/dependency.rb', line 3

def flags
  @flags
end

#installersObject (readonly)

Returns the value of attribute installers.



3
4
5
# File 'lib/hardhat/dependency.rb', line 3

def installers
  @installers
end

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/hardhat/dependency.rb', line 3

def name
  @name
end

Instance Method Details

#inspectObject

inspect -> String Debugging output for this dependency



34
35
36
# File 'lib/hardhat/dependency.rb', line 34

def inspect
  "#<#{self.class}: #{self.name}>"
end

#sudo?Boolean

sudo? -> Boolean Returns a boolean indicating if this dependency needs to be handled as root. This will overide installer defaults.

Returns:

  • (Boolean)


19
20
21
# File 'lib/hardhat/dependency.rb', line 19

def sudo?
  !!@sudo
end

#to_sObject

to_s -> String Returns the name of this dependency. This is used when formatting the system call



27
28
29
# File 'lib/hardhat/dependency.rb', line 27

def to_s
  name
end