Class: Array
- Includes:
- ArrayKeys::ArrayExtensions
- Defined in:
- lib/sequel/core_sql.rb,
lib/sequel/array_keys.rb
Overview
Array extensions.
Instance Attribute Summary
Attributes included from ArrayKeys::ArrayExtensions
Class Method Summary collapse
-
.from_hash(h) ⇒ Object
Converts a hash into an array with keys.
Instance Method Summary collapse
-
#to_sql ⇒ Object
Concatenates an array of strings into an SQL string.
Class Method Details
.from_hash(h) ⇒ Object
Converts a hash into an array with keys.
251 252 253 254 |
# File 'lib/sequel/array_keys.rb', line 251 def self.from_hash(h) a = []; a.keys = [] a.merge!(h) end |
Instance Method Details
#to_sql ⇒ Object
Concatenates an array of strings into an SQL string. ANSI SQL and C-style comments are removed, as well as excessive white-space.
5 6 7 8 |
# File 'lib/sequel/core_sql.rb', line 5 def to_sql map {|l| (l =~ /^(.*)--/ ? $1 : l).chomp}.join(' '). \ gsub(/\/\*.*\*\//, '').gsub(/\s+/, ' ').strip end |