Sha256: 0cb538361f2946f86dbd27fe6e5a1ac44fbc0c8dd21072421ca528caaa8bd58c

Contents?: true

Size: 434 Bytes

Versions: 10

Compression:

Stored size: 434 Bytes

Contents

module Monolens
  module Lens
    module FetchSupport
      def fetch_on(attr, arg, default = nil)
        if arg.key?(attr)
          [ attr, arg[attr] ]
        elsif arg.key?(attr_s = attr.to_s)
          [ attr_s, arg[attr_s] ]
        elsif arg.key?(attr_sym = attr.to_sym)
          [ attr_sym, arg[attr_sym] ]
        elsif default
          [ attr, default ]
        else
          nil
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
monolens-0.6.4 lib/monolens/lens/fetch_support.rb
monolens-0.6.3 lib/monolens/lens/fetch_support.rb
monolens-0.6.2 lib/monolens/lens/fetch_support.rb
monolens-0.6.1 lib/monolens/lens/fetch_support.rb
monolens-0.6.0 lib/monolens/lens/fetch_support.rb
monolens-0.5.3 lib/monolens/lens/fetch_support.rb
monolens-0.5.2 lib/monolens/lens/fetch_support.rb
monolens-0.5.1 lib/monolens/lens/fetch_support.rb
monolens-0.5.0 lib/monolens/lens/fetch_support.rb
monolens-0.4.0 lib/monolens/lens/fetch_support.rb