Sha256: 0c7a36933a9386d2b5ac1a6e1f0313240fd3a2191b4ebbcf2d31bd545d41cbd6

Contents?: true

Size: 577 Bytes

Versions: 5

Compression:

Stored size: 577 Bytes

Contents

# frozen_string_literal: true

module Lite
  module Component
    class Locals

      attr_reader :locals

      alias to_hash locals
      alias to_h locals

      def initialize(locals)
        @locals = (locals || {}).symbolize_keys
      end

      private

      def method_missing(method_name, *arguments, &block)
        if locals.key?(method_name)
          locals[method_name]
        else
          super
        end
      end

      def respond_to_missing?(method_name, include_private = false)
        locals.key?(method_name) || super
      end

    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
lite-component-1.2.2 lib/lite/component/locals.rb
lite-component-1.2.1 lib/lite/component/locals.rb
lite-component-1.2.0 lib/lite/component/locals.rb
lite-component-1.1.0 lib/lite/component/locals.rb
lite-component-1.0.11 lib/lite/component/locals.rb