Module: AIPP::SHOOT::Executable

Defined in:
lib/aipp/scopes/shoot/executable.rb

Instance Method Summary collapse

Instance Method Details

#guardObject



23
24
25
26
# File 'lib/aipp/scopes/shoot/executable.rb', line 23

def guard
  AIPP.options.time_zone = AIPP.options.local_effective_at.at_noon.strftime('%z')
  AIPP.options.effective_at = AIPP.options.local_effective_at.at_midnight.utc
end

#option_parser(o) ⇒ Object



14
15
16
17
18
19
20
21
# File 'lib/aipp/scopes/shoot/executable.rb', line 14

def option_parser(o)
  o.banner = <<~END
    Download online shooting activities and convert them to #{AIPP.options.schema.upcase}.
    Usage: #{File.basename($0)} shoot [options]
  END
  o.on('-t', '--effective (DATE)', String, %Q[effective on this date (default: "#{AIPP.options.local_effective_at.to_date}")]) { AIPP.options.local_effective_at = Time.parse("#{_1} CET") }
  o.on('-i', '--id ID', String, %Q[process shooting ground with this ID only]) { AIPP.options.id = _1 }
end

#optionsObject



6
7
8
9
10
11
12
# File 'lib/aipp/scopes/shoot/executable.rb', line 6

def options
  AIPP.options.merge(
    module: 'Shoot',
    local_effective_at: Time.now.at_midnight,
    id: nil
  )
end