Class: KeepYourHead::Requirement

Inherits:
Object
  • Object
show all
Defined in:
lib/Keepyourhead/Requirements.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize {|_self| ... } ⇒ Requirement

Returns a new instance of Requirement.

Yields:

  • (_self)

Yield Parameters:



4
5
6
# File 'lib/Keepyourhead/Requirements.rb', line 4

def initialize
	yield self
end

Instance Attribute Details

#checkProcObject

Returns the value of attribute checkProc.



3
4
5
# File 'lib/Keepyourhead/Requirements.rb', line 3

def checkProc
  @checkProc
end

#errorDescriptionObject

Returns the value of attribute errorDescription.



3
4
5
# File 'lib/Keepyourhead/Requirements.rb', line 3

def errorDescription
  @errorDescription
end

#nameObject

Returns the value of attribute name.



3
4
5
# File 'lib/Keepyourhead/Requirements.rb', line 3

def name
  @name
end

#websiteObject

Returns the value of attribute website.



3
4
5
# File 'lib/Keepyourhead/Requirements.rb', line 3

def website
  @website
end

Instance Method Details

#checkObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/Keepyourhead/Requirements.rb', line 7

def check
	ret = 
		begin
			@checkProc.call
		rescue
			false
		end

	if not ret then
		puts <<-END
		Requiremente failed !
		-------------------------------
		#{errorDescription}
		Please install #{name}
    #{website}
		-------------------------------
		END
	end

	ret
end