Class: Rake::Pipeline::Web::Filters::MemoryFileWrapper

Inherits:
Struct
  • Object
show all
Defined in:
lib/rake-pipeline-web-filters/chained_filter.rb

Overview

Implement the FileWrapper API. Because filters are defined in terms of the FileWrapper API, we can implement an alternative that doesn’t write to disk but still utilizes the same filter definitions.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#bodyObject Also known as: read

Returns the value of attribute body

Returns:

  • (Object)

    the current value of body



6
7
8
# File 'lib/rake-pipeline-web-filters/chained_filter.rb', line 6

def body
  @body
end

#encodingObject

Returns the value of attribute encoding

Returns:

  • (Object)

    the current value of encoding



6
7
8
# File 'lib/rake-pipeline-web-filters/chained_filter.rb', line 6

def encoding
  @encoding
end

#pathObject

Returns the value of attribute path

Returns:

  • (Object)

    the current value of path



6
7
8
# File 'lib/rake-pipeline-web-filters/chained_filter.rb', line 6

def path
  @path
end

#rootObject

Returns the value of attribute root

Returns:

  • (Object)

    the current value of root



6
7
8
# File 'lib/rake-pipeline-web-filters/chained_filter.rb', line 6

def root
  @root
end

Instance Method Details

#createObject



15
16
17
18
# File 'lib/rake-pipeline-web-filters/chained_filter.rb', line 15

def create
  self.body = ""
  yield
end

#fullpathObject



11
12
13
# File 'lib/rake-pipeline-web-filters/chained_filter.rb', line 11

def fullpath
  File.join(root, path)
end

#with_encoding(new_encoding) ⇒ Object



7
8
9
# File 'lib/rake-pipeline-web-filters/chained_filter.rb', line 7

def with_encoding(new_encoding)
  self.class.new(root, path, new_encoding, body)
end

#write(contents) ⇒ Object



22
23
24
# File 'lib/rake-pipeline-web-filters/chained_filter.rb', line 22

def write(contents)
  self.body << contents
end