Class: Cel::Identifier

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
lib/cel/ast/elements/identifier.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(identifier, package = nil) ⇒ Identifier



11
12
13
14
15
16
# File 'lib/cel/ast/elements/identifier.rb', line 11

def initialize(identifier, package = nil)
  @id = identifier
  @type = TYPES[:any]
  @package = package
  super(@id)
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



7
8
9
# File 'lib/cel/ast/elements/identifier.rb', line 7

def id
  @id
end

#typeObject

Returns the value of attribute type.



9
10
11
# File 'lib/cel/ast/elements/identifier.rb', line 9

def type
  @type
end

Instance Method Details

#==(other) ⇒ Object



18
19
20
# File 'lib/cel/ast/elements/identifier.rb', line 18

def ==(other)
  super || other.to_s == @id.to_s
end

#to_sObject Also known as: to_ruby_type



22
23
24
# File 'lib/cel/ast/elements/identifier.rb', line 22

def to_s
  @id.to_s
end

#try_convert_to_proto_typeObject



28
29
30
# File 'lib/cel/ast/elements/identifier.rb', line 28

def try_convert_to_proto_type
  Protobuf.convert_to_proto_type(@id.to_s, @package)
end