This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ERROR = "error" | |
| STOPPED = "stopped" | |
| RUNNING = "running" | |
| state = ERROR | |
| desired = STOPPED | |
| ([RUNNING].include? state) || (state == ERROR && desired == STOPPED) | |
| [RUNNING].include?(state) || (state == ERROR && desired == STOPPED) | |
| [RUNNING].include? state || (state == ERROR && desired == STOPPED) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require "binding_of_caller" | |
| calls = [] | |
| stats = {} | |
| trace = TracePoint.new(:call, :class, :return) do |tp| | |
| next if tp.path =~ /\/var\/lib\/gems\/2\.0\.0/ | |
| next if tp.path =~ /\/usr\/lib\/ruby\/2\.0\.0/ | |
| next if tp.path =~ /\(erb\)/ | |
| stats[tp.defined_class] ||= {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| scans = [ | |
| ['A','B','C','D','A','B','A','A'], | |
| ['C','C','C','C','C','C','C'], | |
| ['A','B','C','D'] | |
| ] | |
| products = [ | |
| { :code => 'A', :volume => 4, :price => 7 }, | |
| { :code => 'A', :volume => 1, :price => 2 }, | |
| { :code => 'B', :volume => 1, :price => 12 }, |