class Slacken::NodeType
Public: Representing type of DocumentComponent
.
Attributes
name[R]
Public Class Methods
create(name)
click to toggle source
# File lib/slacken/node_type.rb, line 4 def self.create(name) name.is_a?(NodeType) ? name : new(name) end
new(name)
click to toggle source
# File lib/slacken/node_type.rb, line 9 def initialize(name) @name = name.to_sym end
Public Instance Methods
allowed_as_list_item?()
click to toggle source
# File lib/slacken/node_type.rb, line 38 def allowed_as_list_item? member_of?(%i(code b strong i em wrapper span).concat(text_types)) end
allowed_in_headline?()
click to toggle source
# File lib/slacken/node_type.rb, line 42 def allowed_in_headline? member_of?(%i(i em wrapper span).concat(text_types)) end
allowed_in_link?()
click to toggle source
# File lib/slacken/node_type.rb, line 50 def allowed_in_link? member_of?(%i(b strong i em wrapper span).concat(text_types)) end
allowed_in_list?()
click to toggle source
# File lib/slacken/node_type.rb, line 34 def allowed_in_list? member_of?(%i(code b strong i em wrapper div indent span ol ul dl li dd dt).concat(text_types)) end
allowed_in_table?()
click to toggle source
# File lib/slacken/node_type.rb, line 46 def allowed_in_table? member_of?(%i(code b strong i em wrapper span thead tbody tr th td).concat(text_types)) end
block?()
click to toggle source
# File lib/slacken/node_type.rb, line 21 def block? member_of?(%i(document div iframe p img ul ol dl dd li hr indent p h1 h2 h3 h4 h5 h6 h7 h8 pre blockquote body html)) end
inline?()
click to toggle source
# File lib/slacken/node_type.rb, line 26 def inline? !block? end
member_of?(*names)
click to toggle source
# File lib/slacken/node_type.rb, line 13 def member_of?(*names) names.flatten.include?(name) end
text_type?()
click to toggle source
# File lib/slacken/node_type.rb, line 30 def text_type? member_of?(text_types) end
text_types()
click to toggle source
# File lib/slacken/node_type.rb, line 17 def text_types %i(text emoji checkbox) end