Sha256: 70e7ac4497bc4a715a4b3d30e2c6a1b0e45a2deb615903aa7f6f7180bc704a54
Contents?: true
Size: 846 Bytes
Versions: 25
Compression:
Stored size: 846 Bytes
Contents
# frozen_string_literal: true module Katalyst module Tables class Label def initialize(collection:, column:, label: nil) @collection = collection @column = column @label = label end def value return @value if defined?(@value) @value = if !@label.nil? @label elsif @collection.model.present? @collection.model.human_attribute_name(@column) else @column.to_s.humanize.capitalize end end def call ActionView::OutputBuffer.new.tap do |output| output << value.to_s end.to_s end alias to_s call def inspect "#<#{self.class.name} column: #{@column.inspect} value: #{value.inspect}>" end end end end
Version data entries
25 entries across 25 versions & 1 rubygems