wedge 0.1.23 → 0.1.24

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
  SHA1:
3
- metadata.gz: 2b1cef007c7e39778735ef8d90c8063a07a6bfce
4
- data.tar.gz: 20706521f83123f90a403a58da2e4442a064c325
3
+ metadata.gz: 7cd9d55e9e4a4e2552a9161a708dd2ca7ed3b9f9
4
+ data.tar.gz: c47e4e82a4a15245592838be2b34bf7b0d5f6c84
5
5
  SHA512:
6
- metadata.gz: d60d7c4ac517bc04b23039e7e937657970b1b36385ca3e268db885fb4c1487dc4129edab88ba2e75bf20ebffa5bb03cf4a8c20d9aabc5c36b3eb6bdf0fd868c6
7
- data.tar.gz: b665036f77c36336cc95da76ad68105a0c1c19ed9cd3fabb8cd8559161f5480ae673e6e4ed1bee5ffba65ccc9423cd382ee302d39ea824e80ac6ae413a2796d1
6
+ metadata.gz: 9570eae6b1a09a342bb2fee0a664e6eb81706c46725ed755caa6fa044fbd36c27ca11be168b04b864b99734b36509219bfd12776eba6490301848e5214b1e654
7
+ data.tar.gz: e26f5afdf65df26d7f139456e9f7a78b0705714af66789318269dbbab7f72edbfef294d5c936b0e6fdfdc784143dfa1db63190af25df1933a377c7a25858a86d
@@ -2,7 +2,7 @@ class Roda
2
2
  module RodaPlugins
3
3
  class WedgePlugin
4
4
  def self.configure(app, opts = false, &block)
5
- app.use Wedge::Middleware, opts || block, true
5
+ app.use Wedge::Middleware, opts || block
6
6
  end
7
7
 
8
8
  module ClassMethods
data/lib/wedge/config.rb CHANGED
@@ -24,6 +24,7 @@ class Wedge
24
24
  cache_assets: false,
25
25
  is_plugin: false,
26
26
  compile_str: false,
27
+ skip_call_middleware: false,
27
28
  requires: IndifferentHash.new,
28
29
  triggered_browser_events: false,
29
30
  store: IndifferentHash.new,
@@ -2,7 +2,7 @@ class Wedge
2
2
  class Middleware
3
3
  attr_reader :skip_call
4
4
 
5
- def initialize(app = false, settings = false, skip_call = false)
5
+ def initialize(app = false, settings = false)
6
6
  if settings
7
7
  case settings
8
8
  when Proc
@@ -28,7 +28,7 @@ class Wedge
28
28
 
29
29
  @app = app
30
30
  @scope = self.class.scope
31
- @skip_call = skip_call
31
+ @skip_call = !self.class.skip_call.nil?? self.class.skip_call : Wedge.config.skip_call_middleware
32
32
  end
33
33
 
34
34
  def call(env)
@@ -42,6 +42,7 @@ class Wedge
42
42
  def scope! scope
43
43
  klass = Class.new(self)
44
44
  klass.instance_variable_set(:@scope, scope)
45
+ klass.instance_variable_set(:@skip_call, false)
45
46
  klass
46
47
  end
47
48
 
@@ -110,7 +110,7 @@ class Wedge
110
110
  # options
111
111
  { _nested: true }.merge(att_options)
112
112
  ])
113
- elsif att_options.key? :default
113
+ elsif att_options.key?(:default) || _form.respond_to?("default_#{att}")
114
114
  send("#{att}=", default, true)
115
115
  end
116
116
  end
@@ -270,7 +270,7 @@ class Wedge
270
270
  end
271
271
 
272
272
  def _keys
273
- (_atts_keys + _with_atts).reject { |k| _without_atts.include? k }
273
+ ((_options[:atts] || _accessors) + _with_atts).reject { |k| _without_atts.include? k }
274
274
  end
275
275
 
276
276
  def _accessors
@@ -304,8 +304,6 @@ class Wedge
304
304
  _options[:_model_attributes] = for_model
305
305
 
306
306
  _keys.each do |att|
307
- next unless _accessors.include? att.to_sym
308
-
309
307
  opts = _accessor_options[att]
310
308
  if _atts.can_read?(att) && (!opts[:hidden] || opts[:hidden].is_a?(Proc) && !self.instance_exec(&opts[:hidden]))
311
309
  is_form = opts[:form]
data/lib/wedge/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  class Wedge
2
- VERSION = '0.1.23'
2
+ VERSION = '0.1.24'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wedge
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.23
4
+ version: 0.1.24
5
5
  platform: ruby
6
6
  authors:
7
7
  - cj