glue_gun_dsl 0.1.11 → 0.1.13

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
  SHA256:
3
- metadata.gz: edbf3090421208672fdc17def682401b63dab26703932337106fc21e54e3a589
4
- data.tar.gz: 5f7948854600c6472a35119724d5bcdff04e0ae333bc11278559e05432cac849
3
+ metadata.gz: a744558606a85cbfc6641c33ba4aae92925712e9ee8b30555aad1309773def0e
4
+ data.tar.gz: 49d3742eccba3ed436ee950b74c8aa5627d5a36ac1cca8fafe625904f9cd567d
5
5
  SHA512:
6
- metadata.gz: 5d20c2554f8908224286358e4f16f36ce52839db20103ccc3368554088c63fc6af82ae7de6a6d2ebbdf4a3974d7db66502cc7b809f70a9c3cca6f3cb495e0a0f
7
- data.tar.gz: c01c8d848e36cd7632daddbac3b0f6e3d3f552a59649ce25fafc9aa1437d0d21fcbaa886e72cae1962bc1a3a8bc95ea8c839b00944793ea4f2e7193361ff4981
6
+ metadata.gz: 3fd64a4f71a0fd2fee778ce93609bbda6bbf38aff76feeeb9c8bd8d427c75def7c83471ac091cf40dbcc6f7ca16070ed2a89cf1d19e3e1d3eb48c2196d213edf
7
+ data.tar.gz: 46e927fdfe42d553b6ee39e069cfea564fa2d10afd6548618d5bfd1b35db964024d0156a84986f126f85929b78a89de31c3994f61b43780906a3b3cf0b0c2194
data/lib/glue_gun/dsl.rb CHANGED
@@ -121,7 +121,6 @@ module GlueGun
121
121
  attribute_methods_module.class_eval do
122
122
  define_method "#{component_type}=" do |init_args|
123
123
  instance_variable_set("@#{component_type}", initialize_dependency(component_type, init_args))
124
- # propagate_attribute_change(component_type, value) if initialized?
125
124
  end
126
125
  end
127
126
  end
@@ -185,6 +184,11 @@ module GlueGun
185
184
  # Build dependency attributes, including sourcing from parent
186
185
  dep_attributes = build_dependency_attributes(option_config, dep_attributes)
187
186
 
187
+ if dep_attributes.key?(:id)
188
+ raise ArgumentError,
189
+ "cannot bind attribute 'id' between #{self.class.name} and #{option_config.class_name}. ID is reserved for primary keys in Ruby on Rails"
190
+ end
191
+
188
192
  dependency_instance = instantiate_dependency(option_config, dep_attributes)
189
193
 
190
194
  # Keep track of dependencies for attribute binding
@@ -362,8 +366,8 @@ module GlueGun
362
366
  set_default_option_name(:default)
363
367
  end
364
368
 
365
- def attribute(name, default: nil, required: false, source: nil, &block)
366
- single_option.attribute(name, default: default, required: required, source: source, &block)
369
+ def bind_attribute(name, default: nil, required: false, source: nil, &block)
370
+ single_option.bind_attribute(name, default: default, required: required, source: source, &block)
367
371
  end
368
372
 
369
373
  def get_option(name)
@@ -430,7 +434,7 @@ module GlueGun
430
434
  end
431
435
  end
432
436
 
433
- def attribute(name, default: nil, required: false, source: nil, &block)
437
+ def bind_attribute(name, default: nil, required: false, source: nil, &block)
434
438
  attr = ConfigAttr.new(name, default: default, required: required, source: source, &block)
435
439
  @attributes[name.to_sym] = attr
436
440
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GlueGun
4
- VERSION = "0.1.11"
4
+ VERSION = "0.1.13"
5
5
  end
data/lib/glue_gun.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  require "active_model"
2
+ require "active_record"
2
3
  require "active_support/concern"
3
4
 
4
5
  module GlueGun
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glue_gun_dsl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.11
4
+ version: 0.1.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brett Shollenberger
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-10-07 00:00:00.000000000 Z
11
+ date: 2024-10-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel