freighthopper 0.1.5 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.5
1
+ 0.1.6
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{freighthopper}
8
- s.version = "0.1.5"
8
+ s.version = "0.1.6"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Jacob Rothstein"]
12
- s.date = %q{2010-02-24}
12
+ s.date = %q{2010-04-21}
13
13
  s.default_executable = %q{convert_to_should_syntax}
14
14
  s.description = %q{More core ext}
15
15
  s.email = %q{github@jacobrothstein.com}
@@ -16,6 +16,7 @@ class Array
16
16
  def singular?() size == 1 end
17
17
  def singular() singular?? first : nil end
18
18
  def singular!() singular or raise "not singular" end
19
+ def symbols() map {|x| x.to_sym} end
19
20
  end
20
21
 
21
22
  class Object
@@ -51,6 +52,8 @@ class String
51
52
  scan /.{1,#{(size / num.to_f).ceil}}/
52
53
  end
53
54
 
55
+ def _() split(/\s+/).symbols end
56
+
54
57
  def unindent(options = {})
55
58
  tablength = options[:tablength] || 2
56
59
  lines = gsub("\t", " " * tablength).split("\n")
@@ -2,6 +2,12 @@ require File.instance_eval { expand_path join(dirname(__FILE__), 'test_helper')
2
2
  require 'freighthopper'
3
3
 
4
4
  class ArrayTest < Test::Unit::TestCase
5
+ context 'symbols' do
6
+ should 'map to sym' do
7
+ assert_equal [:a, :b, :c, :d, :e], %w( a b c d e ).symbols
8
+ end
9
+ end
10
+
5
11
  context 'singular' do
6
12
  should 'return the singular object if there is indeed only one' do
7
13
  assert_singular 5, [5]
@@ -34,6 +34,12 @@ class StringTest < Test::Unit::TestCase
34
34
  end
35
35
  end
36
36
 
37
+ context '._' do
38
+ should 'split and map to sym' do
39
+ assert_equal [:bark, :claim, :deep, :everest], "bark claim \n\ndeep\teverest"._
40
+ end
41
+ end
42
+
37
43
  context 'unindent' do
38
44
  should 'remove the least common leading whitespace' do
39
45
  unindented = (<<-END).unindent
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: freighthopper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jacob Rothstein
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-02-24 00:00:00 -08:00
12
+ date: 2010-04-21 00:00:00 -07:00
13
13
  default_executable: convert_to_should_syntax
14
14
  dependencies: []
15
15