paranoid_starlight 2.0 → 2.0.1

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.
data/.gitignore CHANGED
@@ -15,3 +15,4 @@ spec/reports
15
15
  test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
+ .directory
data/README.md CHANGED
@@ -60,7 +60,7 @@ If you required active_record hook, you can use:
60
60
  validates_email_format_of :email
61
61
  validates_name_format_of :name
62
62
  # few different valid formats are allowed
63
- validates_telephone_format_of :telephone, :mobile
63
+ validates_telephone_number_convertibility_of :telephone, :mobile
64
64
  # or validates :email, :email => true
65
65
 
66
66
  before_save :convert_fields
@@ -85,7 +85,7 @@ Currently there are these possibilities:
85
85
 
86
86
  - validates_email_format_of
87
87
  - validates_name_format_of
88
- - validates_telephone_number_of
88
+ - validates_telephone_number_convertibility_of
89
89
 
90
90
  *Converters for attributes* (getter and setter methods in object are enough)
91
91
 
@@ -15,7 +15,7 @@
15
15
  # Just type: (require 'paranoid_starlight/active_record')
16
16
  #
17
17
 
18
- require "paranoid_starlight/version"
18
+ require_relative "paranoid_starlight/version"
19
19
  require 'active_model'
20
20
  require 'twitter_cldr'
21
21
  require 'fast_gettext'
@@ -14,7 +14,12 @@ module ParanoidStarlight
14
14
  def validates_name_format_of(*attr_names)
15
15
  validates_with ::ParanoidStarlight::Validators::NameValidator, _merge_attributes(attr_names)
16
16
  end
17
-
17
+
18
+ def validates_telephone_number_convertibility_of(*attr_names)
19
+ validates_with ::ParanoidStarlight::Validators::TelephoneValidator, _merge_attributes(attr_names)
20
+ end
21
+
22
+ # will be deprecated or reworked
18
23
  def validates_telephone_number_of(*attr_names)
19
24
  validates_with ::ParanoidStarlight::Validators::TelephoneValidator, _merge_attributes(attr_names)
20
25
  end
@@ -1,8 +1,8 @@
1
1
  module ParanoidStarlight
2
2
  module Converters
3
3
  def convert_telephone(num, prefixcc = 421)
4
- telephone = num.to_s
5
- prefixcc = prefixcc.to_s
4
+ telephone = num.to_s.dup
5
+ prefixcc = prefixcc.to_s.dup
6
6
 
7
7
  # convert logic
8
8
  # possible formats, with or without spaces
@@ -1,3 +1,3 @@
1
1
  module ParanoidStarlight
2
- VERSION = "2.0"
2
+ VERSION = "2.0.1"
3
3
  end
@@ -22,7 +22,10 @@ end
22
22
 
23
23
  class TestTelephone < WithValidations
24
24
  attr_accessor :telephone
25
- validates_telephone_number_of :telephone
25
+
26
+ # will be deprecated or reqorked
27
+ # validates_telephone_number_of :telephone
28
+ validates_telephone_number_convertibility_of :telephone
26
29
  end
27
30
 
28
31
  describe ParanoidStarlight::Attributes::Validations do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paranoid_starlight
3
3
  version: !ruby/object:Gem::Version
4
- version: '2.0'
4
+ version: 2.0.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-29 00:00:00.000000000 Z
12
+ date: 2013-01-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activemodel