formatting 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f41d31f291d939056af4b95f837c90e6eccc94ae
4
- data.tar.gz: 3061bd63d93f6c7b9d0082fff54dac279b072c34
3
+ metadata.gz: 35af947641623b8cf80b8323106412901717087e
4
+ data.tar.gz: 41ff76fcf71cac124cd77f1b58d0c70a21fdf0a1
5
5
  SHA512:
6
- metadata.gz: bf1788bf1924016ef909aa7f4fb51c5ee6205d6ad6700d50b32a44f3f5c7798d3edc6c854cf4d4a1c0ff44942cff344c72c4a68e635f10cb31845db488deb19d
7
- data.tar.gz: 638b6e2ec4d7ad0eb97a5a53cd0afa208b2fbe819606dc92748f60b8768f4d082520f79868a59a914a5be5fce0e60684dafe01be7a7aeabc11c5fc2111d8cb1b
6
+ metadata.gz: 4c49acfa52b48b08f6309e3e5eb2db8d55705c7c67b2aabc8ca9245084ecaadf3b55e5b641c3b983cc4b1fe7b665e3abb7fc16467c4bb9b336e468f04e48dd18
7
+ data.tar.gz: 9a223c7ed6d58d67f74eb0a5cfb0898b0f68980ff1f31f2e59888b0c454cadaea6052a72b1ccd4481922fd6e8cebb2182090b777fdbdf6dfe01a3921eb597d8d
data/README.md CHANGED
@@ -67,11 +67,6 @@ Formatting.format_currency(company, item.price) # => "1,234.00 SEK"
67
67
  Formatting.format_currency(company, 4567) # => "4,567.00 SEK"
68
68
 
69
69
  Formatting.format_currency(company, 4567, currency: false) # => "4,567.00"
70
-
71
- Formatting.defaults[:currency] = "SEK"
72
- item = Item.new(price: 1234) # Does not respond to "currency"
73
- Formatting.format_currency(item, :price) # => "1,234.00 SEK"
74
-
75
70
  ```
76
71
 
77
72
  #### Options
@@ -9,8 +9,6 @@ module Formatting
9
9
  raise NotARecordError, "Expected an object that could tell us its currency; got #{record.inspect}"
10
10
  end
11
11
 
12
- opts = Formatting.defaults.merge(opts)
13
-
14
12
  format_string = opts.fetch(:format, "<amount> <currency>")
15
13
  skip_currency = opts.fetch(:skip_currency, false)
16
14
 
@@ -1,8 +1,6 @@
1
1
  module Formatting
2
2
  module Number
3
3
  def format_number(number, opts = {})
4
- opts = Formatting.defaults.merge(opts)
5
-
6
4
  thousands_separator = opts.fetch(:thousands_separator) { default_thousands_separator }
7
5
  decimal_separator = opts.fetch(:decimal_separator) { default_decimal_separator }
8
6
  round = opts.fetch(:round, 2)
@@ -1,3 +1,3 @@
1
1
  module Formatting
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.8"
3
3
  end
data/lib/formatting.rb CHANGED
@@ -5,12 +5,6 @@ require "formatting/currency"
5
5
  module Formatting
6
6
  NON_BREAKING_SPACE = "\xc2\xa0"
7
7
 
8
- class << self
9
- attr_accessor :defaults
10
- end
11
-
12
- self.defaults = {}
13
-
14
8
  extend Number
15
9
  extend Currency
16
10
  end
@@ -39,11 +39,6 @@ describe Formatting do
39
39
  it "passes on number formatting options" do
40
40
  expect_formatted(item, 1.567, round: 2).to include "1.57"
41
41
  end
42
-
43
- it "applies default options" do
44
- Formatting.defaults = { currency: "FOO" }
45
- expect_formatted(item, 1).to eq space_to_nbsp("1.00 FOO")
46
- end
47
42
  end
48
43
 
49
44
  context "currency option" do
data/spec/number_spec.rb CHANGED
@@ -14,11 +14,6 @@ describe Formatting do
14
14
  expect_formatted(1234567.89).to eq space_to_nbsp("1 234 567.89")
15
15
  end
16
16
 
17
- it "applies default options" do
18
- Formatting.defaults = { round: 3 }
19
- expect_formatted(12.3456789).to eq "12.346"
20
- end
21
-
22
17
  context "thousands separator" do
23
18
  context "with I18n" do
24
19
  let(:i18n) { stub_const("I18n", double) }
data/spec/spec_helper.rb CHANGED
@@ -8,8 +8,4 @@ end
8
8
 
9
9
  RSpec.configure do |config|
10
10
  config.include Helpers
11
-
12
- config.before do
13
- Formatting.defaults = {}
14
- end
15
11
  end
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.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henrik Nyh
@@ -70,7 +70,6 @@ files:
70
70
  - lib/formatting/number.rb
71
71
  - lib/formatting/version.rb
72
72
  - spec/currency_spec.rb
73
- - spec/formatting_spec.rb
74
73
  - spec/number_spec.rb
75
74
  - spec/spec_helper.rb
76
75
  homepage: ''
@@ -99,7 +98,6 @@ specification_version: 4
99
98
  summary: Rails-less formatting for your unit-testable code.
100
99
  test_files:
101
100
  - spec/currency_spec.rb
102
- - spec/formatting_spec.rb
103
101
  - spec/number_spec.rb
104
102
  - spec/spec_helper.rb
105
103
  has_rdoc:
@@ -1,14 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe Formatting do
4
- describe "defaults" do
5
- it "starts out as an empty hash" do
6
- expect(Formatting.defaults).to eq({})
7
- end
8
-
9
- it "can get and set them" do
10
- Formatting.defaults = { hello: "world" }
11
- expect(Formatting.defaults).to eq({ hello: "world" })
12
- end
13
- end
14
- end