Module: Bible270

Defined in:
lib/bible270/versification.rb,
lib/bible270.rb,
lib/bible270/plan.rb,
lib/bible270/names.rb,
lib/bible270/engine.rb,
lib/bible270/avatars.rb,
lib/bible270/favicon.rb,
lib/bible270/version.rb,
lib/bible270/mentions.rb,
app/models/bible270/like.rb,
lib/bible270/translations.rb,
app/models/bible270/reader.rb,
lib/bible270/configuration.rb,
lib/bible270/email_sign_in.rb,
app/models/bible270/comment.rb,
app/models/bible270/setting.rb,
app/models/bible270/checkoff.rb,
app/helpers/bible270/plan_helper.rb,
app/models/bible270/sign_in_token.rb,
app/mailers/bible270/notice_mailer.rb,
app/mailers/bible270/sign_in_mailer.rb,
app/models/bible270/application_record.rb,
app/mailers/bible270/application_mailer.rb,
app/controllers/bible270/days_controller.rb,
app/controllers/bible270/admin_controller.rb,
app/controllers/bible270/likes_controller.rb,
app/controllers/bible270/readers_controller.rb,
app/controllers/bible270/comments_controller.rb,
app/controllers/bible270/profiles_controller.rb,
app/controllers/bible270/sessions_controller.rb,
app/controllers/bible270/checkoffs_controller.rb,
app/controllers/bible270/application_controller.rb,
lib/generators/bible270/install/install_generator.rb

Overview

Verse counts per chapter (standard English / KJV versification). Verse counts are facts about the text's structure, used purely to weight daily reading portions by length. Generated from a public-domain KJV text.

Defined Under Namespace

Modules: Avatars, EmailSignIn, Favicon, Generators, Mentions, Names, Plan, PlanHelper, Translations, Versification Classes: AdminController, ApplicationController, ApplicationMailer, ApplicationRecord, Checkoff, CheckoffsController, Comment, CommentsController, Configuration, DaysController, Engine, Like, LikesController, NoticeMailer, ProfilesController, Reader, ReadersController, SessionsController, Setting, SignInMailer, SignInToken

Constant Summary collapse

VERSION =
'0.17.1'

Class Method Summary collapse

Class Method Details

.configObject



401
402
403
# File 'lib/bible270/configuration.rb', line 401

def config
  @config ||= Configuration.new
end

.configure {|config| ... } ⇒ Object

Yields:



405
406
407
# File 'lib/bible270/configuration.rb', line 405

def configure
  yield config
end

.local_time(time) ⇒ Object

A stored timestamp in the plan's own zone.

created_at and friends come back in Rails' Time.zone, which is UTC unless the host app sets it — so a reflection written at 5pm in Los Angeles was being shown as the next day. This is the same rule Bible270.today follows: the machine's zone, or config.time_zone when one is given.



34
35
36
37
38
39
40
41
42
43
44
# File 'lib/bible270.rb', line 34

def local_time(time)
  return nil if time.nil?

  zone = config.time_zone
  if zone.to_s.empty?
    time.getlocal
  else
    found = Time.respond_to?(:find_zone) ? Time.find_zone(zone) : nil
    found ? time.in_time_zone(found) : time.getlocal
  end
end

.todayObject

The plan's idea of today.

Date.current follows Rails' Time.zone, which is UTC unless the host app sets it; Date.today follows the machine. A self-hosted reading plan wants the latter, so that is the default, with config.time_zone to override.



24
25
26
# File 'lib/bible270.rb', line 24

def today
  local_time(Time.now).to_date
end