Class: MessagePack::IDL::AST::Enum
- Defined in:
- lib/msgpack/idl/ast.rb
Instance Attribute Summary collapse
-
#fields ⇒ Object
readonly
Returns the value of attribute fields.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(name, fields) ⇒ Enum
constructor
A new instance of Enum.
- #text ⇒ Object
Methods inherited from Element
Constructor Details
#initialize(name, fields) ⇒ Enum
Returns a new instance of Enum.
127 128 129 130 |
# File 'lib/msgpack/idl/ast.rb', line 127 def initialize(name, fields) @name = name @fields = fields end |
Instance Attribute Details
#fields ⇒ Object (readonly)
Returns the value of attribute fields.
131 132 133 |
# File 'lib/msgpack/idl/ast.rb', line 131 def fields @fields end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
131 132 133 |
# File 'lib/msgpack/idl/ast.rb', line 131 def name @name end |
Instance Method Details
#text ⇒ Object
133 134 135 136 137 138 |
# File 'lib/msgpack/idl/ast.rb', line 133 def text t = "enum #{@name} {\n" t << @fields.map {|f| " #{f.text}\n" }.join t << "}" t end |