Module: EDI::DSL::ClassMethods

Defined in:
lib/edi/dsl.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#interpreter_phrasesObject

Returns the value of attribute interpreter_phrases.



5
6
7
# File 'lib/edi/dsl.rb', line 5

def interpreter_phrases
  @interpreter_phrases
end

#invokerObject

Returns the value of attribute invoker.



5
6
7
# File 'lib/edi/dsl.rb', line 5

def invoker
  @invoker
end

#patternObject

Returns the value of attribute pattern.



5
6
7
# File 'lib/edi/dsl.rb', line 5

def pattern
  @pattern
end

#required_environment_variablesObject

Returns the value of attribute required_environment_variables.



5
6
7
# File 'lib/edi/dsl.rb', line 5

def required_environment_variables
  @required_environment_variables
end

Instance Method Details

#interpreter_pattern(pattern) ⇒ Object



11
12
13
# File 'lib/edi/dsl.rb', line 11

def interpreter_pattern(pattern)
  @pattern = pattern
end

#invoke_with(method_name) ⇒ Object

class MyService < EDI::Service

invoke_with :post_tweet

end



23
24
25
26
27
28
29
30
# File 'lib/edi/dsl.rb', line 23

def invoke_with(method_name)
  send :define_method, :invoke do
    run_hook :before_invoke
    @response = send method_name
    run_hook :after_invoke
    @response
  end
end

#phrases(*args) ⇒ Object



6
7
8
9
# File 'lib/edi/dsl.rb', line 6

def phrases(*args)
  @interpreter_phrases = args
  reset_interpreter_pattern
end