This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| puts "Getting the Exception 1" | |
| begin | |
| eval("1+") | |
| rescue Exception => e | |
| puts "Exception Class => #{e.class} - Message: #{e}" | |
| end | |
| puts "Getting the Exception 2" | |
| begin | |
| eval("1+") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Model | |
| def method(&block) | |
| puts "START" | |
| block.call | |
| puts "END" | |
| end | |
| def second(&block) | |
| puts "SECOND - START" | |
| method(&block) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $VAR1=BlaBlaBla | |
| $VAR1=PqPqPqPq | |
| function export_ambient_variable_for() { | |
| if [[ $1 = 'prod' ]]; then | |
| echo 'Exporting ambient variables for Prod environment' | |
| export ZZZZ=$VAR1 | |
| else | |
| echo 'Exporting ambient variables for Dev environment' | |
| export ZZZZ=$VAR2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module XptoModule | |
| class << self | |
| attr_accessor :classes_with_xpto_module | |
| end | |
| self.classes_with_xpto_module = [] | |
| def self.included(base) | |
| self.classes_with_xpto_module << base | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def initialize(opts) | |
| opts.each do |opt,val| | |
| instance_variable_set("@#{opt}", val.to_s) if respond_to? opt | |
| end | |
| end |
NewerOlder