Class: Squash::Java::Argument

Inherits:
Object
  • Object
show all
Defined in:
lib/squash/java/namespace.rb

Overview

A Method argument. Includes the argument Type and whether it is a scalar or an array.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type, array = false) ⇒ Argument

Returns a new instance of Argument.



533
534
535
536
# File 'lib/squash/java/namespace.rb', line 533

def initialize(type, array=false)
  @type  = type
  @array = array
end

Instance Attribute Details

#arraytrue, false (readonly) Also known as: array?

Returns ‘true` if the argument is an array, false if it is a scalar.

Returns:

  • (true, false)

    ‘true` if the argument is an array, false if it is a scalar.



529
530
531
# File 'lib/squash/java/namespace.rb', line 529

def array
  @array
end

#typeSquash::Java::Type (readonly)

Returns The argument type.

Returns:



525
526
527
# File 'lib/squash/java/namespace.rb', line 525

def type
  @type
end

Instance Method Details

#==(other) ⇒ Object



539
540
541
542
543
# File 'lib/squash/java/namespace.rb', line 539

def ==(other)
  other.kind_of?(Squash::Java::Argument) &&
      type == other.type &&
      array? == other.array?
end

#inspectObject



549
# File 'lib/squash/java/namespace.rb', line 549

def inspect() "#<#{self.class} #{to_s}>" end

#to_sString

Returns The type’s full name, with “[]” appended for arrays.

Returns:

  • (String)

    The type’s full name, with “[]” appended for arrays.



546
# File 'lib/squash/java/namespace.rb', line 546

def to_s() "#{type.full_name}#{'[]' if array?}" end