Class: MessagePack::IDL::AST::Field
- Defined in:
- lib/msgpack/idl/ast.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#modifier ⇒ Object
readonly
Returns the value of attribute modifier.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(id, type, modifier, name) ⇒ Field
constructor
A new instance of Field.
- #text ⇒ Object
Methods inherited from Element
Constructor Details
#initialize(id, type, modifier, name) ⇒ Field
Returns a new instance of Field.
96 97 98 99 100 101 |
# File 'lib/msgpack/idl/ast.rb', line 96 def initialize(id, type, modifier, name) @id = id @type = type @name = name @modifier = modifier end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
102 103 104 |
# File 'lib/msgpack/idl/ast.rb', line 102 def id @id end |
#modifier ⇒ Object (readonly)
Returns the value of attribute modifier.
102 103 104 |
# File 'lib/msgpack/idl/ast.rb', line 102 def modifier @modifier end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
102 103 104 |
# File 'lib/msgpack/idl/ast.rb', line 102 def name @name end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
102 103 104 |
# File 'lib/msgpack/idl/ast.rb', line 102 def type @type end |
Instance Method Details
#text ⇒ Object
104 105 106 107 108 109 110 |
# File 'lib/msgpack/idl/ast.rb', line 104 def text if @modifier == FIELD_OPTIONAL "#{@id}: optional #{@type.text} #{@name}" else "#{@id}: #{@type.text} #{@name}" end end |