Class: JenkinsCron::Job::Timer::Field
- Inherits:
-
Object
- Object
- JenkinsCron::Job::Timer::Field
- Defined in:
- lib/jenkins_cron/job/timer.rb
Instance Method Summary collapse
-
#initialize(*args) ⇒ Field
constructor
A new instance of Field.
- #to_s ⇒ Object
Constructor Details
#initialize(*args) ⇒ Field
Returns a new instance of Field.
146 147 148 149 150 151 152 153 154 155 156 157 158 |
# File 'lib/jenkins_cron/job/timer.rb', line 146 def initialize(*args) @opts = args.last.is_a?(Hash) ? args.pop : {} @every = @opts[:every] if @opts.has_key? :every case args.length when 0 @value = (@every.nil? or @every == 1) ? "*" : "H" when 1 @value = args[0] == :once ? "H" : args[0] else @value = args end end |
Instance Method Details
#to_s ⇒ Object
160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 |
# File 'lib/jenkins_cron/job/timer.rb', line 160 def to_s unless @string @string = case @value when Range "H(#{@value.first}-#{@value.last})" when Array @value.join(",") when Fixnum @value.to_s when "H","*" @value end @string += "/#{@every}" if (!@every.nil? and @every != 1) end @string end |