Class: NCATTED_ADD_GLOBAL_ATTRIBUTES_cmd

Inherits:
InplaceCommand show all
Includes:
NCO_warning_filter
Defined in:
lib/file_command.rb

Instance Method Summary collapse

Methods included from NCO_warning_filter

#command_success?

Methods inherited from InplaceCommand

#cmd_txt, #inplace?

Methods inherited from FileCommand

#run

Constructor Details

#initialize(attributes_hash) ⇒ NCATTED_ADD_GLOBAL_ATTRIBUTES_cmd

Returns a new instance of NCATTED_ADD_GLOBAL_ATTRIBUTES_cmd.



197
198
199
# File 'lib/file_command.rb', line 197

def initialize(attributes_hash)
  @attributes = attributes_hash
end

Instance Method Details

#cmd_txt_inplace(file) ⇒ Object



201
202
203
204
205
206
207
208
209
210
211
212
213
# File 'lib/file_command.rb', line 201

def cmd_txt_inplace(file)
  att_args = ""
  @attributes.each do |att_name, att_txt|
    if att_txt.is_a? Integer
      att_args += %Q( -a #{att_name},global,o,l,#{att_txt})
    elsif att_txt.is_a? Float
      att_args += %Q( -a #{att_name},global,o,d,#{att_txt})
    else
      att_args += %Q( -a #{att_name},global,o,c,"#{att_txt}")
    end
  end
  %Q(#{SYSTEM_COMMANDS::NCATTED} --create_ram -h#{att_args} #{file})
end