Sha256: f25def4b7d6ca990e91b7e60fe3b2c22c87e635f8f79b4b01fbc1107e073db97

Contents?: true

Size: 674 Bytes

Versions: 7

Compression:

Stored size: 674 Bytes

Contents

class Array
    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

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

    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
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
dev_commands-0.0.56 lib/array.rb
dev_commands-0.0.55 lib/array.rb
dev_commands-0.0.49 lib/array.rb
dev_commands-0.0.48 lib/array.rb
dev_commands-0.0.47 lib/array.rb
dev_commands-0.0.41 lib/array.rb
dev_commands-0.0.40 lib/array.rb