modelish 0.2.3 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 0.2.4 (2012-8-23)
4
+
5
+ * Make modelish compatible with hashie v1.x, instead of pinning to hashie v1.0.0.
6
+
3
7
  ## 0.2.3 (2012-8-17)
4
8
 
5
9
  * Tweak implementation of validate! method to call validate method, replacing a parallel
@@ -12,7 +16,7 @@
12
16
  ## 0.2.1 (2012-3-8)
13
17
 
14
18
  * Bug fix to make behavior predictable for translated properties when both the property
15
- name and the translated property name are present in an initialization hash (issue #5).
19
+ name and the translated property name are present in an initiali23zation hash (issue #5).
16
20
  * Modelish::Base#to_hash now processes the contents of Array-typed properties.
17
21
 
18
22
  ## 0.2.0 (2012-1-16)
data/lib/modelish/base.rb CHANGED
@@ -62,7 +62,10 @@ module Modelish
62
62
  add_property_type(name, options[:type]) if options[:type]
63
63
  add_property_translation(options[:from], name) if options[:from]
64
64
 
65
- add_validator(name) { |val| validate_required(name => val).first } if options[:required]
65
+ if options[:required] || (self.respond_to?(:required?) && required?(name))
66
+ add_validator(name) { |val| validate_required(name => val).first }
67
+ end
68
+
66
69
  add_validator(name) { |val| validate_length(name, val, options[:max_length]) } if options[:max_length]
67
70
  add_validator(name, &options[:validator]) if options[:validator]
68
71
  add_validator(name) { |val| validate_type(name, val, options[:type]) } if options[:validate_type]
@@ -104,5 +107,17 @@ module Modelish
104
107
  raise NoMethodError, "The property '#{property}' is not defined for this Modelish object."
105
108
  end
106
109
  end
110
+
111
+ def assert_required_properties_set!
112
+ nil
113
+ end
114
+
115
+ def assert_property_required!(property,value)
116
+ nil
117
+ end
118
+
119
+ def assert_property_exists!(property)
120
+ property_exists?(property)
121
+ end
107
122
  end
108
123
  end
@@ -1,3 +1,3 @@
1
1
  module Modelish
2
- VERSION = "0.2.3"
2
+ VERSION = "0.2.4"
3
3
  end
data/modelish.gemspec CHANGED
@@ -19,7 +19,7 @@ Gem::Specification.new do |s|
19
19
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
20
  s.require_paths = ["lib"]
21
21
 
22
- s.add_dependency('hashie', '1.0.0')
22
+ s.add_dependency('hashie', '~>1.0')
23
23
 
24
24
  s.add_development_dependency('rspec','~> 2.5')
25
25
  s.add_development_dependency('yard', '~> 0.6')
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: modelish
3
3
  version: !ruby/object:Gem::Version
4
- hash: 17
4
+ hash: 31
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 3
10
- version: 0.2.3
9
+ - 4
10
+ version: 0.2.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Maeve Revels
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-08-17 00:00:00 Z
18
+ date: 2012-08-23 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: hashie
@@ -23,14 +23,13 @@ dependencies:
23
23
  requirement: &id001 !ruby/object:Gem::Requirement
24
24
  none: false
25
25
  requirements:
26
- - - "="
26
+ - - ~>
27
27
  - !ruby/object:Gem::Version
28
- hash: 23
28
+ hash: 15
29
29
  segments:
30
30
  - 1
31
31
  - 0
32
- - 0
33
- version: 1.0.0
32
+ version: "1.0"
34
33
  type: :runtime
35
34
  version_requirements: *id001
36
35
  - !ruby/object:Gem::Dependency