Sha256: 0642a69e533617d21f3895265c5ba337e3072cd84fc83ea7e09a67619c22fb00

Contents?: true

Size: 333 Bytes

Versions: 125

Compression:

Stored size: 333 Bytes

Contents

require "virtus"

module Ddr::Index
  class FieldAttribute < Virtus::Attribute

    def self.coerce(value)
      case value
      when Field
        value
      when String
        Field.new(value)
      when Symbol
        Fields.get(value)
      end
    end

    def coerce(value)
      self.class.coerce(value)
    end

  end
end

Version data entries

125 entries across 125 versions & 2 rubygems

Version Path
ddr-models-2.4.9 lib/ddr/index/field_attribute.rb
ddr-models-3.0.0.beta.18 lib/ddr/index/field_attribute.rb
ddr-models-2.4.8 lib/ddr/index/field_attribute.rb
ddr-models-3.0.0.beta.17 lib/ddr/index/field_attribute.rb
ddr-models-3.0.0.beta.16 lib/ddr/index/field_attribute.rb
ddr-models-3.0.0.beta.15 lib/ddr/index/field_attribute.rb
ddr-models-3.0.0.beta.14 lib/ddr/index/field_attribute.rb
ddr-models-3.0.0.beta.13 lib/ddr/index/field_attribute.rb
ddr-models-3.0.0.beta.12 lib/ddr/index/field_attribute.rb
ddr-models-3.0.0.beta.11 lib/ddr/index/field_attribute.rb
ddr-models-2.4.7 lib/ddr/index/field_attribute.rb
ddr-models-2.4.6 lib/ddr/index/field_attribute.rb
ddr-models-2.4.5 lib/ddr/index/field_attribute.rb
ddr-models-3.0.0.beta.10 lib/ddr/index/field_attribute.rb
ddr-models-3.0.0.beta.9 lib/ddr/index/field_attribute.rb
ddr-models-3.0.0.beta.8 lib/ddr/index/field_attribute.rb
ddr-models-3.0.0.beta.7 lib/ddr/index/field_attribute.rb
ddr-models-2.4.4 lib/ddr/index/field_attribute.rb
ddr-models-3.0.0.beta.6 lib/ddr/index/field_attribute.rb
ddr-models-2.4.3 lib/ddr/index/field_attribute.rb