Class: Red::AssignmentNode::ClassVariable

Inherits:
Red::AssignmentNode show all
Defined in:
lib/red/nodes/assignment_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(variable_name_sexp, expression_sexp, options) ⇒ ClassVariable

:cvdecl, :@@foo, expression

> inside eval portion of class declaration

:cvasgn, :@@foo, expression

> inside method definition



6
7
8
9
10
11
# File 'lib/red/nodes/assignment_nodes.rb', line 6

def initialize(variable_name_sexp, expression_sexp, options)
  class_name    = @@namespace_stack.join(".")
  variable_name = variable_name_sexp.red!
  expression    = expression_sexp.red!(:as_argument => true)
  self << "%s.cvset('%s',%s)" % [class_name, variable_name, expression]
end