Sha256: 6a562134e8177ffb4b60627b492d2a563c677bb56bf176789ffa08f18cf31902
Contents?: true
Size: 988 Bytes
Versions: 3
Compression:
Stored size: 988 Bytes
Contents
require "mengpaneel/strategy/base" require "mengpaneel/tracker" module Mengpaneel module Strategy class ServerSide < Base def initialize(all_calls, controller = nil, remote_ip = nil) super(all_calls, controller) @remote_ip = remote_ip || controller.try(:request).try(:remote_ip) end def run return true if all_calls[:tracking].blank? perform_calls(:before_setup) perform_calls(:setup) perform_calls(:tracking) true end private def tracker @tracker ||= Tracker.new(Mengpaneel.token, @remote_ip) end def perform_calls(mode) calls = all_calls[mode] || [] calls.each do |method_names, args| method_name = method_names.pop object = method_names.inject(tracker) { |object, method_name| object.public_send(method_name) } object.public_send(method_name, *args) end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
mengpaneel-0.0.3 | lib/mengpaneel/strategy/server_side.rb |
mengpaneel-0.0.2 | lib/mengpaneel/strategy/server_side.rb |
mengpaneel-0.0.1 | lib/mengpaneel/strategy/server_side.rb |