stellar-erb 0.1.0 → 0.1.1
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 +4 -4
- data/README.md +90 -56
- data/lib/stellar/erb/error.rb +15 -12
- data/lib/stellar/erb/version.rb +1 -1
- data/lib/stellar/erb/view.rb +19 -18
- data/lib/stellar/erb.rb +41 -2
- data/lib/stellar/erb.rb.2.bak +17 -0
- data/lib/stellar/erb.rb.2.diff.bak +16 -0
- data/lib/stellar/erb.rb.3.bak +37 -0
- data/lib/stellar/erb.rb.3.diff.bak +30 -0
- data/lib/stellar.rb +4 -0
- data/lib/stellar.rb.1.bak +6 -0
- data/lib/stellar.rb.1.diff.bak +15 -0
- metadata +13 -9
- data/lib/stellar/erb/binding.rb +0 -32
- /data/{LICENSE.txt → LICENSE} +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aa98284e8fd7eb00da41c159321eea5c1019d02eda68661035ea6b2a947ec338
|
4
|
+
data.tar.gz: ba5fcba9afa15e38675584f58c2364d22effdada46cfd81029bd37d7f91f50e9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5f7e3417120b4038a87d11dc65bbb84597e60b12297102320445482c250817f81ec6e0eac82b1adc9935f5a9b06612b1c2fc53f87a9f7fa4bcd0b5c2047ce338
|
7
|
+
data.tar.gz: 6af4affdc2fe29714c54e595821644be708f3e088b9d172da23b51b948a617c1d2a804f6d5ea54ea9ace2ebe3cbbb85ecc4c2e3be58be0c6acc4c3f68cea27c5
|
data/README.md
CHANGED
@@ -2,35 +2,30 @@
|
|
2
2
|
|
3
3
|

|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
A safe, easy to use wrapper for ERB (Embedded Ruby) templates outside of Rails.
|
8
|
-
|
5
|
+
A robust, safe, and feature-rich wrapper for ERB (Embedded Ruby) template rendering outside of Rails.
|
9
6
|
|
10
7
|
## Overview
|
11
8
|
|
12
|
-
Stellar::Erb provides a
|
13
|
-
|
14
|
-
|
15
|
-
- Clean backtraces
|
16
|
-
- Template reusability
|
9
|
+
Stellar::Erb provides a sophisticated yet easy-to-use solution for working with ERB templates in Ruby applications. It offers enhanced error handling, clean backtraces, and a flexible API that makes template rendering both powerful and maintainable.
|
10
|
+
|
11
|
+
### Key Features
|
17
12
|
|
13
|
+
- **Safe Template Rendering**: Built-in protection against common template injection vulnerabilities
|
14
|
+
- **Rich Error Context**: Detailed error messages with line numbers and surrounding code context
|
15
|
+
- **Flexible Variable Passing**: Support for both global and per-render local variables
|
16
|
+
- **String Template Support**: Render ERB directly from strings in addition to files
|
17
|
+
- **Reusable Views**: Create view instances for efficient template reuse
|
18
|
+
- **Minimal Dependencies**: Works standalone without requiring Rails
|
18
19
|
|
19
20
|
## Installation
|
20
21
|
|
21
|
-
Add
|
22
|
+
Add to your Gemfile:
|
22
23
|
|
23
24
|
```ruby
|
24
25
|
gem 'stellar-erb'
|
25
26
|
```
|
26
27
|
|
27
|
-
|
28
|
-
|
29
|
-
```bash
|
30
|
-
$ bundle install
|
31
|
-
```
|
32
|
-
|
33
|
-
Or install it yourself as:
|
28
|
+
Or install directly:
|
34
29
|
|
35
30
|
```bash
|
36
31
|
$ gem install stellar-erb
|
@@ -42,55 +37,100 @@ $ gem install stellar-erb
|
|
42
37
|
|
43
38
|
```ruby
|
44
39
|
# template.erb
|
45
|
-
<
|
46
|
-
<
|
47
|
-
<%
|
48
|
-
<
|
40
|
+
<div class="greeting">
|
41
|
+
<h1>Hello, <%= name %>!</h1>
|
42
|
+
<% if show_date %>
|
43
|
+
<p>Today is <%= Date.today %></p>
|
49
44
|
<% end %>
|
50
|
-
</
|
45
|
+
</div>
|
51
46
|
|
52
47
|
# Ruby code
|
53
|
-
result = Stellar::Erb
|
54
|
-
name: 'John',
|
55
|
-
|
48
|
+
result = Stellar::Erb.render('template.erb',
|
49
|
+
name: 'John',
|
50
|
+
show_date: true
|
56
51
|
)
|
57
52
|
```
|
58
53
|
|
54
|
+
### String Template Rendering
|
59
55
|
|
56
|
+
```ruby
|
57
|
+
template_string = <<~ERB
|
58
|
+
<ul class="items">
|
59
|
+
<% items.each do |item| %>
|
60
|
+
<li><%= item.name %> - $<%= item.price %></li>
|
61
|
+
<% end %>
|
62
|
+
</ul>
|
63
|
+
ERB
|
64
|
+
|
65
|
+
result = Stellar::Erb.render_string(template_string,
|
66
|
+
items: [
|
67
|
+
OpenStruct.new(name: 'Widget', price: 9.99),
|
68
|
+
OpenStruct.new(name: 'Gadget', price: 19.99)
|
69
|
+
]
|
70
|
+
)
|
71
|
+
```
|
60
72
|
|
61
|
-
|
73
|
+
### Reusable Views
|
62
74
|
|
63
75
|
```ruby
|
64
|
-
# Create a view instance
|
65
|
-
|
66
|
-
|
76
|
+
# Create a reusable view instance
|
77
|
+
header = Stellar::Erb::View.new('partials/header.erb',
|
78
|
+
company: 'Acme Corp',
|
79
|
+
logo_url: '/images/logo.png'
|
67
80
|
)
|
68
81
|
|
69
|
-
# Render
|
70
|
-
page1 =
|
71
|
-
page2 =
|
82
|
+
# Render with different page-specific variables
|
83
|
+
page1 = header.render(title: 'Home Page')
|
84
|
+
page2 = header.render(title: 'About Us')
|
72
85
|
```
|
73
86
|
|
74
|
-
|
87
|
+
### Error Handling
|
75
88
|
|
76
89
|
```ruby
|
77
90
|
begin
|
78
|
-
Stellar::Erb::View.render('template.erb', user: current_user)
|
91
|
+
result = Stellar::Erb::View.render('template.erb', user: current_user)
|
79
92
|
rescue Stellar::Erb::Error => e
|
80
|
-
puts "Error: #{e.message}"
|
81
|
-
|
93
|
+
puts "Template Error: #{e.message}"
|
94
|
+
|
95
|
+
# Show context around the error
|
96
|
+
puts "\nError Context:"
|
82
97
|
puts e.context_lines.join("\n")
|
83
|
-
|
98
|
+
|
99
|
+
# Access original error details
|
100
|
+
puts "Line Number: #{e.line_number}"
|
101
|
+
puts "Template Path: #{e.template_path}"
|
84
102
|
end
|
85
103
|
```
|
86
104
|
|
87
105
|
|
88
|
-
|
89
106
|
## Development
|
90
107
|
|
91
|
-
|
108
|
+
```bash
|
109
|
+
# Setup development environment
|
110
|
+
bin/setup
|
111
|
+
|
112
|
+
# Run tests
|
113
|
+
rake test
|
92
114
|
|
93
|
-
|
115
|
+
# Run specific test file
|
116
|
+
ruby -Ilib:test test/stellar/erb/view_test.rb
|
117
|
+
|
118
|
+
# Generate documentation
|
119
|
+
yard doc
|
120
|
+
```
|
121
|
+
|
122
|
+
## Contributing
|
123
|
+
|
124
|
+
1. Fork the repository
|
125
|
+
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
|
126
|
+
3. Add tests for your changes
|
127
|
+
4. Make your changes
|
128
|
+
5. Ensure tests pass (`rake test`)
|
129
|
+
6. Commit your changes (`git commit -am 'Add amazing feature'`)
|
130
|
+
7. Push to the branch (`git push origin feature/amazing-feature`)
|
131
|
+
8. Create a Pull Request
|
132
|
+
|
133
|
+
### Development Workflow
|
94
134
|
|
95
135
|
```mermaid
|
96
136
|
flowchart TD
|
@@ -107,28 +147,22 @@ flowchart TD
|
|
107
147
|
I -->|No| G
|
108
148
|
```
|
109
149
|
|
110
|
-
## Contributing
|
111
|
-
|
112
|
-
1. Fork it
|
113
|
-
2. Create your feature branch (`git checkout -b feature/my-new-feature`)
|
114
|
-
3. Commit your changes (`git commit -am 'Add some feature'`)
|
115
|
-
4. Push to the branch (`git push origin feature/my-new-feature`)
|
116
|
-
5. Create new Pull Request
|
117
|
-
|
118
150
|
## License
|
119
151
|
|
120
|
-
|
121
|
-
|
152
|
+
Released under the MIT License. See [LICENSE](LICENSE) for details.
|
122
153
|
|
123
154
|
## Support
|
124
155
|
|
125
|
-
|
156
|
+
- **Documentation**: [RubyDoc](https://www.rubydoc.info/gems/stellar-erb)
|
157
|
+
- **Issues**: [GitHub Issues](https://github.com/durableprogramming/stellar-erb/issues)
|
158
|
+
- **Discussions**: [GitHub Discussions](https://github.com/durableprogramming/stellar-erb/discussions)
|
126
159
|
|
127
|
-
|
128
|
-
|
129
|
-
Stellar::Erb is actively maintained by [Durable Programming, LLC](https://github.com/durableprogramming).
|
160
|
+
## Commercial Support
|
130
161
|
|
162
|
+
Professional support, custom development, and training services are available from [Durable Programming, LLC](https://www.durableprogramming.com).
|
131
163
|
|
132
|
-
|
164
|
+
---
|
133
165
|
|
134
|
-
](https://github.com/durableprogramming/stellar-erb/actions/workflows/main.yml)
|
167
|
+
[](https://badge.fury.io/rb/stellar-erb)
|
168
|
+
[](LICENSE)
|
data/lib/stellar/erb/error.rb
CHANGED
@@ -1,12 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Stellar
|
2
4
|
module Erb
|
3
5
|
class Error < StandardError
|
4
|
-
|
6
|
+
attr_accessor :template_path, :original_error, :line_number
|
5
7
|
|
6
8
|
def initialize(message = nil, template_path: nil, original_error: nil, line_number: nil)
|
7
9
|
@template_path = template_path
|
8
10
|
@original_error = original_error
|
9
11
|
@line_number = line_number
|
12
|
+
message ||= self.class.name
|
10
13
|
super(message)
|
11
14
|
end
|
12
15
|
|
@@ -23,39 +26,39 @@ module Stellar
|
|
23
26
|
|
24
27
|
def self.wrap(error, template_path: nil)
|
25
28
|
return error if error.is_a?(self)
|
26
|
-
|
29
|
+
|
27
30
|
line_number = extract_line_number(error, template_path)
|
28
31
|
message = error.message
|
29
|
-
|
30
|
-
new(message,
|
31
|
-
template_path: template_path,
|
32
|
-
original_error: error,
|
32
|
+
|
33
|
+
new(message,
|
34
|
+
template_path: template_path,
|
35
|
+
original_error: error,
|
33
36
|
line_number: line_number)
|
34
37
|
end
|
35
38
|
|
36
39
|
def self.extract_line_number(error, template_path)
|
37
40
|
return nil unless template_path && error.backtrace
|
38
|
-
|
41
|
+
|
39
42
|
backtrace_line = error.backtrace.find { |line| line.include?(template_path) }
|
40
43
|
return nil unless backtrace_line
|
41
|
-
|
44
|
+
|
42
45
|
match = backtrace_line.match(/:(\d+):/)
|
43
46
|
match ? match[1].to_i : nil
|
44
47
|
end
|
45
|
-
|
48
|
+
|
46
49
|
def context_lines(number_of_lines = 5)
|
47
50
|
return [] unless template_path && line_number && File.exist?(template_path)
|
48
|
-
|
51
|
+
|
49
52
|
lines = File.readlines(template_path)
|
50
53
|
start_line = [line_number - number_of_lines - 1, 0].max
|
51
54
|
end_line = [line_number + number_of_lines - 1, lines.length - 1].min
|
52
|
-
|
55
|
+
|
53
56
|
context = []
|
54
57
|
(start_line..end_line).each do |i|
|
55
58
|
prefix = i + 1 == line_number ? "=>" : " "
|
56
59
|
context << "#{prefix} #{i + 1}: #{lines[i].chomp}"
|
57
60
|
end
|
58
|
-
|
61
|
+
|
59
62
|
context
|
60
63
|
end
|
61
64
|
end
|
data/lib/stellar/erb/version.rb
CHANGED
data/lib/stellar/erb/view.rb
CHANGED
@@ -1,39 +1,40 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Stellar
|
2
4
|
module Erb
|
3
5
|
class View
|
4
|
-
|
5
|
-
|
6
|
+
attr_accessor :template_path, :template_content, :locals
|
7
|
+
|
6
8
|
def initialize(template_path, locals = {})
|
7
9
|
@template_path = template_path
|
8
|
-
@
|
10
|
+
if @template_path
|
11
|
+
@template_content = File.read(template_path)
|
12
|
+
end
|
9
13
|
@locals = locals
|
10
14
|
end
|
11
|
-
|
15
|
+
|
12
16
|
def render(additional_locals = {})
|
13
17
|
all_locals = locals.merge(additional_locals)
|
14
|
-
binding_obj = Binding.new(all_locals)
|
15
18
|
erb = ::ERB.new(template_content)
|
16
|
-
erb.
|
19
|
+
erb.result_with_hash(all_locals)
|
17
20
|
rescue StandardError => e
|
18
21
|
handle_error(e)
|
19
22
|
end
|
20
|
-
|
23
|
+
|
21
24
|
def self.render(template_path, locals = {})
|
22
25
|
new(template_path, locals).render
|
23
26
|
end
|
24
|
-
|
27
|
+
|
25
28
|
private
|
26
|
-
|
29
|
+
|
27
30
|
def handle_error(error)
|
28
|
-
if error.is_a?(SyntaxError)
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
raise error_with_context
|
36
|
-
end
|
31
|
+
raise Error, "Syntax error in template #{template_path}: #{error.message}" if error.is_a?(SyntaxError)
|
32
|
+
|
33
|
+
backtrace = error.backtrace.select { |line| line.include?(template_path) }
|
34
|
+
message = "Error rendering template #{template_path}: #{error.message}"
|
35
|
+
error_with_context = Error.new(message)
|
36
|
+
error_with_context.set_backtrace(backtrace.empty? ? error.backtrace : backtrace)
|
37
|
+
raise error_with_context
|
37
38
|
end
|
38
39
|
end
|
39
40
|
end
|
data/lib/stellar/erb.rb
CHANGED
@@ -1,16 +1,55 @@
|
|
1
1
|
require_relative "erb/version"
|
2
|
-
require_relative "erb/binding"
|
3
2
|
require_relative "erb/error"
|
4
3
|
require_relative "erb/view"
|
5
4
|
require "erb"
|
6
5
|
|
7
6
|
module Stellar
|
8
7
|
module Erb
|
8
|
+
# :nodoc:
|
9
|
+
# This module provides a lightweight ERB template rendering system
|
10
|
+
# with error handling capabilities.
|
11
|
+
|
9
12
|
class Error < StandardError; end
|
10
|
-
|
13
|
+
|
11
14
|
# Shortcut method for rendering templates
|
15
|
+
# This method provides a convenient interface to render ERB templates
|
16
|
+
# directly from the Stellar::Erb module without instantiating a View.
|
17
|
+
#
|
18
|
+
# @param template_path [String] The path to the ERB template file
|
19
|
+
# @param locals [Hash] A hash of local variables to be made available in the template
|
20
|
+
# @return [String] The rendered template result
|
21
|
+
#
|
22
|
+
# @example Render a template with variables
|
23
|
+
# Stellar::Erb.render("path/to/template.erb", name: "World")
|
24
|
+
#
|
25
|
+
# @example Render a template without variables
|
26
|
+
# Stellar::Erb.render("path/to/simple.erb")
|
27
|
+
#
|
28
|
+
# @raise [Stellar::Erb::Error] if an error occurs during template rendering
|
29
|
+
# @raise [Errno::ENOENT] if the template file doesn't exist
|
12
30
|
def self.render(template_path, locals = {})
|
13
31
|
View.render(template_path, locals)
|
14
32
|
end
|
33
|
+
|
34
|
+
# Renders an ERB template from a string instead of a file
|
35
|
+
# This is useful for template strings that are generated dynamically
|
36
|
+
# or stored in a database rather than in files.
|
37
|
+
#
|
38
|
+
# @param str [String] The ERB template string to render
|
39
|
+
# @param locals [Hash] A hash of local variables to be made available in the template
|
40
|
+
# @return [String] The rendered template result
|
41
|
+
#
|
42
|
+
# @example Render a string template with variables
|
43
|
+
# Stellar::Erb.render_string("<p>Hello, <%= name %></p>", name: "World")
|
44
|
+
#
|
45
|
+
# @example Render a string template without variables
|
46
|
+
# Stellar::Erb.render_string("<p>Static content</p>")
|
47
|
+
#
|
48
|
+
# @raise [Stellar::Erb::Error] if an error occurs during template rendering
|
49
|
+
def self.render_string(str, locals = {})
|
50
|
+
v = View.new(nil, locals)
|
51
|
+
v.template_content = str
|
52
|
+
v.render()
|
53
|
+
end
|
15
54
|
end
|
16
55
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "erb/version"
|
4
|
+
require_relative "erb/error"
|
5
|
+
require_relative "erb/view"
|
6
|
+
require "erb"
|
7
|
+
|
8
|
+
module Stellar
|
9
|
+
module Erb
|
10
|
+
class Error < StandardError; end
|
11
|
+
|
12
|
+
# Shortcut method for rendering templates
|
13
|
+
def self.render(template_path, locals = {})
|
14
|
+
View.render(template_path, locals)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
13,27d12
|
2
|
+
< # This method provides a convenient interface to render ERB templates
|
3
|
+
< # directly from the Stellar::Erb module without instantiating a View.
|
4
|
+
< #
|
5
|
+
< # @param template_path [String] The path to the ERB template file
|
6
|
+
< # @param locals [Hash] A hash of local variables to be made available in the template
|
7
|
+
< # @return [String] The rendered template result
|
8
|
+
< #
|
9
|
+
< # @example Render a template with variables
|
10
|
+
< # Stellar::Erb.render("path/to/template.erb", name: "World")
|
11
|
+
< #
|
12
|
+
< # @example Render a template without variables
|
13
|
+
< # Stellar::Erb.render("path/to/simple.erb")
|
14
|
+
< #
|
15
|
+
< # @raise [Stellar::Erb::Error] if an error occurs during template rendering
|
16
|
+
< # @raise [Errno::ENOENT] if the template file doesn't exist
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "erb/version"
|
4
|
+
require_relative "erb/error"
|
5
|
+
require_relative "erb/view"
|
6
|
+
require "erb"
|
7
|
+
|
8
|
+
module Stellar
|
9
|
+
module Erb
|
10
|
+
class Error < StandardError; end
|
11
|
+
|
12
|
+
# Shortcut method for rendering templates
|
13
|
+
# This method provides a convenient interface to render ERB templates
|
14
|
+
# directly from the Stellar::Erb module without instantiating a View.
|
15
|
+
#
|
16
|
+
# @param template_path [String] The path to the ERB template file
|
17
|
+
# @param locals [Hash] A hash of local variables to be made available in the template
|
18
|
+
# @return [String] The rendered template result
|
19
|
+
#
|
20
|
+
# @example Render a template with variables
|
21
|
+
# Stellar::Erb.render("path/to/template.erb", name: "World")
|
22
|
+
#
|
23
|
+
# @example Render a template without variables
|
24
|
+
# Stellar::Erb.render("path/to/simple.erb")
|
25
|
+
#
|
26
|
+
# @raise [Stellar::Erb::Error] if an error occurs during template rendering
|
27
|
+
# @raise [Errno::ENOENT] if the template file doesn't exist
|
28
|
+
def self.render(template_path, locals = {})
|
29
|
+
View.render(template_path, locals)
|
30
|
+
end
|
31
|
+
def self.render_string(str, locals = {})
|
32
|
+
v = View.new(nil, locals)
|
33
|
+
v.template_content = str
|
34
|
+
v.render()
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
0a1,7
|
2
|
+
> # frozen_string_literal: true
|
3
|
+
>
|
4
|
+
> require_relative "erb/version"
|
5
|
+
> require_relative "erb/error"
|
6
|
+
> require_relative "erb/view"
|
7
|
+
> require "erb"
|
8
|
+
>
|
9
|
+
3,6d9
|
10
|
+
< # :nodoc:
|
11
|
+
< # This module provides a lightweight ERB template rendering system
|
12
|
+
< # with error handling capabilities.
|
13
|
+
<
|
14
|
+
28,43d30
|
15
|
+
<
|
16
|
+
< # Renders an ERB template from a string instead of a file
|
17
|
+
< # This is useful for template strings that are generated dynamically
|
18
|
+
< # or stored in a database rather than in files.
|
19
|
+
< #
|
20
|
+
< # @param str [String] The ERB template string to render
|
21
|
+
< # @param locals [Hash] A hash of local variables to be made available in the template
|
22
|
+
< # @return [String] The rendered template result
|
23
|
+
< #
|
24
|
+
< # @example Render a string template with variables
|
25
|
+
< # Stellar::Erb.render_string("<p>Hello, <%= name %></p>", name: "World")
|
26
|
+
< #
|
27
|
+
< # @example Render a string template without variables
|
28
|
+
< # Stellar::Erb.render_string("<p>Static content</p>")
|
29
|
+
< #
|
30
|
+
< # @raise [Stellar::Erb::Error] if an error occurs during template rendering
|
data/lib/stellar.rb
CHANGED
data/lib/stellar.rb.1.diff.bak
CHANGED
@@ -0,0 +1,15 @@
|
|
1
|
+
5,8d4
|
2
|
+
<
|
3
|
+
< # Autoload the Erb module when it's first referenced
|
4
|
+
< # This avoids loading the code until it's needed, improving performance
|
5
|
+
< # and reducing memory usage for applications that don't use Erb functionality
|
6
|
+
10,18d5
|
7
|
+
<
|
8
|
+
< # Additional Stellar components can be autoloaded here as the library grows
|
9
|
+
< # For example:
|
10
|
+
< # autoload :Json, "stellar/json"
|
11
|
+
< # autoload :Yaml, "stellar/yaml"
|
12
|
+
< # autoload :Markdown, "stellar/markdown"
|
13
|
+
<
|
14
|
+
< # This module can also include utility methods that are used throughout
|
15
|
+
< # the Stellar framework components
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stellar-erb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Durable Programming, LLC
|
@@ -25,33 +25,33 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '4.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: minitest
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '5.0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '5.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '13.0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '13.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rubocop
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -76,16 +76,20 @@ extensions: []
|
|
76
76
|
extra_rdoc_files: []
|
77
77
|
files:
|
78
78
|
- CHANGELOG.md
|
79
|
-
- LICENSE
|
79
|
+
- LICENSE
|
80
80
|
- README.md
|
81
81
|
- bin/console
|
82
82
|
- bin/setup
|
83
83
|
- lib/stellar.rb
|
84
|
+
- lib/stellar.rb.1.bak
|
84
85
|
- lib/stellar.rb.1.diff.bak
|
85
86
|
- lib/stellar/erb.rb
|
86
87
|
- lib/stellar/erb.rb.1.bak
|
87
88
|
- lib/stellar/erb.rb.1.diff.bak
|
88
|
-
- lib/stellar/erb
|
89
|
+
- lib/stellar/erb.rb.2.bak
|
90
|
+
- lib/stellar/erb.rb.2.diff.bak
|
91
|
+
- lib/stellar/erb.rb.3.bak
|
92
|
+
- lib/stellar/erb.rb.3.diff.bak
|
89
93
|
- lib/stellar/erb/binding.rb.1.diff.bak
|
90
94
|
- lib/stellar/erb/error.rb
|
91
95
|
- lib/stellar/erb/error.rb.1.bak
|
data/lib/stellar/erb/binding.rb
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
module Stellar
|
2
|
-
module Erb
|
3
|
-
class Binding
|
4
|
-
attr_reader :locals
|
5
|
-
|
6
|
-
def initialize(locals = {})
|
7
|
-
@locals = locals
|
8
|
-
end
|
9
|
-
|
10
|
-
def get_binding
|
11
|
-
locals.each do |key, value|
|
12
|
-
singleton_class.class_eval do
|
13
|
-
define_method(key) { value }
|
14
|
-
end
|
15
|
-
end
|
16
|
-
binding
|
17
|
-
end
|
18
|
-
|
19
|
-
def method_missing(method_name, *args, &block)
|
20
|
-
if locals.key?(method_name)
|
21
|
-
locals[method_name]
|
22
|
-
else
|
23
|
-
super
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
def respond_to_missing?(method_name, include_private = false)
|
28
|
-
locals.key?(method_name) || super
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
/data/{LICENSE.txt → LICENSE}
RENAMED
File without changes
|