lev 2.0.1 → 2.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- lev (2.0.1)
4
+ lev (2.0.2)
5
5
  actionpack (>= 3.0)
6
6
  active_attr
7
7
  activemodel (>= 3.0)
@@ -2,6 +2,12 @@
2
2
  module Lev
3
3
 
4
4
  class Paramifier
5
+ include ActiveAttr::Model
6
+ include ActiveAttr::Typecasting
7
+
8
+ # Hack to provide ActiveAttr's Boolean type concisely
9
+ def self.boolean; ActiveAttr::Typecasting::Boolean; end
10
+
5
11
  def as_hash(keys)
6
12
  keys = [keys].flatten.compact
7
13
  Hash[keys.collect { |key| [key, self.send(key)] }]
@@ -59,6 +65,9 @@ module Lev
59
65
  # end
60
66
  # end
61
67
  #
68
+ # Note that if you want to use a "Boolean" type, you need to type it with
69
+ # a lowercase (type: boolean).
70
+ #
62
71
  # All handler instance methods have the following available to them:
63
72
  # 1) 'params' -- the params from the input
64
73
  # 2) 'caller' -- the user submitting the input
@@ -124,15 +133,15 @@ module Lev
124
133
 
125
134
  if paramify_classes[group].nil?
126
135
  paramify_classes[group] = Class.new(Lev::Paramifier) do
127
- include ActiveAttr::Model
128
136
  cattr_accessor :group
129
137
  end
130
- paramify_classes[group].class_eval(&block)
131
- paramify_classes[group].group = group
132
138
 
133
139
  # Attach a name to this dynamic class
134
140
  const_set("#{group.to_s.capitalize}Paramifier",
135
141
  paramify_classes[group])
142
+
143
+ paramify_classes[group].class_eval(&block)
144
+ paramify_classes[group].group = group
136
145
  end
137
146
 
138
147
  # Define the "#{group}_params" method to get the paramifier
@@ -1,3 +1,3 @@
1
1
  module Lev
2
- VERSION = "2.0.1"
2
+ VERSION = "2.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lev
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: 2.0.2
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: 2013-10-02 00:00:00.000000000 Z
12
+ date: 2013-10-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activemodel
@@ -246,7 +246,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
246
246
  version: '0'
247
247
  segments:
248
248
  - 0
249
- hash: 55854544372342664
249
+ hash: -3509729886127451718
250
250
  required_rubygems_version: !ruby/object:Gem::Requirement
251
251
  none: false
252
252
  requirements:
@@ -255,7 +255,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
255
255
  version: '0'
256
256
  segments:
257
257
  - 0
258
- hash: 55854544372342664
258
+ hash: -3509729886127451718
259
259
  requirements: []
260
260
  rubyforge_project:
261
261
  rubygems_version: 1.8.25