Class: Card::Content::Chunk::Abstract
- Inherits:
-
Object
- Object
- Card::Content::Chunk::Abstract
show all
- Defined in:
- lib/card/content/chunk.rb
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(match, content) ⇒ Abstract
Returns a new instance of Abstract.
100
101
102
103
104
105
106
|
# File 'lib/card/content/chunk.rb', line 100
def initialize match, content
@text = match[0]
@processed = nil
@content = content
interpret match, content
self
end
|
Instance Attribute Details
#process_chunk ⇒ Object
Returns the value of attribute process_chunk.
79
80
81
|
# File 'lib/card/content/chunk.rb', line 79
def process_chunk
@process_chunk
end
|
#text ⇒ Object
Returns the value of attribute text.
79
80
81
|
# File 'lib/card/content/chunk.rb', line 79
def text
@text
end
|
Class Method Details
.context_ok?(_content, _chunk_start) ⇒ Boolean
91
92
93
|
# File 'lib/card/content/chunk.rb', line 91
def context_ok? _content, _chunk_start
true
end
|
.full_match(content, prefix = nil) ⇒ Object
if the prefix regex matched check that chunk against the full regex
83
84
85
|
# File 'lib/card/content/chunk.rb', line 83
def full_match content, prefix=nil
content.match full_re(prefix)
end
|
.full_re(_prefix) ⇒ Object
87
88
89
|
# File 'lib/card/content/chunk.rb', line 87
def full_re _prefix
config[:full_re]
end
|
Instance Method Details
#as_json(_options = {}) ⇒ Object
129
130
131
132
|
# File 'lib/card/content/chunk.rb', line 129
def as_json _options={}
@process_chunk || @processed ||
"not rendered #{self.class}, #{card && card.name}"
end
|
#card ⇒ Object
117
118
119
|
# File 'lib/card/content/chunk.rb', line 117
def card
@content.card
end
|
113
114
115
|
# File 'lib/card/content/chunk.rb', line 113
def format
@content.format
end
|
#inspect ⇒ Object
125
126
127
|
# File 'lib/card/content/chunk.rb', line 125
def inspect
"<##{self.class}##{self}>"
end
|
#interpret(_match_string, _content, _params) ⇒ Object
108
109
110
111
|
# File 'lib/card/content/chunk.rb', line 108
def interpret _match_string, _content, _params
Rails.logger.info "no #interpret method found for chunk class: " \
"#{self.class}"
end
|
#reference_code ⇒ Object
96
97
98
|
# File 'lib/card/content/chunk.rb', line 96
def reference_code
"I"
end
|
#to_s ⇒ Object
121
122
123
|
# File 'lib/card/content/chunk.rb', line 121
def to_s
@process_chunk || @processed || @text
end
|