Class: CodeTools::AST::Encoding

Inherits:
Node
  • Object
show all
Defined in:
lib/rubinius/ast/encoding.rb

Instance Attribute Summary collapse

Attributes inherited from Node

#line

Instance Method Summary collapse

Methods inherited from Node

#ascii_graph, #attributes, #children, match_arguments?, match_send?, #new_block_generator, #new_generator, #node_name, #or_bytecode, #pos, #set_child, transform, #transform, transform_comment, transform_kind, transform_kind=, transform_name, #value_defined, #visit, #walk

Constructor Details

#initialize(line, name) ⇒ Encoding

Returns a new instance of Encoding.



8
9
10
11
# File 'lib/rubinius/ast/encoding.rb', line 8

def initialize(line, name)
  @line = line
  @name = name
end

Instance Attribute Details

#nameObject

Returns the value of attribute name.



6
7
8
# File 'lib/rubinius/ast/encoding.rb', line 6

def name
  @name
end

Instance Method Details

#bytecode(g) ⇒ Object



13
14
15
16
17
18
19
20
# File 'lib/rubinius/ast/encoding.rb', line 13

def bytecode(g)
  pos(g)

  g.push_rubinius
  g.find_const :Runtime
  g.push_literal @name
  g.send :get_encoding, 1
end

#defined(g) ⇒ Object



22
23
24
# File 'lib/rubinius/ast/encoding.rb', line 22

def defined(g)
  g.push_literal "expression"
end

#to_sexpObject



26
27
28
# File 'lib/rubinius/ast/encoding.rb', line 26

def to_sexp
  [:encoding, @name]
end