Sha256: 8ffce1e13ea9bcae10c928a5d6b597034d7d705d51da6d64fff9542de1862cb0

Contents?: true

Size: 924 Bytes

Versions: 14

Compression:

Stored size: 924 Bytes

Contents

# -*- coding: utf-8 -*-

require 'smalruby_editor'

class ApplicationController < ActionController::Base
  # Prevent CSRF attacks by raising an exception.
  # For APIs, you may want to use :null_session instead.
  protect_from_forgery with: :exception

  helper_method :standalone?, :raspberrypi?

  private

  # スタンドアローンモードかどうかを返す
  def standalone?
    return false if Rails.env == 'production'
    return true if Rails.env == 'standalone'

    if Rails.env != 'test' &&
        (ENV['SMALRUBY_EDITOR_STANDALONE_MODE'] ||
         File.exist?(Rails.root.join('tmp', 'standalone')))
      true
    else
      false
    end
  end

  # Raspberry Piかどうかを返す
  def raspberrypi?
    SmalrubyEditor.raspberrypi?
  end

  def check_whether_standalone
    unless standalone?
      fail "#{self.class.name}##{action_name}はstandaloneモードのみの機能です"
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
smalruby-editor-0.1.22-x86-mingw32 app/controllers/application_controller.rb
smalruby-editor-0.1.22 app/controllers/application_controller.rb
smalruby-editor-0.1.21-x86-mingw32 app/controllers/application_controller.rb
smalruby-editor-0.1.21 app/controllers/application_controller.rb
smalruby-editor-0.1.20-x86-mingw32 app/controllers/application_controller.rb
smalruby-editor-0.1.20 app/controllers/application_controller.rb
smalruby-editor-0.1.19-x86-mingw32 app/controllers/application_controller.rb
smalruby-editor-0.1.19 app/controllers/application_controller.rb
smalruby-editor-0.1.18-x86-mingw32 app/controllers/application_controller.rb
smalruby-editor-0.1.18 app/controllers/application_controller.rb
smalruby-editor-0.1.17-x86-mingw32 app/controllers/application_controller.rb
smalruby-editor-0.1.17 app/controllers/application_controller.rb
smalruby-editor-0.1.16-x86-mingw32 app/controllers/application_controller.rb
smalruby-editor-0.1.16 app/controllers/application_controller.rb