leafy-ruby 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -3
- data/leafy.gemspec +2 -1
- data/lib/leafy/field.rb +2 -2
- data/lib/leafy/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1e9b8ab7fa5fce879b69856041e24097cc574e41343f3c954c6256d45b8746c0
|
4
|
+
data.tar.gz: de0763a761626b180748303a01bd0cf9d403d012ac13c61af212051e1a65b35a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e5390a02d111263752b418777d2cdcee9e224a9f3c52db573362da4d63f1af9f66f3cf17865d978c95d5317b18d87b4a379161f5f40efbc09bae1335ffca710e
|
7
|
+
data.tar.gz: d3e94469b3c0a7d22de8415a5f22550ac90dbf40f72c3986181914c75127c631c53fa1cc97cda8b40199cae5d7bdf4401e7e48071b4fd4dfa208d428565826c3
|
data/README.md
CHANGED
@@ -70,9 +70,9 @@ host.leafy_fields_attributes = [
|
|
70
70
|
|
71
71
|
# or build schema yourself
|
72
72
|
|
73
|
-
field_1 = Leafy::Field.new(name: "Field 1", type: :integer, id: "id_1", default: 1, placeholder: "enter an integer", required: true)
|
74
|
-
field_2 = Leafy::Field.new(name: "Field 2", type: :string, id: "id_2", default: "", placeholder: "enter value")
|
75
|
-
field_3 = Leafy::Field.new(name: "Field 3", type: :datetime, id: "id_3", order: 10000)
|
73
|
+
field_1 = Leafy::Field.new(name: "Field 1", type: :integer, id: "id_1", metadata: { default: 1, placeholder: "enter an integer", required: true })
|
74
|
+
field_2 = Leafy::Field.new(name: "Field 2", type: :string, id: "id_2", metadata: { default: "", placeholder: "enter value" })
|
75
|
+
field_3 = Leafy::Field.new(name: "Field 3", type: :datetime, id: "id_3", metadata: { order: 10000 })
|
76
76
|
|
77
77
|
schema = Leafy::Schema.new
|
78
78
|
schema << field_1
|
data/leafy.gemspec
CHANGED
@@ -17,7 +17,7 @@ Gem::Specification.new do |spec|
|
|
17
17
|
It ships with several basic data types and allows you to add your own data type converters.
|
18
18
|
DESC
|
19
19
|
|
20
|
-
spec.homepage = "https://
|
20
|
+
spec.homepage = "https://github.com/estepnv/leafy"
|
21
21
|
spec.license = "MIT"
|
22
22
|
|
23
23
|
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
@@ -26,6 +26,7 @@ Gem::Specification.new do |spec|
|
|
26
26
|
spec.bindir = "exe"
|
27
27
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
28
28
|
spec.require_paths = ["lib"]
|
29
|
+
spec.required_ruby_version = '>= 2.2'
|
29
30
|
|
30
31
|
spec.add_development_dependency "bundler", "~> 1.16"
|
31
32
|
spec.add_development_dependency "rake", "~> 10.0"
|
data/lib/leafy/field.rb
CHANGED
@@ -9,8 +9,8 @@ module Leafy
|
|
9
9
|
raise ArgumentError, "attributes is not a Hash" unless attributes.is_a?(Hash)
|
10
10
|
attributes = Leafy::Utils.symbolize_keys(attributes)
|
11
11
|
|
12
|
-
self.name = attributes
|
13
|
-
self.type = attributes
|
12
|
+
self.name = attributes.fetch(:name)
|
13
|
+
self.type = attributes.fetch(:type)
|
14
14
|
self.id = attributes.fetch(:id) { [name.downcase.strip.tr(" ", "-"), SecureRandom.uuid].join("-") }
|
15
15
|
self.metadata = attributes.fetch(:metadata, {})
|
16
16
|
end
|
data/lib/leafy/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: leafy-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Evgeny Stepanov
|
@@ -137,7 +137,7 @@ files:
|
|
137
137
|
- lib/leafy/schema.rb
|
138
138
|
- lib/leafy/utils.rb
|
139
139
|
- lib/leafy/version.rb
|
140
|
-
homepage: https://
|
140
|
+
homepage: https://github.com/estepnv/leafy
|
141
141
|
licenses:
|
142
142
|
- MIT
|
143
143
|
metadata: {}
|
@@ -149,7 +149,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
149
149
|
requirements:
|
150
150
|
- - ">="
|
151
151
|
- !ruby/object:Gem::Version
|
152
|
-
version: '
|
152
|
+
version: '2.2'
|
153
153
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
154
154
|
requirements:
|
155
155
|
- - ">="
|