Sha256: 03c81d818694c0b730f42d94667427a1dc0ea148a404323a39dbc4b42791fae2

Contents?: true

Size: 575 Bytes

Versions: 6

Compression:

Stored size: 575 Bytes

Contents

module AgnosticBackend
  module Queryable
    class Value < TreeNode

      attr_accessor :value
      attr_reader :parent

      def initialize(value, parent:, context:)
        super([], context)
        @value, @parent = value, parent
      end

      def ==(o)
        super && o.value == value
      end

      def associated_attribute
        parent.attribute if parent.respond_to? :attribute
      end

      def type
        return :text if associated_attribute.try(:any?)
        associated_attribute.type if associated_attribute.present?
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
agnostic_backend-1.0.4 lib/agnostic_backend/queryable/value.rb
agnostic_backend-1.0.3 lib/agnostic_backend/queryable/value.rb
agnostic_backend-1.0.2 lib/agnostic_backend/queryable/value.rb
agnostic_backend-1.0.1 lib/agnostic_backend/queryable/value.rb
agnostic_backend-1.0.0 lib/agnostic_backend/queryable/value.rb
agnostic_backend-0.9.9 lib/agnostic_backend/queryable/value.rb