Sha256: b4f798d290ffe9340d1783ab63942b3bcc405e73ff6aa8a284408998d1147b15
Contents?: true
Size: 1.05 KB
Versions: 3
Compression:
Stored size: 1.05 KB
Contents
require 'thor' class CfSim::CLI < Thor desc 'max_area DATA_FILE', 'print max area control fields URL.' def max_area(data_file) finder = load_finder_from(data_file) fields = finder.find_max_area_fields puts @generator.fields_link(fields) end desc 'max_count DATA_FILE LIMIT', 'print max count control fields URL list.' def max_count(data_file, limit = nil) finder = load_finder_from(data_file, limit ? limit.to_i : nil) fields_list = finder.find_max_count_fields_list max_area = fields_list.first.total_area fields_list.each do |fields| area_rate = (fields.total_area * 100 / max_area).round(3) puts "#{@generator.fields_link(fields)} (Area rate: #{area_rate})" end end private def load_finder_from(data_file, limit) portals = CfSim::DataFileParser.new(data_file).parse portal_map = CfSim::PortalMap.new(portals) @generator = CfSim::IntelMapUrlGenerator.new(portal_map) CfSim::ControlFieldSetFinder.new(CfSim::PointList.new(portal_map.points).creatable_fields, limit_field_count: limit) end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
cf_sim-1.1.2 | lib/cf_sim/cli.rb |
cf_sim-1.1.1 | lib/cf_sim/cli.rb |
cf_sim-1.1.0 | lib/cf_sim/cli.rb |