Class: Ircbot::Client::Config::Generator
- Defined in:
- lib/ircbot/client/config/generator.rb
Instance Attribute Summary collapse
-
#nick ⇒ Object
readonly
Returns the value of attribute nick.
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(options = {}) ⇒ Generator
constructor
A new instance of Generator.
Constructor Details
#initialize(options = {}) ⇒ Generator
Returns a new instance of Generator.
9 10 11 12 13 14 |
# File 'lib/ircbot/client/config/generator.rb', line 9 def initialize( = {}) @nick = [:nick] @code = [:code] || read_template @nick = current_user + "_bot" if @nick.to_s.empty? end |
Instance Attribute Details
#nick ⇒ Object (readonly)
Returns the value of attribute nick.
7 8 9 |
# File 'lib/ircbot/client/config/generator.rb', line 7 def nick @nick end |
Instance Method Details
#execute ⇒ Object
16 17 18 19 20 |
# File 'lib/ircbot/client/config/generator.rb', line 16 def execute require 'erb' erb = ERB.new(@code) erb.result(binding) end |