Class: Ready::Readyfile::Executable

Inherits:
Object
  • Object
show all
Defined in:
lib/ready/readyfile/executable.rb

Overview

A single executable declared in a readyfile, mapping its name to the compiled path under the build directory.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, build_dir:, prefix: "ready_") ⇒ Executable

Returns a new instance of Executable.



7
8
9
10
11
12
13
# File 'lib/ready/readyfile/executable.rb', line 7

def initialize(name, build_dir:, prefix: "ready_")
  @name = name
  @prefix = prefix
  @build_dir = Pathname(build_dir)

  validate!
end

Instance Attribute Details

#build_dirObject (readonly)

Returns the value of attribute build_dir.



5
6
7
# File 'lib/ready/readyfile/executable.rb', line 5

def build_dir
  @build_dir
end

#nameObject (readonly)

Returns the value of attribute name.



5
6
7
# File 'lib/ready/readyfile/executable.rb', line 5

def name
  @name
end

#prefixObject (readonly)

Returns the value of attribute prefix.



5
6
7
# File 'lib/ready/readyfile/executable.rb', line 5

def prefix
  @prefix
end

Instance Method Details

#mappingObject



15
16
17
# File 'lib/ready/readyfile/executable.rb', line 15

def mapping
  { name => realpath }
end

#ready_nameObject



19
20
21
# File 'lib/ready/readyfile/executable.rb', line 19

def ready_name
  prefix + name
end

#realpathObject



23
24
25
# File 'lib/ready/readyfile/executable.rb', line 23

def realpath
  build_dir / ready_name
end