Class: OrgParse::BlockNode
Overview
BLOCK の情報を保持
Instance Attribute Summary collapse
-
#block_name ⇒ Object
readonly
Returns the value of attribute block_name.
-
#filename ⇒ Object
readonly
Returns the value of attribute filename.
-
#indent ⇒ Object
readonly
Returns the value of attribute indent.
-
#syntax ⇒ Object
readonly
Returns the value of attribute syntax.
-
#syntax_theme ⇒ Object
readonly
Returns the value of attribute syntax_theme.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Attributes inherited from Node
#children, #kind, #parent, #value
Instance Method Summary collapse
-
#initialize(vals, children) ⇒ BlockNode
constructor
A new instance of BlockNode.
- #line ⇒ Object
Methods inherited from Node
#done, #done?, #example?, #html?, #inspect, #is_leaf?, #section_no_array, #set_example, #set_html, #set_src, #set_to_descendant, #set_verse, #src?, #verse?
Constructor Details
#initialize(vals, children) ⇒ BlockNode
Returns a new instance of BlockNode.
238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 |
# File 'lib/org-parse/node.rb', line 238 def initialize(vals, children) @block_name = vals[0].upcase @line = vals[1] @indent = vals[2] @syntax = '' @syntax_theme = '' super(:BLOCK, children, vals[1]) case @block_name when 'VERSE' set_to_descendant :set_verse when 'EXAMPLE' set_to_descendant :set_example when 'SRC' set_to_descendant :set_src if vals[1] =~ /SRC\s*([^\s]+)\s+([^\s]+)\s*$/i @syntax = $1.downcase @syntax_theme = $2.downcase elsif vals[1] =~ /SRC\s*(.+)\s*$/i @syntax = $1.downcase end when 'DOT' set_to_descendant :set_src if vals[1] =~ /DOT\s+(.+)\s+-T(.*)$/ @filename = $1 @type = $2 else @block_name = 'SRC' @syntax = 'dot' end when 'HTML' set_to_descendant :set_html end end |
Instance Attribute Details
#block_name ⇒ Object (readonly)
Returns the value of attribute block_name.
237 238 239 |
# File 'lib/org-parse/node.rb', line 237 def block_name @block_name end |
#filename ⇒ Object (readonly)
Returns the value of attribute filename.
237 238 239 |
# File 'lib/org-parse/node.rb', line 237 def filename @filename end |
#indent ⇒ Object (readonly)
Returns the value of attribute indent.
237 238 239 |
# File 'lib/org-parse/node.rb', line 237 def indent @indent end |
#syntax ⇒ Object (readonly)
Returns the value of attribute syntax.
237 238 239 |
# File 'lib/org-parse/node.rb', line 237 def syntax @syntax end |
#syntax_theme ⇒ Object (readonly)
Returns the value of attribute syntax_theme.
237 238 239 |
# File 'lib/org-parse/node.rb', line 237 def syntax_theme @syntax_theme end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
237 238 239 |
# File 'lib/org-parse/node.rb', line 237 def type @type end |
Instance Method Details
#line ⇒ Object
272 273 274 |
# File 'lib/org-parse/node.rb', line 272 def line @value end |