Class: Array

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

Direct Known Subclasses

Add, Analyze, Build, Clean, Clobber, Commit, Doc, Publish, Pull, Push, Setup, Test, Update, Upgrade

Instance Method Summary collapse

Instance Method Details

#add(command) ⇒ Object



17
18
19
# File 'lib/array.rb', line 17

def add command
  self << command if(!include?(command))
end

#execute(value = nil) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/array.rb', line 2

def execute value=nil
  i=0
  while i < self.length
    self[i]=Command.new(self[i]) 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

    self[i].execute if(self[i].is_a?(Command))
    i=i+1
  end
end

#to_htmlObject



21
22
23
24
25
26
27
28
29
# File 'lib/array.rb', line 21

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