Skip to content

Instantly share code, notes, and snippets.

@EDDYMENS
Last active October 24, 2017 13:37
Show Gist options
  • Save EDDYMENS/e4564071f84752ec3f2061887a71418f to your computer and use it in GitHub Desktop.
Save EDDYMENS/e4564071f84752ec3f2061887a71418f to your computer and use it in GitHub Desktop.
Experimenting with DSLs in Ruby . This time trying to get closer to English as possible
String.new("edmond"). convert_to_upper_case. then. reverse_the_string. lastly. display_to_screen
class String
def initialize(string)
@@string = string
end
def convert_to_upper_case()
@@string = @@string.upcase()
self
end
def convert_to_lower_case()
@@string = @@string.downcase()
self
end
def reverse_the_string()
@@string = @@string.reverse()
self
end
def display_to_screen()
puts @@string
self
end
def then()
self
end
def lastly()
self
end
def also()
self
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment