Class: Twterm::Friendship
- Inherits:
-
Object
- Object
- Twterm::Friendship
- Defined in:
- lib/twterm/friendship.rb
Constant Summary collapse
- STATUSES =
%i( blocking following following_requested muting ).freeze
Instance Attribute Summary collapse
-
#from ⇒ Object
readonly
Returns the value of attribute from.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#to ⇒ Object
readonly
Returns the value of attribute to.
Instance Method Summary collapse
- #blocking? ⇒ Boolean
- #following? ⇒ Boolean
- #following_requested? ⇒ Boolean
-
#initialize(status, from, to) ⇒ Friendship
constructor
A new instance of Friendship.
- #muting? ⇒ Boolean
Constructor Details
#initialize(status, from, to) ⇒ Friendship
Returns a new instance of Friendship.
12 13 14 15 16 |
# File 'lib/twterm/friendship.rb', line 12 def initialize(status, from, to) fail ArgumentError, '`status` must be one of the following: :blocking, :follwing, :following_requested, or :muting' unless STATUSES.include? status @status, @from, @to = status, from, to end |
Instance Attribute Details
#from ⇒ Object (readonly)
Returns the value of attribute from.
10 11 12 |
# File 'lib/twterm/friendship.rb', line 10 def from @from end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
10 11 12 |
# File 'lib/twterm/friendship.rb', line 10 def status @status end |
#to ⇒ Object (readonly)
Returns the value of attribute to.
10 11 12 |
# File 'lib/twterm/friendship.rb', line 10 def to @to end |
Instance Method Details
#blocking? ⇒ Boolean
18 19 20 |
# File 'lib/twterm/friendship.rb', line 18 def blocking? status?(:blocking) end |
#following? ⇒ Boolean
22 23 24 |
# File 'lib/twterm/friendship.rb', line 22 def following? status?(:following) end |
#following_requested? ⇒ Boolean
26 27 28 |
# File 'lib/twterm/friendship.rb', line 26 def following_requested? status?(:following_requested) end |
#muting? ⇒ Boolean
30 31 32 |
# File 'lib/twterm/friendship.rb', line 30 def muting? status?(:muting) end |