Class: Proj
Instance Method Summary collapse
- #[](pattern, refresh = false) ⇒ Object
-
#initialize(cwd = nil, cf = nil) ⇒ Proj
constructor
A new instance of Proj.
- #root_dir ⇒ Object
Constructor Details
Instance Method Details
#[](pattern, refresh = false) ⇒ Object
292 293 294 295 |
# File 'lib/shorthand.rb', line 292 def [](pattern,refresh=false) @cached_lookups.delete(pattern) if refresh return @cached_lookups[pattern] ||= root_dir[pattern] end |
#root_dir ⇒ Object
280 281 282 283 284 285 286 287 288 289 290 |
# File 'lib/shorthand.rb', line 280 def root_dir wd_root = root_dir_for(@p_cwd) return wd_root if @p_cf.blank? cf_root = root_dir_for(@p_cf) return @p_cwd if wd_root.blank? && cf_root.blank? return cf_root if wd_root.blank? return wd_root if cf_root.blank? return wd_root if wd_root === cf_root return wd_root if wd_root.relation_to(cf_root) == :parent return cf_root end |