form_core 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 +4 -4
- data/README.md +0 -6
- data/Rakefile +16 -18
- data/app/models/form_core/application_record.rb +2 -0
- data/app/models/form_core/field.rb +2 -0
- data/app/models/form_core/form.rb +2 -0
- data/lib/form_core.rb +4 -1
- data/lib/form_core/coder.rb +2 -0
- data/lib/form_core/coders/hash_coder.rb +19 -0
- data/lib/form_core/coders/yaml_coder.rb +2 -0
- data/lib/form_core/concerns/models/field.rb +2 -1
- data/lib/form_core/concerns/models/form.rb +2 -0
- data/lib/form_core/engine.rb +2 -0
- data/lib/form_core/errors.rb +2 -0
- data/lib/form_core/version.rb +3 -1
- data/lib/form_core/virtual_model.rb +2 -0
- data/lib/tasks/form_core_tasks.rake +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '06286f029e868efc5cb654fbe32d384e54e2d310'
|
4
|
+
data.tar.gz: 9dc9287003854ad6629ec2bd6b3a889eb4673ca7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 006c32170ccdbbd9d3f730a0a66f534f21c94736ce2f230d4793c0b92a0f95ac39857ff971a85881693d510644fddf863d0bf264f7137da7f65531afd74737fd
|
7
|
+
data.tar.gz: 4d1bc43d614f560ff4073f4c40b5306a0a64502a802c1b2bac10359a6b477e1b2b7d3afd646b578d21004697031ea363dfb6896f2e1e7a96f52ea1a20ff50e7c
|
data/README.md
CHANGED
data/Rakefile
CHANGED
@@ -1,36 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
begin
|
2
|
-
require
|
4
|
+
require "bundler/setup"
|
3
5
|
rescue LoadError
|
4
|
-
puts
|
6
|
+
puts "You must `gem install bundler` and `bundle install` to run rake tasks"
|
5
7
|
end
|
6
8
|
|
7
|
-
require
|
9
|
+
require "rdoc/task"
|
8
10
|
|
9
11
|
RDoc::Task.new(:rdoc) do |rdoc|
|
10
|
-
rdoc.rdoc_dir =
|
11
|
-
rdoc.title =
|
12
|
-
rdoc.options <<
|
13
|
-
rdoc.rdoc_files.include(
|
14
|
-
rdoc.rdoc_files.include(
|
12
|
+
rdoc.rdoc_dir = "rdoc"
|
13
|
+
rdoc.title = "FormCore"
|
14
|
+
rdoc.options << "--line-numbers"
|
15
|
+
rdoc.rdoc_files.include("README.md")
|
16
|
+
rdoc.rdoc_files.include("lib/**/*.rb")
|
15
17
|
end
|
16
18
|
|
17
19
|
APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
|
18
|
-
load
|
19
|
-
|
20
|
-
|
21
|
-
load 'rails/tasks/statistics.rake'
|
20
|
+
load "rails/tasks/engine.rake"
|
22
21
|
|
22
|
+
load "rails/tasks/statistics.rake"
|
23
23
|
|
24
|
+
require "bundler/gem_tasks"
|
24
25
|
|
25
|
-
require
|
26
|
-
|
27
|
-
require 'rake/testtask'
|
26
|
+
require "rake/testtask"
|
28
27
|
|
29
28
|
Rake::TestTask.new(:test) do |t|
|
30
|
-
t.libs <<
|
31
|
-
t.pattern =
|
29
|
+
t.libs << "test"
|
30
|
+
t.pattern = "test/**/*_test.rb"
|
32
31
|
t.verbose = false
|
33
32
|
end
|
34
33
|
|
35
|
-
|
36
34
|
task default: :test
|
data/lib/form_core.rb
CHANGED
@@ -1,7 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "form_core/engine"
|
2
4
|
require "form_core/errors"
|
3
5
|
|
4
6
|
require "form_core/coder"
|
7
|
+
require "form_core/coders/hash_coder"
|
5
8
|
require "form_core/coders/yaml_coder"
|
6
9
|
|
7
10
|
require "form_core/virtual_model"
|
@@ -31,7 +34,7 @@ module FormCore
|
|
31
34
|
end
|
32
35
|
|
33
36
|
def virtual_model_coder_class
|
34
|
-
@virtual_model_coder_class ||=
|
37
|
+
@virtual_model_coder_class ||= HashCoder
|
35
38
|
end
|
36
39
|
|
37
40
|
def virtual_model_coder_class=(klass)
|
data/lib/form_core/coder.rb
CHANGED
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "yaml"
|
4
|
+
|
5
|
+
module FormCore
|
6
|
+
class HashCoder < FormCore::Coder # :nodoc:
|
7
|
+
def dump(obj)
|
8
|
+
obj&.to_h || {}
|
9
|
+
end
|
10
|
+
|
11
|
+
def load(hash)
|
12
|
+
if hash.nil? || !hash.respond_to?(:to_h)
|
13
|
+
return new_or_raise_decoding_error
|
14
|
+
end
|
15
|
+
|
16
|
+
object_class.new hash.to_h
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module FormCore::Concerns
|
2
4
|
module Models
|
3
5
|
module Field
|
@@ -74,7 +76,6 @@ module FormCore::Concerns
|
|
74
76
|
end
|
75
77
|
|
76
78
|
def interpret_extra_to(_model, _accessibility, _overrides = {})
|
77
|
-
|
78
79
|
end
|
79
80
|
|
80
81
|
def check_model_validity!(model)
|
data/lib/form_core/engine.rb
CHANGED
data/lib/form_core/errors.rb
CHANGED
data/lib/form_core/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: form_core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- jasl
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-10-
|
11
|
+
date: 2017-10-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -57,6 +57,7 @@ files:
|
|
57
57
|
- db/migrate/20170430191336_create_fields.rb
|
58
58
|
- lib/form_core.rb
|
59
59
|
- lib/form_core/coder.rb
|
60
|
+
- lib/form_core/coders/hash_coder.rb
|
60
61
|
- lib/form_core/coders/yaml_coder.rb
|
61
62
|
- lib/form_core/concerns/models/field.rb
|
62
63
|
- lib/form_core/concerns/models/form.rb
|