Sha256: 8045b32db51d059037e47576b0eadbdb13a1398a11252d51efcae5182ef29aef
Contents?: true
Size: 1.01 KB
Versions: 37
Compression:
Stored size: 1.01 KB
Contents
# frozen_string_literal: true require 'eac_ruby_utils/core_ext' module EhbrsRubyUtils module Music module Ous class Node DEFAULT_LANGUAGE = 'unk' LANGUAGE_FILE_BASENAME = '.language' enable_simple_cache common_constructor :path do self.path = path.to_pathname.expand_path end def name real_path.basename.to_s end def language self_language || parent_language || DEFAULT_LANGUAGE end def language_file path.join(LANGUAGE_FILE_BASENAME) end def parent_language parent_node.if_present(&:language) end def real_path path.readlink_r end def self_language language_file.if_exist('', &:read).strip.presence end def to_s name end private def parent_node_uncached parent_node_class.if_present { |v| v.new(real_path.parent) } end end end end end
Version data entries
37 entries across 37 versions & 1 rubygems