Class: Rubicure::Core
- Inherits:
-
Object
- Object
- Rubicure::Core
- Includes:
- Enumerable, Rubicure::Concerns::Util, Singleton
- Defined in:
- lib/rubicure/core.rb
Overview
generic methods
Instance Method Summary collapse
-
#all_girls(arg = Time.current) ⇒ Array<Rubicure::Girl>
(also: #all, #all_members)
Get all precures.
-
#all_stars(arg = Time.current) ⇒ Array<Rubicure::Girl>
Get precure all stars.
-
#dream_stars ⇒ Array<Rubicure::Girl>
Get precure dream stars.
-
#each_with_series {|series| ... } ⇒ Array<Symbol>
(also: #each)
iterate with :unmarked, :max_heart, …
- #method_missing(name, *args) ⇒ Object
-
#miracle_leap ⇒ Array<Rubicure::Girl>
Get precure miracle leap.
-
#miracle_universe ⇒ Array<Rubicure::Girl>
Get precure miracle universe.
-
#now ⇒ Rubicure::Series
(also: #current)
get current precure series.
- #respond_to_missing?(name, _include_private) ⇒ Boolean
-
#super_stars ⇒ Array<Rubicure::Girl>
(also: #superstars)
Get precure super stars.
Methods included from Rubicure::Concerns::Util
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
Instance Method Details
#all_girls(arg = Time.current) ⇒ Array<Rubicure::Girl> Also known as: all, all_members
Get all precures
146 147 148 149 150 151 152 153 154 155 156 157 158 159 |
# File 'lib/rubicure/core.rb', line 146 def all_girls(arg = Time.current) date = to_date(arg) unless @all_girls @all_girls = [] Rubicure::Girl.names.each do |girl_name| @all_girls << Rubicure::Girl.find(girl_name) end @all_girls.uniq!(&:human_name) end @all_girls.select {|girl| girl.created_date && girl.created_date <= date } end |
#all_stars(arg = Time.current) ⇒ Array<Rubicure::Girl>
Get precure all stars
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 |
# File 'lib/rubicure/core.rb', line 106 def all_stars(arg = Time.current) extra_girls = [] # args is Time or Date date = to_date(arg) if date last_all_stars_date = Rubicure::Movie.find(:stmm).started_date if date > last_all_stars_date date = last_all_stars_date end else # args is movie name movie = Rubicure::Movie.find(arg.to_sym) date = movie.started_date if movie.has_key?(:extra_girls) extra_girls = movie.extra_girls.map {|girl_name| Rubicure::Girl.find(girl_name.to_sym) } end end all_girls(date) - [Cure.echo] + extra_girls end |
#dream_stars ⇒ Array<Rubicure::Girl>
Get precure dream stars
174 175 176 177 178 179 180 181 182 183 |
# File 'lib/rubicure/core.rb', line 174 def dream_stars return @dream_stars if @dream_stars girls = Precure.go_princess.girls + Precure.maho_girls.girls + Precure.a_la_mode.girls dream_stars_date = Rubicure::Movie.find(:dream_stars).started_date @dream_stars = girls.select {|girl| girl.created_date && girl.created_date <= dream_stars_date } @dream_stars end |
#each_with_series {|series| ... } ⇒ Array<Symbol> Also known as: each
iterate with :unmarked, :max_heart, …
260 261 262 263 264 265 |
# File 'lib/rubicure/core.rb', line 260 def each_with_series Rubicure::Series.uniq_names.each do |series_name| series = Rubicure::Series.find(series_name) yield series end end |
#miracle_leap ⇒ Array<Rubicure::Girl>
Get precure miracle leap
240 241 242 243 244 245 246 247 248 249 250 |
# File 'lib/rubicure/core.rb', line 240 def miracle_leap return @miracle_leap if @miracle_leap girls = Precure.hugtto.girls + Precure.star_twinkle.girls + Precure.healingood.girls miracle_leap_date = Rubicure::Movie.find(:miracle_leap).started_date @miracle_leap = girls.select {|girl| girl.created_date && girl.created_date <= miracle_leap_date } @miracle_leap.reject! {|girl| girl == Cure.earth } @miracle_leap end |
#miracle_universe ⇒ Array<Rubicure::Girl>
Get precure miracle universe
219 220 221 222 223 224 225 226 227 228 |
# File 'lib/rubicure/core.rb', line 219 def miracle_universe return @miracle_universe if @miracle_universe girls = Precure.a_la_mode.girls + Precure.hugtto.girls + Precure.star_twinkle.girls miracle_universe_date = Rubicure::Movie.find(:miracle_universe).started_date @miracle_universe = girls.select {|girl| girl.created_date && girl.created_date <= miracle_universe_date } @miracle_universe end |
#now ⇒ Rubicure::Series Also known as: current
get current precure series
41 42 43 44 45 46 47 |
# File 'lib/rubicure/core.rb', line 41 def now current_time = Time.now each_with_series do |series| return series if series.on_air?(current_time) end raise NotOnAirError, "Not on air precure!" end |
#respond_to_missing?(name, _include_private) ⇒ Boolean
26 27 28 29 |
# File 'lib/rubicure/core.rb', line 26 def respond_to_missing?(name, _include_private) unmarked_precure = Rubicure::Series.find(:unmarked) unmarked_precure.respond_to?(name) end |
#super_stars ⇒ Array<Rubicure::Girl> Also known as: superstars
Get precure super stars
195 196 197 198 199 200 201 202 203 204 |
# File 'lib/rubicure/core.rb', line 195 def super_stars return @super_stars if @super_stars girls = Precure.maho_girls.girls + Precure.a_la_mode.girls + Precure.hugtto.girls super_stars_date = Rubicure::Movie.find(:super_stars).started_date @super_stars = girls.select {|girl| girl.created_date && girl.created_date <= super_stars_date } @super_stars end |