Class: Dapp::Dimg::Config::Directive::Mount

Inherits:
Base show all
Defined in:
lib/dapp/dimg/config/directive/mount.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#clone_to_artifact

Methods inherited from Config::Directive::Base

#clone

Constructor Details

#initialize(to, **kwargs, &blk) ⇒ Mount

Returns a new instance of Mount.

Raises:



10
11
12
13
14
15
# File 'lib/dapp/dimg/config/directive/mount.rb', line 10

def initialize(to, **kwargs, &blk)
  raise Error::Config, code: :mount_to_absolute_path_required unless Pathname((to = to.to_s)).absolute?
  @_to = path_format(to)

  super(**kwargs, &blk)
end

Instance Attribute Details

#_fromObject (readonly)

Returns the value of attribute _from.



7
8
9
# File 'lib/dapp/dimg/config/directive/mount.rb', line 7

def _from
  @_from
end

#_toObject (readonly)

Returns the value of attribute _to.



6
7
8
# File 'lib/dapp/dimg/config/directive/mount.rb', line 6

def _to
  @_to
end

#_typeObject (readonly)

Returns the value of attribute _type.



8
9
10
# File 'lib/dapp/dimg/config/directive/mount.rb', line 8

def _type
  @_type
end

Instance Method Details

#from(type) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/dapp/dimg/config/directive/mount.rb', line 17

def from(type)
  sub_directive_eval do
    type = type.to_sym
    raise Error::Config, code: :mount_from_type_required unless [:tmp_dir, :build_dir].include? type
    @_type = type
  end
end

#from_path(path) ⇒ Object



25
26
27
28
29
30
# File 'lib/dapp/dimg/config/directive/mount.rb', line 25

def from_path(path)
  sub_directive_eval do
    @_from = path_format(path)
    @_type = :custom_dir
  end
end

#validate!Object

Raises:



32
33
34
# File 'lib/dapp/dimg/config/directive/mount.rb', line 32

def validate!
  raise Error::Config, code: :mount_from_or_from_path_required if _type.nil?
end