Module: Phrasing

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

Defined Under Namespace

Modules: Rails, Serializer

Constant Summary collapse

WHITELIST =
"PhrasingPhrase.value"
VERSION =
'4.2.1'.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



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

def self.setup
  yield self
end

.whitelistObject



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

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

.whitelist=(whitelist) ⇒ Object



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

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

.whitelisted?(klass, attribute) ⇒ Boolean

Returns:

  • (Boolean)


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

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