softwear-lib 1.6.2 → 1.7.0

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: ead93a521ac48efacde6f3a1fd9696d571e01412
4
- data.tar.gz: 7a704e8617c45a92de7162f19d10672b456fc7b1
3
+ metadata.gz: 3e9245f4938f0485bf4003d9ddaa38b8d81c2bc3
4
+ data.tar.gz: bd3b86ff184a2ecc9c5e3de2f0f42e483387ee6d
5
5
  SHA512:
6
- metadata.gz: f232c5b750d16dd7851ca6ae4d8dc927678f766be384e93367da16ccc53bcce34649ffaf3ea42f0da55a0060957d2021b5ed3393a1dcead319b228f666b532d8
7
- data.tar.gz: 7098e134d247c19e95f9120f0ab3c61ad60bfff203c4dea29c592aad994c6491102f428fcf3ea48f7d4ce1c5165cf8b5cb76e16aa186d10dbf173bf44900afa7
6
+ metadata.gz: e6c38fe0ee80ca9c9d507020d24f580b4f9748bd88241cf557059529d0ed3933ecb5e94de57be7a6a3f33007110a0a477b3991b7e2dae0d20561041b894a3ebc
7
+ data.tar.gz: 89600a8a7de982f5d195574ab38563b20d233d43c26cfd07c34dd45ee0fa56bdb936297e67dda6e3c9aeb528f390b2a554bb842617114ae9543be3f69ab57faf
@@ -7,7 +7,11 @@ module Softwear
7
7
  def belongs_to_user_called(name, options = {})
8
8
  foreign_key = "#{name}_id"
9
9
 
10
- class_eval <<-RUBY, __FILE__, __LINE__ + 1
10
+ # Create an anonymous module and include it, so that we can
11
+ # override the generated association methods and call `super`
12
+ # in the method body.
13
+ association_methods = Module.new
14
+ association_methods.module_eval <<-RUBY, __FILE__, __LINE__ + 1
11
15
  def #{name}
12
16
  @#{name} ||= User.find(#{name}_id)
13
17
  end
@@ -17,6 +21,8 @@ module Softwear
17
21
  @#{name} = new
18
22
  end
19
23
  RUBY
24
+
25
+ send(:include, association_methods)
20
26
  end
21
27
 
22
28
  def belongs_to_user
@@ -462,6 +462,10 @@ module Softwear
462
462
  def full_name
463
463
  "#{@first_name} #{@last_name}"
464
464
  end
465
+
466
+ def valid_password?(pass)
467
+ query("pass #{id} #{pass}") == 'yes'
468
+ end
465
469
  end
466
470
  end
467
471
  end
@@ -1,5 +1,5 @@
1
1
  module Softwear
2
2
  module Lib
3
- VERSION = "1.6.2"
3
+ VERSION = "1.7.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: softwear-lib
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.2
4
+ version: 1.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nigel Baillie
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-26 00:00:00.000000000 Z
11
+ date: 2016-03-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler