Class: Odin::Types::OdinVerbExpression
Instance Attribute Summary collapse
Attributes inherited from OdinValue
#directives, #modifiers
Instance Method Summary
collapse
Methods inherited from OdinValue
#array?, #binary?, #boolean?, #confidential?, #currency?, #date?, #deprecated?, #duration?, #integer?, #null?, #number?, #numeric?, #object?, #percent?, #reference?, #required?, #string?, #temporal?, #time?, #timestamp?, #verb?
Constructor Details
#initialize(verb, is_custom: false, args: [], **kwargs) ⇒ OdinVerbExpression
Returns a new instance of OdinVerbExpression.
497
498
499
500
501
502
503
|
# File 'lib/odin/types/values.rb', line 497
def initialize(verb, is_custom: false, args: [], **kwargs)
super(**kwargs)
@verb = -verb.to_s
@is_custom = is_custom
@args = args.freeze
freeze
end
|
Instance Attribute Details
#args ⇒ Object
Returns the value of attribute args.
495
496
497
|
# File 'lib/odin/types/values.rb', line 495
def args
@args
end
|
#is_custom ⇒ Object
Returns the value of attribute is_custom.
495
496
497
|
# File 'lib/odin/types/values.rb', line 495
def is_custom
@is_custom
end
|
#verb ⇒ Object
Returns the value of attribute verb.
495
496
497
|
# File 'lib/odin/types/values.rb', line 495
def verb
@verb
end
|
Instance Method Details
#==(other) ⇒ Object
Also known as:
eql?
511
512
513
514
|
# File 'lib/odin/types/values.rb', line 511
def ==(other)
other.is_a?(OdinVerbExpression) && verb == other.verb &&
is_custom == other.is_custom && args == other.args
end
|
#custom? ⇒ Boolean
507
508
509
|
# File 'lib/odin/types/values.rb', line 507
def custom?
@is_custom
end
|
#hash ⇒ Object
517
518
519
|
# File 'lib/odin/types/values.rb', line 517
def hash
[ValueType::VERB, verb, is_custom, args].hash
end
|
#to_s ⇒ Object
521
522
523
|
# File 'lib/odin/types/values.rb', line 521
def to_s
"%#{verb}(#{args.join(', ')})"
end
|
#type ⇒ Object
505
|
# File 'lib/odin/types/values.rb', line 505
def type; ValueType::VERB; end
|
#with_directives(dirs) ⇒ Object
530
531
532
533
|
# File 'lib/odin/types/values.rb', line 530
def with_directives(dirs)
OdinVerbExpression.new(verb, is_custom: is_custom, args: args,
modifiers: modifiers, directives: dirs)
end
|
#with_modifiers(mods) ⇒ Object
525
526
527
528
|
# File 'lib/odin/types/values.rb', line 525
def with_modifiers(mods)
OdinVerbExpression.new(verb, is_custom: is_custom, args: args,
modifiers: mods, directives: directives)
end
|