Class: Literal::Set

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/literal/set.rb

Defined Under Namespace

Classes: Generic

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value, type:) ⇒ Set

Returns a new instance of Set.



26
27
28
29
30
31
32
33
34
35
36
# File 'lib/literal/set.rb', line 26

def initialize(value, type:)
	collection_type = Literal::Types::SetType.new(type)

	Literal.check(value, collection_type) do |c|
		c.fill_receiver(receiver: self, method: "#initialize")
	end

	@__type__ = type
	@__value__ = value
	@__collection_type__ = collection_type
end

Instance Attribute Details

#__type__Object (readonly)

Returns the value of attribute __type__.



38
39
40
# File 'lib/literal/set.rb', line 38

def __type__
  @__type__
end

#__value__Object (readonly)

Returns the value of attribute __value__.



38
39
40
# File 'lib/literal/set.rb', line 38

def __value__
  @__value__
end

Instance Method Details

#eachObject



45
46
47
# File 'lib/literal/set.rb', line 45

def each(...)
	@__value__.each(...)
end

#freezeObject



40
41
42
43
# File 'lib/literal/set.rb', line 40

def freeze
	@__value__.freeze
	super
end