Class: Spunk::Origin
- Inherits:
-
Object
- Object
- Spunk::Origin
- Defined in:
- lib/spunk/origin.rb
Instance Attribute Summary collapse
-
#prefix ⇒ Object
Returns the value of attribute prefix.
Instance Method Summary collapse
-
#initialize(prefix) ⇒ Origin
constructor
A new instance of Origin.
- #nickname ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(prefix) ⇒ Origin
Returns a new instance of Origin.
5 6 7 |
# File 'lib/spunk/origin.rb', line 5 def initialize(prefix) @prefix = prefix end |
Instance Attribute Details
#prefix ⇒ Object
Returns the value of attribute prefix.
3 4 5 |
# File 'lib/spunk/origin.rb', line 3 def prefix @prefix end |
Instance Method Details
#nickname ⇒ Object
9 10 11 |
# File 'lib/spunk/origin.rb', line 9 def nickname @prefix.to_s.split(/!/, 2)[0] end |
#to_s ⇒ Object
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/spunk/origin.rb', line 13 def to_s case when nickname != "" nickname when @prefix @prefix else "-unknown-" end end |