Class: Haplocheirus::MockService::MockNode

Inherits:
Struct
  • Object
show all
Includes:
Comparable
Defined in:
lib/haplocheirus/mock_service.rb

Constant Summary collapse

RETWEET_BIT =
31

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ MockNode

Returns a new instance of MockNode.



14
15
16
17
# File 'lib/haplocheirus/mock_service.rb', line 14

def initialize(*args)
  super
  self.bitfield ||= 0
end

Instance Attribute Details

#bitfieldObject

Returns the value of attribute bitfield

Returns:

  • (Object)

    the current value of bitfield



5
6
7
# File 'lib/haplocheirus/mock_service.rb', line 5

def bitfield
  @bitfield
end

#secondary_idObject

Returns the value of attribute secondary_id

Returns:

  • (Object)

    the current value of secondary_id



5
6
7
# File 'lib/haplocheirus/mock_service.rb', line 5

def secondary_id
  @secondary_id
end

#status_idObject

Returns the value of attribute status_id

Returns:

  • (Object)

    the current value of status_id



5
6
7
# File 'lib/haplocheirus/mock_service.rb', line 5

def status_id
  @status_id
end

Class Method Details

.unpack(string) ⇒ Object



10
11
12
# File 'lib/haplocheirus/mock_service.rb', line 10

def self.unpack(string)
  new *string.unpack("QQI")
end

Instance Method Details

#<=>(other) ⇒ Object



19
20
21
# File 'lib/haplocheirus/mock_service.rb', line 19

def <=>(other)
  status_id <=> other.status_id
end

#is_share?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/haplocheirus/mock_service.rb', line 23

def is_share?
  bitfield[RETWEET_BIT] == 1
end