Class: Rundoc::CodeCommand::Raw
- Inherits:
-
Object
- Object
- Rundoc::CodeCommand::Raw
- Defined in:
- lib/rundoc/code_command/raw.rb
Overview
Wraps lines inside a fenced code block that are not rundoc commands. These are rendered as-is without executing any code.
Example:
```ruby
gem 'sqlite3' <- parsed as Raw
:::>> $ echo "hi" <- parsed as a code command
```
Instance Attribute Summary collapse
-
#contents ⇒ Object
readonly
Returns the value of attribute contents.
Instance Method Summary collapse
- #call(env = {}) ⇒ Object
-
#initialize(user_args: nil, render_command: true, render_result: true, io: nil, contents: nil) ⇒ Raw
constructor
A new instance of Raw.
- #to_md(env = {}) ⇒ Object
Constructor Details
#initialize(user_args: nil, render_command: true, render_result: true, io: nil, contents: nil) ⇒ Raw
Returns a new instance of Raw.
17 18 19 |
# File 'lib/rundoc/code_command/raw.rb', line 17 def initialize(user_args: nil, render_command: true, render_result: true, io: nil, contents: nil) @contents = contents.dup if contents && !contents.empty? end |
Instance Attribute Details
#contents ⇒ Object (readonly)
Returns the value of attribute contents.
15 16 17 |
# File 'lib/rundoc/code_command/raw.rb', line 15 def contents @contents end |
Instance Method Details
#call(env = {}) ⇒ Object
21 22 23 |
# File 'lib/rundoc/code_command/raw.rb', line 21 def call(env = {}) contents.to_s end |
#to_md(env = {}) ⇒ Object
25 26 27 |
# File 'lib/rundoc/code_command/raw.rb', line 25 def to_md(env = {}) contents.to_s end |