Class: WebIDL::Ast::Type

Inherits:
Node
  • Object
show all
Defined in:
lib/webidl/ast/type.rb

Instance Attribute Summary collapse

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.



7
8
9
10
11
12
# File 'lib/webidl/ast/type.rb', line 7

def initialize(parent, name, opts = {})
  super(parent)

  @name     = camel_case_type(name.strip).to_sym
  @nullable = !!opts[:nullable]
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



5
6
7
# File 'lib/webidl/ast/type.rb', line 5

def name
  @name
end

Instance Method Details

#array!Object



18
19
20
# File 'lib/webidl/ast/type.rb', line 18

def array!
  @name = "#{@name}Array".to_sym
end

#nullable?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/webidl/ast/type.rb', line 14

def nullable?
  @nullable
end