Module: Loba::Internal Private

Defined in:
lib/loba/internal.rb,
lib/loba/internal/value.rb,
lib/loba/internal/platform.rb,
lib/loba/internal/settings.rb,
lib/loba/internal/time_keeper.rb,
lib/loba/internal/platform/formatter.rb,
lib/loba/internal/value/value_helper.rb,
lib/loba/internal/platform/within_rails.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Internal functionality support

Defined Under Namespace

Modules: Platform, Value Classes: Settings, TimeKeeper

Class Method Summary collapse

Class Method Details

.boolean_cast(value) ⇒ true, false

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Casts any value to true or false (boolean)

Parameters:

  • value (Object)

    the value to cast

Returns:

  • (true, false)


48
49
50
51
52
# File 'lib/loba/internal.rb', line 48

def boolean_cast(value)
  return false if value.respond_to?(:empty) && value.empty?

  !FALSE_VALUES.include?(value)
end

.unquote(content) ⇒ String, Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Remove wrapping quotes on a string (produced by .inspect)

Parameters:

  • content (String)

    the string (assumed to be produced from calling .inspect) to remove quotes (“) that wrap a string

Returns:

  • (String, Object)
    • If not a string, the original argument will be returned without modification

    • If string does not have quotes as first and last character, the original argument will be returned without modification

    • If string does have quotes as first and last character, the original content will be returned with the original first and last character removed



21
22
23
24
25
26
# File 'lib/loba/internal.rb', line 21

def unquote(content)
  return content unless content.is_a?(String)
  return content unless content[0] == '"' && content[-1] == '"'

  content[1...-1]
end