lib/flipper/adapters/operation_logger.rb in flipper-0.10.1 vs lib/flipper/adapters/operation_logger.rb in flipper-0.10.2
- old
+ new
@@ -14,10 +14,11 @@
:features,
:add,
:remove,
:clear,
:get,
+ :get_multi,
:enable,
:disable,
]
# Internal: An array of the operations that have happened.
@@ -64,10 +65,16 @@
@operations << Operation.new(:get, [feature])
@adapter.get(feature)
end
# Public
+ def get_multi(features)
+ @operations << Operation.new(:get_multi, [features])
+ @adapter.get_multi(features)
+ end
+
+ # Public
def enable(feature, gate, thing)
@operations << Operation.new(:enable, [feature, gate, thing])
@adapter.enable(feature, gate, thing)
end
@@ -78,9 +85,14 @@
end
# Public: Count the number of times a certain operation happened.
def count(type)
@operations.select { |operation| operation.type == type }.size
+ end
+
+ # Public: Get the last operation of a certain type.
+ def last(type)
+ @operations.reverse.find { |operation| operation.type == type }
end
# Public: Resets the operation log to empty
def reset
@operations.clear