bgem 0.0.10 → 0.0.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/bgem.rb +14 -17
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5e2a60a95234060b3eea04309eed4bc83a91bb6b
4
- data.tar.gz: 632c1bfa536331bb7ea0151348fea0d036e2986c
3
+ metadata.gz: 18dc0d82373711c361b72cd76cfe9a89e6df14b0
4
+ data.tar.gz: 2c06eddde35fa89034b46c8e9baaee0ba746051e
5
5
  SHA512:
6
- metadata.gz: e29cb1b762dca9317ce0386fd78c5a3f1f83cfd98a23df889a48d8ba20fe5134da0027a768ca65022619a54e255cb6d8b10b0e8678165ad2cb07f520c68b5189
7
- data.tar.gz: 37240c248158fc477e02c70f44dc5c2bd36e98640a91761ed26df5286db36cb3828b29469ee4a276c6d9e54960d02a04bf1a3ecf431d0755060ad9774f00e871
6
+ metadata.gz: ea8dcdf82dd92ee7969c6325f28defcd50d38cec425277aa22674d08b67b50111515d37d794ca876c84b446a066354b5f727942490ce01f90370372a3b6ee2c8
7
+ data.tar.gz: 1ed151abc9acf8eecaa2fc616d9a4be519a00a7e8306b477257c13611a2e0a49f5c9e0b3d991ad309eaecac8f61dccf8a1b1a0a8dd99d93a9b3dcfc8bd1b3b48
@@ -44,8 +44,8 @@ module Bgem
44
44
  @config.output = file
45
45
  end
46
46
 
47
- def inside *array_of_strings
48
- @config.scope = array_of_strings
47
+ def inside *headers
48
+ @config.scope = headers
49
49
  end
50
50
  end
51
51
  end
@@ -79,32 +79,29 @@ module Bgem
79
79
  source
80
80
  end
81
81
 
82
- def self.concatenate_source_files *symbols
83
- symbols.each do |symbol|
84
- define_appendix symbol
85
- end
86
- end
87
-
88
82
  def self.define_appendix name
89
83
  define_method name do
90
84
  pattern = @file.dirname.join "#{__method__}.#{@constant}/*.rb"
91
- Dir[pattern].sort.map do |file|
92
- self.class.new(file, indent: INDENT).to_s
93
- end.join "\n\n"
85
+ concatenate pattern
94
86
  end
95
87
  end
96
88
 
97
- concatenate_source_files :pre, :before
89
+ [:pre, :before].each { |name| define_appendix name }
98
90
 
99
91
  def after
100
92
  patterns = ["#{@constant}/*.rb", "after.#{@constant}/*.rb"].map do |pattern|
101
93
  @file.dirname.join pattern
102
94
  end
103
95
 
104
- Dir[*patterns].sort.map do |file|
105
- self.class.new(file, indent: INDENT).to_s
106
- end.join "\n\n"
96
+ concatenate *patterns
107
97
  end
98
+
99
+ private
100
+ def concatenate *patterns
101
+ Dir[*patterns].sort.map do |file|
102
+ self.class.new(file, indent: INDENT).to_s
103
+ end.join "\n\n"
104
+ end
108
105
  end
109
106
 
110
107
  class TargetFile
@@ -117,8 +114,8 @@ module Bgem
117
114
  @path.dirname.mkpath
118
115
 
119
116
  if @scope
120
- @scope.each do |head_of_constant_definition|
121
- string = "#{head_of_constant_definition}\n#{string.indent INDENT}\nend"
117
+ @scope.each do |header|
118
+ string = "#{header}\n#{string.indent INDENT}\nend"
122
119
  end
123
120
  end
124
121
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bgem
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: 0.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anatoly Chernow
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-08-19 00:00:00.000000000 Z
11
+ date: 2017-08-25 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: