Class: Markdaver::MarkdownEditorEnv
- Inherits:
-
Object
- Object
- Markdaver::MarkdownEditorEnv
- Defined in:
- lib/markdaver/markdown_editor_env.rb
Instance Attribute Summary collapse
-
#root_path ⇒ Object
readonly
Returns the value of attribute root_path.
Instance Method Summary collapse
- #index ⇒ Object
-
#initialize(root_path: File.expand_path("../../../markdown-editor/"), script_file: nil, file_to_open: nil) ⇒ MarkdownEditorEnv
constructor
A new instance of MarkdownEditorEnv.
Constructor Details
#initialize(root_path: File.expand_path("../../../markdown-editor/"), script_file: nil, file_to_open: nil) ⇒ MarkdownEditorEnv
Returns a new instance of MarkdownEditorEnv.
5 6 7 8 9 10 11 12 13 |
# File 'lib/markdaver/markdown_editor_env.rb', line 5 def initialize( root_path: File.("../../../markdown-editor/"), script_file: nil, file_to_open: nil ) @root_path = root_path @script_file = script_file @file_to_open = file_to_open end |
Instance Attribute Details
#root_path ⇒ Object (readonly)
Returns the value of attribute root_path.
3 4 5 |
# File 'lib/markdaver/markdown_editor_env.rb', line 3 def root_path @root_path end |
Instance Method Details
#index ⇒ Object
15 16 17 18 |
# File 'lib/markdaver/markdown_editor_env.rb', line 15 def index @index ||= File.read(File.join @root_path, "index.html") .gsub(/<\/body>/, "\n<script>#{script}</script>\\0") end |