options_model 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: 49f062b3a41f61cb5c5247eed2551c52785c0987
4
- data.tar.gz: 18b414a537123b4e90f80125d216a882d0208cf6
3
+ metadata.gz: 840526f66190795799451d6aa25f55b2938594b9
4
+ data.tar.gz: 5230c178ab5d88acf6f907848c6140a704d57969
5
5
  SHA512:
6
- metadata.gz: 84be83b6511d112cb405c861946257a14a71e46781d89ecf74c352fdd151982fe1aba16a1a1c1a6ead01a0cf838886b2eb87ecad144549af2ce75a06ed13ec00
7
- data.tar.gz: 793a198caca6fd8d5621bd24d58eb17139f408bc420c67c050352adea167064dbcb7c2997c878331a1fff180b760e4257fc1b7cae2ab6b9fe3cc4074ea9443a6
6
+ metadata.gz: fab4e8da52e002215ed4b61815d7d815b2d800a9a9ce49df817c6d0dac2265c85cf88bce719032b3d6f6d270b25b9c92945c8030aa7c53ef319d58a3c46d3287
7
+ data.tar.gz: f3c392f13f9ee02bcd94fe00a79fb41bc5d4989690589cdc3739e0023e35f338a2b1f0fc6c28dc822a888d401e175a37994d0e289c5439ad0ff5480d463e06c4
data/Rakefile CHANGED
@@ -1,33 +1,29 @@
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 = 'OptionsModel'
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 = "OptionsModel"
14
+ rdoc.options << "--line-numbers"
15
+ rdoc.rdoc_files.include("README.md")
16
+ rdoc.rdoc_files.include("lib/**/*.rb")
15
17
  end
16
18
 
19
+ require "bundler/gem_tasks"
17
20
 
18
-
19
-
20
-
21
-
22
- require 'bundler/gem_tasks'
23
-
24
- require 'rake/testtask'
21
+ require "rake/testtask"
25
22
 
26
23
  Rake::TestTask.new(:test) do |t|
27
- t.libs << 'test'
28
- t.pattern = 'test/**/*_test.rb'
24
+ t.libs << "test"
25
+ t.pattern = "test/**/*_test.rb"
29
26
  t.verbose = false
30
27
  end
31
28
 
32
-
33
29
  task default: :test
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module OptionsModel
2
4
  class Base
3
5
  include ActiveModel::Model
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module OptionsModel
2
4
  module Concerns
3
5
  module AttributeAssignment
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module OptionsModel
2
4
  module Concerns
3
5
  module Attributes
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module OptionsModel
2
4
  module Concerns
3
5
  module NameHacking
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module OptionsModel
2
4
  module Concerns
3
5
  module Serialization
@@ -7,8 +9,12 @@ module OptionsModel
7
9
  hash = {}
8
10
 
9
11
  hash.merge! unused_attributes if self.class.with_unused_attributes?
10
- hash.merge! attributes
11
- hash.merge! nested_attributes.reduce({}) { |h, (k, v)| h[k] = v.to_h; h }
12
+ self.class.attribute_names_for_inlining.each do |name|
13
+ hash[name] = send(name)
14
+ end
15
+ self.class.attribute_names_for_nesting.each do |name|
16
+ hash[name] = send(name).to_h
17
+ end
12
18
 
13
19
  hash
14
20
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module OptionsModel
2
- VERSION = "0.0.5".freeze
4
+ VERSION = "0.0.6"
3
5
  end
data/lib/options_model.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "active_model"
2
4
  require "active_model/type"
3
5
 
@@ -9,5 +11,4 @@ require "options_model/concerns/serialization"
9
11
  require "options_model/base"
10
12
 
11
13
  module OptionsModel
12
-
13
14
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  # desc "Explaining what the task does"
2
3
  # task :options_model do
3
4
  # # Task goes here
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: options_model
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-07-27 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: activemodel