formatting 0.0.11 → 0.0.12

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,15 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 86d1360d37ac53df729455a549d27360133a2926
4
- data.tar.gz: b1a7d79c9b51f887b3900b3b384e27903d0c2907
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ MDgyNTczNTE4YmVlN2ZiYTM5NmJhYTNhOTYzZTUyZGY5M2E4YmE4MQ==
5
+ data.tar.gz: !binary |-
6
+ Mjc0MGZkNWI0MDE5MzY1YjBhOTgwNGI2YTYwMjIxMWFkZmYxMTY2NQ==
5
7
  SHA512:
6
- metadata.gz: 7f548175ebee4b7c92fa55706cb9cb49316aba8ab32b74e30600d35e114299bc2f32aa34aea5c716ef53c9ddc69d08871be57d47cc65477deaff69b76158b791
7
- data.tar.gz: 1bc2c988fa321b29b252e760095e276f7f1822db22f296b04b16acd696b5a7e5cdc023cdfd76fd41e955c9db1634cfba7ccc1c0b3973d8f56561bf0564908a3d
8
+ metadata.gz: !binary |-
9
+ NGQwNTgwOTliODBiZGE4MTZlYmVlOWRhZmMwM2Y4MGUwODkyMDdjZmVhODcy
10
+ ZGVmYTgxNDNmNzkxYTU0MGUyM2RmMWE5NTQ5ZmU0ZWI1ZDYyNGQ2YTg5Njc3
11
+ MmVjYTY5NDQ3YTYxNzgyYjM2ZTE3Njc4YTlkYTI0YTQ2OGQ5MTI=
12
+ data.tar.gz: !binary |-
13
+ Y2EwN2UxMWQxZGIwYWQzMDk5ZWRjZmNhNzM4NmFmZGNmZTcwZjRiYzhiMGZk
14
+ NWYyMTBiN2QwZTc5MWU1ZTU1ZDM2OTg5NzQ4N2YzMDFhZmY5YmYzNWY4NDhj
15
+ ZmJlNTYwZDY0MjQzNDBjZGUxYTA5ZmYwMTU5NjM5ZmM2ZmU0ZjQ=
data/lib/formatting.rb CHANGED
@@ -1,3 +1,6 @@
1
+ # encoding: utf-8
2
+ # ^ so NON_BREAKING_SPACE is treated as UTF-8 in Ruby 1.9.
3
+
1
4
  require "formatting/version"
2
5
  require "formatting/number"
3
6
  require "formatting/currency"
@@ -1,3 +1,3 @@
1
1
  module Formatting
2
- VERSION = "0.0.11"
2
+ VERSION = "0.0.12"
3
3
  end
data/spec/number_spec.rb CHANGED
@@ -14,6 +14,11 @@ describe Formatting do
14
14
  expect_formatted(1234567.89).to eq space_to_nbsp("1 234 567.89")
15
15
  end
16
16
 
17
+ # We had a bug in Ruby 1.9.
18
+ it "uses UTF-8 encoding so non-breaking spaces are interpreted correctly" do
19
+ expect(Formatting.format_number(1234).encoding).to eq Encoding::UTF_8
20
+ end
21
+
17
22
  context "thousands separator" do
18
23
  context "with I18n" do
19
24
  let(:i18n) { stub_const("I18n", double) }
data/spec/spec_helper.rb CHANGED
@@ -2,7 +2,7 @@ require "formatting"
2
2
 
3
3
  module Helpers
4
4
  def space_to_nbsp(value)
5
- value.gsub(" ", "\xc2\xa0")
5
+ value.gsub(" ", Formatting::NON_BREAKING_SPACE)
6
6
  end
7
7
  end
8
8
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: formatting
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.11
4
+ version: 0.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henrik Nyh
@@ -14,14 +14,14 @@ dependencies:
14
14
  name: attr_extras
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ! '>='
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ! '>='
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
@@ -42,28 +42,28 @@ dependencies:
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ! '>='
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ! '>='
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rspec
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '>='
59
+ - - ! '>='
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '>='
66
+ - - ! '>='
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  description:
@@ -96,17 +96,17 @@ require_paths:
96
96
  - lib
97
97
  required_ruby_version: !ruby/object:Gem::Requirement
98
98
  requirements:
99
- - - '>='
99
+ - - ! '>='
100
100
  - !ruby/object:Gem::Version
101
101
  version: '0'
102
102
  required_rubygems_version: !ruby/object:Gem::Requirement
103
103
  requirements:
104
- - - '>='
104
+ - - ! '>='
105
105
  - !ruby/object:Gem::Version
106
106
  version: '0'
107
107
  requirements: []
108
108
  rubyforge_project:
109
- rubygems_version: 2.2.0
109
+ rubygems_version: 2.2.1
110
110
  signing_key:
111
111
  specification_version: 4
112
112
  summary: Rails-less formatting for your unit-testable code.