Module: Minato::Utils::Helpers

Defined in:
lib/minato/utils/helpers.rb

Class Method Summary collapse

Class Method Details

.join_url(*segments) ⇒ Object



8
9
10
11
12
# File 'lib/minato/utils/helpers.rb', line 8

def join_url(*segments)
  segments
    .map { |seg| seg.gsub(%r{/$|^/}, '') }
    .join('/')
end

.parse_json(body) ⇒ Object



14
15
16
# File 'lib/minato/utils/helpers.rb', line 14

def parse_json(body)
  body.present? ? JSON.parse(body, symbolize_names: true) : {}
end