Created
March 5, 2021 04:03
-
-
Save mokagio/622e029f95e7dbb3d9cc31c6aa096a73 to your computer and use it in GitHub Desktop.
Fastlane, Ruby, constants, and functions
This file contains 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
# | |
# Proper version | |
# | |
WRAP_EMOJI = "🌯" | |
lane :test do |options| | |
UI.message wrap_in_emoji("Hello, World!") | |
end | |
def wrap_in_emoji(string) | |
"#{WRAP_EMOJI} #{string} #{WRAP_EMOJI}" | |
end | |
# | |
# Version that doesn't work because of variables vs constants in the scope of a | |
# function | |
# | |
# wrap_emoji = "🌯" | |
# | |
# lane :test do |options| | |
# UI.message wrap_in_emoji("Hello, World!") | |
# end | |
# | |
# def wrap_in_emoji(string) | |
# "#{wrap_emoji} #{string} #{wrap_emoji}" | |
# end | |
# | |
# Version that works because of instance variables, but that's not appropriate | |
# in this case because the value is not an instance variable | |
# | |
# @wrap_emoji = "🌯" | |
# | |
# lane :test do |options| | |
# UI.message wrap_in_emoji("Hello, World!") | |
# end | |
# | |
# def wrap_in_emoji(string) | |
# "#{@wrap_emoji} #{string} #{@wrap_emoji}" | |
# end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment