Class: Array
Overview
Cast an array to an id.
Instance Method Summary collapse
-
#to_date_ids ⇒ Object
Cast the items to date ids.
-
#to_i_ids ⇒ Object
Cast the items to integer ids.
-
#to_s_ids ⇒ Object
Cast the items to string ids.
-
#to_s_uuids ⇒ Object
Cast the items to string uuids.
-
#to_stint_ids ⇒ Object
Cast the items to stint ids.
Instance Method Details
#to_date_ids ⇒ Object
Cast the items to date ids.
[" 2000-12-31 ", " 2001-12-31 ", " 2002-12-31 "].to_date_ids
#=> ["2000-12-31", "2001-12-31", "2002-12-13"]
12 13 14 |
# File 'lib/sixarm_ruby_to_id/array.rb', line 12 def to_date_ids map{|x| x.to_date_id} end |
#to_i_ids ⇒ Object
Cast the items to integer ids.
[" 1 ", " 2 ", " 3 "].to_i_ids
#=> [1, 2, 3]
30 31 32 |
# File 'lib/sixarm_ruby_to_id/array.rb', line 30 def to_i_ids map{|x| x.to_i_id} end |
#to_s_ids ⇒ Object
Cast the items to string ids.
[" a ", " b ", " c "].to_i_ids
#=> ["a", "b", "c"]
39 40 41 |
# File 'lib/sixarm_ruby_to_id/array.rb', line 39 def to_s_ids map{|x| x.to_s_id} end |
#to_s_uuids ⇒ Object
Cast the items to string uuids.
[
" 00000000-0000-0000-0000-000000000000 "
" 11111111-1111-1111-1111-111111111111 ",
" 22222222-2222-2222-2222-222222222222 "
].to_s_uuids
#=> [
"00000000-0000-0000-0000-000000000000"
"11111111-1111-1111-1111-111111111111",
"22222222-2222-2222-2222-222222222222"
]
56 57 58 |
# File 'lib/sixarm_ruby_to_id/array.rb', line 56 def to_s_uuids map{|x| x.to_s_uuid} end |
#to_stint_ids ⇒ Object
Cast the items to stint ids.
["2000-12-30-2000-12-31", "2001-12-30-2001-12-31", "2002-12-30-2002-12-31".to_stint_ids
#=> ["2000-12-30-2000-12-31", "2001-12-30-2001-12-31", "2002-12-30-2002-12-31"]
21 22 23 |
# File 'lib/sixarm_ruby_to_id/array.rb', line 21 def to_stint_ids map{|x| x.to_stint_id} end |