Sha256: ff080d84515baea60088316b24584d011c5d961853404104977cb0ebcb581adb

Contents?: true

Size: 369 Bytes

Versions: 5

Compression:

Stored size: 369 Bytes

Contents

class ThinkingSphinx::RealTime::Attribute < ThinkingSphinx::RealTime::Property
  def multi?
    @options[:multi]
  end

  def type
    @options[:type]
  end

  def translate(object)
    output = super || default_value

    json? ? output.to_json : output
  end

  private

  def default_value
    type == :string ? '' : 0
  end

  def json?
    type == :json
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
thinking-sphinx-3.4.2 lib/thinking_sphinx/real_time/attribute.rb
thinking-sphinx-3.4.1 lib/thinking_sphinx/real_time/attribute.rb
thinking-sphinx-3.4.0 lib/thinking_sphinx/real_time/attribute.rb
thinking-sphinx-3.3.0 lib/thinking_sphinx/real_time/attribute.rb
thinking-sphinx-3.2.0 lib/thinking_sphinx/real_time/attribute.rb