Class: Brut::CLI::Apps::New::ErbBindingDelegate
- Inherits:
-
Object
- Object
- Brut::CLI::Apps::New::ErbBindingDelegate
- Defined in:
- lib/brut/cli/apps/new/erb_binding_delegate.rb
Overview
This exists because ERB can't working with a SimpleDelegator or Delegate.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#app_name ⇒ Object
readonly
Returns the value of attribute app_name.
-
#versions ⇒ Object
readonly
Returns the value of attribute versions.
Instance Method Summary collapse
-
#initialize(options:, app_name:, versions:) ⇒ ErbBindingDelegate
constructor
A new instance of ErbBindingDelegate.
-
#method_missing(syn, *args, &block) ⇒ Object
Not using Delegate because it won't work with ERB binding.
-
#respond_to_missing?(syn, include_all) ⇒ Boolean
Constructor Details
#initialize(options:, app_name:, versions:) ⇒ ErbBindingDelegate
Returns a new instance of ErbBindingDelegate.
5 6 7 8 9 |
# File 'lib/brut/cli/apps/new/erb_binding_delegate.rb', line 5 def initialize(options:, app_name:, versions:) @options = @app_name = app_name @versions = versions end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(syn, *args, &block) ⇒ Object
Not using Delegate because it won't work with ERB binding
12 13 14 15 16 17 18 |
# File 'lib/brut/cli/apps/new/erb_binding_delegate.rb', line 12 def method_missing(syn,*args,&block) if args.empty? && @options.respond_to?(syn) @options.send(syn) else super end end |
Instance Attribute Details
#app_name ⇒ Object (readonly)
Returns the value of attribute app_name.
4 5 6 |
# File 'lib/brut/cli/apps/new/erb_binding_delegate.rb', line 4 def app_name @app_name end |
#versions ⇒ Object (readonly)
Returns the value of attribute versions.
4 5 6 |
# File 'lib/brut/cli/apps/new/erb_binding_delegate.rb', line 4 def versions @versions end |
Instance Method Details
#respond_to_missing?(syn, include_all) ⇒ Boolean
20 21 22 |
# File 'lib/brut/cli/apps/new/erb_binding_delegate.rb', line 20 def respond_to_missing?(syn,include_all) @options.respond_to?(syn) end |