Class: Async::Cron::Schedule::Flags

Inherits:
Object
  • Object
show all
Defined in:
lib/async/cron/schedule/flags.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(drop: true) ⇒ Flags

Returns a new instance of Flags.



27
28
29
# File 'lib/async/cron/schedule/flags.rb', line 27

def initialize(drop: true)
	@drop = drop
end

Class Method Details

.parse(string) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/async/cron/schedule/flags.rb', line 10

def self.parse(string)
	options = {}
	
	string&.each_char do |character|
		case character
		when 'D'
			options[:drop] = true
		when 'd'
			options[:drop] = false
		else
			raise ArgumentError, "Invalid flag: #{character}"
		end
	end
	
	self.new(**options)
end

Instance Method Details

#drop?Boolean

Returns:

  • (Boolean)


31
32
33
# File 'lib/async/cron/schedule/flags.rb', line 31

def drop?
	@drop
end