Class: Trifle::Stats::Nocturnal::Key
- Inherits:
-
Object
- Object
- Trifle::Stats::Nocturnal::Key
- Defined in:
- lib/trifle/stats/nocturnal.rb
Instance Attribute Summary collapse
-
#at ⇒ Object
readonly
Returns the value of attribute at.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#prefix ⇒ Object
Returns the value of attribute prefix.
-
#range ⇒ Object
readonly
Returns the value of attribute range.
Instance Method Summary collapse
- #identifier(separator) ⇒ Object
-
#initialize(key:, range: nil, at: nil) ⇒ Key
constructor
A new instance of Key.
- #join(separator) ⇒ Object
Constructor Details
#initialize(key:, range: nil, at: nil) ⇒ Key
Returns a new instance of Key.
10 11 12 13 14 15 |
# File 'lib/trifle/stats/nocturnal.rb', line 10 def initialize(key:, range: nil, at: nil) @prefix = nil @key = key @range = range @at = at end |
Instance Attribute Details
#at ⇒ Object (readonly)
Returns the value of attribute at.
7 8 9 |
# File 'lib/trifle/stats/nocturnal.rb', line 7 def at @at end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
7 8 9 |
# File 'lib/trifle/stats/nocturnal.rb', line 7 def key @key end |
#prefix ⇒ Object
Returns the value of attribute prefix.
8 9 10 |
# File 'lib/trifle/stats/nocturnal.rb', line 8 def prefix @prefix end |
#range ⇒ Object (readonly)
Returns the value of attribute range.
7 8 9 |
# File 'lib/trifle/stats/nocturnal.rb', line 7 def range @range end |
Instance Method Details
#identifier(separator) ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/trifle/stats/nocturnal.rb', line 21 def identifier(separator) if separator { key: join(separator) } else { key: key, range: range, at: at }.compact end end |
#join(separator) ⇒ Object
17 18 19 |
# File 'lib/trifle/stats/nocturnal.rb', line 17 def join(separator) [prefix, key, range, at&.to_i].compact.join(separator) end |