Module: Legion::API::Routes::IdentityAudit::IdentityAuditHelpers
- Defined in:
- lib/legion/api/identity_audit.rb
Instance Method Summary collapse
Instance Method Details
#parse_since_duration(value) ⇒ Object
32 33 34 35 36 37 38 39 40 41 |
# File 'lib/legion/api/identity_audit.rb', line 32 def parse_since_duration(value) return nil unless value.is_a?(String) case value when /\A(\d+)h\z/ then Regexp.last_match(1).to_i * 3600 when /\A(\d+)m\z/ then Regexp.last_match(1).to_i * 60 when /\A(\d+)s\z/ then Regexp.last_match(1).to_i when /\A(\d+)d\z/ then Regexp.last_match(1).to_i * 86_400 end end |