class ApiDiff::Property

Attributes

readonly_keyword[RW]
writable_keyword[RW]
name[R]
type[R]

Public Class Methods

new(name:, type:, writable:, static:) click to toggle source
# File lib/api_diff/property.rb, line 12
def initialize(name:, type:, writable:, static:)
  @name = name
  @type = type
  @writable = writable
  @static = static
end

Public Instance Methods

<=>(other) click to toggle source
# File lib/api_diff/property.rb, line 43
def <=>(other)
  # static at the bottom
  return 1 if is_static? and not other.is_static?
  return -1 if not is_static? and other.is_static?

  # sort by name
  name <=> other.name
end
eql?(other) click to toggle source
# File lib/api_diff/property.rb, line 31
def eql?(other)
  to_s == other.to_s
end
hash() click to toggle source
# File lib/api_diff/property.rb, line 27
def hash
  to_s.hash
end
is_static?() click to toggle source
# File lib/api_diff/property.rb, line 23
def is_static?
  @static
end
is_writable?() click to toggle source
# File lib/api_diff/property.rb, line 19
def is_writable?
  @writable
end
to_s() click to toggle source
# File lib/api_diff/property.rb, line 35
def to_s
  result = []
  result << "static" if is_static?
  result << (is_writable? ? self.class.writable_keyword : self.class.readonly_keyword)
  result << "#{name}: #{type}"
  result.join(" ")
end