Class: Tkellem::Backlog::Device
- Inherits:
-
Struct
- Object
- Struct
- Tkellem::Backlog::Device
- Defined in:
- lib/tkellem/plugins/backlog.rb
Instance Attribute Summary collapse
-
#country ⇒ Object
Returns the value of attribute country.
-
#device_name ⇒ Object
Returns the value of attribute device_name.
-
#network_user ⇒ Object
Returns the value of attribute network_user.
-
#positions ⇒ Object
Returns the value of attribute positions.
-
#time_zone ⇒ Object
Returns the value of attribute time_zone.
Instance Method Summary collapse
-
#initialize(*a) ⇒ Device
constructor
A new instance of Device.
- #pos(ctx_name, pos_for_new = 0) ⇒ Object
- #update_pos(ctx_name, pos) ⇒ Object
Constructor Details
#initialize(*a) ⇒ Device
Returns a new instance of Device.
66 67 68 69 |
# File 'lib/tkellem/plugins/backlog.rb', line 66 def initialize(*a) super self.positions = {} end |
Instance Attribute Details
#country ⇒ Object
Returns the value of attribute country
65 66 67 |
# File 'lib/tkellem/plugins/backlog.rb', line 65 def country @country end |
#device_name ⇒ Object
Returns the value of attribute device_name
65 66 67 |
# File 'lib/tkellem/plugins/backlog.rb', line 65 def device_name @device_name end |
#network_user ⇒ Object
Returns the value of attribute network_user
65 66 67 |
# File 'lib/tkellem/plugins/backlog.rb', line 65 def network_user @network_user end |
#positions ⇒ Object
Returns the value of attribute positions
65 66 67 |
# File 'lib/tkellem/plugins/backlog.rb', line 65 def positions @positions end |
#time_zone ⇒ Object
Returns the value of attribute time_zone
65 66 67 |
# File 'lib/tkellem/plugins/backlog.rb', line 65 def time_zone @time_zone end |
Instance Method Details
#pos(ctx_name, pos_for_new = 0) ⇒ Object
77 78 79 80 81 82 83 84 |
# File 'lib/tkellem/plugins/backlog.rb', line 77 def pos(ctx_name, pos_for_new = 0) backlog_pos = self.position(ctx_name).first_or_initialize if backlog_pos.new_record? backlog_pos.position = pos_for_new backlog_pos.save end backlog_pos.position end |
#update_pos(ctx_name, pos) ⇒ Object
71 72 73 74 75 |
# File 'lib/tkellem/plugins/backlog.rb', line 71 def update_pos(ctx_name, pos) # TODO: it'd be a good idea to throttle these updates to once every few seconds per ctx # right now we're kind of harsh on the sqlite db self.position(ctx_name).first_or_create.update_attribute(:position, pos) end |