fi_form 0.0.2 → 0.0.3

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: e355461d23423b6c38f917a181c47a296cecf16b33108cb95699c1067c361c9a
4
- data.tar.gz: abcee254f77abbe066b788ddcdd5cb5c76fe573001b31c155292f17494cbef50
3
+ metadata.gz: 5da069ba322494c6e20141ee9531abffb41e7690036182ae19ee75ecb1628086
4
+ data.tar.gz: 23246618ec37f5716c571f6df8cd3214f28a3aedf41dee15a415eb14214d8ae6
5
5
  SHA512:
6
- metadata.gz: 58a730b2b834ccf624be68cf8c4318e3cbea8056c35a856f9fc4cfd0e76d2a18b44706b15c9cb39349cffc694ad79e2b165d363b904bf1b3f2d2ea5678baf6a3
7
- data.tar.gz: d55eb3e743efcbec8e73ed433b0a6859ffb9267297b1febef077f733d259c3902ad3670168c235aaaabb317e65ba633f3187d7dd7624cf8ce3069dac5069cec0
6
+ metadata.gz: 9bf4e47ef335dbf26a6e5d7c313473a8bf9c0186c05516b79291c4dc2ac82a9c057f0d960b68e1a3910382dc63c01585008c48f00164afd49d8f3eb8f16c0cc8
7
+ data.tar.gz: a423264a3bb355927fedd2cf153374c7daabd9a0107afaf9dc32bce0bd633925a9bef1061358157cb9372681a18fa3bd6de08a38cdc2dfe2df56574b7193fe6c
@@ -71,6 +71,10 @@ class FiForm::Builder # PORO \o/
71
71
  with_target last_item, indent: indent, &block
72
72
  end
73
73
 
74
+ def self.add_builder_method(name, &block)
75
+ define_method name, &block
76
+ end
77
+
74
78
  private
75
79
  def resource_value(field)
76
80
  end
@@ -15,7 +15,7 @@ module FiForm::BuilderExtensions
15
15
  add(:blue_print, items: builder.form.items)
16
16
  end
17
17
 
18
- add(:fields_for, field: field, blue_print: blue_print).add_children(indent: indent) do
18
+ add(:fields_for, options.merge(field: field, blue_print: blue_print)).add_children(indent: indent) do
19
19
  # capture fields for every existing record
20
20
  resource.public_send(field).each do |sub_resource|
21
21
  builder = sub_builder(sub_resource, &block)
@@ -22,7 +22,7 @@ module FiForm
22
22
 
23
23
  # add custom behaviour
24
24
  def add_builder_method(name, &block)
25
- FiForm::Builder.define_method name, &block
25
+ FiForm::Builder.add_builder_method name, &block
26
26
  end
27
27
 
28
28
  # fetch a renderer. if none is specified, the default or debug renderer will be returned
@@ -33,7 +33,7 @@ module FiForm
33
33
 
34
34
  # reload renderer classes in development
35
35
  def reload!
36
- self.renderers = self.renderers.map{|k, klass| [k, klass.to_s.constantize] }.to_h
36
+ self.renderers = self.renderers.map{|k, klass| [k, klass.to_s.constantize] }.to_h # uncovered
37
37
  end
38
38
 
39
39
  protected
@@ -1,9 +1,10 @@
1
1
  module FiForm
2
2
 
3
3
  class Renderer
4
- attr_reader :template
5
- def initialize(template)
4
+ attr_reader :template, :f
5
+ def initialize(template, f: nil)
6
6
  @template = template
7
+ @f = f
7
8
  end
8
9
 
9
10
  def render(*args)
@@ -1,3 +1,3 @@
1
1
  module FiForm
2
- VERSION = '0.0.2'
2
+ VERSION = '0.0.3'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fi_form
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Pauly
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-07-13 00:00:00.000000000 Z
11
+ date: 2019-07-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionview