vendor/bundle/ruby/2.3.0/gems/freelancer-0.1.1/lib/freelancer/support/json_mapper.rb
# Build a JSON data structure of the current mapping according to the
# format specifications from the Freelancer.com API.
Build a JSON data structure of the current mapping according to the
format specifications from the Freelancer.com API.
Build a JSON data structure of the current mapping according to the format specifications from the Freelancer . com API .
def to_json
        structure = {}
        mappings.each_pair do |from, to|
          if to.is_a?(Hash)
            structure[to.keys.first] ||= {}
            structure[to.keys.first][to.values.first] = model[from]
          else
            structure[to] = model[from]
          end
        end
        structure
      end
def to_json structure = { } mappings . each_pair do | from , to | if to . is_a? ( Hash ) structure [ to . keys . first ] ||= { } structure [ to . keys . first ] [ to . values . first ] = model [ from ] else structure [ to ] = model [ from ] end end structure end
Build a JSON data structure of the current mapping according to the
format specifications from the Freelancer.com API.
Build a JSON data structure of the current mapping according to the format specifications from the Freelancer . com API .
# Build a Hash of the current mappings # If our "to" is a hash, build a nested hash into the structure