Class: Henshin::Static
- Inherits:
-
Object
- Object
- Henshin::Static
- Defined in:
- lib/henshin/static.rb
Instance Attribute Summary collapse
-
#content ⇒ Object
Returns the value of attribute content.
-
#path ⇒ Object
Returns the value of attribute path.
-
#site ⇒ Object
Returns the value of attribute site.
Instance Method Summary collapse
-
#initialize(path, site) ⇒ Static
constructor
A new instance of Static.
- #inspect ⇒ Object
-
#write ⇒ Object
Writes the file to the correct place.
-
#write_path ⇒ Pathname
Path to write the file.
Constructor Details
#initialize(path, site) ⇒ Static
Returns a new instance of Static.
7 8 9 10 11 |
# File 'lib/henshin/static.rb', line 7 def initialize( path, site ) @path = path @site = site @content = File.read(path) end |
Instance Attribute Details
#content ⇒ Object
Returns the value of attribute content.
5 6 7 |
# File 'lib/henshin/static.rb', line 5 def content @content end |
#path ⇒ Object
Returns the value of attribute path.
5 6 7 |
# File 'lib/henshin/static.rb', line 5 def path @path end |
#site ⇒ Object
Returns the value of attribute site.
5 6 7 |
# File 'lib/henshin/static.rb', line 5 def site @site end |
Instance Method Details
#inspect ⇒ Object
27 28 29 |
# File 'lib/henshin/static.rb', line 27 def inspect "#<Static:#{@path}>" end |
#write ⇒ Object
Writes the file to the correct place
15 16 17 18 19 |
# File 'lib/henshin/static.rb', line 15 def write FileUtils.mkdir_p(self.write_path.dirname) file = File.new(self.write_path, "w") file.puts(@content) end |