Class: Mxrb::Dsl::ScheduledEventBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/mxrb/dsl/builder.rb

Constant Summary collapse

INTERVAL_UNITS =
{
  milliseconds: "Millisecond", seconds: "Second", minutes: "Minute",
  hours: "Hour", days: "Day", weeks: "Week", months: "Month", years: "Year"
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, microflow:, interval: 1, unit: :days, enabled: true) ⇒ ScheduledEventBuilder

Returns a new instance of ScheduledEventBuilder.



801
802
803
804
805
806
807
808
# File 'lib/mxrb/dsl/builder.rb', line 801

def initialize(name, microflow:, interval: 1, unit: :days, enabled: true)
  @name      = name.to_s
  @microflow = microflow.to_s
  @interval  = interval.to_i
  @unit      = unit.to_sym
  @enabled   = enabled
  @doc       = ""
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



799
800
801
# File 'lib/mxrb/dsl/builder.rb', line 799

def name
  @name
end

Instance Method Details

#documentation(d) ⇒ Object



810
# File 'lib/mxrb/dsl/builder.rb', line 810

def documentation(d) = (@doc = d)

#to_hObject



812
813
814
815
816
817
# File 'lib/mxrb/dsl/builder.rb', line 812

def to_h
  {
    name: @name, microflow: @microflow, interval: @interval,
    unit: @unit, enabled: @enabled, documentation: @doc
  }
end