Module: Phrasing

Defined in:
lib/phrasing.rb,
lib/phrasing/string.rb,
lib/phrasing/version.rb,
lib/phrasing/serializer.rb,
lib/phrasing/rails/engine.rb

Defined Under Namespace

Modules: Rails, Serializer Classes: String

Constant Summary collapse

WHITELIST =
"PhrasingPhrase.value"
VERSION =
'4.4.0'.freeze
@@allow_update_on_all_models_and_attributes =
false
@@route =
'phrasing'
@@parent_controller =
"ApplicationController"

Class Method Summary collapse

Class Method Details

.setup {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:

  • _self (Phrasing)

    the object that the method was called on



18
19
20
# File 'lib/phrasing.rb', line 18

def self.setup
  yield self
end

.whitelistObject



24
25
26
27
28
29
30
# File 'lib/phrasing.rb', line 24

def self.whitelist
  if defined? @@whitelist
    @@whitelist + [WHITELIST]
  else
    [WHITELIST]
  end
end

.whitelist=(whitelist) ⇒ Object



32
33
34
# File 'lib/phrasing.rb', line 32

def self.whitelist=(whitelist)
  @@whitelist = whitelist
end

.whitelisted?(klass, attribute) ⇒ Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/phrasing.rb', line 36

def self.whitelisted?(klass, attribute)
  allow_update_on_all_models_and_attributes == true || whitelist.include?("#{klass}.#{attribute}")
end