Sha256: 8d7d43a7282835f3b184cdfb7bfd11a16e5d12479438c9696ec44aab05de2103

Contents?: true

Size: 638 Bytes

Versions: 1

Compression:

Stored size: 638 Bytes

Contents

module SettingsJs
  module Backends
    class SettingsLogic

      attr_accessor :klass

      def initialize(klass)
        self.klass = klass
      end

      # Public: Use application settings logic class to get values of a key.
      #
      # base_key - String formatted.
      #
      # Examples
      #
      #   multiplex('Tom', 4)
      #   # => 'TomTomTomTom'
      #
      # Returns the duplicated String.
      def to_hash(base_key)
        keys      = base_key.split(/\./)
        base_hash = klass.send(keys.shift)

        keys.each { |key| base_hash = base_hash.send(key) }

        base_hash
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
settings_js-0.1.2 lib/settings_js/backends/settings_logic.rb