Class: Object

Inherits:
BasicObject
Defined in:
lib/jirametrics/exporter.rb

Instance Method Summary collapse

Instance Method Details

#assert_jira_behaviour_false(condition, &block) ⇒ Object



21
22
23
24
# File 'lib/jirametrics/exporter.rb', line 21

def assert_jira_behaviour_false condition, &block
  block.call if ENV['RACK_ENV'] == 'test' # Always expand the block if we're running in a test
  failed_jira_behaviour(block) if condition
end

#assert_jira_behaviour_true(condition, &block) ⇒ Object



16
17
18
19
# File 'lib/jirametrics/exporter.rb', line 16

def assert_jira_behaviour_true condition, &block
  block.call if ENV['RACK_ENV'] == 'test' # Always expand the block if we're running in a test
  failed_jira_behaviour(block) unless condition
end

#deprecated(message:, date: nil) ⇒ Object



6
7
8
9
10
11
12
13
14
# File 'lib/jirametrics/exporter.rb', line 6

def deprecated message:, date: nil
  text = String.new
  text << 'Deprecated'
  text << "(#{date})"
  text << ': '
  text << message
  text << "\n-> Called from #{caller[0]}"
  warn text
end

#failed_jira_behaviour(block) ⇒ Object



26
27
28
29
30
31
32
# File 'lib/jirametrics/exporter.rb', line 26

def failed_jira_behaviour block
  text = String.new
  text << 'Jira not doing what we expected. Results may be incorrect: '
  text << block.call
  text << "\n-> Called from #{caller[1]}"
  warn text
end