Class: ApiDiff::Property
- Inherits:
-
Object
- Object
- ApiDiff::Property
- Defined in:
- lib/api_diff/property.rb
Class Attribute Summary collapse
-
.readonly_keyword ⇒ Object
Returns the value of attribute readonly_keyword.
-
.writable_keyword ⇒ Object
Returns the value of attribute writable_keyword.
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #eql?(other) ⇒ Boolean
- #hash ⇒ Object
-
#initialize(name:, type:, writable:, static:) ⇒ Property
constructor
A new instance of Property.
- #is_static? ⇒ Boolean
- #is_writable? ⇒ Boolean
- #to_s ⇒ Object
Constructor Details
#initialize(name:, type:, writable:, static:) ⇒ Property
Returns a new instance of Property.
12 13 14 15 16 17 |
# File 'lib/api_diff/property.rb', line 12 def initialize(name:, type:, writable:, static:) @name = name @type = type @writable = writable @static = static end |
Class Attribute Details
.readonly_keyword ⇒ Object
Returns the value of attribute readonly_keyword.
7 8 9 |
# File 'lib/api_diff/property.rb', line 7 def readonly_keyword @readonly_keyword end |
.writable_keyword ⇒ Object
Returns the value of attribute writable_keyword.
7 8 9 |
# File 'lib/api_diff/property.rb', line 7 def writable_keyword @writable_keyword end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
10 11 12 |
# File 'lib/api_diff/property.rb', line 10 def name @name end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
10 11 12 |
# File 'lib/api_diff/property.rb', line 10 def type @type end |
Instance Method Details
#<=>(other) ⇒ Object
43 44 45 46 47 48 49 50 |
# 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) ⇒ Boolean
31 32 33 |
# File 'lib/api_diff/property.rb', line 31 def eql?(other) to_s == other.to_s end |
#hash ⇒ Object
27 28 29 |
# File 'lib/api_diff/property.rb', line 27 def hash to_s.hash end |
#is_static? ⇒ Boolean
23 24 25 |
# File 'lib/api_diff/property.rb', line 23 def is_static? @static end |
#is_writable? ⇒ Boolean
19 20 21 |
# File 'lib/api_diff/property.rb', line 19 def is_writable? @writable end |
#to_s ⇒ Object
35 36 37 38 39 40 41 |
# 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 |