blocks 3.0.0.rc1 → 3.0.0.rc2

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: 8368c42c087cbd7899de66fb0db01e2df45f1914
4
- data.tar.gz: 9b8b8dafa633483adf853110c8ae80201b38f100
3
+ metadata.gz: d4c7897223c480b20fd3787e150b311af20625db
4
+ data.tar.gz: 4c864e0ee1318de35c64bc27e726b29bb0751d4e
5
5
  SHA512:
6
- metadata.gz: 95ab7e809192edd72f89b3cc1e249f56b578be139fbbdd89b93dd6e379649551445fe2b41e3129ce7470a37e77ad8498f6420368c4b023f07fd483eeb817c99c
7
- data.tar.gz: f6d4020302ef7242e7378a0aec69ea8677611125c23275aefce7845631affb9000ac6c3dda3528814725ed1e2eb4fd4483c5962f012fcd5e8318bdff64e10468
6
+ metadata.gz: 59d329e7bcfbc630e0e83a66405343ddd6ef3b53a954f38fe8d5b3dba68bca75e3f441e4f8fb248954d22934457f8bc78623ced9fc8058ec429b71f5543fb48a
7
+ data.tar.gz: 7ba7fed39355412d3c31f3eef190cea23e04fa998b26be04dc50e4c23b82405ccb7477cca75596f13917140f75860aa18f98632e62cd3d06d618421d55e2dcb2
@@ -3,13 +3,10 @@ module Blocks
3
3
  attr_accessor :options_set,
4
4
  :skip_content,
5
5
  :skip_completely,
6
+ :anonymous,
6
7
  *HookDefinition::HOOKS.map {|hook| "#{hook}_hooks" }
7
8
 
8
9
 
9
- def initialize(*args, &block)
10
- super
11
- end
12
-
13
10
  def skip(completely=false)
14
11
  self.skip_content = true
15
12
  self.skip_completely = completely
@@ -13,6 +13,8 @@ module Blocks
13
13
  # Options provided during initialization of builder
14
14
  attr_accessor :options_set
15
15
 
16
+ attr_accessor :anonymous_block_number
17
+
16
18
  delegate :content_tag, to: :view
17
19
 
18
20
  delegate :render,
@@ -32,6 +34,7 @@ module Blocks
32
34
  self.block_definitions = HashWithIndifferentAccess.new do |hash, key|
33
35
  hash[key] = BlockDefinition.new(key); hash[key]
34
36
  end
37
+ self.anonymous_block_number = 0
35
38
  self.options_set = OptionsSet.new("Builder Options", options)
36
39
  define_helper_blocks
37
40
  end
@@ -70,13 +73,16 @@ module Blocks
70
73
  def define(*args, &block)
71
74
  options = args.extract_options!
72
75
 
73
- if args.first
74
- name = args.shift
75
- block_definitions[name].tap do |block_definition|
76
- block_definition.add_options options, &block
77
- end
76
+ name, anonymous = if args.first
77
+ [args.shift, false]
78
78
  else
79
- BlockDefinition.new(options, &block)
79
+ self.anonymous_block_number += 1
80
+ ["anonymous_block_#{anonymous_block_number}", true]
81
+ end
82
+
83
+ block_definitions[name].tap do |block_definition|
84
+ block_definition.add_options options, &block
85
+ block_definition.anonymous = anonymous
80
86
  end
81
87
  end
82
88
 
@@ -1,3 +1,3 @@
1
1
  module Blocks
2
- VERSION = "3.0.0.rc1"
2
+ VERSION = "3.0.0.rc2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blocks
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0.rc1
4
+ version: 3.0.0.rc2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Hunter
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-06-05 00:00:00.000000000 Z
11
+ date: 2017-06-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: call_with_params
@@ -152,7 +152,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
152
152
  version: 1.3.1
153
153
  requirements: []
154
154
  rubyforge_project:
155
- rubygems_version: 2.6.11
155
+ rubygems_version: 2.6.12
156
156
  signing_key:
157
157
  specification_version: 4
158
158
  summary: Blocks gives you total control over how your blocks of code render.