Class: Card::Content::Chunk::ViewStub
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, #inspect, #reference_code, #to_s
Constructor Details
#initialize(text, content) ⇒ ViewStub
Returns a new instance of ViewStub.
12
13
14
|
# File 'mod/core/chunk/view_stub.rb', line 12
def initialize text, content
super
end
|
Instance Method Details
#interpret(match, _content) ⇒ Object
16
17
18
19
20
|
# File 'mod/core/chunk/view_stub.rb', line 16
def interpret match, _content
@options_json = match[1]
@stub_hash = JSON.parse(Card::View::Stub.unescape @options_json).symbolize_keys
interpret_hash_values
end
|
#interpret_cast ⇒ Object
28
29
30
|
# File 'mod/core/chunk/view_stub.rb', line 28
def interpret_cast
@stub_hash[:cast].symbolize_keys!
end
|
36
37
38
39
40
41
|
# File 'mod/core/chunk/view_stub.rb', line 36
def interpret_format_opts
hash = @stub_hash[:format_opts]
hash.symbolize_keys!
hash[:nest_mode] = hash[:nest_mode].to_sym
hash[:override] = hash[:override] == "true"
end
|
#interpret_hash_values ⇒ Object
22
23
24
25
26
|
# File 'mod/core/chunk/view_stub.rb', line 22
def interpret_hash_values
@stub_hash.keys.each do |key|
send "interpret_#{key}"
end
end
|
#interpret_view_opts ⇒ Object
32
33
34
|
# File 'mod/core/chunk/view_stub.rb', line 32
def interpret_view_opts
@stub_hash[:view_opts].symbolize_keys!
end
|
#process_chunk ⇒ Object
43
44
45
|
# File 'mod/core/chunk/view_stub.rb', line 43
def process_chunk
@processed = yield @stub_hash
end
|
#result ⇒ Object
47
48
49
|
# File 'mod/core/chunk/view_stub.rb', line 47
def result
@processed
end
|