Sha256: 16755df0f4c1323d2e3a2690b128a2679b265c2027b4facb2823e8372f822539

Contents?: true

Size: 685 Bytes

Versions: 4

Compression:

Stored size: 685 Bytes

Contents

module Figly
  module Settings
    module SettingsHash
      def method_missing(meth, *args, &blk)
        m = meth.to_s
        if has_key? m
          value = self[m]
          return value.extend(SettingsHash) if value.instance_of? Hash
          value
        end
      end
    end

    def self.method_missing(meth, *args, &block)
      data = Figly.data
      if data.has_key? meth.to_s
        val = data[meth.to_s]
        if val.instance_of?(Hash)
          val.extend(SettingsHash)
        elsif val.instance_of? Array
          val.each_with_index{ |item ,idx| item.extend(SettingsHash) if item.instance_of? Hash }
        end
        return val
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
figly-1.0.4 lib/figly/settings.rb
figly-1.0.3 lib/figly/settings.rb
figly-1.0.2 lib/figly/settings.rb
figly-1.0.1 lib/figly/settings.rb