repo stringlengths 5 58 | path stringlengths 9 168 | func_name stringlengths 9 130 | original_string stringlengths 66 10.5k | language stringclasses 1
value | code stringlengths 66 10.5k | code_tokens list | docstring stringlengths 8 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 94 266 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
ONLYOFFICE/ooxml_parser | lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/matrix.rb | OoxmlParser.Matrix.parse | def parse(node)
columns_count = 1
j = 0
node.xpath('m:mPr').each do |m_pr|
m_pr.xpath('m:mcs').each do |mcs|
mcs.xpath('m:mc').each do |mc|
mc.xpath('m:mcPr').each do |mc_pr|
mc_pr.xpath('m:count').each do |count|
columns_count = count.attrib... | ruby | def parse(node)
columns_count = 1
j = 0
node.xpath('m:mPr').each do |m_pr|
m_pr.xpath('m:mcs').each do |mcs|
mcs.xpath('m:mc').each do |mc|
mc.xpath('m:mcPr').each do |mc_pr|
mc_pr.xpath('m:count').each do |count|
columns_count = count.attrib... | [
"def",
"parse",
"(",
"node",
")",
"columns_count",
"=",
"1",
"j",
"=",
"0",
"node",
".",
"xpath",
"(",
"'m:mPr'",
")",
".",
"each",
"do",
"|",
"m_pr",
"|",
"m_pr",
".",
"xpath",
"(",
"'m:mcs'",
")",
".",
"each",
"do",
"|",
"mcs",
"|",
"mcs",
".... | Parse Matrix object
@param node [Nokogiri::XML:Element] node to parse
@return [Matrix] result of parsing | [
"Parse",
"Matrix",
"object"
] | 08452315cde52fa94d8cb3e1eff1db4ea33abc88 | https://github.com/ONLYOFFICE/ooxml_parser/blob/08452315cde52fa94d8cb3e1eff1db4ea33abc88/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/matrix.rb#L15-L41 | train |
ONLYOFFICE/ooxml_parser | lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/sdt/sdt_properties.rb | OoxmlParser.SDTProperties.parse | def parse(node)
node.xpath('*').each do |node_child|
case node_child.name
when 'alias'
@alias = ValuedChild.new(:string, parent: self).parse(node_child)
when 'tag'
@tag = ValuedChild.new(:string, parent: self).parse(node_child)
when 'lock'
@lock = Valu... | ruby | def parse(node)
node.xpath('*').each do |node_child|
case node_child.name
when 'alias'
@alias = ValuedChild.new(:string, parent: self).parse(node_child)
when 'tag'
@tag = ValuedChild.new(:string, parent: self).parse(node_child)
when 'lock'
@lock = Valu... | [
"def",
"parse",
"(",
"node",
")",
"node",
".",
"xpath",
"(",
"'*'",
")",
".",
"each",
"do",
"|",
"node_child",
"|",
"case",
"node_child",
".",
"name",
"when",
"'alias'",
"@alias",
"=",
"ValuedChild",
".",
"new",
"(",
":string",
",",
"parent",
":",
"s... | Parse SDTProperties object
@param node [Nokogiri::XML:Element] node to parse
@return [SDTProperties] result of parsing | [
"Parse",
"SDTProperties",
"object"
] | 08452315cde52fa94d8cb3e1eff1db4ea33abc88 | https://github.com/ONLYOFFICE/ooxml_parser/blob/08452315cde52fa94d8cb3e1eff1db4ea33abc88/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/sdt/sdt_properties.rb#L14-L26 | train |
ONLYOFFICE/ooxml_parser | lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/text_body.rb | OoxmlParser.TextBody.parse | def parse(node)
node.xpath('*').each do |node_child|
case node_child.name
when 'p'
@paragraphs << Paragraph.new(parent: self).parse(node_child)
when 'bodyPr'
@properties = OOXMLShapeBodyProperties.new(parent: self).parse(node_child)
end
end
self
... | ruby | def parse(node)
node.xpath('*').each do |node_child|
case node_child.name
when 'p'
@paragraphs << Paragraph.new(parent: self).parse(node_child)
when 'bodyPr'
@properties = OOXMLShapeBodyProperties.new(parent: self).parse(node_child)
end
end
self
... | [
"def",
"parse",
"(",
"node",
")",
"node",
".",
"xpath",
"(",
"'*'",
")",
".",
"each",
"do",
"|",
"node_child",
"|",
"case",
"node_child",
".",
"name",
"when",
"'p'",
"@paragraphs",
"<<",
"Paragraph",
".",
"new",
"(",
"parent",
":",
"self",
")",
".",
... | Parse TextBody object
@param node [Nokogiri::XML:Element] node to parse
@return [TextBody] result of parsing | [
"Parse",
"TextBody",
"object"
] | 08452315cde52fa94d8cb3e1eff1db4ea33abc88 | https://github.com/ONLYOFFICE/ooxml_parser/blob/08452315cde52fa94d8cb3e1eff1db4ea33abc88/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/text_body.rb#L14-L24 | train |
ONLYOFFICE/ooxml_parser | lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/animation_effect/animation_effect.rb | OoxmlParser.AnimationEffect.parse | def parse(node)
node.attributes.each do |key, value|
case key
when 'transition'
@transition = value.value
when 'filter'
@filter = value.value
end
end
node.xpath('*').each do |node_child|
case node_child.name
when 'cBhvr'
@b... | ruby | def parse(node)
node.attributes.each do |key, value|
case key
when 'transition'
@transition = value.value
when 'filter'
@filter = value.value
end
end
node.xpath('*').each do |node_child|
case node_child.name
when 'cBhvr'
@b... | [
"def",
"parse",
"(",
"node",
")",
"node",
".",
"attributes",
".",
"each",
"do",
"|",
"key",
",",
"value",
"|",
"case",
"key",
"when",
"'transition'",
"@transition",
"=",
"value",
".",
"value",
"when",
"'filter'",
"@filter",
"=",
"value",
".",
"value",
... | Parse AnimationEffect object
@param node [Nokogiri::XML:Element] node to parse
@return [AnimationEffect] result of parsing | [
"Parse",
"AnimationEffect",
"object"
] | 08452315cde52fa94d8cb3e1eff1db4ea33abc88 | https://github.com/ONLYOFFICE/ooxml_parser/blob/08452315cde52fa94d8cb3e1eff1db4ea33abc88/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/animation_effect/animation_effect.rb#L8-L25 | train |
ONLYOFFICE/ooxml_parser | lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/cell_xfs/xf.rb | OoxmlParser.Xf.parse | def parse(node)
node.attributes.each do |key, value|
case key
when 'applyFont'
@apply_font = attribute_enabled?(value)
when 'applyBorder'
@apply_border = attribute_enabled?(value)
when 'applyFill'
@apply_fill = attribute_enabled?(value)
when 'a... | ruby | def parse(node)
node.attributes.each do |key, value|
case key
when 'applyFont'
@apply_font = attribute_enabled?(value)
when 'applyBorder'
@apply_border = attribute_enabled?(value)
when 'applyFill'
@apply_fill = attribute_enabled?(value)
when 'a... | [
"def",
"parse",
"(",
"node",
")",
"node",
".",
"attributes",
".",
"each",
"do",
"|",
"key",
",",
"value",
"|",
"case",
"key",
"when",
"'applyFont'",
"@apply_font",
"=",
"attribute_enabled?",
"(",
"value",
")",
"when",
"'applyBorder'",
"@apply_border",
"=",
... | Parse Xf object
@param node [Nokogiri::XML:Element] node to parse
@return [Xf] result of parsing | [
"Parse",
"Xf",
"object"
] | 08452315cde52fa94d8cb3e1eff1db4ea33abc88 | https://github.com/ONLYOFFICE/ooxml_parser/blob/08452315cde52fa94d8cb3e1eff1db4ea33abc88/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/cell_xfs/xf.rb#L86-L118 | train |
ONLYOFFICE/ooxml_parser | lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/sheet_view/pane.rb | OoxmlParser.Pane.parse | def parse(node)
node.attributes.each do |key, value|
case key
when 'state'
@state = value.value.to_sym
when 'topLeftCell'
@top_left_cell = Coordinates.parse_coordinates_from_string(value.value)
when 'xSplit'
@x_split = value.value
when 'ySplit'... | ruby | def parse(node)
node.attributes.each do |key, value|
case key
when 'state'
@state = value.value.to_sym
when 'topLeftCell'
@top_left_cell = Coordinates.parse_coordinates_from_string(value.value)
when 'xSplit'
@x_split = value.value
when 'ySplit'... | [
"def",
"parse",
"(",
"node",
")",
"node",
".",
"attributes",
".",
"each",
"do",
"|",
"key",
",",
"value",
"|",
"case",
"key",
"when",
"'state'",
"@state",
"=",
"value",
".",
"value",
".",
"to_sym",
"when",
"'topLeftCell'",
"@top_left_cell",
"=",
"Coordin... | Parse Pane object
@param node [Nokogiri::XML:Element] node to parse
@return [Pane] result of parsing | [
"Parse",
"Pane",
"object"
] | 08452315cde52fa94d8cb3e1eff1db4ea33abc88 | https://github.com/ONLYOFFICE/ooxml_parser/blob/08452315cde52fa94d8cb3e1eff1db4ea33abc88/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/sheet_view/pane.rb#L9-L23 | train |
ONLYOFFICE/ooxml_parser | lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_comments/presentation_comment.rb | OoxmlParser.PresentationComment.parse | def parse(node)
node.attributes.each do |key, value|
case key
when 'authorId'
@author_id = value.value.to_i
end
end
node.xpath('*').each do |node_child|
case node_child.name
when 'pos'
@position = OOXMLCoordinates.parse(node_child, x_attr: 'x... | ruby | def parse(node)
node.attributes.each do |key, value|
case key
when 'authorId'
@author_id = value.value.to_i
end
end
node.xpath('*').each do |node_child|
case node_child.name
when 'pos'
@position = OOXMLCoordinates.parse(node_child, x_attr: 'x... | [
"def",
"parse",
"(",
"node",
")",
"node",
".",
"attributes",
".",
"each",
"do",
"|",
"key",
",",
"value",
"|",
"case",
"key",
"when",
"'authorId'",
"@author_id",
"=",
"value",
".",
"value",
".",
"to_i",
"end",
"end",
"node",
".",
"xpath",
"(",
"'*'",... | Parse PresentationComment object
@param node [Nokogiri::XML:Element] node to parse
@return [PresentationComment] result of parsing | [
"Parse",
"PresentationComment",
"object"
] | 08452315cde52fa94d8cb3e1eff1db4ea33abc88 | https://github.com/ONLYOFFICE/ooxml_parser/blob/08452315cde52fa94d8cb3e1eff1db4ea33abc88/lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_comments/presentation_comment.rb#L19-L35 | train |
ONLYOFFICE/ooxml_parser | lib/ooxml_parser/common_parser/common_data/table/properties/table_style_properties/table_style_properties_helper.rb | OoxmlParser.TableStylePropertiesHelper.fill_empty_table_styles | def fill_empty_table_styles
TABLE_STYLES_NAMES_HASH.each_value do |current_table_style|
style_exist = false
@table_style_properties_list.each do |existing_style|
style_exist = true if existing_style.type == current_table_style
end
next if style_exist
@table_style... | ruby | def fill_empty_table_styles
TABLE_STYLES_NAMES_HASH.each_value do |current_table_style|
style_exist = false
@table_style_properties_list.each do |existing_style|
style_exist = true if existing_style.type == current_table_style
end
next if style_exist
@table_style... | [
"def",
"fill_empty_table_styles",
"TABLE_STYLES_NAMES_HASH",
".",
"each_value",
"do",
"|",
"current_table_style",
"|",
"style_exist",
"=",
"false",
"@table_style_properties_list",
".",
"each",
"do",
"|",
"existing_style",
"|",
"style_exist",
"=",
"true",
"if",
"existing... | Fill all empty tables styles with default value
To make last changes in parsing table styles compatible
with `ooxml_parser` 0.1.2 and earlier
@return [Nothing] | [
"Fill",
"all",
"empty",
"tables",
"styles",
"with",
"default",
"value",
"To",
"make",
"last",
"changes",
"in",
"parsing",
"table",
"styles",
"compatible",
"with",
"ooxml_parser",
"0",
".",
"1",
".",
"2",
"and",
"earlier"
] | 08452315cde52fa94d8cb3e1eff1db4ea33abc88 | https://github.com/ONLYOFFICE/ooxml_parser/blob/08452315cde52fa94d8cb3e1eff1db4ea33abc88/lib/ooxml_parser/common_parser/common_data/table/properties/table_style_properties/table_style_properties_helper.rb#L31-L41 | train |
ONLYOFFICE/ooxml_parser | lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/autofilter/filter_column.rb | OoxmlParser.FilterColumn.parse | def parse(node)
node.attributes.each do |key, value|
case key
when 'showButton'
@show_button = attribute_enabled?(value)
end
end
node.xpath('*').each do |node_child|
case node_child.name
when 'customFilters'
@custom_filters = CustomFilters.n... | ruby | def parse(node)
node.attributes.each do |key, value|
case key
when 'showButton'
@show_button = attribute_enabled?(value)
end
end
node.xpath('*').each do |node_child|
case node_child.name
when 'customFilters'
@custom_filters = CustomFilters.n... | [
"def",
"parse",
"(",
"node",
")",
"node",
".",
"attributes",
".",
"each",
"do",
"|",
"key",
",",
"value",
"|",
"case",
"key",
"when",
"'showButton'",
"@show_button",
"=",
"attribute_enabled?",
"(",
"value",
")",
"end",
"end",
"node",
".",
"xpath",
"(",
... | Parse FilterColumn data
@param [Nokogiri::XML:Element] node with FilterColumn data
@return [FilterColumn] value of FilterColumn data | [
"Parse",
"FilterColumn",
"data"
] | 08452315cde52fa94d8cb3e1eff1db4ea33abc88 | https://github.com/ONLYOFFICE/ooxml_parser/blob/08452315cde52fa94d8cb3e1eff1db4ea33abc88/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/autofilter/filter_column.rb#L21-L36 | train |
ONLYOFFICE/ooxml_parser | lib/ooxml_parser/common_parser/common_data/table/row/cell/cell.rb | OoxmlParser.TableCell.parse | def parse(node)
node.attributes.each do |key, value|
case key
when 'gridSpan'
@grid_span = value.value.to_i
when 'hMerge'
@horizontal_merge = value.value.to_i
when 'vMerge'
@vertical_merge = value.value.to_i
end
end
node.xpath('*')... | ruby | def parse(node)
node.attributes.each do |key, value|
case key
when 'gridSpan'
@grid_span = value.value.to_i
when 'hMerge'
@horizontal_merge = value.value.to_i
when 'vMerge'
@vertical_merge = value.value.to_i
end
end
node.xpath('*')... | [
"def",
"parse",
"(",
"node",
")",
"node",
".",
"attributes",
".",
"each",
"do",
"|",
"key",
",",
"value",
"|",
"case",
"key",
"when",
"'gridSpan'",
"@grid_span",
"=",
"value",
".",
"value",
".",
"to_i",
"when",
"'hMerge'",
"@horizontal_merge",
"=",
"valu... | Parse TableCell object
@param node [Nokogiri::XML:Element] node to parse
@return [TableCell] result of parsing | [
"Parse",
"TableCell",
"object"
] | 08452315cde52fa94d8cb3e1eff1db4ea33abc88 | https://github.com/ONLYOFFICE/ooxml_parser/blob/08452315cde52fa94d8cb3e1eff1db4ea33abc88/lib/ooxml_parser/common_parser/common_data/table/row/cell/cell.rb#L18-L48 | train |
ONLYOFFICE/ooxml_parser | lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/delimeter.rb | OoxmlParser.Delimiter.parse | def parse(node)
node.xpath('*').each do |node_child|
case node_child.name
when 'dPr'
node_child.xpath('*').each do |node_child_child|
case node_child_child.name
when 'begChr'
@begin_character = ValuedChild.new(:string, parent: self).parse(node_child_... | ruby | def parse(node)
node.xpath('*').each do |node_child|
case node_child.name
when 'dPr'
node_child.xpath('*').each do |node_child_child|
case node_child_child.name
when 'begChr'
@begin_character = ValuedChild.new(:string, parent: self).parse(node_child_... | [
"def",
"parse",
"(",
"node",
")",
"node",
".",
"xpath",
"(",
"'*'",
")",
".",
"each",
"do",
"|",
"node_child",
"|",
"case",
"node_child",
".",
"name",
"when",
"'dPr'",
"node_child",
".",
"xpath",
"(",
"'*'",
")",
".",
"each",
"do",
"|",
"node_child_c... | Parse Delimiter object
@param node [Nokogiri::XML:Element] node to parse
@return [Delimiter] result of parsing | [
"Parse",
"Delimiter",
"object"
] | 08452315cde52fa94d8cb3e1eff1db4ea33abc88 | https://github.com/ONLYOFFICE/ooxml_parser/blob/08452315cde52fa94d8cb3e1eff1db4ea33abc88/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/delimeter.rb#L15-L31 | train |
ONLYOFFICE/ooxml_parser | lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_axis.rb | OoxmlParser.ChartAxis.parse | def parse(node)
node.xpath('*').each do |node_child|
case node_child.name
when 'delete'
@display = false if node_child.attribute('val').value == '1'
when 'title'
@title = ChartAxisTitle.new(parent: self).parse(node_child)
when 'majorGridlines'
@major_g... | ruby | def parse(node)
node.xpath('*').each do |node_child|
case node_child.name
when 'delete'
@display = false if node_child.attribute('val').value == '1'
when 'title'
@title = ChartAxisTitle.new(parent: self).parse(node_child)
when 'majorGridlines'
@major_g... | [
"def",
"parse",
"(",
"node",
")",
"node",
".",
"xpath",
"(",
"'*'",
")",
".",
"each",
"do",
"|",
"node_child",
"|",
"case",
"node_child",
".",
"name",
"when",
"'delete'",
"@display",
"=",
"false",
"if",
"node_child",
".",
"attribute",
"(",
"'val'",
")"... | Parse ChartAxis object
@param node [Nokogiri::XML:Element] node to parse
@return [ChartAxis] result of parsing | [
"Parse",
"ChartAxis",
"object"
] | 08452315cde52fa94d8cb3e1eff1db4ea33abc88 | https://github.com/ONLYOFFICE/ooxml_parser/blob/08452315cde52fa94d8cb3e1eff1db4ea33abc88/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_axis.rb#L27-L48 | train |
ONLYOFFICE/ooxml_parser | lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_legend.rb | OoxmlParser.ChartLegend.parse | def parse(node)
node.xpath('*').each do |child_node|
case child_node.name
when 'legendPos'
@position = value_to_symbol(child_node.attribute('val'))
when 'overlay'
@overlay = true if child_node.attribute('val').value.to_s == '1'
end
end
self
end | ruby | def parse(node)
node.xpath('*').each do |child_node|
case child_node.name
when 'legendPos'
@position = value_to_symbol(child_node.attribute('val'))
when 'overlay'
@overlay = true if child_node.attribute('val').value.to_s == '1'
end
end
self
end | [
"def",
"parse",
"(",
"node",
")",
"node",
".",
"xpath",
"(",
"'*'",
")",
".",
"each",
"do",
"|",
"child_node",
"|",
"case",
"child_node",
".",
"name",
"when",
"'legendPos'",
"@position",
"=",
"value_to_symbol",
"(",
"child_node",
".",
"attribute",
"(",
"... | Parse ChartLegend object
@param node [Nokogiri::XML:Element] node to parse
@return [ChartLegend] result of parsing | [
"Parse",
"ChartLegend",
"object"
] | 08452315cde52fa94d8cb3e1eff1db4ea33abc88 | https://github.com/ONLYOFFICE/ooxml_parser/blob/08452315cde52fa94d8cb3e1eff1db4ea33abc88/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_legend.rb#L27-L37 | train |
ONLYOFFICE/ooxml_parser | lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_comments.rb | OoxmlParser.PresentationComments.parse | def parse(file = "#{OOXMLDocumentObject.path_to_folder}/#{OOXMLDocumentObject.root_subfolder}/comments/comment1.xml")
return nil unless File.exist?(file)
document = parse_xml(File.open(file))
node = document.xpath('*').first
node.xpath('*').each do |node_child|
case node_child.name
... | ruby | def parse(file = "#{OOXMLDocumentObject.path_to_folder}/#{OOXMLDocumentObject.root_subfolder}/comments/comment1.xml")
return nil unless File.exist?(file)
document = parse_xml(File.open(file))
node = document.xpath('*').first
node.xpath('*').each do |node_child|
case node_child.name
... | [
"def",
"parse",
"(",
"file",
"=",
"\"#{OOXMLDocumentObject.path_to_folder}/#{OOXMLDocumentObject.root_subfolder}/comments/comment1.xml\"",
")",
"return",
"nil",
"unless",
"File",
".",
"exist?",
"(",
"file",
")",
"document",
"=",
"parse_xml",
"(",
"File",
".",
"open",
"(... | Parse PresentationComments object
@param file [Nokogiri::XML:Element] node to parse
@return [PresentationComments] result of parsing | [
"Parse",
"PresentationComments",
"object"
] | 08452315cde52fa94d8cb3e1eff1db4ea33abc88 | https://github.com/ONLYOFFICE/ooxml_parser/blob/08452315cde52fa94d8cb3e1eff1db4ea33abc88/lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_comments.rb#L16-L29 | train |
ONLYOFFICE/ooxml_parser | lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/ooxml_size.rb | OoxmlParser.OoxmlSize.to_base_unit | def to_base_unit
case @unit
when :centimeter
OoxmlSize.new(@value * 360_000)
when :point
OoxmlSize.new(@value * 12_700)
when :half_point
OoxmlSize.new(@value * (12_700 / 2))
when :one_eighth_point
OoxmlSize.new(@value * (12_700 / 8))
when :one_100th_po... | ruby | def to_base_unit
case @unit
when :centimeter
OoxmlSize.new(@value * 360_000)
when :point
OoxmlSize.new(@value * 12_700)
when :half_point
OoxmlSize.new(@value * (12_700 / 2))
when :one_eighth_point
OoxmlSize.new(@value * (12_700 / 8))
when :one_100th_po... | [
"def",
"to_base_unit",
"case",
"@unit",
"when",
":centimeter",
"OoxmlSize",
".",
"new",
"(",
"@value",
"*",
"360_000",
")",
"when",
":point",
"OoxmlSize",
".",
"new",
"(",
"@value",
"*",
"12_700",
")",
"when",
":half_point",
"OoxmlSize",
".",
"new",
"(",
"... | Convert all values to one same base unit
@return [OoxmlSize] base unit | [
"Convert",
"all",
"values",
"to",
"one",
"same",
"base",
"unit"
] | 08452315cde52fa94d8cb3e1eff1db4ea33abc88 | https://github.com/ONLYOFFICE/ooxml_parser/blob/08452315cde52fa94d8cb3e1eff1db4ea33abc88/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/ooxml_size.rb#L43-L72 | train |
ONLYOFFICE/ooxml_parser | lib/ooxml_parser/docx_parser/docx_data/document_structure/document_properties.rb | OoxmlParser.DocumentProperties.parse | def parse
properties_file = "#{OOXMLDocumentObject.path_to_folder}docProps/app.xml"
unless File.exist?(properties_file)
warn "There is no 'docProps/app.xml' in docx. It may be some problem with it"
return self
end
node = parse_xml(properties_file)
node.xpath('*').each do |n... | ruby | def parse
properties_file = "#{OOXMLDocumentObject.path_to_folder}docProps/app.xml"
unless File.exist?(properties_file)
warn "There is no 'docProps/app.xml' in docx. It may be some problem with it"
return self
end
node = parse_xml(properties_file)
node.xpath('*').each do |n... | [
"def",
"parse",
"properties_file",
"=",
"\"#{OOXMLDocumentObject.path_to_folder}docProps/app.xml\"",
"unless",
"File",
".",
"exist?",
"(",
"properties_file",
")",
"warn",
"\"There is no 'docProps/app.xml' in docx. It may be some problem with it\"",
"return",
"self",
"end",
"node",
... | Parse Document properties
@return [DocumentProperties] | [
"Parse",
"Document",
"properties"
] | 08452315cde52fa94d8cb3e1eff1db4ea33abc88 | https://github.com/ONLYOFFICE/ooxml_parser/blob/08452315cde52fa94d8cb3e1eff1db4ea33abc88/lib/ooxml_parser/docx_parser/docx_data/document_structure/document_properties.rb#L8-L29 | train |
ONLYOFFICE/ooxml_parser | lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/non_visual_shape_properties/common_non_visual_properties.rb | OoxmlParser.CommonNonVisualProperties.parse | def parse(node)
node.attributes.each do |key, value|
case key
when 'name'
@name = value.value
when 'id'
@id = value.value
when 'title'
@title = value.value
when 'descr'
@description = value.value
end
end
node.xpat... | ruby | def parse(node)
node.attributes.each do |key, value|
case key
when 'name'
@name = value.value
when 'id'
@id = value.value
when 'title'
@title = value.value
when 'descr'
@description = value.value
end
end
node.xpat... | [
"def",
"parse",
"(",
"node",
")",
"node",
".",
"attributes",
".",
"each",
"do",
"|",
"key",
",",
"value",
"|",
"case",
"key",
"when",
"'name'",
"@name",
"=",
"value",
".",
"value",
"when",
"'id'",
"@id",
"=",
"value",
".",
"value",
"when",
"'title'",... | Parse CommonNonVisualProperties object
@param node [Nokogiri::XML:Element] node to parse
@return [CommonNonVisualProperties] result of parsing | [
"Parse",
"CommonNonVisualProperties",
"object"
] | 08452315cde52fa94d8cb3e1eff1db4ea33abc88 | https://github.com/ONLYOFFICE/ooxml_parser/blob/08452315cde52fa94d8cb3e1eff1db4ea33abc88/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/non_visual_shape_properties/common_non_visual_properties.rb#L13-L36 | train |
ONLYOFFICE/ooxml_parser | lib/ooxml_parser/common_parser/common_data/colors/hsl_color.rb | OoxmlParser.HSLColor.to_rgb | def to_rgb
chroma = (1 - (2 * @l - 1).abs) * @s
x = chroma * (1 - ((@h / 60.0) % 2.0 - 1).abs)
m = @l - chroma / 2.0
rgb = if @h.zero?
Color.new(0, 0, 0)
elsif @h > 0 && @h < 60
Color.new(chroma, x, 0)
elsif @h > 60 && @h < 120
C... | ruby | def to_rgb
chroma = (1 - (2 * @l - 1).abs) * @s
x = chroma * (1 - ((@h / 60.0) % 2.0 - 1).abs)
m = @l - chroma / 2.0
rgb = if @h.zero?
Color.new(0, 0, 0)
elsif @h > 0 && @h < 60
Color.new(chroma, x, 0)
elsif @h > 60 && @h < 120
C... | [
"def",
"to_rgb",
"chroma",
"=",
"(",
"1",
"-",
"(",
"2",
"*",
"@l",
"-",
"1",
")",
".",
"abs",
")",
"*",
"@s",
"x",
"=",
"chroma",
"*",
"(",
"1",
"-",
"(",
"(",
"@h",
"/",
"60.0",
")",
"%",
"2.0",
"-",
"1",
")",
".",
"abs",
")",
"m",
... | Chroma - The "colorfulness relative to the brightness of a similarly illuminated white". | [
"Chroma",
"-",
"The",
"colorfulness",
"relative",
"to",
"the",
"brightness",
"of",
"a",
"similarly",
"illuminated",
"white",
"."
] | 08452315cde52fa94d8cb3e1eff1db4ea33abc88 | https://github.com/ONLYOFFICE/ooxml_parser/blob/08452315cde52fa94d8cb3e1eff1db4ea33abc88/lib/ooxml_parser/common_parser/common_data/colors/hsl_color.rb#L51-L72 | train |
ONLYOFFICE/ooxml_parser | lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/transition/transition_properties/transition_properties.rb | OoxmlParser.TransitionProperties.parse | def parse(node)
@type = node.name.to_sym
case node.name
when 'blinds', 'checker', 'comb', 'cover', 'pull', 'push', 'randomBar', 'strips', 'wipe', 'zoom', 'warp'
@direction = value_to_symbol(node.attribute('dir')) if node.attribute('dir')
when 'cut', 'fade'
@through_black = option... | ruby | def parse(node)
@type = node.name.to_sym
case node.name
when 'blinds', 'checker', 'comb', 'cover', 'pull', 'push', 'randomBar', 'strips', 'wipe', 'zoom', 'warp'
@direction = value_to_symbol(node.attribute('dir')) if node.attribute('dir')
when 'cut', 'fade'
@through_black = option... | [
"def",
"parse",
"(",
"node",
")",
"@type",
"=",
"node",
".",
"name",
".",
"to_sym",
"case",
"node",
".",
"name",
"when",
"'blinds'",
",",
"'checker'",
",",
"'comb'",
",",
"'cover'",
",",
"'pull'",
",",
"'push'",
",",
"'randomBar'",
",",
"'strips'",
","... | Parse TransitionProperties object
@param node [Nokogiri::XML:Element] node to parse
@return [TransitionProperties] result of parsing | [
"Parse",
"TransitionProperties",
"object"
] | 08452315cde52fa94d8cb3e1eff1db4ea33abc88 | https://github.com/ONLYOFFICE/ooxml_parser/blob/08452315cde52fa94d8cb3e1eff1db4ea33abc88/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/transition/transition_properties/transition_properties.rb#L8-L22 | train |
ONLYOFFICE/ooxml_parser | lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/inserted.rb | OoxmlParser.Inserted.parse | def parse(node)
node.attributes.each do |key, value|
case key
when 'id'
@id = value.value.to_i
when 'author'
@author = value.value.to_s
when 'date'
@date = parse_date(value.value.to_s)
when 'oouserid'
@user_id = value.value.to_s
... | ruby | def parse(node)
node.attributes.each do |key, value|
case key
when 'id'
@id = value.value.to_i
when 'author'
@author = value.value.to_s
when 'date'
@date = parse_date(value.value.to_s)
when 'oouserid'
@user_id = value.value.to_s
... | [
"def",
"parse",
"(",
"node",
")",
"node",
".",
"attributes",
".",
"each",
"do",
"|",
"key",
",",
"value",
"|",
"case",
"key",
"when",
"'id'",
"@id",
"=",
"value",
".",
"value",
".",
"to_i",
"when",
"'author'",
"@author",
"=",
"value",
".",
"value",
... | Parse Inserted object
@param node [Nokogiri::XML:Element] node to parse
@return [Inserted] result of parsing | [
"Parse",
"Inserted",
"object"
] | 08452315cde52fa94d8cb3e1eff1db4ea33abc88 | https://github.com/ONLYOFFICE/ooxml_parser/blob/08452315cde52fa94d8cb3e1eff1db4ea33abc88/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/inserted.rb#L20-L41 | train |
ONLYOFFICE/ooxml_parser | lib/ooxml_parser/common_parser/common_data/table/properties/table_style_properties.rb | OoxmlParser.TableStyleProperties.parse | def parse(node)
node.attributes.each do |key, value|
case key
when 'type'
@type = value.value.to_sym
end
end
node.xpath('*').each do |node_child|
case node_child.name
when 'rPr'
@run_properties = RunProperties.new(parent: self).parse(node_ch... | ruby | def parse(node)
node.attributes.each do |key, value|
case key
when 'type'
@type = value.value.to_sym
end
end
node.xpath('*').each do |node_child|
case node_child.name
when 'rPr'
@run_properties = RunProperties.new(parent: self).parse(node_ch... | [
"def",
"parse",
"(",
"node",
")",
"node",
".",
"attributes",
".",
"each",
"do",
"|",
"key",
",",
"value",
"|",
"case",
"key",
"when",
"'type'",
"@type",
"=",
"value",
".",
"value",
".",
"to_sym",
"end",
"end",
"node",
".",
"xpath",
"(",
"'*'",
")",... | Parse table style property
@param node [Nokogiri::XML::Element] node to parse
@return [TableStyleProperties] | [
"Parse",
"table",
"style",
"property"
] | 08452315cde52fa94d8cb3e1eff1db4ea33abc88 | https://github.com/ONLYOFFICE/ooxml_parser/blob/08452315cde52fa94d8cb3e1eff1db4ea33abc88/lib/ooxml_parser/common_parser/common_data/table/properties/table_style_properties.rb#L29-L52 | train |
ONLYOFFICE/ooxml_parser | lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/background.rb | OoxmlParser.Background.parse | def parse(node)
node.xpath('*').each do |node_child|
case node_child.name
when 'bgPr'
@properties = BackgroundProperties.new(parent: self).parse(node_child)
end
end
background_properties_node = node.xpath('p:bgPr').first
if background_properties_node
@s... | ruby | def parse(node)
node.xpath('*').each do |node_child|
case node_child.name
when 'bgPr'
@properties = BackgroundProperties.new(parent: self).parse(node_child)
end
end
background_properties_node = node.xpath('p:bgPr').first
if background_properties_node
@s... | [
"def",
"parse",
"(",
"node",
")",
"node",
".",
"xpath",
"(",
"'*'",
")",
".",
"each",
"do",
"|",
"node_child",
"|",
"case",
"node_child",
".",
"name",
"when",
"'bgPr'",
"@properties",
"=",
"BackgroundProperties",
".",
"new",
"(",
"parent",
":",
"self",
... | Parse Background object
@param node [Nokogiri::XML:Element] node to parse
@return [Background] result of parsing | [
"Parse",
"Background",
"object"
] | 08452315cde52fa94d8cb3e1eff1db4ea33abc88 | https://github.com/ONLYOFFICE/ooxml_parser/blob/08452315cde52fa94d8cb3e1eff1db4ea33abc88/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/background.rb#L17-L31 | train |
ONLYOFFICE/ooxml_parser | lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/structured_document_tag.rb | OoxmlParser.StructuredDocumentTag.parse | def parse(node)
node.xpath('*').each do |node_child|
case node_child.name
when 'sdtContent'
@sdt_content = SDTContent.new(parent: self).parse(node_child)
when 'sdtPr'
@properties = SDTProperties.new(parent: self).parse(node_child)
end
end
self
en... | ruby | def parse(node)
node.xpath('*').each do |node_child|
case node_child.name
when 'sdtContent'
@sdt_content = SDTContent.new(parent: self).parse(node_child)
when 'sdtPr'
@properties = SDTProperties.new(parent: self).parse(node_child)
end
end
self
en... | [
"def",
"parse",
"(",
"node",
")",
"node",
".",
"xpath",
"(",
"'*'",
")",
".",
"each",
"do",
"|",
"node_child",
"|",
"case",
"node_child",
".",
"name",
"when",
"'sdtContent'",
"@sdt_content",
"=",
"SDTContent",
".",
"new",
"(",
"parent",
":",
"self",
")... | Parse StructuredDocumentTag object
@param node [Nokogiri::XML:Element] node to parse
@return [StructuredDocumentTag] result of parsing | [
"Parse",
"StructuredDocumentTag",
"object"
] | 08452315cde52fa94d8cb3e1eff1db4ea33abc88 | https://github.com/ONLYOFFICE/ooxml_parser/blob/08452315cde52fa94d8cb3e1eff1db4ea33abc88/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/structured_document_tag.rb#L14-L24 | train |
ONLYOFFICE/ooxml_parser | lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/autofilter.rb | OoxmlParser.Autofilter.parse | def parse(node)
node.attributes.each do |key, value|
case key
when 'ref'
@ref = Coordinates.parser_coordinates_range(value.value)
end
end
node.xpath('*').each do |node_child|
case node_child.name
when 'filterColumn'
@filter_column = FilterCo... | ruby | def parse(node)
node.attributes.each do |key, value|
case key
when 'ref'
@ref = Coordinates.parser_coordinates_range(value.value)
end
end
node.xpath('*').each do |node_child|
case node_child.name
when 'filterColumn'
@filter_column = FilterCo... | [
"def",
"parse",
"(",
"node",
")",
"node",
".",
"attributes",
".",
"each",
"do",
"|",
"key",
",",
"value",
"|",
"case",
"key",
"when",
"'ref'",
"@ref",
"=",
"Coordinates",
".",
"parser_coordinates_range",
"(",
"value",
".",
"value",
")",
"end",
"end",
"... | Parse Autofilter data
@param [Nokogiri::XML:Element] node with Autofilter data
@return [Autofilter] value of Autofilter data | [
"Parse",
"Autofilter",
"data"
] | 08452315cde52fa94d8cb3e1eff1db4ea33abc88 | https://github.com/ONLYOFFICE/ooxml_parser/blob/08452315cde52fa94d8cb3e1eff1db4ea33abc88/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/autofilter.rb#L17-L32 | train |
ONLYOFFICE/ooxml_parser | lib/ooxml_parser/common_parser/common_data/paragraph.rb | OoxmlParser.Paragraph.parse | def parse(node)
node.xpath('*').each do |node_child|
case node_child.name
when 'pPr'
@properties = ParagraphProperties.new(parent: self).parse(node_child)
when 'fld'
@text_field = TextField.new(parent: self).parse(node_child)
when 'r'
@runs << Paragrap... | ruby | def parse(node)
node.xpath('*').each do |node_child|
case node_child.name
when 'pPr'
@properties = ParagraphProperties.new(parent: self).parse(node_child)
when 'fld'
@text_field = TextField.new(parent: self).parse(node_child)
when 'r'
@runs << Paragrap... | [
"def",
"parse",
"(",
"node",
")",
"node",
".",
"xpath",
"(",
"'*'",
")",
".",
"each",
"do",
"|",
"node_child",
"|",
"case",
"node_child",
".",
"name",
"when",
"'pPr'",
"@properties",
"=",
"ParagraphProperties",
".",
"new",
"(",
"parent",
":",
"self",
"... | Parse Paragraph object
@param node [Nokogiri::XML:Element] node to parse
@return [Paragraph] result of parsing | [
"Parse",
"Paragraph",
"object"
] | 08452315cde52fa94d8cb3e1eff1db4ea33abc88 | https://github.com/ONLYOFFICE/ooxml_parser/blob/08452315cde52fa94d8cb3e1eff1db4ea33abc88/lib/ooxml_parser/common_parser/common_data/paragraph.rb#L28-L42 | train |
ONLYOFFICE/ooxml_parser | lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/extension_list/extension.rb | OoxmlParser.Extension.parse | def parse(node)
node.xpath('*').each do |column_node|
case column_node.name
when 'table'
@table = X14Table.new(parent: self).parse(column_node)
when 'sparklineGroups'
@sparkline_groups = SparklineGroups.new(parent: self).parse(column_node)
end
end
se... | ruby | def parse(node)
node.xpath('*').each do |column_node|
case column_node.name
when 'table'
@table = X14Table.new(parent: self).parse(column_node)
when 'sparklineGroups'
@sparkline_groups = SparklineGroups.new(parent: self).parse(column_node)
end
end
se... | [
"def",
"parse",
"(",
"node",
")",
"node",
".",
"xpath",
"(",
"'*'",
")",
".",
"each",
"do",
"|",
"column_node",
"|",
"case",
"column_node",
".",
"name",
"when",
"'table'",
"@table",
"=",
"X14Table",
".",
"new",
"(",
"parent",
":",
"self",
")",
".",
... | Parse Extension data
@param [Nokogiri::XML:Element] node with Extension data
@return [Extension] value of Extension data | [
"Parse",
"Extension",
"data"
] | 08452315cde52fa94d8cb3e1eff1db4ea33abc88 | https://github.com/ONLYOFFICE/ooxml_parser/blob/08452315cde52fa94d8cb3e1eff1db4ea33abc88/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/extension_list/extension.rb#L14-L24 | train |
ONLYOFFICE/ooxml_parser | lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties.rb | OoxmlParser.DocxShapeProperties.parse | def parse(node)
@fill_color = DocxColor.new(parent: self).parse(node)
node.xpath('*').each do |node_child|
case node_child.name
when 'xfrm'
@shape_size = DocxShapeSize.new(parent: self).parse(node_child)
when 'prstGeom'
@preset_geometry = PresetGeometry.new(parent... | ruby | def parse(node)
@fill_color = DocxColor.new(parent: self).parse(node)
node.xpath('*').each do |node_child|
case node_child.name
when 'xfrm'
@shape_size = DocxShapeSize.new(parent: self).parse(node_child)
when 'prstGeom'
@preset_geometry = PresetGeometry.new(parent... | [
"def",
"parse",
"(",
"node",
")",
"@fill_color",
"=",
"DocxColor",
".",
"new",
"(",
"parent",
":",
"self",
")",
".",
"parse",
"(",
"node",
")",
"node",
".",
"xpath",
"(",
"'*'",
")",
".",
"each",
"do",
"|",
"node_child",
"|",
"case",
"node_child",
... | Parse DocxShapeProperties object
@param node [Nokogiri::XML:Element] node to parse
@return [DocxShapeProperties] result of parsing | [
"Parse",
"DocxShapeProperties",
"object"
] | 08452315cde52fa94d8cb3e1eff1db4ea33abc88 | https://github.com/ONLYOFFICE/ooxml_parser/blob/08452315cde52fa94d8cb3e1eff1db4ea33abc88/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties.rb#L26-L47 | train |
ONLYOFFICE/ooxml_parser | lib/ooxml_parser/common_parser/common_data/colors/color_properties.rb | OoxmlParser.ColorProperties.parse | def parse(node)
node.xpath('*').each do |node_child|
case node_child.name
when 'alpha'
@alpha = (node_child.attribute('val').value.to_f / 1_000.0).round
when 'lumMod'
@luminance_modulation = node_child.attribute('val').value.to_f / 100_000.0
when 'lumOff'
... | ruby | def parse(node)
node.xpath('*').each do |node_child|
case node_child.name
when 'alpha'
@alpha = (node_child.attribute('val').value.to_f / 1_000.0).round
when 'lumMod'
@luminance_modulation = node_child.attribute('val').value.to_f / 100_000.0
when 'lumOff'
... | [
"def",
"parse",
"(",
"node",
")",
"node",
".",
"xpath",
"(",
"'*'",
")",
".",
"each",
"do",
"|",
"node_child",
"|",
"case",
"node_child",
".",
"name",
"when",
"'alpha'",
"@alpha",
"=",
"(",
"node_child",
".",
"attribute",
"(",
"'val'",
")",
".",
"val... | Parse ColorProperties object
@param node [Nokogiri::XML:Element] node to parse
@return [ColorProperties] result of parsing | [
"Parse",
"ColorProperties",
"object"
] | 08452315cde52fa94d8cb3e1eff1db4ea33abc88 | https://github.com/ONLYOFFICE/ooxml_parser/blob/08452315cde52fa94d8cb3e1eff1db4ea33abc88/lib/ooxml_parser/common_parser/common_data/colors/color_properties.rb#L10-L24 | train |
ONLYOFFICE/ooxml_parser | lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_line.rb | OoxmlParser.DocxShapeLine.parse | def parse(node)
node.attributes.each do |key, value|
case key
when 'w'
@width = OoxmlSize.new(value.value.to_f, :emu)
when 'cap'
@cap = value_to_symbol(value)
end
end
node.xpath('*').each do |node_child|
case node_child.name
when 'so... | ruby | def parse(node)
node.attributes.each do |key, value|
case key
when 'w'
@width = OoxmlSize.new(value.value.to_f, :emu)
when 'cap'
@cap = value_to_symbol(value)
end
end
node.xpath('*').each do |node_child|
case node_child.name
when 'so... | [
"def",
"parse",
"(",
"node",
")",
"node",
".",
"attributes",
".",
"each",
"do",
"|",
"key",
",",
"value",
"|",
"case",
"key",
"when",
"'w'",
"@width",
"=",
"OoxmlSize",
".",
"new",
"(",
"value",
".",
"value",
".",
"to_f",
",",
":emu",
")",
"when",
... | Parse DocxShapeLine object
@param node [Nokogiri::XML:Element] node to parse
@return [DocxShapeLine] result of parsing | [
"Parse",
"DocxShapeLine",
"object"
] | 08452315cde52fa94d8cb3e1eff1db4ea33abc88 | https://github.com/ONLYOFFICE/ooxml_parser/blob/08452315cde52fa94d8cb3e1eff1db4ea33abc88/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_line.rb#L33-L58 | train |
ONLYOFFICE/ooxml_parser | lib/ooxml_parser/common_parser/common_data/table/table_properties.rb | OoxmlParser.TableProperties.parse | def parse(node)
node.xpath('*').each do |node_child|
case node_child.name
when 'tableStyleId'
@table_style_id = node_child.text
when 'tblBorders'
@table_borders = TableBorders.new(parent: self).parse(node_child)
when 'tblStyle'
# TODO: Incorrect but to... | ruby | def parse(node)
node.xpath('*').each do |node_child|
case node_child.name
when 'tableStyleId'
@table_style_id = node_child.text
when 'tblBorders'
@table_borders = TableBorders.new(parent: self).parse(node_child)
when 'tblStyle'
# TODO: Incorrect but to... | [
"def",
"parse",
"(",
"node",
")",
"node",
".",
"xpath",
"(",
"'*'",
")",
".",
"each",
"do",
"|",
"node_child",
"|",
"case",
"node_child",
".",
"name",
"when",
"'tableStyleId'",
"@table_style_id",
"=",
"node_child",
".",
"text",
"when",
"'tblBorders'",
"@ta... | Parse TableProperties object
@param node [Nokogiri::XML:Element] node to parse
@return [TableProperties] result of parsing | [
"Parse",
"TableProperties",
"object"
] | 08452315cde52fa94d8cb3e1eff1db4ea33abc88 | https://github.com/ONLYOFFICE/ooxml_parser/blob/08452315cde52fa94d8cb3e1eff1db4ea33abc88/lib/ooxml_parser/common_parser/common_data/table/table_properties.rb#L47-L89 | train |
ONLYOFFICE/ooxml_parser | lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/common_slide_data.rb | OoxmlParser.CommonSlideData.parse | def parse(node)
node.xpath('*').each do |node_child|
case node_child.name
when 'spTree'
@shape_tree = ShapeTree.new(parent: self).parse(node_child)
when 'bg'
@background = Background.new(parent: self).parse(node_child)
end
end
self
end | ruby | def parse(node)
node.xpath('*').each do |node_child|
case node_child.name
when 'spTree'
@shape_tree = ShapeTree.new(parent: self).parse(node_child)
when 'bg'
@background = Background.new(parent: self).parse(node_child)
end
end
self
end | [
"def",
"parse",
"(",
"node",
")",
"node",
".",
"xpath",
"(",
"'*'",
")",
".",
"each",
"do",
"|",
"node_child",
"|",
"case",
"node_child",
".",
"name",
"when",
"'spTree'",
"@shape_tree",
"=",
"ShapeTree",
".",
"new",
"(",
"parent",
":",
"self",
")",
"... | Parse CommonSlideData object
@param node [Nokogiri::XML:Element] node to parse
@return [CommonSlideData] result of parsing | [
"Parse",
"CommonSlideData",
"object"
] | 08452315cde52fa94d8cb3e1eff1db4ea33abc88 | https://github.com/ONLYOFFICE/ooxml_parser/blob/08452315cde52fa94d8cb3e1eff1db4ea33abc88/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/common_slide_data.rb#L14-L24 | train |
ONLYOFFICE/ooxml_parser | lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/table_cell_line.rb | OoxmlParser.TableCellLine.parse | def parse(node)
@fill = PresentationFill.new(parent: self).parse(node)
@line_join = LineJoin.new(parent: self).parse(node)
node.attributes.each do |key, value|
case key
when 'w'
@width = OoxmlSize.new(value.value.to_f, :emu)
when 'algn'
@align = value_to_sym... | ruby | def parse(node)
@fill = PresentationFill.new(parent: self).parse(node)
@line_join = LineJoin.new(parent: self).parse(node)
node.attributes.each do |key, value|
case key
when 'w'
@width = OoxmlSize.new(value.value.to_f, :emu)
when 'algn'
@align = value_to_sym... | [
"def",
"parse",
"(",
"node",
")",
"@fill",
"=",
"PresentationFill",
".",
"new",
"(",
"parent",
":",
"self",
")",
".",
"parse",
"(",
"node",
")",
"@line_join",
"=",
"LineJoin",
".",
"new",
"(",
"parent",
":",
"self",
")",
".",
"parse",
"(",
"node",
... | Parse TableCellLine object
@param node [Nokogiri::XML:Element] node to parse
@return [TableCellLine] result of parsing | [
"Parse",
"TableCellLine",
"object"
] | 08452315cde52fa94d8cb3e1eff1db4ea33abc88 | https://github.com/ONLYOFFICE/ooxml_parser/blob/08452315cde52fa94d8cb3e1eff1db4ea33abc88/lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/table_cell_line.rb#L16-L39 | train |
ONLYOFFICE/ooxml_parser | lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape.rb | OoxmlParser.DocxShape.parse | def parse(node)
node.xpath('*').each do |node_child|
case node_child.name
when 'nvSpPr'
@non_visual_properties = NonVisualShapeProperties.new(parent: self).parse(node_child)
when 'spPr'
@properties = DocxShapeProperties.new(parent: self).parse(node_child)
when '... | ruby | def parse(node)
node.xpath('*').each do |node_child|
case node_child.name
when 'nvSpPr'
@non_visual_properties = NonVisualShapeProperties.new(parent: self).parse(node_child)
when 'spPr'
@properties = DocxShapeProperties.new(parent: self).parse(node_child)
when '... | [
"def",
"parse",
"(",
"node",
")",
"node",
".",
"xpath",
"(",
"'*'",
")",
".",
"each",
"do",
"|",
"node_child",
"|",
"case",
"node_child",
".",
"name",
"when",
"'nvSpPr'",
"@non_visual_properties",
"=",
"NonVisualShapeProperties",
".",
"new",
"(",
"parent",
... | Parse DocxShape object
@param node [Nokogiri::XML:Element] node to parse
@return [DocxShape] result of parsing | [
"Parse",
"DocxShape",
"object"
] | 08452315cde52fa94d8cb3e1eff1db4ea33abc88 | https://github.com/ONLYOFFICE/ooxml_parser/blob/08452315cde52fa94d8cb3e1eff1db4ea33abc88/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape.rb#L26-L42 | train |
ONLYOFFICE/ooxml_parser | lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/sdt/sdt_content.rb | OoxmlParser.SDTContent.parse | def parse(node)
node.xpath('*').each do |node_child|
case node_child.name
when 'p'
@elements << DocxParagraph.new(parent: self).parse(node_child)
when 'r'
@elements << ParagraphRun.new(parent: self).parse(node_child)
when 'tbl'
@elements << Table.new(p... | ruby | def parse(node)
node.xpath('*').each do |node_child|
case node_child.name
when 'p'
@elements << DocxParagraph.new(parent: self).parse(node_child)
when 'r'
@elements << ParagraphRun.new(parent: self).parse(node_child)
when 'tbl'
@elements << Table.new(p... | [
"def",
"parse",
"(",
"node",
")",
"node",
".",
"xpath",
"(",
"'*'",
")",
".",
"each",
"do",
"|",
"node_child",
"|",
"case",
"node_child",
".",
"name",
"when",
"'p'",
"@elements",
"<<",
"DocxParagraph",
".",
"new",
"(",
"parent",
":",
"self",
")",
"."... | Parse SDTContent object
@param node [Nokogiri::XML:Element] node to parse
@return [SDTContent] result of parsing | [
"Parse",
"SDTContent",
"object"
] | 08452315cde52fa94d8cb3e1eff1db4ea33abc88 | https://github.com/ONLYOFFICE/ooxml_parser/blob/08452315cde52fa94d8cb3e1eff1db4ea33abc88/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/sdt/sdt_content.rb#L15-L27 | train |
ONLYOFFICE/ooxml_parser | lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/time_node/common_timing.rb | OoxmlParser.CommonTiming.parse | def parse(node)
node.attributes.each do |key, value|
case key
when 'dur'
@duration = value.value
when 'restart'
@restart = value.value
when 'id'
@id = value.value
end
end
node.xpath('*').each do |node_child|
case node_child... | ruby | def parse(node)
node.attributes.each do |key, value|
case key
when 'dur'
@duration = value.value
when 'restart'
@restart = value.value
when 'id'
@id = value.value
end
end
node.xpath('*').each do |node_child|
case node_child... | [
"def",
"parse",
"(",
"node",
")",
"node",
".",
"attributes",
".",
"each",
"do",
"|",
"key",
",",
"value",
"|",
"case",
"key",
"when",
"'dur'",
"@duration",
"=",
"value",
".",
"value",
"when",
"'restart'",
"@restart",
"=",
"value",
".",
"value",
"when",... | Parse CommonTiming object
@param node [Nokogiri::XML:Element] node to parse
@return [CommonTiming] result of parsing | [
"Parse",
"CommonTiming",
"object"
] | 08452315cde52fa94d8cb3e1eff1db4ea33abc88 | https://github.com/ONLYOFFICE/ooxml_parser/blob/08452315cde52fa94d8cb3e1eff1db4ea33abc88/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/time_node/common_timing.rb#L16-L39 | train |
ONLYOFFICE/ooxml_parser | lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/custom_geometry/ooxml_custom_geometry.rb | OoxmlParser.OOXMLCustomGeometry.parse | def parse(node)
node.xpath('*').each do |node_child|
case node_child.name
when 'pathLst'
node_child.xpath('a:path', 'xmlns:a' => 'http://schemas.openxmlformats.org/drawingml/2006/main').each do |path_node|
@paths_list << DocxShapeLinePath.new(parent: self).parse(path_node)
... | ruby | def parse(node)
node.xpath('*').each do |node_child|
case node_child.name
when 'pathLst'
node_child.xpath('a:path', 'xmlns:a' => 'http://schemas.openxmlformats.org/drawingml/2006/main').each do |path_node|
@paths_list << DocxShapeLinePath.new(parent: self).parse(path_node)
... | [
"def",
"parse",
"(",
"node",
")",
"node",
".",
"xpath",
"(",
"'*'",
")",
".",
"each",
"do",
"|",
"node_child",
"|",
"case",
"node_child",
".",
"name",
"when",
"'pathLst'",
"node_child",
".",
"xpath",
"(",
"'a:path'",
",",
"'xmlns:a'",
"=>",
"'http://sche... | Parse OOXMLCustomGeometry object
@param node [Nokogiri::XML:Element] node to parse
@return [OOXMLCustomGeometry] result of parsing | [
"Parse",
"OOXMLCustomGeometry",
"object"
] | 08452315cde52fa94d8cb3e1eff1db4ea33abc88 | https://github.com/ONLYOFFICE/ooxml_parser/blob/08452315cde52fa94d8cb3e1eff1db4ea33abc88/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/custom_geometry/ooxml_custom_geometry.rb#L15-L25 | train |
ONLYOFFICE/ooxml_parser | lib/ooxml_parser/common_parser/common_data/alternate_content/picture/old_docx_picture.rb | OoxmlParser.OldDocxPicture.parse | def parse(node)
node.xpath('*').each do |node_child|
case node_child.name
when 'shape'
@type = :shape
@data = OldDocxShape.new(parent: self).parse(node_child)
when 'group'
@type = :group
@data = OldDocxGroup.new(parent: self).parse(node_child)
... | ruby | def parse(node)
node.xpath('*').each do |node_child|
case node_child.name
when 'shape'
@type = :shape
@data = OldDocxShape.new(parent: self).parse(node_child)
when 'group'
@type = :group
@data = OldDocxGroup.new(parent: self).parse(node_child)
... | [
"def",
"parse",
"(",
"node",
")",
"node",
".",
"xpath",
"(",
"'*'",
")",
".",
"each",
"do",
"|",
"node_child",
"|",
"case",
"node_child",
".",
"name",
"when",
"'shape'",
"@type",
"=",
":shape",
"@data",
"=",
"OldDocxShape",
".",
"new",
"(",
"parent",
... | Parse OldDocxPicture object
@param node [Nokogiri::XML:Element] node to parse
@return [OldDocxPicture] result of parsing | [
"Parse",
"OldDocxPicture",
"object"
] | 08452315cde52fa94d8cb3e1eff1db4ea33abc88 | https://github.com/ONLYOFFICE/ooxml_parser/blob/08452315cde52fa94d8cb3e1eff1db4ea33abc88/lib/ooxml_parser/common_parser/common_data/alternate_content/picture/old_docx_picture.rb#L12-L26 | train |
ONLYOFFICE/ooxml_parser | lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula.rb | OoxmlParser.DocxFormula.parse | def parse(node)
node.xpath('*').each do |node_child|
case node_child.name
when 'r'
@formula_run << MathRun.new(parent: self).parse(node_child)
when 'box', 'borderBox'
@formula_run << Box.new(parent: self).parse(node_child)
when 'func'
@formula_run << F... | ruby | def parse(node)
node.xpath('*').each do |node_child|
case node_child.name
when 'r'
@formula_run << MathRun.new(parent: self).parse(node_child)
when 'box', 'borderBox'
@formula_run << Box.new(parent: self).parse(node_child)
when 'func'
@formula_run << F... | [
"def",
"parse",
"(",
"node",
")",
"node",
".",
"xpath",
"(",
"'*'",
")",
".",
"each",
"do",
"|",
"node_child",
"|",
"case",
"node_child",
".",
"name",
"when",
"'r'",
"@formula_run",
"<<",
"MathRun",
".",
"new",
"(",
"parent",
":",
"self",
")",
".",
... | Parse DocxFormula object
@param node [Nokogiri::XML:Element] node to parse
@return [DocxFormula] result of parsing | [
"Parse",
"DocxFormula",
"object"
] | 08452315cde52fa94d8cb3e1eff1db4ea33abc88 | https://github.com/ONLYOFFICE/ooxml_parser/blob/08452315cde52fa94d8cb3e1eff1db4ea33abc88/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula.rb#L31-L71 | train |
ONLYOFFICE/ooxml_parser | lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/non_visual_shape_properties.rb | OoxmlParser.NonVisualShapeProperties.parse | def parse(node)
node.xpath('*').each do |node_child|
case node_child.name
when 'cNvPr'
@common_properties = CommonNonVisualProperties.new(parent: self).parse(node_child)
when 'nvPr'
@non_visual_properties = NonVisualProperties.new(parent: self).parse(node_child)
... | ruby | def parse(node)
node.xpath('*').each do |node_child|
case node_child.name
when 'cNvPr'
@common_properties = CommonNonVisualProperties.new(parent: self).parse(node_child)
when 'nvPr'
@non_visual_properties = NonVisualProperties.new(parent: self).parse(node_child)
... | [
"def",
"parse",
"(",
"node",
")",
"node",
".",
"xpath",
"(",
"'*'",
")",
".",
"each",
"do",
"|",
"node_child",
"|",
"case",
"node_child",
".",
"name",
"when",
"'cNvPr'",
"@common_properties",
"=",
"CommonNonVisualProperties",
".",
"new",
"(",
"parent",
":"... | Parse NonVisualShapeProperties object
@param node [Nokogiri::XML:Element] node to parse
@return [NonVisualShapeProperties] result of parsing | [
"Parse",
"NonVisualShapeProperties",
"object"
] | 08452315cde52fa94d8cb3e1eff1db4ea33abc88 | https://github.com/ONLYOFFICE/ooxml_parser/blob/08452315cde52fa94d8cb3e1eff1db4ea33abc88/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/non_visual_shape_properties.rb#L10-L20 | train |
ONLYOFFICE/ooxml_parser | lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_column_properties.rb | OoxmlParser.XlsxColumnProperties.parse | def parse(node)
node.attributes.each do |key, value|
case key
when 'min'
@from = value.value.to_i
when 'max'
@to = value.value.to_i
when 'style'
@style = root_object.style_sheet.cell_xfs.xf_array[value.value.to_i]
when 'width'
@width ... | ruby | def parse(node)
node.attributes.each do |key, value|
case key
when 'min'
@from = value.value.to_i
when 'max'
@to = value.value.to_i
when 'style'
@style = root_object.style_sheet.cell_xfs.xf_array[value.value.to_i]
when 'width'
@width ... | [
"def",
"parse",
"(",
"node",
")",
"node",
".",
"attributes",
".",
"each",
"do",
"|",
"key",
",",
"value",
"|",
"case",
"key",
"when",
"'min'",
"@from",
"=",
"value",
".",
"value",
".",
"to_i",
"when",
"'max'",
"@to",
"=",
"value",
".",
"value",
"."... | Parse XlsxColumnProperties object
@param node [Nokogiri::XML:Element] node to parse
@return [XlsxColumnProperties] result of parsing | [
"Parse",
"XlsxColumnProperties",
"object"
] | 08452315cde52fa94d8cb3e1eff1db4ea33abc88 | https://github.com/ONLYOFFICE/ooxml_parser/blob/08452315cde52fa94d8cb3e1eff1db4ea33abc88/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_column_properties.rb#L17-L37 | train |
ONLYOFFICE/ooxml_parser | lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/ooxml_text_box.rb | OoxmlParser.OOXMLTextBox.parse | def parse(node)
text_box_content_node = node.xpath('w:txbxContent').first
text_box_content_node.xpath('*').each_with_index do |node_child, index|
case node_child.name
when 'p'
@elements << DocxParagraph.new(parent: self).parse(node_child, index)
when 'tbl'
@elemen... | ruby | def parse(node)
text_box_content_node = node.xpath('w:txbxContent').first
text_box_content_node.xpath('*').each_with_index do |node_child, index|
case node_child.name
when 'p'
@elements << DocxParagraph.new(parent: self).parse(node_child, index)
when 'tbl'
@elemen... | [
"def",
"parse",
"(",
"node",
")",
"text_box_content_node",
"=",
"node",
".",
"xpath",
"(",
"'w:txbxContent'",
")",
".",
"first",
"text_box_content_node",
".",
"xpath",
"(",
"'*'",
")",
".",
"each_with_index",
"do",
"|",
"node_child",
",",
"index",
"|",
"case... | Parse OOXMLTextBox object
@param node [Nokogiri::XML:Element] node to parse
@return [OOXMLTextBox] result of parsing | [
"Parse",
"OOXMLTextBox",
"object"
] | 08452315cde52fa94d8cb3e1eff1db4ea33abc88 | https://github.com/ONLYOFFICE/ooxml_parser/blob/08452315cde52fa94d8cb3e1eff1db4ea33abc88/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/ooxml_text_box.rb#L14-L27 | train |
ONLYOFFICE/ooxml_parser | lib/ooxml_parser/docx_parser/docx_data/document_structure/document_style/document_style_helper.rb | OoxmlParser.DocumentStyleHelper.document_style_by_name | def document_style_by_name(name)
root_object.document_styles.each do |style|
return style if style.name == name
end
nil
end | ruby | def document_style_by_name(name)
root_object.document_styles.each do |style|
return style if style.name == name
end
nil
end | [
"def",
"document_style_by_name",
"(",
"name",
")",
"root_object",
".",
"document_styles",
".",
"each",
"do",
"|",
"style",
"|",
"return",
"style",
"if",
"style",
".",
"name",
"==",
"name",
"end",
"nil",
"end"
] | Return document style by its name
@param name [String] name of style
@return [DocumentStyle, nil] | [
"Return",
"document",
"style",
"by",
"its",
"name"
] | 08452315cde52fa94d8cb3e1eff1db4ea33abc88 | https://github.com/ONLYOFFICE/ooxml_parser/blob/08452315cde52fa94d8cb3e1eff1db4ea33abc88/lib/ooxml_parser/docx_parser/docx_data/document_structure/document_style/document_style_helper.rb#L7-L12 | train |
ONLYOFFICE/ooxml_parser | lib/ooxml_parser/docx_parser/docx_data/document_structure/document_style/document_style_helper.rb | OoxmlParser.DocumentStyleHelper.document_style_by_id | def document_style_by_id(id)
root_object.document_styles.each do |style|
return style if style.style_id == id
end
nil
end | ruby | def document_style_by_id(id)
root_object.document_styles.each do |style|
return style if style.style_id == id
end
nil
end | [
"def",
"document_style_by_id",
"(",
"id",
")",
"root_object",
".",
"document_styles",
".",
"each",
"do",
"|",
"style",
"|",
"return",
"style",
"if",
"style",
".",
"style_id",
"==",
"id",
"end",
"nil",
"end"
] | Return document style by its id
@param id [String] id of style
@return [DocumentStyle, nil] | [
"Return",
"document",
"style",
"by",
"its",
"id"
] | 08452315cde52fa94d8cb3e1eff1db4ea33abc88 | https://github.com/ONLYOFFICE/ooxml_parser/blob/08452315cde52fa94d8cb3e1eff1db4ea33abc88/lib/ooxml_parser/docx_parser/docx_data/document_structure/document_style/document_style_helper.rb#L17-L22 | train |
ONLYOFFICE/ooxml_parser | lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/box.rb | OoxmlParser.Box.parse | def parse(node)
@borders = true if node.name == 'borderBox'
@element = MathRun.new(parent: self).parse(node)
self
end | ruby | def parse(node)
@borders = true if node.name == 'borderBox'
@element = MathRun.new(parent: self).parse(node)
self
end | [
"def",
"parse",
"(",
"node",
")",
"@borders",
"=",
"true",
"if",
"node",
".",
"name",
"==",
"'borderBox'",
"@element",
"=",
"MathRun",
".",
"new",
"(",
"parent",
":",
"self",
")",
".",
"parse",
"(",
"node",
")",
"self",
"end"
] | Parse Box object
@param node [Nokogiri::XML:Element] node to parse
@return [Box] result of parsing | [
"Parse",
"Box",
"object"
] | 08452315cde52fa94d8cb3e1eff1db4ea33abc88 | https://github.com/ONLYOFFICE/ooxml_parser/blob/08452315cde52fa94d8cb3e1eff1db4ea33abc88/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/box.rb#L14-L18 | train |
ONLYOFFICE/ooxml_parser | lib/ooxml_parser/common_parser/common_data/colors/image_fill.rb | OoxmlParser.ImageFill.parse | def parse(node)
node.xpath('*').each do |node_child|
case node_child.name
when 'blip'
@file_reference = FileReference.new(parent: self).parse(node_child)
when 'tile'
@tile = Tile.new(OOXMLCoordinates.parse(node_child, x_attr: 'tx', y_attr: 'ty'),
... | ruby | def parse(node)
node.xpath('*').each do |node_child|
case node_child.name
when 'blip'
@file_reference = FileReference.new(parent: self).parse(node_child)
when 'tile'
@tile = Tile.new(OOXMLCoordinates.parse(node_child, x_attr: 'tx', y_attr: 'ty'),
... | [
"def",
"parse",
"(",
"node",
")",
"node",
".",
"xpath",
"(",
"'*'",
")",
".",
"each",
"do",
"|",
"node_child",
"|",
"case",
"node_child",
".",
"name",
"when",
"'blip'",
"@file_reference",
"=",
"FileReference",
".",
"new",
"(",
"parent",
":",
"self",
")... | Parse ImageFill object
@param node [Nokogiri::XML:Element] node to parse
@return [ImageFill] result of parsing | [
"Parse",
"ImageFill",
"object"
] | 08452315cde52fa94d8cb3e1eff1db4ea33abc88 | https://github.com/ONLYOFFICE/ooxml_parser/blob/08452315cde52fa94d8cb3e1eff1db4ea33abc88/lib/ooxml_parser/common_parser/common_data/colors/image_fill.rb#L16-L28 | train |
ONLYOFFICE/ooxml_parser | lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing.rb | OoxmlParser.Timing.parse | def parse(node)
node.xpath('*').each do |node_child|
case node_child.name
when 'tnLst'
@time_node_list = TimeNode.parse_list(node_child)
end
end
self
end | ruby | def parse(node)
node.xpath('*').each do |node_child|
case node_child.name
when 'tnLst'
@time_node_list = TimeNode.parse_list(node_child)
end
end
self
end | [
"def",
"parse",
"(",
"node",
")",
"node",
".",
"xpath",
"(",
"'*'",
")",
".",
"each",
"do",
"|",
"node_child",
"|",
"case",
"node_child",
".",
"name",
"when",
"'tnLst'",
"@time_node_list",
"=",
"TimeNode",
".",
"parse_list",
"(",
"node_child",
")",
"end"... | Parse Timing object
@param node [Nokogiri::XML:Element] node to parse
@return [Timing] result of parsing | [
"Parse",
"Timing",
"object"
] | 08452315cde52fa94d8cb3e1eff1db4ea33abc88 | https://github.com/ONLYOFFICE/ooxml_parser/blob/08452315cde52fa94d8cb3e1eff1db4ea33abc88/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing.rb#L17-L25 | train |
ONLYOFFICE/ooxml_parser | lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/style_parametres.rb | OoxmlParser.StyleParametres.parse | def parse(node)
node.xpath('*').each do |node_child|
case node_child.name
when 'name'
@name = node_child.attribute('val').value
when 'qFormat'
@q_format = option_enabled?(node_child)
end
end
self
end | ruby | def parse(node)
node.xpath('*').each do |node_child|
case node_child.name
when 'name'
@name = node_child.attribute('val').value
when 'qFormat'
@q_format = option_enabled?(node_child)
end
end
self
end | [
"def",
"parse",
"(",
"node",
")",
"node",
".",
"xpath",
"(",
"'*'",
")",
".",
"each",
"do",
"|",
"node_child",
"|",
"case",
"node_child",
".",
"name",
"when",
"'name'",
"@name",
"=",
"node_child",
".",
"attribute",
"(",
"'val'",
")",
".",
"value",
"w... | Parse StyleParametres data
@param [Nokogiri::XML:Element] node with StyleParametres data
@return [StyleParametres] value of Columns data | [
"Parse",
"StyleParametres",
"data"
] | 08452315cde52fa94d8cb3e1eff1db4ea33abc88 | https://github.com/ONLYOFFICE/ooxml_parser/blob/08452315cde52fa94d8cb3e1eff1db4ea33abc88/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/style_parametres.rb#L19-L29 | train |
ONLYOFFICE/ooxml_parser | lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/spacing.rb | OoxmlParser.Spacing.parse | def parse(node)
node.xpath('*').each do |spacing_node_child|
case spacing_node_child.name
when 'lnSpc'
self.line = Spacing.parse_spacing_value(spacing_node_child)
self.line_rule = Spacing.parse_spacing_rule(spacing_node_child)
when 'spcBef'
self.before = Spaci... | ruby | def parse(node)
node.xpath('*').each do |spacing_node_child|
case spacing_node_child.name
when 'lnSpc'
self.line = Spacing.parse_spacing_value(spacing_node_child)
self.line_rule = Spacing.parse_spacing_rule(spacing_node_child)
when 'spcBef'
self.before = Spaci... | [
"def",
"parse",
"(",
"node",
")",
"node",
".",
"xpath",
"(",
"'*'",
")",
".",
"each",
"do",
"|",
"spacing_node_child",
"|",
"case",
"spacing_node_child",
".",
"name",
"when",
"'lnSpc'",
"self",
".",
"line",
"=",
"Spacing",
".",
"parse_spacing_value",
"(",
... | Parse data for Spacing
@param [Nokogiri::XML:Element] node with Spacing
@return [Nothing] | [
"Parse",
"data",
"for",
"Spacing"
] | 08452315cde52fa94d8cb3e1eff1db4ea33abc88 | https://github.com/ONLYOFFICE/ooxml_parser/blob/08452315cde52fa94d8cb3e1eff1db4ea33abc88/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/spacing.rb#L71-L83 | train |
ONLYOFFICE/ooxml_parser | lib/ooxml_parser/common_parser/common_data/colors/presentation_fill/gradient_color/gradient_stop.rb | OoxmlParser.GradientStop.parse | def parse(node)
node.attributes.each do |key, value|
case key
when 'pos'
@position = value.value.to_i / 1_000
end
end
node.xpath('*').each do |node_child|
@color = case node_child.name
when 'prstClr'
ValuedChild.new(:string... | ruby | def parse(node)
node.attributes.each do |key, value|
case key
when 'pos'
@position = value.value.to_i / 1_000
end
end
node.xpath('*').each do |node_child|
@color = case node_child.name
when 'prstClr'
ValuedChild.new(:string... | [
"def",
"parse",
"(",
"node",
")",
"node",
".",
"attributes",
".",
"each",
"do",
"|",
"key",
",",
"value",
"|",
"case",
"key",
"when",
"'pos'",
"@position",
"=",
"value",
".",
"value",
".",
"to_i",
"/",
"1_000",
"end",
"end",
"node",
".",
"xpath",
"... | Parse GradientStop object
@param node [Nokogiri::XML:Element] node to parse
@return [GradientStop] result of parsing | [
"Parse",
"GradientStop",
"object"
] | 08452315cde52fa94d8cb3e1eff1db4ea33abc88 | https://github.com/ONLYOFFICE/ooxml_parser/blob/08452315cde52fa94d8cb3e1eff1db4ea33abc88/lib/ooxml_parser/common_parser/common_data/colors/presentation_fill/gradient_color/gradient_stop.rb#L8-L25 | train |
ONLYOFFICE/ooxml_parser | lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties/blip_fill/blip/alpha_mod_fix.rb | OoxmlParser.AlphaModFix.parse | def parse(node)
node.attributes.each do |key, value|
case key
when 'amt'
@amount = OoxmlSize.new(value.value.to_f, :one_1000th_percent)
end
end
self
end | ruby | def parse(node)
node.attributes.each do |key, value|
case key
when 'amt'
@amount = OoxmlSize.new(value.value.to_f, :one_1000th_percent)
end
end
self
end | [
"def",
"parse",
"(",
"node",
")",
"node",
".",
"attributes",
".",
"each",
"do",
"|",
"key",
",",
"value",
"|",
"case",
"key",
"when",
"'amt'",
"@amount",
"=",
"OoxmlSize",
".",
"new",
"(",
"value",
".",
"value",
".",
"to_f",
",",
":one_1000th_percent",... | Parse AlphaModFix object
@param node [Nokogiri::XML:Element] node to parse
@return [AlphaModFix] result of parsing | [
"Parse",
"AlphaModFix",
"object"
] | 08452315cde52fa94d8cb3e1eff1db4ea33abc88 | https://github.com/ONLYOFFICE/ooxml_parser/blob/08452315cde52fa94d8cb3e1eff1db4ea33abc88/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties/blip_fill/blip/alpha_mod_fix.rb#L9-L17 | train |
ONLYOFFICE/ooxml_parser | lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part.rb | OoxmlParser.TablePart.parse | def parse(node)
link_to_table_part_xml = OOXMLDocumentObject.get_link_from_rels(node.attribute('id').value)
doc = parse_xml(OOXMLDocumentObject.path_to_folder + link_to_table_part_xml.gsub('..', 'xl'))
table_node = doc.xpath('xmlns:table').first
table_node.attributes.each do |key, value|
... | ruby | def parse(node)
link_to_table_part_xml = OOXMLDocumentObject.get_link_from_rels(node.attribute('id').value)
doc = parse_xml(OOXMLDocumentObject.path_to_folder + link_to_table_part_xml.gsub('..', 'xl'))
table_node = doc.xpath('xmlns:table').first
table_node.attributes.each do |key, value|
... | [
"def",
"parse",
"(",
"node",
")",
"link_to_table_part_xml",
"=",
"OOXMLDocumentObject",
".",
"get_link_from_rels",
"(",
"node",
".",
"attribute",
"(",
"'id'",
")",
".",
"value",
")",
"doc",
"=",
"parse_xml",
"(",
"OOXMLDocumentObject",
".",
"path_to_folder",
"+"... | Parse TablePart object
@param node [Nokogiri::XML:Element] node to parse
@return [TablePart] result of parsing | [
"Parse",
"TablePart",
"object"
] | 08452315cde52fa94d8cb3e1eff1db4ea33abc88 | https://github.com/ONLYOFFICE/ooxml_parser/blob/08452315cde52fa94d8cb3e1eff1db4ea33abc88/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part.rb#L19-L46 | train |
ONLYOFFICE/ooxml_parser | lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/sheet_view.rb | OoxmlParser.SheetView.parse | def parse(node)
node.attributes.each_key do |key|
case key
when 'showGridLines'
@show_gridlines = attribute_enabled?(node, key)
when 'showRowColHeaders'
@show_row_column_headers = attribute_enabled?(node, key)
end
end
node.xpath('*').each do |node_c... | ruby | def parse(node)
node.attributes.each_key do |key|
case key
when 'showGridLines'
@show_gridlines = attribute_enabled?(node, key)
when 'showRowColHeaders'
@show_row_column_headers = attribute_enabled?(node, key)
end
end
node.xpath('*').each do |node_c... | [
"def",
"parse",
"(",
"node",
")",
"node",
".",
"attributes",
".",
"each_key",
"do",
"|",
"key",
"|",
"case",
"key",
"when",
"'showGridLines'",
"@show_gridlines",
"=",
"attribute_enabled?",
"(",
"node",
",",
"key",
")",
"when",
"'showRowColHeaders'",
"@show_row... | Parse SheetView object
@param node [Nokogiri::XML:Element] node to parse
@return [SheetView] result of parsing | [
"Parse",
"SheetView",
"object"
] | 08452315cde52fa94d8cb3e1eff1db4ea33abc88 | https://github.com/ONLYOFFICE/ooxml_parser/blob/08452315cde52fa94d8cb3e1eff1db4ea33abc88/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/sheet_view.rb#L20-L37 | train |
ONLYOFFICE/ooxml_parser | lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/docx_drawing_position.rb | OoxmlParser.DocxDrawingPosition.parse | def parse(node)
node.attributes.each do |key, value|
case key
when 'relativeFrom'
@relative_from = value_to_symbol(value)
end
end
node.xpath('*').each do |node_child|
case node_child.name
when 'posOffset', 'pctPosHOffset', 'pctPosVOffset'
@o... | ruby | def parse(node)
node.attributes.each do |key, value|
case key
when 'relativeFrom'
@relative_from = value_to_symbol(value)
end
end
node.xpath('*').each do |node_child|
case node_child.name
when 'posOffset', 'pctPosHOffset', 'pctPosVOffset'
@o... | [
"def",
"parse",
"(",
"node",
")",
"node",
".",
"attributes",
".",
"each",
"do",
"|",
"key",
",",
"value",
"|",
"case",
"key",
"when",
"'relativeFrom'",
"@relative_from",
"=",
"value_to_symbol",
"(",
"value",
")",
"end",
"end",
"node",
".",
"xpath",
"(",
... | Parse DocxDrawingPosition object
@param node [Nokogiri::XML:Element] node to parse
@return [DocxDrawingPosition] result of parsing | [
"Parse",
"DocxDrawingPosition",
"object"
] | 08452315cde52fa94d8cb3e1eff1db4ea33abc88 | https://github.com/ONLYOFFICE/ooxml_parser/blob/08452315cde52fa94d8cb3e1eff1db4ea33abc88/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/docx_drawing_position.rb#L9-L26 | train |
ONLYOFFICE/ooxml_parser | lib/ooxml_parser/common_parser/common_data/alternate_content/picture/shape/old_docx_shape.rb | OoxmlParser.OldDocxShape.parse | def parse(node)
@properties = OldDocxShapeProperties.new(parent: self).parse(node)
node.xpath('*').each do |node_child|
case node_child.name
when 'textbox'
@text_box = TextBox.parse_list(node_child, parent: self)
when 'imagedata'
@file_reference = FileReference.ne... | ruby | def parse(node)
@properties = OldDocxShapeProperties.new(parent: self).parse(node)
node.xpath('*').each do |node_child|
case node_child.name
when 'textbox'
@text_box = TextBox.parse_list(node_child, parent: self)
when 'imagedata'
@file_reference = FileReference.ne... | [
"def",
"parse",
"(",
"node",
")",
"@properties",
"=",
"OldDocxShapeProperties",
".",
"new",
"(",
"parent",
":",
"self",
")",
".",
"parse",
"(",
"node",
")",
"node",
".",
"xpath",
"(",
"'*'",
")",
".",
"each",
"do",
"|",
"node_child",
"|",
"case",
"no... | Parse OldDocxShape object
@param node [Nokogiri::XML:Element] node to parse
@return [OldDocxShape] result of parsing | [
"Parse",
"OldDocxShape",
"object"
] | 08452315cde52fa94d8cb3e1eff1db4ea33abc88 | https://github.com/ONLYOFFICE/ooxml_parser/blob/08452315cde52fa94d8cb3e1eff1db4ea33abc88/lib/ooxml_parser/common_parser/common_data/alternate_content/picture/shape/old_docx_shape.rb#L12-L25 | train |
ONLYOFFICE/ooxml_parser | lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_row/xlsx_cell/formula.rb | OoxmlParser.Formula.parse | def parse(node)
node.attributes.each do |key, value|
case key
when 'ref'
@reference = Coordinates.parser_coordinates_range(value.value.to_s)
when 'si'
@string_index = value.value.to_i
when 't'
@type = value.value.to_s
end
end
@valu... | ruby | def parse(node)
node.attributes.each do |key, value|
case key
when 'ref'
@reference = Coordinates.parser_coordinates_range(value.value.to_s)
when 'si'
@string_index = value.value.to_i
when 't'
@type = value.value.to_s
end
end
@valu... | [
"def",
"parse",
"(",
"node",
")",
"node",
".",
"attributes",
".",
"each",
"do",
"|",
"key",
",",
"value",
"|",
"case",
"key",
"when",
"'ref'",
"@reference",
"=",
"Coordinates",
".",
"parser_coordinates_range",
"(",
"value",
".",
"value",
".",
"to_s",
")"... | Parse Formula object
@param node [Nokogiri::XML:Element] node to parse
@return [Formula] parsed object | [
"Parse",
"Formula",
"object"
] | 08452315cde52fa94d8cb3e1eff1db4ea33abc88 | https://github.com/ONLYOFFICE/ooxml_parser/blob/08452315cde52fa94d8cb3e1eff1db4ea33abc88/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_row/xlsx_cell/formula.rb#L16-L30 | train |
ONLYOFFICE/ooxml_parser | lib/ooxml_parser/common_parser/common_data/relationships.rb | OoxmlParser.Relationships.parse_file | def parse_file(file_path)
node = parse_xml(file_path)
node.xpath('*').each do |node_child|
case node_child.name
when 'Relationships'
parse(node_child)
end
end
self
end | ruby | def parse_file(file_path)
node = parse_xml(file_path)
node.xpath('*').each do |node_child|
case node_child.name
when 'Relationships'
parse(node_child)
end
end
self
end | [
"def",
"parse_file",
"(",
"file_path",
")",
"node",
"=",
"parse_xml",
"(",
"file_path",
")",
"node",
".",
"xpath",
"(",
"'*'",
")",
".",
"each",
"do",
"|",
"node_child",
"|",
"case",
"node_child",
".",
"name",
"when",
"'Relationships'",
"parse",
"(",
"no... | Parse .rels file
@param file_path [String] path to file
@return [Relationships] | [
"Parse",
".",
"rels",
"file"
] | 08452315cde52fa94d8cb3e1eff1db4ea33abc88 | https://github.com/ONLYOFFICE/ooxml_parser/blob/08452315cde52fa94d8cb3e1eff1db4ea33abc88/lib/ooxml_parser/common_parser/common_data/relationships.rb#L34-L43 | train |
ONLYOFFICE/ooxml_parser | lib/ooxml_parser/common_parser/common_data/relationships.rb | OoxmlParser.Relationships.target_by_type | def target_by_type(type)
result = []
@relationship.each do |cur_rels|
result << cur_rels.target if cur_rels.type.include?(type)
end
result
end | ruby | def target_by_type(type)
result = []
@relationship.each do |cur_rels|
result << cur_rels.target if cur_rels.type.include?(type)
end
result
end | [
"def",
"target_by_type",
"(",
"type",
")",
"result",
"=",
"[",
"]",
"@relationship",
".",
"each",
"do",
"|",
"cur_rels",
"|",
"result",
"<<",
"cur_rels",
".",
"target",
"if",
"cur_rels",
".",
"type",
".",
"include?",
"(",
"type",
")",
"end",
"result",
... | Get target names by type
@param type [String] type of target
@return [Array<String>] target names | [
"Get",
"target",
"names",
"by",
"type"
] | 08452315cde52fa94d8cb3e1eff1db4ea33abc88 | https://github.com/ONLYOFFICE/ooxml_parser/blob/08452315cde52fa94d8cb3e1eff1db4ea33abc88/lib/ooxml_parser/common_parser/common_data/relationships.rb#L58-L64 | train |
ONLYOFFICE/ooxml_parser | lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering/numbering_level.rb | OoxmlParser.NumberingLevel.parse | def parse(node)
node.attributes.each do |key, value|
case key
when 'ilvl'
@ilvl = value.value.to_f
end
end
node.xpath('*').each do |num_level_child|
case num_level_child.name
when 'start'
@start = ValuedChild.new(:integer, parent: self).pars... | ruby | def parse(node)
node.attributes.each do |key, value|
case key
when 'ilvl'
@ilvl = value.value.to_f
end
end
node.xpath('*').each do |num_level_child|
case num_level_child.name
when 'start'
@start = ValuedChild.new(:integer, parent: self).pars... | [
"def",
"parse",
"(",
"node",
")",
"node",
".",
"attributes",
".",
"each",
"do",
"|",
"key",
",",
"value",
"|",
"case",
"key",
"when",
"'ilvl'",
"@ilvl",
"=",
"value",
".",
"value",
".",
"to_f",
"end",
"end",
"node",
".",
"xpath",
"(",
"'*'",
")",
... | Parse Numbering Level data
@param [Nokogiri::XML:Element] node with Numbering Level data
@return [NumberingLevel] value of Numbering Level data | [
"Parse",
"Numbering",
"Level",
"data"
] | 08452315cde52fa94d8cb3e1eff1db4ea33abc88 | https://github.com/ONLYOFFICE/ooxml_parser/blob/08452315cde52fa94d8cb3e1eff1db4ea33abc88/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering/numbering_level.rb#L34-L62 | train |
ONLYOFFICE/ooxml_parser | lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/cell_xfs.rb | OoxmlParser.CellXfs.parse | def parse(node)
node.attributes.each do |key, value|
case key
when 'count'
@count = value.value.to_i
end
end
node.xpath('*').each do |node_child|
case node_child.name
when 'xf'
@xf_array << Xf.new(parent: self).parse(node_child)
end
... | ruby | def parse(node)
node.attributes.each do |key, value|
case key
when 'count'
@count = value.value.to_i
end
end
node.xpath('*').each do |node_child|
case node_child.name
when 'xf'
@xf_array << Xf.new(parent: self).parse(node_child)
end
... | [
"def",
"parse",
"(",
"node",
")",
"node",
".",
"attributes",
".",
"each",
"do",
"|",
"key",
",",
"value",
"|",
"case",
"key",
"when",
"'count'",
"@count",
"=",
"value",
".",
"value",
".",
"to_i",
"end",
"end",
"node",
".",
"xpath",
"(",
"'*'",
")",... | Parse CellXfs data
@param [Nokogiri::XML:Element] node with CellXfs data
@return [CellXfs] value of CellXfs data | [
"Parse",
"CellXfs",
"data"
] | 08452315cde52fa94d8cb3e1eff1db4ea33abc88 | https://github.com/ONLYOFFICE/ooxml_parser/blob/08452315cde52fa94d8cb3e1eff1db4ea33abc88/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/cell_xfs.rb#L18-L33 | train |
ONLYOFFICE/ooxml_parser | lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/picture/docx_blip.rb | OoxmlParser.DocxBlip.parse | def parse(node)
blip_node = node.xpath('a:blip', 'xmlns:a' => 'http://schemas.openxmlformats.org/drawingml/2006/main').first
return self if blip_node.nil?
@file_reference = FileReference.new(parent: self).parse(blip_node)
self
end | ruby | def parse(node)
blip_node = node.xpath('a:blip', 'xmlns:a' => 'http://schemas.openxmlformats.org/drawingml/2006/main').first
return self if blip_node.nil?
@file_reference = FileReference.new(parent: self).parse(blip_node)
self
end | [
"def",
"parse",
"(",
"node",
")",
"blip_node",
"=",
"node",
".",
"xpath",
"(",
"'a:blip'",
",",
"'xmlns:a'",
"=>",
"'http://schemas.openxmlformats.org/drawingml/2006/main'",
")",
".",
"first",
"return",
"self",
"if",
"blip_node",
".",
"nil?",
"@file_reference",
"=... | Parse DocxBlip object
@param node [Nokogiri::XML:Element] node to parse
@return [DocxBlip] result of parsing | [
"Parse",
"DocxBlip",
"object"
] | 08452315cde52fa94d8cb3e1eff1db4ea33abc88 | https://github.com/ONLYOFFICE/ooxml_parser/blob/08452315cde52fa94d8cb3e1eff1db4ea33abc88/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/picture/docx_blip.rb#L18-L24 | train |
ONLYOFFICE/ooxml_parser | lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/graphic_frame/graphic_frame.rb | OoxmlParser.GraphicFrame.parse | def parse(node)
node.xpath('*').each do |node_child|
case node_child.name
when 'xfrm'
@transform = DocxShapeSize.new(parent: self).parse(node_child)
when 'graphic'
graphic_data = []
node_child.xpath('*').each do |node_child_child|
case node_child_c... | ruby | def parse(node)
node.xpath('*').each do |node_child|
case node_child.name
when 'xfrm'
@transform = DocxShapeSize.new(parent: self).parse(node_child)
when 'graphic'
graphic_data = []
node_child.xpath('*').each do |node_child_child|
case node_child_c... | [
"def",
"parse",
"(",
"node",
")",
"node",
".",
"xpath",
"(",
"'*'",
")",
".",
"each",
"do",
"|",
"node_child",
"|",
"case",
"node_child",
".",
"name",
"when",
"'xfrm'",
"@transform",
"=",
"DocxShapeSize",
".",
"new",
"(",
"parent",
":",
"self",
")",
... | Parse GraphicFrame object
@param node [Nokogiri::XML:Element] node to parse
@return [GraphicFrame] result of parsing | [
"Parse",
"GraphicFrame",
"object"
] | 08452315cde52fa94d8cb3e1eff1db4ea33abc88 | https://github.com/ONLYOFFICE/ooxml_parser/blob/08452315cde52fa94d8cb3e1eff1db4ea33abc88/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/graphic_frame/graphic_frame.rb#L16-L46 | train |
ONLYOFFICE/ooxml_parser | lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_size.rb | OoxmlParser.DocxShapeSize.parse | def parse(node)
node.attributes.each do |key, value|
case key
when 'rot'
@rotation = value.value.to_f
when 'flipH'
@flip_horizontal = attribute_enabled?(value)
when 'flipV'
@flip_vertical = attribute_enabled?(value)
end
end
node.xpa... | ruby | def parse(node)
node.attributes.each do |key, value|
case key
when 'rot'
@rotation = value.value.to_f
when 'flipH'
@flip_horizontal = attribute_enabled?(value)
when 'flipV'
@flip_vertical = attribute_enabled?(value)
end
end
node.xpa... | [
"def",
"parse",
"(",
"node",
")",
"node",
".",
"attributes",
".",
"each",
"do",
"|",
"key",
",",
"value",
"|",
"case",
"key",
"when",
"'rot'",
"@rotation",
"=",
"value",
".",
"value",
".",
"to_f",
"when",
"'flipH'",
"@flip_horizontal",
"=",
"attribute_en... | Parse DocxShapeSize object
@param node [Nokogiri::XML:Element] node to parse
@return [DocxShapeSize] result of parsing | [
"Parse",
"DocxShapeSize",
"object"
] | 08452315cde52fa94d8cb3e1eff1db4ea33abc88 | https://github.com/ONLYOFFICE/ooxml_parser/blob/08452315cde52fa94d8cb3e1eff1db4ea33abc88/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_size.rb#L17-L41 | train |
ONLYOFFICE/ooxml_parser | lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/docx_wrap_drawing.rb | OoxmlParser.DocxWrapDrawing.parse | def parse(node)
unless node.attribute('behindDoc').nil?
@wrap_text = :behind if node.attribute('behindDoc').value == '1'
@wrap_text = :infront if node.attribute('behindDoc').value == '0'
end
node.xpath('*').each do |node_child|
case node_child.name
when 'wrapSquare'
... | ruby | def parse(node)
unless node.attribute('behindDoc').nil?
@wrap_text = :behind if node.attribute('behindDoc').value == '1'
@wrap_text = :infront if node.attribute('behindDoc').value == '0'
end
node.xpath('*').each do |node_child|
case node_child.name
when 'wrapSquare'
... | [
"def",
"parse",
"(",
"node",
")",
"unless",
"node",
".",
"attribute",
"(",
"'behindDoc'",
")",
".",
"nil?",
"@wrap_text",
"=",
":behind",
"if",
"node",
".",
"attribute",
"(",
"'behindDoc'",
")",
".",
"value",
"==",
"'1'",
"@wrap_text",
"=",
":infront",
"... | Parse DocxWrapDrawing object
@param node [Nokogiri::XML:Element] node to parse
@return [DocxWrapDrawing] result of parsing | [
"Parse",
"DocxWrapDrawing",
"object"
] | 08452315cde52fa94d8cb3e1eff1db4ea33abc88 | https://github.com/ONLYOFFICE/ooxml_parser/blob/08452315cde52fa94d8cb3e1eff1db4ea33abc88/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/docx_wrap_drawing.rb#L14-L40 | train |
ONLYOFFICE/ooxml_parser | lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/custom_geometry/docx_custom_geometry/docx_shape_line_path.rb | OoxmlParser.DocxShapeLinePath.parse | def parse(node)
node.attributes.each do |key, value|
case key
when 'w'
@width = value.value.to_f
when 'h'
@height = value.value.to_f
when 'stroke'
@stroke = value.value.to_f
end
end
node.xpath('*').each do |node_child|
@elem... | ruby | def parse(node)
node.attributes.each do |key, value|
case key
when 'w'
@width = value.value.to_f
when 'h'
@height = value.value.to_f
when 'stroke'
@stroke = value.value.to_f
end
end
node.xpath('*').each do |node_child|
@elem... | [
"def",
"parse",
"(",
"node",
")",
"node",
".",
"attributes",
".",
"each",
"do",
"|",
"key",
",",
"value",
"|",
"case",
"key",
"when",
"'w'",
"@width",
"=",
"value",
".",
"value",
".",
"to_f",
"when",
"'h'",
"@height",
"=",
"value",
".",
"value",
".... | Parse DocxShapeLinePath object
@param node [Nokogiri::XML:Element] node to parse
@return [DocxShapeLinePath] result of parsing | [
"Parse",
"DocxShapeLinePath",
"object"
] | 08452315cde52fa94d8cb3e1eff1db4ea33abc88 | https://github.com/ONLYOFFICE/ooxml_parser/blob/08452315cde52fa94d8cb3e1eff1db4ea33abc88/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/custom_geometry/docx_custom_geometry/docx_shape_line_path.rb#L15-L30 | train |
ONLYOFFICE/ooxml_parser | lib/ooxml_parser/common_parser/common_data/colors/presentation_fill.rb | OoxmlParser.PresentationFill.parse | def parse(node)
return nil if node.xpath('*').empty?
node.xpath('*').each do |node_child|
case node_child.name
when 'gradFill'
@type = :gradient
@color = GradientColor.new(parent: self).parse(node_child)
when 'solidFill'
@type = :solid
@color ... | ruby | def parse(node)
return nil if node.xpath('*').empty?
node.xpath('*').each do |node_child|
case node_child.name
when 'gradFill'
@type = :gradient
@color = GradientColor.new(parent: self).parse(node_child)
when 'solidFill'
@type = :solid
@color ... | [
"def",
"parse",
"(",
"node",
")",
"return",
"nil",
"if",
"node",
".",
"xpath",
"(",
"'*'",
")",
".",
"empty?",
"node",
".",
"xpath",
"(",
"'*'",
")",
".",
"each",
"do",
"|",
"node_child",
"|",
"case",
"node_child",
".",
"name",
"when",
"'gradFill'",
... | Parse PresentationFill object
@param node [Nokogiri::XML:Element] node to parse
@return [PresentationFill] result of parsing | [
"Parse",
"PresentationFill",
"object"
] | 08452315cde52fa94d8cb3e1eff1db4ea33abc88 | https://github.com/ONLYOFFICE/ooxml_parser/blob/08452315cde52fa94d8cb3e1eff1db4ea33abc88/lib/ooxml_parser/common_parser/common_data/colors/presentation_fill.rb#L11-L36 | train |
ONLYOFFICE/ooxml_parser | lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties.rb | OoxmlParser.ParagraphProperties.parse | def parse(node)
@spacing.parse(node)
node.attributes.each do |key, value|
case key
when 'algn'
@align = value_to_symbol(value)
when 'lvl'
@level = value.value.to_i
when 'indent'
@indent = OoxmlSize.new(value.value.to_f, :emu)
when 'marR'
... | ruby | def parse(node)
@spacing.parse(node)
node.attributes.each do |key, value|
case key
when 'algn'
@align = value_to_symbol(value)
when 'lvl'
@level = value.value.to_i
when 'indent'
@indent = OoxmlSize.new(value.value.to_f, :emu)
when 'marR'
... | [
"def",
"parse",
"(",
"node",
")",
"@spacing",
".",
"parse",
"(",
"node",
")",
"node",
".",
"attributes",
".",
"each",
"do",
"|",
"key",
",",
"value",
"|",
"case",
"key",
"when",
"'algn'",
"@align",
"=",
"value_to_symbol",
"(",
"value",
")",
"when",
"... | Parse ParagraphProperties object
@param node [Nokogiri::XML:Element] node to parse
@return [ParagraphProperties] result of parsing | [
"Parse",
"ParagraphProperties",
"object"
] | 08452315cde52fa94d8cb3e1eff1db4ea33abc88 | https://github.com/ONLYOFFICE/ooxml_parser/blob/08452315cde52fa94d8cb3e1eff1db4ea33abc88/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties.rb#L45-L97 | train |
ONLYOFFICE/ooxml_parser | lib/ooxml_parser/common_parser/common_data/table/row/row.rb | OoxmlParser.TableRow.parse | def parse(node)
root_object.default_font_style = FontStyle.new(true) # TODO: Add correct parsing of TableStyle.xml file and use it
node.attributes.each do |key, value|
case key
when 'h'
@height = OoxmlSize.new(value.value.to_f, :emu)
end
end
node.xpath('*').each... | ruby | def parse(node)
root_object.default_font_style = FontStyle.new(true) # TODO: Add correct parsing of TableStyle.xml file and use it
node.attributes.each do |key, value|
case key
when 'h'
@height = OoxmlSize.new(value.value.to_f, :emu)
end
end
node.xpath('*').each... | [
"def",
"parse",
"(",
"node",
")",
"root_object",
".",
"default_font_style",
"=",
"FontStyle",
".",
"new",
"(",
"true",
")",
"node",
".",
"attributes",
".",
"each",
"do",
"|",
"key",
",",
"value",
"|",
"case",
"key",
"when",
"'h'",
"@height",
"=",
"Ooxm... | Parse TableRow object
@param node [Nokogiri::XML:Element] node to parse
@return [TableRow] result of parsing | [
"Parse",
"TableRow",
"object"
] | 08452315cde52fa94d8cb3e1eff1db4ea33abc88 | https://github.com/ONLYOFFICE/ooxml_parser/blob/08452315cde52fa94d8cb3e1eff1db4ea33abc88/lib/ooxml_parser/common_parser/common_data/table/row/row.rb#L17-L35 | train |
ONLYOFFICE/ooxml_parser | lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_drawing/xlsx_drawing_position_parameters.rb | OoxmlParser.XlsxDrawingPositionParameters.parse | def parse(node)
node.xpath('*').each do |node_child|
case node_child.name
when 'col'
@column = Coordinates.get_column_name(node_child.text.to_i + 1)
when 'colOff'
@column_offset = OoxmlSize.new(node_child.text.to_f, :emu)
when 'row'
@row = node_child.t... | ruby | def parse(node)
node.xpath('*').each do |node_child|
case node_child.name
when 'col'
@column = Coordinates.get_column_name(node_child.text.to_i + 1)
when 'colOff'
@column_offset = OoxmlSize.new(node_child.text.to_f, :emu)
when 'row'
@row = node_child.t... | [
"def",
"parse",
"(",
"node",
")",
"node",
".",
"xpath",
"(",
"'*'",
")",
".",
"each",
"do",
"|",
"node_child",
"|",
"case",
"node_child",
".",
"name",
"when",
"'col'",
"@column",
"=",
"Coordinates",
".",
"get_column_name",
"(",
"node_child",
".",
"text",... | Parse XlsxDrawingPositionParameters object
@param node [Nokogiri::XML:Element] node to parse
@return [XlsxDrawingPositionParameters] result of parsing | [
"Parse",
"XlsxDrawingPositionParameters",
"object"
] | 08452315cde52fa94d8cb3e1eff1db4ea33abc88 | https://github.com/ONLYOFFICE/ooxml_parser/blob/08452315cde52fa94d8cb3e1eff1db4ea33abc88/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_drawing/xlsx_drawing_position_parameters.rb#L9-L23 | train |
ONLYOFFICE/ooxml_parser | lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/fills/fill.rb | OoxmlParser.Fill.parse | def parse(node)
node.attributes.each do |key, value|
case key
when 'color2'
@color2 = Color.new(parent: self).parse_hex_string(value.value.split(' ').first.delete('#'))
when 'id'
@id = value.value.to_s
@file = FileReference.new(parent: self).parse(node)
... | ruby | def parse(node)
node.attributes.each do |key, value|
case key
when 'color2'
@color2 = Color.new(parent: self).parse_hex_string(value.value.split(' ').first.delete('#'))
when 'id'
@id = value.value.to_s
@file = FileReference.new(parent: self).parse(node)
... | [
"def",
"parse",
"(",
"node",
")",
"node",
".",
"attributes",
".",
"each",
"do",
"|",
"key",
",",
"value",
"|",
"case",
"key",
"when",
"'color2'",
"@color2",
"=",
"Color",
".",
"new",
"(",
"parent",
":",
"self",
")",
".",
"parse_hex_string",
"(",
"val... | Parse Fill data
@param [Nokogiri::XML:Element] node with Fill data
@return [Fill] value of Fill data | [
"Parse",
"Fill",
"data"
] | 08452315cde52fa94d8cb3e1eff1db4ea33abc88 | https://github.com/ONLYOFFICE/ooxml_parser/blob/08452315cde52fa94d8cb3e1eff1db4ea33abc88/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/fills/fill.rb#L19-L39 | train |
ONLYOFFICE/ooxml_parser | lib/ooxml_parser/docx_parser/docx_data/document_structure/styles/document_defaults.rb | OoxmlParser.DocumentDefaults.parse | def parse(node)
node.xpath('*').each do |node_child|
case node_child.name
when 'rPrDefault'
@run_properties_default = RunPropertiesDefault.new(parent: self).parse(node_child)
when 'pPrDefault'
@paragraph_properties_default = ParagraphPropertiesDefault.new(parent: self).... | ruby | def parse(node)
node.xpath('*').each do |node_child|
case node_child.name
when 'rPrDefault'
@run_properties_default = RunPropertiesDefault.new(parent: self).parse(node_child)
when 'pPrDefault'
@paragraph_properties_default = ParagraphPropertiesDefault.new(parent: self).... | [
"def",
"parse",
"(",
"node",
")",
"node",
".",
"xpath",
"(",
"'*'",
")",
".",
"each",
"do",
"|",
"node_child",
"|",
"case",
"node_child",
".",
"name",
"when",
"'rPrDefault'",
"@run_properties_default",
"=",
"RunPropertiesDefault",
".",
"new",
"(",
"parent",
... | Parse Bookmark object
@param node [Nokogiri::XML:Element] node to parse
@return [Bookmark] result of parsing | [
"Parse",
"Bookmark",
"object"
] | 08452315cde52fa94d8cb3e1eff1db4ea33abc88 | https://github.com/ONLYOFFICE/ooxml_parser/blob/08452315cde52fa94d8cb3e1eff1db4ea33abc88/lib/ooxml_parser/docx_parser/docx_data/document_structure/styles/document_defaults.rb#L14-L24 | train |
ONLYOFFICE/ooxml_parser | lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/fills/fill/pattern_fill.rb | OoxmlParser.PatternFill.parse | def parse(node)
node.attributes.each do |key, value|
case key
when 'patternType'
@pattern_type = value.value.to_sym
end
end
node.xpath('*').each do |node_child|
case node_child.name
when 'fgColor'
@foreground_color = OoxmlColor.new(parent: s... | ruby | def parse(node)
node.attributes.each do |key, value|
case key
when 'patternType'
@pattern_type = value.value.to_sym
end
end
node.xpath('*').each do |node_child|
case node_child.name
when 'fgColor'
@foreground_color = OoxmlColor.new(parent: s... | [
"def",
"parse",
"(",
"node",
")",
"node",
".",
"attributes",
".",
"each",
"do",
"|",
"key",
",",
"value",
"|",
"case",
"key",
"when",
"'patternType'",
"@pattern_type",
"=",
"value",
".",
"value",
".",
"to_sym",
"end",
"end",
"node",
".",
"xpath",
"(",
... | Parse PatternFill data
@param [Nokogiri::XML:Element] node with PatternFill data
@return [PatternFill] value of PatternFill data | [
"Parse",
"PatternFill",
"data"
] | 08452315cde52fa94d8cb3e1eff1db4ea33abc88 | https://github.com/ONLYOFFICE/ooxml_parser/blob/08452315cde52fa94d8cb3e1eff1db4ea33abc88/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/fills/fill/pattern_fill.rb#L14-L31 | train |
stewartmckee/cobweb | lib/crawl.rb | CobwebModule.Crawl.set_base_url | def set_base_url(redis)
if redis.get("base_url").nil?
unless !defined?(content.redirect_through) || content.redirect_through.empty? || !@options[:first_page_redirect_internal]
uri = Addressable::URI.parse(content.redirect_through.last)
redis.sadd("internal_urls", [uri.scheme, "://", ur... | ruby | def set_base_url(redis)
if redis.get("base_url").nil?
unless !defined?(content.redirect_through) || content.redirect_through.empty? || !@options[:first_page_redirect_internal]
uri = Addressable::URI.parse(content.redirect_through.last)
redis.sadd("internal_urls", [uri.scheme, "://", ur... | [
"def",
"set_base_url",
"(",
"redis",
")",
"if",
"redis",
".",
"get",
"(",
"\"base_url\"",
")",
".",
"nil?",
"unless",
"!",
"defined?",
"(",
"content",
".",
"redirect_through",
")",
"||",
"content",
".",
"redirect_through",
".",
"empty?",
"||",
"!",
"@optio... | Sets the base url in redis. If the first page is a redirect, it sets the base_url to the destination | [
"Sets",
"the",
"base",
"url",
"in",
"redis",
".",
"If",
"the",
"first",
"page",
"is",
"a",
"redirect",
"it",
"sets",
"the",
"base_url",
"to",
"the",
"destination"
] | a957f4519e544c09e6f32a497cac2e991e5dbac3 | https://github.com/stewartmckee/cobweb/blob/a957f4519e544c09e6f32a497cac2e991e5dbac3/lib/crawl.rb#L348-L356 | train |
yihangho/emoji-for-jekyll | lib/emoji_for_jekyll.rb | EmojiForJekyll.EmojiGenerator.convert | def convert(key, block = nil)
if block.nil? or block.call(key)
img_tag(key)
else
":#{key}:"
end
end | ruby | def convert(key, block = nil)
if block.nil? or block.call(key)
img_tag(key)
else
":#{key}:"
end
end | [
"def",
"convert",
"(",
"key",
",",
"block",
"=",
"nil",
")",
"if",
"block",
".",
"nil?",
"or",
"block",
".",
"call",
"(",
"key",
")",
"img_tag",
"(",
"key",
")",
"else",
"\":#{key}:\"",
"end",
"end"
] | convert takes in the key to the emoji to be converted and an optional block
If block is provided, conversion will be done only if this block evaluates to true. | [
"convert",
"takes",
"in",
"the",
"key",
"to",
"the",
"emoji",
"to",
"be",
"converted",
"and",
"an",
"optional",
"block",
"If",
"block",
"is",
"provided",
"conversion",
"will",
"be",
"done",
"only",
"if",
"this",
"block",
"evaluates",
"to",
"true",
"."
] | 2946d1dc5a0419af42b28fe5af9275494bf25316 | https://github.com/yihangho/emoji-for-jekyll/blob/2946d1dc5a0419af42b28fe5af9275494bf25316/lib/emoji_for_jekyll.rb#L82-L88 | train |
stretcher/stretcher | lib/stretcher/index_type.rb | Stretcher.IndexType.get | def get(id, options={}, raw=false)
if options == true || options == false # Support raw as second argument, legacy API
raw = true
options = {}
end
res = request(:get, id, options)
raw ? res : (res["_source"] || res["fields"])
end | ruby | def get(id, options={}, raw=false)
if options == true || options == false # Support raw as second argument, legacy API
raw = true
options = {}
end
res = request(:get, id, options)
raw ? res : (res["_source"] || res["fields"])
end | [
"def",
"get",
"(",
"id",
",",
"options",
"=",
"{",
"}",
",",
"raw",
"=",
"false",
")",
"if",
"options",
"==",
"true",
"||",
"options",
"==",
"false",
"raw",
"=",
"true",
"options",
"=",
"{",
"}",
"end",
"res",
"=",
"request",
"(",
":get",
",",
... | Retrieves the document by ID.
Normally this returns the contents of _source, however, if the 'raw' flag is passed in, it will return the full response hash.
Returns nil if the document does not exist.
The :fields argument can either be a csv String or an Array. e.g. [:field1,'field2] or "field1,field2".
If the fie... | [
"Retrieves",
"the",
"document",
"by",
"ID",
".",
"Normally",
"this",
"returns",
"the",
"contents",
"of",
"_source",
"however",
"if",
"the",
"raw",
"flag",
"is",
"passed",
"in",
"it",
"will",
"return",
"the",
"full",
"response",
"hash",
".",
"Returns",
"nil... | 2ae1b4b012e7d66dfd6028da77a948c55b36fb80 | https://github.com/stretcher/stretcher/blob/2ae1b4b012e7d66dfd6028da77a948c55b36fb80/lib/stretcher/index_type.rb#L23-L31 | train |
stretcher/stretcher | lib/stretcher/index_type.rb | Stretcher.IndexType.delete | def delete(id, options={})
request :delete, id, options
rescue Stretcher::RequestError => e
raise e if e.http_response.status != 404
false
end | ruby | def delete(id, options={})
request :delete, id, options
rescue Stretcher::RequestError => e
raise e if e.http_response.status != 404
false
end | [
"def",
"delete",
"(",
"id",
",",
"options",
"=",
"{",
"}",
")",
"request",
":delete",
",",
"id",
",",
"options",
"rescue",
"Stretcher",
"::",
"RequestError",
"=>",
"e",
"raise",
"e",
"if",
"e",
".",
"http_response",
".",
"status",
"!=",
"404",
"false",... | Deletes the document with the given ID | [
"Deletes",
"the",
"document",
"with",
"the",
"given",
"ID"
] | 2ae1b4b012e7d66dfd6028da77a948c55b36fb80 | https://github.com/stretcher/stretcher/blob/2ae1b4b012e7d66dfd6028da77a948c55b36fb80/lib/stretcher/index_type.rb#L69-L74 | train |
stretcher/stretcher | lib/stretcher/index_type.rb | Stretcher.IndexType.exists? | def exists?(id=nil)
request :head, id
true
rescue Stretcher::RequestError::NotFound => e
false
end | ruby | def exists?(id=nil)
request :head, id
true
rescue Stretcher::RequestError::NotFound => e
false
end | [
"def",
"exists?",
"(",
"id",
"=",
"nil",
")",
"request",
":head",
",",
"id",
"true",
"rescue",
"Stretcher",
"::",
"RequestError",
"::",
"NotFound",
"=>",
"e",
"false",
"end"
] | Check if this index type is defined, if passed an id
this will check if the given document exists | [
"Check",
"if",
"this",
"index",
"type",
"is",
"defined",
"if",
"passed",
"an",
"id",
"this",
"will",
"check",
"if",
"the",
"given",
"document",
"exists"
] | 2ae1b4b012e7d66dfd6028da77a948c55b36fb80 | https://github.com/stretcher/stretcher/blob/2ae1b4b012e7d66dfd6028da77a948c55b36fb80/lib/stretcher/index_type.rb#L110-L115 | train |
stretcher/stretcher | lib/stretcher/es_component.rb | Stretcher.EsComponent.do_search | def do_search(generic_opts={}, explicit_body=nil)
query_opts = {}
body = nil
if explicit_body
query_opts = generic_opts
body = explicit_body
else
body = generic_opts
end
response = request(:get, "_search", query_opts, nil, {}, :mashify => false) do |req|
... | ruby | def do_search(generic_opts={}, explicit_body=nil)
query_opts = {}
body = nil
if explicit_body
query_opts = generic_opts
body = explicit_body
else
body = generic_opts
end
response = request(:get, "_search", query_opts, nil, {}, :mashify => false) do |req|
... | [
"def",
"do_search",
"(",
"generic_opts",
"=",
"{",
"}",
",",
"explicit_body",
"=",
"nil",
")",
"query_opts",
"=",
"{",
"}",
"body",
"=",
"nil",
"if",
"explicit_body",
"query_opts",
"=",
"generic_opts",
"body",
"=",
"explicit_body",
"else",
"body",
"=",
"ge... | Many of the methods marked protected are called by one line shims in subclasses. This is mostly to facilitate
better looking rdocs | [
"Many",
"of",
"the",
"methods",
"marked",
"protected",
"are",
"called",
"by",
"one",
"line",
"shims",
"in",
"subclasses",
".",
"This",
"is",
"mostly",
"to",
"facilitate",
"better",
"looking",
"rdocs"
] | 2ae1b4b012e7d66dfd6028da77a948c55b36fb80 | https://github.com/stretcher/stretcher/blob/2ae1b4b012e7d66dfd6028da77a948c55b36fb80/lib/stretcher/es_component.rb#L8-L22 | train |
stretcher/stretcher | lib/stretcher/server.rb | Stretcher.Server.check_response | def check_response(res, options)
if res.status >= 200 && res.status <= 299
if(options[:mashify] && res.body.instance_of?(Hash))
Hashie::Mash.new(res.body)
else
res.body
end
elsif [404, 410].include? res.status
err_str = "Error processing request: (#{res.st... | ruby | def check_response(res, options)
if res.status >= 200 && res.status <= 299
if(options[:mashify] && res.body.instance_of?(Hash))
Hashie::Mash.new(res.body)
else
res.body
end
elsif [404, 410].include? res.status
err_str = "Error processing request: (#{res.st... | [
"def",
"check_response",
"(",
"res",
",",
"options",
")",
"if",
"res",
".",
"status",
">=",
"200",
"&&",
"res",
".",
"status",
"<=",
"299",
"if",
"(",
"options",
"[",
":mashify",
"]",
"&&",
"res",
".",
"body",
".",
"instance_of?",
"(",
"Hash",
")",
... | Internal use only
Check response codes from request | [
"Internal",
"use",
"only",
"Check",
"response",
"codes",
"from",
"request"
] | 2ae1b4b012e7d66dfd6028da77a948c55b36fb80 | https://github.com/stretcher/stretcher/blob/2ae1b4b012e7d66dfd6028da77a948c55b36fb80/lib/stretcher/server.rb#L246-L262 | train |
stretcher/stretcher | lib/stretcher/alias.rb | Stretcher.Alias.create | def create(options = {})
request(:put) do |req|
req.body = {
actions: [
add: options.merge(:alias => @name)
]
}
end
end | ruby | def create(options = {})
request(:put) do |req|
req.body = {
actions: [
add: options.merge(:alias => @name)
]
}
end
end | [
"def",
"create",
"(",
"options",
"=",
"{",
"}",
")",
"request",
"(",
":put",
")",
"do",
"|",
"req",
"|",
"req",
".",
"body",
"=",
"{",
"actions",
":",
"[",
"add",
":",
"options",
".",
"merge",
"(",
":alias",
"=>",
"@name",
")",
"]",
"}",
"end",... | Create the alias in elastic search with the given options
my_alias.create({ filter: { term: { user_id: 1 } } }) | [
"Create",
"the",
"alias",
"in",
"elastic",
"search",
"with",
"the",
"given",
"options"
] | 2ae1b4b012e7d66dfd6028da77a948c55b36fb80 | https://github.com/stretcher/stretcher/blob/2ae1b4b012e7d66dfd6028da77a948c55b36fb80/lib/stretcher/alias.rb#L27-L35 | train |
salesforce/flo | lib/flo/task.rb | Flo.Task.call | def call(args=[])
raise ArgumentError.new("Expected Array") unless args.is_a? Array
@provider.public_send(method_sym, *merged_evaluated_args(args.dup))
end | ruby | def call(args=[])
raise ArgumentError.new("Expected Array") unless args.is_a? Array
@provider.public_send(method_sym, *merged_evaluated_args(args.dup))
end | [
"def",
"call",
"(",
"args",
"=",
"[",
"]",
")",
"raise",
"ArgumentError",
".",
"new",
"(",
"\"Expected Array\"",
")",
"unless",
"args",
".",
"is_a?",
"Array",
"@provider",
".",
"public_send",
"(",
"method_sym",
",",
"*",
"merged_evaluated_args",
"(",
"args",... | Creates a new Task instance
@param [Provider] provider The provider to send the message to
@param [Symbol] The method you wish to call on the provider
@param [Hash] provider_options={} A hash of options to be passed when
invoking the method on the provider. Any lambda values will be called
during the executi... | [
"Creates",
"a",
"new",
"Task",
"instance"
] | 34c01f22e0a5d065f879aaed9fbdf3f2a9b2163a | https://github.com/salesforce/flo/blob/34c01f22e0a5d065f879aaed9fbdf3f2a9b2163a/lib/flo/task.rb#L34-L37 | train |
salesforce/flo | lib/flo/task.rb | Flo.Task.evaluate_proc_values | def evaluate_proc_values(args=[])
args.collect do |arg|
case arg
when Proc
arg.call
when Hash
hsh = {}
arg.each do |k, v|
hsh[k] = v.is_a?(Proc) ? v.call : v
end
hsh
else
arg
end
end
end | ruby | def evaluate_proc_values(args=[])
args.collect do |arg|
case arg
when Proc
arg.call
when Hash
hsh = {}
arg.each do |k, v|
hsh[k] = v.is_a?(Proc) ? v.call : v
end
hsh
else
arg
end
end
end | [
"def",
"evaluate_proc_values",
"(",
"args",
"=",
"[",
"]",
")",
"args",
".",
"collect",
"do",
"|",
"arg",
"|",
"case",
"arg",
"when",
"Proc",
"arg",
".",
"call",
"when",
"Hash",
"hsh",
"=",
"{",
"}",
"arg",
".",
"each",
"do",
"|",
"k",
",",
"v",
... | For each value in the args array, evaluate any procs.
If the value is a hash, evaluate any values in the hash
that are procs. | [
"For",
"each",
"value",
"in",
"the",
"args",
"array",
"evaluate",
"any",
"procs",
".",
"If",
"the",
"value",
"is",
"a",
"hash",
"evaluate",
"any",
"values",
"in",
"the",
"hash",
"that",
"are",
"procs",
"."
] | 34c01f22e0a5d065f879aaed9fbdf3f2a9b2163a | https://github.com/salesforce/flo/blob/34c01f22e0a5d065f879aaed9fbdf3f2a9b2163a/lib/flo/task.rb#L54-L69 | train |
maestrano/mno-enterprise | core/lib/mno_enterprise/smtp_client.rb | MnoEnterprise.SmtpClient.deliver | def deliver(template, from, to, vars={}, opts={})
@info = vars
@info[:company] = from[:name]
mail(
from: format_sender(from),
to: to[:email],
subject: humanize(template),
template_path: 'system_notifications',
template_name: template
)
end | ruby | def deliver(template, from, to, vars={}, opts={})
@info = vars
@info[:company] = from[:name]
mail(
from: format_sender(from),
to: to[:email],
subject: humanize(template),
template_path: 'system_notifications',
template_name: template
)
end | [
"def",
"deliver",
"(",
"template",
",",
"from",
",",
"to",
",",
"vars",
"=",
"{",
"}",
",",
"opts",
"=",
"{",
"}",
")",
"@info",
"=",
"vars",
"@info",
"[",
":company",
"]",
"=",
"from",
"[",
":name",
"]",
"mail",
"(",
"from",
":",
"format_sender"... | Send SMTP template - terminal mailing part | [
"Send",
"SMTP",
"template",
"-",
"terminal",
"mailing",
"part"
] | bd957f523959531926e2bf844608d77addef2047 | https://github.com/maestrano/mno-enterprise/blob/bd957f523959531926e2bf844608d77addef2047/core/lib/mno_enterprise/smtp_client.rb#L9-L20 | train |
maestrano/mno-enterprise | api/lib/mno_enterprise/intercom_events_listener.rb | MnoEnterprise.IntercomEventsListener.tag_user | def tag_user(user)
if user.meta_data && user.meta_data[:source].present?
intercom.tags.tag(name: user.meta_data[:source], users: [{user_id: user.id}])
end
end | ruby | def tag_user(user)
if user.meta_data && user.meta_data[:source].present?
intercom.tags.tag(name: user.meta_data[:source], users: [{user_id: user.id}])
end
end | [
"def",
"tag_user",
"(",
"user",
")",
"if",
"user",
".",
"meta_data",
"&&",
"user",
".",
"meta_data",
"[",
":source",
"]",
".",
"present?",
"intercom",
".",
"tags",
".",
"tag",
"(",
"name",
":",
"user",
".",
"meta_data",
"[",
":source",
"]",
",",
"use... | If a source is set, tag the user with it | [
"If",
"a",
"source",
"is",
"set",
"tag",
"the",
"user",
"with",
"it"
] | bd957f523959531926e2bf844608d77addef2047 | https://github.com/maestrano/mno-enterprise/blob/bd957f523959531926e2bf844608d77addef2047/api/lib/mno_enterprise/intercom_events_listener.rb#L65-L69 | train |
maestrano/mno-enterprise | api/app/controllers/mno_enterprise/jpi/v1/admin/invites_controller.rb | MnoEnterprise::Jpi::V1::Admin.InvitesController.send_org_invite | def send_org_invite(user, invite)
# Generate token if not generated
user.send(:generate_confirmation_token!) if !user.confirmed? && user.confirmation_token.blank?
MnoEnterprise::SystemNotificationMailer.organization_invite(invite).deliver_later
# Update staged invite status
invite.status... | ruby | def send_org_invite(user, invite)
# Generate token if not generated
user.send(:generate_confirmation_token!) if !user.confirmed? && user.confirmation_token.blank?
MnoEnterprise::SystemNotificationMailer.organization_invite(invite).deliver_later
# Update staged invite status
invite.status... | [
"def",
"send_org_invite",
"(",
"user",
",",
"invite",
")",
"user",
".",
"send",
"(",
":generate_confirmation_token!",
")",
"if",
"!",
"user",
".",
"confirmed?",
"&&",
"user",
".",
"confirmation_token",
".",
"blank?",
"MnoEnterprise",
"::",
"SystemNotificationMaile... | Send the org invite and update the status | [
"Send",
"the",
"org",
"invite",
"and",
"update",
"the",
"status"
] | bd957f523959531926e2bf844608d77addef2047 | https://github.com/maestrano/mno-enterprise/blob/bd957f523959531926e2bf844608d77addef2047/api/app/controllers/mno_enterprise/jpi/v1/admin/invites_controller.rb#L28-L38 | train |
maestrano/mno-enterprise | api/app/controllers/mno_enterprise/jpi/v1/base_resource_controller.rb | MnoEnterprise.Jpi::V1::BaseResourceController.check_authorization | def check_authorization
unless current_user
render nothing: true, status: :unauthorized
return false
end
if params[:organization_id] && !parent_organization
render nothing: true, status: :forbidden
return false
end
true
end | ruby | def check_authorization
unless current_user
render nothing: true, status: :unauthorized
return false
end
if params[:organization_id] && !parent_organization
render nothing: true, status: :forbidden
return false
end
true
end | [
"def",
"check_authorization",
"unless",
"current_user",
"render",
"nothing",
":",
"true",
",",
"status",
":",
":unauthorized",
"return",
"false",
"end",
"if",
"params",
"[",
":organization_id",
"]",
"&&",
"!",
"parent_organization",
"render",
"nothing",
":",
"true... | Check current user is logged in
Check organization is valid if specified | [
"Check",
"current",
"user",
"is",
"logged",
"in",
"Check",
"organization",
"is",
"valid",
"if",
"specified"
] | bd957f523959531926e2bf844608d77addef2047 | https://github.com/maestrano/mno-enterprise/blob/bd957f523959531926e2bf844608d77addef2047/api/app/controllers/mno_enterprise/jpi/v1/base_resource_controller.rb#L20-L30 | train |
maestrano/mno-enterprise | core/app/models/mno_enterprise/base_resource.rb | MnoEnterprise.BaseResource.save! | def save!(options={})
if perform_validations(options)
ret = super()
process_response_errors
raise_record_invalid if self.errors.any?
ret
else
raise_record_invalid
end
end | ruby | def save!(options={})
if perform_validations(options)
ret = super()
process_response_errors
raise_record_invalid if self.errors.any?
ret
else
raise_record_invalid
end
end | [
"def",
"save!",
"(",
"options",
"=",
"{",
"}",
")",
"if",
"perform_validations",
"(",
"options",
")",
"ret",
"=",
"super",
"(",
")",
"process_response_errors",
"raise_record_invalid",
"if",
"self",
".",
"errors",
".",
"any?",
"ret",
"else",
"raise_record_inval... | ActiveRecord Compatibility for Her | [
"ActiveRecord",
"Compatibility",
"for",
"Her"
] | bd957f523959531926e2bf844608d77addef2047 | https://github.com/maestrano/mno-enterprise/blob/bd957f523959531926e2bf844608d77addef2047/core/app/models/mno_enterprise/base_resource.rb#L149-L158 | train |
maestrano/mno-enterprise | core/app/models/mno_enterprise/user.rb | MnoEnterprise.User.role | def role(organization = nil)
# Return cached version if available
return self.read_attribute(:role) if !organization
# Find in arrays if organizations have been fetched
# already. Perform remote query otherwise
org = begin
if self.organizations.loaded?
self.organizations... | ruby | def role(organization = nil)
# Return cached version if available
return self.read_attribute(:role) if !organization
# Find in arrays if organizations have been fetched
# already. Perform remote query otherwise
org = begin
if self.organizations.loaded?
self.organizations... | [
"def",
"role",
"(",
"organization",
"=",
"nil",
")",
"return",
"self",
".",
"read_attribute",
"(",
":role",
")",
"if",
"!",
"organization",
"org",
"=",
"begin",
"if",
"self",
".",
"organizations",
".",
"loaded?",
"self",
".",
"organizations",
".",
"to_a",
... | Return the role of this user for the provided
organization | [
"Return",
"the",
"role",
"of",
"this",
"user",
"for",
"the",
"provided",
"organization"
] | bd957f523959531926e2bf844608d77addef2047 | https://github.com/maestrano/mno-enterprise/blob/bd957f523959531926e2bf844608d77addef2047/core/app/models/mno_enterprise/user.rb#L186-L201 | train |
maestrano/mno-enterprise | core/app/controllers/mno_enterprise/application_controller.rb | MnoEnterprise.ApplicationController.after_sign_in_path_for | def after_sign_in_path_for(resource)
previous_url = session.delete(:previous_url)
default_url = if resource.respond_to?(:admin_role) && resource.admin_role.present?
MnoEnterprise.router.admin_path
else
MnoEnterprise.router.dashboard_path || main_app.root_url
end
return (ret... | ruby | def after_sign_in_path_for(resource)
previous_url = session.delete(:previous_url)
default_url = if resource.respond_to?(:admin_role) && resource.admin_role.present?
MnoEnterprise.router.admin_path
else
MnoEnterprise.router.dashboard_path || main_app.root_url
end
return (ret... | [
"def",
"after_sign_in_path_for",
"(",
"resource",
")",
"previous_url",
"=",
"session",
".",
"delete",
"(",
":previous_url",
")",
"default_url",
"=",
"if",
"resource",
".",
"respond_to?",
"(",
":admin_role",
")",
"&&",
"resource",
".",
"admin_role",
".",
"present... | Redirect to previous url and reset it | [
"Redirect",
"to",
"previous",
"url",
"and",
"reset",
"it"
] | bd957f523959531926e2bf844608d77addef2047 | https://github.com/maestrano/mno-enterprise/blob/bd957f523959531926e2bf844608d77addef2047/core/app/controllers/mno_enterprise/application_controller.rb#L96-L104 | train |
maestrano/mno-enterprise | core/app/models/mno_enterprise/impac/dashboard.rb | MnoEnterprise.Impac::Dashboard.organizations | def organizations(org_list = nil)
if org_list
return org_list if dashboard_type == 'template'
org_list.to_a.select { |e| organization_ids.include?(e.uid) || organization_ids.include?(e.id) }
else
MnoEnterprise::Organization.where('uid.in' => organization_ids).to_a
end
end | ruby | def organizations(org_list = nil)
if org_list
return org_list if dashboard_type == 'template'
org_list.to_a.select { |e| organization_ids.include?(e.uid) || organization_ids.include?(e.id) }
else
MnoEnterprise::Organization.where('uid.in' => organization_ids).to_a
end
end | [
"def",
"organizations",
"(",
"org_list",
"=",
"nil",
")",
"if",
"org_list",
"return",
"org_list",
"if",
"dashboard_type",
"==",
"'template'",
"org_list",
".",
"to_a",
".",
"select",
"{",
"|",
"e",
"|",
"organization_ids",
".",
"include?",
"(",
"e",
".",
"u... | Return all the organizations linked to this dashboard and to which the user has access
If the dashboard is a template, return all the current user's organizations | [
"Return",
"all",
"the",
"organizations",
"linked",
"to",
"this",
"dashboard",
"and",
"to",
"which",
"the",
"user",
"has",
"access",
"If",
"the",
"dashboard",
"is",
"a",
"template",
"return",
"all",
"the",
"current",
"user",
"s",
"organizations"
] | bd957f523959531926e2bf844608d77addef2047 | https://github.com/maestrano/mno-enterprise/blob/bd957f523959531926e2bf844608d77addef2047/core/app/models/mno_enterprise/impac/dashboard.rb#L26-L33 | train |
maestrano/mno-enterprise | core/app/models/mno_enterprise/impac/dashboard.rb | MnoEnterprise.Impac::Dashboard.filtered_widgets_templates | def filtered_widgets_templates
if MnoEnterprise.widgets_templates_listing
return self.widgets_templates.select do |t|
MnoEnterprise.widgets_templates_listing.include?(t[:path])
end
else
return self.widgets_templates
end
end | ruby | def filtered_widgets_templates
if MnoEnterprise.widgets_templates_listing
return self.widgets_templates.select do |t|
MnoEnterprise.widgets_templates_listing.include?(t[:path])
end
else
return self.widgets_templates
end
end | [
"def",
"filtered_widgets_templates",
"if",
"MnoEnterprise",
".",
"widgets_templates_listing",
"return",
"self",
".",
"widgets_templates",
".",
"select",
"do",
"|",
"t",
"|",
"MnoEnterprise",
".",
"widgets_templates_listing",
".",
"include?",
"(",
"t",
"[",
":path",
... | Filter widgets list based on config | [
"Filter",
"widgets",
"list",
"based",
"on",
"config"
] | bd957f523959531926e2bf844608d77addef2047 | https://github.com/maestrano/mno-enterprise/blob/bd957f523959531926e2bf844608d77addef2047/core/app/models/mno_enterprise/impac/dashboard.rb#L36-L44 | train |
salesforce/flo | lib/flo/command.rb | Flo.Command.call | def call(args={})
evaluate_command_definition(args)
response = tasks.map do |task|
response = task.call(args)
# bail early if the task failed
return response unless response.success?
response
end.last
end | ruby | def call(args={})
evaluate_command_definition(args)
response = tasks.map do |task|
response = task.call(args)
# bail early if the task failed
return response unless response.success?
response
end.last
end | [
"def",
"call",
"(",
"args",
"=",
"{",
"}",
")",
"evaluate_command_definition",
"(",
"args",
")",
"response",
"=",
"tasks",
".",
"map",
"do",
"|",
"task",
"|",
"response",
"=",
"task",
".",
"call",
"(",
"args",
")",
"return",
"response",
"unless",
"resp... | Invoke the command that has already been defined.
This will run the command, processing any tasks defined by {#perform} and
{#validate} in order, stopping execution if any of the tasks fails.
Arguments passed in here will be merged with the provider options defined
in each task.
@param args [Hash] arguments to be... | [
"Invoke",
"the",
"command",
"that",
"has",
"already",
"been",
"defined",
"."
] | 34c01f22e0a5d065f879aaed9fbdf3f2a9b2163a | https://github.com/salesforce/flo/blob/34c01f22e0a5d065f879aaed9fbdf3f2a9b2163a/lib/flo/command.rb#L78-L88 | train |
salesforce/flo | lib/flo/command.rb | Flo.Command.optional_parameters | def optional_parameters
definition_lambda.parameters.select { |key,_value| key == :key }.map { |_key,value| value }
end | ruby | def optional_parameters
definition_lambda.parameters.select { |key,_value| key == :key }.map { |_key,value| value }
end | [
"def",
"optional_parameters",
"definition_lambda",
".",
"parameters",
".",
"select",
"{",
"|",
"key",
",",
"_value",
"|",
"key",
"==",
":key",
"}",
".",
"map",
"{",
"|",
"_key",
",",
"value",
"|",
"value",
"}",
"end"
] | Returns a list of any optional parameters
Optional parameters are generated automatically by inspecting the optional
parameters for the definition lambda
@return [Array<Symbol>] An array of symbols representing optional parameters | [
"Returns",
"a",
"list",
"of",
"any",
"optional",
"parameters"
] | 34c01f22e0a5d065f879aaed9fbdf3f2a9b2163a | https://github.com/salesforce/flo/blob/34c01f22e0a5d065f879aaed9fbdf3f2a9b2163a/lib/flo/command.rb#L107-L109 | train |
maestrano/mno-enterprise | api/app/controllers/mno_enterprise/jpi/v1/admin/theme_controller.rb | MnoEnterprise.Jpi::V1::Admin::ThemeController.save_previewer_style | def save_previewer_style(theme)
target = Rails.root.join('frontend', 'src','app','stylesheets','theme-previewer-tmp.less')
File.open(target, 'w') { |f| f.write(theme_to_less(theme)) }
end | ruby | def save_previewer_style(theme)
target = Rails.root.join('frontend', 'src','app','stylesheets','theme-previewer-tmp.less')
File.open(target, 'w') { |f| f.write(theme_to_less(theme)) }
end | [
"def",
"save_previewer_style",
"(",
"theme",
")",
"target",
"=",
"Rails",
".",
"root",
".",
"join",
"(",
"'frontend'",
",",
"'src'",
",",
"'app'",
",",
"'stylesheets'",
",",
"'theme-previewer-tmp.less'",
")",
"File",
".",
"open",
"(",
"target",
",",
"'w'",
... | Save current style to theme-previewer-tmp.less stylesheet
This file overrides theme-previewer-published.less | [
"Save",
"current",
"style",
"to",
"theme",
"-",
"previewer",
"-",
"tmp",
".",
"less",
"stylesheet",
"This",
"file",
"overrides",
"theme",
"-",
"previewer",
"-",
"published",
".",
"less"
] | bd957f523959531926e2bf844608d77addef2047 | https://github.com/maestrano/mno-enterprise/blob/bd957f523959531926e2bf844608d77addef2047/api/app/controllers/mno_enterprise/jpi/v1/admin/theme_controller.rb#L55-L58 | train |
maestrano/mno-enterprise | api/app/controllers/mno_enterprise/jpi/v1/admin/theme_controller.rb | MnoEnterprise.Jpi::V1::Admin::ThemeController.apply_previewer_style | def apply_previewer_style(theme)
target = Rails.root.join('frontend', 'src','app','stylesheets','theme-previewer-published.less')
File.open(target, 'w') { |f| f.write(theme_to_less(theme)) }
reset_previewer_style
end | ruby | def apply_previewer_style(theme)
target = Rails.root.join('frontend', 'src','app','stylesheets','theme-previewer-published.less')
File.open(target, 'w') { |f| f.write(theme_to_less(theme)) }
reset_previewer_style
end | [
"def",
"apply_previewer_style",
"(",
"theme",
")",
"target",
"=",
"Rails",
".",
"root",
".",
"join",
"(",
"'frontend'",
",",
"'src'",
",",
"'app'",
",",
"'stylesheets'",
",",
"'theme-previewer-published.less'",
")",
"File",
".",
"open",
"(",
"target",
",",
"... | Save style to theme-previewer-published.less and discard theme-previewer-tmp.less | [
"Save",
"style",
"to",
"theme",
"-",
"previewer",
"-",
"published",
".",
"less",
"and",
"discard",
"theme",
"-",
"previewer",
"-",
"tmp",
".",
"less"
] | bd957f523959531926e2bf844608d77addef2047 | https://github.com/maestrano/mno-enterprise/blob/bd957f523959531926e2bf844608d77addef2047/api/app/controllers/mno_enterprise/jpi/v1/admin/theme_controller.rb#L61-L65 | train |
maestrano/mno-enterprise | api/app/controllers/mno_enterprise/jpi/v1/admin/theme_controller.rb | MnoEnterprise.Jpi::V1::Admin::ThemeController.theme_to_less | def theme_to_less(theme)
out = "// Generated by the Express Theme Previewer\n"
if theme[:branding]
out += "\n//----------------------------------------\n"
out += "// General Branding\n"
out += "//----------------------------------------\n"
out += theme[:branding]... | ruby | def theme_to_less(theme)
out = "// Generated by the Express Theme Previewer\n"
if theme[:branding]
out += "\n//----------------------------------------\n"
out += "// General Branding\n"
out += "//----------------------------------------\n"
out += theme[:branding]... | [
"def",
"theme_to_less",
"(",
"theme",
")",
"out",
"=",
"\"// Generated by the Express Theme Previewer\\n\"",
"if",
"theme",
"[",
":branding",
"]",
"out",
"+=",
"\"\\n//----------------------------------------\\n\"",
"out",
"+=",
"\"// General Branding\\n\"",
"out",
"+=",
"\... | Convert a theme provided as a hash into a properly
formatted LESS file | [
"Convert",
"a",
"theme",
"provided",
"as",
"a",
"hash",
"into",
"a",
"properly",
"formatted",
"LESS",
"file"
] | bd957f523959531926e2bf844608d77addef2047 | https://github.com/maestrano/mno-enterprise/blob/bd957f523959531926e2bf844608d77addef2047/api/app/controllers/mno_enterprise/jpi/v1/admin/theme_controller.rb#L84-L107 | train |
maestrano/mno-enterprise | core/app/pdf/mno_enterprise/invoice_pdf.rb | MnoEnterprise.InvoicePdf.generate_content | def generate_content
@pdf = Prawn::Document.new(
info: self.metadata,
top_margin: @format[:header_size] + @format[:top_margin],
bottom_margin: @format[:footer_size] + @format[:bottom_margin]
)
add_page_body
add_page_header
add_page_footer
add_page_numbering
... | ruby | def generate_content
@pdf = Prawn::Document.new(
info: self.metadata,
top_margin: @format[:header_size] + @format[:top_margin],
bottom_margin: @format[:footer_size] + @format[:bottom_margin]
)
add_page_body
add_page_header
add_page_footer
add_page_numbering
... | [
"def",
"generate_content",
"@pdf",
"=",
"Prawn",
"::",
"Document",
".",
"new",
"(",
"info",
":",
"self",
".",
"metadata",
",",
"top_margin",
":",
"@format",
"[",
":header_size",
"]",
"+",
"@format",
"[",
":top_margin",
"]",
",",
"bottom_margin",
":",
"@for... | Generate the document content
by adding body, header, footer and
page numbering | [
"Generate",
"the",
"document",
"content",
"by",
"adding",
"body",
"header",
"footer",
"and",
"page",
"numbering"
] | bd957f523959531926e2bf844608d77addef2047 | https://github.com/maestrano/mno-enterprise/blob/bd957f523959531926e2bf844608d77addef2047/core/app/pdf/mno_enterprise/invoice_pdf.rb#L97-L107 | train |
maestrano/mno-enterprise | core/app/pdf/mno_enterprise/invoice_pdf.rb | MnoEnterprise.InvoicePdf.add_page_header | def add_page_header
title = Settings.payment.disabled ? 'Account Statement - ' : 'Monthly Invoice - '
@pdf.repeat :all do
@pdf.bounding_box([0, @pdf.bounds.top+@format[:header_size]], width: 540, height: @format[:footer_size]) do
@pdf.float do
@pdf.image main_logo_white_bg_path... | ruby | def add_page_header
title = Settings.payment.disabled ? 'Account Statement - ' : 'Monthly Invoice - '
@pdf.repeat :all do
@pdf.bounding_box([0, @pdf.bounds.top+@format[:header_size]], width: 540, height: @format[:footer_size]) do
@pdf.float do
@pdf.image main_logo_white_bg_path... | [
"def",
"add_page_header",
"title",
"=",
"Settings",
".",
"payment",
".",
"disabled",
"?",
"'Account Statement - '",
":",
"'Monthly Invoice - '",
"@pdf",
".",
"repeat",
":all",
"do",
"@pdf",
".",
"bounding_box",
"(",
"[",
"0",
",",
"@pdf",
".",
"bounds",
".",
... | Add a repeated header to the document | [
"Add",
"a",
"repeated",
"header",
"to",
"the",
"document"
] | bd957f523959531926e2bf844608d77addef2047 | https://github.com/maestrano/mno-enterprise/blob/bd957f523959531926e2bf844608d77addef2047/core/app/pdf/mno_enterprise/invoice_pdf.rb#L126-L137 | train |
maestrano/mno-enterprise | core/app/pdf/mno_enterprise/invoice_pdf.rb | MnoEnterprise.InvoicePdf.add_page_footer | def add_page_footer
@pdf.repeat :all do
@pdf.bounding_box([0, @pdf.bounds.bottom], width: 540, height: @format[:footer_size]) do
@pdf.move_down 50
@pdf.stroke_color '999999'
@pdf.stroke_horizontal_rule
@pdf.move_down 10
@pdf.font_size(8) do
@pd... | ruby | def add_page_footer
@pdf.repeat :all do
@pdf.bounding_box([0, @pdf.bounds.bottom], width: 540, height: @format[:footer_size]) do
@pdf.move_down 50
@pdf.stroke_color '999999'
@pdf.stroke_horizontal_rule
@pdf.move_down 10
@pdf.font_size(8) do
@pd... | [
"def",
"add_page_footer",
"@pdf",
".",
"repeat",
":all",
"do",
"@pdf",
".",
"bounding_box",
"(",
"[",
"0",
",",
"@pdf",
".",
"bounds",
".",
"bottom",
"]",
",",
"width",
":",
"540",
",",
"height",
":",
"@format",
"[",
":footer_size",
"]",
")",
"do",
"... | Add a repeated footer to the document | [
"Add",
"a",
"repeated",
"footer",
"to",
"the",
"document"
] | bd957f523959531926e2bf844608d77addef2047 | https://github.com/maestrano/mno-enterprise/blob/bd957f523959531926e2bf844608d77addef2047/core/app/pdf/mno_enterprise/invoice_pdf.rb#L140-L155 | train |
maestrano/mno-enterprise | core/app/pdf/mno_enterprise/invoice_pdf.rb | MnoEnterprise.InvoicePdf.add_page_numbering | def add_page_numbering
numbering_options = {
at: [@pdf.bounds.right - 150, 0-@format[:footer_size]],
width: 150,
align: :right,
start_count_at: 1,
color: "999999",
size: 8
}
@pdf.number_pages "Page <page> of <total>", numbering_options
end | ruby | def add_page_numbering
numbering_options = {
at: [@pdf.bounds.right - 150, 0-@format[:footer_size]],
width: 150,
align: :right,
start_count_at: 1,
color: "999999",
size: 8
}
@pdf.number_pages "Page <page> of <total>", numbering_options
end | [
"def",
"add_page_numbering",
"numbering_options",
"=",
"{",
"at",
":",
"[",
"@pdf",
".",
"bounds",
".",
"right",
"-",
"150",
",",
"0",
"-",
"@format",
"[",
":footer_size",
"]",
"]",
",",
"width",
":",
"150",
",",
"align",
":",
":right",
",",
"start_cou... | Add page number on every page | [
"Add",
"page",
"number",
"on",
"every",
"page"
] | bd957f523959531926e2bf844608d77addef2047 | https://github.com/maestrano/mno-enterprise/blob/bd957f523959531926e2bf844608d77addef2047/core/app/pdf/mno_enterprise/invoice_pdf.rb#L158-L168 | train |
NCSU-Libraries/quick_search | app/searchers/quick_search/best_bets_searcher.rb | QuickSearch.BestBetsSearcher.search_best_bets_index | def search_best_bets_index
response = @http.get(query_url)
parsed_response = JSON.parse(response.body)
if parsed_response['response']['numFound'].to_s == '0'
return nil
else
resp = parsed_response['response']['docs'][0]
result = OpenStruct.new
result.title = title... | ruby | def search_best_bets_index
response = @http.get(query_url)
parsed_response = JSON.parse(response.body)
if parsed_response['response']['numFound'].to_s == '0'
return nil
else
resp = parsed_response['response']['docs'][0]
result = OpenStruct.new
result.title = title... | [
"def",
"search_best_bets_index",
"response",
"=",
"@http",
".",
"get",
"(",
"query_url",
")",
"parsed_response",
"=",
"JSON",
".",
"parse",
"(",
"response",
".",
"body",
")",
"if",
"parsed_response",
"[",
"'response'",
"]",
"[",
"'numFound'",
"]",
".",
"to_s... | Regular Best Bets | [
"Regular",
"Best",
"Bets"
] | 2e2c3f8682eed63a2bf2c008fa77f04ff9dd6a03 | https://github.com/NCSU-Libraries/quick_search/blob/2e2c3f8682eed63a2bf2c008fa77f04ff9dd6a03/app/searchers/quick_search/best_bets_searcher.rb#L34-L50 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.