Class: Catsay::Cat
- Inherits:
-
Object
- Object
- Catsay::Cat
- Defined in:
- lib/cat.rb
Overview
Cat class does the meowing.
Instance Method Summary collapse
-
#initialize(kwargs = {}) ⇒ Cat
constructor
create a new instance of cat :template specifies which template to use the default template is :default.
-
#meow(message) ⇒ Object
renders the message using an erb template returns the rendered template.
Constructor Details
#initialize(kwargs = {}) ⇒ Cat
create a new instance of cat :template specifies which template to use the default template is :default
7 8 9 10 |
# File 'lib/cat.rb', line 7 def initialize(kwargs = {}) @template = kwargs[:template] self end |
Instance Method Details
#meow(message) ⇒ Object
renders the message using an erb template returns the rendered template
14 15 16 17 |
# File 'lib/cat.rb', line 14 def meow() @message = ERB.new(@template).result(binding) end |