licensee 9.3.1 → 9.4.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 686c1d6bcdeb0ba5e6ea53812e3e264926c71cdd
4
- data.tar.gz: f252392d65e2e9ec2af84850558bc7c583e1b5c5
3
+ metadata.gz: 65fcfb5d490c6b1c20c0b28f46cb67384755d869
4
+ data.tar.gz: 68d6bd7a409d4fe4bcac047a02e4ae9118d76a18
5
5
  SHA512:
6
- metadata.gz: 74d3e52865c1cc086f8c8bdc16e9ad66c0722f40d73ef0d1a00abddce3e5a1df7cfd2798699ee2f1f6f52889700e007269bdd245fc7d1172593015e85969a3f7
7
- data.tar.gz: ad46ba133915e82c14ce7ac1909abca10794b30e535da4e2b233b4c57ba9cbc6762d92dfd6ac211458b5740ac5088ea6074c7640dc01c6192d48a3eadce9eb70
6
+ metadata.gz: e4b5cac3a131f7a666126f6c7d0e8bd43372b07c6c9eb1e101e4248273879ae67cfccd20869e6cad30c3b7409368653d882316a4205bdd45c7a4b3edf546a131
7
+ data.tar.gz: 6ce3b0827cd6f725c210fea7aa8a929309ea3c2efff5bff5107fb645bcc2826443b51c964b1d0c3a6e1f227f0014f4c11610f16d3eff522d0841a4da9fbfda7b
@@ -45,5 +45,11 @@ module Licensee
45
45
 
46
46
  alias key name
47
47
  FIELD_REGEX = /\[(#{Regexp.union(LicenseField.keys)})\]/
48
+
49
+ # The human-readable field name
50
+ def label
51
+ key.sub('fullname', 'full name').capitalize
52
+ end
53
+ alias to_s label
48
54
  end
49
55
  end
@@ -1,3 +1,3 @@
1
1
  module Licensee
2
- VERSION = '9.3.1'.freeze
2
+ VERSION = '9.4.0'.freeze
3
3
  end
@@ -53,11 +53,27 @@ RSpec.describe Licensee::LicenseField do
53
53
  it 'stores and exposes values' do
54
54
  field = described_class.new('foo', 'bar')
55
55
  expect(field.name).to eql('foo')
56
+ expect(field.key).to eql('foo')
56
57
  expect(field.description).to eql('bar')
57
58
  end
58
59
 
60
+ it 'returns the field label' do
61
+ field = described_class.new('foo', 'bar')
62
+ expect(field.label).to eql('Foo')
63
+ end
64
+
59
65
  it "doesn't error for licenses without bodies" do
60
66
  other = Licensee::License.find('other')
61
67
  expect(other.fields).to be_empty
62
68
  end
69
+
70
+ it 'converts fullname to two words' do
71
+ field = described_class.new('fullname', 'foo')
72
+ expect(field.label).to eql('Full name')
73
+ end
74
+
75
+ it 'returns the label for #to_s' do
76
+ field = described_class.new('foo', 'bar')
77
+ expect(field.to_s).to eql('Foo')
78
+ end
63
79
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: licensee
3
3
  version: !ruby/object:Gem::Version
4
- version: 9.3.1
4
+ version: 9.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Balter
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-10-26 00:00:00.000000000 Z
11
+ date: 2017-11-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rugged