Class: Odin::Types::OdinModifiers
- Inherits:
-
Object
- Object
- Odin::Types::OdinModifiers
- Defined in:
- lib/odin/types/modifiers.rb
Constant Summary collapse
- NONE =
new
Instance Attribute Summary collapse
-
#attr ⇒ Object
readonly
Returns the value of attribute attr.
-
#confidential ⇒ Object
readonly
Returns the value of attribute confidential.
-
#deprecated ⇒ Object
readonly
Returns the value of attribute deprecated.
-
#required ⇒ Object
readonly
Returns the value of attribute required.
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
- #any? ⇒ Boolean
- #hash ⇒ Object
-
#initialize(required: false, confidential: false, deprecated: false, attr: nil) ⇒ OdinModifiers
constructor
A new instance of OdinModifiers.
- #to_s ⇒ Object
Constructor Details
#initialize(required: false, confidential: false, deprecated: false, attr: nil) ⇒ OdinModifiers
Returns a new instance of OdinModifiers.
8 9 10 11 12 13 14 |
# File 'lib/odin/types/modifiers.rb', line 8 def initialize(required: false, confidential: false, deprecated: false, attr: nil) @required = required @confidential = confidential @deprecated = deprecated @attr = attr freeze end |
Instance Attribute Details
#attr ⇒ Object (readonly)
Returns the value of attribute attr.
6 7 8 |
# File 'lib/odin/types/modifiers.rb', line 6 def attr @attr end |
#confidential ⇒ Object (readonly)
Returns the value of attribute confidential.
6 7 8 |
# File 'lib/odin/types/modifiers.rb', line 6 def confidential @confidential end |
#deprecated ⇒ Object (readonly)
Returns the value of attribute deprecated.
6 7 8 |
# File 'lib/odin/types/modifiers.rb', line 6 def deprecated @deprecated end |
#required ⇒ Object (readonly)
Returns the value of attribute required.
6 7 8 |
# File 'lib/odin/types/modifiers.rb', line 6 def required @required end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
22 23 24 25 26 27 28 |
# File 'lib/odin/types/modifiers.rb', line 22 def ==(other) other.is_a?(OdinModifiers) && required == other.required && confidential == other.confidential && deprecated == other.deprecated && self.attr == other.attr end |
#any? ⇒ Boolean
18 19 20 |
# File 'lib/odin/types/modifiers.rb', line 18 def any? required || confidential || deprecated end |
#hash ⇒ Object
31 32 33 |
# File 'lib/odin/types/modifiers.rb', line 31 def hash [required, confidential, deprecated, self.attr].hash end |
#to_s ⇒ Object
35 36 37 38 39 40 41 42 |
# File 'lib/odin/types/modifiers.rb', line 35 def to_s parts = [] parts << "required" if required parts << "confidential" if confidential parts << "deprecated" if deprecated parts << "attr=#{self.attr}" if self.attr parts.empty? ? "OdinModifiers(none)" : "OdinModifiers(#{parts.join(', ')})" end |