Class: Middleman::SourceFile

Inherits:
Struct
  • Object
show all
Defined in:
middleman-core/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


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

def directory
  @directory
end

#full_pathObject

Returns the value of attribute full_path

Returns:

  • (Object)

    the current value of full_path


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

def full_path
  @full_path
end

#relative_pathObject

Returns the value of attribute relative_path

Returns:

  • (Object)

    the current value of relative_path


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

def relative_path
  @relative_path
end

#typesObject

Returns the value of attribute types

Returns:

  • (Object)

    the current value of types


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

def types
  @types
end

#versionObject

Returns the value of attribute version

Returns:

  • (Object)

    the current value of version


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

def version
  @version
end

Instance Method Details

#normalized_relative_pathObject


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

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

#readObject


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

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