Returns the information (name, type, required, ...etc) needed to build
 the custom class.
 That will be stored into the target instance.

 @return [ Hash ] The hash
776360
def to_recipe
      method_name       = :"#{self.type}_to_recipe"
      custom_to_recipe  = self.send(method_name) rescue {}

      { 'name'      => self.name,
        'type'      => self.type,
        'required'  => self.required?,
        'unique'    => self.unique?,
        'localized' => self.localized?,
        'default'   => self.default }.merge(custom_to_recipe)
    end
99843
def method_information(inspected)
      arg_mapping = argument_mapping
      info        = {:method => {}, :instance_method => {}}

      inspected.each do |type, methods|
        methods.each do |method|
          args = []

          method.parameters.each_with_index do |arg, index|
            name = arg[1] || "arg#{index + 1}"
            args << {:type => arg_mapping[arg[0]], :name => name}
          end

          info[type][method.name] = args
        end
      end

      return info
    end
534487
def klass
      klass_name = options.fetch(:class, name).to_s.camelize
      Object.const_get(klass_name)
    rescue NameError
      raise InvalidClassError, "class #{klass_name.inspect} does not exist"
    end
927269
def new
      hash = {}

      if step = Step.find_by_id(params["step_id"])
        hash[:container] = step
      elsif element = RiddlerAdmin::Element.find_by_id(params[:element_id])
        hash[:container] = element
      end

      @element = @element_class.new hash
    end
559527
def select
      new_instance = self.class.new
      if block_given?
        @data.each { |k,v| new_instance.data[k] = v if yield(k,v) }
      end
      return new_instance
    end
1373569
def attributes
      return @attributes if @attributes

      unsorted = Hash.new { |h,k| h[k] = Hash.new(0) }
      snapshots.each do |attributes|
        attributes = attributes[@field] if @field

        attributes.each do |h|
          h.each { |attribute, value| unsorted[attribute][value] += 1 }
        end
      end

      @attributes = Hash.new { |h,k| h[k] = [] }
      unsorted.each do |name, h|
        h.each do |value, count|
          @attributes[name] << { :value => value, :count => count }
        end
        @attributes[name].sort! { |x,y| y[:count] <=> x[:count] }
      end

      return @attributes
    end
1311446
def serializable_hash
      return serializable_collection if collection?
      self.class._attributes.each_with_object({}) do |(name, option), hash|
        if _include_from_options?(name) && public_send(option[:include_method])
          hash[option[:key] || name] = _set_value(name, option)
        end
      end
    end
593834
def to_hash
      hash = {}

      instance_variables.each do |v|
        hash[v.to_s[1..-1].to_sym] = instance_variable_get(v)
      end

      hash[:results].each do |c|
        hash[:results][hash[:results].index(c)] = c.to_hash
      end

      hash
    end
1229551
def get_class(class_entry)
      result = nil
      for path in class_entry.path_names
        path = RiWriter.class_desc_path(path, class_entry)
        desc = File.open(path) {|f| RI::Description.deserialize(f) }
        if result
          result.merge_in(desc)
        else
          result = desc
        end
      end
      result
    end
884178
def hash_to_model(klass_name, hash)
      model_klass =
        if self.class.const_defined?("#{self.class}::#{klass_name}")
          self.class.const_get(klass_name)
        else
          self.class.const_set(klass_name, Class.new(HashModel))
        end
      model_klass.new(hash)
    end
992125
def build_collections_and_classes
    @classes = Hash.new
    @class_metadata = Hash.new # This is used to store property information about a class

    # Build complex types first, these will be used for entities
    complex_types = @edmx.xpath("//edm:ComplexType", @ds_namespaces) || []
    complex_types.each do |c|
      name = qualify_class_name(c['Name'])
      props = c.xpath(".//edm:Property", @ds_namespaces)
      methods = props.collect { |p| p['Name'] } # Standard Properties
      @classes[name] = ClassBuilder.new(name, methods, [], self, @namespace).build unless @classes.keys.include?(name)
    end

    entity_types = @edmx.xpath("//edm:EntityType", @ds_namespaces)
    entity_types.each do |e|
      next if e['Abstract'] == "true"
      klass_name = qualify_class_name(e['Name'])
      methods = collect_properties(klass_name, e, @edmx)
      nav_props = collect_navigation_properties(klass_name, e, @edmx)
      @classes[klass_name] = ClassBuilder.new(klass_name, methods, nav_props, self, @namespace).build unless @classes.keys.include?(klass_name)
    end

    # Fill in the collections instance variable
    collections = @edmx.xpath("//edm:EntityContainer/edm:EntitySet", @ds_namespaces)
    collections.each do |c|
      entity_type = c["EntityType"]
      @collections[c["Name"]] = { :edmx_type => entity_type, :type => convert_to_local_type(entity_type) }
    end

    build_function_imports
  end
1364206
def deep_copy_hash hash
      require_that(hash.is_a?(Hash), "deep_copy_hash requires a hash be specified, got #{hash.class}")
      Marshal.load Marshal.dump(hash)
    end
129811
def to_hash
      Hash[instance_variables.map { |name| [name.to_s.delete('@').to_sym, instance_variable_get(name)] }]
    end
1242333
def resource(opts = {})
      raise ArgumentError, ':type and :title are required' unless opts[:type] && opts[:title]
      build
      build_resource_hash if @resource_hash.nil?
      return nil unless @resource_hash[opts[:type]].is_a?(Hash)
      @resource_hash[opts[:type]][opts[:title]]
    end
510813
def GetHasher(cls, hasher_name):
    
    hasher_name = hasher_name.lower()
    if hasher_name not in cls._hasher_classes:
      raise KeyError(
          'hasher class not set for name: {0:s}.'.format(hasher_name))

    hasher_class = cls._hasher_classes[hasher_name]
    return hasher_class()
1176483
def build_results

      # Now we uinq the attributes
      @attributes_to_pluck.uniq!{|f| f[:name] }

      # Obtain both the names and SQL columns
      names_to_pluck = @attributes_to_pluck.map{|f| f[:name] }
      sql_to_pluck = @attributes_to_pluck.map{|f| f[:sql] }


      # And perform the real ActiveRecord pluck.
      pluck_records(sql_to_pluck).each_with_index do |record, index|
        # After the pluck we have to create the hash for each record.

        # If there's only a field we will not receive an array. But we need it
        # so we built it.
        record = [record] unless record.is_a? Array
        # Now we zip it with the attribute names and create a hash. If we have
        # have a record: [1, "Test title 1", "Test text 1"] and the
        # names_to_pluck are [:id, :title, :text] we will end with {:id=>1,
        # :title=>"Test title 1", :text=>"Test text 1"}
        attributes_to_return = Hash[names_to_pluck.zip(record)]

        # Now we store it in the results hash
        @results[attributes_to_return[:id]] = attributes_to_return
      end
    end
876770
def create_migration_method_hashes
      # the class => attribute => migration filter hash
      @attr_flt_hash = {}
      customizable_class_attributes.each do |klass, pas|
        flts = migration_filters(klass) || next
        @attr_flt_hash[klass] = flts
      end
      # print the migration shim methods
      unless @mgt_mths.empty? then
        logger.info("Migration shim methods:\n#{@mgt_mths.qp}")
      end
    end