yyks_simple_command 0.1.2 → 0.1.3

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
  SHA256:
3
- metadata.gz: cdcc22becbd4d9520832ee55884a544401d92125f990c448b4ba4ad7fe8f2681
4
- data.tar.gz: f531b3ebdcbf3e5bf5560bd466f5a1b5853f5844dcaa3165156cb915c1d69a7a
3
+ metadata.gz: 141f232dfaf02d31bbd6bdc05f8d917ee099f96047d4a38cc21e6d1bb222beb8
4
+ data.tar.gz: 004544f7b657b5b9b6ea7018434c88e458f27f0186f41e195ccce027f5453124
5
5
  SHA512:
6
- metadata.gz: '00941e9317fafe2f7706564b4da03413375239e8de819f4c49fb5cb0e9454814aa1cb78b77745db524d805151cb6be2631bf0d30f51c11f455ab4e6f97ab3ea3'
7
- data.tar.gz: 34514eaad80d64b7621ace1dd5af19ca8d8873c941b156dde888e075ea4257cda2ba2fdb4653bfe757bd1f989450448427f5a5e894688a96954ad35877b0b5a5
6
+ metadata.gz: 14540254963e72c81777156c2a8896916886e2f0f3bf4338115c5bda5a57700b47c6b26f8a8bd24a143ffe3ae05de7d0f20cbfe3e264b8e9afbc8bf0a184c1e9
7
+ data.tar.gz: 299b44963728374ce5511c48f112e001af7d3d635a2a406adf84d6d3f0f33561dee5f630ac3034ae37e07fdb22ea974499b3e25d0ac6e89d980b94afc91e30aa
@@ -19,5 +19,16 @@ module SimpleCommand
19
19
  self[field].each { |message| yield field, message }
20
20
  end
21
21
  end
22
+
23
+ def full_messages
24
+ map { |attribute, message| full_message(attribute, message) }
25
+ end
26
+
27
+ private
28
+ def full_message(attribute, message)
29
+ return message if attribute == :base
30
+ attr_name = attribute.to_s.tr('.', '_').capitalize
31
+ "%s %s" % [attr_name, message]
32
+ end
22
33
  end
23
34
  end
@@ -1,3 +1,3 @@
1
1
  module SimpleCommand
2
- VERSION = '0.1.2'
2
+ VERSION = '0.1.3'
3
3
  end
@@ -55,4 +55,17 @@ describe SimpleCommand::Errors do
55
55
  )
56
56
  end
57
57
  end
58
+
59
+ describe '#full_messages' do
60
+ before do
61
+ errors.add :attr1, 'has an error'
62
+ errors.add :attr2, 'has an error'
63
+ errors.add :attr2, 'has two errors'
64
+ end
65
+
66
+ it "returrns the full messages array" do
67
+ expect(errors.full_messages).to eq ["Attr1 has an error", "Attr2 has an error", "Attr2 has two errors"]
68
+ end
69
+
70
+ end
58
71
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yyks_simple_command
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Moicen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-01-05 00:00:00.000000000 Z
11
+ date: 2019-01-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler