Skip to content

Instantly share code, notes, and snippets.

@oren
Created March 22, 2010 00:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oren/339671 to your computer and use it in GitHub Desktop.
Save oren/339671 to your computer and use it in GitHub Desktop.
----------------------------------------------------------- Class: Array
Convert and array into a tuple.
------------------------------------------------------------------------
helper to check for method existance in ruby 1.8- and
1.9-compatible way because `methods`, `instance_methods` and others
return strings in 1.8 and symbols in 1.9
['foo', 'bar'].include_method?(:foo) # => true
------------------------------------------------------------------------
Sequel extends the Array class to add methods to implement the SQL
DSL. Most of these methods require that the array not be empty and
that it must consist solely of other arrays that have exactly two
elements.
------------------------------------------------------------------------
helper to check for method existance in ruby 1.8- and
1.9-compatible way because `methods`, `instance_methods` and others
return strings in 1.8 and symbols in 1.9
['foo', 'bar'].include_method?(:foo) # => true
------------------------------------------------------------------------
Includes:
---------
Diff::LCS(diff, lcs, patch, patch!, sdiff, traverse_balanced,
traverse_sequences, unpatch, unpatch!), Indexable(body, ends,
first, first!, first=, foot, head, index, index_of, last, last!,
last=, mid, middle, pos, range, tail, thru),
Mocha::ArrayMethods(mocha_inspect), Random(), Stackable(peek, poke,
pop, pull, push, shift, unshift)
Instance methods:
-----------------
all_two_pairs?, case, collapse, combination, conjoin,
delete_unless, delete_values, delete_values_at, dissolve,
flatten_one_level, include_method?, index, last=, mean, merge!,
nonempty?, not_empty?, object_state, one?, only, pad, pad!,
permutation, power_set, product, recursively, recursively!, rest,
rotate, rotate!, select!, shelljoin, shellwords, splice, sql_array,
sql_expr, sql_negate, sql_or, sql_string_join, sum, to_b,
to_boolean_h, to_h, to_h_assoc, to_h_auto, to_h_flat, to_h_multi,
to_h_splat, to_t, traverse, traverse!, uniq_by!, ~
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment