Sha256: b5a8854b66a3e5491617174de98ec13b5019c5168258f01e4e6b1fd2f292f1ca

Contents?: true

Size: 577 Bytes

Versions: 1

Compression:

Stored size: 577 Bytes

Contents

# frozen_string_literal: true

module Taksi
  module Values
    class Dynamic
      attr_reader :widget, :name, :content_key

      def initialize(widget, name, content_key = nil)
        @widget = widget
        @name = name
        @content_key = content_key
      end

      def path
        return content_key if content_key

        "#{widget.id}.#{name}"
      end

      def as_json
        {type: 'dynamic', value: path}
      end

      def dynamic?
        true
      end
    end
  end

  # Just a shortcut for ::Taksi::Values::Static
  Dynamic = Values::Dynamic
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
taksi-0.1.0 lib/taksi/values/dynamic.rb