Sha256: b7967461aafa53a519a71d27d8daf162780b93d167ca051c185b43d74ac2b460

Contents?: true

Size: 961 Bytes

Versions: 7

Compression:

Stored size: 961 Bytes

Contents

class Card
  class Content
    module Chunk
      class ViewStub < Abstract
        Chunk.register_class(
          self,
          prefix_re: Regexp.escape("<card-view>"),
          full_re: /\<card-view\>([^\<]*)\<\/card-view\>/,
          idx_char: "<"
        )

        def interpret match, _content
          @options_json = match[1]
          @stub_hash = JSON.parse(@options_json).symbolize_keys
          interpret_hash_values
        end

        def interpret_hash_values
          @stub_hash.keys.each do |key|
            send "interpret_#{key}"
          end
        end

        def interpret_cast
          @stub_hash[:cast].symbolize_keys!
        end

        def interpret_options
          @stub_hash[:options].symbolize_keys!
        end

        def interpret_mode
          @stub_hash[:mode] = @stub_hash[:mode].to_sym
        end

        def process_chunk
          @processed = yield @stub_hash
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
card-1.91 mod/core/chunk/view_stub.rb
card-1.21.0 mod/core/chunk/view_stub.rb
card-1.20.4 mod/core/chunk/view_stub.rb
card-1.20.3 mod/core/chunk/view_stub.rb
card-1.20.2 mod/core/chunk/view_stub.rb
card-1.20.1 mod/core/chunk/view_stub.rb
card-1.20.0 mod/core/chunk/view_stub.rb