code
stringlengths
26
124k
docstring
stringlengths
23
125k
func_name
stringlengths
1
98
language
stringclasses
1 value
repo
stringlengths
5
53
path
stringlengths
7
151
url
stringlengths
50
211
license
stringclasses
7 values
def meta_encoding if (meta = at_xpath("//meta[@charset]")) meta[:charset] elsif (meta = meta_content_type) meta["content"][/charset\s*=\s*([\w-]+)/i, 1] end end
## Get the meta tag encoding for this document. If there is no meta tag, then nil is returned.
meta_encoding
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/html4/document.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/html4/document.rb
Apache-2.0
def title (title = at_xpath("//title")) && title.inner_text end
## Get the title string of this document. Return nil if there is no title tag.
title
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/html4/document.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/html4/document.rb
Apache-2.0
def serialize(options = {}) options[:save_with] ||= XML::Node::SaveOptions::DEFAULT_HTML super end
### Serialize Node using +options+. Save options can also be set using a block. See also Nokogiri::XML::Node::SaveOptions and Node@Serialization+and+Generating+Output. These two statements are equivalent: node.serialize(:encoding => 'UTF-8', :save_with => FORMAT | AS_XML) or node.serialize(:encoding => 'UTF-8') do |config| config.format.as_xml end
serialize
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/html4/document.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/html4/document.rb
Apache-2.0
def fragment(tags = nil) DocumentFragment.new(self, tags, root) end
### Create a Nokogiri::XML::DocumentFragment from +tags+
fragment
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/html4/document.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/html4/document.rb
Apache-2.0
def parse_memory(data, encoding = "UTF-8") raise TypeError unless String === data return if data.empty? ctx = ParserContext.memory(data, encoding) yield ctx if block_given? ctx.parse_with(self) end
## Parse html stored in +data+ using +encoding+
parse_memory
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/html4/sax/parser.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/html4/sax/parser.rb
Apache-2.0
def write(chunk, last_chunk = false) native_write(chunk, last_chunk) end
## Write a +chunk+ of HTML to the PushParser. Any callback methods that can be called will be called immediately.
write
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/html4/sax/push_parser.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/html4/sax/push_parser.rb
Apache-2.0
def finish write("", true) end
## Finish the parsing. This method is only necessary for Nokogiri::HTML4::SAX::Document#end_document to be called.
finish
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/html4/sax/push_parser.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/html4/sax/push_parser.rb
Apache-2.0
def initialize(options = {}, root = nil, &block) if root @doc = root.document @parent = root else @parent = @doc = related_class("Document").new end @context = nil @arity = nil @ns = nil options = DEFAULT_DOCUMENT_OPTIONS.merge(options) options.each do |k, v| @doc.send(:"#{k}=", v) end return unless block @arity = block.arity if @arity <= 0 @context = eval("self", block.binding) instance_eval(&block) else yield self end @parent = @doc end
## Create a new Builder object. +options+ are sent to the top level Document that is being built. Building a document with a particular encoding for example: Nokogiri::XML::Builder.new(:encoding => 'UTF-8') do |xml| ... end
initialize
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/xml/builder.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/xml/builder.rb
Apache-2.0
def to_xml(*args) if Nokogiri.jruby? options = args.first.is_a?(Hash) ? args.shift : {} unless options[:save_with] options[:save_with] = Node::SaveOptions::AS_BUILDER end args.insert(0, options) end @doc.to_xml(*args) end
## Convert this Builder object to XML
to_xml
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/xml/builder.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/xml/builder.rb
Apache-2.0
def insert(node, &block) node = @parent.add_child(node) if block begin old_parent = @parent @parent = node @arity ||= block.arity if @arity <= 0 instance_eval(&block) else yield(self) end ensure @parent = old_parent end end NodeBuilder.new(node, self) end
## Insert +node+ as a child of the current Node
insert
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/xml/builder.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/xml/builder.rb
Apache-2.0
def initialize(document, tags = nil, ctx = nil, options = ParseOptions::DEFAULT_XML) return self unless tags options = Nokogiri::XML::ParseOptions.new(options) if Integer === options yield options if block_given? children = if ctx # Fix for issue#490 if Nokogiri.jruby? # fix for issue #770 ctx.parse("<root #{namespace_declarations(ctx)}>#{tags}</root>", options).children else ctx.parse(tags, options) end else wrapper_doc = XML::Document.parse("<root>#{tags}</root>", nil, nil, options) self.errors = wrapper_doc.errors wrapper_doc.xpath("/root/node()") end children.each { |child| child.parent = self } end
# Create a new DocumentFragment from +tags+. If +ctx+ is present, it is used as a context node for the subtree created, e.g., namespaces will be resolved relative to +ctx+.
initialize
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/xml/document_fragment.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/xml/document_fragment.rb
Apache-2.0
def to_html(*args) if Nokogiri.jruby? options = args.first.is_a?(Hash) ? args.shift : {} unless options[:save_with] options[:save_with] = Node::SaveOptions::NO_DECLARATION | Node::SaveOptions::NO_EMPTY_TAGS | Node::SaveOptions::AS_HTML end args.insert(0, options) end children.to_html(*args) end
## Convert this DocumentFragment to html See Nokogiri::XML::NodeSet#to_html
to_html
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/xml/document_fragment.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/xml/document_fragment.rb
Apache-2.0
def to_xhtml(*args) if Nokogiri.jruby? options = args.first.is_a?(Hash) ? args.shift : {} unless options[:save_with] options[:save_with] = Node::SaveOptions::NO_DECLARATION | Node::SaveOptions::NO_EMPTY_TAGS | Node::SaveOptions::AS_XHTML end args.insert(0, options) end children.to_xhtml(*args) end
## Convert this DocumentFragment to xhtml See Nokogiri::XML::NodeSet#to_xhtml
to_xhtml
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/xml/document_fragment.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/xml/document_fragment.rb
Apache-2.0
def css(*args) if children.any? children.css(*args) # 'children' is a smell here else NodeSet.new(document) end end
## call-seq: css *rules, [namespace-bindings, custom-pseudo-class] Search this fragment for CSS +rules+. +rules+ must be one or more CSS selectors. For example: For more information see Nokogiri::XML::Searchable#css
css
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/xml/document_fragment.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/xml/document_fragment.rb
Apache-2.0
def search(*rules) rules, handler, ns, binds = extract_params(rules) rules.inject(NodeSet.new(document)) do |set, rule| set + if Searchable::LOOKS_LIKE_XPATH.match?(rule) xpath(*[rule, ns, handler, binds].compact) else children.css(*[rule, ns, handler].compact) # 'children' is a smell here end end end
NOTE that we don't delegate #xpath to children ... another smell. def xpath ; end ## call-seq: search *paths, [namespace-bindings, xpath-variable-bindings, custom-handler-class] Search this fragment for +paths+. +paths+ must be one or more XPath or CSS queries. For more information see Nokogiri::XML::Searchable#search
search
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/xml/document_fragment.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/xml/document_fragment.rb
Apache-2.0
def children [c1, c2].compact end
## Get the children of this ElementContent node
children
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/xml/element_content.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/xml/element_content.rb
Apache-2.0
def add_child(node_or_tags) node_or_tags = coerce(node_or_tags) if node_or_tags.is_a?(XML::NodeSet) node_or_tags.each { |n| add_child_node_and_reparent_attrs(n) } else add_child_node_and_reparent_attrs(node_or_tags) end node_or_tags end
:section: Manipulating Document Structure ## Add +node_or_tags+ as a child of this Node. +node_or_tags+ can be a Nokogiri::XML::Node, a ::DocumentFragment, a ::NodeSet, or a string containing markup. Returns the reparented node (if +node_or_tags+ is a Node), or NodeSet (if +node_or_tags+ is a DocumentFragment, NodeSet, or string). Also see related method +<<+.
add_child
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/xml/node.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/xml/node.rb
Apache-2.0
def prepend_child(node_or_tags) if (first = children.first) # Mimic the error add_child would raise. raise "Document already has a root node" if document? && !(node_or_tags.comment? || node_or_tags.processing_instruction?) first.__send__(:add_sibling, :previous, node_or_tags) else add_child(node_or_tags) end end
## Add +node_or_tags+ as the first child of this Node. +node_or_tags+ can be a Nokogiri::XML::Node, a ::DocumentFragment, a ::NodeSet, or a string containing markup. Returns the reparented node (if +node_or_tags+ is a Node), or NodeSet (if +node_or_tags+ is a DocumentFragment, NodeSet, or string). Also see related method +add_child+.
prepend_child
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/xml/node.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/xml/node.rb
Apache-2.0
def wrap(html) new_parent = document.parse(html).first add_next_sibling(new_parent) new_parent.add_child(self) self end
## Add html around this node Returns self
wrap
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/xml/node.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/xml/node.rb
Apache-2.0
def add_previous_sibling(node_or_tags) raise ArgumentError, "A document may not have multiple root nodes." if parent&.document? && !(node_or_tags.comment? || node_or_tags.processing_instruction?) add_sibling(:previous, node_or_tags) end
## Insert +node_or_tags+ before this Node (as a sibling). +node_or_tags+ can be a Nokogiri::XML::Node, a ::DocumentFragment, a ::NodeSet, or a string containing markup. Returns the reparented node (if +node_or_tags+ is a Node), or NodeSet (if +node_or_tags+ is a DocumentFragment, NodeSet, or string). Also see related method +before+.
add_previous_sibling
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/xml/node.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/xml/node.rb
Apache-2.0
def add_next_sibling(node_or_tags) raise ArgumentError, "A document may not have multiple root nodes." if parent&.document? && !(node_or_tags.comment? || node_or_tags.processing_instruction?) add_sibling(:next, node_or_tags) end
## Insert +node_or_tags+ after this Node (as a sibling). +node_or_tags+ can be a Nokogiri::XML::Node, a ::DocumentFragment, a ::NodeSet, or a string containing markup. Returns the reparented node (if +node_or_tags+ is a Node), or NodeSet (if +node_or_tags+ is a DocumentFragment, NodeSet, or string). Also see related method +after+.
add_next_sibling
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/xml/node.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/xml/node.rb
Apache-2.0
def before(node_or_tags) add_previous_sibling(node_or_tags) self end
### Insert +node_or_tags+ before this node (as a sibling). +node_or_tags+ can be a Nokogiri::XML::Node, a ::DocumentFragment, a ::NodeSet, or a string containing markup. Returns self, to support chaining of calls. Also see related method +add_previous_sibling+.
before
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/xml/node.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/xml/node.rb
Apache-2.0
def after(node_or_tags) add_next_sibling(node_or_tags) self end
### Insert +node_or_tags+ after this node (as a sibling). +node_or_tags+ can be a Nokogiri::XML::Node, a Nokogiri::XML::DocumentFragment, or a string containing markup. Returns self, to support chaining of calls. Also see related method +add_next_sibling+.
after
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/xml/node.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/xml/node.rb
Apache-2.0
def replace(node_or_tags) raise("Cannot replace a node with no parent") unless parent # We cannot replace a text node directly, otherwise libxml will return # an internal error at parser.c:13031, I don't know exactly why # libxml is trying to find a parent node that is an element or document # so I can't tell if this is bug in libxml or not. issue #775. if text? replacee = Nokogiri::XML::Node.new("dummy", document) add_previous_sibling_node(replacee) unlink return replacee.replace(node_or_tags) end node_or_tags = parent.coerce(node_or_tags) if node_or_tags.is_a?(XML::NodeSet) node_or_tags.each { |n| add_previous_sibling(n) } unlink else replace_node(node_or_tags) end node_or_tags end
### Replace this Node with +node_or_tags+. +node_or_tags+ can be a Nokogiri::XML::Node, a ::DocumentFragment, a ::NodeSet, or a string containing markup. Returns the reparented node (if +node_or_tags+ is a Node), or NodeSet (if +node_or_tags+ is a DocumentFragment, NodeSet, or string). Also see related method +swap+.
replace
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/xml/node.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/xml/node.rb
Apache-2.0
def swap(node_or_tags) replace(node_or_tags) self end
### Swap this Node for +node_or_tags+ +node_or_tags+ can be a Nokogiri::XML::Node, a ::DocumentFragment, a ::NodeSet, or a string containing markup. Returns self, to support chaining of calls. Also see related method +replace+.
swap
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/xml/node.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/xml/node.rb
Apache-2.0
def do_xinclude(options = XML::ParseOptions::DEFAULT_XML) options = Nokogiri::XML::ParseOptions.new(options) if Integer === options yield options if block_given? # call c extension process_xincludes(options.to_i) end
## Do xinclude substitution on the subtree below node. If given a block, a Nokogiri::XML::ParseOptions object initialized from +options+, will be passed to it, allowing more convenient modification of the parser options.
do_xinclude
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/xml/node.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/xml/node.rb
Apache-2.0
def initialize(document, list = []) @document = document document.decorate(self) list.each { |x| self << x } yield self if block_given? end
Create a NodeSet with +document+ defaulting to +list+
initialize
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/xml/node_set.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/xml/node_set.rb
Apache-2.0
def first(n = nil) return self[0] unless n list = [] [n, length].min.times { |i| list << self[i] } list end
## Get the first element of the NodeSet.
first
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/xml/node_set.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/xml/node_set.rb
Apache-2.0
def index(node = nil) if node warn("given block not used") if block_given? each_with_index { |member, j| return j if member == node } elsif block_given? each_with_index { |member, j| return j if yield(member) } end nil end
## Returns the index of the first node in self that is == to +node+ or meets the given block. Returns nil if no match is found.
index
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/xml/node_set.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/xml/node_set.rb
Apache-2.0
def css(*args) rules, handler, ns, _ = extract_params(args) paths = css_rules_to_xpath(rules, ns) inject(NodeSet.new(document)) do |set, node| set + xpath_internal(node, paths, handler, ns, nil) end end
## call-seq: css *rules, [namespace-bindings, custom-pseudo-class] Search this node set for CSS +rules+. +rules+ must be one or more CSS selectors. For example: For more information see Nokogiri::XML::Searchable#css
css
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/xml/node_set.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/xml/node_set.rb
Apache-2.0
def xpath(*args) paths, handler, ns, binds = extract_params(args) inject(NodeSet.new(document)) do |set, node| set + xpath_internal(node, paths, handler, ns, binds) end end
## call-seq: xpath *paths, [namespace-bindings, variable-bindings, custom-handler-class] Search this node set for XPath +paths+. +paths+ must be one or more XPath queries. For more information see Nokogiri::XML::Searchable#xpath
xpath
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/xml/node_set.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/xml/node_set.rb
Apache-2.0
def at(*args) if args.length == 1 && args.first.is_a?(Numeric) return self[args.first] end super(*args) end
## call-seq: search *paths, [namespace-bindings, xpath-variable-bindings, custom-handler-class] Search this object for +paths+, and return only the first result. +paths+ must be one or more XPath or CSS queries. See Searchable#search for more information. Or, if passed an integer, index into the NodeSet: node_set.at(3) # same as node_set[3]
at
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/xml/node_set.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/xml/node_set.rb
Apache-2.0
def filter(expr) find_all { |node| node.matches?(expr) } end
## Filter this list for nodes that match +expr+
filter
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/xml/node_set.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/xml/node_set.rb
Apache-2.0
def add_class(name) each do |el| el.add_class(name) end self end
## Add the class attribute +name+ to all Node objects in the NodeSet. See Nokogiri::XML::Node#add_class for more information.
add_class
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/xml/node_set.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/xml/node_set.rb
Apache-2.0
def append_class(name) each do |el| el.append_class(name) end self end
## Append the class attribute +name+ to all Node objects in the NodeSet. See Nokogiri::XML::Node#append_class for more information.
append_class
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/xml/node_set.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/xml/node_set.rb
Apache-2.0
def remove_class(name = nil) each do |el| el.remove_class(name) end self end
## Remove the class attribute +name+ from all Node objects in the NodeSet. See Nokogiri::XML::Node#remove_class for more information.
remove_class
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/xml/node_set.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/xml/node_set.rb
Apache-2.0
def attr(key, value = nil, &block) unless key.is_a?(Hash) || (key && (value || block)) return first ? first.attribute(key) : nil end hash = key.is_a?(Hash) ? key : { key => value } hash.each do |k, v| each do |node| node[k] = v || yield(node) end end self end
## Set attributes on each Node in the NodeSet, or get an attribute from the first Node in the NodeSet. To get an attribute from the first Node in a NodeSet: node_set.attr("href") # => "https://www.nokogiri.org" Note that an empty NodeSet will return nil when +#attr+ is called as a getter. To set an attribute on each node, +key+ can either be an attribute name, or a Hash of attribute names and values. When called as a setter, +#attr+ returns the NodeSet. If +key+ is an attribute name, then either +value+ or +block+ must be passed. If +key+ is a Hash then attributes will be set for each key/value pair: node_set.attr("href" => "https://www.nokogiri.org", "class" => "member") If +value+ is passed, it will be used as the attribute value for all nodes: node_set.attr("href", "https://www.nokogiri.org") If +block+ is passed, it will be called on each Node object in the NodeSet and the return value used as the attribute value for that node: node_set.attr("class") { |node| node.name }
attr
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/xml/node_set.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/xml/node_set.rb
Apache-2.0
def remove_attr(name) each { |el| el.delete(name) } self end
## Remove the attributed named +name+ from all Node objects in the NodeSet
remove_attr
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/xml/node_set.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/xml/node_set.rb
Apache-2.0
def each return to_enum unless block_given? 0.upto(length - 1) do |x| yield self[x] end self end
## Iterate over each node, yielding to +block+
each
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/xml/node_set.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/xml/node_set.rb
Apache-2.0
def inner_html(*args) collect { |j| j.inner_html(*args) }.join("") end
## Get the inner html of all contained Node objects
inner_html
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/xml/node_set.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/xml/node_set.rb
Apache-2.0
def pop return nil if length == 0 delete(last) end
## Removes the last element from set and returns it, or +nil+ if the set is empty
pop
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/xml/node_set.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/xml/node_set.rb
Apache-2.0
def shift return nil if length == 0 delete(first) end
## Returns the first element of the NodeSet and removes it. Returns +nil+ if the set is empty.
shift
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/xml/node_set.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/xml/node_set.rb
Apache-2.0
def children node_set = NodeSet.new(document) each do |node| node.children.each { |n| node_set.push(n) } end node_set end
## Returns a new NodeSet containing all the children of all the nodes in the NodeSet
children
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/xml/node_set.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/xml/node_set.rb
Apache-2.0
def reverse node_set = NodeSet.new(document) (length - 1).downto(0) do |x| node_set.push(self[x]) end node_set end
## Returns a new NodeSet containing all the nodes in the NodeSet in reverse order
reverse
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/xml/node_set.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/xml/node_set.rb
Apache-2.0
def each while (cursor = read) yield cursor end end
## Move the cursor through the document yielding the cursor to the block
each
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/xml/reader.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/xml/reader.rb
Apache-2.0
def validate(thing) if thing.is_a?(Nokogiri::XML::Document) validate_document(thing) elsif File.file?(thing) validate_file(thing) else raise ArgumentError, "Must provide Nokogiri::Xml::Document or the name of an existing file" end end
## Validate +thing+ against this schema. +thing+ can be a Nokogiri::XML::Document object, or a filename. An Array of Nokogiri::XML::SyntaxError objects found while validating the +thing+ is returned.
validate
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/xml/schema.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/xml/schema.rb
Apache-2.0
def none? level == 0 end
## return true if this is a non error
none?
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/xml/syntax_error.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/xml/syntax_error.rb
Apache-2.0
def warning? level == 1 end
## return true if this is a warning
warning?
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/xml/syntax_error.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/xml/syntax_error.rb
Apache-2.0
def error? level == 2 end
## return true if this is an error
error?
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/xml/syntax_error.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/xml/syntax_error.rb
Apache-2.0
def fatal? level == 3 end
## return true if this error is fatal
fatal?
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/xml/syntax_error.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/xml/syntax_error.rb
Apache-2.0
def initialize(options = 0) @options = options end
Create a new SaveOptions object with +options+
initialize
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/xml/node/save_options.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/xml/node/save_options.rb
Apache-2.0
def start_element_namespace(name, attrs = [], prefix = nil, uri = nil, ns = []) ### # Deal with SAX v1 interface name = [prefix, name].compact.join(":") attributes = ns.map do |ns_prefix, ns_uri| [["xmlns", ns_prefix].compact.join(":"), ns_uri] end + attrs.map do |attr| [[attr.prefix, attr.localname].compact.join(":"), attr.value] end start_element(name, attributes) end
## Called at the beginning of an element +name+ is the element name +attrs+ is a list of attributes +prefix+ is the namespace prefix for the element +uri+ is the associated namespace URI +ns+ is a hash of namespace prefix:urls associated with the element
start_element_namespace
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/xml/sax/document.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/xml/sax/document.rb
Apache-2.0
def end_element_namespace(name, prefix = nil, uri = nil) ### # Deal with SAX v1 interface end_element([prefix, name].compact.join(":")) end
## Called at the end of an element +name+ is the element's name +prefix+ is the namespace prefix associated with the element +uri+ is the associated namespace URI
end_element_namespace
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/xml/sax/document.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/xml/sax/document.rb
Apache-2.0
def initialize(doc = Nokogiri::XML::SAX::Document.new, encoding = "UTF-8") @encoding = check_encoding(encoding) @document = doc @warned = false end
Create a new Parser with +doc+ and +encoding+
initialize
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/xml/sax/parser.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/xml/sax/parser.rb
Apache-2.0
def parse(thing, &block) if thing.respond_to?(:read) && thing.respond_to?(:close) parse_io(thing, &block) else parse_memory(thing, &block) end end
## Parse given +thing+ which may be a string containing xml, or an IO object.
parse
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/xml/sax/parser.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/xml/sax/parser.rb
Apache-2.0
def initialize(doc = XML::SAX::Document.new, file_name = nil, encoding = "UTF-8") @document = doc @encoding = encoding @sax_parser = XML::SAX::Parser.new(doc) ## Create our push parser context initialize_native(@sax_parser, file_name) end
## Create a new PushParser with +doc+ as the SAX Document, providing an optional +file_name+ and +encoding+
initialize
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/xml/sax/push_parser.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/xml/sax/push_parser.rb
Apache-2.0
def write(chunk, last_chunk = false) native_write(chunk, last_chunk) end
## Write a +chunk+ of XML to the PushParser. Any callback methods that can be called will be called immediately.
write
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/xml/sax/push_parser.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/xml/sax/push_parser.rb
Apache-2.0
def finish write("", true) end
## Finish the parsing. This method is only necessary for Nokogiri::XML::SAX::Document#end_document to be called.
finish
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/xml/sax/push_parser.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/xml/sax/push_parser.rb
Apache-2.0
def apply_to(document, params = []) serialize(transform(document, params)) end
## Apply an XSLT stylesheet to an XML::Document. +params+ is an array of strings used as XSLT parameters. returns serialized document
apply_to
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/xslt/stylesheet.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/nokogiri/xslt/stylesheet.rb
Apache-2.0
def initialize(host, opt = {}) super @parser = ::Nokogiri::XML::SAX::Parser.new(self, @charset || "UTF-8") end
## Create a new XSD parser with +host+ and +opt+
initialize
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/xsd/xmlparser/nokogiri.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/xsd/xmlparser/nokogiri.rb
Apache-2.0
def start_element(name, attrs = []) super(name, Hash[*attrs.flatten]) end
## Handle the start_element event with +name+ and +attrs+
start_element
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/xsd/xmlparser/nokogiri.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/xsd/xmlparser/nokogiri.rb
Apache-2.0
def start_element_namespace(name, attrs = [], prefix = nil, uri = nil, ns = []) ### # Deal with SAX v1 interface name = [prefix, name].compact.join(":") attributes = ns.map do |ns_prefix, ns_uri| [["xmlns", ns_prefix].compact.join(":"), ns_uri] end + attrs.map do |attr| [[attr.prefix, attr.localname].compact.join(":"), attr.value] end.flatten start_element(name, attributes) end
## Called at the beginning of an element +name+ is the element name +attrs+ is a list of attributes +prefix+ is the namespace prefix for the element +uri+ is the associated namespace URI +ns+ is a hash of namespace prefix:urls associated with the element
start_element_namespace
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/xsd/xmlparser/nokogiri.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/xsd/xmlparser/nokogiri.rb
Apache-2.0
def end_element_namespace(name, prefix = nil, uri = nil) ### # Deal with SAX v1 interface end_element([prefix, name].compact.join(":")) end
## Called at the end of an element +name+ is the element's name +prefix+ is the namespace prefix associated with the element +uri+ is the associated namespace URI
end_element_namespace
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/xsd/xmlparser/nokogiri.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/nokogiri-1.13.10-x86_64-linux/lib/xsd/xmlparser/nokogiri.rb
Apache-2.0
def client return @client if defined?(@client) && @client.same_options?(options) @client = Octokit::Client.new(options) end
API client based on configured options {Configurable} @return [Octokit::Client] API wrapper
client
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/octokit-4.25.1/lib/octokit.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/octokit-4.25.1/lib/octokit.rb
Apache-2.0
def enterprise_admin_client if defined?(@enterprise_admin_client) && @enterprise_admin_client.same_options?(options) return @enterprise_admin_client end @enterprise_admin_client = Octokit::EnterpriseAdminClient.new(options) end
EnterpriseAdminClient client based on configured options {Configurable} @return [Octokit::EnterpriseAdminClient] API wrapper
enterprise_admin_client
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/octokit-4.25.1/lib/octokit.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/octokit-4.25.1/lib/octokit.rb
Apache-2.0
def enterprise_management_console_client if defined?(@enterprise_management_console_client) && @enterprise_management_console_client.same_options?(options) return @enterprise_management_console_client end @enterprise_management_console_client = Octokit::EnterpriseManagementConsoleClient.new(options) end
EnterpriseManagementConsoleClient client based on configured options {Configurable} @return [Octokit::EnterpriseManagementConsoleClient] API wrapper
enterprise_management_console_client
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/octokit-4.25.1/lib/octokit.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/octokit-4.25.1/lib/octokit.rb
Apache-2.0
def basic_authenticated? !!(@login && @password) end
Indicates if the client was supplied Basic Auth username and password @see https://developer.github.com/v3/#authentication @return [Boolean]
basic_authenticated?
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/octokit-4.25.1/lib/octokit/authentication.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/octokit-4.25.1/lib/octokit/authentication.rb
Apache-2.0
def user_authenticated? basic_authenticated? || token_authenticated? end
Indicates if the client was supplied an OAuth access token or Basic Auth username and password @see https://developer.github.com/v3/#authentication @return [Boolean]
user_authenticated?
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/octokit-4.25.1/lib/octokit/authentication.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/octokit-4.25.1/lib/octokit/authentication.rb
Apache-2.0
def inspect inspected = super # mask password inspected.gsub! @password, '*******' if @password if @management_console_password inspected.gsub! @management_console_password, '*******' end inspected.gsub! @bearer_token, '********' if @bearer_token # Only show last 4 of token, secret if @access_token inspected.gsub! @access_token, "#{'*' * 36}#{@access_token[36..-1]}" end if @client_secret inspected.gsub! @client_secret, "#{'*' * 36}#{@client_secret[36..-1]}" end inspected end
Text representation of the client, masking tokens and passwords @return [String]
inspect
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/octokit-4.25.1/lib/octokit/client.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/octokit-4.25.1/lib/octokit/client.rb
Apache-2.0
def as_app(key = client_id, secret = client_secret) if key.to_s.empty? || secret.to_s.empty? raise ApplicationCredentialsRequired, 'client_id and client_secret required' end app_client = dup app_client.client_id = app_client.client_secret = nil app_client.login = key app_client.password = secret yield app_client if block_given? end
Duplicate client using client_id and client_secret as Basic Authentication credentials. @example Octokit.client_id = "foo" Octokit.client_secret = "bar" # GET https://api.github.com/?client_id=foo&client_secret=bar Octokit.get "/" Octokit.client.as_app do |client| # GET https://foo:[email protected]/ client.get "/" end
as_app
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/octokit-4.25.1/lib/octokit/client.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/octokit-4.25.1/lib/octokit/client.rb
Apache-2.0
def keys @keys ||= %i[ access_token api_endpoint auto_paginate bearer_token client_id client_secret connection_options default_media_type login management_console_endpoint management_console_password middleware netrc netrc_file per_page password proxy ssl_verify_mode user_agent web_endpoint ] end
List of configurable keys for {Octokit::Client} @return [Array] of option keys
keys
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/octokit-4.25.1/lib/octokit/configurable.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/octokit-4.25.1/lib/octokit/configurable.rb
Apache-2.0
def reset! # rubocop:disable Style/HashEachMethods # # This may look like a `.keys.each` which should be replaced with `#each_key`, but # this doesn't actually work, since `#keys` is just a method we've defined ourselves. # The class doesn't fulfill the whole `Enumerable` contract. Octokit::Configurable.keys.each do |key| # rubocop:enable Style/HashEachMethods instance_variable_set(:"@#{key}", Octokit::Default.options[key]) end self end
Reset configuration options to default values
reset!
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/octokit-4.25.1/lib/octokit/configurable.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/octokit-4.25.1/lib/octokit/configurable.rb
Apache-2.0
def same_options?(opts) opts.hash == options.hash end
Compares client options to a Hash of requested options @param opts [Hash] Options to compare with current client options @return [Boolean]
same_options?
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/octokit-4.25.1/lib/octokit/configurable.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/octokit-4.25.1/lib/octokit/configurable.rb
Apache-2.0
def web_endpoint File.join(@web_endpoint, '') end
Base URL for generated web URLs @return [String] Default: https://github.com/
web_endpoint
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/octokit-4.25.1/lib/octokit/configurable.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/octokit-4.25.1/lib/octokit/configurable.rb
Apache-2.0
def get(url, options = {}) request :get, url, parse_query_and_convenience_headers(options) end
Make a HTTP GET request @param url [String] The path, relative to {#api_endpoint} @param options [Hash] Query and header params for request @return [Sawyer::Resource]
get
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/octokit-4.25.1/lib/octokit/connection.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/octokit-4.25.1/lib/octokit/connection.rb
Apache-2.0
def post(url, options = {}) request :post, url, options end
Make a HTTP POST request @param url [String] The path, relative to {#api_endpoint} @param options [Hash] Body and header params for request @return [Sawyer::Resource]
post
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/octokit-4.25.1/lib/octokit/connection.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/octokit-4.25.1/lib/octokit/connection.rb
Apache-2.0
def put(url, options = {}) request :put, url, options end
Make a HTTP PUT request @param url [String] The path, relative to {#api_endpoint} @param options [Hash] Body and header params for request @return [Sawyer::Resource]
put
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/octokit-4.25.1/lib/octokit/connection.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/octokit-4.25.1/lib/octokit/connection.rb
Apache-2.0
def patch(url, options = {}) request :patch, url, options end
Make a HTTP PATCH request @param url [String] The path, relative to {#api_endpoint} @param options [Hash] Body and header params for request @return [Sawyer::Resource]
patch
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/octokit-4.25.1/lib/octokit/connection.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/octokit-4.25.1/lib/octokit/connection.rb
Apache-2.0
def delete(url, options = {}) request :delete, url, options end
Make a HTTP DELETE request @param url [String] The path, relative to {#api_endpoint} @param options [Hash] Query and header params for request @return [Sawyer::Resource]
delete
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/octokit-4.25.1/lib/octokit/connection.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/octokit-4.25.1/lib/octokit/connection.rb
Apache-2.0
def head(url, options = {}) request :head, url, parse_query_and_convenience_headers(options) end
Make a HTTP HEAD request @param url [String] The path, relative to {#api_endpoint} @param options [Hash] Query and header params for request @return [Sawyer::Resource]
head
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/octokit-4.25.1/lib/octokit/connection.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/octokit-4.25.1/lib/octokit/connection.rb
Apache-2.0
def paginate(url, options = {}) opts = parse_query_and_convenience_headers(options) if @auto_paginate || @per_page opts[:query][:per_page] ||= @per_page || (@auto_paginate ? 100 : nil) end data = request(:get, url, opts.dup) if @auto_paginate while @last_response.rels[:next] && rate_limit.remaining > 0 @last_response = @last_response.rels[:next].get(headers: opts[:headers]) if block_given? yield(data, @last_response) else data.concat(@last_response.data) if @last_response.data.is_a?(Array) end end end data end
Make one or more HTTP GET requests, optionally fetching the next page of results from URL in Link response header based on value in {#auto_paginate}. @param url [String] The path, relative to {#api_endpoint} @param options [Hash] Query and header params for request @param block [Block] Block to perform the data concatination of the multiple requests. The block is called with two parameters, the first contains the contents of the requests so far and the second parameter contains the latest response. @return [Sawyer::Resource]
paginate
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/octokit-4.25.1/lib/octokit/connection.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/octokit-4.25.1/lib/octokit/connection.rb
Apache-2.0
def agent @agent ||= Sawyer::Agent.new(endpoint, sawyer_options) do |http| http.headers[:accept] = default_media_type http.headers[:content_type] = 'application/json' http.headers[:user_agent] = user_agent if basic_authenticated? http.request(*FARADAY_BASIC_AUTH_KEYS, @login, @password) elsif token_authenticated? http.request :authorization, 'token', @access_token elsif bearer_authenticated? http.request :authorization, 'Bearer', @bearer_token elsif application_authenticated? http.request(*FARADAY_BASIC_AUTH_KEYS, @client_id, @client_secret) end end end
Hypermedia agent for the GitHub API @return [Sawyer::Agent]
agent
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/octokit-4.25.1/lib/octokit/connection.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/octokit-4.25.1/lib/octokit/connection.rb
Apache-2.0
def root get '/' end
Fetch the root resource for the API @return [Sawyer::Resource]
root
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/octokit-4.25.1/lib/octokit/connection.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/octokit-4.25.1/lib/octokit/connection.rb
Apache-2.0
def last_response @last_response if defined? @last_response end
Response for last HTTP request @return [Sawyer::Response]
last_response
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/octokit-4.25.1/lib/octokit/connection.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/octokit-4.25.1/lib/octokit/connection.rb
Apache-2.0
def boolean_from_response(method, path, options = {}) request(method, path, options) [201, 202, 204].include? @last_response.status rescue Octokit::NotFound false end
Executes the request, checking if it was successful @return [Boolean] True on success, false otherwise
boolean_from_response
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/octokit-4.25.1/lib/octokit/connection.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/octokit-4.25.1/lib/octokit/connection.rb
Apache-2.0
def api_endpoint ENV['OCTOKIT_API_ENDPOINT'] || API_ENDPOINT end
Default API endpoint from ENV or {API_ENDPOINT} @return [String]
api_endpoint
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/octokit-4.25.1/lib/octokit/default.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/octokit-4.25.1/lib/octokit/default.rb
Apache-2.0
def connection_options { headers: { accept: default_media_type, user_agent: user_agent } } end
Default options for Faraday::Connection @return [Hash]
connection_options
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/octokit-4.25.1/lib/octokit/default.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/octokit-4.25.1/lib/octokit/default.rb
Apache-2.0
def default_media_type ENV['OCTOKIT_DEFAULT_MEDIA_TYPE'] || MEDIA_TYPE end
Default media type from ENV or {MEDIA_TYPE} @return [String]
default_media_type
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/octokit-4.25.1/lib/octokit/default.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/octokit-4.25.1/lib/octokit/default.rb
Apache-2.0
def per_page page_size = ENV['OCTOKIT_PER_PAGE'] page_size&.to_i end
Default pagination page size from ENV @return [Integer] Page size
per_page
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/octokit-4.25.1/lib/octokit/default.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/octokit-4.25.1/lib/octokit/default.rb
Apache-2.0
def ssl_verify_mode # 0 is OpenSSL::SSL::VERIFY_NONE # 1 is OpenSSL::SSL::SSL_VERIFY_PEER # the standard default for SSL is SSL_VERIFY_PEER which requires a server certificate check on the client ENV.fetch('OCTOKIT_SSL_VERIFY_MODE', 1).to_i end
Default SSL verify mode from ENV @return [Integer]
ssl_verify_mode
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/octokit-4.25.1/lib/octokit/default.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/octokit-4.25.1/lib/octokit/default.rb
Apache-2.0
def user_agent ENV['OCTOKIT_USER_AGENT'] || USER_AGENT end
Default User-Agent header string from ENV or {USER_AGENT} @return [String]
user_agent
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/octokit-4.25.1/lib/octokit/default.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/octokit-4.25.1/lib/octokit/default.rb
Apache-2.0
def web_endpoint ENV['OCTOKIT_WEB_ENDPOINT'] || WEB_ENDPOINT end
Default web endpoint from ENV or {WEB_ENDPOINT} @return [String]
web_endpoint
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/octokit-4.25.1/lib/octokit/default.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/octokit-4.25.1/lib/octokit/default.rb
Apache-2.0
def netrc ENV['OCTOKIT_NETRC'] || false end
Default behavior for reading .netrc file @return [Boolean]
netrc
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/octokit-4.25.1/lib/octokit/default.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/octokit-4.25.1/lib/octokit/default.rb
Apache-2.0
def netrc_file ENV['OCTOKIT_NETRC_FILE'] || File.join(ENV['HOME'].to_s, '.netrc') end
Default path for .netrc file @return [String]
netrc_file
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/octokit-4.25.1/lib/octokit/default.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/octokit-4.25.1/lib/octokit/default.rb
Apache-2.0
def documentation_url data[:documentation_url] if data.is_a? Hash end
Documentation URL returned by the API for some errors @return [String]
documentation_url
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/octokit-4.25.1/lib/octokit/error.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/octokit-4.25.1/lib/octokit/error.rb
Apache-2.0
def errors if data&.is_a?(Hash) data[:errors] || [] else [] end end
Array of validation errors @return [Array<Hash>] Error info
errors
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/octokit-4.25.1/lib/octokit/error.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/octokit-4.25.1/lib/octokit/error.rb
Apache-2.0
def password_delivery @password_delivery ||= delivery_method_from_header end
Delivery method for the user's OTP @return [String]
password_delivery
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/octokit-4.25.1/lib/octokit/error.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/octokit-4.25.1/lib/octokit/error.rb
Apache-2.0
def initialize(repo) case repo when Integer @id = repo when NAME_WITH_OWNER_PATTERN @owner, @name = repo.split('/') when Repository @owner = repo.owner @name = repo.name when Hash @name = repo[:repo] || repo[:name] @owner = repo[:owner] || repo[:user] || repo[:username] else raise_invalid_repository!(repo) end validate_owner_and_name!(repo) if @owner && @name end
@raise [Octokit::InvalidRepository] if the repository has an invalid format
initialize
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/octokit-4.25.1/lib/octokit/repository.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/octokit-4.25.1/lib/octokit/repository.rb
Apache-2.0
def octokit_warn(*message) warn message unless ENV['OCTOKIT_SILENT'] end
Wrapper around Kernel#warn to print warnings unless OCTOKIT_SILENT is set to true. @return [nil]
octokit_warn
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/octokit-4.25.1/lib/octokit/warnable.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/octokit-4.25.1/lib/octokit/warnable.rb
Apache-2.0
def get_public_key(repo) get "#{Repository.path repo}/actions/secrets/public-key" end
Get public key for secrets encryption @param repo [Integer, String, Hash, Repository] A GitHub repository @return [Hash] key_id and key @see https://developer.github.com/v3/actions/secrets/#get-your-public-key
get_public_key
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/octokit-4.25.1/lib/octokit/client/actions_secrets.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/octokit-4.25.1/lib/octokit/client/actions_secrets.rb
Apache-2.0