Class: Camille::Types::Intersection

Inherits:
BasicType
  • Object
show all
Defined in:
lib/camille/types/intersection.rb

Defined Under Namespace

Classes: ArgumentError

Instance Attribute Summary collapse

Attributes inherited from BasicType

#fingerprint

Instance Method Summary collapse

Methods inherited from BasicType

&, #&, #[], [], check_params, directly_instantiable?, inherited, instance, |, #|

Constructor Details

#initialize(left, right) ⇒ Intersection

Returns a new instance of Intersection.



8
9
10
11
12
# File 'lib/camille/types/intersection.rb', line 8

def initialize left, right
  @left = Camille::Type.instance left
  @right = Camille::Type.instance right
  @fingerprint = Digest::MD5.hexdigest "#{self.class.name}#{[@left.fingerprint, @right.fingerprint].sort}"
end

Instance Attribute Details

#leftObject (readonly)

Returns the value of attribute left.



6
7
8
# File 'lib/camille/types/intersection.rb', line 6

def left
  @left
end

#rightObject (readonly)

Returns the value of attribute right.



6
7
8
# File 'lib/camille/types/intersection.rb', line 6

def right
  @right
end

Instance Method Details

#check(value) ⇒ Object



14
15
16
# File 'lib/camille/types/intersection.rb', line 14

def check value
  check_with_method(value, :check)
end

#check_params(value) ⇒ Object



18
19
20
# File 'lib/camille/types/intersection.rb', line 18

def check_params value
  check_with_method(value, :check_params)
end

#literalObject



22
23
24
# File 'lib/camille/types/intersection.rb', line 22

def literal
  "(#{@left.literal} & #{@right.literal})"
end