Class: GlooLang::Expr::LBoolean

Inherits:
Core::Literal show all
Defined in:
lib/gloo_lang/expr/l_boolean.rb

Instance Attribute Summary

Attributes inherited from Core::Literal

#value

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Core::Literal

#initialize

Constructor Details

This class inherits a constructor from GlooLang::Core::Literal

Class Method Details

.boolean?(token) ⇒ Boolean

Is the given token a boolean?

Returns:

  • (Boolean)


14
15
16
# File 'lib/gloo_lang/expr/l_boolean.rb', line 14

def self.boolean?( token )
  return GlooLang::Objs::Boolean.boolean? token
end

Instance Method Details

#set_value(value) ⇒ Object

Set the value, converting to an boolean.



21
22
23
# File 'lib/gloo_lang/expr/l_boolean.rb', line 21

def set_value( value )
  @value = GlooLang::Objs::Boolean.coerse_to_bool value
end

#to_sObject

Get string representation



28
29
30
31
32
# File 'lib/gloo_lang/expr/l_boolean.rb', line 28

def to_s
  return 'false' unless @value

  return @value.to_s
end