render 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/Gemfile.lock +1 -1
- data/lib/render/generator.rb +2 -0
- data/lib/render/type.rb +2 -2
- data/lib/render/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZDdkY2Y3ZDlhMDIxZjQyZDA1OTNiZDJjZWQzMDIzMTI0YjkwM2E0Mw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZDY4MTllMWE1NTgyYmI4ZmRjOWIwNzA0NzEwNDcwMzM3YjFjMTA5Yg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MmJlMWIwNjZkZjcyNDcwZDlkNDBjNmM0OWI4NDA4YWViNjM2MDVmMTkxYjJl
|
10
|
+
ZjU1NDYyN2NjMjZhZDIzMmY2NjhhMWYyZWE5YzFmYWI0OTI1MzBmZTAzOWJm
|
11
|
+
M2E4N2MzZTVhNzNkMGRiZGVlYzI1MzZiZDFmYzNlYjk0ZjM2MDY=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YzExNmU4ZjQ0NDk0NmYxYTFjMDcyZDZmODAxZmYwZDlhNDJjY2FhYjc3Yjgx
|
14
|
+
ZjNhYzQxMGIwN2ZlOTViMDM3MDgzMjQ5YWEwNzBjOTgyMWI1YzZiNGZkZjcw
|
15
|
+
MzdmZmFmNjNjZmZhNjY3YWY5MGQxZmYyM2RlZDM3MjM2NDE1MTE=
|
data/Gemfile.lock
CHANGED
data/lib/render/generator.rb
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
|
4
4
|
require "uuid"
|
5
5
|
require "render/errors"
|
6
|
+
require "date"
|
6
7
|
|
7
8
|
module Render
|
8
9
|
class Generator
|
@@ -64,5 +65,6 @@ module Render
|
|
64
65
|
Generator.create!(Time, /.*/, proc { |attribute| time = Time.now; (attribute.type == String) ? time.to_s : time })
|
65
66
|
Generator.create!(Type::Boolean, /.*/, proc { [true, false].sample })
|
66
67
|
Generator.create!(Type::Enum, /.*/, proc { |attribute| attribute.enums.sample })
|
68
|
+
Generator.create!(Type::Date, /.*/, proc { Time.now.to_date })
|
67
69
|
end
|
68
70
|
end
|
data/lib/render/type.rb
CHANGED
@@ -9,6 +9,7 @@ module Render
|
|
9
9
|
|
10
10
|
class Enum; end
|
11
11
|
class Boolean; end
|
12
|
+
class Date; end
|
12
13
|
|
13
14
|
class << self
|
14
15
|
attr_accessor :instances
|
@@ -24,8 +25,6 @@ module Render
|
|
24
25
|
def parse(name, raise_error = false)
|
25
26
|
return name unless name.is_a?(String)
|
26
27
|
Render::Type.find(name) || Object.const_get(name.capitalize)
|
27
|
-
rescue NameError => error
|
28
|
-
raise Errors::InvalidType.new(name) if raise_error
|
29
28
|
end
|
30
29
|
|
31
30
|
def parse!(name)
|
@@ -59,5 +58,6 @@ module Render
|
|
59
58
|
add!(:time, Time)
|
60
59
|
add_render_specific_type!(:Boolean)
|
61
60
|
add_render_specific_type!(:Enum)
|
61
|
+
add_render_specific_type!(:Date)
|
62
62
|
end
|
63
63
|
end
|
data/lib/render/version.rb
CHANGED