Class: Literal::Types::RangeType Private

Inherits:
Object
  • Object
show all
Includes:
Literal::Type
Defined in:
lib/literal/types/range_type.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type) ⇒ RangeType

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of RangeType.



7
8
9
10
# File 'lib/literal/types/range_type.rb', line 7

def initialize(type)
	@type = type
	freeze
end

Instance Attribute Details

#typeObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



12
13
14
# File 'lib/literal/types/range_type.rb', line 12

def type
  @type
end

Instance Method Details

#===(value) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



18
19
20
21
22
23
24
25
26
# File 'lib/literal/types/range_type.rb', line 18

def ===(value)
	Range === value && (
		(
			@type === value.begin && (nil === value.end || @type === value.end)
		) || (
			@type === value.end && nil === value.begin
		)
	)
end

#>=(other) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



28
29
30
31
32
33
34
35
# File 'lib/literal/types/range_type.rb', line 28

def >=(other)
	case other
	when Literal::Types::RangeType
		Literal.subtype?(other.type, @type)
	else
		false
	end
end

#inspectObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



14
15
16
# File 'lib/literal/types/range_type.rb', line 14

def inspect
	"_Range(#{@type.inspect})"
end