Class: Rubyhexagon::Type Private
- Inherits:
-
Object
- Object
- Rubyhexagon::Type
- Defined in:
- lib/rubyhexagon/type.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Class to hold type information.
Instance Attribute Summary collapse
-
#id ⇒ Integer
readonly
private
Id of type.
-
#name ⇒ String
readonly
private
Name of type.
Instance Method Summary collapse
-
#==(other) ⇒ TrueClass, FalseClass
private
Comparison method for Types, to give a more meaningful comparison.
-
#initialize(id, locked) ⇒ Object
constructor
private
Initializer for Type.
-
#locked? ⇒ TrueClass, FalseClass
private
Check if this type is locked for the tag who has it assigned.
Constructor Details
#initialize(id, locked) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Initializer for Type.
43 44 45 46 47 48 49 50 |
# File 'lib/rubyhexagon/type.rb', line 43 def initialize(id, locked) unless [0, 1, 3, 4, 5].include?(id) raise ArgumentError, "Unkown type id: #{id}" end @id = id.to_i @name = [:general, :artist, nil, :copyright, :character, :species][@id] @locked = locked ? true : false end |
Instance Attribute Details
#id ⇒ Integer (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns id of type.
27 28 29 |
# File 'lib/rubyhexagon/type.rb', line 27 def id @id end |
#name ⇒ String (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns name of type.
30 31 32 |
# File 'lib/rubyhexagon/type.rb', line 30 def name @name end |
Instance Method Details
#==(other) ⇒ TrueClass, FalseClass
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Comparison method for Types, to give a more meaningful comparison.
57 58 59 60 |
# File 'lib/rubyhexagon/type.rb', line 57 def ==(other) other.is_a?(Type) && @id == other.id && @name == other.name && @locked == other.locked? end |
#locked? ⇒ TrueClass, FalseClass
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Check if this type is locked for the tag who has it assigned.
68 69 70 |
# File 'lib/rubyhexagon/type.rb', line 68 def locked? @locked end |