Sha256: 861c822bb9a8bd8b6b69b716a261621b5c92eb6e8e08d1138e2f62a2751ca1fe

Contents?: true

Size: 558 Bytes

Versions: 30

Compression:

Stored size: 558 Bytes

Contents

class RestModel
  module Source
    module Path
      def self.resolve(options, convert_input_keys = Key::Converter::DefaultHandler)
        convert_input_keys.call keys_for_path(custom_path(options))
      end

      private

      def self.custom_path(options)
        options.slice(:start_key, :field)
      end

      def self.keys_for_path(path)
        return [] if path.empty?

        if path.values.first.kind_of?(Symbol)
          [path.values.first]
        else
          path.values.first.to_s.split('.')
        end
      end
    end
  end
end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
rest_model-0.3.1 lib/rest_model/source/path.rb
rest_model-0.3.0 lib/rest_model/source/path.rb
rest_model-0.2.3 lib/rest_model/source/path.rb
rest_model-0.2.1 lib/rest_model/source/path.rb
rest_model-0.2.0 lib/rest_model/source/path.rb
rest_model-0.1.24 lib/rest_model/source/path.rb
rest_model-0.1.23 lib/rest_model/source/path.rb
rest_model-0.1.22 lib/rest_model/source/path.rb
rest_model-0.1.21 lib/rest_model/source/path.rb
rest_model-0.1.20 lib/rest_model/source/path.rb
rest_model-0.1.19 lib/rest_model/source/path.rb
rest_model-0.1.18 lib/rest_model/source/path.rb
rest_model-0.1.17 lib/rest_model/source/path.rb
rest_model-0.1.16 lib/rest_model/source/path.rb
rest_model-0.1.15 lib/rest_model/source/path.rb
rest_model-0.1.14 lib/rest_model/source/path.rb
rest_model-0.1.13 lib/rest_model/source/path.rb
rest_model-0.1.12 lib/rest_model/source/path.rb
rest_model-0.1.11 lib/rest_model/source/path.rb
rest_model-0.1.10 lib/rest_model/source/path.rb