Class: Rebi::ErbHelper
- Inherits:
-
Object
- Object
- Rebi::ErbHelper
- Defined in:
- lib/rebi/erb_helper.rb
Instance Method Summary collapse
-
#initialize(input, env_conf) ⇒ ErbHelper
constructor
A new instance of ErbHelper.
- #rebi ⇒ Object
- #rebi_env(k = nil) ⇒ Object
- #result ⇒ Object
Constructor Details
#initialize(input, env_conf) ⇒ ErbHelper
Returns a new instance of ErbHelper.
3 4 5 6 7 |
# File 'lib/rebi/erb_helper.rb', line 3 def initialize input, env_conf @input = input @env = env_conf.environment_variables || {} @options = env_conf. end |
Instance Method Details
#rebi ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/rebi/erb_helper.rb', line 13 def rebi OpenStruct.new ({ env: @env, opts: @options, options: @options, }) end |
#rebi_env(k = nil) ⇒ Object
9 10 11 |
# File 'lib/rebi/erb_helper.rb', line 9 def rebi_env k=nil k.present? ? @env[k] : @env end |
#result ⇒ Object
21 22 23 |
# File 'lib/rebi/erb_helper.rb', line 21 def result ERB.new(@input).result(binding) end |