Sha256: 36013aaff9555b8119b453b2659f222355c8c91041087db1b00ce8bc31bdb73d

Contents?: true

Size: 469 Bytes

Versions: 1

Compression:

Stored size: 469 Bytes

Contents

module HSS
  ##
  # Allow shortcut expansion from the config
  class Parser
    private

    def shortcut(input)
      @config.dig('shortcuts', input) || raise(NameError, "Shortcut does not exist #{input}")
    end
  end
end

unless {}.respond_to? :dig
  ##
  # Define dig method if it didn't exist (because Ruby predates 2.3)
  class Hash
    def dig(arg, *args)
      val = self[arg]
      return val if val.nil? || args.empty?
      val.dig(*args)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
hss-1.1.0 lib/hss/helpers/shortcut.rb