Class: PointRb::PointRbFile
- Inherits:
-
Object
- Object
- PointRb::PointRbFile
- Defined in:
- lib/pointrb/pointrb_file.rb
Instance Attribute Summary collapse
-
#base_dir ⇒ Object
Returns the value of attribute base_dir.
-
#content ⇒ Object
Returns the value of attribute content.
-
#path ⇒ Object
Returns the value of attribute path.
Instance Method Summary collapse
- #create ⇒ Object
- #full_path ⇒ Object
-
#initialize(path, content) ⇒ PointRbFile
constructor
A new instance of PointRbFile.
Constructor Details
#initialize(path, content) ⇒ PointRbFile
Returns a new instance of PointRbFile.
7 8 9 10 11 |
# File 'lib/pointrb/pointrb_file.rb', line 7 def initialize(path, content) @path = path @base_dir = '' @content = canonize_string(content) end |
Instance Attribute Details
#base_dir ⇒ Object
Returns the value of attribute base_dir.
5 6 7 |
# File 'lib/pointrb/pointrb_file.rb', line 5 def base_dir @base_dir end |
#content ⇒ Object
Returns the value of attribute content.
5 6 7 |
# File 'lib/pointrb/pointrb_file.rb', line 5 def content @content end |
#path ⇒ Object
Returns the value of attribute path.
5 6 7 |
# File 'lib/pointrb/pointrb_file.rb', line 5 def path @path end |
Instance Method Details
#create ⇒ Object
21 22 23 24 25 |
# File 'lib/pointrb/pointrb_file.rb', line 21 def create File.open(full_path, "wb") do |f| f.write content end end |
#full_path ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/pointrb/pointrb_file.rb', line 13 def full_path if @path =~ /^\// @path else File.join(@base_dir, @path) end end |