Class: Rufus::Scheduler::Job
- Inherits:
-
Object
- Object
- Rufus::Scheduler::Job
- Defined in:
- lib/rufus_monkeypatch.rb
Constant Summary collapse
- UNDESIRED_ELEMENTS =
['', '}', 'end']
Instance Method Summary collapse
Instance Method Details
#identifier ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/rufus_monkeypatch.rb', line 6 def identifier @identifier ||= begin return name if name lines = handler.source.split("\n") whitespace_removed = lines.map(&:strip) undesired_removed = whitespace_removed - UNDESIRED_ELEMENTS comment_only_lines_removed = undesired_removed.grep_v(/#.*/) comment_only_lines_removed[-1] # final line rescue begin source_location.join('-') rescue 'error-calculating-job-identifier' end end end |
#slug ⇒ Object
24 25 26 27 |
# File 'lib/rufus_monkeypatch.rb', line 24 def slug require 'active_support/inflector' identifier.gsub('_', '-').parameterize end |