Class: Astromapper::Builder::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/astromapper/builder.rb

Direct Known Subclasses

Moon, Orbit, Sector, Star, Volume

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(root_dir) ⇒ Base

Returns a new instance of Base.



16
17
18
# File 'lib/astromapper/builder.rb', line 16

def initialize(root_dir)
  @root_dir = Pathname.new(root_dir)
end

Instance Attribute Details

#root_dirObject

Returns the value of attribute root_dir.



11
12
13
# File 'lib/astromapper/builder.rb', line 11

def root_dir
  @root_dir
end

Class Method Details

.constitute(root_dir) ⇒ Object



13
14
15
# File 'lib/astromapper/builder.rb', line 13

def self.constitute(root_dir)
  new(root_dir).constitute
end

Instance Method Details

#configObject



20
21
22
# File 'lib/astromapper/builder.rb', line 20

def config
  Astromapper.config(root_dir)
end

#namesObject

(@@dice.roll(a) - b).whole



27
28
29
# File 'lib/astromapper/builder.rb', line 27

def names
  Astromapper.names
end

#spawn_command(cmd) ⇒ Object



31
32
33
34
35
36
37
38
39
40
# File 'lib/astromapper/builder.rb', line 31

def spawn_command(cmd)
  begin
    stdout_and_stderr, status = Open3.capture2e(*cmd)
  rescue Errno::ENOENT => e
    puts e.message
  else
    puts stdout_and_stderr unless status.success?
    status.success?
  end
end

#toss(a = 2, b = 2) ⇒ Object



23
24
25
26
# File 'lib/astromapper/builder.rb', line 23

def toss(a=2,b=2)
  (a.d6 - b).whole
  # (@@dice.roll(a) - b).whole
end