Module: Stingray::Exec::DSL
- Defined in:
- lib/stingray/exec/dsl.rb
Instance Method Summary collapse
-
#foreach(anything, &block) ⇒ Object
A little helper that allows for iteration over SOAP results that may be singular or plural (or just plain missing.) A block must always be given.
-
#ssl_verify_mode(mode = nil) ⇒ Object
Set the SSL verification mode for all SOAP communication.
- #stingray_exec(string = '', filename = '', lineno = 0, &block) ⇒ Object
Instance Method Details
#foreach(anything, &block) ⇒ Object
A little helper that allows for iteration over SOAP results that may be singular or plural (or just plain missing.) A block must always be given.
44 45 46 47 |
# File 'lib/stingray/exec/dsl.rb', line 44 def foreach(anything, &block) raise SyntaxError.new('Block needed!') unless block_given? [*(anything || [])].each(&block) end |
#ssl_verify_mode(mode = nil) ⇒ Object
Set the SSL verification mode for all SOAP communication. Valid values are really up to the HTTP backend, but some known good ones are “:none” and “:peer”. Setting the STINGRAY_SSL_VERIFY_NONE environmental variable will result in this method defaulting to “:none”. Once a configuration model has been initialized, its verify mode cannot be modified through this function. Instead, set the model’s deeply-nested attribute of ‘.client.http.auth.ssl.verify_mode`.
35 36 37 38 39 40 |
# File 'lib/stingray/exec/dsl.rb', line 35 def ssl_verify_mode(mode = nil) unless mode.nil? @ssl_verify_mode = mode end @ssl_verify_mode || ENV['STINGRAY_SSL_VERIFY_NONE'] ? :none : :peer end |
#stingray_exec(string = '', filename = '', lineno = 0, &block) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/stingray/exec/dsl.rb', line 5 def stingray_exec(string = '', filename = '', lineno = 0, &block) unless string.empty? instance_eval(string, filename, lineno) else instance_eval(&block) end end |