class Flammarion::Writeable::Progress
Public Class Methods
new(name, owner)
click to toggle source
# File lib/cem/cflame/progress.rb, line 20 def initialize(name, owner) @name = name @owner = owner @owner.raw("<div id='progressBar' style='width: 100%; height: 22px; border: 1px solid #8f8f8f; background-color: #292929; border-radius: 2px; box-shadow: 0 2px 3px rgba(0, 0, 0, 0.25) inset;'><div id='progressBarInner-#{@name}' style='height: 100%; color: #fff; text-align: center; line-height: 22px; width: 0px; background-color: #0099ff;'></div></div>") end
Public Instance Methods
each(ary) { |a| ... }
click to toggle source
# File lib/cem/cflame/progress.rb, line 26 def each(ary, &block) set(0) @max = ary.size return if @max == 0 ary.each_with_index { |a, i| yield a set(i * 100 / @max) } ary end
set(value)
click to toggle source
# File lib/cem/cflame/progress.rb, line 38 def set(value) value = value.to_s @owner.js("$( '#progressBarInner-#{@name}' ).width('#{value}%').html('#{value}%');") end