Class: Avm::Launcher::Paths::Logical

Inherits:
Object
  • Object
show all
Includes:
Comparable, EacRubyUtils::SimpleCache
Defined in:
lib/avm/launcher/paths/logical.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(context, parent_path, real, logical) ⇒ Logical

Returns a new instance of Logical.



23
24
25
26
27
28
# File 'lib/avm/launcher/paths/logical.rb', line 23

def initialize(context, parent_path, real, logical)
  @context = context
  @parent_path = parent_path
  @real = ::Avm::Launcher::Paths::Real.new(real)
  @logical = logical
end

Instance Attribute Details

#contextObject (readonly)

Returns the value of attribute context.



21
22
23
# File 'lib/avm/launcher/paths/logical.rb', line 21

def context
  @context
end

#logicalObject (readonly)

Returns the value of attribute logical.



21
22
23
# File 'lib/avm/launcher/paths/logical.rb', line 21

def logical
  @logical
end

#parent_pathObject (readonly)

Returns the value of attribute parent_path.



21
22
23
# File 'lib/avm/launcher/paths/logical.rb', line 21

def parent_path
  @parent_path
end

#realObject (readonly)

Returns the value of attribute real.



21
22
23
# File 'lib/avm/launcher/paths/logical.rb', line 21

def real
  @real
end

Class Method Details

.from_h(context, hash) ⇒ Object



15
16
17
18
# File 'lib/avm/launcher/paths/logical.rb', line 15

def from_h(context, hash)
  parent_path = hash[:parent_path] ? from_h(context, hash[:parent_path]) : nil
  new(context, parent_path, hash[:real], hash[:logical])
end

Instance Method Details

#<=>(other) ⇒ Object



30
31
32
# File 'lib/avm/launcher/paths/logical.rb', line 30

def <=>(other)
  [logical, real] <=> [other.logical, other.real]
end

#childrenObject



46
47
48
49
50
51
52
53
54
55
56
# File 'lib/avm/launcher/paths/logical.rb', line 46

def children
  r = []
  Dir.entries(warped).each do |c|
    c_path = ::File.join(warped, c)
    next unless ::File.directory?(c_path)
    next if c.start_with?('.')

    r << build_child(c)
  end
  r
end

#included?Boolean

Returns:

  • (Boolean)


58
59
60
# File 'lib/avm/launcher/paths/logical.rb', line 58

def included?
  !context.settings.excluded_paths.include?(logical)
end

#project?Boolean

Returns:

  • (Boolean)


42
43
44
# File 'lib/avm/launcher/paths/logical.rb', line 42

def project?
  stereotypes.any?
end

#to_hObject



38
39
40
# File 'lib/avm/launcher/paths/logical.rb', line 38

def to_h
  { logical: logical, real: real.to_s, parent_path: parent_path ? parent_path.to_h : nil }
end

#to_sObject



34
35
36
# File 'lib/avm/launcher/paths/logical.rb', line 34

def to_s
  logical
end