Class: Array
- Inherits:
-
Object
show all
- Defined in:
- lib/base/array.rb
Direct Known Subclasses
Add, Analyze, Build, Commit, Doc, Publish, Pull, Push, Setup, Test, Update
Instance Attribute Summary collapse
Instance Method Summary
collapse
Instance Attribute Details
#env ⇒ Object
Returns the value of attribute env.
3
4
5
|
# File 'lib/base/array.rb', line 3
def env
@env
end
|
Instance Method Details
#add(command) ⇒ Object
33
34
35
|
# File 'lib/base/array.rb', line 33
def add command
self << command if !has_command? command
end
|
#add_passive(command) ⇒ Object
55
56
57
|
# File 'lib/base/array.rb', line 55
def add_passive command
add Command.new({ :input => command, :quiet => true, :ignore_failure => true })
end
|
#add_quiet(command) ⇒ Object
51
52
53
|
# File 'lib/base/array.rb', line 51
def add_quiet command
add Command.new({ :input => command, :quiet => true })
end
|
#execute(value = nil) ⇒ Object
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/base/array.rb', line 10
def execute value=nil
@env=Environment.new() if @env.nil?
i=0
while i < self.length
self[i]=Command.new({ :input => self[i], :quiet => true }) if(self[i].is_a?(String))
self[i]=Command.new(self[i]) if(self[i].is_a?(Hash) && !self[i].is_a?(Command))
if(!value.nil? && value.is_a?(Hash))
value.each{|k,v|self[i][k]=v}
end
if(self[i].is_a?(Command))
self[i].execute
@env.out self[i].summary
end
i=i+1
end
end
|
#has_command?(command) ⇒ Boolean
37
38
39
40
41
42
43
44
45
46
47
48
49
|
# File 'lib/base/array.rb', line 37
def has_command? command
return true if(command.kind_of?(String) && !include?(command))
if(command.kind_of?(Command))
self.each{|c|
if c.kind_of?(String)
return true if command[:input] == c
else
return true if(c[:input] == command[:input])
end
}
end
false
end
|
#intialize(env = nil) ⇒ Object
4
5
6
7
8
|
# File 'lib/base/array.rb', line 4
def intialize env=nil
@env=env
@env=Environment.new() if @env.nil?
@env=Environmnet.new() if !@env.kind_of?(Environment)
end
|
#to_html ⇒ Object
59
60
61
62
63
64
65
66
67
|
# File 'lib/base/array.rb', line 59
def to_html
html=Array.new
html << '<div>'
self.each{|e|
html << e.to_html if e.respond_to?(:to_html)
}
html << '</div>'
html.join
end
|