Class: Faussaire::Tv
- Inherits:
-
Object
- Object
- Faussaire::Tv
- Defined in:
- lib/faussaire/tv.rb
Defined Under Namespace
Modules: FestivalCannes
Constant Summary collapse
- DATA_PATH =
File.('../../../locale/fr.yml', __FILE__)
Class Method Summary collapse
-
.channel ⇒ String
Produces a random TV channel name.
-
.famous_couples ⇒ String
Produces a random famous couple from television.
- .festival_cannes ⇒ Object
-
.fetch(key) ⇒ Object?
Fetches and samples data from the YAML file based on the provided key.
-
.influencer ⇒ String
Produces a random famous influencer’s name.
-
.netflix ⇒ String
Produces a random Netflix program.
-
.show ⇒ String
Produces a random television show title.
Class Method Details
.channel ⇒ String
Produces a random TV channel name.
169 170 171 |
# File 'lib/faussaire/tv.rb', line 169 def self.channel fetch('fr.faussaire.tv.channel') end |
.famous_couples ⇒ String
Produces a random famous couple from television.
157 158 159 |
# File 'lib/faussaire/tv.rb', line 157 def self.famous_couples fetch('fr.faussaire.tv.famous_couples') end |
.festival_cannes ⇒ Object
121 122 123 |
# File 'lib/faussaire/tv.rb', line 121 def self.festival_cannes FestivalCannes end |
.fetch(key) ⇒ Object?
Fetches and samples data from the YAML file based on the provided key. If the data is an array, it samples a single item.
115 116 117 118 119 |
# File 'lib/faussaire/tv.rb', line 115 def self.fetch(key) data = YAML.load_file(DATA_PATH) result = data.dig(*key.split('.')) result.is_a?(Array) ? result.sample : result end |
.influencer ⇒ String
Produces a random famous influencer’s name.
145 146 147 |
# File 'lib/faussaire/tv.rb', line 145 def self.influencer fetch('fr.faussaire.tv.influencer') end |
.netflix ⇒ String
Produces a random Netflix program.
181 182 183 |
# File 'lib/faussaire/tv.rb', line 181 def self.netflix fetch('fr.faussaire.tv.netflix') end |
.show ⇒ String
Produces a random television show title.
133 134 135 |
# File 'lib/faussaire/tv.rb', line 133 def self.show fetch('fr.faussaire.tv.show') end |