Class: Card::Content::Chunk::ViewStub

Inherits:
Abstract
  • Object
show all
Defined in:
mod/core/chunk/view_stub.rb

Instance Attribute Summary

Attributes inherited from Abstract

#text

Instance Method Summary collapse

Methods inherited from Abstract

#as_json, #card, context_ok?, #format, full_match, full_re, #initialize, #inspect, #reference_code, #to_s

Constructor Details

This class inherits a constructor from Card::Content::Chunk::Abstract

Instance Method Details

#interpret(match, _content) ⇒ Object



12
13
14
15
16
# File 'mod/core/chunk/view_stub.rb', line 12

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

#interpret_castObject



24
25
26
# File 'mod/core/chunk/view_stub.rb', line 24

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

#interpret_hash_valuesObject



18
19
20
21
22
# File 'mod/core/chunk/view_stub.rb', line 18

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

#interpret_modeObject



32
33
34
# File 'mod/core/chunk/view_stub.rb', line 32

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

#interpret_optionsObject



28
29
30
# File 'mod/core/chunk/view_stub.rb', line 28

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

#process_chunkObject



36
37
38
# File 'mod/core/chunk/view_stub.rb', line 36

def process_chunk
  @processed = yield @stub_hash
end