Class: SassListen::Record::Entry
- Inherits:
-
Object
- Object
- SassListen::Record::Entry
- Defined in:
- lib/sass-listen/record/entry.rb
Overview
Represents a directory entry (dir or file)
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#relative ⇒ Object
readonly
Returns the value of attribute relative.
-
#root ⇒ Object
readonly
Returns the value of attribute root.
Instance Method Summary collapse
- #children ⇒ Object
-
#initialize(root, relative, name = nil) ⇒ Entry
constructor
file: “/home/me/watched_dir”, “app/models”, “foo.rb” dir, “/home/me/watched_dir”, “.”.
- #meta ⇒ Object
- #real_path ⇒ Object
-
#record_dir_key ⇒ Object
record hash is e.g.
- #sys_path ⇒ Object
Constructor Details
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
12 13 14 |
# File 'lib/sass-listen/record/entry.rb', line 12 def name @name end |
#relative ⇒ Object (readonly)
Returns the value of attribute relative.
12 13 14 |
# File 'lib/sass-listen/record/entry.rb', line 12 def relative @relative end |
#root ⇒ Object (readonly)
Returns the value of attribute root.
12 13 14 |
# File 'lib/sass-listen/record/entry.rb', line 12 def root @root end |
Instance Method Details
#children ⇒ Object
14 15 16 17 18 19 |
# File 'lib/sass-listen/record/entry.rb', line 14 def children child_relative = _join (_entries(sys_path) - %w(. ..)).map do |name| Entry.new(@root, child_relative, name) end end |
#meta ⇒ Object
21 22 23 24 |
# File 'lib/sass-listen/record/entry.rb', line 21 def lstat = ::File.lstat(sys_path) { mtime: lstat.mtime.to_f, mode: lstat.mode } end |
#real_path ⇒ Object
39 40 41 |
# File 'lib/sass-listen/record/entry.rb', line 39 def real_path @real_path ||= ::File.realpath(sys_path) end |
#record_dir_key ⇒ Object
record hash is e.g. if @record[“project/app/models”] if @record[“project/app”] record_dir_key is “project/app/models”
30 31 32 |
# File 'lib/sass-listen/record/entry.rb', line 30 def record_dir_key ::File.join(*[@relative, @name].compact) end |
#sys_path ⇒ Object
34 35 36 37 |
# File 'lib/sass-listen/record/entry.rb', line 34 def sys_path # Use full path in case someone uses chdir ::File.join(*[@root, @relative, @name].compact) end |