Sha256: d49bbbdacb4863c79cd4cb746b1909c19f63e62ceec071ecebb8261f09b812f3
Contents?: true
Size: 566 Bytes
Versions: 1
Compression:
Stored size: 566 Bytes
Contents
module TableCloth class Column attr_reader :options, :name def initialize(name, options={}) @name = name @options = options end def value(object, view, table=nil) if options[:proc] && options[:proc].respond_to?(:call) view.instance_exec(object, view, &options[:proc]) else object.send(name) end end def human_name(view) if options[:label].kind_of? Proc view.instance_exec(&options[:label]) else options[:label] || name.to_s.humanize end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
table_cloth-0.3.1.alpha1 | lib/table_cloth/column.rb |