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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 819b17a80a69cb0746675b706757485d0cc686e8
4
- data.tar.gz: 046e9e86b856786834df1093ffc7cf572e660520
3
+ metadata.gz: '06286f029e868efc5cb654fbe32d384e54e2d310'
4
+ data.tar.gz: 9dc9287003854ad6629ec2bd6b3a889eb4673ca7
5
5
  SHA512:
6
- metadata.gz: 62edafb741f3196caa8a69c5d344112d4a5f7695e4955f722f7e9e1f7134a035984aa5fae0dbd8731ab8bc52f64fff3443c8d4aaf7e004e3bae4373ce93983a7
7
- data.tar.gz: 167d4bf390c740232cf4e88a9e9c5e07828e94770c8affd995964e1967c2847212abe1436abeb7ab178e3c8a08764e52d877c80de65c0dab92e51fd762d91346
6
+ metadata.gz: 006c32170ccdbbd9d3f730a0a66f534f21c94736ce2f230d4793c0b92a0f95ac39857ff971a85881693d510644fddf863d0bf264f7137da7f65531afd74737fd
7
+ data.tar.gz: 4d1bc43d614f560ff4073f4c40b5306a0a64502a802c1b2bac10359a6b477e1b2b7d3afd646b578d21004697031ea363dfb6896f2e1e7a96f52ea1a20ff50e7c
data/README.md CHANGED
@@ -59,12 +59,6 @@ Run bundler
59
59
  $ bundle install
60
60
  ```
61
61
 
62
- Run yarn
63
-
64
- ```sh
65
- $ test/dummy/bin/yarn
66
- ```
67
-
68
62
  Preparing database
69
63
 
70
64
  ```sh
data/Rakefile CHANGED
@@ -1,36 +1,34 @@
1
+ # frozen_string_literal: true
2
+
1
3
  begin
2
- require 'bundler/setup'
4
+ require "bundler/setup"
3
5
  rescue LoadError
4
- puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
6
+ puts "You must `gem install bundler` and `bundle install` to run rake tasks"
5
7
  end
6
8
 
7
- require 'rdoc/task'
9
+ require "rdoc/task"
8
10
 
9
11
  RDoc::Task.new(:rdoc) do |rdoc|
10
- rdoc.rdoc_dir = 'rdoc'
11
- rdoc.title = 'FormCore'
12
- rdoc.options << '--line-numbers'
13
- rdoc.rdoc_files.include('README.md')
14
- rdoc.rdoc_files.include('lib/**/*.rb')
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 'rails/tasks/engine.rake'
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 'bundler/gem_tasks'
26
-
27
- require 'rake/testtask'
26
+ require "rake/testtask"
28
27
 
29
28
  Rake::TestTask.new(:test) do |t|
30
- t.libs << 'test'
31
- t.pattern = 'test/**/*_test.rb'
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
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module FormCore
2
4
  class ApplicationRecord < ActiveRecord::Base
3
5
  self.abstract_class = true
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module FormCore
2
4
  class Field < ApplicationRecord
3
5
  include FormCore::Concerns::Models::Field
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module FormCore
2
4
  class Form < ApplicationRecord
3
5
  include FormCore::Concerns::Models::Form
@@ -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 ||= YAMLCoder
37
+ @virtual_model_coder_class ||= HashCoder
35
38
  end
36
39
 
37
40
  def virtual_model_coder_class=(klass)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module FormCore
2
4
  class Coder
3
5
  attr_reader :object_class
@@ -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
  require "yaml"
2
4
 
3
5
  module FormCore
@@ -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)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module FormCore::Concerns
2
4
  module Models
3
5
  module Form
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module FormCore
2
4
  class Engine < ::Rails::Engine
3
5
  isolate_namespace FormCore
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module FormCore
2
4
  # = Form Core Errors
3
5
  #
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module FormCore
2
- VERSION = "0.0.5"
4
+ VERSION = "0.0.6"
3
5
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "duck_record"
2
4
 
3
5
  module FormCore
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  # desc "Explaining what the task does"
2
3
  # task :form_core do
3
4
  # # Task goes here
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.5
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-03 00:00:00.000000000 Z
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