Completed
Pull Request — master (#14)
by Marcelo
40s
created

Date   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 11
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
c 1
b 0
f 0
dl 0
loc 11
rs 10
1
module Koine
2
  module Attributes
3
    module Adapter
4
      class Date < Base
5
        private
6
7
        def coerce_not_nil(date)
8
          secure do
9
            next date if date.is_a?(::Date)
10
            next date.to_date if date.is_a?(::Time)
11
            ::Date.parse(date)
12
          rescue => error
0 ignored issues
show
Bug introduced by
The Ruby parser could not interpret the code. It reported: unexpected token kRESCUE (Using Ruby 2.0 ...meter, under `AllCops`).
Loading history...
13
            raise ArgumentError.new(error)
14
          end
15
        end
16
      end
17
    end
18
  end
19
end
20