Class: Ec2::ErbProfile
- Inherits:
-
Object
- Object
- Ec2::ErbProfile
- Defined in:
- lib/ec2/erb_profile.rb
Instance Attribute Summary collapse
-
#api ⇒ Object
Returns the value of attribute api.
Instance Method Summary collapse
- #binding ⇒ Object
-
#initialize(file, api: nil) ⇒ ErbProfile
constructor
A new instance of ErbProfile.
- #render ⇒ Object
Methods included from Helper
Methods included from Logger
#debug?, #logger, logger, #stderr, stderr
Constructor Details
#initialize(file, api: nil) ⇒ ErbProfile
Returns a new instance of ErbProfile.
13 14 15 16 |
# File 'lib/ec2/erb_profile.rb', line 13 def initialize(file, api: nil) @file = file @api = api end |
Instance Attribute Details
#api ⇒ Object
Returns the value of attribute api.
11 12 13 |
# File 'lib/ec2/erb_profile.rb', line 11 def api @api end |
Instance Method Details
#binding ⇒ Object
18 19 20 |
# File 'lib/ec2/erb_profile.rb', line 18 def binding api.instance_eval { binding } end |
#render ⇒ Object
22 23 24 25 26 27 |
# File 'lib/ec2/erb_profile.rb', line 22 def render erb = ERB.new(File.read(@file), nil, '-') erb.result(binding) rescue => e error "while rendering erb file #{@file}" end |