Class: Megam::BirrOptions

Inherits:
Object
  • Object
show all
Defined in:
lib/megam/birr_options.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(&block) ⇒ BirrOptions

Returns a new instance of BirrOptions.



27
28
29
30
31
32
33
34
35
36
37
# File 'lib/megam/birr_options.rb', line 27

def initialize(&block)
  # defaults
  @tarball         = nil
  @sudo            = false
  @directory       = []
  @command         = []
  @commands        = []
  @start_time      = Time.now
  instance_eval(&block)

end

Instance Attribute Details

#commandsObject (readonly)

Returns the value of attribute commands.



25
26
27
# File 'lib/megam/birr_options.rb', line 25

def commands
  @commands
end

#sudoObject (readonly)

Returns the value of attribute sudo.



25
26
27
# File 'lib/megam/birr_options.rb', line 25

def sudo
  @sudo
end

Class Method Details

.setter(*method_names) ⇒ Object



7
8
9
10
11
12
13
# File 'lib/megam/birr_options.rb', line 7

def self.setter(*method_names)
  method_names.each do |name|
    send :define_method, name do |data|
      instance_variable_set "@#{name}".to_sym, data
    end
  end
end

.varargs_setter(*method_names) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/megam/birr_options.rb', line 15

def self.varargs_setter(*method_names)
  method_names.each do |name|
    send :define_method, name do |*data|
      instance_variable_set "@#{name}".to_sym, data
    end
  end
end

Instance Method Details

#sudo?Boolean

Returns:

  • (Boolean)


43
44
45
# File 'lib/megam/birr_options.rb', line 43

def sudo?
  @sudo
end

#tarball_fileObject



47
48
49
# File 'lib/megam/birr_options.rb', line 47

def tarball_file
  @tarball_file ||= @tarball
end

#to_sObject



51
52
53
54
55
56
57
# File 'lib/megam/birr_options.rb', line 51

def to_s
  tmps = ""
  tmps << "sudo :" + @sudo.to_s + "\n"
  tmps << "dir  :" + @directory.to_s + "\n"
  tmps << "cmd  :" + commands.to_s + "\n"
  tmps << "strt :" + @start_time.to_s
end