Class: DNSer::Template
- Inherits:
-
Object
- Object
- DNSer::Template
- Defined in:
- lib/dnser/template.rb
Defined Under Namespace
Classes: Unknown
Instance Method Summary collapse
- #apply(domain, *args, &block) ⇒ Object
-
#initialize(params = {}, &block) ⇒ Template
constructor
A new instance of Template.
Constructor Details
#initialize(params = {}, &block) ⇒ Template
Returns a new instance of Template.
3 4 5 6 |
# File 'lib/dnser/template.rb', line 3 def initialize(params = {}, &block) @block = block @params = params end |
Instance Method Details
#apply(domain, *args, &block) ⇒ Object
8 9 10 11 12 13 14 15 16 |
# File 'lib/dnser/template.rb', line 8 def apply(domain, *args, &block) if args.last.is_a? Hash args.push @params.merge(args.pop) else args.push @params end domain.instance_exec *args, &@block if @block domain.instance_exec *args, &block if block end |