id int32 0 24.9k | 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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
17,900 | 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 |
17,901 | 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 |
17,902 | 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 |
17,903 | 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 |
17,904 | 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 |
17,905 | 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 |
17,906 | 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 |
17,907 | 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 |
17,908 | 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 |
17,909 | 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 |
17,910 | 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 |
17,911 | 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 |
17,912 | 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 |
17,913 | 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 |
17,914 | 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 |
17,915 | 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 |
17,916 | 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 |
17,917 | 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 |
17,918 | 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 |
17,919 | 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 |
17,920 | 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 |
17,921 | 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 |
17,922 | 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 |
17,923 | 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 |
17,924 | 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 |
17,925 | 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 |
17,926 | 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 |
17,927 | 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 |
17,928 | 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 |
17,929 | 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 |
17,930 | 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 |
17,931 | 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 |
17,932 | 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 |
17,933 | 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 |
17,934 | 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 |
17,935 | 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 |
17,936 | 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 |
17,937 | 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 |
17,938 | 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 |
17,939 | 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 |
17,940 | 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",
")",
"# TODO: Add correct parsing of TableStyle.xml file and use it",
"node",
".",
"attributes",
".",
"each",
"do",
"|",
"key",
",",
"value",
"|"... | 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 |
17,941 | 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 |
17,942 | 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 |
17,943 | 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 |
17,944 | 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 |
17,945 | 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 |
17,946 | 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 |
17,947 | 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",
"# Support raw as second argument, legacy API",
"raw",
"=",
"true",
"options",
"=",
"{",
"}",
"end",
"re... | 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 |
17,948 | 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 |
17,949 | 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 |
17,950 | 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 |
17,951 | 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 |
17,952 | 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 |
17,953 | 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 |
17,954 | 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 |
17,955 | 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 |
17,956 | 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 |
17,957 | 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",
")",
"# Generate token if not generated",
"user",
".",
"send",
"(",
":generate_confirmation_token!",
")",
"if",
"!",
"user",
".",
"confirmed?",
"&&",
"user",
".",
"confirmation_token",
".",
"blank?",
"MnoEnterpri... | 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 |
17,958 | 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 |
17,959 | 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 |
17,960 | 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 cached version if available",
"return",
"self",
".",
"read_attribute",
"(",
":role",
")",
"if",
"!",
"organization",
"# Find in arrays if organizations have been fetched",
"# already. Perform remote query otherwise"... | 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 |
17,961 | 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 |
17,962 | 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 |
17,963 | 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 |
17,964 | 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",
")",
"# bail early if the task failed",
"retur... | 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 |
17,965 | 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 |
17,966 | 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 |
17,967 | 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 |
17,968 | 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 |
17,969 | 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 |
17,970 | 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 |
17,971 | 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 |
17,972 | 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 |
17,973 | 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 |
17,974 | NCSU-Libraries/quick_search | app/controllers/quick_search/typeahead_controller.rb | QuickSearch.TypeaheadController.typeahead | def typeahead
# :searcher param expected to be name of a searcher with underscores, ie: ematrix_journal
searcher = params[:searcher]
query = params[:q] or ''
total = params[:total] or 3
if searcher.blank?
logger.error "Typeahead request: no searcher param provided"
head :b... | ruby | def typeahead
# :searcher param expected to be name of a searcher with underscores, ie: ematrix_journal
searcher = params[:searcher]
query = params[:q] or ''
total = params[:total] or 3
if searcher.blank?
logger.error "Typeahead request: no searcher param provided"
head :b... | [
"def",
"typeahead",
"# :searcher param expected to be name of a searcher with underscores, ie: ematrix_journal",
"searcher",
"=",
"params",
"[",
":searcher",
"]",
"query",
"=",
"params",
"[",
":q",
"]",
"or",
"''",
"total",
"=",
"params",
"[",
":total",
"]",
"or",
"3"... | This method should return a list of search suggestions for a given searcher
It should return errors if there is no param called 'searcher', if the searcher does not exist
or if the searcher doesn't implement the 'typeahead' method
Otherwise, it should return the result of calling the 'typeahead' method as JSON | [
"This",
"method",
"should",
"return",
"a",
"list",
"of",
"search",
"suggestions",
"for",
"a",
"given",
"searcher",
"It",
"should",
"return",
"errors",
"if",
"there",
"is",
"no",
"param",
"called",
"searcher",
"if",
"the",
"searcher",
"does",
"not",
"exist",
... | 2e2c3f8682eed63a2bf2c008fa77f04ff9dd6a03 | https://github.com/NCSU-Libraries/quick_search/blob/2e2c3f8682eed63a2bf2c008fa77f04ff9dd6a03/app/controllers/quick_search/typeahead_controller.rb#L10-L45 |
17,975 | NCSU-Libraries/quick_search | app/controllers/quick_search/logging_controller.rb | QuickSearch.LoggingController.log_search | def log_search
if params[:query].present? && params[:page].present?
@session.searches.create(query: params[:query], page: params[:page])
head :ok
else
head :bad_request
end
end | ruby | def log_search
if params[:query].present? && params[:page].present?
@session.searches.create(query: params[:query], page: params[:page])
head :ok
else
head :bad_request
end
end | [
"def",
"log_search",
"if",
"params",
"[",
":query",
"]",
".",
"present?",
"&&",
"params",
"[",
":page",
"]",
".",
"present?",
"@session",
".",
"searches",
".",
"create",
"(",
"query",
":",
"params",
"[",
":query",
"]",
",",
"page",
":",
"params",
"[",
... | Logs a search to the database
This is an API endpoint for logging a search. It requires that at least a search query and a page are
present in the query parameters. It returns a 200 OK HTTP status if the request was successful, or
an 400 BAD REQUEST HTTP status if any parameters are missing. | [
"Logs",
"a",
"search",
"to",
"the",
"database"
] | 2e2c3f8682eed63a2bf2c008fa77f04ff9dd6a03 | https://github.com/NCSU-Libraries/quick_search/blob/2e2c3f8682eed63a2bf2c008fa77f04ff9dd6a03/app/controllers/quick_search/logging_controller.rb#L20-L27 |
17,976 | NCSU-Libraries/quick_search | app/controllers/quick_search/logging_controller.rb | QuickSearch.LoggingController.log_event | def log_event
if params[:category].present? && params[:event_action].present? && params[:label].present?
# if an action isn't passed in, assume that it is a click
action = params.fetch(:action_type, 'click')
# create a new event on the current session
@session.events.create(catego... | ruby | def log_event
if params[:category].present? && params[:event_action].present? && params[:label].present?
# if an action isn't passed in, assume that it is a click
action = params.fetch(:action_type, 'click')
# create a new event on the current session
@session.events.create(catego... | [
"def",
"log_event",
"if",
"params",
"[",
":category",
"]",
".",
"present?",
"&&",
"params",
"[",
":event_action",
"]",
".",
"present?",
"&&",
"params",
"[",
":label",
"]",
".",
"present?",
"# if an action isn't passed in, assume that it is a click",
"action",
"=",
... | Logs an event to the database. Typically, these can be clicks or serves.
This is an API endpoint for logging an event. It requires that at least a TODO are
present in the query parameters. It returns a 200 OK HTTP status if the request was successful, or
an 400 BAD REQUEST HTTP status if any parameters are missing.... | [
"Logs",
"an",
"event",
"to",
"the",
"database",
".",
"Typically",
"these",
"can",
"be",
"clicks",
"or",
"serves",
"."
] | 2e2c3f8682eed63a2bf2c008fa77f04ff9dd6a03 | https://github.com/NCSU-Libraries/quick_search/blob/2e2c3f8682eed63a2bf2c008fa77f04ff9dd6a03/app/controllers/quick_search/logging_controller.rb#L36-L57 |
17,977 | NCSU-Libraries/quick_search | app/controllers/quick_search/logging_controller.rb | QuickSearch.LoggingController.new_session | def new_session
on_campus = on_campus?(request.remote_ip)
is_mobile = is_mobile?
session_expiry = 5.minutes.from_now
session_uuid = SecureRandom.uuid
# create session in db
@session = Session.create(session_uuid: session_uuid, expiry: session_expiry, on_campus: on_campus, is_mobile:... | ruby | def new_session
on_campus = on_campus?(request.remote_ip)
is_mobile = is_mobile?
session_expiry = 5.minutes.from_now
session_uuid = SecureRandom.uuid
# create session in db
@session = Session.create(session_uuid: session_uuid, expiry: session_expiry, on_campus: on_campus, is_mobile:... | [
"def",
"new_session",
"on_campus",
"=",
"on_campus?",
"(",
"request",
".",
"remote_ip",
")",
"is_mobile",
"=",
"is_mobile?",
"session_expiry",
"=",
"5",
".",
"minutes",
".",
"from_now",
"session_uuid",
"=",
"SecureRandom",
".",
"uuid",
"# create session in db",
"@... | Creates a new session, and logs it in the database
A session is tracked by a UUID that is stored in a cookie, and has a 5 minute expiry time.
Sessions are stored in the database with the time they were initiated, their expiry time (or end time),
whether the request originated from a campus IP address, and whether t... | [
"Creates",
"a",
"new",
"session",
"and",
"logs",
"it",
"in",
"the",
"database"
] | 2e2c3f8682eed63a2bf2c008fa77f04ff9dd6a03 | https://github.com/NCSU-Libraries/quick_search/blob/2e2c3f8682eed63a2bf2c008fa77f04ff9dd6a03/app/controllers/quick_search/logging_controller.rb#L135-L145 |
17,978 | NCSU-Libraries/quick_search | app/controllers/quick_search/logging_controller.rb | QuickSearch.LoggingController.update_session | def update_session
# update session expiry in the database
session_id = cookies[:session_id]
@session = Session.find_by session_uuid: session_id
@session.expiry = 5.minutes.from_now
@session.save
# update session expiry on cookie
cookies[:session_id] = { :value => session_id, ... | ruby | def update_session
# update session expiry in the database
session_id = cookies[:session_id]
@session = Session.find_by session_uuid: session_id
@session.expiry = 5.minutes.from_now
@session.save
# update session expiry on cookie
cookies[:session_id] = { :value => session_id, ... | [
"def",
"update_session",
"# update session expiry in the database",
"session_id",
"=",
"cookies",
"[",
":session_id",
"]",
"@session",
"=",
"Session",
".",
"find_by",
"session_uuid",
":",
"session_id",
"@session",
".",
"expiry",
"=",
"5",
".",
"minutes",
".",
"from_... | Updates a session's expiration time on cookie and in database
When a request is made with a non-expired session, the expiration time is updated to 5 minutes from the current time.
This update is reflected in the cookie as well as in the database entry for the session. | [
"Updates",
"a",
"session",
"s",
"expiration",
"time",
"on",
"cookie",
"and",
"in",
"database"
] | 2e2c3f8682eed63a2bf2c008fa77f04ff9dd6a03 | https://github.com/NCSU-Libraries/quick_search/blob/2e2c3f8682eed63a2bf2c008fa77f04ff9dd6a03/app/controllers/quick_search/logging_controller.rb#L153-L162 |
17,979 | NCSU-Libraries/quick_search | app/searchers/quick_search/searcher.rb | QuickSearch.Searcher.no_results_link | def no_results_link(service_name, i18n_key, default_i18n_key = nil)
if (i18n_key.present? && I18n.exists?(i18n_key)) ||
(default_i18n_key.present? && I18n.exists?(default_i18n_key))
locale_result = I18n.t(i18n_key, default: I18n.t(default_i18n_key))
return locale_result if locale_result
... | ruby | def no_results_link(service_name, i18n_key, default_i18n_key = nil)
if (i18n_key.present? && I18n.exists?(i18n_key)) ||
(default_i18n_key.present? && I18n.exists?(default_i18n_key))
locale_result = I18n.t(i18n_key, default: I18n.t(default_i18n_key))
return locale_result if locale_result
... | [
"def",
"no_results_link",
"(",
"service_name",
",",
"i18n_key",
",",
"default_i18n_key",
"=",
"nil",
")",
"if",
"(",
"i18n_key",
".",
"present?",
"&&",
"I18n",
".",
"exists?",
"(",
"i18n_key",
")",
")",
"||",
"(",
"default_i18n_key",
".",
"present?",
"&&",
... | Returns a String representing the link to use when no results are
found for a search.
This default implementation first looks for the "i18n_key" and
"default_i18n_key" in the I18N locale files. If no entry is found
the "no_results_link" from the searcher configuration is returned.
Using the I18N locale files is ... | [
"Returns",
"a",
"String",
"representing",
"the",
"link",
"to",
"use",
"when",
"no",
"results",
"are",
"found",
"for",
"a",
"search",
"."
] | 2e2c3f8682eed63a2bf2c008fa77f04ff9dd6a03 | https://github.com/NCSU-Libraries/quick_search/blob/2e2c3f8682eed63a2bf2c008fa77f04ff9dd6a03/app/searchers/quick_search/searcher.rb#L38-L51 |
17,980 | NCSU-Libraries/quick_search | app/controllers/quick_search/search_controller.rb | QuickSearch.SearchController.xhr_search | def xhr_search
endpoint = params[:endpoint]
if params[:template] == 'with_paging'
template = 'xhr_response_with_paging'
else
template = 'xhr_response'
end
@query = params_q_scrubbed
@page = page
@per_page = per_page(endpoint)
@offset = offset(@page,@per_... | ruby | def xhr_search
endpoint = params[:endpoint]
if params[:template] == 'with_paging'
template = 'xhr_response_with_paging'
else
template = 'xhr_response'
end
@query = params_q_scrubbed
@page = page
@per_page = per_page(endpoint)
@offset = offset(@page,@per_... | [
"def",
"xhr_search",
"endpoint",
"=",
"params",
"[",
":endpoint",
"]",
"if",
"params",
"[",
":template",
"]",
"==",
"'with_paging'",
"template",
"=",
"'xhr_response_with_paging'",
"else",
"template",
"=",
"'xhr_response'",
"end",
"@query",
"=",
"params_q_scrubbed",
... | The following searches for individual sections of the page.
This allows us to do client-side requests in cases where the original server-side
request times out or otherwise fails. | [
"The",
"following",
"searches",
"for",
"individual",
"sections",
"of",
"the",
"page",
".",
"This",
"allows",
"us",
"to",
"do",
"client",
"-",
"side",
"requests",
"in",
"cases",
"where",
"the",
"original",
"server",
"-",
"side",
"request",
"times",
"out",
"... | 2e2c3f8682eed63a2bf2c008fa77f04ff9dd6a03 | https://github.com/NCSU-Libraries/quick_search/blob/2e2c3f8682eed63a2bf2c008fa77f04ff9dd6a03/app/controllers/quick_search/search_controller.rb#L46-L119 |
17,981 | saturnflyer/surrounded | lib/surrounded/context.rb | Surrounded.Context.private_const_set | def private_const_set(name, const)
unless role_const_defined?(name)
const = const_set(name, const)
private_constant name.to_sym
end
const
end | ruby | def private_const_set(name, const)
unless role_const_defined?(name)
const = const_set(name, const)
private_constant name.to_sym
end
const
end | [
"def",
"private_const_set",
"(",
"name",
",",
"const",
")",
"unless",
"role_const_defined?",
"(",
"name",
")",
"const",
"=",
"const_set",
"(",
"name",
",",
"const",
")",
"private_constant",
"name",
".",
"to_sym",
"end",
"const",
"end"
] | Set a named constant and make it private | [
"Set",
"a",
"named",
"constant",
"and",
"make",
"it",
"private"
] | 0052932a1ce70aa01122c0efdc79b4f60578bace | https://github.com/saturnflyer/surrounded/blob/0052932a1ce70aa01122c0efdc79b4f60578bace/lib/surrounded/context.rb#L73-L79 |
17,982 | CocoaPods/fourflusher | lib/fourflusher/executable.rb | Fourflusher.Executable.executable | def executable(name)
define_method(name) do |*command|
Executable.execute_command(name, Array(command).flatten, false)
end
define_method(name.to_s + '!') do |*command|
Executable.execute_command(name, Array(command).flatten, true)
end
end | ruby | def executable(name)
define_method(name) do |*command|
Executable.execute_command(name, Array(command).flatten, false)
end
define_method(name.to_s + '!') do |*command|
Executable.execute_command(name, Array(command).flatten, true)
end
end | [
"def",
"executable",
"(",
"name",
")",
"define_method",
"(",
"name",
")",
"do",
"|",
"*",
"command",
"|",
"Executable",
".",
"execute_command",
"(",
"name",
",",
"Array",
"(",
"command",
")",
".",
"flatten",
",",
"false",
")",
"end",
"define_method",
"("... | Creates the methods for the executable with the given name.
@param [Symbol] name
the name of the executable.
@return [void] | [
"Creates",
"the",
"methods",
"for",
"the",
"executable",
"with",
"the",
"given",
"name",
"."
] | 8235ee8fae34ccaf5c708987306228988cea2e43 | https://github.com/CocoaPods/fourflusher/blob/8235ee8fae34ccaf5c708987306228988cea2e43/lib/fourflusher/executable.rb#L52-L60 |
17,983 | CocoaPods/fourflusher | lib/fourflusher/find.rb | Fourflusher.SimControl.fetch_sims | def fetch_sims
device_list = JSON.parse(list(['-j', 'devices']))['devices']
unless device_list.is_a?(Hash)
msg = "Expected devices to be of type Hash but instated found #{device_list.class}"
fail Fourflusher::Informative, msg
end
device_list.flat_map do |runtime_str, devices|
... | ruby | def fetch_sims
device_list = JSON.parse(list(['-j', 'devices']))['devices']
unless device_list.is_a?(Hash)
msg = "Expected devices to be of type Hash but instated found #{device_list.class}"
fail Fourflusher::Informative, msg
end
device_list.flat_map do |runtime_str, devices|
... | [
"def",
"fetch_sims",
"device_list",
"=",
"JSON",
".",
"parse",
"(",
"list",
"(",
"[",
"'-j'",
",",
"'devices'",
"]",
")",
")",
"[",
"'devices'",
"]",
"unless",
"device_list",
".",
"is_a?",
"(",
"Hash",
")",
"msg",
"=",
"\"Expected devices to be of type Hash ... | Gets the simulators and transforms the simctl json into Simulator objects | [
"Gets",
"the",
"simulators",
"and",
"transforms",
"the",
"simctl",
"json",
"into",
"Simulator",
"objects"
] | 8235ee8fae34ccaf5c708987306228988cea2e43 | https://github.com/CocoaPods/fourflusher/blob/8235ee8fae34ccaf5c708987306228988cea2e43/lib/fourflusher/find.rb#L124-L148 |
17,984 | brandur/json_schema | lib/json_schema/validator.rb | JsonSchema.Validator.get_extra_keys | def get_extra_keys(schema, data)
extra = data.keys - schema.properties.keys
if schema.pattern_properties
schema.pattern_properties.keys.each do |pattern|
extra -= extra.select { |k| k =~ pattern }
end
end
extra
end | ruby | def get_extra_keys(schema, data)
extra = data.keys - schema.properties.keys
if schema.pattern_properties
schema.pattern_properties.keys.each do |pattern|
extra -= extra.select { |k| k =~ pattern }
end
end
extra
end | [
"def",
"get_extra_keys",
"(",
"schema",
",",
"data",
")",
"extra",
"=",
"data",
".",
"keys",
"-",
"schema",
".",
"properties",
".",
"keys",
"if",
"schema",
".",
"pattern_properties",
"schema",
".",
"pattern_properties",
".",
"keys",
".",
"each",
"do",
"|",... | for use with additionalProperties and strictProperties | [
"for",
"use",
"with",
"additionalProperties",
"and",
"strictProperties"
] | 9c4656774a7c7d22a6f466932b34fd47d67c88dc | https://github.com/brandur/json_schema/blob/9c4656774a7c7d22a6f466932b34fd47d67c88dc/lib/json_schema/validator.rb#L60-L70 |
17,985 | brandur/json_schema | lib/json_pointer/evaluator.rb | JsonPointer.Evaluator.split | def split(path)
parts = []
last_index = 0
while index = path.index("/", last_index)
if index == last_index
parts << ""
else
parts << path[last_index...index]
end
last_index = index + 1
end
# and also get that last segment
parts << p... | ruby | def split(path)
parts = []
last_index = 0
while index = path.index("/", last_index)
if index == last_index
parts << ""
else
parts << path[last_index...index]
end
last_index = index + 1
end
# and also get that last segment
parts << p... | [
"def",
"split",
"(",
"path",
")",
"parts",
"=",
"[",
"]",
"last_index",
"=",
"0",
"while",
"index",
"=",
"path",
".",
"index",
"(",
"\"/\"",
",",
"last_index",
")",
"if",
"index",
"==",
"last_index",
"parts",
"<<",
"\"\"",
"else",
"parts",
"<<",
"pat... | custom split method to account for blank segments | [
"custom",
"split",
"method",
"to",
"account",
"for",
"blank",
"segments"
] | 9c4656774a7c7d22a6f466932b34fd47d67c88dc | https://github.com/brandur/json_schema/blob/9c4656774a7c7d22a6f466932b34fd47d67c88dc/lib/json_pointer/evaluator.rb#L53-L69 |
17,986 | rajatthareja/ReportBuilder | lib/report_builder/builder.rb | ReportBuilder.Builder.build_report | def build_report
options = ReportBuilder.options
groups = get_groups options[:input_path]
json_report_path = options[:json_report_path] || options[:report_path]
if options[:report_types].include? 'JSON'
File.open(json_report_path + '.json', 'w') do |file|
file.write JSON.pret... | ruby | def build_report
options = ReportBuilder.options
groups = get_groups options[:input_path]
json_report_path = options[:json_report_path] || options[:report_path]
if options[:report_types].include? 'JSON'
File.open(json_report_path + '.json', 'w') do |file|
file.write JSON.pret... | [
"def",
"build_report",
"options",
"=",
"ReportBuilder",
".",
"options",
"groups",
"=",
"get_groups",
"options",
"[",
":input_path",
"]",
"json_report_path",
"=",
"options",
"[",
":json_report_path",
"]",
"||",
"options",
"[",
":report_path",
"]",
"if",
"options",
... | ReportBuilder Main method | [
"ReportBuilder",
"Main",
"method"
] | 58b849fb368a7d6407ab9519cbee70bb9decd908 | https://github.com/rajatthareja/ReportBuilder/blob/58b849fb368a7d6407ab9519cbee70bb9decd908/lib/report_builder/builder.rb#L19-L61 |
17,987 | davetron5000/methadone | lib/methadone/exit_now.rb | Methadone.ExitNow.exit_now! | def exit_now!(exit_code,message=nil)
if exit_code.kind_of?(String) && message.nil?
raise Methadone::Error.new(1,exit_code)
else
raise Methadone::Error.new(exit_code,message)
end
end | ruby | def exit_now!(exit_code,message=nil)
if exit_code.kind_of?(String) && message.nil?
raise Methadone::Error.new(1,exit_code)
else
raise Methadone::Error.new(exit_code,message)
end
end | [
"def",
"exit_now!",
"(",
"exit_code",
",",
"message",
"=",
"nil",
")",
"if",
"exit_code",
".",
"kind_of?",
"(",
"String",
")",
"&&",
"message",
".",
"nil?",
"raise",
"Methadone",
"::",
"Error",
".",
"new",
"(",
"1",
",",
"exit_code",
")",
"else",
"rais... | Call this to exit the program immediately
with the given error code and message.
+exit_code+:: exit status you'd like to exit with
+message+:: message to display to the user explaining the problem
If +exit_code+ is a String and +message+ is omitted, +exit_code+ will be used as the message
and the actual exit cod... | [
"Call",
"this",
"to",
"exit",
"the",
"program",
"immediately",
"with",
"the",
"given",
"error",
"code",
"and",
"message",
"."
] | 2e670ac24cee3ab8658a1de62a70ff58e7806dc5 | https://github.com/davetron5000/methadone/blob/2e670ac24cee3ab8658a1de62a70ff58e7806dc5/lib/methadone/exit_now.rb#L25-L31 |
17,988 | davetron5000/methadone | lib/methadone/cli.rb | Methadone.CLI.check_and_prepare_basedir! | def check_and_prepare_basedir!(basedir,force)
if File.exists? basedir
if force
rm_rf basedir, :verbose => true, :secure => true
else
exit_now! 1,"error: #{basedir} exists, use --force to override"
end
end
mkdir_p basedir
end | ruby | def check_and_prepare_basedir!(basedir,force)
if File.exists? basedir
if force
rm_rf basedir, :verbose => true, :secure => true
else
exit_now! 1,"error: #{basedir} exists, use --force to override"
end
end
mkdir_p basedir
end | [
"def",
"check_and_prepare_basedir!",
"(",
"basedir",
",",
"force",
")",
"if",
"File",
".",
"exists?",
"basedir",
"if",
"force",
"rm_rf",
"basedir",
",",
":verbose",
"=>",
"true",
",",
":secure",
"=>",
"true",
"else",
"exit_now!",
"1",
",",
"\"error: #{basedir}... | Checks that the basedir can be used, either by
not existing, or by existing and force is true.
In that case, we clean it out entirely
+basedir+:: base directory where the user wants to create a new project
+force+:: if true, and +basedir+ exists, delete it before proceeding
This will exit the app if the dir exis... | [
"Checks",
"that",
"the",
"basedir",
"can",
"be",
"used",
"either",
"by",
"not",
"existing",
"or",
"by",
"existing",
"and",
"force",
"is",
"true",
".",
"In",
"that",
"case",
"we",
"clean",
"it",
"out",
"entirely"
] | 2e670ac24cee3ab8658a1de62a70ff58e7806dc5 | https://github.com/davetron5000/methadone/blob/2e670ac24cee3ab8658a1de62a70ff58e7806dc5/lib/methadone/cli.rb#L19-L28 |
17,989 | davetron5000/methadone | lib/methadone/cli.rb | Methadone.CLI.add_to_file | def add_to_file(file,lines,options = {})
new_lines = []
found_line = false
File.open(file).readlines.each do |line|
line.chomp!
if options[:before] && options[:before] === line
found_line = true
new_lines += lines
end
new_lines << line
end
... | ruby | def add_to_file(file,lines,options = {})
new_lines = []
found_line = false
File.open(file).readlines.each do |line|
line.chomp!
if options[:before] && options[:before] === line
found_line = true
new_lines += lines
end
new_lines << line
end
... | [
"def",
"add_to_file",
"(",
"file",
",",
"lines",
",",
"options",
"=",
"{",
"}",
")",
"new_lines",
"=",
"[",
"]",
"found_line",
"=",
"false",
"File",
".",
"open",
"(",
"file",
")",
".",
"readlines",
".",
"each",
"do",
"|",
"line",
"|",
"line",
".",
... | Add content to a file
+file+:: path to the file
+lines+:: Array of String representing the lines to add
+options+:: Hash of options:
<tt>:before</tt>:: A regexp that will appear right after the new content. i.e.
this is where to insert said content. | [
"Add",
"content",
"to",
"a",
"file"
] | 2e670ac24cee3ab8658a1de62a70ff58e7806dc5 | https://github.com/davetron5000/methadone/blob/2e670ac24cee3ab8658a1de62a70ff58e7806dc5/lib/methadone/cli.rb#L37-L55 |
17,990 | davetron5000/methadone | lib/methadone/cli.rb | Methadone.CLI.copy_file | def copy_file(relative_path,options = {})
options[:from] ||= :full
relative_path = File.join(relative_path.split(/\//))
template_path = File.join(template_dir(options[:from]),relative_path + ".erb")
template = ERB.new(File.open(template_path).readlines.join(''))
relative_path_parts = Fi... | ruby | def copy_file(relative_path,options = {})
options[:from] ||= :full
relative_path = File.join(relative_path.split(/\//))
template_path = File.join(template_dir(options[:from]),relative_path + ".erb")
template = ERB.new(File.open(template_path).readlines.join(''))
relative_path_parts = Fi... | [
"def",
"copy_file",
"(",
"relative_path",
",",
"options",
"=",
"{",
"}",
")",
"options",
"[",
":from",
"]",
"||=",
":full",
"relative_path",
"=",
"File",
".",
"join",
"(",
"relative_path",
".",
"split",
"(",
"/",
"\\/",
"/",
")",
")",
"template_path",
... | Copies a file, running it through ERB
+relative_path+:: path to the file, relative to the project root, minus the .erb extension
You should use forward slashes to separate paths; this method
will handle making the ultimate path OS independent.
+options+:: Options to affect how t... | [
"Copies",
"a",
"file",
"running",
"it",
"through",
"ERB"
] | 2e670ac24cee3ab8658a1de62a70ff58e7806dc5 | https://github.com/davetron5000/methadone/blob/2e670ac24cee3ab8658a1de62a70ff58e7806dc5/lib/methadone/cli.rb#L67-L84 |
17,991 | davetron5000/methadone | lib/methadone/argv_parser.rb | Methadone.ARGVParser.parse_string_for_argv | def parse_string_for_argv(string) #:nodoc:
return [] if string.nil?
args = [] # return value we are building up
current = 0 # pointer to where we are in +string+
next_arg = '' # the next arg we are building up to ultimatley put into args
inside_quote = ... | ruby | def parse_string_for_argv(string) #:nodoc:
return [] if string.nil?
args = [] # return value we are building up
current = 0 # pointer to where we are in +string+
next_arg = '' # the next arg we are building up to ultimatley put into args
inside_quote = ... | [
"def",
"parse_string_for_argv",
"(",
"string",
")",
"#:nodoc:",
"return",
"[",
"]",
"if",
"string",
".",
"nil?",
"args",
"=",
"[",
"]",
"# return value we are building up",
"current",
"=",
"0",
"# pointer to where we are in +string+",
"next_arg",
"=",
"''",
"# the n... | Parses +string+, returning an array that can be placed into ARGV or given to OptionParser | [
"Parses",
"+",
"string",
"+",
"returning",
"an",
"array",
"that",
"can",
"be",
"placed",
"into",
"ARGV",
"or",
"given",
"to",
"OptionParser"
] | 2e670ac24cee3ab8658a1de62a70ff58e7806dc5 | https://github.com/davetron5000/methadone/blob/2e670ac24cee3ab8658a1de62a70ff58e7806dc5/lib/methadone/argv_parser.rb#L11-L48 |
17,992 | davetron5000/methadone | lib/methadone/main.rb | Methadone.Main.go! | def go!
setup_defaults
opts.post_setup
opts.parse!
opts.check_args!
result = call_main
if result.kind_of? Integer
exit result
else
exit 0
end
rescue OptionParser::ParseError => ex
logger.error ex.message
puts
puts opts.help
exit... | ruby | def go!
setup_defaults
opts.post_setup
opts.parse!
opts.check_args!
result = call_main
if result.kind_of? Integer
exit result
else
exit 0
end
rescue OptionParser::ParseError => ex
logger.error ex.message
puts
puts opts.help
exit... | [
"def",
"go!",
"setup_defaults",
"opts",
".",
"post_setup",
"opts",
".",
"parse!",
"opts",
".",
"check_args!",
"result",
"=",
"call_main",
"if",
"result",
".",
"kind_of?",
"Integer",
"exit",
"result",
"else",
"exit",
"0",
"end",
"rescue",
"OptionParser",
"::",
... | Start your command-line app, exiting appropriately when
complete.
This *will* exit your program when it completes. If your
#main block evaluates to an integer, that value will be sent
to Kernel#exit, otherwise, this will exit with 0
If the command-line options couldn't be parsed, this
will exit with 64 and wha... | [
"Start",
"your",
"command",
"-",
"line",
"app",
"exiting",
"appropriately",
"when",
"complete",
"."
] | 2e670ac24cee3ab8658a1de62a70ff58e7806dc5 | https://github.com/davetron5000/methadone/blob/2e670ac24cee3ab8658a1de62a70ff58e7806dc5/lib/methadone/main.rb#L162-L178 |
17,993 | davetron5000/methadone | lib/methadone/main.rb | Methadone.Main.normalize_defaults | def normalize_defaults
new_options = {}
options.each do |key,value|
unless value.nil?
new_options[key.to_s] = value
new_options[key.to_sym] = value
end
end
options.merge!(new_options)
end | ruby | def normalize_defaults
new_options = {}
options.each do |key,value|
unless value.nil?
new_options[key.to_s] = value
new_options[key.to_sym] = value
end
end
options.merge!(new_options)
end | [
"def",
"normalize_defaults",
"new_options",
"=",
"{",
"}",
"options",
".",
"each",
"do",
"|",
"key",
",",
"value",
"|",
"unless",
"value",
".",
"nil?",
"new_options",
"[",
"key",
".",
"to_s",
"]",
"=",
"value",
"new_options",
"[",
"key",
".",
"to_sym",
... | Normalized all defaults to both string and symbol forms, so
the user can access them via either means just as they would for
non-defaulted options | [
"Normalized",
"all",
"defaults",
"to",
"both",
"string",
"and",
"symbol",
"forms",
"so",
"the",
"user",
"can",
"access",
"them",
"via",
"either",
"means",
"just",
"as",
"they",
"would",
"for",
"non",
"-",
"defaulted",
"options"
] | 2e670ac24cee3ab8658a1de62a70ff58e7806dc5 | https://github.com/davetron5000/methadone/blob/2e670ac24cee3ab8658a1de62a70ff58e7806dc5/lib/methadone/main.rb#L384-L393 |
17,994 | davetron5000/methadone | lib/methadone/main.rb | Methadone.Main.call_main | def call_main
@leak_exceptions = nil unless defined? @leak_exceptions
@main_block.call(*ARGV)
rescue Methadone::Error => ex
raise ex if ENV['DEBUG']
logger.error ex.message unless no_message? ex
ex.exit_code
rescue OptionParser::ParseError
raise
rescue => ex
raise e... | ruby | def call_main
@leak_exceptions = nil unless defined? @leak_exceptions
@main_block.call(*ARGV)
rescue Methadone::Error => ex
raise ex if ENV['DEBUG']
logger.error ex.message unless no_message? ex
ex.exit_code
rescue OptionParser::ParseError
raise
rescue => ex
raise e... | [
"def",
"call_main",
"@leak_exceptions",
"=",
"nil",
"unless",
"defined?",
"@leak_exceptions",
"@main_block",
".",
"call",
"(",
"ARGV",
")",
"rescue",
"Methadone",
"::",
"Error",
"=>",
"ex",
"raise",
"ex",
"if",
"ENV",
"[",
"'DEBUG'",
"]",
"logger",
".",
"err... | Handle calling main and trapping any exceptions thrown | [
"Handle",
"calling",
"main",
"and",
"trapping",
"any",
"exceptions",
"thrown"
] | 2e670ac24cee3ab8658a1de62a70ff58e7806dc5 | https://github.com/davetron5000/methadone/blob/2e670ac24cee3ab8658a1de62a70ff58e7806dc5/lib/methadone/main.rb#L396-L410 |
17,995 | davetron5000/methadone | lib/methadone/main.rb | Methadone.OptionParserProxy.check_args! | def check_args!
::Hash[@args.zip(::ARGV)].each do |arg_name,arg_value|
if @arg_options[arg_name].include? :required
if arg_value.nil?
message = "'#{arg_name.to_s}' is required"
message = "at least one " + message if @arg_options[arg_name].include? :many
raise ... | ruby | def check_args!
::Hash[@args.zip(::ARGV)].each do |arg_name,arg_value|
if @arg_options[arg_name].include? :required
if arg_value.nil?
message = "'#{arg_name.to_s}' is required"
message = "at least one " + message if @arg_options[arg_name].include? :many
raise ... | [
"def",
"check_args!",
"::",
"Hash",
"[",
"@args",
".",
"zip",
"(",
"::",
"ARGV",
")",
"]",
".",
"each",
"do",
"|",
"arg_name",
",",
"arg_value",
"|",
"if",
"@arg_options",
"[",
"arg_name",
"]",
".",
"include?",
":required",
"if",
"arg_value",
".",
"nil... | Create the proxy
+option_parser+:: An OptionParser instance
+options+:: a hash that will store the options
set via automatic setting. The caller should
retain a reference to this | [
"Create",
"the",
"proxy"
] | 2e670ac24cee3ab8658a1de62a70ff58e7806dc5 | https://github.com/davetron5000/methadone/blob/2e670ac24cee3ab8658a1de62a70ff58e7806dc5/lib/methadone/main.rb#L442-L452 |
17,996 | davetron5000/methadone | lib/methadone/main.rb | Methadone.OptionParserProxy.arg | def arg(arg_name,*options)
options << :optional if options.include?(:any) && !options.include?(:optional)
options << :required unless options.include? :optional
options << :one unless options.include?(:any) || options.include?(:many)
@args << arg_name
@arg_options[arg_name] = options
... | ruby | def arg(arg_name,*options)
options << :optional if options.include?(:any) && !options.include?(:optional)
options << :required unless options.include? :optional
options << :one unless options.include?(:any) || options.include?(:many)
@args << arg_name
@arg_options[arg_name] = options
... | [
"def",
"arg",
"(",
"arg_name",
",",
"*",
"options",
")",
"options",
"<<",
":optional",
"if",
"options",
".",
"include?",
"(",
":any",
")",
"&&",
"!",
"options",
".",
"include?",
"(",
":optional",
")",
"options",
"<<",
":required",
"unless",
"options",
".... | Sets the banner to include these arg names | [
"Sets",
"the",
"banner",
"to",
"include",
"these",
"arg",
"names"
] | 2e670ac24cee3ab8658a1de62a70ff58e7806dc5 | https://github.com/davetron5000/methadone/blob/2e670ac24cee3ab8658a1de62a70ff58e7806dc5/lib/methadone/main.rb#L483-L493 |
17,997 | davetron5000/methadone | lib/methadone/sh.rb | Methadone.SH.sh | def sh(command,options={},&block)
sh_logger.debug("Executing '#{command}'")
stdout,stderr,status = execution_strategy.run_command(command)
process_status = Methadone::ProcessStatus.new(status,options[:expected])
sh_logger.warn("stderr output of '#{command}': #{stderr}") unless stderr.strip.len... | ruby | def sh(command,options={},&block)
sh_logger.debug("Executing '#{command}'")
stdout,stderr,status = execution_strategy.run_command(command)
process_status = Methadone::ProcessStatus.new(status,options[:expected])
sh_logger.warn("stderr output of '#{command}': #{stderr}") unless stderr.strip.len... | [
"def",
"sh",
"(",
"command",
",",
"options",
"=",
"{",
"}",
",",
"&",
"block",
")",
"sh_logger",
".",
"debug",
"(",
"\"Executing '#{command}'\"",
")",
"stdout",
",",
"stderr",
",",
"status",
"=",
"execution_strategy",
".",
"run_command",
"(",
"command",
")... | Run a shell command, capturing and logging its output.
If the command completed successfully, it's output is logged at DEBUG.
If not, its output as logged at INFO. In either case, its
error output is logged at WARN.
command:: the command to run as a String or Array of String. The String form is simplest, but
... | [
"Run",
"a",
"shell",
"command",
"capturing",
"and",
"logging",
"its",
"output",
".",
"If",
"the",
"command",
"completed",
"successfully",
"it",
"s",
"output",
"is",
"logged",
"at",
"DEBUG",
".",
"If",
"not",
"its",
"output",
"as",
"logged",
"at",
"INFO",
... | 2e670ac24cee3ab8658a1de62a70ff58e7806dc5 | https://github.com/davetron5000/methadone/blob/2e670ac24cee3ab8658a1de62a70ff58e7806dc5/lib/methadone/sh.rb#L100-L120 |
17,998 | davetron5000/methadone | lib/methadone/sh.rb | Methadone.SH.call_block | def call_block(block,stdout,stderr,exitstatus)
# blocks that take no arguments have arity -1. Or 0. Ugh.
if block.arity > 0
case block.arity
when 1
block.call(stdout)
when 2
block.call(stdout,stderr)
else
# Let it fail for lambdas
bl... | ruby | def call_block(block,stdout,stderr,exitstatus)
# blocks that take no arguments have arity -1. Or 0. Ugh.
if block.arity > 0
case block.arity
when 1
block.call(stdout)
when 2
block.call(stdout,stderr)
else
# Let it fail for lambdas
bl... | [
"def",
"call_block",
"(",
"block",
",",
"stdout",
",",
"stderr",
",",
"exitstatus",
")",
"# blocks that take no arguments have arity -1. Or 0. Ugh.",
"if",
"block",
".",
"arity",
">",
"0",
"case",
"block",
".",
"arity",
"when",
"1",
"block",
".",
"call",
"(",
... | Safely call our block, even if the user passed in a lambda | [
"Safely",
"call",
"our",
"block",
"even",
"if",
"the",
"user",
"passed",
"in",
"a",
"lambda"
] | 2e670ac24cee3ab8658a1de62a70ff58e7806dc5 | https://github.com/davetron5000/methadone/blob/2e670ac24cee3ab8658a1de62a70ff58e7806dc5/lib/methadone/sh.rb#L206-L221 |
17,999 | akretion/ooor | lib/ooor/associations.rb | Ooor.Associations.relationnal_result | def relationnal_result(method_name, *arguments)
self.class.reload_fields_definition(false)
if self.class.many2one_associations.has_key?(method_name)
load_m2o_association(method_name, *arguments)
elsif self.class.polymorphic_m2o_associations.has_key?(method_name)# && @associations[method_name]
... | ruby | def relationnal_result(method_name, *arguments)
self.class.reload_fields_definition(false)
if self.class.many2one_associations.has_key?(method_name)
load_m2o_association(method_name, *arguments)
elsif self.class.polymorphic_m2o_associations.has_key?(method_name)# && @associations[method_name]
... | [
"def",
"relationnal_result",
"(",
"method_name",
",",
"*",
"arguments",
")",
"self",
".",
"class",
".",
"reload_fields_definition",
"(",
"false",
")",
"if",
"self",
".",
"class",
".",
"many2one_associations",
".",
"has_key?",
"(",
"method_name",
")",
"load_m2o_a... | fakes associations like much like ActiveRecord according to the cached OpenERP data model | [
"fakes",
"associations",
"like",
"much",
"like",
"ActiveRecord",
"according",
"to",
"the",
"cached",
"OpenERP",
"data",
"model"
] | f0aa6c70601cc28dbbb519ebec33af40f57b3943 | https://github.com/akretion/ooor/blob/f0aa6c70601cc28dbbb519ebec33af40f57b3943/lib/ooor/associations.rb#L28-L39 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.