Add attribute Diversipub::Main#pwd
This commit is contained in:
parent
fa9e28fd66
commit
6d26cc6e39
3 changed files with 16 additions and 2 deletions
|
@ -59,6 +59,7 @@ $stdout.sync = true
|
|||
$stderr.sync = true
|
||||
|
||||
main = Diversipub::Main.new(
|
||||
pwd: Pathname.pwd,
|
||||
program_name: $PROGRAM_NAME,
|
||||
argv: ARGV,
|
||||
env: ENV,
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
####################
|
||||
|
||||
require 'logger'
|
||||
require 'pathname'
|
||||
|
||||
########
|
||||
# Gems #
|
||||
|
|
|
@ -5,9 +5,16 @@ module Diversipub
|
|||
# The whole application runner.
|
||||
#
|
||||
class Main
|
||||
attr_reader :program_name, :argv, :env, :stdin, :stdout, :stderr
|
||||
attr_reader :pwd, :program_name, :argv, :env, :stdin, :stdout, :stderr
|
||||
|
||||
def initialize(program_name:, argv:, env:, stdin:, stdout:, stderr:)
|
||||
def initialize(pwd:,
|
||||
program_name:,
|
||||
argv:,
|
||||
env:,
|
||||
stdin:,
|
||||
stdout:,
|
||||
stderr:)
|
||||
self.pwd = pwd
|
||||
self.program_name = program_name
|
||||
self.argv = argv
|
||||
self.env = env
|
||||
|
@ -18,6 +25,7 @@ module Diversipub
|
|||
end
|
||||
|
||||
def run
|
||||
p pwd
|
||||
p program_name
|
||||
p argv
|
||||
p env
|
||||
|
@ -40,6 +48,10 @@ module Diversipub
|
|||
|
||||
attr_writer :stdin, :stdout, :stderr
|
||||
|
||||
def pwd=(pwd)
|
||||
@pwd = Pathname.new(pwd).freeze
|
||||
end
|
||||
|
||||
def program_name=(program_name)
|
||||
@program_name = String(program_name).freeze
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue