Class: SuriLang::Greeter
- Inherits:
-
Object
- Object
- SuriLang::Greeter
- Defined in:
- lib/suri_lang/greeter.rb
Instance Attribute Summary collapse
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#season ⇒ Object
readonly
Returns the value of attribute season.
-
#source ⇒ Object
readonly
Returns the value of attribute source.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(message, source, season) ⇒ Greeter
constructor
A new instance of Greeter.
Constructor Details
#initialize(message, source, season) ⇒ Greeter
Returns a new instance of Greeter.
9 10 11 12 13 |
# File 'lib/suri_lang/greeter.rb', line 9 def initialize(, source, season) @message = @source = source @season = season end |
Instance Attribute Details
#message ⇒ Object (readonly)
Returns the value of attribute message.
5 6 7 |
# File 'lib/suri_lang/greeter.rb', line 5 def @message end |
#season ⇒ Object (readonly)
Returns the value of attribute season.
7 8 9 |
# File 'lib/suri_lang/greeter.rb', line 7 def season @season end |
#source ⇒ Object (readonly)
Returns the value of attribute source.
6 7 8 |
# File 'lib/suri_lang/greeter.rb', line 6 def source @source end |
Class Method Details
.greet ⇒ Object
20 21 22 |
# File 'lib/suri_lang/greeter.rb', line 20 def self.greet self.greeting_list.sample['message'] end |
.greeting_list ⇒ Object
24 25 26 |
# File 'lib/suri_lang/greeter.rb', line 24 def self.greeting_list YAML.load_file(File.("../greeter/greetings.yml", __FILE__)) end |
.random_build ⇒ Object
15 16 17 18 |
# File 'lib/suri_lang/greeter.rb', line 15 def self.random_build greeting = self.greeting_list.sample self.new(greeting['message'], greeting['source'], greeting['season']) end |