Class: Tudu::Dsl

Inherits:
Object
  • Object
show all
Defined in:
lib/tudu_dsl.rb

Overview

Tudu::Dsl

Constant Summary collapse

TARGET_TYPES =

TARGET_TYPES

notice target types

types

  • none: no notice

  • mail: mail notice

{ none: :none, mail: :mail }

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeDsl

initialize Dsl



19
20
21
22
# File 'lib/tudu_dsl.rb', line 19

def initialize
  @_target_type = TARGET_TYPES[:none]
  @_targets = []
end

Instance Attribute Details

#_target_typeObject

notice target type



14
15
16
# File 'lib/tudu_dsl.rb', line 14

def _target_type
  @_target_type
end

#_targetsObject

notice targets



16
17
18
# File 'lib/tudu_dsl.rb', line 16

def _targets
  @_targets
end

Instance Method Details

#target_type(target_type) ⇒ Object

initialize Dsl

Params

  • target_type: target notice type



27
28
29
30
31
32
33
# File 'lib/tudu_dsl.rb', line 27

def target_type(target_type)
  return if target_type.nil?
  return unless [String, Symbol].include?(target_type.class)
  target_type = target_type.to_sym if target_type.instance_of? String
  return unless TARGET_TYPES.include? target_type
  @_target_type = target_type
end

#targets(target_type) ⇒ Object



35
36
37
38
39
# File 'lib/tudu_dsl.rb', line 35

def targets(target_type)
  return if target_type.nil?
  return unless target_type.instance_of? Array
  @_targets = target_type
end