Class: FileParser
- Inherits:
-
Object
- Object
- FileParser
- Defined in:
- lib/rstub/file_parser.rb
Overview
FileParser goes through a file and writes the contents of it to a target file, but it ignores anything between the delimiters # STUB and # ENDSTUB.
Instance Attribute Summary collapse
-
#end_stub_regex ⇒ Object
Returns the value of attribute end_stub_regex.
-
#stub_regex ⇒ Object
Returns the value of attribute stub_regex.
-
#stubbing ⇒ Object
Returns the value of attribute stubbing.
Instance Method Summary collapse
Instance Attribute Details
#end_stub_regex ⇒ Object
Returns the value of attribute end_stub_regex.
4 5 6 |
# File 'lib/rstub/file_parser.rb', line 4 def end_stub_regex @end_stub_regex end |
#stub_regex ⇒ Object
Returns the value of attribute stub_regex.
4 5 6 |
# File 'lib/rstub/file_parser.rb', line 4 def stub_regex @stub_regex end |
#stubbing ⇒ Object
Returns the value of attribute stubbing.
4 5 6 |
# File 'lib/rstub/file_parser.rb', line 4 def stubbing @stubbing end |
Instance Method Details
#stub(target_file, file) ⇒ Object
6 7 8 9 10 11 12 13 |
# File 'lib/rstub/file_parser.rb', line 6 def stub(target_file, file) determine_delimiters(file) File.open(file, 'r') do |readable_file| File.open(target_file, 'w') do |target| write_text(target, readable_file) end end end |