lev 7.0.2 → 7.0.3

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: b058526f574463059a8b4e17a129ae2bcb760214
4
- data.tar.gz: 05e4c081fb7c6828f82971a9135dac5e3c42aec4
3
+ metadata.gz: 39058e1cbfa410f404d73fa99f6cdb4fd101bdb6
4
+ data.tar.gz: 7b9f5c3e3366f9915f3c1bb16086c6b5c0c20a41
5
5
  SHA512:
6
- metadata.gz: 20f82c60f67ebc6262e0d22fae356989a71eaa8444fd2e11b1df24fa0d6daa71e1179140e65457368278bb1710e982f7b78b3938ae225cff151974deb4c5af2a
7
- data.tar.gz: 6771464edd118c4536167e8a085bc692081e10d322f43a5611ea271f2093cff32a85ea9d5e3ba54f2acc8c1821a005ace679c3f675963c35242a54542f05ee7f
6
+ metadata.gz: 388f7e4f202994665ddcc1881081526859d3e059738e2f60af3ebed416f4e4615a9d75bac3d588fd84780e9f331a60d0f8b2a4c4477b11eb1caebce301177af4
7
+ data.tar.gz: 756b6ee8991ee1b3e92912c496c1d766be58122b8c9efaefff90edcbab267c610b5453ebe837ab6b46d18130e66d15bcac984d30e760bb5d63e4f2e54b49ff11
@@ -244,6 +244,10 @@ module Lev
244
244
  messages.dup
245
245
  end
246
246
 
247
+ def to_s
248
+ inspect
249
+ end
250
+
247
251
  # Adds +message+ to the error messages on +attribute+. More than one error can be added to the same
248
252
  # +attribute+.
249
253
  # If no +message+ is supplied, <tt>:invalid</tt> is assumed.
@@ -311,11 +315,11 @@ module Lev
311
315
  def self.full_message(model, attribute, message)
312
316
  return message if attribute == :base
313
317
  attr_name = attribute.to_s.gsub('.', '_').humanize
314
- attr_name = model.class.human_attribute_name(attribute, :default => attr_name)
318
+ attr_name = model.class.human_attribute_name(attribute, default: attr_name)
315
319
  I18n.t(:"errors.format", {
316
- :default => "%{attribute} %{message}",
317
- :attribute => attr_name,
318
- :message => message
320
+ default: "%{attribute} %{message}",
321
+ attribute: attr_name,
322
+ message: message
319
323
  })
320
324
  end
321
325
 
@@ -24,6 +24,26 @@ module Lev
24
24
  ErrorTranslator.translate(self)
25
25
  end
26
26
 
27
+ def to_s
28
+ inspect
29
+ end
30
+
31
+ def full_message
32
+ attribute = data[:attribute] if data.present?
33
+ return message.humanize if attribute.nil?
34
+
35
+ attr_name = attribute.to_s.gsub('.', '_').humanize
36
+
37
+ model = data[:model]
38
+ attr_name = model.class.human_attribute_name(attribute, default: attr_name) if model.present?
39
+
40
+ I18n.t(:"errors.format", {
41
+ default: "%{attribute} %{message}",
42
+ attribute: attr_name,
43
+ message: message
44
+ })
45
+ end
46
+
27
47
  end
28
48
 
29
49
  end
@@ -50,10 +50,14 @@ module Lev
50
50
  end
51
51
 
52
52
  def raise_exception_if_any!(exception_type = StandardError)
53
- raise exception_type, collect{|error| error.message}.join('; ') if any?
53
+ raise exception_type, map(&:message).join('; ') if any?
54
54
  end
55
55
 
56
- protected
56
+ def full_messages
57
+ map(&:full_message)
58
+ end
59
+
60
+ protected
57
61
 
58
62
  attr_reader :routine_status
59
63
  attr_reader :raise_fatal_errors
@@ -376,19 +376,19 @@ module Lev
376
376
  end
377
377
 
378
378
  #
379
- # Attach the subroutine to self, call it, transfer errors and results
379
+ # Attach the subroutine to self, call it, transfer outputs and errors
380
380
  #
381
381
 
382
382
  other_routine.runner = self
383
383
  run_result = other_routine.call(*args, &block)
384
384
 
385
- options[:errors_are_fatal] = true if !options.has_key?(:errors_are_fatal)
386
- transfer_errors_from(run_result.errors, input_mapper, options[:errors_are_fatal])
387
-
388
385
  run_result.outputs.transfer_to(outputs) do |name|
389
386
  output_mapper.map(name)
390
387
  end
391
388
 
389
+ options[:errors_are_fatal] = true if !options.has_key?(:errors_are_fatal)
390
+ transfer_errors_from(run_result.errors, input_mapper, options[:errors_are_fatal])
391
+
392
392
  run_result
393
393
  end
394
394
 
@@ -1,3 +1,3 @@
1
1
  module Lev
2
- VERSION = "7.0.2"
2
+ VERSION = "7.0.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lev
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.0.2
4
+ version: 7.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - JP Slavinsky
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-20 00:00:00.000000000 Z
11
+ date: 2016-08-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
@@ -292,7 +292,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
292
292
  version: '0'
293
293
  requirements: []
294
294
  rubyforge_project:
295
- rubygems_version: 2.4.5.1
295
+ rubygems_version: 2.4.8
296
296
  signing_key:
297
297
  specification_version: 4
298
298
  summary: Ride the rails but don't touch them.