Class: Chelsy::Raw

Inherits:
Element show all
Defined in:
lib/chelsy/ast.rb

Overview

This node represents arbitrary C code snippet. It can be an decsendant of any node. However it is used mainly in macro definition.

Instance Attribute Summary collapse

Attributes inherited from Element

#fragments, #post_fragments

Instance Method Summary collapse

Constructor Details

#initialize(code, **rest) ⇒ Raw

Initialize instance.

Parameters:

  • code (#to_s)

    C code snippet



131
132
133
134
# File 'lib/chelsy/ast.rb', line 131

def initialize(code, **rest)
  @code = Chelsy.immutable_stringify(code)
  super **rest
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



127
128
129
# File 'lib/chelsy/ast.rb', line 127

def code
  @code
end

Instance Method Details

#to_sObject



136
137
138
# File 'lib/chelsy/ast.rb', line 136

def to_s
  @code
end