Sha256: 31a9196651a82f3478a51e961f3a92a085ea3bf5faecfc12e43e44ac69eecea1
Contents?: true
Size: 714 Bytes
Versions: 1
Compression:
Stored size: 714 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.capture(object, view, &options[:proc]) else object.send(name) end end def human_name options[:label] || name.to_s.humanize end def available?(table) if options[:if] && options[:if].is_a?(Symbol) return !!table.send(options[:if]) end if options[:unless] && options[:unless].is_a?(Symbol) return !table.send(options[:unless]) end true end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
table_cloth-0.1.2 | lib/table_cloth/column.rb |