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
- #username ⇒ 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).first end |
#to_s ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/spunk/origin.rb', line 17 def to_s case when nickname != "" nickname when @prefix @prefix end end |
#username ⇒ Object
13 14 15 |
# File 'lib/spunk/origin.rb', line 13 def username @prefix.to_s.split(/!/, 2)[1].split("@").first end |