Module: Prof::ExternalSpec::Helpers::FileHelper
- Defined in:
- lib/prof/external_spec/helpers/file_helper.rb
Instance Method Summary collapse
- #file_contents(relative_to_root) ⇒ Object
- #file_path(relative_to_root) ⇒ Object
- #json_contents(relative_to_root) ⇒ Object
- #root_path ⇒ Object
Instance Method Details
#file_contents(relative_to_root) ⇒ Object
29 30 31 |
# File 'lib/prof/external_spec/helpers/file_helper.rb', line 29 def file_contents(relative_to_root) File.read(file_path(relative_to_root)) end |
#file_path(relative_to_root) ⇒ Object
21 22 23 |
# File 'lib/prof/external_spec/helpers/file_helper.rb', line 21 def file_path(relative_to_root) File.(relative_to_root, root_path) end |
#json_contents(relative_to_root) ⇒ Object
25 26 27 |
# File 'lib/prof/external_spec/helpers/file_helper.rb', line 25 def json_contents(relative_to_root) JSON.parse(file_contents(relative_to_root), symbolize_names: true) end |
#root_path ⇒ Object
17 18 19 |
# File 'lib/prof/external_spec/helpers/file_helper.rb', line 17 def root_path defined?(ROOT_PATH) ? ROOT_PATH : Dir.pwd end |