Class: Rubipara::Episode
- Inherits:
-
Object
- Object
- Rubipara::Episode
- Defined in:
- lib/rubipara/episode.rb
Defined Under Namespace
Classes: NotFoundError
Constant Summary collapse
- @@config =
YAML.load_file("#{File.dirname(__FILE__)}/../../config/episode.yml")
Instance Attribute Summary collapse
-
#episode_num ⇒ Object
readonly
Returns the value of attribute episode_num.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Class Method Summary collapse
-
.all ⇒ Object
return an array of episode objects of all episodes.
Instance Method Summary collapse
-
#initialize(episode_num) ⇒ Episode
constructor
A new instance of Episode.
Constructor Details
#initialize(episode_num) ⇒ Episode
Returns a new instance of Episode.
18 19 20 21 22 |
# File 'lib/rubipara/episode.rb', line 18 def initialize(episode_num) @episode_num = episode_num.to_i raise NotFoundError.new('ERROR: No such an episode') unless @@config.has_key?(@episode_num) @title = @@config[@episode_num]['title'] end |
Instance Attribute Details
#episode_num ⇒ Object (readonly)
Returns the value of attribute episode_num.
5 6 7 |
# File 'lib/rubipara/episode.rb', line 5 def episode_num @episode_num end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
5 6 7 |
# File 'lib/rubipara/episode.rb', line 5 def title @title end |