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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
14,500 | ruby-grape/grape-entity | lib/grape_entity/entity.rb | Grape.Entity.serializable_hash | def serializable_hash(runtime_options = {})
return nil if object.nil?
opts = options.merge(runtime_options || {})
root_exposure.serializable_value(self, opts)
end | ruby | def serializable_hash(runtime_options = {})
return nil if object.nil?
opts = options.merge(runtime_options || {})
root_exposure.serializable_value(self, opts)
end | [
"def",
"serializable_hash",
"(",
"runtime_options",
"=",
"{",
"}",
")",
"return",
"nil",
"if",
"object",
".",
"nil?",
"opts",
"=",
"options",
".",
"merge",
"(",
"runtime_options",
"||",
"{",
"}",
")",
"root_exposure",
".",
"serializable_value",
"(",
"self",
... | The serializable hash is the Entity's primary output. It is the transformed
hash for the given data model and is used as the basis for serialization to
JSON and other formats.
@param runtime_options [Hash] Any options you pass in here will be known to the entity
representation, this is where you can trigger thin... | [
"The",
"serializable",
"hash",
"is",
"the",
"Entity",
"s",
"primary",
"output",
".",
"It",
"is",
"the",
"transformed",
"hash",
"for",
"the",
"given",
"data",
"model",
"and",
"is",
"used",
"as",
"the",
"basis",
"for",
"serialization",
"to",
"JSON",
"and",
... | 1443468f6593360b44d2ca6da5f03b19e51a2be1 | https://github.com/ruby-grape/grape-entity/blob/1443468f6593360b44d2ca6da5f03b19e51a2be1/lib/grape_entity/entity.rb#L489-L495 |
14,501 | jmazzi/crypt_keeper | spec/support/active_record.rb | CryptKeeper.LoggedQueries.logged_queries | def logged_queries(&block)
queries = []
subscriber = ActiveSupport::Notifications
.subscribe('sql.active_record') do |name, started, finished, id, payload|
queries << payload[:sql]
end
block.call
queries
ensure ActiveSupport::Notifications.unsubscribe(subscriber)
... | ruby | def logged_queries(&block)
queries = []
subscriber = ActiveSupport::Notifications
.subscribe('sql.active_record') do |name, started, finished, id, payload|
queries << payload[:sql]
end
block.call
queries
ensure ActiveSupport::Notifications.unsubscribe(subscriber)
... | [
"def",
"logged_queries",
"(",
"&",
"block",
")",
"queries",
"=",
"[",
"]",
"subscriber",
"=",
"ActiveSupport",
"::",
"Notifications",
".",
"subscribe",
"(",
"'sql.active_record'",
")",
"do",
"|",
"name",
",",
"started",
",",
"finished",
",",
"id",
",",
"pa... | Logs the queries run inside the block, and return them. | [
"Logs",
"the",
"queries",
"run",
"inside",
"the",
"block",
"and",
"return",
"them",
"."
] | 61aff33712b5ac3559a9332253e3890baee4c6f3 | https://github.com/jmazzi/crypt_keeper/blob/61aff33712b5ac3559a9332253e3890baee4c6f3/spec/support/active_record.rb#L75-L88 |
14,502 | jekyll/classifier-reborn | lib/classifier-reborn/extensions/hasher.rb | ClassifierReborn.Hasher.word_hash | def word_hash(str, enable_stemmer = true,
tokenizer: Tokenizer::Whitespace,
token_filters: [TokenFilter::Stopword])
if token_filters.include?(TokenFilter::Stemmer)
unless enable_stemmer
token_filters.reject! do |token_filter|
token_filter == TokenF... | ruby | def word_hash(str, enable_stemmer = true,
tokenizer: Tokenizer::Whitespace,
token_filters: [TokenFilter::Stopword])
if token_filters.include?(TokenFilter::Stemmer)
unless enable_stemmer
token_filters.reject! do |token_filter|
token_filter == TokenF... | [
"def",
"word_hash",
"(",
"str",
",",
"enable_stemmer",
"=",
"true",
",",
"tokenizer",
":",
"Tokenizer",
"::",
"Whitespace",
",",
"token_filters",
":",
"[",
"TokenFilter",
"::",
"Stopword",
"]",
")",
"if",
"token_filters",
".",
"include?",
"(",
"TokenFilter",
... | Return a Hash of strings => ints. Each word in the string is stemmed,
interned, and indexes to its frequency in the document. | [
"Return",
"a",
"Hash",
"of",
"strings",
"=",
">",
"ints",
".",
"Each",
"word",
"in",
"the",
"string",
"is",
"stemmed",
"interned",
"and",
"indexes",
"to",
"its",
"frequency",
"in",
"the",
"document",
"."
] | 849ba0834c5a9be78147a9072e599187e2203fce | https://github.com/jekyll/classifier-reborn/blob/849ba0834c5a9be78147a9072e599187e2203fce/lib/classifier-reborn/extensions/hasher.rb#L17-L38 |
14,503 | jekyll/classifier-reborn | lib/classifier-reborn/bayes.rb | ClassifierReborn.Bayes.classify | def classify(text)
result, score = classify_with_score(text)
result = nil if threshold_enabled? && (score < @threshold || score == Float::INFINITY)
result
end | ruby | def classify(text)
result, score = classify_with_score(text)
result = nil if threshold_enabled? && (score < @threshold || score == Float::INFINITY)
result
end | [
"def",
"classify",
"(",
"text",
")",
"result",
",",
"score",
"=",
"classify_with_score",
"(",
"text",
")",
"result",
"=",
"nil",
"if",
"threshold_enabled?",
"&&",
"(",
"score",
"<",
"@threshold",
"||",
"score",
"==",
"Float",
"::",
"INFINITY",
")",
"result... | Return the classification without the score | [
"Return",
"the",
"classification",
"without",
"the",
"score"
] | 849ba0834c5a9be78147a9072e599187e2203fce | https://github.com/jekyll/classifier-reborn/blob/849ba0834c5a9be78147a9072e599187e2203fce/lib/classifier-reborn/bayes.rb#L163-L167 |
14,504 | jekyll/classifier-reborn | lib/classifier-reborn/bayes.rb | ClassifierReborn.Bayes.custom_stopwords | def custom_stopwords(stopwords)
unless stopwords.is_a?(Enumerable)
if stopwords.strip.empty?
stopwords = []
elsif File.exist?(stopwords)
stopwords = File.read(stopwords).force_encoding('utf-8').split
else
return # Do not overwrite the default
end
... | ruby | def custom_stopwords(stopwords)
unless stopwords.is_a?(Enumerable)
if stopwords.strip.empty?
stopwords = []
elsif File.exist?(stopwords)
stopwords = File.read(stopwords).force_encoding('utf-8').split
else
return # Do not overwrite the default
end
... | [
"def",
"custom_stopwords",
"(",
"stopwords",
")",
"unless",
"stopwords",
".",
"is_a?",
"(",
"Enumerable",
")",
"if",
"stopwords",
".",
"strip",
".",
"empty?",
"stopwords",
"=",
"[",
"]",
"elsif",
"File",
".",
"exist?",
"(",
"stopwords",
")",
"stopwords",
"... | Overwrites the default stopwords for current language with supplied list of stopwords or file | [
"Overwrites",
"the",
"default",
"stopwords",
"for",
"current",
"language",
"with",
"supplied",
"list",
"of",
"stopwords",
"or",
"file"
] | 849ba0834c5a9be78147a9072e599187e2203fce | https://github.com/jekyll/classifier-reborn/blob/849ba0834c5a9be78147a9072e599187e2203fce/lib/classifier-reborn/bayes.rb#L269-L280 |
14,505 | jekyll/classifier-reborn | lib/classifier-reborn/lsi.rb | ClassifierReborn.LSI.build_index | def build_index(cutoff = 0.75)
return unless needs_rebuild?
make_word_list
doc_list = @items.values
tda = doc_list.collect { |node| node.raw_vector_with(@word_list) }
if $GSL
tdm = GSL::Matrix.alloc(*tda).trans
ntdm = build_reduced_matrix(tdm, cutoff)
ntdm.size[... | ruby | def build_index(cutoff = 0.75)
return unless needs_rebuild?
make_word_list
doc_list = @items.values
tda = doc_list.collect { |node| node.raw_vector_with(@word_list) }
if $GSL
tdm = GSL::Matrix.alloc(*tda).trans
ntdm = build_reduced_matrix(tdm, cutoff)
ntdm.size[... | [
"def",
"build_index",
"(",
"cutoff",
"=",
"0.75",
")",
"return",
"unless",
"needs_rebuild?",
"make_word_list",
"doc_list",
"=",
"@items",
".",
"values",
"tda",
"=",
"doc_list",
".",
"collect",
"{",
"|",
"node",
"|",
"node",
".",
"raw_vector_with",
"(",
"@wor... | This function rebuilds the index if needs_rebuild? returns true.
For very large document spaces, this indexing operation may take some
time to complete, so it may be wise to place the operation in another
thread.
As a rule, indexing will be fairly swift on modern machines until
you have well over 500 documents in... | [
"This",
"function",
"rebuilds",
"the",
"index",
"if",
"needs_rebuild?",
"returns",
"true",
".",
"For",
"very",
"large",
"document",
"spaces",
"this",
"indexing",
"operation",
"may",
"take",
"some",
"time",
"to",
"complete",
"so",
"it",
"may",
"be",
"wise",
"... | 849ba0834c5a9be78147a9072e599187e2203fce | https://github.com/jekyll/classifier-reborn/blob/849ba0834c5a9be78147a9072e599187e2203fce/lib/classifier-reborn/lsi.rb#L133-L165 |
14,506 | jekyll/classifier-reborn | lib/classifier-reborn/lsi.rb | ClassifierReborn.LSI.highest_relative_content | def highest_relative_content(max_chunks = 10)
return [] if needs_rebuild?
avg_density = {}
@items.each_key { |item| avg_density[item] = proximity_array_for_content(item).inject(0.0) { |x, y| x + y[1] } }
avg_density.keys.sort_by { |x| avg_density[x] }.reverse[0..max_chunks - 1].map
end | ruby | def highest_relative_content(max_chunks = 10)
return [] if needs_rebuild?
avg_density = {}
@items.each_key { |item| avg_density[item] = proximity_array_for_content(item).inject(0.0) { |x, y| x + y[1] } }
avg_density.keys.sort_by { |x| avg_density[x] }.reverse[0..max_chunks - 1].map
end | [
"def",
"highest_relative_content",
"(",
"max_chunks",
"=",
"10",
")",
"return",
"[",
"]",
"if",
"needs_rebuild?",
"avg_density",
"=",
"{",
"}",
"@items",
".",
"each_key",
"{",
"|",
"item",
"|",
"avg_density",
"[",
"item",
"]",
"=",
"proximity_array_for_content... | This method returns max_chunks entries, ordered by their average semantic rating.
Essentially, the average distance of each entry from all other entries is calculated,
the highest are returned.
This can be used to build a summary service, or to provide more information about
your dataset's general content. For exa... | [
"This",
"method",
"returns",
"max_chunks",
"entries",
"ordered",
"by",
"their",
"average",
"semantic",
"rating",
".",
"Essentially",
"the",
"average",
"distance",
"of",
"each",
"entry",
"from",
"all",
"other",
"entries",
"is",
"calculated",
"the",
"highest",
"ar... | 849ba0834c5a9be78147a9072e599187e2203fce | https://github.com/jekyll/classifier-reborn/blob/849ba0834c5a9be78147a9072e599187e2203fce/lib/classifier-reborn/lsi.rb#L175-L182 |
14,507 | jekyll/classifier-reborn | lib/classifier-reborn/lsi.rb | ClassifierReborn.LSI.proximity_array_for_content | def proximity_array_for_content(doc, &block)
return [] if needs_rebuild?
content_node = node_for_content(doc, &block)
result =
@items.keys.collect do |item|
val = if $GSL
content_node.search_vector * @items[item].transposed_search_vector
else
... | ruby | def proximity_array_for_content(doc, &block)
return [] if needs_rebuild?
content_node = node_for_content(doc, &block)
result =
@items.keys.collect do |item|
val = if $GSL
content_node.search_vector * @items[item].transposed_search_vector
else
... | [
"def",
"proximity_array_for_content",
"(",
"doc",
",",
"&",
"block",
")",
"return",
"[",
"]",
"if",
"needs_rebuild?",
"content_node",
"=",
"node_for_content",
"(",
"doc",
",",
"block",
")",
"result",
"=",
"@items",
".",
"keys",
".",
"collect",
"do",
"|",
"... | This function is the primitive that find_related and classify
build upon. It returns an array of 2-element arrays. The first element
of this array is a document, and the second is its "score", defining
how "close" it is to other indexed items.
These values are somewhat arbitrary, having to do with the vector space... | [
"This",
"function",
"is",
"the",
"primitive",
"that",
"find_related",
"and",
"classify",
"build",
"upon",
".",
"It",
"returns",
"an",
"array",
"of",
"2",
"-",
"element",
"arrays",
".",
"The",
"first",
"element",
"of",
"this",
"array",
"is",
"a",
"document"... | 849ba0834c5a9be78147a9072e599187e2203fce | https://github.com/jekyll/classifier-reborn/blob/849ba0834c5a9be78147a9072e599187e2203fce/lib/classifier-reborn/lsi.rb#L196-L210 |
14,508 | jekyll/classifier-reborn | lib/classifier-reborn/lsi.rb | ClassifierReborn.LSI.proximity_norms_for_content | def proximity_norms_for_content(doc, &block)
return [] if needs_rebuild?
content_node = node_for_content(doc, &block)
if $GSL && content_node.raw_norm.isnan?.all?
puts "There are no documents that are similar to #{doc}"
else
content_node_norms(content_node)
end
end | ruby | def proximity_norms_for_content(doc, &block)
return [] if needs_rebuild?
content_node = node_for_content(doc, &block)
if $GSL && content_node.raw_norm.isnan?.all?
puts "There are no documents that are similar to #{doc}"
else
content_node_norms(content_node)
end
end | [
"def",
"proximity_norms_for_content",
"(",
"doc",
",",
"&",
"block",
")",
"return",
"[",
"]",
"if",
"needs_rebuild?",
"content_node",
"=",
"node_for_content",
"(",
"doc",
",",
"block",
")",
"if",
"$GSL",
"&&",
"content_node",
".",
"raw_norm",
".",
"isnan?",
... | Similar to proximity_array_for_content, this function takes similar
arguments and returns a similar array. However, it uses the normalized
calculated vectors instead of their full versions. This is useful when
you're trying to perform operations on content that is much smaller than
the text you're working with. sea... | [
"Similar",
"to",
"proximity_array_for_content",
"this",
"function",
"takes",
"similar",
"arguments",
"and",
"returns",
"a",
"similar",
"array",
".",
"However",
"it",
"uses",
"the",
"normalized",
"calculated",
"vectors",
"instead",
"of",
"their",
"full",
"versions",
... | 849ba0834c5a9be78147a9072e599187e2203fce | https://github.com/jekyll/classifier-reborn/blob/849ba0834c5a9be78147a9072e599187e2203fce/lib/classifier-reborn/lsi.rb#L217-L226 |
14,509 | jekyll/classifier-reborn | lib/classifier-reborn/lsi.rb | ClassifierReborn.LSI.search | def search(string, max_nearest = 3)
return [] if needs_rebuild?
carry = proximity_norms_for_content(string)
unless carry.nil?
result = carry.collect { |x| x[0] }
result[0..max_nearest - 1]
end
end | ruby | def search(string, max_nearest = 3)
return [] if needs_rebuild?
carry = proximity_norms_for_content(string)
unless carry.nil?
result = carry.collect { |x| x[0] }
result[0..max_nearest - 1]
end
end | [
"def",
"search",
"(",
"string",
",",
"max_nearest",
"=",
"3",
")",
"return",
"[",
"]",
"if",
"needs_rebuild?",
"carry",
"=",
"proximity_norms_for_content",
"(",
"string",
")",
"unless",
"carry",
".",
"nil?",
"result",
"=",
"carry",
".",
"collect",
"{",
"|"... | This function allows for text-based search of your index. Unlike other functions
like find_related and classify, search only takes short strings. It will also ignore
factors like repeated words. It is best for short, google-like search terms.
A search will first priortize lexical relationships, then semantic ones.
... | [
"This",
"function",
"allows",
"for",
"text",
"-",
"based",
"search",
"of",
"your",
"index",
".",
"Unlike",
"other",
"functions",
"like",
"find_related",
"and",
"classify",
"search",
"only",
"takes",
"short",
"strings",
".",
"It",
"will",
"also",
"ignore",
"f... | 849ba0834c5a9be78147a9072e599187e2203fce | https://github.com/jekyll/classifier-reborn/blob/849ba0834c5a9be78147a9072e599187e2203fce/lib/classifier-reborn/lsi.rb#L248-L256 |
14,510 | jekyll/classifier-reborn | lib/classifier-reborn/lsi.rb | ClassifierReborn.LSI.find_related | def find_related(doc, max_nearest = 3, &block)
carry =
proximity_array_for_content(doc, &block).reject { |pair| pair[0].eql? doc }
result = carry.collect { |x| x[0] }
result[0..max_nearest - 1]
end | ruby | def find_related(doc, max_nearest = 3, &block)
carry =
proximity_array_for_content(doc, &block).reject { |pair| pair[0].eql? doc }
result = carry.collect { |x| x[0] }
result[0..max_nearest - 1]
end | [
"def",
"find_related",
"(",
"doc",
",",
"max_nearest",
"=",
"3",
",",
"&",
"block",
")",
"carry",
"=",
"proximity_array_for_content",
"(",
"doc",
",",
"block",
")",
".",
"reject",
"{",
"|",
"pair",
"|",
"pair",
"[",
"0",
"]",
".",
"eql?",
"doc",
"}",... | This function takes content and finds other documents
that are semantically "close", returning an array of documents sorted
from most to least relavant.
max_nearest specifies the number of documents to return. A value of
0 means that it returns all the indexed documents, sorted by relavence.
This is particularly ... | [
"This",
"function",
"takes",
"content",
"and",
"finds",
"other",
"documents",
"that",
"are",
"semantically",
"close",
"returning",
"an",
"array",
"of",
"documents",
"sorted",
"from",
"most",
"to",
"least",
"relavant",
".",
"max_nearest",
"specifies",
"the",
"num... | 849ba0834c5a9be78147a9072e599187e2203fce | https://github.com/jekyll/classifier-reborn/blob/849ba0834c5a9be78147a9072e599187e2203fce/lib/classifier-reborn/lsi.rb#L267-L272 |
14,511 | jekyll/classifier-reborn | lib/classifier-reborn/lsi.rb | ClassifierReborn.LSI.classify | def classify(doc, cutoff = 0.30, &block)
scored_categories(doc, cutoff, &block).last.first
end | ruby | def classify(doc, cutoff = 0.30, &block)
scored_categories(doc, cutoff, &block).last.first
end | [
"def",
"classify",
"(",
"doc",
",",
"cutoff",
"=",
"0.30",
",",
"&",
"block",
")",
"scored_categories",
"(",
"doc",
",",
"cutoff",
",",
"block",
")",
".",
"last",
".",
"first",
"end"
] | Return the most obvious category without the score | [
"Return",
"the",
"most",
"obvious",
"category",
"without",
"the",
"score"
] | 849ba0834c5a9be78147a9072e599187e2203fce | https://github.com/jekyll/classifier-reborn/blob/849ba0834c5a9be78147a9072e599187e2203fce/lib/classifier-reborn/lsi.rb#L280-L282 |
14,512 | jekyll/classifier-reborn | lib/classifier-reborn/lsi.rb | ClassifierReborn.LSI.scored_categories | def scored_categories(doc, cutoff = 0.30, &block)
icutoff = (@items.size * cutoff).round
carry = proximity_array_for_content(doc, &block)
carry = carry[0..icutoff - 1]
votes = Hash.new(0.0)
carry.each do |pair|
@items[pair[0]].categories.each do |category|
votes[category]... | ruby | def scored_categories(doc, cutoff = 0.30, &block)
icutoff = (@items.size * cutoff).round
carry = proximity_array_for_content(doc, &block)
carry = carry[0..icutoff - 1]
votes = Hash.new(0.0)
carry.each do |pair|
@items[pair[0]].categories.each do |category|
votes[category]... | [
"def",
"scored_categories",
"(",
"doc",
",",
"cutoff",
"=",
"0.30",
",",
"&",
"block",
")",
"icutoff",
"=",
"(",
"@items",
".",
"size",
"*",
"cutoff",
")",
".",
"round",
"carry",
"=",
"proximity_array_for_content",
"(",
"doc",
",",
"block",
")",
"carry",... | This function uses a voting system to categorize documents, based on
the categories of other documents. It uses the same logic as the
find_related function to find related documents, then returns the
list of sorted categories.
cutoff signifies the number of documents to consider when clasifying
text. A cutoff of ... | [
"This",
"function",
"uses",
"a",
"voting",
"system",
"to",
"categorize",
"documents",
"based",
"on",
"the",
"categories",
"of",
"other",
"documents",
".",
"It",
"uses",
"the",
"same",
"logic",
"as",
"the",
"find_related",
"function",
"to",
"find",
"related",
... | 849ba0834c5a9be78147a9072e599187e2203fce | https://github.com/jekyll/classifier-reborn/blob/849ba0834c5a9be78147a9072e599187e2203fce/lib/classifier-reborn/lsi.rb#L293-L305 |
14,513 | jekyll/classifier-reborn | lib/classifier-reborn/lsi.rb | ClassifierReborn.LSI.highest_ranked_stems | def highest_ranked_stems(doc, count = 3)
raise 'Requested stem ranking on non-indexed content!' unless @items[doc]
content_vector_array = node_for_content(doc).lsi_vector.to_a
top_n = content_vector_array.sort.reverse[0..count - 1]
top_n.collect { |x| @word_list.word_for_index(content_vector_ar... | ruby | def highest_ranked_stems(doc, count = 3)
raise 'Requested stem ranking on non-indexed content!' unless @items[doc]
content_vector_array = node_for_content(doc).lsi_vector.to_a
top_n = content_vector_array.sort.reverse[0..count - 1]
top_n.collect { |x| @word_list.word_for_index(content_vector_ar... | [
"def",
"highest_ranked_stems",
"(",
"doc",
",",
"count",
"=",
"3",
")",
"raise",
"'Requested stem ranking on non-indexed content!'",
"unless",
"@items",
"[",
"doc",
"]",
"content_vector_array",
"=",
"node_for_content",
"(",
"doc",
")",
".",
"lsi_vector",
".",
"to_a"... | Prototype, only works on indexed documents.
I have no clue if this is going to work, but in theory
it's supposed to. | [
"Prototype",
"only",
"works",
"on",
"indexed",
"documents",
".",
"I",
"have",
"no",
"clue",
"if",
"this",
"is",
"going",
"to",
"work",
"but",
"in",
"theory",
"it",
"s",
"supposed",
"to",
"."
] | 849ba0834c5a9be78147a9072e599187e2203fce | https://github.com/jekyll/classifier-reborn/blob/849ba0834c5a9be78147a9072e599187e2203fce/lib/classifier-reborn/lsi.rb#L310-L316 |
14,514 | jekyll/classifier-reborn | lib/classifier-reborn/lsi/content_node.rb | ClassifierReborn.ContentNode.raw_vector_with | def raw_vector_with(word_list)
vec = if $GSL
GSL::Vector.alloc(word_list.size)
else
Array.new(word_list.size, 0)
end
@word_hash.each_key do |word|
vec[word_list[word]] = @word_hash[word] if word_list[word]
end
# Perform the scaling tr... | ruby | def raw_vector_with(word_list)
vec = if $GSL
GSL::Vector.alloc(word_list.size)
else
Array.new(word_list.size, 0)
end
@word_hash.each_key do |word|
vec[word_list[word]] = @word_hash[word] if word_list[word]
end
# Perform the scaling tr... | [
"def",
"raw_vector_with",
"(",
"word_list",
")",
"vec",
"=",
"if",
"$GSL",
"GSL",
"::",
"Vector",
".",
"alloc",
"(",
"word_list",
".",
"size",
")",
"else",
"Array",
".",
"new",
"(",
"word_list",
".",
"size",
",",
"0",
")",
"end",
"@word_hash",
".",
"... | Creates the raw vector out of word_hash using word_list as the
key for mapping the vector space. | [
"Creates",
"the",
"raw",
"vector",
"out",
"of",
"word_hash",
"using",
"word_list",
"as",
"the",
"key",
"for",
"mapping",
"the",
"vector",
"space",
"."
] | 849ba0834c5a9be78147a9072e599187e2203fce | https://github.com/jekyll/classifier-reborn/blob/849ba0834c5a9be78147a9072e599187e2203fce/lib/classifier-reborn/lsi/content_node.rb#L40-L98 |
14,515 | piotrmurach/tty-table | lib/tty/table.rb | TTY.Table.rotate_horizontal | def rotate_horizontal
return unless rotated?
head, body = orientation.slice(self)
if header && header.empty?
@header = head[0]
@rows = body.map { |row| to_row(row, @header) }
else
@rows = body.map { |row| to_row(row) }
end
end | ruby | def rotate_horizontal
return unless rotated?
head, body = orientation.slice(self)
if header && header.empty?
@header = head[0]
@rows = body.map { |row| to_row(row, @header) }
else
@rows = body.map { |row| to_row(row) }
end
end | [
"def",
"rotate_horizontal",
"return",
"unless",
"rotated?",
"head",
",",
"body",
"=",
"orientation",
".",
"slice",
"(",
"self",
")",
"if",
"header",
"&&",
"header",
".",
"empty?",
"@header",
"=",
"head",
"[",
"0",
"]",
"@rows",
"=",
"body",
".",
"map",
... | Rotate the table horizontally
@api private | [
"Rotate",
"the",
"table",
"horizontally"
] | b89bc3615bc1e834e089e4451e7444ff90bce4a8 | https://github.com/piotrmurach/tty-table/blob/b89bc3615bc1e834e089e4451e7444ff90bce4a8/lib/tty/table.rb#L190-L199 |
14,516 | piotrmurach/tty-table | lib/tty/table.rb | TTY.Table.row | def row(index, &block)
if block_given?
rows.fetch(index) { return self }.each(&block)
self
else
rows.fetch(index) { return nil }
end
end | ruby | def row(index, &block)
if block_given?
rows.fetch(index) { return self }.each(&block)
self
else
rows.fetch(index) { return nil }
end
end | [
"def",
"row",
"(",
"index",
",",
"&",
"block",
")",
"if",
"block_given?",
"rows",
".",
"fetch",
"(",
"index",
")",
"{",
"return",
"self",
"}",
".",
"each",
"(",
"block",
")",
"self",
"else",
"rows",
".",
"fetch",
"(",
"index",
")",
"{",
"return",
... | Return a row number at the index of the table as an Array.
When a block is given, the elements of that Array are iterated over.
@example
rows = [['a1', 'a2'], ['b1', 'b2']]
table = TTY::Table.new rows: rows
table.row(1) { |row| ... }
@param [Integer] index
@yield []
optional block to execute in the ... | [
"Return",
"a",
"row",
"number",
"at",
"the",
"index",
"of",
"the",
"table",
"as",
"an",
"Array",
".",
"When",
"a",
"block",
"is",
"given",
"the",
"elements",
"of",
"that",
"Array",
"are",
"iterated",
"over",
"."
] | b89bc3615bc1e834e089e4451e7444ff90bce4a8 | https://github.com/piotrmurach/tty-table/blob/b89bc3615bc1e834e089e4451e7444ff90bce4a8/lib/tty/table.rb#L249-L256 |
14,517 | piotrmurach/tty-table | lib/tty/table.rb | TTY.Table.column | def column(index)
index_unknown = index.is_a?(Integer) && (index >= columns_size || index < 0)
if block_given?
return self if index_unknown
rows.map { |row| yield row[index] }
else
return nil if index_unknown
rows.map { |row| row[index] }.compact
end
end | ruby | def column(index)
index_unknown = index.is_a?(Integer) && (index >= columns_size || index < 0)
if block_given?
return self if index_unknown
rows.map { |row| yield row[index] }
else
return nil if index_unknown
rows.map { |row| row[index] }.compact
end
end | [
"def",
"column",
"(",
"index",
")",
"index_unknown",
"=",
"index",
".",
"is_a?",
"(",
"Integer",
")",
"&&",
"(",
"index",
">=",
"columns_size",
"||",
"index",
"<",
"0",
")",
"if",
"block_given?",
"return",
"self",
"if",
"index_unknown",
"rows",
".",
"map... | Return a column number at the index of the table as an Array.
If the table has a header then column can be searched by header name.
When a block is given, the elements of that Array are iterated over.
@example
header = [:h1, :h2]
rows = [ ['a1', 'a2'], ['b1', 'b2'] ]
table = TTY::Table.new :rows => rows, ... | [
"Return",
"a",
"column",
"number",
"at",
"the",
"index",
"of",
"the",
"table",
"as",
"an",
"Array",
".",
"If",
"the",
"table",
"has",
"a",
"header",
"then",
"column",
"can",
"be",
"searched",
"by",
"header",
"name",
".",
"When",
"a",
"block",
"is",
"... | b89bc3615bc1e834e089e4451e7444ff90bce4a8 | https://github.com/piotrmurach/tty-table/blob/b89bc3615bc1e834e089e4451e7444ff90bce4a8/lib/tty/table.rb#L279-L288 |
14,518 | piotrmurach/tty-table | lib/tty/table.rb | TTY.Table.<< | def <<(row)
if row == Border::SEPARATOR
separators << columns_size - (header ? 0 : 2)
else
rows_copy = rows.dup
assert_row_sizes rows_copy << row
rows << to_row(row)
end
self
end | ruby | def <<(row)
if row == Border::SEPARATOR
separators << columns_size - (header ? 0 : 2)
else
rows_copy = rows.dup
assert_row_sizes rows_copy << row
rows << to_row(row)
end
self
end | [
"def",
"<<",
"(",
"row",
")",
"if",
"row",
"==",
"Border",
"::",
"SEPARATOR",
"separators",
"<<",
"columns_size",
"-",
"(",
"header",
"?",
"0",
":",
"2",
")",
"else",
"rows_copy",
"=",
"rows",
".",
"dup",
"assert_row_sizes",
"rows_copy",
"<<",
"row",
"... | Add row to table
@param [Array] row
@return [self]
@api public | [
"Add",
"row",
"to",
"table"
] | b89bc3615bc1e834e089e4451e7444ff90bce4a8 | https://github.com/piotrmurach/tty-table/blob/b89bc3615bc1e834e089e4451e7444ff90bce4a8/lib/tty/table.rb#L297-L306 |
14,519 | piotrmurach/tty-table | lib/tty/table.rb | TTY.Table.render_with | def render_with(border_class, renderer_type=(not_set=true), options={}, &block)
unless not_set
if renderer_type.respond_to?(:to_hash)
options = renderer_type
else
options[:renderer] = renderer_type
end
end
Renderer.render_with(border_class, self, options, &... | ruby | def render_with(border_class, renderer_type=(not_set=true), options={}, &block)
unless not_set
if renderer_type.respond_to?(:to_hash)
options = renderer_type
else
options[:renderer] = renderer_type
end
end
Renderer.render_with(border_class, self, options, &... | [
"def",
"render_with",
"(",
"border_class",
",",
"renderer_type",
"=",
"(",
"not_set",
"=",
"true",
")",
",",
"options",
"=",
"{",
"}",
",",
"&",
"block",
")",
"unless",
"not_set",
"if",
"renderer_type",
".",
"respond_to?",
"(",
":to_hash",
")",
"options",
... | Render a given table using custom border class.
@param [TTY::Table::Border] border_class
@param [Symbol] renderer_type
@param [Hash] options
@yield [renderer]
@yieldparam [TTY::Table::Renderer] renderer
the renderer for the table
@return [String]
@api public | [
"Render",
"a",
"given",
"table",
"using",
"custom",
"border",
"class",
"."
] | b89bc3615bc1e834e089e4451e7444ff90bce4a8 | https://github.com/piotrmurach/tty-table/blob/b89bc3615bc1e834e089e4451e7444ff90bce4a8/lib/tty/table.rb#L459-L469 |
14,520 | piotrmurach/tty-table | lib/tty/table.rb | TTY.Table.coerce | def coerce(rows)
coerced_rows = []
@converter.convert(rows).to(:array).each do |row|
if row == Border::SEPARATOR
separators << coerced_rows.length - (header ? 0 : 1)
else
coerced_rows << to_row(row, header)
end
end
coerced_rows
end | ruby | def coerce(rows)
coerced_rows = []
@converter.convert(rows).to(:array).each do |row|
if row == Border::SEPARATOR
separators << coerced_rows.length - (header ? 0 : 1)
else
coerced_rows << to_row(row, header)
end
end
coerced_rows
end | [
"def",
"coerce",
"(",
"rows",
")",
"coerced_rows",
"=",
"[",
"]",
"@converter",
".",
"convert",
"(",
"rows",
")",
".",
"to",
"(",
":array",
")",
".",
"each",
"do",
"|",
"row",
"|",
"if",
"row",
"==",
"Border",
"::",
"SEPARATOR",
"separators",
"<<",
... | Coerce an Enumerable into a Table
This coercion mechanism is used by Table to handle Enumerable types
and force them into array type.
@param [Enumerable] rows
the object to coerce
@return [Array]
@api public | [
"Coerce",
"an",
"Enumerable",
"into",
"a",
"Table",
"This",
"coercion",
"mechanism",
"is",
"used",
"by",
"Table",
"to",
"handle",
"Enumerable",
"types",
"and",
"force",
"them",
"into",
"array",
"type",
"."
] | b89bc3615bc1e834e089e4451e7444ff90bce4a8 | https://github.com/piotrmurach/tty-table/blob/b89bc3615bc1e834e089e4451e7444ff90bce4a8/lib/tty/table.rb#L481-L491 |
14,521 | Shopify/statsd-instrument | lib/statsd/instrument.rb | StatsD.Instrument.statsd_measure | def statsd_measure(method, name, *metric_options)
add_to_method(method, name, :measure) do
define_method(method) do |*args, &block|
StatsD.measure(StatsD::Instrument.generate_metric_name(name, self, *args), *metric_options) { super(*args, &block) }
end
end
end | ruby | def statsd_measure(method, name, *metric_options)
add_to_method(method, name, :measure) do
define_method(method) do |*args, &block|
StatsD.measure(StatsD::Instrument.generate_metric_name(name, self, *args), *metric_options) { super(*args, &block) }
end
end
end | [
"def",
"statsd_measure",
"(",
"method",
",",
"name",
",",
"*",
"metric_options",
")",
"add_to_method",
"(",
"method",
",",
"name",
",",
":measure",
")",
"do",
"define_method",
"(",
"method",
")",
"do",
"|",
"*",
"args",
",",
"&",
"block",
"|",
"StatsD",
... | Adds execution duration instrumentation to a method as a timing.
@param method [Symbol] The name of the method to instrument.
@param name [String, #call] The name of the metric to use. You can also pass in a
callable to dynamically generate a metric name
@param metric_options (see StatsD#measure)
@return [void... | [
"Adds",
"execution",
"duration",
"instrumentation",
"to",
"a",
"method",
"as",
"a",
"timing",
"."
] | f1a96b4f86811ea1505a34e10a738dc22b19effa | https://github.com/Shopify/statsd-instrument/blob/f1a96b4f86811ea1505a34e10a738dc22b19effa/lib/statsd/instrument.rb#L78-L84 |
14,522 | Shopify/statsd-instrument | lib/statsd/instrument.rb | StatsD.Instrument.statsd_distribution | def statsd_distribution(method, name, *metric_options)
add_to_method(method, name, :distribution) do
define_method(method) do |*args, &block|
StatsD.distribution(StatsD::Instrument.generate_metric_name(name, self, *args), *metric_options) { super(*args, &block) }
end
end
end | ruby | def statsd_distribution(method, name, *metric_options)
add_to_method(method, name, :distribution) do
define_method(method) do |*args, &block|
StatsD.distribution(StatsD::Instrument.generate_metric_name(name, self, *args), *metric_options) { super(*args, &block) }
end
end
end | [
"def",
"statsd_distribution",
"(",
"method",
",",
"name",
",",
"*",
"metric_options",
")",
"add_to_method",
"(",
"method",
",",
"name",
",",
":distribution",
")",
"do",
"define_method",
"(",
"method",
")",
"do",
"|",
"*",
"args",
",",
"&",
"block",
"|",
... | Adds execution duration instrumentation to a method as a distribution.
@param method [Symbol] The name of the method to instrument.
@param name [String, #call] The name of the metric to use. You can also pass in a
callable to dynamically generate a metric name
@param metric_options (see StatsD#measure)
@return... | [
"Adds",
"execution",
"duration",
"instrumentation",
"to",
"a",
"method",
"as",
"a",
"distribution",
"."
] | f1a96b4f86811ea1505a34e10a738dc22b19effa | https://github.com/Shopify/statsd-instrument/blob/f1a96b4f86811ea1505a34e10a738dc22b19effa/lib/statsd/instrument.rb#L94-L100 |
14,523 | Shopify/statsd-instrument | lib/statsd/instrument.rb | StatsD.Instrument.statsd_count | def statsd_count(method, name, *metric_options)
add_to_method(method, name, :count) do
define_method(method) do |*args, &block|
StatsD.increment(StatsD::Instrument.generate_metric_name(name, self, *args), 1, *metric_options)
super(*args, &block)
end
end
end | ruby | def statsd_count(method, name, *metric_options)
add_to_method(method, name, :count) do
define_method(method) do |*args, &block|
StatsD.increment(StatsD::Instrument.generate_metric_name(name, self, *args), 1, *metric_options)
super(*args, &block)
end
end
end | [
"def",
"statsd_count",
"(",
"method",
",",
"name",
",",
"*",
"metric_options",
")",
"add_to_method",
"(",
"method",
",",
"name",
",",
":count",
")",
"do",
"define_method",
"(",
"method",
")",
"do",
"|",
"*",
"args",
",",
"&",
"block",
"|",
"StatsD",
".... | Adds counter instrumentation to a method.
The metric will be incremented for every call of the instrumented method, no matter
whether what the method returns, or whether it raises an exception.
@param method (see #statsd_measure)
@param name (see #statsd_measure)
@param metric_options (see #statsd_measure)
@ret... | [
"Adds",
"counter",
"instrumentation",
"to",
"a",
"method",
"."
] | f1a96b4f86811ea1505a34e10a738dc22b19effa | https://github.com/Shopify/statsd-instrument/blob/f1a96b4f86811ea1505a34e10a738dc22b19effa/lib/statsd/instrument.rb#L176-L183 |
14,524 | chef/mixlib-shellout | lib/mixlib/shellout.rb | Mixlib.ShellOut.format_for_exception | def format_for_exception
return "Command execution failed. STDOUT/STDERR suppressed for sensitive resource" if sensitive
msg = ""
msg << "#{@terminate_reason}\n" if @terminate_reason
msg << "---- Begin output of #{command} ----\n"
msg << "STDOUT: #{stdout.strip}\n"
msg << "STDERR: #{... | ruby | def format_for_exception
return "Command execution failed. STDOUT/STDERR suppressed for sensitive resource" if sensitive
msg = ""
msg << "#{@terminate_reason}\n" if @terminate_reason
msg << "---- Begin output of #{command} ----\n"
msg << "STDOUT: #{stdout.strip}\n"
msg << "STDERR: #{... | [
"def",
"format_for_exception",
"return",
"\"Command execution failed. STDOUT/STDERR suppressed for sensitive resource\"",
"if",
"sensitive",
"msg",
"=",
"\"\"",
"msg",
"<<",
"\"#{@terminate_reason}\\n\"",
"if",
"@terminate_reason",
"msg",
"<<",
"\"---- Begin output of #{command} ----... | Creates a String showing the output of the command, including a banner
showing the exact command executed. Used by +invalid!+ to show command
results when the command exited with an unexpected status. | [
"Creates",
"a",
"String",
"showing",
"the",
"output",
"of",
"the",
"command",
"including",
"a",
"banner",
"showing",
"the",
"exact",
"command",
"executed",
".",
"Used",
"by",
"+",
"invalid!",
"+",
"to",
"show",
"command",
"results",
"when",
"the",
"command",... | 35f1d3636974838cd623c65f18b861fa2d16b777 | https://github.com/chef/mixlib-shellout/blob/35f1d3636974838cd623c65f18b861fa2d16b777/lib/mixlib/shellout.rb#L232-L242 |
14,525 | kneath/kss | lib/kss/comment_parser.rb | Kss.CommentParser.normalize | def normalize(text_block)
return text_block if @options[:preserve_whitespace]
# Strip out any preceding [whitespace]* that occur on every line. Not
# the smartest, but I wonder if I care.
text_block = text_block.gsub(/^(\s*\*+)/, '')
# Strip consistent indenting by measuring first line's... | ruby | def normalize(text_block)
return text_block if @options[:preserve_whitespace]
# Strip out any preceding [whitespace]* that occur on every line. Not
# the smartest, but I wonder if I care.
text_block = text_block.gsub(/^(\s*\*+)/, '')
# Strip consistent indenting by measuring first line's... | [
"def",
"normalize",
"(",
"text_block",
")",
"return",
"text_block",
"if",
"@options",
"[",
":preserve_whitespace",
"]",
"# Strip out any preceding [whitespace]* that occur on every line. Not",
"# the smartest, but I wonder if I care.",
"text_block",
"=",
"text_block",
".",
"gsub"... | Normalizes the comment block to ignore any consistent preceding
whitespace. Consistent means the same amount of whitespace on every line
of the comment block. Also strips any whitespace at the start and end of
the whole block.
Returns a String of normalized text. | [
"Normalizes",
"the",
"comment",
"block",
"to",
"ignore",
"any",
"consistent",
"preceding",
"whitespace",
".",
"Consistent",
"means",
"the",
"same",
"amount",
"of",
"whitespace",
"on",
"every",
"line",
"of",
"the",
"comment",
"block",
".",
"Also",
"strips",
"an... | b0791708cb397f5e8995a855af0d1a8b0aa89a2e | https://github.com/kneath/kss/blob/b0791708cb397f5e8995a855af0d1a8b0aa89a2e/lib/kss/comment_parser.rb#L151-L173 |
14,526 | GoogleCloudPlatform/fluent-plugin-detect-exceptions | lib/fluent/plugin/exception_detector.rb | Fluent.ExceptionDetector.transition | def transition(line)
@rules[@state].each do |r|
next unless line =~ r.pattern
@state = r.to_state
return true
end
@state = :start_state
false
end | ruby | def transition(line)
@rules[@state].each do |r|
next unless line =~ r.pattern
@state = r.to_state
return true
end
@state = :start_state
false
end | [
"def",
"transition",
"(",
"line",
")",
"@rules",
"[",
"@state",
"]",
".",
"each",
"do",
"|",
"r",
"|",
"next",
"unless",
"line",
"=~",
"r",
".",
"pattern",
"@state",
"=",
"r",
".",
"to_state",
"return",
"true",
"end",
"@state",
"=",
":start_state",
"... | Executes a transition of the state machine for the given line.
Returns false if the line does not match any transition rule and the
state machine was reset to the initial state. | [
"Executes",
"a",
"transition",
"of",
"the",
"state",
"machine",
"for",
"the",
"given",
"line",
".",
"Returns",
"false",
"if",
"the",
"line",
"does",
"not",
"match",
"any",
"transition",
"rule",
"and",
"the",
"state",
"machine",
"was",
"reset",
"to",
"the",... | 69d95d2d46820095da7aa5d351257df625dd4d10 | https://github.com/GoogleCloudPlatform/fluent-plugin-detect-exceptions/blob/69d95d2d46820095da7aa5d351257df625dd4d10/lib/fluent/plugin/exception_detector.rb#L222-L230 |
14,527 | treasure-data/serverengine | lib/serverengine/daemon_logger.rb | ServerEngine.DaemonLogger.add | def add(severity, message = nil, progname = nil, &block)
if severity < @level
return true
end
if message.nil?
if block_given?
message = yield
else
message = progname
progname = nil
end
end
progname ||= @progname
self << fo... | ruby | def add(severity, message = nil, progname = nil, &block)
if severity < @level
return true
end
if message.nil?
if block_given?
message = yield
else
message = progname
progname = nil
end
end
progname ||= @progname
self << fo... | [
"def",
"add",
"(",
"severity",
",",
"message",
"=",
"nil",
",",
"progname",
"=",
"nil",
",",
"&",
"block",
")",
"if",
"severity",
"<",
"@level",
"return",
"true",
"end",
"if",
"message",
".",
"nil?",
"if",
"block_given?",
"message",
"=",
"yield",
"else... | override add method | [
"override",
"add",
"method"
] | 400b4b818fda4f98d4c71b1fb06ffdc74bb4bf4a | https://github.com/treasure-data/serverengine/blob/400b4b818fda4f98d4c71b1fb06ffdc74bb4bf4a/lib/serverengine/daemon_logger.rb#L65-L80 |
14,528 | thesp0nge/dawnscanner | lib/dawn/knowledge_base_experimental.rb | Dawn.KnowledgeBaseExperimental.__packed? | def __packed?
FILES.each do |fn|
return true if fn.end_with? 'tar.gz' and File.exists?(File.join($path, fn))
end
return false
end | ruby | def __packed?
FILES.each do |fn|
return true if fn.end_with? 'tar.gz' and File.exists?(File.join($path, fn))
end
return false
end | [
"def",
"__packed?",
"FILES",
".",
"each",
"do",
"|",
"fn",
"|",
"return",
"true",
"if",
"fn",
".",
"end_with?",
"'tar.gz'",
"and",
"File",
".",
"exists?",
"(",
"File",
".",
"join",
"(",
"$path",
",",
"fn",
")",
")",
"end",
"return",
"false",
"end"
] | Check if the local KB is packet or not.
Returns true if at least one KB tarball file it has been found in the
local DB path | [
"Check",
"if",
"the",
"local",
"KB",
"is",
"packet",
"or",
"not",
"."
] | ac3eba58fa9adf563ecf01807d29066cb72cdeec | https://github.com/thesp0nge/dawnscanner/blob/ac3eba58fa9adf563ecf01807d29066cb72cdeec/lib/dawn/knowledge_base_experimental.rb#L222-L227 |
14,529 | thesp0nge/dawnscanner | lib/dawn/engine.rb | Dawn.Engine.output_dir | def output_dir
@output_dir_name = File.join(Dir.home, 'dawnscanner', 'results', File.basename(@target), Time.now.strftime('%Y%m%d'))
if Dir.exist?(@output_dir_name)
i=1
while (Dir.exist?(@output_dir_name)) do
@output_dir_name = File.join(Dir.home, 'dawnscanner', 'results', File.bas... | ruby | def output_dir
@output_dir_name = File.join(Dir.home, 'dawnscanner', 'results', File.basename(@target), Time.now.strftime('%Y%m%d'))
if Dir.exist?(@output_dir_name)
i=1
while (Dir.exist?(@output_dir_name)) do
@output_dir_name = File.join(Dir.home, 'dawnscanner', 'results', File.bas... | [
"def",
"output_dir",
"@output_dir_name",
"=",
"File",
".",
"join",
"(",
"Dir",
".",
"home",
",",
"'dawnscanner'",
",",
"'results'",
",",
"File",
".",
"basename",
"(",
"@target",
")",
",",
"Time",
".",
"now",
".",
"strftime",
"(",
"'%Y%m%d'",
")",
")",
... | Output stuff - START
Creates the directory name where dawnscanner results will be saved
Examples
engine.create_output_dir
# => /Users/thesp0nge/dawnscanner/results/railsgoat/20151123
# => /Users/thesp0nge/dawnscanner/results/railsgoat/20151123_1 (if
previous directory name exists) | [
"Output",
"stuff",
"-",
"START"
] | ac3eba58fa9adf563ecf01807d29066cb72cdeec | https://github.com/thesp0nge/dawnscanner/blob/ac3eba58fa9adf563ecf01807d29066cb72cdeec/lib/dawn/engine.rb#L231-L241 |
14,530 | thesp0nge/dawnscanner | lib/dawn/engine.rb | Dawn.Engine.apply | def apply(name)
# FIXME.20140325
# Now if no checks are loaded because knowledge base was not previously called, apply and apply_all proudly refuse to run.
# Reason is simple, load_knowledge_base now needs enabled check array
# and I don't want to pollute engine API to propagate this value. It'... | ruby | def apply(name)
# FIXME.20140325
# Now if no checks are loaded because knowledge base was not previously called, apply and apply_all proudly refuse to run.
# Reason is simple, load_knowledge_base now needs enabled check array
# and I don't want to pollute engine API to propagate this value. It'... | [
"def",
"apply",
"(",
"name",
")",
"# FIXME.20140325",
"# Now if no checks are loaded because knowledge base was not previously called, apply and apply_all proudly refuse to run.",
"# Reason is simple, load_knowledge_base now needs enabled check array",
"# and I don't want to pollute engine API to pr... | Output stuff - END
Security stuff applies here
Public it applies a single security check given by its name
name - the security check to be applied
Examples
engine.apply("CVE-2013-1800")
# => boolean
Returns a true value if the security check was successfully applied or false
otherwise | [
"Output",
"stuff",
"-",
"END"
] | ac3eba58fa9adf563ecf01807d29066cb72cdeec | https://github.com/thesp0nge/dawnscanner/blob/ac3eba58fa9adf563ecf01807d29066cb72cdeec/lib/dawn/engine.rb#L268-L289 |
14,531 | neo4jrb/neo4j | lib/neo4j/active_rel/initialize.rb | Neo4j::ActiveRel.Initialize.init_on_load | def init_on_load(persisted_rel, from_node_id, to_node_id, type)
@rel_type = type
@_persisted_obj = persisted_rel
changed_attributes_clear!
@attributes = convert_and_assign_attributes(persisted_rel.props)
load_nodes(from_node_id, to_node_id)
end | ruby | def init_on_load(persisted_rel, from_node_id, to_node_id, type)
@rel_type = type
@_persisted_obj = persisted_rel
changed_attributes_clear!
@attributes = convert_and_assign_attributes(persisted_rel.props)
load_nodes(from_node_id, to_node_id)
end | [
"def",
"init_on_load",
"(",
"persisted_rel",
",",
"from_node_id",
",",
"to_node_id",
",",
"type",
")",
"@rel_type",
"=",
"type",
"@_persisted_obj",
"=",
"persisted_rel",
"changed_attributes_clear!",
"@attributes",
"=",
"convert_and_assign_attributes",
"(",
"persisted_rel"... | called when loading the rel from the database
@param [Neo4j::Embedded::EmbeddedRelationship, Neo4j::Server::CypherRelationship] persisted_rel properties of this relationship
@param [Neo4j::Relationship] from_node_id The neo_id of the starting node of this rel
@param [Neo4j::Relationship] to_node_id The neo_id of the... | [
"called",
"when",
"loading",
"the",
"rel",
"from",
"the",
"database"
] | 291c79a757e8bd5e84920a7bd44867a5f304aa8b | https://github.com/neo4jrb/neo4j/blob/291c79a757e8bd5e84920a7bd44867a5f304aa8b/lib/neo4j/active_rel/initialize.rb#L11-L17 |
14,532 | neo4jrb/neo4j | lib/neo4j/shared/property.rb | Neo4j::Shared.Property.process_attributes | def process_attributes(attributes = nil)
return attributes if attributes.blank?
multi_parameter_attributes = {}
new_attributes = {}
attributes.each_pair do |key, value|
if key.match(DATE_KEY_REGEX)
match = key.to_s.match(DATE_KEY_REGEX)
found_key = match[1]
... | ruby | def process_attributes(attributes = nil)
return attributes if attributes.blank?
multi_parameter_attributes = {}
new_attributes = {}
attributes.each_pair do |key, value|
if key.match(DATE_KEY_REGEX)
match = key.to_s.match(DATE_KEY_REGEX)
found_key = match[1]
... | [
"def",
"process_attributes",
"(",
"attributes",
"=",
"nil",
")",
"return",
"attributes",
"if",
"attributes",
".",
"blank?",
"multi_parameter_attributes",
"=",
"{",
"}",
"new_attributes",
"=",
"{",
"}",
"attributes",
".",
"each_pair",
"do",
"|",
"key",
",",
"va... | Gives support for Rails date_select, datetime_select, time_select helpers. | [
"Gives",
"support",
"for",
"Rails",
"date_select",
"datetime_select",
"time_select",
"helpers",
"."
] | 291c79a757e8bd5e84920a7bd44867a5f304aa8b | https://github.com/neo4jrb/neo4j/blob/291c79a757e8bd5e84920a7bd44867a5f304aa8b/lib/neo4j/shared/property.rb#L82-L98 |
14,533 | neo4jrb/neo4j | lib/neo4j/shared/declared_properties.rb | Neo4j::Shared.DeclaredProperties.attributes_nil_hash | def attributes_nil_hash
@_attributes_nil_hash ||= {}.tap do |attr_hash|
registered_properties.each_pair do |k, prop_obj|
val = prop_obj.default_value
attr_hash[k.to_s] = val
end
end.freeze
end | ruby | def attributes_nil_hash
@_attributes_nil_hash ||= {}.tap do |attr_hash|
registered_properties.each_pair do |k, prop_obj|
val = prop_obj.default_value
attr_hash[k.to_s] = val
end
end.freeze
end | [
"def",
"attributes_nil_hash",
"@_attributes_nil_hash",
"||=",
"{",
"}",
".",
"tap",
"do",
"|",
"attr_hash",
"|",
"registered_properties",
".",
"each_pair",
"do",
"|",
"k",
",",
"prop_obj",
"|",
"val",
"=",
"prop_obj",
".",
"default_value",
"attr_hash",
"[",
"k... | During object wrap, a hash is needed that contains each declared property with a nil value.
The active_attr dependency is capable of providing this but it is expensive and calculated on the fly
each time it is called. Rather than rely on that, we build this progressively as properties are registered.
When the node o... | [
"During",
"object",
"wrap",
"a",
"hash",
"is",
"needed",
"that",
"contains",
"each",
"declared",
"property",
"with",
"a",
"nil",
"value",
".",
"The",
"active_attr",
"dependency",
"is",
"capable",
"of",
"providing",
"this",
"but",
"it",
"is",
"expensive",
"an... | 291c79a757e8bd5e84920a7bd44867a5f304aa8b | https://github.com/neo4jrb/neo4j/blob/291c79a757e8bd5e84920a7bd44867a5f304aa8b/lib/neo4j/shared/declared_properties.rb#L69-L76 |
14,534 | neo4jrb/neo4j | lib/neo4j/shared/declared_properties.rb | Neo4j::Shared.DeclaredProperties.attributes_string_map | def attributes_string_map
@_attributes_string_map ||= {}.tap do |attr_hash|
attributes_nil_hash.each_key { |k| attr_hash[k.to_sym] = k }
end.freeze
end | ruby | def attributes_string_map
@_attributes_string_map ||= {}.tap do |attr_hash|
attributes_nil_hash.each_key { |k| attr_hash[k.to_sym] = k }
end.freeze
end | [
"def",
"attributes_string_map",
"@_attributes_string_map",
"||=",
"{",
"}",
".",
"tap",
"do",
"|",
"attr_hash",
"|",
"attributes_nil_hash",
".",
"each_key",
"{",
"|",
"k",
"|",
"attr_hash",
"[",
"k",
".",
"to_sym",
"]",
"=",
"k",
"}",
"end",
".",
"freeze",... | During object wrapping, a props hash is built with string keys but Neo4j-core provides symbols.
Rather than a `to_s` or `symbolize_keys` during every load, we build a map of symbol-to-string
to speed up the process. This increases memory used by the gem but reduces object allocation and GC, so it is faster
in practi... | [
"During",
"object",
"wrapping",
"a",
"props",
"hash",
"is",
"built",
"with",
"string",
"keys",
"but",
"Neo4j",
"-",
"core",
"provides",
"symbols",
".",
"Rather",
"than",
"a",
"to_s",
"or",
"symbolize_keys",
"during",
"every",
"load",
"we",
"build",
"a",
"m... | 291c79a757e8bd5e84920a7bd44867a5f304aa8b | https://github.com/neo4jrb/neo4j/blob/291c79a757e8bd5e84920a7bd44867a5f304aa8b/lib/neo4j/shared/declared_properties.rb#L82-L86 |
14,535 | neo4jrb/neo4j | lib/neo4j/active_rel/persistence/query_factory.rb | Neo4j::ActiveRel::Persistence.QueryFactory.node_before_callbacks! | def node_before_callbacks!
validate_unpersisted_nodes!
from_node.conditional_callback(:create, from_node.persisted?) do
to_node.conditional_callback(:create, to_node.persisted?) do
yield
end
end
end | ruby | def node_before_callbacks!
validate_unpersisted_nodes!
from_node.conditional_callback(:create, from_node.persisted?) do
to_node.conditional_callback(:create, to_node.persisted?) do
yield
end
end
end | [
"def",
"node_before_callbacks!",
"validate_unpersisted_nodes!",
"from_node",
".",
"conditional_callback",
"(",
":create",
",",
"from_node",
".",
"persisted?",
")",
"do",
"to_node",
".",
"conditional_callback",
"(",
":create",
",",
"to_node",
".",
"persisted?",
")",
"d... | Node callbacks only need to be executed if the node is not persisted. We let the `conditional_callback` method do the work,
we only have to give it the type of callback we expect to be run and the condition which, if true, will prevent it from executing. | [
"Node",
"callbacks",
"only",
"need",
"to",
"be",
"executed",
"if",
"the",
"node",
"is",
"not",
"persisted",
".",
"We",
"let",
"the",
"conditional_callback",
"method",
"do",
"the",
"work",
"we",
"only",
"have",
"to",
"give",
"it",
"the",
"type",
"of",
"ca... | 291c79a757e8bd5e84920a7bd44867a5f304aa8b | https://github.com/neo4jrb/neo4j/blob/291c79a757e8bd5e84920a7bd44867a5f304aa8b/lib/neo4j/active_rel/persistence/query_factory.rb#L37-L44 |
14,536 | neo4jrb/neo4j | lib/neo4j/shared/persistence.rb | Neo4j::Shared.Persistence.update | def update(attributes)
self.class.run_transaction do |tx|
self.attributes = process_attributes(attributes)
saved = save
tx.mark_failed unless saved
saved
end
end | ruby | def update(attributes)
self.class.run_transaction do |tx|
self.attributes = process_attributes(attributes)
saved = save
tx.mark_failed unless saved
saved
end
end | [
"def",
"update",
"(",
"attributes",
")",
"self",
".",
"class",
".",
"run_transaction",
"do",
"|",
"tx",
"|",
"self",
".",
"attributes",
"=",
"process_attributes",
"(",
"attributes",
")",
"saved",
"=",
"save",
"tx",
".",
"mark_failed",
"unless",
"saved",
"s... | Updates this resource with all the attributes from the passed-in Hash and requests that the record be saved.
If saving fails because the resource is invalid then false will be returned. | [
"Updates",
"this",
"resource",
"with",
"all",
"the",
"attributes",
"from",
"the",
"passed",
"-",
"in",
"Hash",
"and",
"requests",
"that",
"the",
"record",
"be",
"saved",
".",
"If",
"saving",
"fails",
"because",
"the",
"resource",
"is",
"invalid",
"then",
"... | 291c79a757e8bd5e84920a7bd44867a5f304aa8b | https://github.com/neo4jrb/neo4j/blob/291c79a757e8bd5e84920a7bd44867a5f304aa8b/lib/neo4j/shared/persistence.rb#L182-L189 |
14,537 | neo4jrb/neo4j | lib/neo4j/active_rel/related_node.rb | Neo4j::ActiveRel.RelatedNode.loaded | def loaded
fail UnsetRelatedNodeError, 'Node not set, cannot load' if @node.nil?
@node = if @node.respond_to?(:neo_id)
@node
else
Neo4j::ActiveBase.new_query.match(:n).where(n: {neo_id: @node}).pluck(:n).first
end
end | ruby | def loaded
fail UnsetRelatedNodeError, 'Node not set, cannot load' if @node.nil?
@node = if @node.respond_to?(:neo_id)
@node
else
Neo4j::ActiveBase.new_query.match(:n).where(n: {neo_id: @node}).pluck(:n).first
end
end | [
"def",
"loaded",
"fail",
"UnsetRelatedNodeError",
",",
"'Node not set, cannot load'",
"if",
"@node",
".",
"nil?",
"@node",
"=",
"if",
"@node",
".",
"respond_to?",
"(",
":neo_id",
")",
"@node",
"else",
"Neo4j",
"::",
"ActiveBase",
".",
"new_query",
".",
"match",
... | Loads a node from the database or returns the node if already laoded | [
"Loads",
"a",
"node",
"from",
"the",
"database",
"or",
"returns",
"the",
"node",
"if",
"already",
"laoded"
] | 291c79a757e8bd5e84920a7bd44867a5f304aa8b | https://github.com/neo4jrb/neo4j/blob/291c79a757e8bd5e84920a7bd44867a5f304aa8b/lib/neo4j/active_rel/related_node.rb#L30-L37 |
14,538 | neo4jrb/neo4j | lib/neo4j/shared/type_converters.rb | Neo4j::Shared.TypeConverters.convert_properties_to | def convert_properties_to(obj, medium, properties)
direction = medium == :ruby ? :to_ruby : :to_db
properties.each_pair do |key, value|
next if skip_conversion?(obj, key, value)
properties[key] = convert_property(key, value, direction)
end
end | ruby | def convert_properties_to(obj, medium, properties)
direction = medium == :ruby ? :to_ruby : :to_db
properties.each_pair do |key, value|
next if skip_conversion?(obj, key, value)
properties[key] = convert_property(key, value, direction)
end
end | [
"def",
"convert_properties_to",
"(",
"obj",
",",
"medium",
",",
"properties",
")",
"direction",
"=",
"medium",
"==",
":ruby",
"?",
":to_ruby",
":",
":to_db",
"properties",
".",
"each_pair",
"do",
"|",
"key",
",",
"value",
"|",
"next",
"if",
"skip_conversion?... | Modifies a hash's values to be of types acceptable to Neo4j or matching what the user defined using `type` in property definitions.
@param [Neo4j::Shared::Property] obj A node or rel that mixes in the Property module
@param [Symbol] medium Indicates the type of conversion to perform.
@param [Hash] properties A hash ... | [
"Modifies",
"a",
"hash",
"s",
"values",
"to",
"be",
"of",
"types",
"acceptable",
"to",
"Neo4j",
"or",
"matching",
"what",
"the",
"user",
"defined",
"using",
"type",
"in",
"property",
"definitions",
"."
] | 291c79a757e8bd5e84920a7bd44867a5f304aa8b | https://github.com/neo4jrb/neo4j/blob/291c79a757e8bd5e84920a7bd44867a5f304aa8b/lib/neo4j/shared/type_converters.rb#L335-L341 |
14,539 | neo4jrb/neo4j | lib/neo4j/shared/type_converters.rb | Neo4j::Shared.TypeConverters.convert_property | def convert_property(key, value, direction)
converted_property(primitive_type(key.to_sym), value, direction)
end | ruby | def convert_property(key, value, direction)
converted_property(primitive_type(key.to_sym), value, direction)
end | [
"def",
"convert_property",
"(",
"key",
",",
"value",
",",
"direction",
")",
"converted_property",
"(",
"primitive_type",
"(",
"key",
".",
"to_sym",
")",
",",
"value",
",",
"direction",
")",
"end"
] | Converts a single property from its current format to its db- or Ruby-expected output type.
@param [Symbol] key A property declared on the model
@param value The value intended for conversion
@param [Symbol] direction Either :to_ruby or :to_db, indicates the type of conversion to perform | [
"Converts",
"a",
"single",
"property",
"from",
"its",
"current",
"format",
"to",
"its",
"db",
"-",
"or",
"Ruby",
"-",
"expected",
"output",
"type",
"."
] | 291c79a757e8bd5e84920a7bd44867a5f304aa8b | https://github.com/neo4jrb/neo4j/blob/291c79a757e8bd5e84920a7bd44867a5f304aa8b/lib/neo4j/shared/type_converters.rb#L347-L349 |
14,540 | neo4jrb/neo4j | lib/neo4j/shared/type_converters.rb | Neo4j::Shared.TypeConverters.primitive_type | def primitive_type(attr)
case
when serialized_properties.include?(attr)
serialized_properties[attr]
when magic_typecast_properties.include?(attr)
magic_typecast_properties[attr]
else
fetch_upstream_primitive(attr)
end
end | ruby | def primitive_type(attr)
case
when serialized_properties.include?(attr)
serialized_properties[attr]
when magic_typecast_properties.include?(attr)
magic_typecast_properties[attr]
else
fetch_upstream_primitive(attr)
end
end | [
"def",
"primitive_type",
"(",
"attr",
")",
"case",
"when",
"serialized_properties",
".",
"include?",
"(",
"attr",
")",
"serialized_properties",
"[",
"attr",
"]",
"when",
"magic_typecast_properties",
".",
"include?",
"(",
"attr",
")",
"magic_typecast_properties",
"["... | If the attribute is to be typecast using a custom converter, which converter should it use? If no, returns the type to find a native serializer. | [
"If",
"the",
"attribute",
"is",
"to",
"be",
"typecast",
"using",
"a",
"custom",
"converter",
"which",
"converter",
"should",
"it",
"use?",
"If",
"no",
"returns",
"the",
"type",
"to",
"find",
"a",
"native",
"serializer",
"."
] | 291c79a757e8bd5e84920a7bd44867a5f304aa8b | https://github.com/neo4jrb/neo4j/blob/291c79a757e8bd5e84920a7bd44867a5f304aa8b/lib/neo4j/shared/type_converters.rb#L372-L381 |
14,541 | neo4jrb/neo4j | lib/neo4j/shared/type_converters.rb | Neo4j::Shared.TypeConverters.skip_conversion? | def skip_conversion?(obj, attr, value)
value.nil? || !obj.class.attributes.key?(attr)
end | ruby | def skip_conversion?(obj, attr, value)
value.nil? || !obj.class.attributes.key?(attr)
end | [
"def",
"skip_conversion?",
"(",
"obj",
",",
"attr",
",",
"value",
")",
"value",
".",
"nil?",
"||",
"!",
"obj",
".",
"class",
".",
"attributes",
".",
"key?",
"(",
"attr",
")",
"end"
] | Returns true if the property isn't defined in the model or if it is nil | [
"Returns",
"true",
"if",
"the",
"property",
"isn",
"t",
"defined",
"in",
"the",
"model",
"or",
"if",
"it",
"is",
"nil"
] | 291c79a757e8bd5e84920a7bd44867a5f304aa8b | https://github.com/neo4jrb/neo4j/blob/291c79a757e8bd5e84920a7bd44867a5f304aa8b/lib/neo4j/shared/type_converters.rb#L384-L386 |
14,542 | chefspec/chefspec | lib/chefspec/matchers/render_file_matcher.rb | ChefSpec::Matchers.RenderFileMatcher.matches_content? | def matches_content?
return true if @expected_content.empty?
@actual_content = ChefSpec::Renderer.new(@runner, resource).content
return false if @actual_content.nil?
# Knock out matches that pass. When we're done, we pass if the list is
# empty. Otherwise, @expected_content is the list ... | ruby | def matches_content?
return true if @expected_content.empty?
@actual_content = ChefSpec::Renderer.new(@runner, resource).content
return false if @actual_content.nil?
# Knock out matches that pass. When we're done, we pass if the list is
# empty. Otherwise, @expected_content is the list ... | [
"def",
"matches_content?",
"return",
"true",
"if",
"@expected_content",
".",
"empty?",
"@actual_content",
"=",
"ChefSpec",
"::",
"Renderer",
".",
"new",
"(",
"@runner",
",",
"resource",
")",
".",
"content",
"return",
"false",
"if",
"@actual_content",
".",
"nil?"... | Determines if the resources content matches the expected content.
@param [Chef::Resource] resource
@return [true, false] | [
"Determines",
"if",
"the",
"resources",
"content",
"matches",
"the",
"expected",
"content",
"."
] | b7c260d480c3b71a0e61ce46148ec7b9d3f3c40e | https://github.com/chefspec/chefspec/blob/b7c260d480c3b71a0e61ce46148ec7b9d3f3c40e/lib/chefspec/matchers/render_file_matcher.rb#L112-L138 |
14,543 | chefspec/chefspec | lib/chefspec/server_methods.rb | ChefSpec.ServerMethods.load_data | def load_data(name, key, data = {})
ChefSpec::ZeroServer.load_data(name, key, data)
end | ruby | def load_data(name, key, data = {})
ChefSpec::ZeroServer.load_data(name, key, data)
end | [
"def",
"load_data",
"(",
"name",
",",
"key",
",",
"data",
"=",
"{",
"}",
")",
"ChefSpec",
"::",
"ZeroServer",
".",
"load_data",
"(",
"name",
",",
"key",
",",
"data",
")",
"end"
] | Shortcut method for loading data into Chef Zero.
@param [String] name
the name or id of the item to load
@param [String, Symbol] key
the key to load
@param [Hash] data
the data for the object, which will be converted to JSON and uploaded
to the server | [
"Shortcut",
"method",
"for",
"loading",
"data",
"into",
"Chef",
"Zero",
"."
] | b7c260d480c3b71a0e61ce46148ec7b9d3f3c40e | https://github.com/chefspec/chefspec/blob/b7c260d480c3b71a0e61ce46148ec7b9d3f3c40e/lib/chefspec/server_methods.rb#L156-L158 |
14,544 | chefspec/chefspec | lib/chefspec/zero_server.rb | ChefSpec.ZeroServer.reset! | def reset!
if RSpec.configuration.server_runner_clear_cookbooks
@server.clear_data
@cookbooks_uploaded = false
else
# If we don't want to do a full clear, iterate through each value that we
# set and manually remove it.
@data_loaded.each do |key, names|
if k... | ruby | def reset!
if RSpec.configuration.server_runner_clear_cookbooks
@server.clear_data
@cookbooks_uploaded = false
else
# If we don't want to do a full clear, iterate through each value that we
# set and manually remove it.
@data_loaded.each do |key, names|
if k... | [
"def",
"reset!",
"if",
"RSpec",
".",
"configuration",
".",
"server_runner_clear_cookbooks",
"@server",
".",
"clear_data",
"@cookbooks_uploaded",
"=",
"false",
"else",
"# If we don't want to do a full clear, iterate through each value that we",
"# set and manually remove it.",
"@dat... | Remove all the data we just loaded from the ChefZero server | [
"Remove",
"all",
"the",
"data",
"we",
"just",
"loaded",
"from",
"the",
"ChefZero",
"server"
] | b7c260d480c3b71a0e61ce46148ec7b9d3f3c40e | https://github.com/chefspec/chefspec/blob/b7c260d480c3b71a0e61ce46148ec7b9d3f3c40e/lib/chefspec/zero_server.rb#L31-L47 |
14,545 | chefspec/chefspec | lib/chefspec/zero_server.rb | ChefSpec.ZeroServer.nuke! | def nuke!
@server = ChefZero::Server.new(
# Set the log level from RSpec, defaulting to warn
log_level: RSpec.configuration.log_level || :warn,
port: RSpec.configuration.server_runner_port,
# Set the data store
data_store: data_store(RSpec.configuration.server_runner_data... | ruby | def nuke!
@server = ChefZero::Server.new(
# Set the log level from RSpec, defaulting to warn
log_level: RSpec.configuration.log_level || :warn,
port: RSpec.configuration.server_runner_port,
# Set the data store
data_store: data_store(RSpec.configuration.server_runner_data... | [
"def",
"nuke!",
"@server",
"=",
"ChefZero",
"::",
"Server",
".",
"new",
"(",
"# Set the log level from RSpec, defaulting to warn",
"log_level",
":",
"RSpec",
".",
"configuration",
".",
"log_level",
"||",
":warn",
",",
"port",
":",
"RSpec",
".",
"configuration",
".... | Really reset everything and reload the configuration | [
"Really",
"reset",
"everything",
"and",
"reload",
"the",
"configuration"
] | b7c260d480c3b71a0e61ce46148ec7b9d3f3c40e | https://github.com/chefspec/chefspec/blob/b7c260d480c3b71a0e61ce46148ec7b9d3f3c40e/lib/chefspec/zero_server.rb#L52-L63 |
14,546 | chefspec/chefspec | lib/chefspec/zero_server.rb | ChefSpec.ZeroServer.upload_cookbooks! | def upload_cookbooks!
return if @cookbooks_uploaded
loader = Chef::CookbookLoader.new(Chef::Config[:cookbook_path])
loader.load_cookbooks
cookbook_uploader_for(loader).upload_cookbooks
@cookbooks_uploaded = true
end | ruby | def upload_cookbooks!
return if @cookbooks_uploaded
loader = Chef::CookbookLoader.new(Chef::Config[:cookbook_path])
loader.load_cookbooks
cookbook_uploader_for(loader).upload_cookbooks
@cookbooks_uploaded = true
end | [
"def",
"upload_cookbooks!",
"return",
"if",
"@cookbooks_uploaded",
"loader",
"=",
"Chef",
"::",
"CookbookLoader",
".",
"new",
"(",
"Chef",
"::",
"Config",
"[",
":cookbook_path",
"]",
")",
"loader",
".",
"load_cookbooks",
"cookbook_uploader_for",
"(",
"loader",
")"... | Upload the cookbooks to the Chef Server. | [
"Upload",
"the",
"cookbooks",
"to",
"the",
"Chef",
"Server",
"."
] | b7c260d480c3b71a0e61ce46148ec7b9d3f3c40e | https://github.com/chefspec/chefspec/blob/b7c260d480c3b71a0e61ce46148ec7b9d3f3c40e/lib/chefspec/zero_server.rb#L75-L81 |
14,547 | chefspec/chefspec | lib/chefspec/solo_runner.rb | ChefSpec.SoloRunner.converge | def converge(*recipe_names)
# Re-apply the Chef config before converging in case something else
# called Config.reset too.
apply_chef_config!
@converging = false
node.run_list.reset!
recipe_names.each { |recipe_name| node.run_list.add(recipe_name) }
return self if dry_run?
... | ruby | def converge(*recipe_names)
# Re-apply the Chef config before converging in case something else
# called Config.reset too.
apply_chef_config!
@converging = false
node.run_list.reset!
recipe_names.each { |recipe_name| node.run_list.add(recipe_name) }
return self if dry_run?
... | [
"def",
"converge",
"(",
"*",
"recipe_names",
")",
"# Re-apply the Chef config before converging in case something else",
"# called Config.reset too.",
"apply_chef_config!",
"@converging",
"=",
"false",
"node",
".",
"run_list",
".",
"reset!",
"recipe_names",
".",
"each",
"{",
... | Instantiate a new SoloRunner to run examples with.
@example Instantiate a new Runner
ChefSpec::SoloRunner.new
@example Specifying the platform and version
ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '18.04')
@example Specifying the cookbook path
ChefSpec::SoloRunner.new(cookbook_path: ['/cookbo... | [
"Instantiate",
"a",
"new",
"SoloRunner",
"to",
"run",
"examples",
"with",
"."
] | b7c260d480c3b71a0e61ce46148ec7b9d3f3c40e | https://github.com/chefspec/chefspec/blob/b7c260d480c3b71a0e61ce46148ec7b9d3f3c40e/lib/chefspec/solo_runner.rb#L89-L127 |
14,548 | chefspec/chefspec | lib/chefspec/solo_runner.rb | ChefSpec.SoloRunner.converge_block | def converge_block(&block)
converge do
recipe = Chef::Recipe.new(cookbook_name, '_test', run_context)
recipe.instance_exec(&block)
end
end | ruby | def converge_block(&block)
converge do
recipe = Chef::Recipe.new(cookbook_name, '_test', run_context)
recipe.instance_exec(&block)
end
end | [
"def",
"converge_block",
"(",
"&",
"block",
")",
"converge",
"do",
"recipe",
"=",
"Chef",
"::",
"Recipe",
".",
"new",
"(",
"cookbook_name",
",",
"'_test'",
",",
"run_context",
")",
"recipe",
".",
"instance_exec",
"(",
"block",
")",
"end",
"end"
] | Execute a block of recipe code.
@param [Proc] block
A block containing Chef recipe code
@return [ChefSpec::SoloRunner] | [
"Execute",
"a",
"block",
"of",
"recipe",
"code",
"."
] | b7c260d480c3b71a0e61ce46148ec7b9d3f3c40e | https://github.com/chefspec/chefspec/blob/b7c260d480c3b71a0e61ce46148ec7b9d3f3c40e/lib/chefspec/solo_runner.rb#L137-L142 |
14,549 | chefspec/chefspec | lib/chefspec/solo_runner.rb | ChefSpec.SoloRunner.find_resource | def find_resource(type, name, action = nil)
resource_collection.all_resources.reverse_each.find do |resource|
resource.declared_type == type.to_sym && (name === resource.identity || name === resource.name) && (action.nil? || resource.performed_action?(action))
end
end | ruby | def find_resource(type, name, action = nil)
resource_collection.all_resources.reverse_each.find do |resource|
resource.declared_type == type.to_sym && (name === resource.identity || name === resource.name) && (action.nil? || resource.performed_action?(action))
end
end | [
"def",
"find_resource",
"(",
"type",
",",
"name",
",",
"action",
"=",
"nil",
")",
"resource_collection",
".",
"all_resources",
".",
"reverse_each",
".",
"find",
"do",
"|",
"resource",
"|",
"resource",
".",
"declared_type",
"==",
"type",
".",
"to_sym",
"&&",
... | Find the resource with the declared type and resource name, and optionally match a performed action.
If multiples match it returns the last (which more or less matches the chef last-inserter-wins semantics)
@example Find a template at `/etc/foo`
chef_run.find_resource(:template, '/etc/foo') #=> #<Chef::Resource:... | [
"Find",
"the",
"resource",
"with",
"the",
"declared",
"type",
"and",
"resource",
"name",
"and",
"optionally",
"match",
"a",
"performed",
"action",
"."
] | b7c260d480c3b71a0e61ce46148ec7b9d3f3c40e | https://github.com/chefspec/chefspec/blob/b7c260d480c3b71a0e61ce46148ec7b9d3f3c40e/lib/chefspec/solo_runner.rb#L207-L211 |
14,550 | chefspec/chefspec | lib/chefspec/solo_runner.rb | ChefSpec.SoloRunner.find_resources | def find_resources(type)
resource_collection.all_resources.select do |resource|
resource_name(resource) == type.to_sym
end
end | ruby | def find_resources(type)
resource_collection.all_resources.select do |resource|
resource_name(resource) == type.to_sym
end
end | [
"def",
"find_resources",
"(",
"type",
")",
"resource_collection",
".",
"all_resources",
".",
"select",
"do",
"|",
"resource",
"|",
"resource_name",
"(",
"resource",
")",
"==",
"type",
".",
"to_sym",
"end",
"end"
] | Find the resource with the declared type.
@example Find all template resources
chef_run.find_resources(:template) #=> [#<Chef::Resource::Template>, #...]
@param [Symbol] type
The type of resource such as `:file` or `:directory`.
@return [Array<Chef::Resource>]
The matching resources | [
"Find",
"the",
"resource",
"with",
"the",
"declared",
"type",
"."
] | b7c260d480c3b71a0e61ce46148ec7b9d3f3c40e | https://github.com/chefspec/chefspec/blob/b7c260d480c3b71a0e61ce46148ec7b9d3f3c40e/lib/chefspec/solo_runner.rb#L226-L230 |
14,551 | chefspec/chefspec | lib/chefspec/solo_runner.rb | ChefSpec.SoloRunner.step_into? | def step_into?(resource)
key = resource_name(resource)
Array(options[:step_into]).map(&method(:resource_name)).include?(key)
end | ruby | def step_into?(resource)
key = resource_name(resource)
Array(options[:step_into]).map(&method(:resource_name)).include?(key)
end | [
"def",
"step_into?",
"(",
"resource",
")",
"key",
"=",
"resource_name",
"(",
"resource",
")",
"Array",
"(",
"options",
"[",
":step_into",
"]",
")",
".",
"map",
"(",
"method",
"(",
":resource_name",
")",
")",
".",
"include?",
"(",
"key",
")",
"end"
] | Determines if the runner should step into the given resource. The
+step_into+ option takes a string, but this method coerces everything
to symbols for safety.
This method also substitutes any dashes (+-+) with underscores (+_+),
because that's what Chef does under the hood. (See GitHub issue #254
for more backgro... | [
"Determines",
"if",
"the",
"runner",
"should",
"step",
"into",
"the",
"given",
"resource",
".",
"The",
"+",
"step_into",
"+",
"option",
"takes",
"a",
"string",
"but",
"this",
"method",
"coerces",
"everything",
"to",
"symbols",
"for",
"safety",
"."
] | b7c260d480c3b71a0e61ce46148ec7b9d3f3c40e | https://github.com/chefspec/chefspec/blob/b7c260d480c3b71a0e61ce46148ec7b9d3f3c40e/lib/chefspec/solo_runner.rb#L256-L259 |
14,552 | chefspec/chefspec | lib/chefspec/solo_runner.rb | ChefSpec.SoloRunner.method_missing | def method_missing(m, *args, &block)
if block = ChefSpec.matchers[resource_name(m.to_sym)]
instance_exec(args.first, &block)
else
super
end
end | ruby | def method_missing(m, *args, &block)
if block = ChefSpec.matchers[resource_name(m.to_sym)]
instance_exec(args.first, &block)
else
super
end
end | [
"def",
"method_missing",
"(",
"m",
",",
"*",
"args",
",",
"&",
"block",
")",
"if",
"block",
"=",
"ChefSpec",
".",
"matchers",
"[",
"resource_name",
"(",
"m",
".",
"to_sym",
")",
"]",
"instance_exec",
"(",
"args",
".",
"first",
",",
"block",
")",
"els... | Respond to custom matchers defined by the user. | [
"Respond",
"to",
"custom",
"matchers",
"defined",
"by",
"the",
"user",
"."
] | b7c260d480c3b71a0e61ce46148ec7b9d3f3c40e | https://github.com/chefspec/chefspec/blob/b7c260d480c3b71a0e61ce46148ec7b9d3f3c40e/lib/chefspec/solo_runner.rb#L294-L300 |
14,553 | chefspec/chefspec | lib/chefspec/solo_runner.rb | ChefSpec.SoloRunner.with_default_options | def with_default_options(options)
config = RSpec.configuration
{
cookbook_root: config.cookbook_root || calling_cookbook_root(options, caller),
cookbook_path: config.cookbook_path || calling_cookbook_path(options, caller),
role_path: config.role_path || default_role_path,
... | ruby | def with_default_options(options)
config = RSpec.configuration
{
cookbook_root: config.cookbook_root || calling_cookbook_root(options, caller),
cookbook_path: config.cookbook_path || calling_cookbook_path(options, caller),
role_path: config.role_path || default_role_path,
... | [
"def",
"with_default_options",
"(",
"options",
")",
"config",
"=",
"RSpec",
".",
"configuration",
"{",
"cookbook_root",
":",
"config",
".",
"cookbook_root",
"||",
"calling_cookbook_root",
"(",
"options",
",",
"caller",
")",
",",
"cookbook_path",
":",
"config",
"... | Set the default options, with the given options taking precedence.
@param [Hash] options
the list of options to take precedence
@return [Hash] options | [
"Set",
"the",
"default",
"options",
"with",
"the",
"given",
"options",
"taking",
"precedence",
"."
] | b7c260d480c3b71a0e61ce46148ec7b9d3f3c40e | https://github.com/chefspec/chefspec/blob/b7c260d480c3b71a0e61ce46148ec7b9d3f3c40e/lib/chefspec/solo_runner.rb#L334-L348 |
14,554 | chefspec/chefspec | lib/chefspec/solo_runner.rb | ChefSpec.SoloRunner.calling_cookbook_root | def calling_cookbook_root(options, kaller)
calling_spec = options[:spec_declaration_locations] || kaller.find { |line| line =~ /\/spec/ }
raise Error::CookbookPathNotFound if calling_spec.nil?
bits = calling_spec.split(/:[0-9]/, 2).first.split(File::SEPARATOR)
spec_dir = bits.index('spec') || 0... | ruby | def calling_cookbook_root(options, kaller)
calling_spec = options[:spec_declaration_locations] || kaller.find { |line| line =~ /\/spec/ }
raise Error::CookbookPathNotFound if calling_spec.nil?
bits = calling_spec.split(/:[0-9]/, 2).first.split(File::SEPARATOR)
spec_dir = bits.index('spec') || 0... | [
"def",
"calling_cookbook_root",
"(",
"options",
",",
"kaller",
")",
"calling_spec",
"=",
"options",
"[",
":spec_declaration_locations",
"]",
"||",
"kaller",
".",
"find",
"{",
"|",
"line",
"|",
"line",
"=~",
"/",
"\\/",
"/",
"}",
"raise",
"Error",
"::",
"Co... | The inferred cookbook root from the calling spec.
@param [Hash<Symbol, Object>] options
initial runner options
@param [Array<String>] kaller
the calling trace
@return [String] | [
"The",
"inferred",
"cookbook",
"root",
"from",
"the",
"calling",
"spec",
"."
] | b7c260d480c3b71a0e61ce46148ec7b9d3f3c40e | https://github.com/chefspec/chefspec/blob/b7c260d480c3b71a0e61ce46148ec7b9d3f3c40e/lib/chefspec/solo_runner.rb#L360-L368 |
14,555 | chefspec/chefspec | lib/chefspec/solo_runner.rb | ChefSpec.SoloRunner.calling_cookbook_path | def calling_cookbook_path(options, kaller)
File.expand_path(File.join(calling_cookbook_root(options, kaller), '..'))
end | ruby | def calling_cookbook_path(options, kaller)
File.expand_path(File.join(calling_cookbook_root(options, kaller), '..'))
end | [
"def",
"calling_cookbook_path",
"(",
"options",
",",
"kaller",
")",
"File",
".",
"expand_path",
"(",
"File",
".",
"join",
"(",
"calling_cookbook_root",
"(",
"options",
",",
"kaller",
")",
",",
"'..'",
")",
")",
"end"
] | The inferred path from the calling spec.
@param [Hash<Symbol, Object>] options
initial runner options
@param [Array<String>] kaller
the calling trace
@return [String] | [
"The",
"inferred",
"path",
"from",
"the",
"calling",
"spec",
"."
] | b7c260d480c3b71a0e61ce46148ec7b9d3f3c40e | https://github.com/chefspec/chefspec/blob/b7c260d480c3b71a0e61ce46148ec7b9d3f3c40e/lib/chefspec/solo_runner.rb#L380-L382 |
14,556 | chefspec/chefspec | lib/chefspec/solo_runner.rb | ChefSpec.SoloRunner.default_role_path | def default_role_path
Pathname.new(Dir.pwd).ascend do |path|
possible = File.join(path, 'roles')
return possible if File.exist?(possible)
end
nil
end | ruby | def default_role_path
Pathname.new(Dir.pwd).ascend do |path|
possible = File.join(path, 'roles')
return possible if File.exist?(possible)
end
nil
end | [
"def",
"default_role_path",
"Pathname",
".",
"new",
"(",
"Dir",
".",
"pwd",
")",
".",
"ascend",
"do",
"|",
"path",
"|",
"possible",
"=",
"File",
".",
"join",
"(",
"path",
",",
"'roles'",
")",
"return",
"possible",
"if",
"File",
".",
"exist?",
"(",
"p... | The inferred path to roles.
@return [String, nil] | [
"The",
"inferred",
"path",
"to",
"roles",
"."
] | b7c260d480c3b71a0e61ce46148ec7b9d3f3c40e | https://github.com/chefspec/chefspec/blob/b7c260d480c3b71a0e61ce46148ec7b9d3f3c40e/lib/chefspec/solo_runner.rb#L389-L396 |
14,557 | chefspec/chefspec | lib/chefspec/coverage.rb | ChefSpec.Coverage.start! | def start!(&block)
warn("ChefSpec's coverage reporting is deprecated and will be removed in a future version")
instance_eval(&block) if block
at_exit { ChefSpec::Coverage.report! }
end | ruby | def start!(&block)
warn("ChefSpec's coverage reporting is deprecated and will be removed in a future version")
instance_eval(&block) if block
at_exit { ChefSpec::Coverage.report! }
end | [
"def",
"start!",
"(",
"&",
"block",
")",
"warn",
"(",
"\"ChefSpec's coverage reporting is deprecated and will be removed in a future version\"",
")",
"instance_eval",
"(",
"block",
")",
"if",
"block",
"at_exit",
"{",
"ChefSpec",
"::",
"Coverage",
".",
"report!",
"}",
... | Create a new coverage object singleton.
Start the coverage reporting analysis. This method also adds the the
+at_exit+ handler for printing the coverage report. | [
"Create",
"a",
"new",
"coverage",
"object",
"singleton",
"."
] | b7c260d480c3b71a0e61ce46148ec7b9d3f3c40e | https://github.com/chefspec/chefspec/blob/b7c260d480c3b71a0e61ce46148ec7b9d3f3c40e/lib/chefspec/coverage.rb#L47-L51 |
14,558 | chefspec/chefspec | lib/chefspec/coverage.rb | ChefSpec.Coverage.add_filter | def add_filter(filter = nil, &block)
id = "#{filter.inspect}/#{block.inspect}".hash
@filters[id] = if filter.kind_of?(Filter)
filter
elsif filter.kind_of?(String)
StringFilter.new(filter)
elsif filter.kind_of?(Regexp)
... | ruby | def add_filter(filter = nil, &block)
id = "#{filter.inspect}/#{block.inspect}".hash
@filters[id] = if filter.kind_of?(Filter)
filter
elsif filter.kind_of?(String)
StringFilter.new(filter)
elsif filter.kind_of?(Regexp)
... | [
"def",
"add_filter",
"(",
"filter",
"=",
"nil",
",",
"&",
"block",
")",
"id",
"=",
"\"#{filter.inspect}/#{block.inspect}\"",
".",
"hash",
"@filters",
"[",
"id",
"]",
"=",
"if",
"filter",
".",
"kind_of?",
"(",
"Filter",
")",
"filter",
"elsif",
"filter",
"."... | Add a filter to the coverage analysis.
@param [Filter, String, Regexp] filter
the filter to add
@param [Proc] block
the block to use as a filter
@return [true] | [
"Add",
"a",
"filter",
"to",
"the",
"coverage",
"analysis",
"."
] | b7c260d480c3b71a0e61ce46148ec7b9d3f3c40e | https://github.com/chefspec/chefspec/blob/b7c260d480c3b71a0e61ce46148ec7b9d3f3c40e/lib/chefspec/coverage.rb#L63-L80 |
14,559 | chefspec/chefspec | lib/chefspec/coverage.rb | ChefSpec.Coverage.set_template | def set_template(file = 'human.erb')
[
ChefSpec.root.join('templates', 'coverage', file),
File.expand_path(file, Dir.pwd)
].each do |temp|
if File.exist?(temp)
@template = temp
return
end
end
raise Error::TemplateNotFound.new(path: file)
en... | ruby | def set_template(file = 'human.erb')
[
ChefSpec.root.join('templates', 'coverage', file),
File.expand_path(file, Dir.pwd)
].each do |temp|
if File.exist?(temp)
@template = temp
return
end
end
raise Error::TemplateNotFound.new(path: file)
en... | [
"def",
"set_template",
"(",
"file",
"=",
"'human.erb'",
")",
"[",
"ChefSpec",
".",
"root",
".",
"join",
"(",
"'templates'",
",",
"'coverage'",
",",
"file",
")",
",",
"File",
".",
"expand_path",
"(",
"file",
",",
"Dir",
".",
"pwd",
")",
"]",
".",
"eac... | Change the template for reporting of converage analysis.
@param [string] path
The template file to use for the output of the report
@return [true] | [
"Change",
"the",
"template",
"for",
"reporting",
"of",
"converage",
"analysis",
"."
] | b7c260d480c3b71a0e61ce46148ec7b9d3f3c40e | https://github.com/chefspec/chefspec/blob/b7c260d480c3b71a0e61ce46148ec7b9d3f3c40e/lib/chefspec/coverage.rb#L101-L112 |
14,560 | chefspec/chefspec | lib/chefspec/librarian.rb | ChefSpec.Librarian.teardown! | def teardown!
env = ::Librarian::Chef::Environment.new(project_path: Dir.pwd)
env.config_db.local['path'] = @originalpath
FileUtils.rm_rf(@tmpdir) if File.exist?(@tmpdir)
end | ruby | def teardown!
env = ::Librarian::Chef::Environment.new(project_path: Dir.pwd)
env.config_db.local['path'] = @originalpath
FileUtils.rm_rf(@tmpdir) if File.exist?(@tmpdir)
end | [
"def",
"teardown!",
"env",
"=",
"::",
"Librarian",
"::",
"Chef",
"::",
"Environment",
".",
"new",
"(",
"project_path",
":",
"Dir",
".",
"pwd",
")",
"env",
".",
"config_db",
".",
"local",
"[",
"'path'",
"]",
"=",
"@originalpath",
"FileUtils",
".",
"rm_rf"... | Remove the temporary directory and restore the librarian-chef cookbook path. | [
"Remove",
"the",
"temporary",
"directory",
"and",
"restore",
"the",
"librarian",
"-",
"chef",
"cookbook",
"path",
"."
] | b7c260d480c3b71a0e61ce46148ec7b9d3f3c40e | https://github.com/chefspec/chefspec/blob/b7c260d480c3b71a0e61ce46148ec7b9d3f3c40e/lib/chefspec/librarian.rb#L38-L43 |
14,561 | chefspec/chefspec | lib/chefspec/policyfile.rb | ChefSpec.Policyfile.setup! | def setup!
policyfile_path = File.join(Dir.pwd, 'Policyfile.rb')
installer = ChefDK::PolicyfileServices::Install.new(
policyfile: policyfile_path,
ui: ChefDK::UI.null
)
installer.run
exporter = ChefDK::PolicyfileServices::ExportRepo.new(
policyfile: policyfile_pa... | ruby | def setup!
policyfile_path = File.join(Dir.pwd, 'Policyfile.rb')
installer = ChefDK::PolicyfileServices::Install.new(
policyfile: policyfile_path,
ui: ChefDK::UI.null
)
installer.run
exporter = ChefDK::PolicyfileServices::ExportRepo.new(
policyfile: policyfile_pa... | [
"def",
"setup!",
"policyfile_path",
"=",
"File",
".",
"join",
"(",
"Dir",
".",
"pwd",
",",
"'Policyfile.rb'",
")",
"installer",
"=",
"ChefDK",
"::",
"PolicyfileServices",
"::",
"Install",
".",
"new",
"(",
"policyfile",
":",
"policyfile_path",
",",
"ui",
":",... | Setup and install the necessary dependencies in the temporary directory | [
"Setup",
"and",
"install",
"the",
"necessary",
"dependencies",
"in",
"the",
"temporary",
"directory"
] | b7c260d480c3b71a0e61ce46148ec7b9d3f3c40e | https://github.com/chefspec/chefspec/blob/b7c260d480c3b71a0e61ce46148ec7b9d3f3c40e/lib/chefspec/policyfile.rb#L24-L48 |
14,562 | chefspec/chefspec | lib/chefspec/mixins/normalize.rb | ChefSpec.Normalize.resource_name | def resource_name(thing)
if thing.respond_to?(:declared_type) && thing.declared_type
name = thing.declared_type
elsif thing.respond_to?(:resource_name)
name = thing.resource_name
else
name = thing
end
name.to_s.gsub('-', '_').to_sym
end | ruby | def resource_name(thing)
if thing.respond_to?(:declared_type) && thing.declared_type
name = thing.declared_type
elsif thing.respond_to?(:resource_name)
name = thing.resource_name
else
name = thing
end
name.to_s.gsub('-', '_').to_sym
end | [
"def",
"resource_name",
"(",
"thing",
")",
"if",
"thing",
".",
"respond_to?",
"(",
":declared_type",
")",
"&&",
"thing",
".",
"declared_type",
"name",
"=",
"thing",
".",
"declared_type",
"elsif",
"thing",
".",
"respond_to?",
"(",
":resource_name",
")",
"name",... | Calculate the name of a resource, replacing dashes with underscores
and converting symbols to strings and back again.
@param [String, Chef::Resource] thing
@return [Symbol] | [
"Calculate",
"the",
"name",
"of",
"a",
"resource",
"replacing",
"dashes",
"with",
"underscores",
"and",
"converting",
"symbols",
"to",
"strings",
"and",
"back",
"again",
"."
] | b7c260d480c3b71a0e61ce46148ec7b9d3f3c40e | https://github.com/chefspec/chefspec/blob/b7c260d480c3b71a0e61ce46148ec7b9d3f3c40e/lib/chefspec/mixins/normalize.rb#L11-L20 |
14,563 | chefspec/chefspec | lib/chefspec/formatter.rb | ChefSpec.ChefFormatter.node_load_failed | def node_load_failed(node_name, exception, config)
expecting_exception(exception) do
description = Chef::Formatters::ErrorMapper.node_load_failed(node_name, exception, config)
display_error(description)
end
end | ruby | def node_load_failed(node_name, exception, config)
expecting_exception(exception) do
description = Chef::Formatters::ErrorMapper.node_load_failed(node_name, exception, config)
display_error(description)
end
end | [
"def",
"node_load_failed",
"(",
"node_name",
",",
"exception",
",",
"config",
")",
"expecting_exception",
"(",
"exception",
")",
"do",
"description",
"=",
"Chef",
"::",
"Formatters",
"::",
"ErrorMapper",
".",
"node_load_failed",
"(",
"node_name",
",",
"exception",... | Failed to load node data from the server | [
"Failed",
"to",
"load",
"node",
"data",
"from",
"the",
"server"
] | b7c260d480c3b71a0e61ce46148ec7b9d3f3c40e | https://github.com/chefspec/chefspec/blob/b7c260d480c3b71a0e61ce46148ec7b9d3f3c40e/lib/chefspec/formatter.rb#L42-L47 |
14,564 | chefspec/chefspec | lib/chefspec/formatter.rb | ChefSpec.ChefFormatter.run_list_expand_failed | def run_list_expand_failed(node, exception)
expecting_exception(exception) do
description = Chef::Formatters::ErrorMapper.run_list_expand_failed(node, exception)
display_error(description)
end
end | ruby | def run_list_expand_failed(node, exception)
expecting_exception(exception) do
description = Chef::Formatters::ErrorMapper.run_list_expand_failed(node, exception)
display_error(description)
end
end | [
"def",
"run_list_expand_failed",
"(",
"node",
",",
"exception",
")",
"expecting_exception",
"(",
"exception",
")",
"do",
"description",
"=",
"Chef",
"::",
"Formatters",
"::",
"ErrorMapper",
".",
"run_list_expand_failed",
"(",
"node",
",",
"exception",
")",
"displa... | Error expanding the run list | [
"Error",
"expanding",
"the",
"run",
"list"
] | b7c260d480c3b71a0e61ce46148ec7b9d3f3c40e | https://github.com/chefspec/chefspec/blob/b7c260d480c3b71a0e61ce46148ec7b9d3f3c40e/lib/chefspec/formatter.rb#L50-L55 |
14,565 | chefspec/chefspec | lib/chefspec/formatter.rb | ChefSpec.ChefFormatter.cookbook_resolution_failed | def cookbook_resolution_failed(expanded_run_list, exception)
expecting_exception(exception) do
description = Chef::Formatters::ErrorMapper.cookbook_resolution_failed(expanded_run_list, exception)
display_error(description)
end
end | ruby | def cookbook_resolution_failed(expanded_run_list, exception)
expecting_exception(exception) do
description = Chef::Formatters::ErrorMapper.cookbook_resolution_failed(expanded_run_list, exception)
display_error(description)
end
end | [
"def",
"cookbook_resolution_failed",
"(",
"expanded_run_list",
",",
"exception",
")",
"expecting_exception",
"(",
"exception",
")",
"do",
"description",
"=",
"Chef",
"::",
"Formatters",
"::",
"ErrorMapper",
".",
"cookbook_resolution_failed",
"(",
"expanded_run_list",
",... | Called when there is an error getting the cookbook collection from the
server. | [
"Called",
"when",
"there",
"is",
"an",
"error",
"getting",
"the",
"cookbook",
"collection",
"from",
"the",
"server",
"."
] | b7c260d480c3b71a0e61ce46148ec7b9d3f3c40e | https://github.com/chefspec/chefspec/blob/b7c260d480c3b71a0e61ce46148ec7b9d3f3c40e/lib/chefspec/formatter.rb#L67-L72 |
14,566 | chefspec/chefspec | lib/chefspec/formatter.rb | ChefSpec.ChefFormatter.cookbook_sync_failed | def cookbook_sync_failed(cookbooks, exception)
expecting_exception(exception) do
description = Chef::Formatters::ErrorMapper.cookbook_sync_failed(cookbooks, exception)
display_error(description)
end
end | ruby | def cookbook_sync_failed(cookbooks, exception)
expecting_exception(exception) do
description = Chef::Formatters::ErrorMapper.cookbook_sync_failed(cookbooks, exception)
display_error(description)
end
end | [
"def",
"cookbook_sync_failed",
"(",
"cookbooks",
",",
"exception",
")",
"expecting_exception",
"(",
"exception",
")",
"do",
"description",
"=",
"Chef",
"::",
"Formatters",
"::",
"ErrorMapper",
".",
"cookbook_sync_failed",
"(",
"cookbooks",
",",
"exception",
")",
"... | Called when an error occurs during cookbook sync | [
"Called",
"when",
"an",
"error",
"occurs",
"during",
"cookbook",
"sync"
] | b7c260d480c3b71a0e61ce46148ec7b9d3f3c40e | https://github.com/chefspec/chefspec/blob/b7c260d480c3b71a0e61ce46148ec7b9d3f3c40e/lib/chefspec/formatter.rb#L98-L103 |
14,567 | chefspec/chefspec | lib/chefspec/formatter.rb | ChefSpec.ChefFormatter.recipe_not_found | def recipe_not_found(exception)
expecting_exception(exception) do
description = Chef::Formatters::ErrorMapper.file_load_failed(nil, exception)
display_error(description)
end
end | ruby | def recipe_not_found(exception)
expecting_exception(exception) do
description = Chef::Formatters::ErrorMapper.file_load_failed(nil, exception)
display_error(description)
end
end | [
"def",
"recipe_not_found",
"(",
"exception",
")",
"expecting_exception",
"(",
"exception",
")",
"do",
"description",
"=",
"Chef",
"::",
"Formatters",
"::",
"ErrorMapper",
".",
"file_load_failed",
"(",
"nil",
",",
"exception",
")",
"display_error",
"(",
"descriptio... | Called when a recipe cannot be resolved | [
"Called",
"when",
"a",
"recipe",
"cannot",
"be",
"resolved"
] | b7c260d480c3b71a0e61ce46148ec7b9d3f3c40e | https://github.com/chefspec/chefspec/blob/b7c260d480c3b71a0e61ce46148ec7b9d3f3c40e/lib/chefspec/formatter.rb#L176-L181 |
14,568 | chefspec/chefspec | lib/chefspec/formatter.rb | ChefSpec.ChefFormatter.resource_failed | def resource_failed(resource, action, exception)
expecting_exception(exception) do
description = Chef::Formatters::ErrorMapper.resource_failed(resource, action, exception)
display_error(description)
end
end | ruby | def resource_failed(resource, action, exception)
expecting_exception(exception) do
description = Chef::Formatters::ErrorMapper.resource_failed(resource, action, exception)
display_error(description)
end
end | [
"def",
"resource_failed",
"(",
"resource",
",",
"action",
",",
"exception",
")",
"expecting_exception",
"(",
"exception",
")",
"do",
"description",
"=",
"Chef",
"::",
"Formatters",
"::",
"ErrorMapper",
".",
"resource_failed",
"(",
"resource",
",",
"action",
",",... | Called when a resource fails and will not be retried. | [
"Called",
"when",
"a",
"resource",
"fails",
"and",
"will",
"not",
"be",
"retried",
"."
] | b7c260d480c3b71a0e61ce46148ec7b9d3f3c40e | https://github.com/chefspec/chefspec/blob/b7c260d480c3b71a0e61ce46148ec7b9d3f3c40e/lib/chefspec/formatter.rb#L199-L204 |
14,569 | chefspec/chefspec | lib/chefspec/renderer.rb | ChefSpec.Renderer.content | def content
case resource_name(resource)
when :template
content_from_template(chef_run, resource)
when :file
content_from_file(chef_run, resource)
when :cookbook_file
content_from_cookbook_file(chef_run, resource)
else
nil
end
end | ruby | def content
case resource_name(resource)
when :template
content_from_template(chef_run, resource)
when :file
content_from_file(chef_run, resource)
when :cookbook_file
content_from_cookbook_file(chef_run, resource)
else
nil
end
end | [
"def",
"content",
"case",
"resource_name",
"(",
"resource",
")",
"when",
":template",
"content_from_template",
"(",
"chef_run",
",",
"resource",
")",
"when",
":file",
"content_from_file",
"(",
"chef_run",
",",
"resource",
")",
"when",
":cookbook_file",
"content_from... | Create a new Renderer for the given Chef run and resource.
@param [Chef::Runner] chef_run
the Chef run containing the resources
@param [Chef::Resource] resource
the resource to render content from
The content of the resource (this method delegates to the)
various private rendering methods.
@return [Strin... | [
"Create",
"a",
"new",
"Renderer",
"for",
"the",
"given",
"Chef",
"run",
"and",
"resource",
"."
] | b7c260d480c3b71a0e61ce46148ec7b9d3f3c40e | https://github.com/chefspec/chefspec/blob/b7c260d480c3b71a0e61ce46148ec7b9d3f3c40e/lib/chefspec/renderer.rb#L38-L49 |
14,570 | chefspec/chefspec | lib/chefspec/renderer.rb | ChefSpec.Renderer.content_from_template | def content_from_template(chef_run, template)
cookbook_name = template.cookbook || template.cookbook_name
template_location = cookbook_collection(chef_run.node)[cookbook_name].preferred_filename_on_disk_location(chef_run.node, :templates, template.source)
if Chef::Mixin::Template.const_defined?(:Temp... | ruby | def content_from_template(chef_run, template)
cookbook_name = template.cookbook || template.cookbook_name
template_location = cookbook_collection(chef_run.node)[cookbook_name].preferred_filename_on_disk_location(chef_run.node, :templates, template.source)
if Chef::Mixin::Template.const_defined?(:Temp... | [
"def",
"content_from_template",
"(",
"chef_run",
",",
"template",
")",
"cookbook_name",
"=",
"template",
".",
"cookbook",
"||",
"template",
".",
"cookbook_name",
"template_location",
"=",
"cookbook_collection",
"(",
"chef_run",
".",
"node",
")",
"[",
"cookbook_name"... | Compute the contents of a template using Chef's templating logic.
@param [Chef::RunContext] chef_run
the run context for the node
@param [Chef::Provider::Template] template
the template resource
@return [String] | [
"Compute",
"the",
"contents",
"of",
"a",
"template",
"using",
"Chef",
"s",
"templating",
"logic",
"."
] | b7c260d480c3b71a0e61ce46148ec7b9d3f3c40e | https://github.com/chefspec/chefspec/blob/b7c260d480c3b71a0e61ce46148ec7b9d3f3c40e/lib/chefspec/renderer.rb#L63-L82 |
14,571 | chefspec/chefspec | lib/chefspec/renderer.rb | ChefSpec.Renderer.content_from_cookbook_file | def content_from_cookbook_file(chef_run, cookbook_file)
cookbook_name = cookbook_file.cookbook || cookbook_file.cookbook_name
cookbook = cookbook_collection(chef_run.node)[cookbook_name]
File.read(cookbook.preferred_filename_on_disk_location(chef_run.node, :files, cookbook_file.source))
end | ruby | def content_from_cookbook_file(chef_run, cookbook_file)
cookbook_name = cookbook_file.cookbook || cookbook_file.cookbook_name
cookbook = cookbook_collection(chef_run.node)[cookbook_name]
File.read(cookbook.preferred_filename_on_disk_location(chef_run.node, :files, cookbook_file.source))
end | [
"def",
"content_from_cookbook_file",
"(",
"chef_run",
",",
"cookbook_file",
")",
"cookbook_name",
"=",
"cookbook_file",
".",
"cookbook",
"||",
"cookbook_file",
".",
"cookbook_name",
"cookbook",
"=",
"cookbook_collection",
"(",
"chef_run",
".",
"node",
")",
"[",
"coo... | Get the contents of a cookbook file using Chef.
@param [Chef::RunContext] chef_run
the run context for the node
@param [Chef::Provider::CookbookFile] cookbook_file
the file resource | [
"Get",
"the",
"contents",
"of",
"a",
"cookbook",
"file",
"using",
"Chef",
"."
] | b7c260d480c3b71a0e61ce46148ec7b9d3f3c40e | https://github.com/chefspec/chefspec/blob/b7c260d480c3b71a0e61ce46148ec7b9d3f3c40e/lib/chefspec/renderer.rb#L106-L110 |
14,572 | chefspec/chefspec | lib/chefspec/renderer.rb | ChefSpec.Renderer.cookbook_collection | def cookbook_collection(node)
if chef_run.respond_to?(:run_context)
chef_run.run_context.cookbook_collection # Chef 11.8+
elsif node.respond_to?(:run_context)
node.run_context.cookbook_collection # Chef 11+
else
node.cookbook_collection # Chef 10
end
end | ruby | def cookbook_collection(node)
if chef_run.respond_to?(:run_context)
chef_run.run_context.cookbook_collection # Chef 11.8+
elsif node.respond_to?(:run_context)
node.run_context.cookbook_collection # Chef 11+
else
node.cookbook_collection # Chef 10
end
end | [
"def",
"cookbook_collection",
"(",
"node",
")",
"if",
"chef_run",
".",
"respond_to?",
"(",
":run_context",
")",
"chef_run",
".",
"run_context",
".",
"cookbook_collection",
"# Chef 11.8+",
"elsif",
"node",
".",
"respond_to?",
"(",
":run_context",
")",
"node",
".",
... | The cookbook collection for the current Chef run context. Handles
the differing cases between Chef 10 and Chef 11.
@param [Chef::Node] node
the Chef node to get the cookbook collection from
@return [Array<Chef::Cookbook>] | [
"The",
"cookbook",
"collection",
"for",
"the",
"current",
"Chef",
"run",
"context",
".",
"Handles",
"the",
"differing",
"cases",
"between",
"Chef",
"10",
"and",
"Chef",
"11",
"."
] | b7c260d480c3b71a0e61ce46148ec7b9d3f3c40e | https://github.com/chefspec/chefspec/blob/b7c260d480c3b71a0e61ce46148ec7b9d3f3c40e/lib/chefspec/renderer.rb#L119-L127 |
14,573 | chefspec/chefspec | lib/chefspec/renderer.rb | ChefSpec.Renderer.template_finder | def template_finder(chef_run, cookbook_name)
if Chef::Provider.const_defined?(:TemplateFinder) # Chef 11+
Chef::Provider::TemplateFinder.new(chef_run.run_context, cookbook_name, chef_run.node)
else
nil
end
end | ruby | def template_finder(chef_run, cookbook_name)
if Chef::Provider.const_defined?(:TemplateFinder) # Chef 11+
Chef::Provider::TemplateFinder.new(chef_run.run_context, cookbook_name, chef_run.node)
else
nil
end
end | [
"def",
"template_finder",
"(",
"chef_run",
",",
"cookbook_name",
")",
"if",
"Chef",
"::",
"Provider",
".",
"const_defined?",
"(",
":TemplateFinder",
")",
"# Chef 11+",
"Chef",
"::",
"Provider",
"::",
"TemplateFinder",
".",
"new",
"(",
"chef_run",
".",
"run_conte... | Return a new instance of the TemplateFinder if we are running on Chef 11.
@param [Chef::RunContext] chef_run
the run context for the noe
@param [String] cookbook_name
the name of the cookbook
@return [Chef::Provider::TemplateFinder, nil] | [
"Return",
"a",
"new",
"instance",
"of",
"the",
"TemplateFinder",
"if",
"we",
"are",
"running",
"on",
"Chef",
"11",
"."
] | b7c260d480c3b71a0e61ce46148ec7b9d3f3c40e | https://github.com/chefspec/chefspec/blob/b7c260d480c3b71a0e61ce46148ec7b9d3f3c40e/lib/chefspec/renderer.rb#L137-L143 |
14,574 | simukappu/activity_notification | lib/activity_notification/apis/notification_api.rb | ActivityNotification.NotificationApi.send_notification_email | def send_notification_email(options = {})
if target.notification_email_allowed?(notifiable, key) &&
notifiable.notification_email_allowed?(target, key) &&
email_subscribed?
send_later = options.has_key?(:send_later) ? options[:send_later] : true
send_later ?
@@notificat... | ruby | def send_notification_email(options = {})
if target.notification_email_allowed?(notifiable, key) &&
notifiable.notification_email_allowed?(target, key) &&
email_subscribed?
send_later = options.has_key?(:send_later) ? options[:send_later] : true
send_later ?
@@notificat... | [
"def",
"send_notification_email",
"(",
"options",
"=",
"{",
"}",
")",
"if",
"target",
".",
"notification_email_allowed?",
"(",
"notifiable",
",",
"key",
")",
"&&",
"notifiable",
".",
"notification_email_allowed?",
"(",
"target",
",",
"key",
")",
"&&",
"email_sub... | Sends notification email to the target.
@param [Hash] options Options for notification email
@option options [Boolean] :send_later If it sends notification email asynchronously
@option options [String, Symbol] :fallback (:default) Fallback template to use when MissingTemplate is raised
@return ... | [
"Sends",
"notification",
"email",
"to",
"the",
"target",
"."
] | 7f0f0ea8db1e69d7806f5b0685e226452714847a | https://github.com/simukappu/activity_notification/blob/7f0f0ea8db1e69d7806f5b0685e226452714847a/lib/activity_notification/apis/notification_api.rb#L435-L444 |
14,575 | simukappu/activity_notification | lib/activity_notification/apis/notification_api.rb | ActivityNotification.NotificationApi.publish_to_optional_targets | def publish_to_optional_targets(options = {})
notifiable.optional_targets(target.to_resources_name, key).map { |optional_target|
optional_target_name = optional_target.to_optional_target_name
if optional_target_subscribed?(optional_target_name)
optional_target.notify(self, options[option... | ruby | def publish_to_optional_targets(options = {})
notifiable.optional_targets(target.to_resources_name, key).map { |optional_target|
optional_target_name = optional_target.to_optional_target_name
if optional_target_subscribed?(optional_target_name)
optional_target.notify(self, options[option... | [
"def",
"publish_to_optional_targets",
"(",
"options",
"=",
"{",
"}",
")",
"notifiable",
".",
"optional_targets",
"(",
"target",
".",
"to_resources_name",
",",
"key",
")",
".",
"map",
"{",
"|",
"optional_target",
"|",
"optional_target_name",
"=",
"optional_target",... | Publishes notification to the optional targets.
@param [Hash] options Options for optional targets
@return [Hash] Result of publishing to optional target | [
"Publishes",
"notification",
"to",
"the",
"optional",
"targets",
"."
] | 7f0f0ea8db1e69d7806f5b0685e226452714847a | https://github.com/simukappu/activity_notification/blob/7f0f0ea8db1e69d7806f5b0685e226452714847a/lib/activity_notification/apis/notification_api.rb#L450-L460 |
14,576 | simukappu/activity_notification | lib/activity_notification/apis/notification_api.rb | ActivityNotification.NotificationApi.open! | def open!(options = {})
opened? and return 0
opened_at = options[:opened_at] || Time.current
with_members = options.has_key?(:with_members) ? options[:with_members] : true
unopened_member_count = with_members ? group_members.unopened_only.count : 0
group_members.update_all(opened_at: op... | ruby | def open!(options = {})
opened? and return 0
opened_at = options[:opened_at] || Time.current
with_members = options.has_key?(:with_members) ? options[:with_members] : true
unopened_member_count = with_members ? group_members.unopened_only.count : 0
group_members.update_all(opened_at: op... | [
"def",
"open!",
"(",
"options",
"=",
"{",
"}",
")",
"opened?",
"and",
"return",
"0",
"opened_at",
"=",
"options",
"[",
":opened_at",
"]",
"||",
"Time",
".",
"current",
"with_members",
"=",
"options",
".",
"has_key?",
"(",
":with_members",
")",
"?",
"opti... | Opens the notification.
@param [Hash] options Options for opening notifications
@option options [DateTime] :opened_at (Time.current) Time to set to opened_at of the notification record
@option options [Boolean] :with_members (true) If it opens notifications including group members
@return [Integer] Numbe... | [
"Opens",
"the",
"notification",
"."
] | 7f0f0ea8db1e69d7806f5b0685e226452714847a | https://github.com/simukappu/activity_notification/blob/7f0f0ea8db1e69d7806f5b0685e226452714847a/lib/activity_notification/apis/notification_api.rb#L468-L476 |
14,577 | simukappu/activity_notification | lib/activity_notification/apis/notification_api.rb | ActivityNotification.NotificationApi.group_notifier_count | def group_notifier_count(limit = ActivityNotification.config.opened_index_limit)
notification = group_member? && group_owner.present? ? group_owner : self
notification.notifier.present? ? group_member_notifier_count(limit) + 1 : 0
end | ruby | def group_notifier_count(limit = ActivityNotification.config.opened_index_limit)
notification = group_member? && group_owner.present? ? group_owner : self
notification.notifier.present? ? group_member_notifier_count(limit) + 1 : 0
end | [
"def",
"group_notifier_count",
"(",
"limit",
"=",
"ActivityNotification",
".",
"config",
".",
"opened_index_limit",
")",
"notification",
"=",
"group_member?",
"&&",
"group_owner",
".",
"present?",
"?",
"group_owner",
":",
"self",
"notification",
".",
"notifier",
"."... | Returns count of group member notifiers including group owner notifier.
It always returns 0 if group owner notifier is blank.
This method is designed to cache group by query result to avoid N+1 call.
@param [Integer] limit Limit to query for opened notifications
@return [Integer] Count of group notifications inclu... | [
"Returns",
"count",
"of",
"group",
"member",
"notifiers",
"including",
"group",
"owner",
"notifier",
".",
"It",
"always",
"returns",
"0",
"if",
"group",
"owner",
"notifier",
"is",
"blank",
".",
"This",
"method",
"is",
"designed",
"to",
"cache",
"group",
"by"... | 7f0f0ea8db1e69d7806f5b0685e226452714847a | https://github.com/simukappu/activity_notification/blob/7f0f0ea8db1e69d7806f5b0685e226452714847a/lib/activity_notification/apis/notification_api.rb#L561-L564 |
14,578 | simukappu/activity_notification | lib/activity_notification/apis/notification_api.rb | ActivityNotification.NotificationApi.remove_from_group | def remove_from_group
new_group_owner = group_members.earliest
if new_group_owner.present?
new_group_owner.update(group_owner_id: nil)
group_members.update_all(group_owner_id: new_group_owner.id)
end
new_group_owner
end | ruby | def remove_from_group
new_group_owner = group_members.earliest
if new_group_owner.present?
new_group_owner.update(group_owner_id: nil)
group_members.update_all(group_owner_id: new_group_owner.id)
end
new_group_owner
end | [
"def",
"remove_from_group",
"new_group_owner",
"=",
"group_members",
".",
"earliest",
"if",
"new_group_owner",
".",
"present?",
"new_group_owner",
".",
"update",
"(",
"group_owner_id",
":",
"nil",
")",
"group_members",
".",
"update_all",
"(",
"group_owner_id",
":",
... | Remove from notification group and make a new group owner.
@return [Notificaion] New group owner instance of the notification group | [
"Remove",
"from",
"notification",
"group",
"and",
"make",
"a",
"new",
"group",
"owner",
"."
] | 7f0f0ea8db1e69d7806f5b0685e226452714847a | https://github.com/simukappu/activity_notification/blob/7f0f0ea8db1e69d7806f5b0685e226452714847a/lib/activity_notification/apis/notification_api.rb#L578-L585 |
14,579 | simukappu/activity_notification | lib/activity_notification/apis/notification_api.rb | ActivityNotification.NotificationApi.notifiable_path | def notifiable_path
notifiable.present? or raise ActiveRecord::RecordNotFound.new("Couldn't find notifiable #{notifiable_type}")
notifiable.notifiable_path(target_type, key)
end | ruby | def notifiable_path
notifiable.present? or raise ActiveRecord::RecordNotFound.new("Couldn't find notifiable #{notifiable_type}")
notifiable.notifiable_path(target_type, key)
end | [
"def",
"notifiable_path",
"notifiable",
".",
"present?",
"or",
"raise",
"ActiveRecord",
"::",
"RecordNotFound",
".",
"new",
"(",
"\"Couldn't find notifiable #{notifiable_type}\"",
")",
"notifiable",
".",
"notifiable_path",
"(",
"target_type",
",",
"key",
")",
"end"
] | Returns notifiable_path to move after opening notification with notifiable.notifiable_path.
@return [String] Notifiable path URL to move after opening notification | [
"Returns",
"notifiable_path",
"to",
"move",
"after",
"opening",
"notification",
"with",
"notifiable",
".",
"notifiable_path",
"."
] | 7f0f0ea8db1e69d7806f5b0685e226452714847a | https://github.com/simukappu/activity_notification/blob/7f0f0ea8db1e69d7806f5b0685e226452714847a/lib/activity_notification/apis/notification_api.rb#L590-L593 |
14,580 | simukappu/activity_notification | lib/activity_notification/helpers/view_helpers.rb | ActivityNotification.ViewHelpers.notifications_path_for | def notifications_path_for(target, params = {})
options = params.dup
options.delete(:devise_default_routes) ?
send("#{routing_scope(options)}notifications_path", options) :
send("#{routing_scope(options)}#{target.to_resource_name}_notifications_path", target, options)
end | ruby | def notifications_path_for(target, params = {})
options = params.dup
options.delete(:devise_default_routes) ?
send("#{routing_scope(options)}notifications_path", options) :
send("#{routing_scope(options)}#{target.to_resource_name}_notifications_path", target, options)
end | [
"def",
"notifications_path_for",
"(",
"target",
",",
"params",
"=",
"{",
"}",
")",
"options",
"=",
"params",
".",
"dup",
"options",
".",
"delete",
"(",
":devise_default_routes",
")",
"?",
"send",
"(",
"\"#{routing_scope(options)}notifications_path\"",
",",
"option... | Returns notifications_path for the target
@param [Object] target Target instance
@param [Hash] params Request parameters
@return [String] notifications_path for the target
@todo Needs any other better implementation
@todo Must handle devise namespace | [
"Returns",
"notifications_path",
"for",
"the",
"target"
] | 7f0f0ea8db1e69d7806f5b0685e226452714847a | https://github.com/simukappu/activity_notification/blob/7f0f0ea8db1e69d7806f5b0685e226452714847a/lib/activity_notification/helpers/view_helpers.rb#L81-L86 |
14,581 | simukappu/activity_notification | lib/activity_notification/helpers/view_helpers.rb | ActivityNotification.ViewHelpers.notification_path_for | def notification_path_for(notification, params = {})
options = params.dup
options.delete(:devise_default_routes) ?
send("#{routing_scope(options)}notification_path", notification, options) :
send("#{routing_scope(options)}#{notification.target.to_resource_name}_notification_path", notificati... | ruby | def notification_path_for(notification, params = {})
options = params.dup
options.delete(:devise_default_routes) ?
send("#{routing_scope(options)}notification_path", notification, options) :
send("#{routing_scope(options)}#{notification.target.to_resource_name}_notification_path", notificati... | [
"def",
"notification_path_for",
"(",
"notification",
",",
"params",
"=",
"{",
"}",
")",
"options",
"=",
"params",
".",
"dup",
"options",
".",
"delete",
"(",
":devise_default_routes",
")",
"?",
"send",
"(",
"\"#{routing_scope(options)}notification_path\"",
",",
"no... | Returns notification_path for the notification
@param [Notification] notification Notification instance
@param [Hash] params Request parameters
@return [String] notification_path for the notification
@todo Needs any other better implementation
@todo Must handle devise namespace | [
"Returns",
"notification_path",
"for",
"the",
"notification"
] | 7f0f0ea8db1e69d7806f5b0685e226452714847a | https://github.com/simukappu/activity_notification/blob/7f0f0ea8db1e69d7806f5b0685e226452714847a/lib/activity_notification/helpers/view_helpers.rb#L95-L100 |
14,582 | simukappu/activity_notification | lib/activity_notification/helpers/view_helpers.rb | ActivityNotification.ViewHelpers.move_notification_path_for | def move_notification_path_for(notification, params = {})
options = params.dup
options.delete(:devise_default_routes) ?
send("move_#{routing_scope(options)}notification_path", notification, options) :
send("move_#{routing_scope(options)}#{notification.target.to_resource_name}_notification_pa... | ruby | def move_notification_path_for(notification, params = {})
options = params.dup
options.delete(:devise_default_routes) ?
send("move_#{routing_scope(options)}notification_path", notification, options) :
send("move_#{routing_scope(options)}#{notification.target.to_resource_name}_notification_pa... | [
"def",
"move_notification_path_for",
"(",
"notification",
",",
"params",
"=",
"{",
"}",
")",
"options",
"=",
"params",
".",
"dup",
"options",
".",
"delete",
"(",
":devise_default_routes",
")",
"?",
"send",
"(",
"\"move_#{routing_scope(options)}notification_path\"",
... | Returns move_notification_path for the target of specified notification
@param [Notification] notification Notification instance
@param [Hash] params Request parameters
@return [String] move_notification_path for the target
@todo Needs any other better implementation
@todo Must handle devise namespace | [
"Returns",
"move_notification_path",
"for",
"the",
"target",
"of",
"specified",
"notification"
] | 7f0f0ea8db1e69d7806f5b0685e226452714847a | https://github.com/simukappu/activity_notification/blob/7f0f0ea8db1e69d7806f5b0685e226452714847a/lib/activity_notification/helpers/view_helpers.rb#L109-L114 |
14,583 | simukappu/activity_notification | lib/activity_notification/helpers/view_helpers.rb | ActivityNotification.ViewHelpers.open_notification_path_for | def open_notification_path_for(notification, params = {})
options = params.dup
options.delete(:devise_default_routes) ?
send("open_#{routing_scope(options)}notification_path", notification, options) :
send("open_#{routing_scope(options)}#{notification.target.to_resource_name}_notification_pa... | ruby | def open_notification_path_for(notification, params = {})
options = params.dup
options.delete(:devise_default_routes) ?
send("open_#{routing_scope(options)}notification_path", notification, options) :
send("open_#{routing_scope(options)}#{notification.target.to_resource_name}_notification_pa... | [
"def",
"open_notification_path_for",
"(",
"notification",
",",
"params",
"=",
"{",
"}",
")",
"options",
"=",
"params",
".",
"dup",
"options",
".",
"delete",
"(",
":devise_default_routes",
")",
"?",
"send",
"(",
"\"open_#{routing_scope(options)}notification_path\"",
... | Returns open_notification_path for the target of specified notification
@param [Notification] notification Notification instance
@param [Hash] params Request parameters
@return [String] open_notification_path for the target
@todo Needs any other better implementation
@todo Must handle devise namespace | [
"Returns",
"open_notification_path",
"for",
"the",
"target",
"of",
"specified",
"notification"
] | 7f0f0ea8db1e69d7806f5b0685e226452714847a | https://github.com/simukappu/activity_notification/blob/7f0f0ea8db1e69d7806f5b0685e226452714847a/lib/activity_notification/helpers/view_helpers.rb#L123-L128 |
14,584 | simukappu/activity_notification | lib/activity_notification/helpers/view_helpers.rb | ActivityNotification.ViewHelpers.open_all_notifications_path_for | def open_all_notifications_path_for(target, params = {})
options = params.dup
options.delete(:devise_default_routes) ?
send("open_all_#{routing_scope(options)}notifications_path", options) :
send("open_all_#{routing_scope(options)}#{target.to_resource_name}_notifications_path", target, optio... | ruby | def open_all_notifications_path_for(target, params = {})
options = params.dup
options.delete(:devise_default_routes) ?
send("open_all_#{routing_scope(options)}notifications_path", options) :
send("open_all_#{routing_scope(options)}#{target.to_resource_name}_notifications_path", target, optio... | [
"def",
"open_all_notifications_path_for",
"(",
"target",
",",
"params",
"=",
"{",
"}",
")",
"options",
"=",
"params",
".",
"dup",
"options",
".",
"delete",
"(",
":devise_default_routes",
")",
"?",
"send",
"(",
"\"open_all_#{routing_scope(options)}notifications_path\""... | Returns open_all_notifications_path for the target
@param [Object] target Target instance
@param [Hash] params Request parameters
@return [String] open_all_notifications_path for the target
@todo Needs any other better implementation
@todo Must handle devise namespace | [
"Returns",
"open_all_notifications_path",
"for",
"the",
"target"
] | 7f0f0ea8db1e69d7806f5b0685e226452714847a | https://github.com/simukappu/activity_notification/blob/7f0f0ea8db1e69d7806f5b0685e226452714847a/lib/activity_notification/helpers/view_helpers.rb#L137-L142 |
14,585 | simukappu/activity_notification | lib/activity_notification/helpers/view_helpers.rb | ActivityNotification.ViewHelpers.notifications_url_for | def notifications_url_for(target, params = {})
options = params.dup
options.delete(:devise_default_routes) ?
send("#{routing_scope(options)}notifications_url", options) :
send("#{routing_scope(options)}#{target.to_resource_name}_notifications_url", target, options)
end | ruby | def notifications_url_for(target, params = {})
options = params.dup
options.delete(:devise_default_routes) ?
send("#{routing_scope(options)}notifications_url", options) :
send("#{routing_scope(options)}#{target.to_resource_name}_notifications_url", target, options)
end | [
"def",
"notifications_url_for",
"(",
"target",
",",
"params",
"=",
"{",
"}",
")",
"options",
"=",
"params",
".",
"dup",
"options",
".",
"delete",
"(",
":devise_default_routes",
")",
"?",
"send",
"(",
"\"#{routing_scope(options)}notifications_url\"",
",",
"options"... | Returns notifications_url for the target
@param [Object] target Target instance
@param [Hash] params Request parameters
@return [String] notifications_url for the target
@todo Needs any other better implementation
@todo Must handle devise namespace | [
"Returns",
"notifications_url",
"for",
"the",
"target"
] | 7f0f0ea8db1e69d7806f5b0685e226452714847a | https://github.com/simukappu/activity_notification/blob/7f0f0ea8db1e69d7806f5b0685e226452714847a/lib/activity_notification/helpers/view_helpers.rb#L151-L156 |
14,586 | simukappu/activity_notification | lib/activity_notification/helpers/view_helpers.rb | ActivityNotification.ViewHelpers.notification_url_for | def notification_url_for(notification, params = {})
options = params.dup
options.delete(:devise_default_routes) ?
send("#{routing_scope(options)}notification_url", notification, options) :
send("#{routing_scope(options)}#{notification.target.to_resource_name}_notification_url", notification.... | ruby | def notification_url_for(notification, params = {})
options = params.dup
options.delete(:devise_default_routes) ?
send("#{routing_scope(options)}notification_url", notification, options) :
send("#{routing_scope(options)}#{notification.target.to_resource_name}_notification_url", notification.... | [
"def",
"notification_url_for",
"(",
"notification",
",",
"params",
"=",
"{",
"}",
")",
"options",
"=",
"params",
".",
"dup",
"options",
".",
"delete",
"(",
":devise_default_routes",
")",
"?",
"send",
"(",
"\"#{routing_scope(options)}notification_url\"",
",",
"noti... | Returns notification_url for the target of specified notification
@param [Notification] notification Notification instance
@param [Hash] params Request parameters
@return [String] notification_url for the target
@todo Needs any other better implementation
@todo Must handle devise namespace | [
"Returns",
"notification_url",
"for",
"the",
"target",
"of",
"specified",
"notification"
] | 7f0f0ea8db1e69d7806f5b0685e226452714847a | https://github.com/simukappu/activity_notification/blob/7f0f0ea8db1e69d7806f5b0685e226452714847a/lib/activity_notification/helpers/view_helpers.rb#L165-L170 |
14,587 | simukappu/activity_notification | lib/activity_notification/helpers/view_helpers.rb | ActivityNotification.ViewHelpers.move_notification_url_for | def move_notification_url_for(notification, params = {})
options = params.dup
options.delete(:devise_default_routes) ?
send("move_#{routing_scope(options)}notification_url", notification, options) :
send("move_#{routing_scope(options)}#{notification.target.to_resource_name}_notification_url"... | ruby | def move_notification_url_for(notification, params = {})
options = params.dup
options.delete(:devise_default_routes) ?
send("move_#{routing_scope(options)}notification_url", notification, options) :
send("move_#{routing_scope(options)}#{notification.target.to_resource_name}_notification_url"... | [
"def",
"move_notification_url_for",
"(",
"notification",
",",
"params",
"=",
"{",
"}",
")",
"options",
"=",
"params",
".",
"dup",
"options",
".",
"delete",
"(",
":devise_default_routes",
")",
"?",
"send",
"(",
"\"move_#{routing_scope(options)}notification_url\"",
",... | Returns move_notification_url for the target of specified notification
@param [Notification] notification Notification instance
@param [Hash] params Request parameters
@return [String] move_notification_url for the target
@todo Needs any other better implementation
@todo Must handle devise namespace | [
"Returns",
"move_notification_url",
"for",
"the",
"target",
"of",
"specified",
"notification"
] | 7f0f0ea8db1e69d7806f5b0685e226452714847a | https://github.com/simukappu/activity_notification/blob/7f0f0ea8db1e69d7806f5b0685e226452714847a/lib/activity_notification/helpers/view_helpers.rb#L179-L184 |
14,588 | simukappu/activity_notification | lib/activity_notification/helpers/view_helpers.rb | ActivityNotification.ViewHelpers.open_notification_url_for | def open_notification_url_for(notification, params = {})
options = params.dup
options.delete(:devise_default_routes) ?
send("open_#{routing_scope(options)}notification_url", notification, options) :
send("open_#{routing_scope(options)}#{notification.target.to_resource_name}_notification_url"... | ruby | def open_notification_url_for(notification, params = {})
options = params.dup
options.delete(:devise_default_routes) ?
send("open_#{routing_scope(options)}notification_url", notification, options) :
send("open_#{routing_scope(options)}#{notification.target.to_resource_name}_notification_url"... | [
"def",
"open_notification_url_for",
"(",
"notification",
",",
"params",
"=",
"{",
"}",
")",
"options",
"=",
"params",
".",
"dup",
"options",
".",
"delete",
"(",
":devise_default_routes",
")",
"?",
"send",
"(",
"\"open_#{routing_scope(options)}notification_url\"",
",... | Returns open_notification_url for the target of specified notification
@param [Notification] notification Notification instance
@param [Hash] params Request parameters
@return [String] open_notification_url for the target
@todo Needs any other better implementation
@todo Must handle devise namespace | [
"Returns",
"open_notification_url",
"for",
"the",
"target",
"of",
"specified",
"notification"
] | 7f0f0ea8db1e69d7806f5b0685e226452714847a | https://github.com/simukappu/activity_notification/blob/7f0f0ea8db1e69d7806f5b0685e226452714847a/lib/activity_notification/helpers/view_helpers.rb#L193-L198 |
14,589 | simukappu/activity_notification | lib/activity_notification/helpers/view_helpers.rb | ActivityNotification.ViewHelpers.open_all_notifications_url_for | def open_all_notifications_url_for(target, params = {})
options = params.dup
options.delete(:devise_default_routes) ?
send("open_all_#{routing_scope(options)}notifications_url", options) :
send("open_all_#{routing_scope(options)}#{target.to_resource_name}_notifications_url", target, options)... | ruby | def open_all_notifications_url_for(target, params = {})
options = params.dup
options.delete(:devise_default_routes) ?
send("open_all_#{routing_scope(options)}notifications_url", options) :
send("open_all_#{routing_scope(options)}#{target.to_resource_name}_notifications_url", target, options)... | [
"def",
"open_all_notifications_url_for",
"(",
"target",
",",
"params",
"=",
"{",
"}",
")",
"options",
"=",
"params",
".",
"dup",
"options",
".",
"delete",
"(",
":devise_default_routes",
")",
"?",
"send",
"(",
"\"open_all_#{routing_scope(options)}notifications_url\"",
... | Returns open_all_notifications_url for the target of specified notification
@param [Target] target Target instance
@param [Hash] params Request parameters
@return [String] open_all_notifications_url for the target
@todo Needs any other better implementation
@todo Must handle devise namespace | [
"Returns",
"open_all_notifications_url",
"for",
"the",
"target",
"of",
"specified",
"notification"
] | 7f0f0ea8db1e69d7806f5b0685e226452714847a | https://github.com/simukappu/activity_notification/blob/7f0f0ea8db1e69d7806f5b0685e226452714847a/lib/activity_notification/helpers/view_helpers.rb#L207-L212 |
14,590 | simukappu/activity_notification | lib/activity_notification/helpers/view_helpers.rb | ActivityNotification.ViewHelpers.subscriptions_path_for | def subscriptions_path_for(target, params = {})
options = params.dup
options.delete(:devise_default_routes) ?
send("#{routing_scope(options)}subscriptions_path", options) :
send("#{routing_scope(options)}#{target.to_resource_name}_subscriptions_path", target, options)
end | ruby | def subscriptions_path_for(target, params = {})
options = params.dup
options.delete(:devise_default_routes) ?
send("#{routing_scope(options)}subscriptions_path", options) :
send("#{routing_scope(options)}#{target.to_resource_name}_subscriptions_path", target, options)
end | [
"def",
"subscriptions_path_for",
"(",
"target",
",",
"params",
"=",
"{",
"}",
")",
"options",
"=",
"params",
".",
"dup",
"options",
".",
"delete",
"(",
":devise_default_routes",
")",
"?",
"send",
"(",
"\"#{routing_scope(options)}subscriptions_path\"",
",",
"option... | Returns subscriptions_path for the target
@param [Object] target Target instance
@param [Hash] params Request parameters
@return [String] subscriptions_path for the target
@todo Needs any other better implementation | [
"Returns",
"subscriptions_path",
"for",
"the",
"target"
] | 7f0f0ea8db1e69d7806f5b0685e226452714847a | https://github.com/simukappu/activity_notification/blob/7f0f0ea8db1e69d7806f5b0685e226452714847a/lib/activity_notification/helpers/view_helpers.rb#L220-L225 |
14,591 | simukappu/activity_notification | lib/activity_notification/helpers/view_helpers.rb | ActivityNotification.ViewHelpers.subscription_path_for | def subscription_path_for(subscription, params = {})
options = params.dup
options.delete(:devise_default_routes) ?
send("#{routing_scope(options)}subscription_path", subscription, options) :
send("#{routing_scope(options)}#{subscription.target.to_resource_name}_subscription_path", subscripti... | ruby | def subscription_path_for(subscription, params = {})
options = params.dup
options.delete(:devise_default_routes) ?
send("#{routing_scope(options)}subscription_path", subscription, options) :
send("#{routing_scope(options)}#{subscription.target.to_resource_name}_subscription_path", subscripti... | [
"def",
"subscription_path_for",
"(",
"subscription",
",",
"params",
"=",
"{",
"}",
")",
"options",
"=",
"params",
".",
"dup",
"options",
".",
"delete",
"(",
":devise_default_routes",
")",
"?",
"send",
"(",
"\"#{routing_scope(options)}subscription_path\"",
",",
"su... | Returns subscription_path for the subscription
@param [Subscription] subscription Subscription instance
@param [Hash] params Request parameters
@return [String] subscription_path for the subscription
@todo Needs any other better implementation | [
"Returns",
"subscription_path",
"for",
"the",
"subscription"
] | 7f0f0ea8db1e69d7806f5b0685e226452714847a | https://github.com/simukappu/activity_notification/blob/7f0f0ea8db1e69d7806f5b0685e226452714847a/lib/activity_notification/helpers/view_helpers.rb#L233-L238 |
14,592 | simukappu/activity_notification | lib/activity_notification/helpers/view_helpers.rb | ActivityNotification.ViewHelpers.subscribe_subscription_path_for | def subscribe_subscription_path_for(subscription, params = {})
options = params.dup
options.delete(:devise_default_routes) ?
send("subscribe_#{routing_scope(options)}subscription_path", subscription, options) :
send("subscribe_#{routing_scope(options)}#{subscription.target.to_resource_name}_... | ruby | def subscribe_subscription_path_for(subscription, params = {})
options = params.dup
options.delete(:devise_default_routes) ?
send("subscribe_#{routing_scope(options)}subscription_path", subscription, options) :
send("subscribe_#{routing_scope(options)}#{subscription.target.to_resource_name}_... | [
"def",
"subscribe_subscription_path_for",
"(",
"subscription",
",",
"params",
"=",
"{",
"}",
")",
"options",
"=",
"params",
".",
"dup",
"options",
".",
"delete",
"(",
":devise_default_routes",
")",
"?",
"send",
"(",
"\"subscribe_#{routing_scope(options)}subscription_p... | Returns subscribe_subscription_path for the target of specified subscription
@param [Subscription] subscription Subscription instance
@param [Hash] params Request parameters
@return [String] subscription_path for the subscription
@todo Needs any other better implementation | [
"Returns",
"subscribe_subscription_path",
"for",
"the",
"target",
"of",
"specified",
"subscription"
] | 7f0f0ea8db1e69d7806f5b0685e226452714847a | https://github.com/simukappu/activity_notification/blob/7f0f0ea8db1e69d7806f5b0685e226452714847a/lib/activity_notification/helpers/view_helpers.rb#L246-L251 |
14,593 | simukappu/activity_notification | lib/activity_notification/helpers/view_helpers.rb | ActivityNotification.ViewHelpers.unsubscribe_subscription_path_for | def unsubscribe_subscription_path_for(subscription, params = {})
options = params.dup
options.delete(:devise_default_routes) ?
send("unsubscribe_#{routing_scope(options)}subscription_path", subscription, options) :
send("unsubscribe_#{routing_scope(options)}#{subscription.target.to_resource_... | ruby | def unsubscribe_subscription_path_for(subscription, params = {})
options = params.dup
options.delete(:devise_default_routes) ?
send("unsubscribe_#{routing_scope(options)}subscription_path", subscription, options) :
send("unsubscribe_#{routing_scope(options)}#{subscription.target.to_resource_... | [
"def",
"unsubscribe_subscription_path_for",
"(",
"subscription",
",",
"params",
"=",
"{",
"}",
")",
"options",
"=",
"params",
".",
"dup",
"options",
".",
"delete",
"(",
":devise_default_routes",
")",
"?",
"send",
"(",
"\"unsubscribe_#{routing_scope(options)}subscripti... | Returns unsubscribe_subscription_path for the target of specified subscription
@param [Subscription] subscription Subscription instance
@param [Hash] params Request parameters
@return [String] subscription_path for the subscription
@todo Needs any other better implementation | [
"Returns",
"unsubscribe_subscription_path",
"for",
"the",
"target",
"of",
"specified",
"subscription"
] | 7f0f0ea8db1e69d7806f5b0685e226452714847a | https://github.com/simukappu/activity_notification/blob/7f0f0ea8db1e69d7806f5b0685e226452714847a/lib/activity_notification/helpers/view_helpers.rb#L260-L265 |
14,594 | simukappu/activity_notification | lib/activity_notification/helpers/view_helpers.rb | ActivityNotification.ViewHelpers.subscribe_to_email_subscription_path_for | def subscribe_to_email_subscription_path_for(subscription, params = {})
options = params.dup
options.delete(:devise_default_routes) ?
send("subscribe_to_email_#{routing_scope(options)}subscription_path", subscription, options) :
send("subscribe_to_email_#{routing_scope(options)}#{subscriptio... | ruby | def subscribe_to_email_subscription_path_for(subscription, params = {})
options = params.dup
options.delete(:devise_default_routes) ?
send("subscribe_to_email_#{routing_scope(options)}subscription_path", subscription, options) :
send("subscribe_to_email_#{routing_scope(options)}#{subscriptio... | [
"def",
"subscribe_to_email_subscription_path_for",
"(",
"subscription",
",",
"params",
"=",
"{",
"}",
")",
"options",
"=",
"params",
".",
"dup",
"options",
".",
"delete",
"(",
":devise_default_routes",
")",
"?",
"send",
"(",
"\"subscribe_to_email_#{routing_scope(optio... | Returns subscribe_to_email_subscription_path for the target of specified subscription
@param [Subscription] subscription Subscription instance
@param [Hash] params Request parameters
@return [String] subscription_path for the subscription
@todo Needs any other better implementation | [
"Returns",
"subscribe_to_email_subscription_path",
"for",
"the",
"target",
"of",
"specified",
"subscription"
] | 7f0f0ea8db1e69d7806f5b0685e226452714847a | https://github.com/simukappu/activity_notification/blob/7f0f0ea8db1e69d7806f5b0685e226452714847a/lib/activity_notification/helpers/view_helpers.rb#L274-L279 |
14,595 | simukappu/activity_notification | lib/activity_notification/helpers/view_helpers.rb | ActivityNotification.ViewHelpers.unsubscribe_to_email_subscription_path_for | def unsubscribe_to_email_subscription_path_for(subscription, params = {})
options = params.dup
options.delete(:devise_default_routes) ?
send("unsubscribe_to_email_#{routing_scope(options)}subscription_path", subscription, options) :
send("unsubscribe_to_email_#{routing_scope(options)}#{subsc... | ruby | def unsubscribe_to_email_subscription_path_for(subscription, params = {})
options = params.dup
options.delete(:devise_default_routes) ?
send("unsubscribe_to_email_#{routing_scope(options)}subscription_path", subscription, options) :
send("unsubscribe_to_email_#{routing_scope(options)}#{subsc... | [
"def",
"unsubscribe_to_email_subscription_path_for",
"(",
"subscription",
",",
"params",
"=",
"{",
"}",
")",
"options",
"=",
"params",
".",
"dup",
"options",
".",
"delete",
"(",
":devise_default_routes",
")",
"?",
"send",
"(",
"\"unsubscribe_to_email_#{routing_scope(o... | Returns unsubscribe_to_email_subscription_path for the target of specified subscription
@param [Subscription] subscription Subscription instance
@param [Hash] params Request parameters
@return [String] subscription_path for the subscription
@todo Needs any other better implementation | [
"Returns",
"unsubscribe_to_email_subscription_path",
"for",
"the",
"target",
"of",
"specified",
"subscription"
] | 7f0f0ea8db1e69d7806f5b0685e226452714847a | https://github.com/simukappu/activity_notification/blob/7f0f0ea8db1e69d7806f5b0685e226452714847a/lib/activity_notification/helpers/view_helpers.rb#L288-L293 |
14,596 | simukappu/activity_notification | lib/activity_notification/helpers/view_helpers.rb | ActivityNotification.ViewHelpers.subscribe_to_optional_target_subscription_path_for | def subscribe_to_optional_target_subscription_path_for(subscription, params = {})
options = params.dup
options.delete(:devise_default_routes) ?
send("subscribe_to_optional_target_#{routing_scope(options)}subscription_path", subscription, options) :
send("subscribe_to_optional_target_#{routin... | ruby | def subscribe_to_optional_target_subscription_path_for(subscription, params = {})
options = params.dup
options.delete(:devise_default_routes) ?
send("subscribe_to_optional_target_#{routing_scope(options)}subscription_path", subscription, options) :
send("subscribe_to_optional_target_#{routin... | [
"def",
"subscribe_to_optional_target_subscription_path_for",
"(",
"subscription",
",",
"params",
"=",
"{",
"}",
")",
"options",
"=",
"params",
".",
"dup",
"options",
".",
"delete",
"(",
":devise_default_routes",
")",
"?",
"send",
"(",
"\"subscribe_to_optional_target_#... | Returns subscribe_to_optional_target_subscription_path for the target of specified subscription
@param [Subscription] subscription Subscription instance
@param [Hash] params Request parameters
@return [String] subscription_path for the subscription
@todo Needs any other better implementation | [
"Returns",
"subscribe_to_optional_target_subscription_path",
"for",
"the",
"target",
"of",
"specified",
"subscription"
] | 7f0f0ea8db1e69d7806f5b0685e226452714847a | https://github.com/simukappu/activity_notification/blob/7f0f0ea8db1e69d7806f5b0685e226452714847a/lib/activity_notification/helpers/view_helpers.rb#L302-L307 |
14,597 | simukappu/activity_notification | lib/activity_notification/helpers/view_helpers.rb | ActivityNotification.ViewHelpers.unsubscribe_to_optional_target_subscription_path_for | def unsubscribe_to_optional_target_subscription_path_for(subscription, params = {})
options = params.dup
options.delete(:devise_default_routes) ?
send("unsubscribe_to_optional_target_#{routing_scope(options)}subscription_path", subscription, options) :
send("unsubscribe_to_optional_target_#{... | ruby | def unsubscribe_to_optional_target_subscription_path_for(subscription, params = {})
options = params.dup
options.delete(:devise_default_routes) ?
send("unsubscribe_to_optional_target_#{routing_scope(options)}subscription_path", subscription, options) :
send("unsubscribe_to_optional_target_#{... | [
"def",
"unsubscribe_to_optional_target_subscription_path_for",
"(",
"subscription",
",",
"params",
"=",
"{",
"}",
")",
"options",
"=",
"params",
".",
"dup",
"options",
".",
"delete",
"(",
":devise_default_routes",
")",
"?",
"send",
"(",
"\"unsubscribe_to_optional_targ... | Returns unsubscribe_to_optional_target_subscription_path for the target of specified subscription
@param [Subscription] subscription Subscription instance
@param [Hash] params Request parameters
@return [String] subscription_path for the subscription
@todo Needs any other better implementation | [
"Returns",
"unsubscribe_to_optional_target_subscription_path",
"for",
"the",
"target",
"of",
"specified",
"subscription"
] | 7f0f0ea8db1e69d7806f5b0685e226452714847a | https://github.com/simukappu/activity_notification/blob/7f0f0ea8db1e69d7806f5b0685e226452714847a/lib/activity_notification/helpers/view_helpers.rb#L316-L321 |
14,598 | simukappu/activity_notification | lib/activity_notification/helpers/view_helpers.rb | ActivityNotification.ViewHelpers.subscriptions_url_for | def subscriptions_url_for(target, params = {})
options = params.dup
options.delete(:devise_default_routes) ?
send("#{routing_scope(options)}subscriptions_url", options) :
send("#{routing_scope(options)}#{target.to_resource_name}_subscriptions_url", target, options)
end | ruby | def subscriptions_url_for(target, params = {})
options = params.dup
options.delete(:devise_default_routes) ?
send("#{routing_scope(options)}subscriptions_url", options) :
send("#{routing_scope(options)}#{target.to_resource_name}_subscriptions_url", target, options)
end | [
"def",
"subscriptions_url_for",
"(",
"target",
",",
"params",
"=",
"{",
"}",
")",
"options",
"=",
"params",
".",
"dup",
"options",
".",
"delete",
"(",
":devise_default_routes",
")",
"?",
"send",
"(",
"\"#{routing_scope(options)}subscriptions_url\"",
",",
"options"... | Returns subscriptions_url for the target
@param [Object] target Target instance
@param [Hash] params Request parameters
@return [String] subscriptions_url for the target
@todo Needs any other better implementation | [
"Returns",
"subscriptions_url",
"for",
"the",
"target"
] | 7f0f0ea8db1e69d7806f5b0685e226452714847a | https://github.com/simukappu/activity_notification/blob/7f0f0ea8db1e69d7806f5b0685e226452714847a/lib/activity_notification/helpers/view_helpers.rb#L330-L335 |
14,599 | simukappu/activity_notification | lib/activity_notification/helpers/view_helpers.rb | ActivityNotification.ViewHelpers.subscription_url_for | def subscription_url_for(subscription, params = {})
options = params.dup
options.delete(:devise_default_routes) ?
send("#{routing_scope(options)}subscription_url", subscription, options) :
send("#{routing_scope(options)}#{subscription.target.to_resource_name}_subscription_url", subscription.... | ruby | def subscription_url_for(subscription, params = {})
options = params.dup
options.delete(:devise_default_routes) ?
send("#{routing_scope(options)}subscription_url", subscription, options) :
send("#{routing_scope(options)}#{subscription.target.to_resource_name}_subscription_url", subscription.... | [
"def",
"subscription_url_for",
"(",
"subscription",
",",
"params",
"=",
"{",
"}",
")",
"options",
"=",
"params",
".",
"dup",
"options",
".",
"delete",
"(",
":devise_default_routes",
")",
"?",
"send",
"(",
"\"#{routing_scope(options)}subscription_url\"",
",",
"subs... | Returns subscription_url for the subscription
@param [Subscription] subscription Subscription instance
@param [Hash] params Request parameters
@return [String] subscription_url for the subscription
@todo Needs any other better implementation | [
"Returns",
"subscription_url",
"for",
"the",
"subscription"
] | 7f0f0ea8db1e69d7806f5b0685e226452714847a | https://github.com/simukappu/activity_notification/blob/7f0f0ea8db1e69d7806f5b0685e226452714847a/lib/activity_notification/helpers/view_helpers.rb#L343-L348 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.