Class: WebIDL::Ast::Type
- Inherits:
-
Node
- Object
- Node
- WebIDL::Ast::Type
show all
- Defined in:
- lib/webidl/ast/type.rb
Instance Method Summary
collapse
Methods inherited from Node
#accept, #qualified_name, #snake_name
Constructor Details
#initialize(parent, name, opts = {}) ⇒ Type
Returns a new instance of Type.
5
6
7
8
9
10
11
|
# File 'lib/webidl/ast/type.rb', line 5
def initialize(parent, name, opts = {})
super(parent)
@name = camel_case_type(name.strip).to_sym
@nullable = !!opts[:nullable]
@array = !!opts[:array]
end
|
Instance Method Details
#array=(bool) ⇒ Object
21
22
23
|
# File 'lib/webidl/ast/type.rb', line 21
def array=(bool)
@array = bool
end
|
#array? ⇒ Boolean
17
18
19
|
# File 'lib/webidl/ast/type.rb', line 17
def array?
@array
end
|
#name ⇒ Object
29
30
31
|
# File 'lib/webidl/ast/type.rb', line 29
def name
(array? ? "#{@name}Array" : @name).to_sym
end
|
#nullable=(bool) ⇒ Object
25
26
27
|
# File 'lib/webidl/ast/type.rb', line 25
def nullable=(bool)
@nullable = bool
end
|
#nullable? ⇒ Boolean
13
14
15
|
# File 'lib/webidl/ast/type.rb', line 13
def nullable?
@nullable
end
|