Class: RubyHeaderParser::ArgumentDefinition

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby_header_parser/argument_definition.rb

Overview

argument definition for FunctionDefinition

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type:, name:, pointer: nil, length: 0) ⇒ ArgumentDefinition

Returns a new instance of ArgumentDefinition.

Parameters:

  • type (String)
  • name (String)
  • pointer (Symbol, nil) (defaults to: nil)

    :ref, :array

  • length (String) (defaults to: 0)


26
27
28
29
30
31
# File 'lib/ruby_header_parser/argument_definition.rb', line 26

def initialize(type:, name:, pointer: nil, length: 0)
  @type = type
  @name = name
  @pointer = pointer
  @length = length
end

Instance Attribute Details

#lengthInteger

Returns:

  • (Integer)


20
21
22
# File 'lib/ruby_header_parser/argument_definition.rb', line 20

def length
  @length
end

#nameString

Returns:

  • (String)


12
13
14
# File 'lib/ruby_header_parser/argument_definition.rb', line 12

def name
  @name
end

#pointerSymbol?

Returns :ref, :array.

Returns:

  • (Symbol, nil)

    :ref, :array



16
17
18
# File 'lib/ruby_header_parser/argument_definition.rb', line 16

def pointer
  @pointer
end

#typeString

Returns:

  • (String)


8
9
10
# File 'lib/ruby_header_parser/argument_definition.rb', line 8

def type
  @type
end

Instance Method Details

#==(other) ⇒ Boolean

Parameters:

Returns:

  • (Boolean)


35
36
37
38
# File 'lib/ruby_header_parser/argument_definition.rb', line 35

def ==(other)
  other.is_a?(ArgumentDefinition) && type == other.type && name == other.name && pointer == other.pointer &&
    length == other.length
end

#pointer?Boolean

Returns:

  • (Boolean)


41
42
43
# File 'lib/ruby_header_parser/argument_definition.rb', line 41

def pointer?
  !!pointer
end