Class: Hash

Inherits:
Object
  • Object
show all
Defined in:
lib/marjoree/core.rb,
lib/marjoree/fixtures.rb

Instance Method Summary collapse

Instance Method Details

#symbolize_keysObject



7
8
9
10
11
12
# File 'lib/marjoree/core.rb', line 7

def symbolize_keys
    self.inject({}) do |result, (key, value)|
        result[key.to_sym] = value
        result
    end
end

#to_sql(table) ⇒ Object



151
152
153
154
155
# File 'lib/marjoree/fixtures.rb', line 151

def to_sql(table)
  columns = keys.join(',')
  column_values = values.collect { |v| v.kind_of?(Numeric) ? v : "'#{v}'" }.join(',')
  return "INSERT INTO #{table}(#{columns}) VALUES(#{column_values})"
end