Class: Middleman::SourceFile

Inherits:
Struct
  • Object
show all
Defined in:
lib/middleman-core/sources.rb

Overview

The standard "record" that contains information about a file on disk.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#directoryObject

Returns the value of attribute directory

Returns:

  • (Object)

    the current value of directory



6
7
8
# File 'lib/middleman-core/sources.rb', line 6

def directory
  @directory
end

#full_pathObject

Returns the value of attribute full_path

Returns:

  • (Object)

    the current value of full_path



6
7
8
# File 'lib/middleman-core/sources.rb', line 6

def full_path
  @full_path
end

#relative_pathObject

Returns the value of attribute relative_path

Returns:

  • (Object)

    the current value of relative_path



6
7
8
# File 'lib/middleman-core/sources.rb', line 6

def relative_path
  @relative_path
end

#typesObject

Returns the value of attribute types

Returns:

  • (Object)

    the current value of types



6
7
8
# File 'lib/middleman-core/sources.rb', line 6

def types
  @types
end

#versionObject

Returns the value of attribute version

Returns:

  • (Object)

    the current value of version



6
7
8
# File 'lib/middleman-core/sources.rb', line 6

def version
  @version
end

Instance Method Details

#normalized_relative_pathObject



12
13
14
# File 'lib/middleman-core/sources.rb', line 12

def normalized_relative_path
  @normalized_relative_path ||= ::Middleman::Util.normalize_path relative_path.to_s
end

#readObject



7
8
9
10
# File 'lib/middleman-core/sources.rb', line 7

def read
  ::Middleman::Sources.file_cache[full_path] ||= {}
  ::Middleman::Sources.file_cache[full_path][version] ||= ::File.read(full_path)
end