This should meet the requirements that you described:
class HelloWorld
def self.main
puts "Hello World"
end
end
HelloWorld.main
However, it’s nearly all unnecessary; you can simply use a one-line program:
puts "Hello World"
More Related Contents:
- how to i add objects to an array ? ruby
- What do you call the &: operator in Ruby? [duplicate]
- Ruby: What does ‘require: false’ in Gemfile mean?
- What are the Ruby Gotchas a newbie should be warned about? [closed]
- The ‘json’ native gem requires installed build tools
- What is the -> (stab) operator in Ruby? [duplicate]
- Ruby 1.9 Array.to_s behaves differently?
- How do I parse a YAML file in Ruby?
- Safe ActiveRecord like query
- In Ruby, why does Array.new(size, object) create an array consisting of multiple references to the same object?
- Avoiding AppleScript through Ruby: rb-appscript or rubyosa?
- Sort an array according to the elements of another array
- How do I create a SHA1 hash in ruby?
- Haml: Append class if condition is true in Haml
- How to run all tests with minitest?
- to_s vs. to_str (and to_i/to_a/to_h vs. to_int/to_ary/to_hash) in Ruby
- How can I calculate the day of the week of a date in ruby?
- Match a string against multiple patterns
- troubles with RVM and OpenSSL
- Ruby gsub doesn’t escape single-quotes
- Set time zone offset in Ruby
- Print an XML document without the XML header line at the top
- What’s the precedence of ruby’s method call
- What is the difference between Raising Exceptions vs Throwing Exceptions in Ruby?
- List of installed gems?
- How can I find the number of days between two Date objects in Ruby?
- What are those pipe symbols for in Ruby?
- Ruby’s yield feature in relation to computer science
- Why isn’t current directory on my Ruby path? [duplicate]
- Iterate over Ruby Time object with delta