Class: Smartdown::Parser::InputFile
- Inherits:
-
Object
- Object
- Smartdown::Parser::InputFile
- Defined in:
- lib/smartdown/parser/directory_input.rb
Instance Method Summary collapse
-
#initialize(path, name = nil) ⇒ InputFile
constructor
A new instance of InputFile.
- #name ⇒ Object
- #read ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(path, name = nil) ⇒ InputFile
Returns a new instance of InputFile.
67 68 69 70 |
# File 'lib/smartdown/parser/directory_input.rb', line 67 def initialize(path, name=nil) @path = Pathname.new(path.to_s) @name = name ||= @path.basename end |
Instance Method Details
#name ⇒ Object
72 73 74 |
# File 'lib/smartdown/parser/directory_input.rb', line 72 def name @name.to_s.split(".").first end |
#read ⇒ Object
76 77 78 |
# File 'lib/smartdown/parser/directory_input.rb', line 76 def read File.read(@path) end |
#to_s ⇒ Object
80 81 82 |
# File 'lib/smartdown/parser/directory_input.rb', line 80 def to_s @path.to_s end |