Class: Tkellem::Backlog::Device
- Inherits:
-
Struct
- Object
- Struct
- Tkellem::Backlog::Device
- Defined in:
- lib/tkellem/plugins/backlog.rb
Overview
IMPL
Instance Attribute Summary collapse
-
#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.
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.
51 52 53 54 |
# File 'lib/tkellem/plugins/backlog.rb', line 51 def initialize(*a) super self.positions = {} end |
Instance Attribute Details
#device_name ⇒ Object
Returns the value of attribute device_name
50 51 52 |
# File 'lib/tkellem/plugins/backlog.rb', line 50 def device_name @device_name end |
#network_user ⇒ Object
Returns the value of attribute network_user
50 51 52 |
# File 'lib/tkellem/plugins/backlog.rb', line 50 def network_user @network_user end |
#positions ⇒ Object
Returns the value of attribute positions
50 51 52 |
# File 'lib/tkellem/plugins/backlog.rb', line 50 def positions @positions end |
Instance Method Details
#pos(ctx_name, pos_for_new = 0) ⇒ Object
62 63 64 65 66 67 68 69 |
# File 'lib/tkellem/plugins/backlog.rb', line 62 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
56 57 58 59 60 |
# File 'lib/tkellem/plugins/backlog.rb', line 56 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 |