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


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

def directory
  @directory
end

#full_pathObject

Returns the value of attribute full_path

Returns:

  • (Object)

    the current value of full_path


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

def full_path
  @full_path
end

#relative_pathObject

Returns the value of attribute relative_path

Returns:

  • (Object)

    the current value of relative_path


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

def relative_path
  @relative_path
end

#typesObject

Returns the value of attribute types

Returns:

  • (Object)

    the current value of types


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

def types
  @types
end

#versionObject

Returns the value of attribute version

Returns:

  • (Object)

    the current value of version


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

def version
  @version
end

Instance Method Details

#normalized_relative_pathObject


15
16
17
# File 'middleman-core/lib/middleman-core/sources.rb', line 15

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

#readObject


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

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