Sha256: 332a7b94ca7265c653f0f6b6fd20011460591c3fea11d4aa752ad094b16ebf29

Contents?: true

Size: 346 Bytes

Versions: 4

Compression:

Stored size: 346 Bytes

Contents

module Piglet
  module Field
    class BinaryConditional
      include Field
      
      def initialize(test, if_true, if_false)
        @test, @if_true, @if_false = test, if_true, if_false
        @type = expression_type(@if_true)
      end
          
      def to_s
        "(#{@test} ? #{@if_true} : #{@if_false})"
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
piglet-0.2.4 lib/piglet/field/binary_conditional.rb
piglet-0.2.3 lib/piglet/field/binary_conditional.rb
piglet-0.2.2 lib/piglet/field/binary_conditional.rb
piglet-0.2.0 lib/piglet/field/binary_conditional.rb