Class: Victor::CLI::RubyCode
- Inherits:
-
Object
- Object
- Victor::CLI::RubyCode
- Includes:
- DSL
- Defined in:
- lib/victor/cli/ruby_code.rb
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
Instance Method Summary collapse
- #evaluate ⇒ Object
-
#initialize(code) ⇒ RubyCode
constructor
A new instance of RubyCode.
- #template(template) ⇒ Object
Constructor Details
#initialize(code) ⇒ RubyCode
Returns a new instance of RubyCode.
7 8 9 |
# File 'lib/victor/cli/ruby_code.rb', line 7 def initialize(code) @code = code end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
5 6 7 |
# File 'lib/victor/cli/ruby_code.rb', line 5 def code @code end |
Instance Method Details
#evaluate ⇒ Object
11 12 13 |
# File 'lib/victor/cli/ruby_code.rb', line 11 def evaluate instance_eval code end |
#template(template) ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/victor/cli/ruby_code.rb', line 15 def template(template) if built_in_templates.include? template template = template.to_sym elsif !File.exist? template raise "Template not found #{template}\nAvailable templates: #{built_in_templates.join ', '}, or a file path" end svg.template = template end |