Class: Votifier::Vote
- Inherits:
-
Object
- Object
- Votifier::Vote
- Defined in:
- lib/votifier/vote.rb
Instance Attribute Summary collapse
-
#ip_address ⇒ Object
readonly
Returns the value of attribute ip_address.
-
#service_name ⇒ Object
readonly
Returns the value of attribute service_name.
-
#timestamp ⇒ Object
readonly
Returns the value of attribute timestamp.
-
#username ⇒ Object
readonly
Returns the value of attribute username.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(service_name, username, ip_address, timestamp) ⇒ Vote
constructor
A new instance of Vote.
- #to_h ⇒ Object
Constructor Details
#initialize(service_name, username, ip_address, timestamp) ⇒ Vote
Returns a new instance of Vote.
5 6 7 8 9 10 |
# File 'lib/votifier/vote.rb', line 5 def initialize(service_name, username, ip_address, ) @service_name = service_name @username = username @ip_address = ip_address = end |
Instance Attribute Details
#ip_address ⇒ Object (readonly)
Returns the value of attribute ip_address.
3 4 5 |
# File 'lib/votifier/vote.rb', line 3 def ip_address @ip_address end |
#service_name ⇒ Object (readonly)
Returns the value of attribute service_name.
3 4 5 |
# File 'lib/votifier/vote.rb', line 3 def service_name @service_name end |
#timestamp ⇒ Object (readonly)
Returns the value of attribute timestamp.
3 4 5 |
# File 'lib/votifier/vote.rb', line 3 def end |
#username ⇒ Object (readonly)
Returns the value of attribute username.
3 4 5 |
# File 'lib/votifier/vote.rb', line 3 def username @username end |
Class Method Details
.from_array(vote_info) ⇒ Object
12 13 14 15 16 |
# File 'lib/votifier/vote.rb', line 12 def self.from_array(vote_info) opcode, service_name, username, ip_address, , empty_space = vote_info vote = Vote.new(service_name, username, ip_address, ) vote end |
Instance Method Details
#to_h ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/votifier/vote.rb', line 18 def to_h { :service_name => service_name, :username => username, :ip_address => ip_address, :timestamp => } end |