Class: DDQL::TokenType::String
- Inherits:
-
Literal
- Object
- DDQL::TokenType
- Literal
- DDQL::TokenType::String
- Defined in:
- lib/ddql/token_type.rb
Constant Summary
Constants inherited from DDQL::TokenType
ALL, CURRENCY_LITERAL, FACTOR, FACTOR_PATTERN, INFIXOPERATOR, INTEGER_LITERAL, LBRACE, LPAREN, NESTED_CLOSER, NESTED_CLOSE_PATTERN, NESTED_OPENER, NESTED_OPEN_PATTERN, NUMERIC_LITERAL, POSTFIXOPERATOR, PREFIXOPERATOR, RBRACE, RPAREN, SCI_NUM_LITERAL, SCREEN, SPECIAL_MARKER, STRING_LITERAL, SUB_Q_ALIAS, SUB_Q_EXPR, SUB_Q_FIELDS, SUB_Q_GROUP, SUB_Q_TYPE, WHITESPACE
Instance Attribute Summary
Attributes inherited from DDQL::TokenType
Instance Method Summary collapse
- #as_hash(data) ⇒ Object
- #data_type ⇒ Object
-
#initialize ⇒ String
constructor
A new instance of String.
Methods inherited from Literal
Methods inherited from DDQL::TokenType
#==, all_types_pattern, #comparison?, #data_from, #expression?, #factor?, #group?, #infix?, #interpret, #interpreted_data_from, #literal?, #match?, #parse, #postfix?, #prefix?, #screen?, #skipping!, #supports_post_processing?, #trimming!
Constructor Details
#initialize ⇒ String
Returns a new instance of String.
190 191 192 193 |
# File 'lib/ddql/token_type.rb', line 190 def initialize super(name: :string, pattern: /'(?:[^'\\]|\\.)*?'/) @value_transformer = -> (s) { s.gsub('\\', '') } end |
Instance Method Details
#as_hash(data) ⇒ Object
195 196 197 198 199 200 201 |
# File 'lib/ddql/token_type.rb', line 195 def as_hash(data) if data&.strip.each_byte.all? { |e| e == 0x30 } Integer.new.as_hash(data.to_i) else super end end |
#data_type ⇒ Object
203 204 205 |
# File 'lib/ddql/token_type.rb', line 203 def data_type name end |