Class: MessagePack::IDL::AST::Type
- Defined in:
- lib/msgpack/idl/ast.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#nullable ⇒ Object
readonly
Returns the value of attribute nullable.
Instance Method Summary collapse
-
#initialize(name, nullable = false) ⇒ Type
constructor
A new instance of Type.
- #nullable? ⇒ Boolean
- #text ⇒ Object
Methods inherited from Element
Constructor Details
#initialize(name, nullable = false) ⇒ Type
Returns a new instance of Type.
264 265 266 267 |
# File 'lib/msgpack/idl/ast.rb', line 264 def initialize(name, nullable=false) @name = name @nullable = nullable end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
268 269 270 |
# File 'lib/msgpack/idl/ast.rb', line 268 def name @name end |
#nullable ⇒ Object (readonly)
Returns the value of attribute nullable.
268 269 270 |
# File 'lib/msgpack/idl/ast.rb', line 268 def nullable @nullable end |
Instance Method Details
#nullable? ⇒ Boolean
270 271 272 |
# File 'lib/msgpack/idl/ast.rb', line 270 def nullable? @nullable end |
#text ⇒ Object
274 275 276 277 278 279 280 |
# File 'lib/msgpack/idl/ast.rb', line 274 def text if @nullable "#{@name}?" else "#{@name}" end end |