class Crysna::OptionManager
Constants
- ALL_OPTIONS
- DEFAULT_CELLS_FILE
- DEFAULT_FITTED_STRUCTURE_FILE
- DEFAULT_MODEL_FILE
- DEFAULT_OCCUPIED_SITES_FILE
- DEFAULT_SITE_CANDIDATE_FILE
- DEFAULT_SITE_COMBINATION_FILE
- DEFAULT_SITE_MIGRATION_FILE
- DEFAULT_SITE_OPERATION_FILE
- DEFAULT_SITE_SINGLE_FILE
- DEFAULT_SITE_UNIQUE_FILE
- DEFAULT_SYM_ID_SITE_FILE
- DEFAULT_SYM_OPERATION_FILE
Attributes
options[R]
parser[RW]
Public Class Methods
new(activates = ALL_OPTIONS)
click to toggle source
activates にセットしたものしか有効にしない。
# File lib/crysna/optionmanager.rb, line 40 def initialize(activates = ALL_OPTIONS) @parser = OptionParser.new @options = {} activates.each do |option| unless ALL_OPTIONS.include? option raise INVARID_OPTION, option.to_s end end activates.each do |opt| case opt when :cells ; set_cells when :fitted ; set_fitted when :occupied ; set_occupied when :model ; set_model when :symid ; set_symid when :migration ; set_migration when :operation ; set_operation when :symmetry ; set_symmetry when :single ; set_single when :unique ; set_unique when :quiet ; set_quiet when :combination ; set_combination when :candidate ; set_candidate else end end end
Public Instance Methods
parse!(ary)
click to toggle source
# File lib/crysna/optionmanager.rb, line 173 def parse!(ary) @parser.parse!(ary) end
set_candidate()
click to toggle source
# File lib/crysna/optionmanager.rb, line 159 def set_candidate @options[:candidate] = DEFAULT_SITE_CANDIDATE_FILE @parser.on("-d file", "--candidate=file", "Indicate site_candidate file. #{DEFAULT_SITE_CANDIDATE_FILE} as default" ){|str| @options[:candidate] = str} end
set_cells()
click to toggle source
# File lib/crysna/optionmanager.rb, line 71 def set_cells @options[:cells] = DEFAULT_CELLS_FILE @parser.on("-c file", "--cells=file", "Indicate cells file. #{DEFAULT_CELLS_FILE} as default" ){|str| @options[:cells] = str} end
set_combination()
click to toggle source
# File lib/crysna/optionmanager.rb, line 151 def set_combination @options[:combination] = DEFAULT_SITE_COMBINATION_FILE @parser.on("-b file", "--combination=file", "Indicate site_combination file. #{DEFAULT_SITE_COMBINATION_FILE} as default" ){|str| @options[:combination] = str} end
set_fitted()
click to toggle source
# File lib/crysna/optionmanager.rb, line 79 def set_fitted @options[:fitted] = DEFAULT_FITTED_STRUCTURE_FILE @parser.on("-f file", "--fitted=file", "Indicate fitted_structure file. #{DEFAULT_FITTED_STRUCTURE_FILE} as default" ){|str| @options[:fitted] = str} end
set_migration()
click to toggle source
# File lib/crysna/optionmanager.rb, line 111 def set_migration @options[:migration] = DEFAULT_SITE_MIGRATION_FILE @parser.on("-M file", "--sitemigration=file", "Indicate site_migration file. #{DEFAULT_SITE_MIGRATION_FILE} as default" ){|str| @options[:migration] = str} end
set_model()
click to toggle source
# File lib/crysna/optionmanager.rb, line 95 def set_model @options[:model] = DEFAULT_MODEL_FILE @parser.on("-m file", "--model=file", "Indicate model_structure file. Default: #{DEFAULT_MODEL_FILE}" ){|str| @options[:model] = str} end
set_occupied()
click to toggle source
# File lib/crysna/optionmanager.rb, line 87 def set_occupied @options[:occupied] = DEFAULT_OCCUPIED_SITES_FILE @parser.on("-p file", "--occupied=file", "Indicate occupied_site file. Default: #{DEFAULT_OCCUPIED_SITES_FILE}" ){|str| @options[:occupied] = str} end
set_operation()
click to toggle source
# File lib/crysna/optionmanager.rb, line 119 def set_operation @options[:operation] = DEFAULT_SITE_OPERATION_FILE @parser.on("-o file", "--siteoperation=file", "Indicate site_operation file. #{DEFAULT_SITE_OPERATION_FILE} as default" ){|str| @options[:operation] = str} end
set_quiet()
click to toggle source
# File lib/crysna/optionmanager.rb, line 167 def set_quiet @options[:quiet] = false @parser.on("-q" , "--quite" , "Supress standard output."){ @options[:quiet] = true} end
set_single()
click to toggle source
# File lib/crysna/optionmanager.rb, line 135 def set_single @options[:single] = DEFAULT_SITE_SINGLE_FILE @parser.on("-s file", "--single=file", "Indicate site_single file. #{DEFAULT_SITE_SINGLE_FILE} as default" ){|str| @options[:single] = str} end
set_symid()
click to toggle source
# File lib/crysna/optionmanager.rb, line 103 def set_symid @options[:symid] = DEFAULT_SYM_ID_SITE_FILE @parser.on("-i file", "--symmetric-id=file", "Indicate symmetric_identification file. Default: #{DEFAULT_SYM_ID_SITE_FILE}" ){|str| @options[:symid] = str} end
set_symmetry()
click to toggle source
# File lib/crysna/optionmanager.rb, line 127 def set_symmetry @options[:symmetry] = DEFAULT_SYM_OPERATION_FILE @parser.on("-y file", "--symmetry=file", "Indicate symmetry_operation file. #{DEFAULT_SYM_OPERATION_FILE} as default" ){|str| @options[:symmetry] = str} end
set_unique()
click to toggle source
# File lib/crysna/optionmanager.rb, line 143 def set_unique @options[:unique] = DEFAULT_SITE_UNIQUE_FILE @parser.on("-u file", "--unique=file", "Indicate site_unique file. #{DEFAULT_SITE_UNIQUE_FILE} as default" ){|str| @options[:unique] = str} end