Sha256: 18d8b86e705584a30b1e07cf57c3ae014fd04a30c84833f7754b156e1c17e1fa

Contents?: true

Size: 387 Bytes

Versions: 16

Compression:

Stored size: 387 Bytes

Contents

module Csb
  class Col
    attr_reader :name

    def initialize(name, value = nil, &block)
      @name = name
      @value = block ? block : value
    end

    def value_by_item(item)
      case value
      when ::Symbol
        item.public_send(value)
      when ::Proc
        value.call(item)
      else
        value
      end
    end

    private

    attr_reader :value
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
csb-0.12.0 lib/csb/col.rb
csb-0.10.0 lib/csb/col.rb
csb-0.9.0 lib/csb/col.rb
csb-0.8.0 lib/csb/col.rb
csb-0.7.0 lib/csb/col.rb
csb-0.6.0 lib/csb/col.rb
csb-0.5.1 lib/csb/col.rb
csb-0.5.0 lib/csb/col.rb
csb-0.4.0 lib/csb/col.rb
csb-0.3.1 lib/csb/col.rb
csb-0.3.0 lib/csb/col.rb
csb-0.2.4 lib/csb/col.rb
csb-0.2.3 lib/csb/col.rb
csb-0.2.2 lib/csb/col.rb
csb-0.2.1 lib/csb/col.rb
csb-0.2.0 lib/csb/col.rb