morse_nameable 1.0.2 → 1.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: 17074da7e1534030f3cbda39540cd50687dac4f2
4
- data.tar.gz: a5d906d8a0131199bcab20a271f5efd0db456738
3
+ metadata.gz: a5133693badd106b8dd679264457ee8f7be8b74d
4
+ data.tar.gz: 0ea6268c25aa1f8302e6a1925da2ee4049338871
5
5
  SHA512:
6
- metadata.gz: 8787066f5d8f82fa4df9af1a512b83c6beea1e5e931d75f8dac135cf63a911f780ba785d8d5e83537028cd789576351535747ca7a22bc0a97476bbba632da601
7
- data.tar.gz: 620de7d4c01f99f83655e4d147425b062fad75732127c36d47666965317da2ba5c57d5762f5381b868ce99ba80c6e36fa460deae85294e439d539106eb589d86
6
+ metadata.gz: 11c519c8a9fc832d2464fba1ffe81fe7d748d475256f5a005cf392a9a9342f10810b811a47c25aaabcf441699dab2ff9ef528f3988a571c2eed85561a3d78b52
7
+ data.tar.gz: 81307e0b9126b1156e28e6a88a07ebd9a55b5ffcaa9c730921b7f278a763706a0bec943e22132b2d9a0e0a6c5c5d02e2cdb1cbb6c3852151f1e47d03aa3825e0
@@ -1,3 +1,3 @@
1
1
  module MorseNameable
2
- VERSION = "1.0.2"
2
+ VERSION = "1.0.3"
3
3
  end
@@ -1,4 +1,4 @@
1
1
  require 'active_model'
2
2
  require 'active_support/all'
3
3
  require 'morse_fields_validator'
4
- require "morse_nameable/nameable"
4
+ require "nameable"
data/lib/nameable.rb ADDED
@@ -0,0 +1,39 @@
1
+ module Nameable
2
+ extend ActiveSupport::Concern
3
+ include FieldsValidator
4
+
5
+ included do
6
+ validate_required_attributes
7
+ end
8
+
9
+ class_methods do
10
+ def required_attributes
11
+ result=defined?(super) ? super : []
12
+ result+=required_nameable_attributes
13
+ end
14
+
15
+ def required_database_fields
16
+ result=defined?(super) ? super : []
17
+ result+=[:firstname, :lastname]
18
+ end
19
+
20
+ def required_nameable_attributes
21
+ [:firstname,:lastname]
22
+ end
23
+ end
24
+
25
+ public
26
+
27
+ def full_name
28
+ "#{firstname} #{lastname}"
29
+ end
30
+
31
+ def proper_name
32
+ "#{lastname.upcase}, #{firstname}"
33
+ end
34
+
35
+ private
36
+
37
+
38
+ end
39
+
@@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
21
21
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
22
  spec.require_paths = ["lib"]
23
23
 
24
- spec.add_dependency "morse_fields_validator",">=1.0"
24
+ spec.add_dependency "morse_fields_validator","~>1.0"
25
25
 
26
26
  spec.add_development_dependency "bundler", "~> 1.8"
27
27
  spec.add_development_dependency "coveralls", "~> 0.8"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: morse_nameable
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Terry S
@@ -9,20 +9,20 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-07-30 00:00:00.000000000 Z
12
+ date: 2015-07-31 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: morse_fields_validator
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - ">="
18
+ - - "~>"
19
19
  - !ruby/object:Gem::Version
20
20
  version: '1.0'
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - ">="
25
+ - - "~>"
26
26
  - !ruby/object:Gem::Version
27
27
  version: '1.0'
28
28
  - !ruby/object:Gem::Dependency
@@ -142,8 +142,8 @@ files:
142
142
  - bin/console
143
143
  - bin/setup
144
144
  - lib/morse_nameable.rb
145
- - lib/morse_nameable/nameable.rb
146
145
  - lib/morse_nameable/version.rb
146
+ - lib/nameable.rb
147
147
  - morse_nameable-1.0.0.gem
148
148
  - morse_nameable.gemspec
149
149
  homepage: https://github.com/morsedigital/morse_nameable
@@ -1,28 +0,0 @@
1
- module Nameable
2
- include FieldsValidator
3
- extend ActiveSupport::Concern
4
-
5
- included do
6
- load_required_attributes(*%w{firstname lastname})
7
- validate_required_attributes
8
- end
9
-
10
- public
11
-
12
- def full_name
13
- "#{firstname} #{lastname}"
14
- end
15
-
16
- def proper_name
17
- "#{lastname.upcase}, #{firstname}"
18
- end
19
-
20
- private
21
-
22
- def required_database_fields
23
- result=defined?(super) ? super : []
24
- result+=[:firstname, :lastname]
25
- end
26
-
27
- end
28
-