Class: Red::LiteralNode::Other

Inherits:
Red::LiteralNode show all
Defined in:
lib/red/nodes/literal_nodes.rb

Overview

:nodoc:

Instance Method Summary collapse

Methods inherited from String

#%, #*, #+, #<<, #<=>, #==, #=~, #[], #[]=, #capitalize, #capitalize!, #casecmp, #center, #chomp, #chomp!, #chop, #chop!, #concat, #count, #crypt, #delete, #delete!, #downcase, #downcase!, #each, #each_byte, #each_line, #empty?, #eql?, #gsub, #gsub!, #hash, #hex, #include?, #index, #insert, #inspect, #intern, #length, #ljust, #lstrip, #lstrip!, #match, #next, #next!, #oct, #replace, #reverse, #reverse!, #rindex, #rjust, #rstrip, #rstrip!, #scan, #size, #slice, #slice!, #split, #squeeze, #strip, #strip!, #strip_scripts, #sub, #sub!, #succ, #succ!, #sum, #swapcase, #swapcase!, #to_f, #to_i, #to_s, #to_str, #to_sym, #tr, #tr!, #tr_s, #tr_s!, #upcase, #upcase!, #upto

Constructor Details

#initialize(value_sexp = nil, options = {}) ⇒ Other

:lit, | regexp | range
:svalue, [:array, expression, expression, …]
:to_ary, expression

> right side of :masgn when arguments are too few



61
62
63
64
65
66
67
# File 'lib/red/nodes/literal_nodes.rb', line 61

def initialize(value_sexp = nil, options = {})
  (options = value_sexp) && (value_sexp = nil) if value_sexp.is_a?(::Hash)
  symbol_sexp = [:sym, value_sexp] if value_sexp.is_a?(::Symbol)
  regexp_sexp = [:regex, value_sexp] if value_sexp.is_a?(::Regexp)
  value = (regexp_sexp || symbol_sexp || value_sexp).red!(options)
  self << "%s" % [value]
end