class HtmlGrid::Component
Constants
- HTTP_HEADERS
Public Class Methods
escaped(*names)
click to toggle source
# File lib/ydim/html/view/htmlgrid.rb, line 21 def escaped(*names) names.each { |name| define_method(name) { |model| number_format escape(model.send(name)) } } end
links(event, *names)
click to toggle source
# File lib/ydim/html/view/htmlgrid.rb, line 28 def links(event, *names) names.each { |name| define_method(name) { |model| link = HtmlGrid::Link.new(name, model, @session, self) args = {:unique_id => model.unique_id} link.href = @lookandfeel._event_url(event, args) link.value = model.send(name) link } } end
Public Instance Methods
escape(value)
click to toggle source
# File lib/ydim/html/view/htmlgrid.rb, line 40 def escape(value) CGI.escape(format(value)) end
format(value)
click to toggle source
# File lib/ydim/html/view/htmlgrid.rb, line 43 def format(value) case value when Float sprintf("%1.#{self.precision}f", value) else value.to_s end end
number_format(string)
click to toggle source
# File lib/ydim/html/view/htmlgrid.rb, line 51 def number_format(string) string.reverse.gsub(/\d{3}(?=\d)(?!\d*\.)/) do |match| match << "'" end.reverse end
precision()
click to toggle source
# File lib/ydim/html/view/htmlgrid.rb, line 56 def precision mdl = @session.state.model if(mdl.respond_to?(:precision)) mdl.precision else 2 end end