sane 0.23.6 → 0.24.0

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/ChangeLog CHANGED
@@ -1,4 +1,7 @@
1
- 0.25.6 add Socket.get_host_ips, remove dependency on andand until I need it again.
1
+ 0.24.0
2
+ remove __dir__ (deemed too confusing, since it would seem to imply that __file__ also exists, which it doesn't)
3
+ change __DIR__ from /a/b/ to /a/b (also confused me once, can't have that!)
4
+ add Numeric#group_digits(',')
2
5
 
3
6
  # 3: add hash_set_operators
4
7
  # 0.2.2: add Regex+Regex, bug fixes
data/Rakefile CHANGED
@@ -7,5 +7,5 @@ Jeweler::Tasks.new do |s|
7
7
  s.description = s.summary = %q{Helpers for ruby core to make it easier to work with--things that are missing from core but should arguably be there}
8
8
  s.email = ["rogerdpack@gmail.com"]
9
9
  s.add_dependency 'os'
10
- #s.add_dependency 'andand' # turns out to be pretty useful...
10
+ s.add_dependency 'andand' # turns out to be pretty useful...
11
11
  end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.23.6
1
+ 0.24.0
@@ -5,8 +5,8 @@ if RUBY_VERSION < '1.9.2'
5
5
  small = "%f" % self
6
6
 
7
7
  if small.to_f == self
8
- small.sub! /0+$/, ''
9
- small.sub /\.$/, '.0'
8
+ small.sub!(/0+$/, '')
9
+ small.sub(/\.$/, '.0') # reformat, see spec
10
10
  else
11
11
  big
12
12
  end
@@ -65,7 +65,9 @@ module Kernel
65
65
  dir += '/' if dir
66
66
  dir
67
67
  end unless defined?(__DIR__)
68
- alias __dir__ __DIR__ unless defined?(__dir__)
68
+ # deemed too unfriendly since it would
69
+ # seem to imply that _file__ also exists
70
+ # alias __dir__ __DIR__ unless defined?(__dir__)
69
71
  end
70
72
 
71
73
  if RUBY_VERSION >= '1.9.2'
@@ -30,6 +30,7 @@ describe Sane do
30
30
 
31
31
  it "should have working __DIR__" do
32
32
  __DIR__.should_not == nil
33
+ __DIR__[-1].should_not == '/' # not ending slash, that feels weird in real use.
33
34
  end
34
35
 
35
36
  it "should write to files" do
@@ -42,10 +43,6 @@ describe Sane do
42
43
  File.delete filename
43
44
  end
44
45
 
45
- it "should have __dir__ too" do
46
- __dir__.should_not be_nil
47
- end
48
-
49
46
  class A
50
47
  def go; 3; end
51
48
  end
@@ -179,14 +176,9 @@ describe Sane do
179
176
  end
180
177
 
181
178
  it "should have an insert commas operator on numbers" do
182
- 1_000_000.comma_format.should == '1,000,000'
183
- 1_000_000.0.comma_format.should == '1,000,000.0'
184
- 1_000_000.0.comma_format.should == '1,000,000.0'
179
+ 1_000_000.group_digits.should == '1,000,000'
180
+ 1_000_000.0.group_digits.should == '1,000,000.0'
181
+ 1_000_000.03555.group_digits.should == '1,000,000.03555'
185
182
  end
186
183
 
187
- it 'should have socket ips' do
188
- Socket.get_host_ips.length.should be > 0
189
- end
190
-
191
-
192
184
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sane
3
3
  version: !ruby/object:Gem::Version
4
- hash: 79
4
+ hash: 127
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 23
9
- - 6
10
- version: 0.23.6
8
+ - 24
9
+ - 0
10
+ version: 0.24.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Roger Pack
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-09-23 00:00:00 Z
18
+ date: 2011-07-05 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: os
@@ -31,6 +31,20 @@ dependencies:
31
31
  version: "0"
32
32
  type: :runtime
33
33
  version_requirements: *id001
34
+ - !ruby/object:Gem::Dependency
35
+ name: andand
36
+ prerelease: false
37
+ requirement: &id002 !ruby/object:Gem::Requirement
38
+ none: false
39
+ requirements:
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ hash: 3
43
+ segments:
44
+ - 0
45
+ version: "0"
46
+ type: :runtime
47
+ version_requirements: *id002
34
48
  description: Helpers for ruby core to make it easier to work with--things that are missing from core but should arguably be there
35
49
  email:
36
50
  - rogerdpack@gmail.com
@@ -68,7 +82,6 @@ files:
68
82
  - lib/sane/pps.rb
69
83
  - lib/sane/require_relative.rb
70
84
  - lib/sane/sane_random.rb
71
- - lib/sane/socket_ips.rb
72
85
  - lib/sane/string_blank.rb
73
86
  - lib/sane/test.rb
74
87
  - lib/sane/test/assertions.rb
@@ -112,7 +125,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
112
125
  requirements: []
113
126
 
114
127
  rubyforge_project:
115
- rubygems_version: 1.7.2
128
+ rubygems_version: 1.8.5
116
129
  signing_key:
117
130
  specification_version: 3
118
131
  summary: Helpers for ruby core to make it easier to work with--things that are missing from core but should arguably be there
@@ -1,34 +0,0 @@
1
- class Numeric
2
- def ord; self; end unless RUBY_VERSION[0..2] == '1.9' # helper for 1.8/1.9
3
- end
4
-
5
- require 'socket' # sane already loads it for BasicSocket.reverse_lookup
6
-
7
- class Socket
8
- class << self
9
- def get_host_ips
10
- get_ips(Socket.gethostname)
11
- end
12
-
13
- def get_ips hostname
14
- begin
15
-
16
- socket_info = Socket.getaddrinfo(hostname, nil,
17
- Socket::AF_UNSPEC, Socket::SOCK_STREAM, nil,
18
- Socket::AI_CANONNAME).select{|type| type[0] == 'AF_INET'}
19
-
20
- raise if socket_info.length == 0
21
- ips = socket_info.map{|info| info[3]}
22
- return ips
23
- rescue => e # getaddrinfo failed...
24
- begin
25
- ipInt = gethostbyname(hostname)[3] # do a DNS lookup
26
- return ["%d.%d.%d.%d" % [ipInt[0].ord, ipInt[1].ord, ipInt[2].ord, ipInt[3].ord]]
27
- rescue SocketError # happens in certain instances...
28
- return nil
29
- end
30
- end
31
- end
32
-
33
- end
34
- end