trenchcoat 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8a247e5d207ed202dee8f4ae60fb16257cf297db730220462acbae5b21389bab
4
- data.tar.gz: ce0e27f3b0ffe5c5579d150ae70b276aaa09a56e70a0da01548508c4544dcfba
3
+ metadata.gz: 8ab1043005d9403e859adae46b633f3ae255a7d4145ec32a185d3205a8e54af8
4
+ data.tar.gz: 26d16373edc25738c88256734370c7dff4d92e95a8ad1322d28090043a8abebf
5
5
  SHA512:
6
- metadata.gz: 8dd448293b16dd374d4a6c43e2344fa216ae32334055fbe2c2b80f622a36205364703bb4bd97eaba977944f0abe10038945d13ac563bbf7c9624dd53a5209038
7
- data.tar.gz: f8c1da6f9332cab609b1753deb6aece9db3483f630a41ec519e571d62eee49e0db7984faf9137016d6498d60b474722ee994218b1f2f554d6843d961a3eafaa7
6
+ metadata.gz: 564b53fbbfa5bf36c243bdda4a2caab82708e1ebc05900e8c9d7d48b911444a869cffef901f6210c2f48ce094d1fb9662dc3e341acb04d0798d8774a4b514dbc
7
+ data.tar.gz: d1e30cebfaddb4f93ba35fee83a84189a5abe6d0380595a75f3f360aeb0aa21cdf14a733fbb6b400d0de1e3d27a8ca4b81c27b8b0deafff5876143a32cdd9fc4
data/.rubocop.yml CHANGED
@@ -6,3 +6,7 @@ Style/StringLiterals:
6
6
 
7
7
  Style/StringLiteralsInInterpolation:
8
8
  EnforcedStyle: double_quotes
9
+
10
+ Layout/LineLength:
11
+ Exclude:
12
+ - test/**/*
data/README.md CHANGED
@@ -2,15 +2,13 @@
2
2
 
3
3
  ## Installation
4
4
 
5
- TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
6
-
7
5
  Install the gem and add to the application's Gemfile by executing:
8
6
 
9
- $ bundle add UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
7
+ $ bundle add trenchcoat
10
8
 
11
9
  If bundler is not being used to manage dependencies, install the gem by executing:
12
10
 
13
- $ gem install UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
11
+ $ gem install trenchcoat
14
12
 
15
13
  ## Usage
16
14
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Trenchcoat
4
- VERSION = "0.1.0"
4
+ VERSION = "0.2.0"
5
5
  end
data/lib/trenchcoat.rb CHANGED
@@ -8,9 +8,9 @@ module Trenchcoat
8
8
  module Model
9
9
  extend ActiveSupport::Concern
10
10
 
11
- def fallback_to_model_values(model:, attributes:)
12
- attributes.each do |attribute|
13
- next if send(attribute)
11
+ def fallback_to_model_values(model:, attributes_to_check:, original_attributes_hash:)
12
+ attributes_to_check.each do |attribute|
13
+ next if original_attributes_hash.with_indifferent_access.key?(attribute)
14
14
 
15
15
  send(:"#{attribute}=", model.public_send(attribute))
16
16
  end
@@ -22,7 +22,7 @@ module Trenchcoat
22
22
 
23
23
  attributes.each do |attribute_name|
24
24
  column = columns.fetch(attribute_name)
25
- attribute column.name, column.type, default: column.default
25
+ attribute column.name, model_class.type_for_attribute(attribute_name), default: column.default
26
26
  end
27
27
  end
28
28
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trenchcoat
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas Cannon