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 |
---|---|---|---|---|---|---|
Return the preferred language for literal value selection for term fetch. Only applies if the authority provides language encoded literals. | def term_language
return @term_language unless @term_language.nil?
lang = Config.config_value(term_config, :language)
return nil if lang.nil?
lang = [lang] if lang.is_a? String
@term_language = lang.collect(&:to_sym)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def language (value = nil)\n\t\tif value\n\t\t\traise_if_error C.glyr_opt_lang(to_native, value)\n\t\telse\n\t\t\tto_native[:lang]\n\t\tend\n\tend",
"def select_language\n I18n.backend.send(:init_translations) unless I18n.backend.initialized?\n lang = PatientHelper.languages(primary_language)&.dig(:code)&.to_sym || :en\n lang = :en unless %i[en es es-PR so fr].include?(lang)\n lang\n end",
"def language\n if ladnn?\n ['zxx'] # MARC code for 'No linguistic content'\n else\n # If it's populated, DLCS uses MARC IDs, not labels, so we don't need to map like w/ resource_type\n map_field(:language)\n end\n end",
"def display_language\n default = I18n.locale.try {|l| l.to_s.gsub(/\\-.*$/, '')} || \"en\"\n\n this_doc = self.language_obj.try(:iso_639_1)\n\n return nil if this_doc == default\n\n self.language_str\n end",
"def language_code\n self[:language_code] || (self.person ? self.person.default_language : Utility.language_code)\n end",
"def language_code\n self[:language_code] || (self.person ? self.person.default_language : Utility.language_code)\n end",
"def language_code\n self[:language_code] || (self.person ? self.person.default_language : Utility.language_code)\n end",
"def language_for_code(code)\n # ISO_639 maps -1 and -2. LanguageList maps -3.\n ISO_639.find(code)&.english_name || LanguageList::LanguageInfo.find(code)&.name\n end",
"def get_language_from_code code\n ISO_639.find(code).english_name if not(code.nil?)\n end",
"def language\n case \n when self.ENU || self.ENG then \"ENG\"\n when self.SPM || self.SPE then \"SPE\"\n when self.FRC || self.FRF then \"FRF\"\n when self.ITI then \"ITI\"\n when self.DUN then \"DUN\"\n when self.GED then \"GED\"\n end\n end",
"def language\n fetch('nation.language')\n end",
"def language #:nodoc\n return '' if read_attribute(:language).nil?\n read_attribute(:language).to_sym\n end",
"def language\n return 'en' if code == \"ind2:0\"\n \n return 'se' if code == \"ind2:4\"\n\n return nil\n end",
"def compute_effective_locale\n # Priority order:\n # 1.query parameter 'lang'\n # 2.cookie 'lang'\n # 3.browser setting\n requested_lang = params[:lang] || cookies[:lang]\n if self.offered_locales.include? requested_lang\n yield requested_lang if block_given?\n return requested_lang\n end\n\n parse_and_match_accept_language || 'en'\n end",
"def preferred_language_from(locales)\n (accepted_languages & locales).first\n end",
"def org_language(item:)\n dflt = I18n.default_locale || 'en'\n return dflt unless item.present?\n\n labels = item.fetch('labels', [{ iso639: dflt }])\n labels.first&.fetch('iso639', I18n.default_locale) || dflt\n end",
"def display_language(val)\n lang = LanguageList::LanguageInfo.find(val)\n lang ? lang.name : val\n end",
"def negotiate_language\n host = request.env['HTTP_X_FORWARDED_HOST'] || request.env['HTTP_HOST'] || \"www.omdb.org\"\n if !local_request? and host.split(\":\").first.split(\".\").first != \"www\"\n lang = host.split(\":\").first.split('.').first\n elsif request.env['HTTP_ACCEPT_LANGUAGE'].to_s.blank?\n lang = 'en'\n else\n lang = request.env['HTTP_ACCEPT_LANGUAGE'].split(',')[0]\n lang = lang.split('-')[0] if lang =~ /-/\n end\n # fall back to english if the language is currently not supported\n if not LOCALES.keys.include?( lang )\n lang = 'en'\n end\n # :TODO: This might throw a RecordNotFound Exception, but we'll\n # deal with that later on. currently its nice to see if a language\n # is not supported.\n Globalize::Language.find_by_iso_639_1(lang)\n end",
"def language\n read_attribute(:language) || Language::MULTIPLE_LANGUAGES\n end",
"def language_of_text\n @descriptive_detail.language_of_text || @default_language_of_text\n end",
"def get_lang_from_headers\n\t\t\t@env['HTTP_ACCEPT_LANGUAGE'].to_s[0, 2]\n\t\tend",
"def language\n \tread_attribute(:language) || Language::MULTIPLE_LANGUAGES\n\tend",
"def language\n fetch('dnd.languages')\n end",
"def iso_639\n iso_639_1 || iso_639_2t || iso_639_2b || iso_639_3\n end",
"def polyglossia_default_language(language_code_3_chars)\n {\n 'ara' => 'arabic',\n 'frs' => 'farsi',\n 'kan' => 'kannada',\n 'mal' => 'malayalam',\n 'pun' => 'punjabi',\n }[language_code_3_chars]\n end",
"def extract_code_language(attr); end",
"def language\n @language ||= if %W[rbx maglev].any? { |name| engine == name }\n CPlusPlus\n elsif platform =~ /java/\n Java\n else\n C\n end\n end",
"def lang\n language = \"#{@lang}\".strip.downcase\n { #Aliases to languages names\n \"eng\" => [\"en\",\"en-us\",\"english\"],\n \"ita\" => [\"it\"],\n \"por\" => [\"pt\",\"pt-br\",\"portuguese\"],\n \"spa\" => [\"sp\"]\n }.each do |value,names|\n return \" -l #{value} \" if names.include? language\n end\n return \" -l #{language} \" if language.size > 0\n \"\"\n rescue\n \"\"\n end",
"def pbGetLanguage()\n case System.user_language[0..1]\n when \"ja\" then return 1 # Japanese\n when \"en\" then return 2 # English\n when \"fr\" then return 3 # French\n when \"it\" then return 4 # Italian\n when \"de\" then return 5 # German\n when \"es\" then return 7 # Spanish\n when \"ko\" then return 8 # Korean\n end\n return 2 # Use 'English' by default\nend",
"def language\n self\n end",
"def language_code\n @language_code ||= code_parts[0]\n end",
"def language_code_lookup( language_code )\n\n case language_code\n when 'eng'\n return 'English'\n when 'fre'\n return 'French'\n when 'ger'\n return 'German'\n when 'spa'\n return 'Spanish'\n end\n return language_code\n end",
"def language_iso_639_3\n language_obj.try {|l| l.iso_639_3 }\n end",
"def extlang\n return nil unless @language\n decompose_language unless @primary\n @extlang\n end",
"def language(options = {})\n Babel.guess(self, options)\n end",
"def language\n attributes[\"language\"] || \"en\"\n end",
"def pbGetLanguage()\n getUserDefaultLangID=Win32API.new(\"kernel32\",\"GetUserDefaultLangID\",\"\",\"i\") rescue nil\n ret=0\n if getUserDefaultLangID\n ret=getUserDefaultLangID.call()&0x3FF\n end\n if ret==0 # Unknown\n ret=MiniRegistry.get(MiniRegistry::HKEY_CURRENT_USER,\n \"Control Panel\\\\Desktop\\\\ResourceLocale\",\"\",0)\n ret=MiniRegistry.get(MiniRegistry::HKEY_CURRENT_USER,\n \"Control Panel\\\\International\",\"Locale\",\"0\").to_i(16) if ret==0\n ret=ret&0x3FF\n return 0 if ret==0 # Unknown\n end\n return 1 if ret==0x11 # Japanese\n return 2 if ret==0x09 # English\n return 3 if ret==0x0C # French\n return 4 if ret==0x10 # Italian\n return 5 if ret==0x07 # German\n return 7 if ret==0x0A # Spanish\n return 8 if ret==0x12 # Korean\n return 2 # Use 'English' by default\nend",
"def official_language_code(language_code)\n {\n cs: \"zh-CN\",\n ct: \"zh-TW\",\n sp: \"es\",\n jp: \"ja\",\n }[language_code] || language_code\n end",
"def language\n attributes.fetch(:language)\n end",
"def language\n attributes.fetch(:language)\n end",
"def extract_code_language!(attr); end",
"def language\n @language ||= LanguageDetector.new\n end",
"def language\n if @language.nil?\n @language = FeedTools::XmlHelper.select_not_blank([\n FeedTools::XmlHelper.try_xpaths(self.channel_node, [\n \"language/text()\",\n \"dc:language/text()\",\n \"@dc:language\",\n \"@xml:lang\",\n \"xml:lang/text()\"\n ], :select_result_value => true),\n FeedTools::XmlHelper.try_xpaths(self.root_node, [\n \"@xml:lang\",\n \"xml:lang/text()\"\n ], :select_result_value => true)\n ])\n if @language.blank?\n @language = \"en-us\"\n end\n @language.gsub!(/_/, \"-\")\n @language = @language.downcase\n if @language.split('-').size > 1\n @language =\n \"#{@language.split('-').first}-\" +\n \"#{@language.split('-').last.upcase}\"\n end\n end\n return @language\n end",
"def language\n return proper_language(self.parameters[:language]) if self.parameters[:language]\n return session_lang = proper_language(self.session[:language]) if self.session[:language]\n \n lang = self.env['HTTP_ACCEPT_LANGUAGE'] || ''\n m = lang.match(/^[a-zA-Z]{2}(\\-[a-zA-Z]{2})?/)\n\n return TranslatorExtension.defaults[:language] unless m\n match = m[0]\n return proper_language(match)\n end",
"def language(property)\n @languages.fetch(property.to_s, @default_language) if !coerce(property)\n end",
"def language \n \"language\" \n end",
"def lang(value)\n merge(lang: value.to_s)\n end",
"def language\n if !block_given?\n return @j_del.java_method(:language, []).call()\n end\n raise ArgumentError, \"Invalid arguments when calling language()\"\n end",
"def language; end",
"def language; end",
"def language; end",
"def language; end",
"def language_from_kaf(input)\n parser = Oga::XML::PullParser.new(input)\n language = nil\n\n parser.parse do |node|\n if node.is_a?(Oga::XML::Element) and node.name == 'KAF'\n language = node.get('xml:lang')\n break\n end\n end\n\n # Make sure nobody can _somehow_ inject a language such as \"../../foo\".\n unless language =~ /\\A[a-zA-Z\\-_]+\\z/\n raise Core::UnsupportedLanguageError, language\n end\n\n language\n end",
"def language_obj\n @language_obj ||= begin\n lookup = self.language_code || self.language_str\n LanguageList::LanguageInfo.find( lookup.dup ) if lookup\n end\n end",
"def get_locale\n if !self.language.nil?\n return self.language.abbreviation\n else\n return nil\n end\n end",
"def language\n Coursemology::Polyglot::Language.find_by(type: super)\n end",
"def language_from_kaf(input)\n document = Nokogiri::XML(input)\n language = document.xpath('KAF/@xml:lang')[0]\n\n return language ? language.to_s : nil\n end",
"def language_from_kaf(input)\n document = Nokogiri::XML(input)\n language = document.xpath('KAF/@xml:lang')[0]\n\n return language ? language.to_s : nil\n end",
"def lang; end",
"def lang; end",
"def lang; end",
"def lang; end",
"def language\n @language ||= begin\n primary = languages.max_by { |(_, size)| size }\n primary && primary[0]\n end\n end",
"def language_in(country_name)\n params = {query: {fullText: 'true'}}\n response = HTTParty.get(\"#{COUNTRIES_BASE_URL}/#{country_name}\", params)\n json_response = JSON.parse(response.body)\n json_response.first['languages'].first['iso639_1']\n end",
"def language_in(country_name)\n params = {query: {fullText: 'true'}}\n response = HTTParty.get(\"#{COUNTRIES_BASE_URL}/#{country_name}\", params)\n json_response = JSON.parse(response.body)\n json_response.first['languages'].first['iso639_1']\n end",
"def language_in(country_name)\n params = {query: {fullText: 'true'}}\n response = HTTParty.get(\"#{COUNTRIES_BASE_URL}/#{country_name}\", params)\n json_response = JSON.parse(response.body)\n json_response.first['languages'].first['iso639_1']\n end",
"def language_in(country_name)\n params = {query: {fullText: 'true'}}\n response = HTTParty.get(\"#{COUNTRIES_BASE_URL}/#{country_name}\", params)\n json_response = JSON.parse(response.body)\n json_response.first['languages'].first['iso639_1']\n end",
"def language_in(country_name)\n params = {query: {fullText: 'true'}}\n response = HTTParty.get(\"#{COUNTRIES_BASE_URL}/#{country_name}\", params)\n json_response = JSON.parse(response.body)\n json_response.first['languages'].first['iso639_1']\n end",
"def language_in(country_name)\n params = {query: {fullText: 'true'}}\n response = HTTParty.get(\"#{COUNTRIES_BASE_URL}/#{country_name}\", params)\n json_response = JSON.parse(response.body)\n json_response.first['languages'].first['iso639_1']\n end",
"def language_in(country_name)\n params = {query: {fullText: 'true'}}\n response = HTTParty.get(\"#{COUNTRIES_BASE_URL}/#{country_name}\", params)\n json_response = JSON.parse(response.body)\n json_response.first['languages'].first['iso639_1']\n end",
"def language_in(country_name)\n params = {query: {fullText: 'true'}}\n response = HTTParty.get(\"#{COUNTRIES_BASE_URL}/#{country_name}\", params)\n json_response = JSON.parse(response.body)\n json_response.first['languages'].first['iso639_1']\n end",
"def language_in(country_name)\n params = {query: {fullText: 'true'}}\n response = HTTParty.get(\"#{COUNTRIES_BASE_URL}/#{country_name}\", params)\n json_response = JSON.parse(response.body)\n json_response.first['languages'].first['iso639_1']\n end",
"def language\n values = super\n values = Deepblue::MetadataHelper.ordered( ordered_values: language_ordered, values: values )\n return values\n end",
"def select_languages_localized\n available_languages.map{ |x| known_languages.assoc(x)}.map{ |y| [y[2],y[0]]}.sort!\n end",
"def preferred_language\n mother_tongues.first || self.last_login_language || Language[I18n.default_locale]\n end",
"def find_language(text)\n @cc.find_language(Result, SpanInfo, text.encode(Encoding::UTF_8))\n end",
"def name\n (default_name if default_name.present?) ||\n (iso_639_code if iso_639_code.present?) ||\n (id ? UNKNOWN_LANGUAGE % id : '')\n end",
"def language\n values = super\n values = MetadataHelper.ordered( ordered_values: self.language_ordered, values: values )\n return values\n end",
"def language\n values = super\n values = MetadataHelper.ordered( ordered_values: self.language_ordered, values: values )\n return values\n end",
"def languages\n get(\"/repos/show/#{owner.login}/#{name}/languages\")['languages']\n end",
"def get_locale\n if !self.language.nil?\n return self.language.abbreviation\n elsif !self.org.nil?\n return self.org.get_locale\n else\n return nil\n end\n end",
"def languages\n value.document.fetch(\"#{value.key}_lang\", [])\n end",
"def get_language(retina_name, body)\n resource_path = '/text/detect_language'\n verb = 'POST'\n query_params = { 'retina_name' => retina_name}\n post_data = body\n headers = {'Accept' => 'Application/json', 'Content-Type' => 'application/json'}\n\n response = @api_client.call_api(resource_path, verb, query_params, post_data, headers)\n RetinaSDK::Model::LanguageRest.new(JSON.parse(response.body, symbolize_names: true))\n end",
"def language\n return OrderedStringHelper.deserialize(super )\n end",
"def user_language\n USER_LANGUAGE[spoken_language]\n end",
"def language_code_of_text\n if self.language_of_text\n self.language_of_text.code\n end\n end",
"def localize_language( iso639 )\n begin\n known_languages.find{ |x,y,z| x == iso639 }[2]\n rescue Exception => e\n _('Unknown language')\n end\n end",
"def language_iso_639_1\n language_obj.try { |l| l.iso_639_1 }\n end",
"def language\n @grpc.language\n end",
"def language; languages.first; end",
"def language; languages.first; end",
"def get_language(code, options = {})\n root = get_root\n object_from_response(GogoKit::Language,\n GogoKit::LanguageRepresenter,\n :get,\n \"#{root.links['self'].href}/languages/#{code}\",\n options)\n end",
"def key_lang\n if @is_result\n @lang[0, @lang.length - RESULT_SUFFIX_LENGTH]\n else\n @lang\n end\n end",
"def language\n tag = self.languages.first\n return tag ? tag.name : nil\n end",
"def language\n text(data.at_xpath(\"#{data_root}/did/langmaterial/language/@langcode\"))\n end",
"def language(doc)\n node = doc.at('/html/@lang')\n if node\n lang = node.text\n if lang.present?\n lang.split(/[^a-zA-Z]/, 2).first.downcase\n end\n end\n end",
"def most_common_language\n self.repos.collect { |repo| repo.language }.mode\n end",
"def locale\n if !language.nil?\n language.abbreviation\n elsif !org.nil?\n org.locale\n end\n end",
"def language\n return @language\n end",
"def select_languages_native\n available_languages.map{ |x| known_languages.assoc(x)}.map{ |y| [y[1],y[0]]}.sort!\n end"
] | [
"0.6892601",
"0.6644617",
"0.66379243",
"0.6631493",
"0.6465269",
"0.6465269",
"0.6465269",
"0.63848174",
"0.6342725",
"0.63016415",
"0.62941664",
"0.62736636",
"0.6269395",
"0.62621105",
"0.623273",
"0.62284756",
"0.6221173",
"0.6197366",
"0.6192198",
"0.61330897",
"0.6076975",
"0.60679024",
"0.60642993",
"0.6062756",
"0.60546577",
"0.6042312",
"0.6002808",
"0.5998381",
"0.5995048",
"0.59924674",
"0.59844625",
"0.5978218",
"0.5976464",
"0.59640163",
"0.5950945",
"0.5938841",
"0.593025",
"0.59200597",
"0.59188014",
"0.59188014",
"0.5908597",
"0.5906668",
"0.5906399",
"0.58983785",
"0.5888377",
"0.58854914",
"0.58763975",
"0.58736867",
"0.58678323",
"0.58678323",
"0.58678323",
"0.58678323",
"0.5844865",
"0.58446306",
"0.58435553",
"0.584079",
"0.5840407",
"0.5840407",
"0.5821453",
"0.5821453",
"0.5821453",
"0.5821453",
"0.57985187",
"0.57965505",
"0.57963175",
"0.57963175",
"0.57963175",
"0.57963175",
"0.57963175",
"0.57963175",
"0.57963175",
"0.57963175",
"0.5795249",
"0.57889855",
"0.5788312",
"0.57880104",
"0.57831794",
"0.5777546",
"0.5777546",
"0.5765839",
"0.5760635",
"0.5752014",
"0.5738029",
"0.5735855",
"0.57345426",
"0.57341933",
"0.57155037",
"0.56929874",
"0.5689711",
"0.56727797",
"0.56727797",
"0.5659916",
"0.56420153",
"0.563949",
"0.5631046",
"0.56237173",
"0.56214416",
"0.5599825",
"0.5594156",
"0.5588901"
] | 0.67905855 | 1 |
Return parameters that are required for QA api | def term_qa_replacement_patterns
Config.config_value(term_config, :qa_replacement_patterns)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def qa_params\n params.fetch(:qa, {})\n end",
"def altoq_params\n params.fetch(:altoq, {})\n end",
"def api_v1_question_params\n params.fetch(:api_v1_question, {})\n end",
"def api_params(q = {})\n @api[:optional].deep_merge(@api[:required]).deep_merge(q)\n end",
"def request_parameters; end",
"def query_parameters; end",
"def request_parameters\n {:email => @email, :receiverid => @receiverid, :amt => @amt,\n :uniqueid => @unique, :note => @note}.reject{|k,v| v.nil? }\n end",
"def q_params\n params.fetch(:q, {}).permit(:name, :qn_id, :correct_flg)\n end",
"def request_params; end",
"def accepted_params\n [\n :Amount,\n :isPreAuth,\n :ServiceId, \n :RequestLang, \n :FullName, \n :Email, \n :Phone, \n :MaxInstallments,\n :MerchantTrns,\n :CustomerTrns,\n :SourceCode,\n :PaymentTimeOut,\n :ExpirationDate,\n :AllowRecurring,\n :Tags,\n :AllowTaxCard,\n :ActionUser,\n :DisableCash,\n :DisableCard\n ]\n end",
"def query_parameters\n end",
"def mandatory_params\n return {}\n end",
"def query_params; end",
"def validation_parameters\n query(['ticket', ticket],\n ['service', service],\n ['pgtUrl', proxy_callback_url])\n end",
"def query_params\n return if params.blank?\n\n rq_params = params[:rq]\n rq_params&.delete_if { |key, value| key == 'enabled_eq' && value == '0' }\n end",
"def query_params\n raise(\"missing query_params stub!\")\n end",
"def query_params\n {\n name:,\n q: query,\n api_key:\n }\n end",
"def get_parameters; end",
"def get_parameters; end",
"def qanote_parameters\n params.require(:qanote).permit(:clientdetail, :productname, :projectname, :currenttag, :oldtag, :servername, :date, :developername, :gatekeeper, :uploadedfromtag, :tasknodetail, :patchnamedetail, :diff1, :diff2, :signature, :testedby, :user_id, :task_id)\n end",
"def exclude_qsh_params\n []\n end",
"def exclude_qsh_params\n []\n end",
"def query_params\n { v: version, prerelease: prerelease, nightlies: nightlies,\n p: platform, pv: platform_version, m: machine_arch }\n end",
"def quiz_params\n paramspermit(:answer)\n end",
"def qit_params\n params.require(:qit).permit(:borrower_id, :borrower, :item, :item_id, :borrowed_on, :returned_on, :item_status, :incharge, :issue)\n end",
"def define_parameters #:nodoc:#\n @request_parameters = [:version, :method, :startdate, :enddate,\n :email, :receiver, :receiptid,\n :transactionid, :invnum, :acct, :auctionitemnumber,\n :transactionclass, :amt, :currencycode, :status]\n end",
"def get_order_params( required_params )\n {}\n end",
"def admin_academy_question_params\n params[:admin_academy_question]\n end",
"def required_params(params)\n if params.options.nil? || params.options.url.nil? || params.options.url == Connection::ENDPOINT\n raise_error(\"An API key must be specified using :k variable name\") if not params.key?(:k)\n end\n end",
"def query_params\n validate_params!\n \n qargs = {\n Ebay::Search::Api::OPERATION_NAME[:key] => Ebay::Search::Api::OPERATION_NAME[:value],\n Ebay::Search::Api::SERVICE_VERSION[:key] => Ebay::Search::Api::SERVICE_VERSION[:value],\n Ebay::Search::Api::SECURITY_APPNAME[:key] => self.app_name,\n Ebay::Search::Api::GLOBAL_ID[:key] => self.global_id,\n Ebay::Search::Api::RESPONSE_DATA_FORMAT[:key] => Ebay::Search::Api::RESPONSE_DATA_FORMAT[:value],\n Ebay::Search::Api::PER_PAGE[:key] => self.per_page,\n Ebay::Search::Api::KEYWORDS[:key] => self.keywords\n }\n \n query_formatter(qargs) do |params|\n params.join(\"&\")\n end\n end",
"def query_params\n {\n affiliate:,\n access_key:,\n query:,\n offset:,\n limit:\n }\n end",
"def common_params\n {\n magento_url: magento_url,\n magento_username: magento_username,\n magento_api_key: magento_api_key\n }\n end",
"def api_question_params\n params.require(:api_question).permit(:header, :body, :rating)\n end",
"def prepare_base_params()\n\t\tparams=Hash.new\n\t\tparams=add_params(params,\"application\",@testobj[:application])\t\n\t\treturn params\n\tend",
"def question_params\n if user_signed_in? and current_user.admin?\n params.require(:question).permit(:title, :content, {:legislator_ids => []}, {:keyword_ids => []},\n :user_id, :ivod_url, :committee_id, :meeting_description, :date, :comment, :published)\n else\n params.require(:question).permit(:title, :content, {:legislator_ids => []}, {:keyword_ids => []},\n :user_id, :ivod_url, :committee_id, :meeting_description, :date, :comment)\n end\n end",
"def valid_params_request?; end",
"def get_required_params(key)\n get_option(key, :required_params)\n end",
"def assumption_params\n attribute_for_all = [:name, :description, :type,]\n array_for_all = {required_by_ids: [], model_ids: []}\n res = if (params[:query_assumption])\n params.require(:query_assumption).permit(attribute_for_all, :question, :argument_inverted, array_for_all)\n elsif (params[:blank_assumption])\n params.require(:blank_assumption).permit(attribute_for_all, :argument_inverted, array_for_all, assumption_ids: [])\n elsif (params[:test_assumption])\n params.require(:test_assumption).permit(attribute_for_all, :r_code, :argument_inverted, array_for_all, required_dataset_fields: [])\n elsif (params[:query_test_assumption])\n params.require(:query_test_assumption).permit(attribute_for_all, :r_code, :argument_inverted, :question, :argument_inverted, array_for_all, required_dataset_fields: [])\n else\n {}\n end\n res[:user] = current_user\n res\n end",
"def amphibian_params\n base_params\n end",
"def quser_params\n params.require(:quser).permit(:displayname, :qmail, :encrypass, :qsubscriber, :qoid)\n end",
"def q_params\n params.require(:q).permit(:order, :quiz_id, :title)\n end",
"def qdataset_params\n params.require(:qdataset).permit(:displayname, :qmail, :encrypass, :qsubscriber, :qoid)\n end",
"def request_params( params = {} )\n params\n end",
"def request_query_params\n {}\n end",
"def base_params\n {\n v: PROTOCOL_VERSION,\n # Client ID\n cid: @user_id,\n # Tracking ID\n tid: TRACKING_ID,\n # Application Name\n an: APPLICATION_NAME,\n # Application Version\n av: Bolt::VERSION,\n # Anonymize IPs\n aip: true,\n # User locale\n ul: Locale.current.to_rfc,\n # Custom Dimension 1 (Operating System)\n cd1: @os\n }\n end",
"def language_params\n params.require(:q)\n end",
"def parameters\n nil\n end",
"def q_params\n params.require(:q)\n .permit(:requested_by_user_id, :assigned_to_user_id, :status,\n created_at: %i[start_date end_date])\n end",
"def q_params\n params.require(:q)\n .permit(:requested_by_user_id, :assigned_to_user_id, :status,\n created_at: %i[start_date end_date])\n end",
"def required_custom_params\n custom.select{|param| param[\"required\"]}.map{|param| param[\"name\"]}\n end",
"def quotation_params\n params.require(:quotation)\n end",
"def required_parameters\n @required_parameters ||= ((self.parameter_descriptions.select do |k, v|\n v['required']\n end).inject({}) { |h,(k,v)| h[k]=v; h }).keys\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 bq_params\n params[:bq]\n end",
"def query_params\n params.permit(:aql)\n end",
"def quclity_check_params\n params.permit(:plan_id, :remark, :is_standard)\n end",
"def get_resource_params\n \traise NotImplementedError\n end",
"def qy_app_params\n params.require(:qy_app).permit(:name, :qy_token, :encoding_aes_key, :corp_id)\n end",
"def query_params\n\t\t\t\t{}\n\t\t\tend",
"def qux_params\n params.require(:qux).permit(:name)\n end",
"def query_params\n get_query_params\n end",
"def list_available_params\n cg_reader.list_available_params\n end",
"def requisition_params\n params.require(:requisition).permit(:id, :title, :description, :amount, :status, :loc)\n end",
"def required_params_present?\n\n render json: {error: 'Missing required parameter: result'},\n status: :bad_request and return false unless params[:result]\n\n render json: {error: 'Missing required parameter: result.result_type'},\n status: :bad_request and return false unless params[:result][:result_type]\n\n # Manual Results are required to provide the execution id.\n # All other results are required to provide the project_id\n if params['result']['result_type'] == 'manual'\n render json: {error: 'Missing required parameter: result.execution_id'},\n status: :bad_request and return false unless params[:result][:execution_id]\n else\n render json: {error: 'Missing required parameter: result.project_id'},\n status: :bad_request and return false unless params[:result][:project_id]\n end\n\n\n render json: {error: 'Missing required parameter: result.testcase_id'},\n status: :bad_request and return false unless params[:result][:testcase_id]\n\n render json: {error: 'Missing required parameter: result.environment_id'},\n status: :bad_request and return false unless params[:result][:environment_id]\n\n\n render json: {error: 'Missing required parameter: result.status'},\n status: :bad_request and return false unless params[:result][:status]\n\n true\n end",
"def question_params\n params.fetch(:question, {})\n end",
"def parameters; end",
"def parameters; end",
"def parameters; end",
"def parameters; end",
"def parameters; end",
"def parameters; end",
"def parameters; end",
"def parameters; end",
"def query_params\n {}\n end",
"def query_params\n {}\n end",
"def get_query_params\n {}\n end",
"def prepare(params)\n check_like_value(:keywords, params)\n check_array_value(:subjects, params)\n check_array_value(:media_types, params)\n check_array_value(:durations, params)\n check_single_value(:account_id, params)\n check_numeric_value(:per_page, params, 20)\n check_numeric_value(:page, params, 1)\n check_single_value(:workflow_state, params, \"active\")\n end",
"def parameters\n @parameters ||= {}\n end",
"def parameters\n @parameters ||= {}\n end",
"def quatum_params\n params.require(:quatum).permit(:service_request_id, :user_id, :amount, :duration, :when, :state)\n end",
"def qa_setting_params\n params.require(:qa_setting).permit(:name, :setting_id, :team_id, :description, :out_of, :qa, :position)\n end",
"def query_params\n {}\n end",
"def query_params\n {}\n end",
"def query_params\n {}\n end",
"def query_params\n {}\n end",
"def query_params\n {}\n end",
"def query_params\n {}\n end",
"def query_params\n {}\n end",
"def query_params\n {}\n end",
"def params\n # Normal cases\n # raise @params.values.inspect\n # return @params.values.length.inspect\n if %w{ready accesses list_subscribe list_unsubscribe}.include?(@action)\n @params\n elsif @params.values.first.is_a? Hash\n {@params.keys.first => @params.values.first.select{|k,v| v.present? }}\n elsif @params.values.first.is_a? Array\n {@params.keys.first => @params.values.first.select(&:present?)} rescue {}\n end\n # rescue => e\n # {}\n end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end"
] | [
"0.7521961",
"0.6979034",
"0.6782931",
"0.6754813",
"0.6733016",
"0.671401",
"0.66703606",
"0.6561681",
"0.6520662",
"0.65206015",
"0.6505873",
"0.6495679",
"0.6412497",
"0.64057755",
"0.63969517",
"0.63658667",
"0.634184",
"0.6318486",
"0.6318486",
"0.6313167",
"0.63059354",
"0.63059354",
"0.6300509",
"0.62902665",
"0.62802815",
"0.6265566",
"0.6240382",
"0.6229623",
"0.62184733",
"0.62105757",
"0.61447924",
"0.61215794",
"0.6117227",
"0.6115863",
"0.6107459",
"0.6098169",
"0.60954595",
"0.60924715",
"0.60899544",
"0.608303",
"0.60801315",
"0.60763705",
"0.60691196",
"0.60589963",
"0.6050568",
"0.60501117",
"0.604116",
"0.60299534",
"0.60299534",
"0.60297835",
"0.60001916",
"0.5988302",
"0.59842205",
"0.5979949",
"0.59677607",
"0.5959902",
"0.5953279",
"0.5945015",
"0.5942979",
"0.59422415",
"0.5941727",
"0.59303087",
"0.5922494",
"0.5918761",
"0.5915803",
"0.59118724",
"0.59118724",
"0.59118724",
"0.59118724",
"0.59118724",
"0.59118724",
"0.59118724",
"0.59118724",
"0.59028906",
"0.59028906",
"0.59017277",
"0.5901443",
"0.5900001",
"0.5900001",
"0.58914804",
"0.5888676",
"0.5887567",
"0.5886207",
"0.5886207",
"0.5886207",
"0.5885224",
"0.5885224",
"0.5885224",
"0.5885224",
"0.5884746",
"0.5884742",
"0.5884742",
"0.5884742",
"0.5884742",
"0.5884742",
"0.5884742",
"0.5884742",
"0.5884742",
"0.5884742",
"0.5884742",
"0.5884742"
] | 0.0 | -1 |
Should the replacement pattern be encoded? | def term_qa_replacement_encoded?(pattern_key)
map_key = term_qa_replacement_patterns[pattern_key].to_sym
term_replacement_encoded? map_key
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def javascriptify_pattern(pattern)\n pattern.gsub!(/^\\\\A/, '^')\n pattern.gsub!(/\\\\z$/, '$')\n \"/#{pattern}/\"\n end",
"def reencode_string(input); end",
"def string_replacements\nend",
"def id3 pattern\n id3tool(pattern).encode! 'UTF-8',\n 'UTF-8',\n :invalid => :replace,\n :undef => :replace\n end",
"def pattern2regex(pattern); end",
"def replace\n end",
"def replace_encoded(str, regex)\n str.scan(regex).each do |x|\n str = str.sub(\"#{x[0]}[#{x[1]}]\", x[1] * x[0].to_i)\n end\n str\nend",
"def replacements; end",
"def sub(pattern, replacement)\n replacement = Maglev::Type.coerce_to(replacement, String, :to_str)\n regex = self.__get_pattern(pattern, true)\n\n # If pattern is a string, then do NOT interpret regex special characters.\n # stores into caller's $~\n if (match = regex.__match_vcglobals(self, 0x30))\n __replace_match_with(match, replacement)\n else\n dup\n end\n # r.taint if replacement.tainted? || self.tainted?\n end",
"def url_replace(url)\n URL_SUBSTITUTION.each do |pattern, replacement|\n if url.match(pattern)\n return url.gsub(Regexp.new(\".*#{pattern}.*\",\"uxim\"), replacement)\n end\n end\n return \"[url]\"\n end",
"def rewrite!(content)\n return content unless match?\n \n content.gsub(/#{pattern}/, replacement)\n end",
"def simplified_pattern\n pattern\n end",
"def simplified_pattern\n pattern\n end",
"def as_replacements; end",
"def as_replacements; end",
"def as_replacements; end",
"def replace(input, string, replacement = T.unsafe(nil)); end",
"def key_replace\n /[^a-z0-9?]+/\n end",
"def escape input, regexp, map\n input.gsub(regexp) { | char | map[char] || char }\n end",
"def replace(p0) end",
"def replace(p0) end",
"def replace(p0) end",
"def strip_nongsm_chars!(replacement = \"\")\n # Should this be a patch to String?\n\n # keeping them here in canse I need them\n # basic alpha\n # '@','£','$','¥','è','é','ù','ì','ò','Ç',\"\\n\",'Ø','ø',\"\\r\",'Å','å',\n # 'Δ','_','Φ','Γ','Λ','Ω','Π','Ψ','Σ','Θ','Ξ','Æ','æ','ß','É',' ',\n # '!','\"','#','¤','%','&','\\'','(',')','*','+',',','-','.','/','0',\n # '1','2','3','4','5','6','7','8','9',':',';','<','=','>','?','¡',\n # 'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P',\n # 'Q','R','S','T','U','V','W','X','Y','Z','Ä','Ö','Ñ','Ü','§','¿',\n # 'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p',\n # 'q','r','s','t','u','v','w','x','y','z','ä','ö','ñ','ü','à'\n #\n # extended alpha\n # '|','^','€','{','}','[',']','~','\\\\'\n\n allowed = '@£$¥èéùìòÇ'+\"\\n\"+'Øø'+\"\\r\"+'ÅåΔ_ΦΓΛΩΠΨΣΘΞÆæßÉ'+' '+Regexp.escape('!\"#¤%&\\'()*+,-.')+'\\/'+Regexp.escape('0123456789:;<=>?¡ABCDEFGHIJKLMNOPQRSTUVWXYZÄÖÑܧ¿abcdefghijklmnopqrstuvwxyzäöñüà|^€{}[]~\\\\')\n\n map = {\n /á|â|ã/ => \"a\",\n /ê|ẽ|ë/ => \"e\",\n /í|î|ï/ => \"i\",\n /ó|ô|õ/ => \"o\",\n /ú|ů|û/ => \"u\",\n /ç/ => \"Ç\"\n }\n\n map.each do |key, value|\n self.gsub!(key, value)\n end\n\n pattern = Regexp.new( \"[^\"+allowed+\"]\" )\n self.gsub!(pattern,\"\")\n end",
"def gsub(pattern, replace)\n lambda do |rec, acc|\n acc.collect! { |v| v.gsub(pattern, replace) }\n end\n end",
"def sub!(pattern, replacement = T.unsafe(nil), &block); end",
"def replace!(destination, regexp, string)\n content = File.binread(destination)\n content.gsub!(regexp, string)\n File.open(destination, 'wb') { |file| file.write(content) }\nend",
"def replace pattern, substitute\n if pattern.is_a? Regexp\n ArelExtensions::Nodes::RegexpReplace.new self, pattern, substitute\n else\n ArelExtensions::Nodes::Replace.new self, pattern, substitute\n end\n end",
"def recognizer_pattern\n @recognizer_pattern ||= Regexp.escape(pattern)+'\\z'\n end",
"def expected\n Regexp.new('\\A' << super.gsub('%', '.*').tr('_', '.') << '\\z')\n end",
"def new_regex(old_unescaped_content, new_unescaped_content, old_regex_string)\r\n\t\t#STDERR.puts \"\"\r\n\t\t#STDERR.puts \"OldRegex\" + old_regex_string\r\n\t\t#content already content unescaped, so it only te\\:st is alreadt te:st\r\n\t\t\r\n\t\t#escape content\r\n\t\t#STDERR.puts SnortRuleContent.escape(old_unescaped_content)\r\n\t\told_escaped_content = content_escape(Regexp.escape(old_unescaped_content))\r\n\t\tnew_escaped_content = content_escape(Regexp.escape(new_unescaped_content))\r\n\t\t#STDERR.puts \"OldEC:\" + old_escaped_content\r\n\t\t#STDERR.puts \"NewEC:\" + new_escaped_content\r\n\t\r\n\t\t#fix up incorrect escape of hyphen\r\n\t\twhile(old_escaped_content.sub(\"\\\\-\",\"-\") != old_escaped_content)\r\n\t\t\told_escaped_content = old_escaped_content.sub(\"\\\\-\",\"-\") \r\n\t\tend\r\n\t\twhile(new_escaped_content.sub(\"\\\\-\",\"-\") != new_escaped_content)\r\n\t\t\tnew_escaped_content = new_escaped_content.sub(\"\\\\-\",\"-\") \r\n\t\tend\r\n\r\n\t\t#replace all occurences of old_escaped_content with new_escaped_content in old_regex_string\r\n\t\twhile(old_regex_string.sub(old_escaped_content,new_escaped_content) !=old_regex_string)\r\n\t\t\told_regex_string = old_regex_string.sub(old_escaped_content,new_escaped_content) \r\n\t\tend\r\n\t\tnew_regex_string = old_regex_string\r\n\t\t#STDERR.puts \"NewRegex\" + new_regex_string\r\n\t\treturn new_regex_string\r\n\tend",
"def _encode(source)\n source.gsub(' ','_').gsub(/%.<.+?>/) { |match|\n CGI.escape(match[3..-2]).gsub('%', match[1..1])\n }\n end",
"def escape(s); s.to_s.gsub(/([^ a-zA-Z0-9_.-]+)/n){'%'+$1.unpack('H2'*$1.size).join('%').upcase}.tr(' ', '+') end",
"def char_replace!(str, hash)\n\nend",
"def replace!(regexp, string, force)\n return if base.options[:pretend]\n content = File.binread(destination)\n if force || !content.include?(replacement)\n content.gsub!(regexp, string)\n File.open(destination, \"wb\") { |file| file.write(content) }\n end\n end",
"def signature\r\n [@regexp, @replace]\r\n end",
"def signature\r\n [@regexp, @replace]\r\n end",
"def to_like(pattern)\n <<~SQL\n REPLACE(REPLACE(REPLACE(#{pattern},\n #{q('%')}, #{q('\\\\%')}),\n #{q('_')}, #{q('\\\\_')}),\n #{q('*')}, #{q('%')})\n SQL\n end",
"def gsub(*)\n self\n end",
"def fix_encoding_errors!\n gsub!(BAD_ENCODING_PATTERNS) { |substring| BAD_ENCODING[substring] || substring } || self\n end",
"def sanitize_regexp(value)\n original = value.dup\n\n SANITIZE_REGEXP.each do |pattern, replacement|\n value.gsub!(pattern, replacement)\n end\n\n value2 = ''\n group_index = 0\n value.scan(/((?:[^\\\\(]+|\\\\[^\\d])+)|(\\\\\\d+)|(\\(\\??)/m) do |content, backref, capture|\n value2 << if capture == '('\n \"(?<_#{group_index += 1}>\"\n elsif backref\n \"\\\\k<_#{backref[/\\d+/]}>\"\n else\n (content || capture)\n end\n end\n\n Regexp.new(value2)\n rescue RegexpError => ex\n if ex.message =~ /^invalid multibyte escape:/\n begin\n /#{value2.force_encoding(Encoding::BINARY)}/n\n rescue RegexpError => ex\n error(ex, original, value2)\n end\n else\n error(ex, original, value2)\n end\n end",
"def encode_string_ex; end",
"def test_gsub\n assert_equal 'éxa', 'éda'.chars.gsub(/d/, 'x')\n with_kcode('none') do\n assert_equal 'éxa', 'éda'.chars.gsub(/d/, 'x')\n end\n end",
"def term_replacement_encoded?(map_key)\n return false unless term_url_mappings[map_key].key? :encode\n term_url_mappings[map_key][:encode]\n end",
"def escape_wildcards(unescaped)\n case ActiveRecord::Base.connection.adapter_name\n when \"Mysql2\".freeze\n # Necessary for MySQL\n unescaped.to_s.gsub(/([\\\\%_])/, '\\\\\\\\\\\\1')\n when \"PostgreSQL\".freeze\n # Necessary for PostgreSQL\n unescaped.to_s.gsub(/([\\\\%_.])/, '\\\\\\\\\\\\1')\n else\n unescaped\n end\n end",
"def regexp=(_arg0); end",
"def sub!(pattern, replacement)\n regex = self.__get_pattern(pattern, true)\n # stores into caller's $~\n if match = regex.__match_vcglobals(self, 0x30)\n replace(__replace_match_with(match, replacement))\n # self.taint if replacement.tainted?\n self\n else\n nil\n end\n end",
"def match(pattern); end",
"def pattern=(pattern)\n @pattern = pattern\n substitute_variables! # TODO: Remove this call\n end",
"def re; end",
"def encode(word)\n word.gsub(/[aeiou]/, 'a' => 1, 'e' => 2, 'i' => 3, 'o' => 4,\n 'u' => 5)\nend",
"def fix_common_typos!\n # well, I don't know what kind of typos people do!\n @pattern.squish!\n end",
"def additional_encoding(s)\n encoding_hash = {\":\" => \"%3A\", \"+\" => \"%2B\"}\n encoding_hash.each_pair do |k, v|\n s.gsub!(k, v)\n end\n s\n end",
"def escape_re(str)\n str.gsub(@re_chars) {|c| @re_esc + c}\n end",
"def replace!(regexp, string)\n unless base.options[:pretend]\n content = File.read(destination)\n content.gsub!(regexp, string)\n File.open(destination, 'wb') { |file| file.write(content) }\n end\n end",
"def apply_replacements(word)\n @replacements.each do |pattern, target|\n word.gsub!(pattern, target)\n end\n \n word\n end",
"def wc_with_placeholder_equals(str, pat, repl_chars)\n return false if pat.size != str.size\n\n fixed_pat = wc_replace(pat, repl_chars)\n wc_equals(str, fixed_pat)\nend",
"def perform_substitutions(input)\n @data[:presubs].each { |s| input.gsub!(s[0], s[1]) }\n input\nend",
"def escape_wildcards(unescaped)\n case ActiveRecord::Base.connection.adapter_name\n when \"Mysql2\", \"PostgreSQL\"\n # Necessary for PostgreSQL and MySQL\n unescaped.to_s.gsub(/([\\\\|\\%|.])/, '\\\\\\\\\\\\1')\n else\n unescaped\n end\n end",
"def set_replace_tag(begin_tag, end_tag, escape=true)\n\t\tif(escape)\n\t\t\tbegin_tag = begin_tag.gsub(/([.*+?^\\$\\\\|()\\[\\]])/, '\\\\\\\\\\\\1')\n\t\t\tend_tag = end_tag .gsub(/([.*+?^\\$\\\\|()\\[\\]])/, '\\\\\\\\\\\\1')\n\t\tend\n\n\t\t@@SIFTER_REPLACE_TAG_BGN = begin_tag\n\t\t@@SIFTER_REPLACE_TAG_END = end_tag \n\t\t@@SIFTER_REPLACE_PATTERN = begin_tag + SIFTER_REPLACE_EXPRESSION + end_tag\n\tend",
"def convert_regexp_handling target\n convert_string super\n end",
"def exactize pattern\r\n pattern.include?(':') ? \"exact:#{pattern}\" : pattern\r\n end",
"def rsub(pattern, replacement)\n if i = rindex(pattern) # rubocop:disable Lint/AssignmentInCondition\n s = @string.dup\n s[i] = replacement\n self.class.new s\n else\n self\n end\n end",
"def uri_escape(input); end",
"def determine_pattern_replacements(patterns)\n seen_patterns = []\n replacements = {}\n\n # Pattern names are sorted to ensure predictable pattern replacement. Makes tests easier to write.\n pattern_names = patterns.keys.sort\n\n # Detect duplicates\n pattern_names.each do |pattern_name|\n pattern = patterns[pattern_name]\n found_duplicate = false\n seen_patterns.each do |seen_pattern|\n if !found_duplicate && pattern.same_tracks_as?(seen_pattern)\n replacements[pattern.name.to_sym] = seen_pattern.name.to_sym\n found_duplicate = true\n end\n end\n\n if !found_duplicate\n seen_patterns << pattern\n end\n end\n\n replacements\n end",
"def regexp; end",
"def regexp; end",
"def replace(s)\n s.gsub(/[AEIOUaeiou]/, \"!\")\nend",
"def replace(range, content); end",
"def replace(range, content); end",
"def replace(range, content); end",
"def replace(range, content); end",
"def replace(range, content); end",
"def replace(range, content); end",
"def replace(range, content); end",
"def replace(range, content); end",
"def escape(str); end",
"def promote_traditional!\n self.gsub!(TRADITIONAL_REGEX, $1) if self =~ TRADITIONAL_REGEX\n end",
"def with_repl_like_sigint; end",
"def escape(string); end",
"def lex_en_regexp_modifiers=(_arg0); end",
"def lex_en_regexp_modifiers=(_arg0); end",
"def lex_en_regexp_modifiers=(_arg0); end",
"def lex_en_regexp_modifiers; end",
"def lex_en_regexp_modifiers; end",
"def lex_en_regexp_modifiers; end",
"def to_regex_str\n pattern\n end",
"def test_extended_patterns_no_flags\n [\n [ \".*\", \"abcd\\nefg\", \"abcd\" ],\n [ \"^a.\", \"abcd\\naefg\", \"ab\" ],\n [ \"^a.\", \"bacd\\naefg\", \"ae\" ],\n [ \".$\", \"bacd\\naefg\", \"d\" ]\n ].each do |reg, str, result|\n m = RustRegexp.new(reg).match(str)\n puts m.inspect\n unless m.nil?\n assert_equal result, m[0]\n end\n end\n end",
"def put_re(pattern, &hndlr)\n @j_del.putWithRegEx(pattern) { |j_req| hndlr.call(HttpServerRequest.new(j_req)) }\n end",
"def escape(string)\n string.gsub(/([^ a-zA-Z0-9_.-]+)/n) do\n '%' + $1.unpack('H2' * $1.size).join('%').upcase\n end.tr(' ', '+')\t\n\tend",
"def register_processor(pattern, klass, replace_all: T.unsafe(nil)); end",
"def make_regexp\n @intent = self.intent\n regexp = self.pattern.dup.downcase\n words = regexp.split(\" \")\n words.each do |word|\n if word.include? '/'\n regexp = regexp.gsub(word,\"(#{word})\")\n\n end\n\n end\n regexp = regexp.gsub('/',\"|\")\n regexp = regexp.gsub('^ ','.{0,60}').gsub(' ^','.{0,60}').gsub(' *','.{1,60}').gsub('* ','.{1,60}').gsub('^','.{1,60}').gsub(' [','.{0,60}[')\n regexp = regexp.gsub(' .{0,60}','.{0,60}')\n regexp = regexp.gsub(' .{1,60}','.{1,60}')\n regexp = '.{0,60}' + regexp + '.{0,60}'\n self.regexp = regexp\n chunks = self.pattern.split(' ')\n chunks.each do |ch|\n result= Regexp.new(/\\[.{0,12}\\]/) =~ ch\n if(result==0)\n set = WordSet.find_by_keyword(ch[1..-2])\n str = '(' + set.words.join('|') + ')'\n regexp = self.regexp.gsub(ch,str)\n self.regexp = regexp\n end\n end\n self.save\n end",
"def ancientify!\n\t\tself.gsub!(\"CM\", \"DCCCC\")\n\t\tself.gsub!(\"CD\", \"CCCC\")\n\t\tself.gsub!(\"XC\", \"LXXXX\")\n\t\tself.gsub!(\"XL\", \"XXXX\")\n\t\tself.gsub!(\"IX\", \"VIIII\")\n\t\tself.gsub!(\"IV\", \"IIII\")\n\tend",
"def pattern; end",
"def pattern; end",
"def pattern; end",
"def replace_contents!(pattern, replace_with)\n\t\twrite contents.gsub(pattern, replace_with)\n\tend",
"def replace_contents!(pattern, replace_with)\n\t\twrite contents.gsub(pattern, replace_with)\n\tend",
"def prepare_pattern(pattern)\n pattern.scan(/(\\<[^\\>]+\\>[^\\<]?)/).flatten.map { |x| TagPattern.new(x) }.reverse\n end",
"def encode(string); end",
"def gsub(pattern, replacement = nil, &blk)\n if block_given?\n @string.gsub(pattern, &blk)\n else\n @string.gsub(pattern, replacement)\n end\n end"
] | [
"0.6729404",
"0.63441247",
"0.6325576",
"0.63092875",
"0.6298945",
"0.62757164",
"0.6254565",
"0.61993325",
"0.61525327",
"0.6091126",
"0.6013831",
"0.600055",
"0.600055",
"0.5995484",
"0.5995484",
"0.5995484",
"0.5991386",
"0.5923532",
"0.59208715",
"0.590815",
"0.590815",
"0.5905486",
"0.5896489",
"0.58259183",
"0.5821945",
"0.58140266",
"0.58039373",
"0.5802067",
"0.57949454",
"0.5756308",
"0.574904",
"0.572412",
"0.57201415",
"0.5685758",
"0.56721044",
"0.56721044",
"0.5665895",
"0.56521076",
"0.5619599",
"0.56193614",
"0.5592152",
"0.55908215",
"0.55897063",
"0.5577944",
"0.5577125",
"0.5574432",
"0.5570819",
"0.5560072",
"0.55483377",
"0.554738",
"0.5539234",
"0.5517608",
"0.551099",
"0.55041504",
"0.55023056",
"0.5490602",
"0.54777753",
"0.5474308",
"0.54688144",
"0.5465562",
"0.5455142",
"0.54473704",
"0.5447065",
"0.5443755",
"0.543748",
"0.543748",
"0.5429443",
"0.5428665",
"0.5428665",
"0.5428665",
"0.5428665",
"0.5428665",
"0.5428665",
"0.5428665",
"0.5428665",
"0.54203665",
"0.541706",
"0.54117453",
"0.54087704",
"0.5394684",
"0.5394684",
"0.5394684",
"0.53906375",
"0.53906375",
"0.53906375",
"0.53841966",
"0.5375391",
"0.5374992",
"0.5371737",
"0.53705853",
"0.5368399",
"0.53649795",
"0.5350095",
"0.5350095",
"0.5350095",
"0.533728",
"0.533728",
"0.53268456",
"0.53191113",
"0.5317134"
] | 0.6861212 | 0 |
Are there replacement parameters configured for term fetch? | def term_replacements?
term_replacement_count.positive?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def term_replacements\n return @term_replacements unless @term_replacements.nil?\n @term_replacements = {}\n @term_replacements = term_url_mappings.select { |k, _v| !term_qa_replacement_patterns.value?(k.to_s) } unless term_config.nil? || term_url_mappings.nil?\n @term_replacements\n end",
"def term_params\n if TERM_ADDITIONAL_FIELDS[params[:term]['controlled_vocabulary_string_key']].blank?\n addl_term_params = []\n else\n addl_term_params = TERM_ADDITIONAL_FIELDS[params[:term]['controlled_vocabulary_string_key']].map { |key, _value| key.to_sym }\n end\n params.require(:term).permit([:controlled_vocabulary_string_key, :value, :uri, :type, :authority] + addl_term_params)\n end",
"def term_multiple?( term )\n #puts \"=====> GenericWork.term_multiple? #{term}\"\n return true if [:keyword, :title, :contributor, :subject, :related_url, :sponsoring_agency, :admin_notes].include? term\n false\n end",
"def autocomplete_known_uri_predicates\n @known_uris = search_known_uris_by_name_or_uri(params[:term])\n @known_uris.delete_if{ |ku| ku.uri_type_id != UriType.measurement.id || ! EOL::Sparql.connection.all_measurement_type_known_uris.include?(ku) }\n render_autocomplete_results\n end",
"def term_param(name)\n term_params.select {|t| t.name == name}[0]\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 potential_interpretations\n parsed_form && Sense.lookup_all_by_headword(parsed_form)\n end",
"def supported_terms\n term_help_messages.keys\n end",
"def supports_term?\n term_config.present?\n end",
"def rest_keywords; end",
"def term_replacement_count\n term_replacements.size\n end",
"def autocomplete_known_uri_values\n lookup_predicate\n if params[:term].blank? || params[:term].strip.blank?\n if @predicate && @predicate.has_values?\n @known_uris = @predicate.allowed_values.select{ |ku| ku.visible? }\n else\n @known_uris = []\n end\n else\n @known_uris = search_known_uris_by_name_or_uri(params[:term])\n if @predicate\n @known_uris.delete_if{ |ku| ! @predicate.allowed_values.include?(ku) }\n else\n @known_uris.delete_if{ |ku| ! ku.value? }\n end\n end\n render_autocomplete_results\n end",
"def terms_for_editing\n terms_for_display\n end",
"def terms\n end",
"def term\r\n Riddle::Query.escape params[:term]\r\n end",
"def term\r\n Riddle::Query.escape params[:term]\r\n end",
"def update\n @errors = []\n term_opts = flat_term_data_to_term_opts(term_params)\n\n begin\n @term = UriService.client.update_term(@term['uri'], term_opts)\n rescue UriService::NonExistentUriError, UriService::InvalidAdditionalFieldKeyError, UriService::CannotChangeTemporaryTerm => e\n @errors << e.message\n end\n\n respond_to do |format|\n if @errors.blank?\n format.html { redirect_to term_path(@term['internal_id']), notice: 'Term was successfully updated.' }\n format.json do\n render json: @term\n end\n else\n format.html { render action: 'new' }\n format.json do\n render json: { errors: @errors }\n end\n end\n end\n end",
"def term\n @term\n end",
"def term_required?( term )\n #puts \"=====> GenericWork.term_required? #{term}\"\n return true if [:author_email, :author_first_name, :author_last_name, :author_institution, :title, :creator, :contributor, :description, :publisher, :rights, :identifier, :department, :degree, :license].include? term\n false\n end",
"def autocomplete_known_uri_metadata\n lookup_predicate\n if params[:term].strip.blank?\n @known_uris = KnownUri.metadata.select{ |ku| ku.visible? }\n else\n @known_uris = search_known_uris_by_name_or_uri(params[:term])\n @known_uris.delete_if{ |ku| ku.uri_type_id != UriType.metadata.id }\n end\n if @predicate && @predicate.has_units?\n @known_uris.delete(KnownUri.unit_of_measure)\n end\n render_autocomplete_results\n end",
"def term_readonly?( term )\n #puts \"=====> GenericWork.term_readonly? #{term}\"\n return true if [:author_email, :author_institution, :date_created, :identifier, :publisher, :department, :degree, :license].include? term\n return true if term == :title && is_sis_thesis?\n false\n end",
"def set_term_search_instance_variables_from_options(options)\n @species_list = options[:species_list]\n @and_object = options[:object]\n @and_predicate = options[:predicate]\n # NOTE THAT YOU CANNOT HAVE TWO PREDICATES AND TWO OBJECTS!!!! (It's not\n # allowed in the UI, so I'm not accounting for it in the code)\n if @and_object.is_a?(Array)\n @term = TraitBank.term_as_hash(@and_object.first)\n @and_object = @and_object.size == 1 ? nil :\n TraitBank.term_as_hash(@and_object.last)\n\n @object = true\n elsif @and_predicate.is_a?(Array)\n @term = TraitBank.term_as_hash(@and_predicate.first)\n @and_predicate = @and_predicate.size == 1 ? nil :\n TraitBank.term_as_hash(@and_predicate.last)\n @object = false\n else\n # TODO: the whole \"object\" flag is LAME. Remove it entirely!\n @object = options[:object] && ! options[:predicate]\n if options[:predicate] && options[:predicate]\n @term = TraitBank.term_as_hash(options[:predicate])\n @and_predicate = nil\n @and_object = TraitBank.term_as_hash(options[:object])\n elsif options[:predicate]\n @term = TraitBank.term_as_hash(options[:predicate])\n @and_predicate = nil\n @and_object = nil\n else\n @term = TraitBank.term_as_hash(options[:object])\n @and_predicate = nil\n @and_object = nil\n end\n end\n @clade = options[:clade]\n end",
"def autocomplete_known_uri_search\n @known_uris = params[:term].blank? ? [] : search_known_uris_by_name_or_uri(params[:term])\n render_autocomplete_results\n end",
"def above_fold_terms\n [:maker,\n :date_original,\n :date_published,\n :resource_type,\n :genre_string,\n :identifier,\n :rights,\n ]\n end",
"def term_replacement_encoded?(map_key)\n return false unless term_url_mappings[map_key].key? :encode\n term_url_mappings[map_key][:encode]\n end",
"def has_additional_terms_of_use\n false\n end",
"def look_up(term='')\n\n NSLog(\"Something just tried to look up the term #{term}\")\n false\n\n end",
"def literature_params\n params.fetch(:literature, {})\n end",
"def conceptwiki_ep_search\n\t\tOPS_API_FREETEXT_SEARCH_URL\n\tend",
"def supports_suggest_output?\n $client.version_support.es_version_2_x?\nend",
"def terms\n\n end",
"def terms\n\n end",
"def ocr_search_params(solr_parameters = {})\n solr_parameters[:facet] = false\n solr_parameters[:hl] = true\n solr_parameters[:'hl.fl'] = blacklight_config.iiif_search[:full_text_field]\n solr_parameters[:'hl.fragsize'] = 100\n solr_parameters[:'hl.snippets'] = 10\n solr_parameters[:qf] = blacklight_config.iiif_search[:full_text_field]\n # catalog controller puts params here when you call search_results\n solr_parameters[:fq] = solr_parameters[:fq] || []\n solr_parameters[:fq] += blacklight_params[:fq]\n end",
"def autocomplete_known_uri_units\n lookup_predicate\n if params[:term].blank? || params[:term].strip.blank?\n @known_uris = @predicate ? @predicate.units_for_form_select : []\n if @known_uris.blank?\n @known_uris = KnownUri.default_units_for_form_select\n end\n else\n @known_uris = search_known_uris_by_name_or_uri(params[:term])\n allowed_values = KnownUri.unit_of_measure.allowed_values\n @known_uris.delete_if{ |ku| ! allowed_values.include?(ku) }\n end\n render_autocomplete_results\n end",
"def update!(**args)\n @suggest_results = args[:suggest_results] if args.key?(:suggest_results)\n end",
"def update!(**args)\n @suggest_results = args[:suggest_results] if args.key?(:suggest_results)\n end",
"def term; end",
"def legacy_terms\n # Legacy terms are those before and including Settings.terms.legacy_cutoff.\n Berkeley::Terms.fetch.campus.values.select &:legacy?\n end",
"def update\n if @term.update(term_params)\n render :show, status: :ok, location: api_v1_term_url(@term)\n else\n render json: @term.errors, status: :unprocessable_entity\n end\n end",
"def url_search_terms\n if openbis?\n []\n else\n super\n end\n end",
"def terms\n\tend",
"def search_param_terms\n\t\t\tp = params.permit(:terms, :order)\n\t\t\tp['terms']\n\t\tend",
"def term_name\n self.content\n end",
"def term_qa_replacement_encoded?(pattern_key)\n map_key = term_qa_replacement_patterns[pattern_key].to_sym\n term_replacement_encoded? map_key\n end",
"def interpolation_options\n { resource_name: @term.display_name }\n end",
"def term_to_query(term)\n \"%#{term}%\"\nend",
"def update!(**args)\n @suggested_query = args[:suggested_query] if args.key?(:suggested_query)\n end",
"def update!(**args)\n @suggested_query = args[:suggested_query] if args.key?(:suggested_query)\n end",
"def suggest\n Hash[@solr_data[:spellcheck]['suggestions']]['collation']\n end",
"def characterization_terms(omdoc)\n h = {}\n omdoc.class.terminology.terms.each_pair do |key, target|\n # a key is a proxy if its target responds to proxied_term\n next unless target.respond_to? :proxied_term\n begin\n h[key] = omdoc.send(key)\n rescue NoMethodError\n next\n end\n end\n h.delete_if { |_k, v| v.empty? }\n end",
"def term_params\n params.require(:term).permit(:name)\n end",
"def show_everything(solr_parameters)\n solr_parameters[:fq] ||= []\n solr_parameters[:fq] << 'internal_resource_ssim:(\"Collection::Archival\" OR \"Collection::Library\"' \\\n 'OR \"Collection::Curated\" OR \"Work::Submission\" OR \"Work::FileSet\")'\n end",
"def terms\n raise NotImplementedError\n end",
"def termsig(*) end",
"def term_qa_replacement_patterns\n Config.config_value(term_config, :qa_replacement_patterns)\n end",
"def term=(term)\n @term = term\n @twitter_search = nil\n load_words\n end",
"def get_term_details\n # This query ensures we look at the most recent fully loaded ontologies\n sql = <<-SQL\n select term.*\n from term\n join ontology on ontology.ontology_id = term.ontology_id\n where term.identifier = ?\n order by ontology.fully_loaded desc, ontology.load_date asc\n SQL\n \n term_set = OLS_DB[ sql, @name ].all()\n \n if term_set.size == 0\n get_term_from_synonym\n else\n subject = term_set.first\n @content = subject[:term_name]\n @term_pk = subject[:term_pk]\n @ontology_id = subject[:ontology_id]\n end\n end",
"def ocr_search_params(solr_parameters = {})\n solr_parameters[:facet] = false\n solr_parameters[:hl] = true\n solr_parameters[:'hl.fl'] = blacklight_config.ocr_search_field\n solr_parameters[:'hl.fragsize'] = 135\n solr_parameters[:'hl.snippets'] = 10\n end",
"def has_search_parameters?\n result = super || !params[:t].blank? || !params[:l].blank? || !params[:resolve].blank?\n end",
"def terms_for_display\n # 'type' is the RDF.type assertion, which is not present by default, but may be\n # provided in some RDF schemas\n self.descMetadata.class.fields + [:tags] - [:tag]\n end",
"def search_terms=(value)\n @search_terms = value\n end",
"def describe_search_if_present\n if params[:q].present?\n return \"matching “#{h params[:q]}”\".html_safe\n end\n end",
"def modify_search_query\n query_data = params['q'] && params['q'][Garage::SearchPredicate]\n if query_data.present?\n params['q'][Garage::SearchPredicate] = query_data.split(' ')\n end\n end",
"def has_search_parameters?\n params[:mlt_id].present? || super\n end",
"def find_terms(doc)\n terms_match = @terms.select { |term| doc.join('').match(term.to_s) }\n\n terms_match.map do |term, definition|\n \"*[#{term}]: #{definition}\".delete(\"\\t\\r\\n\").squeeze(' ').strip\n end\nend",
"def sanskrit_term_params\n params.require(:sanskrit_term).permit(:term, :definition)\n end",
"def add_full_text_context(params)\n return unless blacklight_params[:q].present?\n\n params['hl'] = true\n params['hl.fl'] ||= []\n params['hl.fl'] << 'extracted_text_tsimv'\n end",
"def term_subauthority_replacement_pattern\n return {} unless term_subauthorities?\n @term_subauthority_replacement_pattern ||= {} if term_config.nil? || !term_subauthorities?\n pattern = term_qa_replacement_patterns[:subauth]\n @term_subauthority_replacement_pattern ||= { pattern: pattern, default: term_url_mappings[pattern.to_sym][:default] }\n end",
"def term(string)\n @request.q = string\n end",
"def project_entry_params\n params.permit(:term)\n end",
"def search_any_term\n render json: Article.with_any_terms(params[:query]).map(&:title)\n end",
"def search_all_terms\n render json: Article.with_all_terms(params[:query]).map(&:title)\n end",
"def read_terms\n object.tnc_last_accepted.present?\n end",
"def show_past_term # :nologin: :prefetch: :norobots:\n pass_query_params\n store_location\n if @term = find_or_goto_index(Term, params[:id].to_s)\n if params[:version]\n @term.revert_to(params[:version].to_i)\n else\n flash_error(:show_past_location_no_version.t)\n redirect_to(:action => show_term, :id => @term.id)\n end\n end\n end",
"def update\n respond_to do |format|\n if @neglected_term.update(neglected_term_params)\n format.html { redirect_to @neglected_term, notice: 'Neglected term was successfully updated.' }\n format.json { render :show, status: :ok, location: @neglected_term }\n else\n format.html { render :edit }\n format.json { render json: @neglected_term.errors, status: :unprocessable_entity }\n end\n end\n end",
"def lookup(name, options = {})\n options = Term.specialize(options)\n\n options[:name] = name = name.to_s\n options[:form] = 'long' unless options.key?(:form)\n\n # NB: currently only ordinals support gender-forms\n options.delete(:'gender-form')\n\n candidates = registry[name]\n return if candidates.empty?\n\n # loop terminates when a matching term is found or\n # when there are no more form fallbacks left\n while true do\n term = candidates.detect { |t| t.match?(options) }\n return term unless term.nil?\n\n fallback = Term.form_fallbacks[options[:form].to_s]\n return if fallback == options[:form]\n\n options[:form] = fallback\n end\n end",
"def hidden_field_terms\n Sufia.config.makers.keys\n end",
"def fetch_custom_search_params; end",
"def hidden_field_terms\n [:after,\n :artist,\n :attributed_to,\n :author,\n :addressee,\n :creator_of_work,\n :contributor,\n :editor,\n :engraver,\n :interviewee,\n :interviewer,\n :manner_of,\n :school_of,\n :manufacturer,\n :photographer,\n :printer,\n :printer_of_plates,\n :publisher,\n :place_of_interview,\n :place_of_manufacture,\n :place_of_publication,\n :place_of_creation]\n end",
"def update!(**args)\n @suggestions = args[:suggestions] if args.key?(:suggestions)\n end",
"def update!(**args)\n @suggestions = args[:suggestions] if args.key?(:suggestions)\n end",
"def update!(**args)\n @suggestions = args[:suggestions] if args.key?(:suggestions)\n end",
"def common_term_params\n params.require(:common_term).permit(:search_term, :pages)\n end",
"def gated_discovery_filters\n return super if @access != :deposit\n [\"{!terms f=id}#{admin_set_ids_for_deposit.join(',')}\"]\n end",
"def update!(**args)\n @snippet_query_term_coverage = args[:snippet_query_term_coverage] if args.key?(:snippet_query_term_coverage)\n @title_query_term_coverage = args[:title_query_term_coverage] if args.key?(:title_query_term_coverage)\n @title_snippet_query_term_coverage = args[:title_snippet_query_term_coverage] if args.key?(:title_snippet_query_term_coverage)\n end",
"def update!(**args)\n @bigram_discount_tf = args[:bigram_discount_tf] if args.key?(:bigram_discount_tf)\n @bigramness = args[:bigramness] if args.key?(:bigramness)\n @centrality = args[:centrality] if args.key?(:centrality)\n @corrected_tf = args[:corrected_tf] if args.key?(:corrected_tf)\n @expected_tf = args[:expected_tf] if args.key?(:expected_tf)\n @global_npmi = args[:global_npmi] if args.key?(:global_npmi)\n @idf = args[:idf] if args.key?(:idf)\n @is_bigram = args[:is_bigram] if args.key?(:is_bigram)\n @label = args[:label] if args.key?(:label)\n @local_npmi = args[:local_npmi] if args.key?(:local_npmi)\n @observed_tf = args[:observed_tf] if args.key?(:observed_tf)\n @original_term = args[:original_term] if args.key?(:original_term)\n @raw_tf = args[:raw_tf] if args.key?(:raw_tf)\n @salience = args[:salience] if args.key?(:salience)\n @source = args[:source] if args.key?(:source)\n end",
"def add_term_filters\n body.filter(:term, posted: true)\n body.filter(:term, hidden_by_admin: false)\n body.filter(:term, restricted: false) unless include_restricted?\n body.filter(:term, unrevealed: false) unless include_unrevealed?\n body.filter(:term, anonymous: false) unless include_anon?\n body.filter(:term, chapter_count: 1) if options[:single_chapter]\n\n %i(complete language crossover).map do |field|\n value = options[field]\n body.filter(:term, field => value) unless value.nil?\n end\n add_tag_filters\n end",
"def relevancy_param(params)\n params[:sort_key] = ['has_granules']\n # sensor, archive_center and two_d_coordinate_system_name were removed from the available facets but it doesn't\n # hurt to list them here though.\n relevancy_capable_fields = [:keyword, :free_text, :platform, :instrument, :sensor, :two_d_coordinate_system_name,\n :science_keywords, :project, :processing_level_id, :data_center, :archive_center]\n if (params.keys & relevancy_capable_fields.map(&:to_s)).empty?\n params[:sort_key].push 'entry_title'\n else\n params[:sort_key].push 'score'\n end\n end",
"def substitute_entities=(value = true)\n Document.substitute_entities = value\n end",
"def set_search_terms\n if relevent_dish\n self.search_terms = self.name_translations.collect do |key,value|\n next value\n end.join(\" \")\n if self.restaurant\n self.restaurant_name = self.restaurant.name\n end\n if img = self.image.first\n self.top_image = img.img_url_medium\n end\n else\n self.search_terms = nil\n end\n save\n end",
"def update\n respond_to do |format|\n if @term.update(term_params)\n format.html { redirect_to @term, notice: 'Term was successfully updated.' }\n format.json { render :show, status: :ok, location: @term }\n else\n format.html { render :edit }\n format.json { render json: @term.errors, status: :unprocessable_entity }\n end\n end\n end",
"def suggest\n end",
"def legit_feature\n return unless legit_feature?\n\n params[:feature]\n end",
"def update\n @term.update!(term_params)\n rescue => e\n render partial: \"shared/validation_messages\",\n locals: { object: @term.errors.any? ? @term : e },\n status: :bad_request\n else\n toast!(title: \"Term updated\",\n message: \"The vocabulary term \\\"#{@term.displayed_value}\\\" has \"\\\n \"been updated.\")\n render \"shared/reload\"\n end",
"def update!(**args)\n @is_bypassed_name = args[:is_bypassed_name] if args.key?(:is_bypassed_name)\n @is_compound_name = args[:is_compound_name] if args.key?(:is_compound_name)\n @is_compound_retrieval_key = args[:is_compound_retrieval_key] if args.key?(:is_compound_retrieval_key)\n @is_dictionary_term = args[:is_dictionary_term] if args.key?(:is_dictionary_term)\n @is_event_retrieval_key = args[:is_event_retrieval_key] if args.key?(:is_event_retrieval_key)\n @is_generated_name = args[:is_generated_name] if args.key?(:is_generated_name)\n @is_generated_streetname = args[:is_generated_streetname] if args.key?(:is_generated_streetname)\n @is_hierarchy_propagated = args[:is_hierarchy_propagated] if args.key?(:is_hierarchy_propagated)\n @is_isbn = args[:is_isbn] if args.key?(:is_isbn)\n @is_lyrics_content = args[:is_lyrics_content] if args.key?(:is_lyrics_content)\n @is_phone_number = args[:is_phone_number] if args.key?(:is_phone_number)\n @is_refcon_name = args[:is_refcon_name] if args.key?(:is_refcon_name)\n @is_reference_name = args[:is_reference_name] if args.key?(:is_reference_name)\n @is_refpage_url = args[:is_refpage_url] if args.key?(:is_refpage_url)\n @is_reverse_unique_property_name = args[:is_reverse_unique_property_name] if args.key?(:is_reverse_unique_property_name)\n @is_strong_identifier = args[:is_strong_identifier] if args.key?(:is_strong_identifier)\n @is_synonym_or_fuzzy_match = args[:is_synonym_or_fuzzy_match] if args.key?(:is_synonym_or_fuzzy_match)\n @is_trusted_allcaps_name = args[:is_trusted_allcaps_name] if args.key?(:is_trusted_allcaps_name)\n @is_unnormalized_name = args[:is_unnormalized_name] if args.key?(:is_unnormalized_name)\n @not_generated_name = args[:not_generated_name] if args.key?(:not_generated_name)\n @original_names = args[:original_names] if args.key?(:original_names)\n @suppress_tokenization = args[:suppress_tokenization] if args.key?(:suppress_tokenization)\n end",
"def parameters_double_registry; end",
"def suggest\n # For some reason, Rails is not respecting the include_root_in_json for this action. So need to specify manually.\n render(:root => false, :json => OptionSuggester.new.suggest(current_mission, params[:q]).as_json(:for_option_set_form => true))\n end",
"def apply_gated_discovery(solr_parameters, user_parameters)\n solr_parameters[:fq] ||= []\n solr_parameters[:fq] << gated_discovery_filters.join(\" OR \")\n logger.debug(\"Solr parameters: #{ solr_parameters.inspect }\")\n end",
"def terms_id\n parse_terms_id_response(SolrQuery.new.solr_query(q='rdftype_tesim:\"http://www.w3.org/2004/02/skos/core#ConceptScheme\" AND preflabel_tesim:\"places\"'))\n end",
"def prepare_suggested_searches\n @suggested_searches = [\n # { label_key: 'search_suggestion_whale_mass',\n # params: {\n # sort: 'desc',\n # min: 10000,\n # taxon_concept_id: 7649,\n # attribute: 'http://purl.obolibrary.org/obo/VT_0001259',\n # unit: 'http://purl.obolibrary.org/obo/UO_0000009' }},\n # { label_key: 'search_suggestion_cavity_nests',\n # params: {\n # q: 'cavity',\n # attribute: 'http://eol.org/schema/terms/NestType' }},\n { label_key: 'search_suggestion_diatom_shape',\n params: {\n attribute: 'http://purl.obolibrary.org/obo/OBA_0000052',\n taxon_concept_id: 3685 }} #,\n # { label_key: 'search_suggestion_blue_flowers',\n # params: {\n # q: 'http://purl.obolibrary.org/obo/PATO_0000318',\n # attribute: 'http://purl.obolibrary.org/obo/TO_0000537' }}\n ]\n end"
] | [
"0.6010386",
"0.57534367",
"0.5718806",
"0.5673127",
"0.56246346",
"0.55411404",
"0.5516069",
"0.5513188",
"0.54924035",
"0.54756874",
"0.54684055",
"0.54171485",
"0.5373414",
"0.53592384",
"0.535789",
"0.535789",
"0.535762",
"0.535565",
"0.53330994",
"0.53172326",
"0.5297368",
"0.52814233",
"0.5271155",
"0.5264983",
"0.5249009",
"0.52468175",
"0.5243514",
"0.5234244",
"0.5233716",
"0.52319044",
"0.52152604",
"0.52152604",
"0.51980054",
"0.5194161",
"0.51743776",
"0.51743776",
"0.5158927",
"0.51556927",
"0.5154895",
"0.5154483",
"0.5127968",
"0.51137066",
"0.5110913",
"0.51074976",
"0.51074475",
"0.5105499",
"0.5104718",
"0.5104718",
"0.50946957",
"0.5067938",
"0.506229",
"0.5058376",
"0.50496244",
"0.5025108",
"0.49955377",
"0.49935278",
"0.49922875",
"0.49736083",
"0.4971338",
"0.4969882",
"0.4966899",
"0.49646968",
"0.49645397",
"0.49613893",
"0.49559504",
"0.49530327",
"0.49502355",
"0.49490017",
"0.49420336",
"0.49393123",
"0.4932511",
"0.49297974",
"0.49099976",
"0.490977",
"0.48987937",
"0.48942107",
"0.48924544",
"0.48908883",
"0.4889182",
"0.48848236",
"0.48835897",
"0.48835742",
"0.48781997",
"0.48723853",
"0.48715746",
"0.48707885",
"0.48658273",
"0.48630548",
"0.4860161",
"0.4852132",
"0.4850662",
"0.48490104",
"0.48483747",
"0.48474678",
"0.48436612",
"0.48429608",
"0.48388696",
"0.4838731",
"0.4837289",
"0.48347956"
] | 0.5932273 | 1 |
Should the replacement parameter be encoded? | def term_replacement_encoded?(map_key)
return false unless term_url_mappings[map_key].key? :encode
term_url_mappings[map_key][:encode]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reencode_string(input); end",
"def encode_string_ex; end",
"def replace(input, string, replacement = T.unsafe(nil)); end",
"def replace\n end",
"def normalize_encode_params(params); end",
"def term_qa_replacement_encoded?(pattern_key)\n map_key = term_qa_replacement_patterns[pattern_key].to_sym\n term_replacement_encoded? map_key\n end",
"def encode_options\n {invalid: :replace, undef: :replace, replace: '?'}\n end",
"def string_replacements\nend",
"def param_encoding(action, param, encoding); end",
"def scramble_unencode_unescaped(param)\n param && SimpleScramble.unscramble(param)\n end",
"def skip_parameter_encoding(action); end",
"def replacements; end",
"def replace(p0) end",
"def replace(p0) end",
"def replace(p0) end",
"def encode_string; end",
"def encode(string); end",
"def encode!; end",
"def encode_parameters(**prm)\n encode_parameters!(prm)\n end",
"def char_replace!(str, hash)\n\nend",
"def _encode(source)\n source.gsub(' ','_').gsub(/%.<.+?>/) { |match|\n CGI.escape(match[3..-2]).gsub('%', match[1..1])\n }\n end",
"def scramble_unencode(param)\n param && SimpleScramble.unscramble(CGI.unescape(param))\n end",
"def encoding=(_arg0); end",
"def encoding=(_arg0); end",
"def encoding=(_arg0); end",
"def encoding=(_arg0); end",
"def encoding=(_arg0); end",
"def encoding=(_arg0); end",
"def encoding=(_arg0); end",
"def additional_encoding(s)\n encoding_hash = {\":\" => \"%3A\", \"+\" => \"%2B\"}\n encoding_hash.each_pair do |k, v|\n s.gsub!(k, v)\n end\n s\n end",
"def encode_method(method)\n method.gsub('?', '-')\n end",
"def encode_method(method)\n method.gsub('?', '-')\n end",
"def quoteparam_part(part); part.gsub('&&', \"\\x00\\x00\\x00\").gsub(\"|\", \"\\x00\\x00\"); end",
"def visit_ParameterNode(o)\n unless @preserved_identifiers.include?(o.value)\n o.value = JSObfu::Utils::random_var_encoding(rename_var(o.value))\n end\n\n super\n end",
"def encode(word)\n word.gsub(/[aeiou]/, 'a' => 1, 'e' => 2, 'i' => 3, 'o' => 4,\n 'u' => 5)\nend",
"def as_replacements; end",
"def as_replacements; end",
"def as_replacements; end",
"def encode(text); end",
"def encode(text); end",
"def uri_escape(input); end",
"def encode_parameter(key)\n IGNORED_PARAMETERS.include?(key) ? \"_#{key}\".to_sym : key\n end",
"def escape(string); end",
"def key_replace\n /[^a-z0-9?]+/\n end",
"def replace_vowels_with_question_mark(word)\nend",
"def scramble_encode(param)\n CGI.escape(SimpleScramble.scramble(param))\n end",
"def replace_this_with_appropriate_code(x) end",
"def encode_param text\n CGI::escape(text).gsub(\"+\", \"%20\").gsub(\"%\", \"%25\")\n end",
"def encode!(*); self; end",
"def encode\n transform :encode \n end",
"def encode_parameters!(prm)\n prm.transform_keys! { |k| encode_parameter(k) }\n end",
"def escape(str); end",
"def safe_encode value\n value = URI.encode_www_form_component(value).gsub(/\\+/,'%20').gsub(/\\*/,'%2A').gsub(/%7E/,'~')\n end",
"def test_entity_replacement\n\tt = NQXML::Tokenizer.new('')\n\n\t# add a method that lets us set the internal entity hash\n\tclass << t\n\t def testSetInternalEntities(h); @internalEntities = h; end\n\tend\n\n\tt.testSetInternalEntities({ # as if we saw <!ENTITY...> tags\n\t 'a' => '&b;',\n\t 'b' => '&foo;',\n\t 'foo' => '&bar;',\n\t 'bar' => 'bletch',\n\t 'ugly' => 'An ampersand (&) may be escaped' +\n\t\t\t' numerically (&#38;) or with a general' +\n\t\t\t' entity (&amp;).'\n\t})\n\n\tassert_equal('x <&> x', t.replaceAllRefsButParams('x <&> x'))\n\tassert_equal('x \"\\' x', t.replaceAllRefsButParams('x "' x'))\n\tassert_equal('x A x', t.replaceAllRefsButParams('x A x'))\n\tassert_equal('x A x', t.replaceAllRefsButParams('x A x'))\n\tassert_equal('&&', t.replaceAllRefsButParams('&&'))\n\n\tassert_equal('&', t.replaceAllRefsButParams('&'))\n\tassert_equal('&', t.replaceAllRefsButParams('&'))\n\n\tassert_equal('bletch', t.replaceAllRefsButParams('&bar;'))\n\tassert_equal('bletch', t.replaceAllRefsButParams('&foo;'))\n\tassert_equal('bletch', t.replaceAllRefsButParams('&b;'))\n\tassert_equal('bletch', t.replaceAllRefsButParams('&a;'))\n\n\tassert_equal('An ampersand (&) may be escaped' +\n\t\t ' numerically (&) or with a general' +\n\t\t ' entity (&).', t.replaceAllRefsButParams('&ugly;'))\n\n\t# Make sure unknown entities raise an error\n\texpect_error('x &huh; x', /entity reference '&huh;' is undefined/)\n end",
"def test_gsub\n assert_equal 'éxa', 'éda'.chars.gsub(/d/, 'x')\n with_kcode('none') do\n assert_equal 'éxa', 'éda'.chars.gsub(/d/, 'x')\n end\n end",
"def fix_encoding_errors!\n gsub!(BAD_ENCODING_PATTERNS) { |substring| BAD_ENCODING[substring] || substring } || self\n end",
"def url_encode(param)\n URI.escape(param, Regexp.new(\"[^#{URI::PATTERN::UNRESERVED}]\"))\n end",
"def add_encoded_extension(encoded); end",
"def escape_query_value(s)\n s.to_s.gsub(/([^ a-zA-Z0-9_.-]+)/u) {\n '%'+$1.unpack('H2'*bytesize($1)).join('%').upcase\n }.tr(' ', '+')\n end",
"def replaceParamRefs(str)\n\t return nil if str.nil?\n\t copy = str.dup\n\t replacement = ''\n\t while copy =~ /%([^%;]*);/mn\n\t\treplacement << $`\n\t\tref = $&\n\t\trefName = $1\n\t\tcopy = $'\n\t\tval = @paramEntities[refName]\n\t\tif val.nil?\n\t\t str = \"entity reference '#{ref}' is undefined\"\n\t\t raise ParserError.new(str, self)\n\t\tend\n\t\tval = replaceParamRefs(val)\n\t\treplacement << val\n\t end\n\t replacement << copy\n\t return replacement\n\tend",
"def escape_param(param) # :nodoc:\n URI::escape(param.to_s, Regexp.new(\"[^#{URI::PATTERN::UNRESERVED}]\"))\n end",
"def tricky_method_two(a_string_param, an_array_param)\n a_string_param.gsub!('pumpkins', 'rutabega')\n an_array_param = ['pumpkins', 'rutabega']\nend",
"def encoding(encoding); end",
"def encodeURI s\n URI.escape s, /[^A-Za-z0-9;,\\/?:@&=+$\\-_.!~*'()#]/\nend",
"def tricky_method_two(a_string_param, an_array_param)\n a_string_param.gsub!('pumpkins', 'pumpkinsrutabaga')\n an_array_param = ['pumpkins', 'rutabaga']\nend",
"def shorten\n encode\n end",
"def tricky_method_two(a_string_param, an_array_param)\n a_string_param.gsub!('pumpkins', 'rutabaga')\n an_array_param = ['pumpkins', 'rutabaga']\nend",
"def tricky_method_two(a_string_param, an_array_param)\n a_string_param.gsub!('pumpkins', 'rutabaga')\n an_array_param = ['pumpkins', 'rutabaga']\nend",
"def tricky_method_two(a_string_param, an_array_param)\n a_string_param.gsub!('pumpkins', 'rutabaga')\n an_array_param = ['pumpkins', 'rutabaga']\nend",
"def tricky_method_two(a_string_param, an_array_param)\n a_string_param.gsub!('pumpkins', 'rutabaga')\n an_array_param = ['pumpkins', 'rutabaga']\nend",
"def encoder=(_arg0); end",
"def replace_country_code( value )\n $COUNTRIES.each do |record|\n # Replace country code with emoji using gsub\n # Use interpolation with regex then compare the variable with i option to ignore case sensitivity \n value = value.gsub(/#{record[:code]}/i, record[:code].flag_emoji+\" \") # I chose not to use gsub with ! because it was modifying the reference variable\n end\n return value\nend",
"def to_utf8!; replace(to_utf8); end",
"def encode_params(log_msg)\n params_patterns = \"(#{ENCODE_PARAMS.join('|')})=\\\\w+\"\n log_msg.gsub(Regexp.new(params_patterns)) { |match| hide_value(match).to_s }\n end",
"def perform_substitutions(input)\n @data[:presubs].each { |s| input.gsub!(s[0], s[1]) }\n input\nend",
"def encode_char(immune,input)\n return input if immune.include?(input)\n return input if hex(input).nil?\n return \"#{@escape_char}#{input}\"\n end",
"def force_encoding(*args) settings.force_encoding(*args) end",
"def hex_encode_keywords\n if self =~ /(select)/i\n foo=$1\n newstr = self.gsub(foo, foo.gsub(/e/i, \"%#{'e'.hexme}\"))\n else\n newstr = self\n end\n if newstr =~ /(update)/i\n foo=$1\n newstr = newstr.gsub!(foo, foo.sub(/p/i, \"%#{'p'.hexme}\"))\n end\n if newstr =~ /(insert)/i\n foo=$1\n newstr = newstr.gsub!(foo, foo.sub(/s/i, \"%#{'s'.hexme}\"))\n end\n if newstr =~ /(delete)/i\n foo=$1\n newstr = newstr.gsub!(foo, foo.sub(/l/i, \"%#{'l'.hexme}\"))\n end\n if newstr =~ /(union)/i\n foo=$1\n newstr = newstr.gsub!(foo, foo.gsub(/n/i, \"%#{'n'.hexme}\"))\n end\n if newstr =~ /[, ](concat)/i\n foo=$1\n newstr = newstr.gsub!(foo, foo.gsub(/c/i, \"%#{'c'.hexme}\"))\n end\n if newstr =~ /(group_concat)/i\n foo=$1\n newstr = newstr.gsub!(foo, foo.gsub(/o/i, \"%#{'o'.hexme}\"))\n end\n if newstr =~ /(information_schema)/i\n foo=$1\n newstr = newstr.gsub!(foo, foo.gsub(/a/i, \"%#{'a'.hexme}\"))\n end\n if newstr =~ /(cast)/i\n foo=$1\n newstr = newstr.gsub!(foo, foo.sub(/t/i, \"%#{'t'.hexme}\"))\n end\n if newstr =~ /(convert)/i\n foo=$1\n newstr = newstr.gsub!(foo, foo.sub(/v/i, \"%#{'v'.hexme}\"))\n end\n if newstr =~ /(substring)/i\n foo=$1\n newstr = newstr.gsub!(foo, foo.gsub(/s/i, \"%#{'s'.hexme}\"))\n end\n if newstr =~ /(sleep)/i\n foo=$1\n newstr = newstr.gsub!(foo, foo.sub(/p/i, \"%#{'p'.hexme}\"))\n end\n if newstr =~ /(benchmark)/i\n foo=$1\n newstr = newstr.gsub!(foo, foo.sub(/b/i, \"%#{'b'.hexme}\"))\n end\n return newstr\n end",
"def escape(s); s.to_s.gsub(/([^ a-zA-Z0-9_.-]+)/n){'%'+$1.unpack('H2'*$1.size).join('%').upcase}.tr(' ', '+') end",
"def with_repl_like_sigint; end",
"def escape(string)\n #This is a stub, used for indexing\n end",
"def tricky_method_two(a_string_param, an_array_param)\n a_string_param.gsub!('pumpkins', 'rutabaga')\n an_array_param = ['pumpkins', 'rutabaga']\n end",
"def tricky_method_two(a_string_param, an_array_param)\n a_string_param.gsub!('pumpkins', 'rutabaga')\n an_array_param = ['pumpkins', 'rutabaga']\n end",
"def safe_parameterize(str)\n sep = '-'\n\n # Reimplementation of http://api.rubyonrails.org/classes/ActiveSupport/Inflector.html#method-i-parameterize that preserves un-transliterate-able multibyte chars.\n parameterized_string = ::ActiveSupport::Inflector.transliterate(str.to_s).downcase\n parameterized_string.gsub!(/[^a-z0-9\\-_\\?]+/, sep)\n\n parameterized_string.chars.to_a.each_with_index do |char, i|\n next unless char == '?' && str[i].bytes.count != 1\n parameterized_string[i] = str[i]\n end\n\n re_sep = ::Regexp.escape(sep)\n # No more than one of the separator in a row.\n parameterized_string.gsub!(/#{re_sep}{2,}/, sep)\n # Remove leading/trailing separator.\n parameterized_string.gsub!(/^#{re_sep}|#{re_sep}$/, '')\n\n parameterized_string\n end",
"def escape_special_chars(data)\n data = data.dup\n data.gsub! /&/n , \"&\"\n data.gsub! /\\\"/n , \""\"\n data.gsub! />/n , \">\"\n data.gsub! /</n , \"<\"\n data.gsub! /'/ , \"'\"\n return data\n end",
"def protect_encoding(x)\n x.encode('UTF-8', 'binary', invalid: :replace, undef: :replace, replace: '')\n end",
"def ensure_correct_encoding!(val)\n if @eval_string.empty? &&\n val.respond_to?(:encoding) &&\n val.encoding != @eval_string.encoding\n @eval_string.force_encoding(val.encoding)\n end\n end",
"def replace_encoded(str, regex)\n str.scan(regex).each do |x|\n str = str.sub(\"#{x[0]}[#{x[1]}]\", x[1] * x[0].to_i)\n end\n str\nend",
"def encode(*); self; end",
"def escape(string)\n string.gsub(/([^ a-zA-Z0-9_.-]+)/n) do\n '%' + $1.unpack('H2' * $1.size).join('%').upcase\n end.tr(' ', '+')\t\n\tend",
"def force_encoding(*); self; end",
"def unicode_filter_encode(str)\n self.encode_unicode ? Rex::Text.unicode_filter_encode(str) : str\n end",
"def encode_code( str, rs )\n\t\t\t#str.gsub( %r{&}, '&' ).\n\t\t\t\t#gsub( %r{<}, '<' ).\n\t\t\t\t#gsub( %r{>}, '>' ).\n\t\t\t\t#gsub( CodeEscapeRegexp ) {|match| EscapeTable[match][:md5]}\n return str\n\t\tend",
"def singleq2utf\n self.gsub(\"'\", '%EF%BC%87')\n end",
"def utf8_enforcer_tag; end",
"def normalize_parameter_name(name)\n name.gsub(/[\\&\\*\\$\\[\\]\\:]/, '')\n end",
"def escape(string)\n string.gsub(/([^ a-zA-Z0-9_.-]+)/) do\n $1.nil? ? nil : ('%' + $1.unpack('H2' * $1.bytesize).\n compact.join('%').upcase)\n end.tr(' ','+')\nend",
"def encode_key(key)\n @uri_parser.escape(key, /[^-_.a-zA-Z0-9]/n) # //n switch means explicit 'ASCII-8BIT' pattern\n end",
"def encode_bson_with_placeholder(encoded = \"\".force_encoding(BINARY))\n encoded << PLACEHOLDER\n yield(encoded)\n encoded << NULL_BYTE\n encoded[0, 4] = encoded.bytesize.to_bson\n encoded\n end",
"def escape input, regexp, map\n input.gsub(regexp) { | char | map[char] || char }\n end"
] | [
"0.67503697",
"0.66480947",
"0.65140265",
"0.64896667",
"0.64593476",
"0.6415307",
"0.6285969",
"0.6257486",
"0.6235421",
"0.6230398",
"0.62216794",
"0.6167915",
"0.6162557",
"0.6162557",
"0.61597395",
"0.6130953",
"0.6097707",
"0.6089438",
"0.60717064",
"0.60704106",
"0.60696954",
"0.60524297",
"0.60032386",
"0.60032386",
"0.6003091",
"0.6003091",
"0.6003091",
"0.6003091",
"0.6003091",
"0.595749",
"0.59484047",
"0.59484047",
"0.5945475",
"0.58574414",
"0.58571106",
"0.58439016",
"0.58439016",
"0.58439016",
"0.58336955",
"0.58336955",
"0.58251256",
"0.581389",
"0.57978487",
"0.57759386",
"0.57701063",
"0.576771",
"0.5757648",
"0.57339954",
"0.5707971",
"0.5706581",
"0.57020867",
"0.5698369",
"0.56726205",
"0.56518453",
"0.5649802",
"0.563858",
"0.5637685",
"0.56351954",
"0.5633686",
"0.56029713",
"0.55997956",
"0.55990726",
"0.55964774",
"0.55826694",
"0.55754054",
"0.55688035",
"0.5568032",
"0.5568032",
"0.5568032",
"0.5568032",
"0.55673015",
"0.55621964",
"0.55595654",
"0.5550195",
"0.55292714",
"0.5525201",
"0.5523117",
"0.5519849",
"0.55106086",
"0.5499953",
"0.5482024",
"0.54795086",
"0.54712534",
"0.54705054",
"0.5468333",
"0.54670876",
"0.5461766",
"0.54582614",
"0.545218",
"0.5446327",
"0.5444266",
"0.5442626",
"0.54231906",
"0.54203045",
"0.5409128",
"0.5395622",
"0.53902906",
"0.53879523",
"0.5383728",
"0.5380928"
] | 0.6386572 | 6 |
Return the number of possible replacement values to make in the term URL | def term_replacement_count
term_replacements.size
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def count_of_url_in_seo(input)\n\t \tNonAdwordUrl.where(url: input).count\n\t end",
"def term_replacements?\n term_replacement_count.positive?\n end",
"def word_count\n @tried_solutions.length\n end",
"def nonadword_count_total(page)\n\t\tnonadword_urls(page).length\n\tend",
"def url_contains_adword_count(input)\n\t \tAdwordUrl.where(\"url LIKE ?\", \"%#{input}%\").count\n\t end",
"def params_size\n accum = 0\n @params.each do |p|\n accum += 1 if p.needs_word?\n end\n accum\n end",
"def number_of_expression_parts(login=nil)\n count_by_frbr(login, :contains, :how_many_expressions?) \n end",
"def nouns\n i = 0\n @synsets.each do |key, values|\n i += values.length\n end\n i\n end",
"def term_replacements\n return @term_replacements unless @term_replacements.nil?\n @term_replacements = {}\n @term_replacements = term_url_mappings.select { |k, _v| !term_qa_replacement_patterns.value?(k.to_s) } unless term_config.nil? || term_url_mappings.nil?\n @term_replacements\n end",
"def genre_count(term)\n #count the genres in object.get_genres\n genres = Hash.new(0)\n object.get_genres(term).each do |genre|\n case\n when genre.include?(\"rap\")\n genres[:rap]+=1\n when genre.include?(\"pop\")\n genres[:pop]+=1\n when genre.include?(\"country\")\n genres[:country]+=1\n when genre.include?(\"indie\")\n genres[:indie]+=1\n when genre.include?(\"hip\")\n genres[\"hip hop\"]+=1\n when genre.include?(\"rock\")\n genres[:rock]+=1\n when genre.include?(\"jazz\")\n genres[:jazz]+=1\n when genre.include?(\"instrumental\")\n genres[:instrumental]+=1\n when genre.include?(\"r&b\")\n genres[\"r&b\"]+=1\n else\n genres[:misc] +=1\n end\n end\n genres\n end",
"def noun_count\n 20\nend",
"def adword_count_right(page)\n\t\tadword_urls_right(page).length\n\tend",
"def countSubst(path)\n count = 0\n path.each do | atom |\n if @atoms[atom].size > 2 then\n count += (@atoms[atom].size - 2)\n end\n end\n count\n end",
"def value_count\n $capitals.values.length\nend",
"def num_urls\n @client[URLS_COLLECTION].count\n end",
"def number_of_concept_genres(login=nil)\n count_by_frbr(login, :has_as_its_genre, :how_many_concepts?) \n end",
"def number_of_concept_genres(login=nil)\n count_by_frbr(login, :has_as_its_genre, :how_many_concepts?) \n end",
"def getNumberOfSolutions; @solutions.length; end",
"def nr_of_words\n html_remove.split.size\n end",
"def rewrite_count\n TaliaCore::SemanticRelation.count + TaliaCore::ActiveSource.count\n end",
"def getNbRecompense\n return 0\n end",
"def get_new_term(new_term, num_of_terms)\n\tif new_term % 2 == 0\n\t\tnew_term /= 2\n\t\tnum_of_terms += 1\n\telse\n\t\tnew_term = 3 * new_term + 1\n\t\tnum_of_terms += 1\t\t\n\tend\n\n\treturn new_term, num_of_terms\nend",
"def find_counts()\n # Search through given fields for given text\n counts = Array.new\n find_text = @replace['replace']['find']\n @replace['replace']['tables'].each do |table, fields|\n query = find_query(find_text, table, fields.clone)\n @dbconn.query(query).each do |row|\n count_hash = {table: table, fields: fields, count: row['total']}\n counts.push count_hash\n end\n end\n counts\n end",
"def long_word_count(text)\n \nend",
"def size\n @patterns.size\n end",
"def total_terms\n return original_query_offset if normalized_page == 0\n (hits_requested * normalized_page) + original_query_offset\n end",
"def size\n return site_tags.length\n end",
"def word_count\n return words.size\n end",
"def number_of_concept_influences(login=nil)\n count_by_frbr(login, :is_influenced_by, :how_many_concepts?) \n end",
"def number_of_concept_influences(login=nil)\n count_by_frbr(login, :is_influenced_by, :how_many_concepts?) \n end",
"def num_of_choices(current_page, pages)\n\tchoices = 0\n\tpages.select { |k,v| choices += 1 if k.include?(\"~#{current_page}:c\")}\n\tchoices\nend",
"def word_count\n words.size\n end",
"def word_count\n words.size\n end",
"def possibilities\n @dictionary.length\n end",
"def phraseLength\n\t\treturn @dictionaries.length\n\tend",
"def word_instances(text)\n instances = Hash.new(0)\n normalize(text).each do |word|\n instances[word] += 1\n end\n instances\nend",
"def number_word_char_count\n (1..1000).map(&:english_word).join.count_chars\nend",
"def num_urls\n @client[:urls].count\n end",
"def word_count\n @@word_count\n end",
"def number_of_unique_words\n @frequencies.keys.length\n end",
"def get_lookup_count(word, *args)\n http_method = :get\n path = '/word/{word}/lookupCount'\n path.sub!('{word}', word.to_s)\n\n # Ruby turns all key-value arguments at the end into a single hash\n # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')\n # becomes {:limit => 10, :part_of_speech => 'verb'}\n last_arg = args.pop if args.last.is_a?(Hash)\n last_arg = args.pop if args.last.is_a?(Array)\n last_arg ||= {}\n\n # Look for a kwarg called :request_only, whose presence indicates\n # that we want the request itself back, not the response body\n if last_arg.is_a?(Hash) && last_arg[:request_only].present?\n request_only = true\n last_arg.delete(:request_only)\n end\n\n params = last_arg\n body ||= {}\n request = Wordnik::Request.new(http_method, path, :params => params, :body => body)\n request_only ? request : request.response.body\n end",
"def word_sizes(text)\n word_size = Hash.new(0)\n words = text.split\n words.each { |word| word_size[word.size] += 1 }\n word_size\nend",
"def destinations_with_multiplicities\n destinations.each_with_object(Hash.new(0)) do |word, counts|\n counts[word] += 1\n end\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 term_map\n\t\t\tterm_set = Hash.new(0)\n\t\t\tself.to_terms.each do |term|\n\t\t\t\tterm_set[term] = term_set[term] + 1\n\t\t\tend\n\t\t\tterm_set\n\t\tend",
"def num_unknown\n @num_unknown ||= num_researched - num_known\nend",
"def num_similar_links\n num_elements(\".sim a\")\n end",
"def wildcard_count\n @landmarks.flatten.select {|feature| feature.kind_of? Symbol}.size\n end",
"def number_of_internal_links_to_page(link)\n @ilps[link]\n end",
"def word_sizes(text)\n word_size = Hash.new(0)\n text.split.map do |word|\n word.delete \"^A-Za-z\"\n word_size[word.size] += 1\n end\n word_size\nend",
"def num_unique_words\n @frequencies.keys.length\n end",
"def num_sites\n if permission.value.positive?\n 'All sites'\n elsif connections.count.zero?\n 'No sites'\n elsif connections.count == 1\n '1 site'\n else\n \"#{connections.count} sites\"\n end\n end",
"def process\n tokenize(text).each do |word|\n token = TfIdfSimilarity::Token.new word\n if token.valid?\n @term_counts[token.lowercase_filter.classic_filter.to_s] += 1\n end\n end\n @size = term_counts.values.reduce(:+)\n end",
"def n_support\n @model[:sv_indices].size\n end",
"def word_sizes2(string)\n frequency = Hash.new(0) #set the default value to 0\n string.split.each do |word| \n frequency[word.length] += 1\n end\n frequency\nend",
"def count_occ(usages_list)\n count = 0\n usages_list.each do |k,v|\n if k['location']['type'] == 'pipeline'\n count += 1\n end\n end\n return count\nend",
"def nb_opinions() opinion_ids.size end",
"def symbolic_count(count); end",
"def exact_match_count\n (0..3).inject(0) do |count, index|\n count + (exact_match?(index) ? 1 : 0)\n end\n end",
"def numWords\n @words\n end",
"def num_custom_lookup_table_entries\n return @num_custom_lookup_table_entries unless @num_custom_lookup_table_entries.nil?\n if flags.has_custom_lookup_table\n @num_custom_lookup_table_entries = (num_custom_lookup_table_entries_m1 + 1)\n end\n @num_custom_lookup_table_entries\n end",
"def word_sizes(str)\n word_counts = Hash.new(0)\n str.gsub(/[^a-zA-Z ]/, '').split.each { |word| word_counts[word.length] += 1 }\n word_counts\nend",
"def for_web_urls\n self.fixed_length\n end",
"def number_of_concept_themes(login=nil)\n count_by_frbr(login, :has_as_its_theme, :how_many_concepts?) \n end",
"def number_of_concept_themes(login=nil)\n count_by_frbr(login, :has_as_its_theme, :how_many_concepts?) \n end",
"def word_number\n text.split.size\n end",
"def digit_count(titles)\n Math.log10(titles.size).to_i + 1\n end",
"def variants_idx; end",
"def number_of_syllables\n return (@words.map { |word| Helpfulness::PT::Syllable::syllables( word ).length }.inject(:+).to_f) || 0\n end",
"def word_count\n #need to modify regex to account for apostrophes\n text = (@text.gsub!(/\\W+|\\d/,' ').split(\" \"))\n word_count = Hash.new(0)\n text.each do |word|\n word = word.downcase\n word_count[word] +=1\n end\n word_count\n end",
"def arity\n @source.scan('*').count + 1\n end",
"def entity_expansion_count; end",
"def num_researched\n @num_researched ||= worth_counting { count_researched }\nend",
"def number_of_certifications(text)\n result = 0\n @certifications.each do |c|\n if text.downcase.include?(c)\n result += 1\n end\n end\n return result\nend",
"def count; @value.size; end",
"def number_of_presented_expressions(login=nil)\n count_by_frbr(login, :has_presented, :how_many_expressions?) \n end",
"def get_noun_words_count\n @redis.llen(\"store:nouns\").to_i\n end",
"def word_sizes(words)\n count_hash = Hash.new(0)\n words.split.each do |word|\n clean_word = word.delete('^a-zA-Z')\n count_hash[clean_word.size] += 1\n end\n count_hash\nend",
"def countWords(href)\n\n # Use mechanize to follow link and get contents\n mechanize = Mechanize.new\n mechanize.user_agent_alias = \"Windows Mozilla\"\n mechanize.agent.http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n mechanize.redirect_ok = true\n\n begin\n\n page = mechanize.get(href)\n\n rescue\n\n return { :Positive => 0, :Negative => 0, :Symbol => @symbol, :Date => Time.now.strftime(\"%d/%m/%Y\")}\n\n end\n\n # Use Nokogiri to get the HTML content of a link.\n # html_doc = Nokogiri::HTML(open(href,:allow_redirections => :all, ssl_verify_mode: OpenSSL::SSL::VERIFY_NONE))\n\n html_doc = Nokogiri::HTML(page.content)\n\n # Look for all <p> tags and store their contents\n paragraph = html_doc.css(\"p\").inner_text\n\n # Split the content in single sentences and store in array\n strings = Array[]\n strings = paragraph.split('.')\n\n #Counters for positive and negative words\n positiveCounter = 0\n negativeCounter = 0\n\n # Iterate the sentence array\n strings.each do |s|\n\n # If the sentence includes the @symbol or the @symbolName, split in single words\n if s.upcase.include?(@symbolName) or s.upcase.include?(@symbol)\n\n words = Array[]\n words = s.gsub(/\\s+/m, ' ').strip.split(\" \")\n\n # Iterate the words array\n words.each do |s2|\n\n # Count word if it equals a positive words\n @positiveWordsArray.each do |line|\n if s2.upcase == line\n Scraper.logger.info s2\n #puts s2\n positiveCounter = positiveCounter + 1\n end\n end\n\n # Count word if it equals a negative words\n @negativeWordsArray.each do |line|\n if s2.upcase == line\n Scraper.logger.info s2\n #puts s2\n negativeCounter = negativeCounter + 1\n end\n end\n\n end\n\n end\n\n end\n\n Scraper.logger.info positiveCounter\n Scraper.logger.info positiveCounter\n\n return { :Positive => positiveCounter, :Negative => negativeCounter, :Symbol => @symbol, :Date => Time.now.strftime(\"%d/%m/%Y\")}\n\n end",
"def term_replacement_encoded?(map_key)\n return false unless term_url_mappings[map_key].key? :encode\n term_url_mappings[map_key][:encode]\n end",
"def create_freq_regexs\n @frequency_regex = /#{word_frequency[0..10].join(\"|\")}/\n end",
"def count_word_occurrences(text = '')\n count = {}\n text.encode(@encoding).downcase.split.each do |word|\n stemmed_word = (@skip_stemming) ? word : word.stem_porter\n unless stopwords.include? stemmed_word\n count[stemmed_word] = count[stemmed_word] ? count[stemmed_word] + 1 : 1\n end\n end\n count\n end",
"def length\n words.reject { |w| w.rel == 'punct' }.length\n end",
"def _set_loop_count(replace)\n\t\treturn if(!replace.is_a?(Hash))\n\n\t\treplace.each {|key,|\n\t\t\tif(replace[key].is_a?(Array))\n\t\t\t\treplace[\"\\##{key}_count\"] = replace[key].length\n\t\t\t\tfor i in 0..replace[key].length\n\t\t\t\t\tself._set_loop_count(replace[key][i])\n\t\t\t\tend\n\t\t\tend\n\t\t}\n\tend",
"def number_of_descriptive_resources(login=nil)\n count_by_frbr(login, :is_described_by, :how_many_resources?) \n end",
"def number_of_descriptive_resources(login=nil)\n count_by_frbr(login, :is_described_by, :how_many_resources?) \n end",
"def start_of_terms\n return 0 if normalized_page == 0\n total_terms - hits_requested\n end",
"def size\n @size ||= languages.inject(0) { |s,(_,v)| s + v }\n end",
"def word_sizes(words)\n result_hash = Hash.new(0)\n words.split.each do |word| \n word = word.gsub(/[^a-z]/i,\"\")\n result_hash[word.length] += 1\n end\n result_hash\nend",
"def word_sizes(sentence)\n sentence.split.each_with_object(Hash.new(0)) { |word, obj| obj[word.size] += 1 } \nend",
"def number_of_targets(index)\n @all[index].to_hash[\"fields\"].select{|field| field.keys.first == \"866\" }.size\n end",
"def word_count\n word_map = {}\n words.each {|word| word_map[word] = words.count(word) }\n word_map\n end",
"def number_of_chars\n html_remove.without_garbage.split(\"\\n\").join.split.join.length\n end",
"def count\n values.inject(0){|m, v| m + v.length}\n end",
"def nqueries\n @nqueries ||= section_names.select {|name| name =~ /query/ }.length\n end",
"def word_length\n\t\t@ans_word.length\n\tend",
"def request_count; end",
"def url_search_terms\n if openbis?\n []\n else\n super\n end\n end",
"def request_count=(_arg0); end",
"def num_records\n num_urls + num_docs\n end"
] | [
"0.60595226",
"0.5989144",
"0.58407545",
"0.5704308",
"0.56784153",
"0.5633429",
"0.5622745",
"0.54799354",
"0.5425366",
"0.5361639",
"0.5361229",
"0.5356592",
"0.52727115",
"0.5229313",
"0.5228294",
"0.5195668",
"0.5195668",
"0.51910275",
"0.51777726",
"0.51773554",
"0.5171646",
"0.51365715",
"0.5129006",
"0.5126807",
"0.5126432",
"0.5117877",
"0.51117176",
"0.5108266",
"0.51076144",
"0.51076144",
"0.51030844",
"0.509999",
"0.509999",
"0.5083248",
"0.50716573",
"0.50701284",
"0.5066418",
"0.5062642",
"0.50486344",
"0.5044762",
"0.50418043",
"0.5038265",
"0.5037688",
"0.5019859",
"0.5016801",
"0.50122744",
"0.5002154",
"0.4995882",
"0.4987941",
"0.49850807",
"0.4981516",
"0.49758074",
"0.49743968",
"0.49596238",
"0.49571228",
"0.49534884",
"0.49437425",
"0.4941161",
"0.49333876",
"0.49326614",
"0.49323595",
"0.49301195",
"0.49252555",
"0.49213517",
"0.49198428",
"0.49164996",
"0.4913388",
"0.4905994",
"0.49051476",
"0.49009952",
"0.4900993",
"0.4896981",
"0.48895055",
"0.48886874",
"0.48875248",
"0.4885961",
"0.48855326",
"0.48723203",
"0.4870511",
"0.48700735",
"0.48698768",
"0.4866193",
"0.48601744",
"0.48600417",
"0.48592493",
"0.48592493",
"0.4856936",
"0.48524377",
"0.48523843",
"0.4851309",
"0.48475474",
"0.48440304",
"0.48413807",
"0.48390812",
"0.48390675",
"0.4834817",
"0.48275322",
"0.48259985",
"0.48222736",
"0.48145938"
] | 0.76797587 | 0 |
Return the replacement configurations | def term_replacements
return @term_replacements unless @term_replacements.nil?
@term_replacements = {}
@term_replacements = term_url_mappings.select { |k, _v| !term_qa_replacement_patterns.value?(k.to_s) } unless term_config.nil? || term_url_mappings.nil?
@term_replacements
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def as_replacements; end",
"def as_replacements; end",
"def as_replacements; end",
"def replaces\n @replaces ||= []\n end",
"def replaces\n @replaces ||= []\n end",
"def configurations; end",
"def matched_configs\n [@full_config['environments'][environment], @full_config['nodes'][fqdn]]\n end",
"def configurations\n @configurations ||= []\n end",
"def configurations\n return @configurations if @configurations\n \n configurations = CONFIGURATIONS_CLASS.new\n configurations.extend(IndifferentAccess) if @use_indifferent_access\n \n ancestors.reverse.each do |ancestor|\n next unless ancestor.kind_of?(ClassMethods)\n ancestor.config_registry.each_pair do |key, value|\n if value.nil?\n configurations.delete(key)\n else\n configurations[key] = value\n end\n end\n end\n \n configurations\n end",
"def replacements; 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 configuration\n cfg = []\n @entries.each {|e| cfg.push(e.source)}\n return(cfg)\n end",
"def pool_configurations\n ActiveRecord::Base.configurations.map do |name, config|\n next unless name.to_s =~ /#{ReplicaPools.config.environment}_pool_(.*)_name_(.*)/\n [name, $1, $2]\n end.compact\n end",
"def smash_configs\n # private overrides public general config\n a = remove_environments(@general_config_pub)\n b = remove_environments(@general_config_priv)\n general = a.merge(b)\n\n # private overrides public collection config\n c = remove_environments(@collection_config_pub)\n d = remove_environments(@collection_config_priv)\n collection = c.merge(d)\n\n # collection overrides general config\n return general.merge(collection)\n end",
"def merged_config_for_generator\n return {}\n end",
"def configuration\n cfg = []\n @entries.each {|e| cfg.push(e.configuration)}\n return(cfg)\n end",
"def configuration\n cfg = []\n @entries.each {|e| cfg.push(e.configuration)}\n return(cfg)\n end",
"def configuration\n cfg = []\n @entries.each {|e| cfg.push(e.configuration)}\n return(cfg)\n end",
"def configurations\n if @configurations.blank?\n @configurations = FeedTools.configurations.dup\n end\n return @configurations\n end",
"def grifter_configuration\n @config.clone\n end",
"def configurations\n @configurations ||= begin\n if configurations = config.dig(\"gradle\", \"configurations\")\n Array(configurations)\n else\n DEFAULT_CONFIGURATIONS\n end\n end\n end",
"def configurations\n @configurations ||= begin\n if configurations = config.dig(\"gradle\", \"configurations\")\n Array(configurations)\n else\n DEFAULT_CONFIGURATIONS\n end\n end\n end",
"def config_files(override); end",
"def retriable_configuration\n Take2::Configuration::CONFIG_ATTRS.each_with_object({}) do |key, hash|\n hash[key] = send(key)\n end\n end",
"def applied_config\n @applied_config ||= {}\n end",
"def term_qa_replacement_patterns\n Config.config_value(term_config, :qa_replacement_patterns)\n end",
"def replacements_params\n params.\n permit(replacements: [:url, :replacement, :original]).\n fetch(:replacements, {})\n end",
"def configuration\n cfg = []\n @entries.each {|e| cfg.push(e.desc)}\n return(cfg)\n end",
"def old()\n\t\treturn @oldConfig\n\tend",
"def get_override_settings\n {}\n end",
"def sources\n @settings.sources.to_a.inject({}) do |result, (source_id, source)|\n result[source_id] = source[:adapter].configuration\n result\n end\n end",
"def configs\n @configuration.ids\n end",
"def merge_configs\n # Update our original_config - if someone has created a knife command\n # instance directly, they are likely ot have set cmd.config values directly\n # as well, at which point our saved original config is no longer up to date.\n @original_config = config.dup\n # other code may have a handle to the config object, so use Hash#replace to deliberately\n # update-in-place.\n config.replace(config_file_defaults.merge(default_config).merge(config_file_settings).merge(config))\n end",
"def configured_adapters\n # Get our adapters as above.\n adapters = ADAPTERS.dup\n\n # Get all configured custom adapters and iterate over them.\n QuirkyApi.adapters.all.each do |configured_adapter|\n # Get the index of the adapter that will be used to determine\n # placement on the custom adapter.\n index = adapters.index(configured_adapter[:adapter])\n\n # Get the pre-existing adapter at that index.\n old_adapter = adapters[index]\n\n # Determine the placement of the new adapter by the 'placement'\n # specified when you configured it (based upon insert_before/after).\n # '+1' here means the new adapter should go after the old one, '-1'\n # means it should go before the old one.\n case configured_adapter[:placement]\n # Append\n when '+1'\n # Put the new adapter immediately after the old adapter.\n adapters[index, 1] = [old_adapter, configured_adapter[:new_adapter]]\n # Prepend\n when '-1'\n # Put the ne wadapter immediately before the old adapter.\n adapters[index, 1] = [configured_adapter[:new_adapter], old_adapter]\n end\n end\n\n # Return all adapters such as they are.\n adapters\n end",
"def substitute_from_config_libraries(sql)\n Admin::ConfigLibrary.make_substitutions! sql, :sql\n sql\n end",
"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 configuration\n Stupidedi::Config.new.customize do |c|\n c.interchange.customize do |x|\n x.register(\"00401\") { Stupidedi::Versions::Interchanges::FourOhOne::InterchangeDef }\n end\n\n c.functional_group.customize do |x|\n x.register(\"004010\") { Stupidedi::Versions::FunctionalGroups::FortyTen::FunctionalGroupDef }\n end\n\n c.transaction_set.customize do |x|\n # Not using the barebone transaction set definition, as it doesn't have enough constraints to parse\n # the document with multiple levels of HL (not deterministic)\n # x.register(\"004010\", \"SH\", \"856\") { Stupidedi::Contrib::FortyTen::TransactionSetDefs::SH856 }\n \n # Modified the guide to include REF element for the Line Item HL\n x.register(\"004010\", \"SH\", \"856\") { Stupidedi::Contrib::FortyTen::Guides::SH856 }\n end\n end\n end",
"def all_configurations\n @all_configuration ||= Configuration.new(:all)\n end",
"def find_configurations\n @configurations = @user.configurations\n @config_by_key = @configurations.inject({}) do |map, cfg|\n values = map[cfg.api_key] || []\n values << cfg\n map[cfg.api_key] = values\n map\n end\n end",
"def configure()\n origConfig = @site.config['svgo'] || {}\n generatedConfig = origConfig.clone\n generatedConfig.delete_if {|k, v| k.end_with?('.svg')}\n\n if origConfig.key?(@name)\n generatedConfig.merge!(origConfig[@name])\n end\n\n generatedConfig\n end",
"def module_config\r\n []\r\n end",
"def configs_cascade\n [\n @opts, \n @opts_config, \n @env_config, \n @additional_config, \n @local_config, \n @global_config, \n @defaults\n ]\n end",
"def merge_configurations cfg,cfg2\n cfg['prefix']||=cfg2['prefix']\n raise \"Attempting to merge configurations with differing prefixes: '#{cfg['prefix']}' vs. '#{cfg2['prefix']}' \" if cfg['prefix']!=cfg2['prefix']\n cfg['include']||=[]\n cfg['depend']||=[]\n cfg['interface']||=[]\n cfg['include']+=cfg2['include'] if cfg2['include']\n cfg['depend']+=cfg2['depend'] if cfg2['depend']\n cfg['interface']+=cfg2['interface'] if cfg2['interface']\n return cfg\nend",
"def options\n @options = @options.select { |key, _val| CONFIGURATIONS.include?(key.to_sym) }\n end",
"def configurations=(new_configurations)\n @configurations = new_configurations\n end",
"def genPiledConf(conf = {})\n return genPiledDefaultConf().update(conf) ;\n end",
"def patches\n {:p0 =>\n \"https://trac.macports.org/export/82481/trunk/dports/net/cclive/files/patch-configure.diff\"\n }\n end",
"def extra_substitutions_data\n return @extra_substitutions_data if @extra_substitutions_data\n return unless extra_substitutions\n\n @extra_substitutions_data = YAML.safe_load(extra_substitutions, [Symbol])\n end",
"def flatten_configurations\n all_settings = all_configurations.settings\n flattened_configurations = []\n\n debug_configurations.each do |b|\n b.settings = default_debug_settings.merge!(all_settings).merge!(b.settings)\n flattened_configurations << b\n end\n\n release_configurations.each do |b|\n b.settings = default_release_settings.merge!(all_settings).merge!(b.settings)\n flattened_configurations << b\n end\n\n flattened_configurations\n end",
"def config_options\n {\n 'datacenter' => new_resource.datacenter,\n 'template_path' => new_resource.template_path,\n 'power_on' => true,\n 'datastore' => new_resource.datastore,\n 'wait' => true,\n 'hostname' => new_resource.hostname,\n 'name' => new_resource.name,\n 'customization_spec' => {\n 'domain' => new_resource.domain,\n 'ipsettings' => {\n 'ip' => new_resource.ip || node['vcac_vm']['ip'],\n 'gateway' => new_resource.gateway,\n 'subnetMask' => new_resource.subnet_mask,\n },\n }\n }\nend",
"def configs!\n @configs = begin\n # This global is set when Origen is first required, it generally means that what is considered\n # to be the pwd for the purposes of looking for a site_config file is the place from where the\n # user invoked Origen. Otherwise if the running app switches the PWD it can lead to confusing\n # behavior - this was a particular problem when testing the new app generator which switches the\n # pwd to /tmp to build the new app\n path = $_origen_invocation_pwd\n configs = []\n # Add any site_configs from where we are currently running from, i.e. the application\n # directory area\n until path.root?\n file = File.join(path, 'config', 'origen_site_config.yml')\n configs << YAML.load_file(file) if File.exist?(file) && YAML.load_file(file)\n file = File.join(path, 'origen_site_config.yml')\n configs << YAML.load_file(file) if File.exist?(file) && YAML.load_file(file)\n path = path.parent\n end\n\n # Add and any site_configs from the directory hierarchy where Ruby is installed\n path = Pathname.new($LOAD_PATH.last)\n until path.root?\n file = File.join(path, 'origen_site_config.yml')\n configs << YAML.load_file(file) if File.exist?(file) && YAML.load_file(file)\n path = path.parent\n end\n\n # Add the one from the Origen core as the lowest priority, this one defines\n # the default values\n configs << YAML.load_file(File.expand_path('../../../origen_site_config.yml', __FILE__))\n configs\n end\n\n # Add the site_config from the user's home directory as highest priority, if it exists\n # But, make sure we take the site installation's setup into account.\n # That is, if user's home directories are somewhere else, make sure we use that directory to the find\n # the user's overwrite file. The user can then override that if they want.\"\n user_config = File.join(File.expand_path(user_install_dir), 'origen_site_config.yml')\n if File.exist?(user_config)\n @configs.unshift(YAML.load_file(user_config)) if YAML.load_file(user_config)\n end\n\n @configs\n end",
"def config\n filter_config(static.merge(dynamic))\n end",
"def institutions_index_config\n blacklight_config.search_builder_class = CommonwealthInstitutionsSearchBuilder\n blacklight_config.view.delete(:gallery)\n blacklight_config.view.delete(:masonry)\n blacklight_config.view.delete(:slideshow)\n end",
"def names\n @configs.keys\n end",
"def names\n @configs.keys\n end",
"def as_options\n on_replace = if copy_on_replace? then :copy\n else\n :drop\n end\n\n { on_replace: on_replace }\n end",
"def reconfigure(overrides={})\n config.merge!(overrides)\n self\n end",
"def config_files\n @config_files\n end",
"def replaced_files; end",
"def get_actual_config\n @config\n end",
"def build_extension_configurations\n extension.configurations.each do |ext_configuration|\n extension_settings.new(key: ext_configuration[:key]) unless\n extension_settings.where(key: ext_configuration[:key]).present?\n end\n end",
"def configure\n load_all_configs \n end",
"def substitution_dict\n dict = {}\n\n # X__[]\n @states.each_with_index do |s, i|\n dict[s] = var :\"X__[#{i}]\"\n end\n\n # XL__[]\n size = @states_i_f.size\n @states_i_f[0...-size/2].each_with_index do |sl, i|\n dict[sl] = var :\"XL__[#{i}]\"\n end\n\n # XR__[]\n @states_i_f[(size/2)..-1].each_with_index do |sr, i|\n dict[sr] = var :\"XR__[#{i}]\"\n end\n\n # L__[]\n @lambdas.each_with_index do |l, i|\n dict[l] = var :\"L__[#{i}]\"\n end\n\n # LL__[]\n size = @lambdas_i_f.size\n @lambdas_i_f[0...-size/2].each_with_index do |ll, i|\n dict[ll] = var :\"LL__[#{i}]\"\n end\n\n # LR__[]\n @lambdas_i_f[(size/2)..-1].each_with_index do |lr, i|\n dict[lr] = var :\"LR__[#{i}]\"\n end\n \n # U__[]\n @controls.each_with_index do |c,i|\n dict[c] = var :\"U__[#{i}]\"\n end\n \n # OMEGA__[]\n @omegas.each_with_index do |o, i|\n dict[o] = var :\"OMEGA__[#{i}]\"\n end\n\n # P__[]\n @params.each_with_index do |p, i|\n dict[p] = var :\"P__[#{i}]\"\n end\n\n # V__[]\n @nu.each_with_index do |n, i|\n dict[n] = var :\"V__[#{i}]\"\n end\n\n # ModelPars[]\n @aux_params.each_with_index do |(p, _), i|\n dict[p] = var :\"ModelPars[#{i}]\"\n end\n\n return dict\n end",
"def config\n config = {}\n config['recipes'] = []\n config['recipes'] |= hash_path(@default_config, 'recipes', 'global') || []\n config['recipes'] |= hash_path(@default_config, 'recipes', @platform) || []\n @group_configs.each do |group_name, group_config|\n config['recipes'] |= hash_path(group_config, 'recipes', 'global') || []\n config['recipes'] |= hash_path(group_config, 'recipes', @platform) || []\n end\n people_recipes = @people_config['recipes'] || {}\n config['recipes'] |= people_recipes['global'] || []\n config['recipes'] |= people_recipes[@platform] || []\n config['attributes'] = {}\n config['attributes'].deep_merge!(@default_config['attributes'] || {}) { |key, old, new| Array.wrap(old) + Array.wrap(new) }\n @group_configs.each do |group_name, group_config|\n config['attributes'].deep_merge!(group_config['attributes']) { |key, old, new| Array.wrap(old) + Array.wrap(new) } unless group_config['attributes'].nil?\n end\n people_attributes = @people_config['attributes'] || {}\n config['attributes'].deep_merge!(people_attributes) { |key, old, new| Array.wrap(old) + Array.wrap(new) }\n config\n end",
"def replace_expressions!(node2rep)\n # By default, nothing to do.\n return {}\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 configuration\n @configuration ||= deep_merge(default_configuration, @factory_config)\n end",
"def c\n configuration\n end",
"def parametrize #alias\n self.configuration\n end",
"def options\n opts = {}\n self.configuration_options.each do |option|\n opts.merge!({option.name.to_sym => option.value})\n end\n opts\n end",
"def config_generator_options\n definition.config_generator_options\n end",
"def c\n configuration\n end",
"def configs(cfg)\n Dir.glob(cfg[\"tile_engines\"][\"conf_dir\"] + \"/*.conf.yml\").each do |item|\n\t engine_cfg = File.open(item){|fd| YAML.load(fd)}\n\t engine_cfg[\"mailer_config\"] = cfg[\"tile_engines\"][\"mailer_config\"]\n\t engine_cfg[\"config_path\"]=item\n\t yield engine_cfg\n end\n end",
"def option_sets_for_instances\n opt_sets = enabled_questionings.map do |qing|\n if qing.default.present? && qing.default =~ ODK::DynamicPatternParser::VALUE_REGEX\n referenced_option_sets(qing)\n end\n end\n opt_sets.flatten.compact.uniq\n end",
"def generate_config(watchers)\n main_stanza = []\n events_stanza = []\n http_stanza = []\n upstream_stanza = []\n location_stanza = []\n server_stanza = []\n watchers.each do |watcher|\n # if service doesnt has nginx block, skip it\n next unless watcher.nginx \n log.info \"#{watcher.name} - #{watcher.backends} - #{watcher.haproxy} - #{watcher.nginx}\"\n @watcher_configs[watcher.name] = parse_watcher_config(watcher)\n log.info @watcher_configs\n upstream_stanza << generate_upstream_stanza(watcher, @watcher_configs[watcher.name]['upstream']) \n location_stanza << generate_location_stanza(watcher,@watcher_configs[watcher.name]['location'])\n end\n\n main_config = get_main_config\n main_stanza = generate_main_stanza(main_config)\n\n event_config = get_event_config\n events_stanza = generate_event_stanza(event_config)\n\n http_config = get_http_config\n http_stanza = generate_http_stanza(http_config)\n close_bracket = [\"}\"]\n\n base_server_config = get_server_base_config\n server_stanza = generate_server_stanza(location_stanza,base_server_config)\n if http_stanza.empty?\n final_config = main_stanza << events_stanza << http_stanza << upstream_stanza << server_stanza \n else\n final_config = main_stanza << events_stanza << http_stanza << upstream_stanza << server_stanza << close_bracket \n end\n log.info \"config array is #{final_config}\"\n\n return final_config\n end",
"def config\n configuration\n end",
"def process config\n replace_variables config.template_location\n\n replace_variables config.generate_settings.command unless config.generate_settings == nil || config.generate_settings.command == nil\n replace_variables config.generate_settings.docker_file unless config.generate_settings == nil || config.generate_settings.docker_file == nil\n\n replace_variables config.build_settings.build_commands.fetch unless config.build_settings == nil || config.build_settings.build_commands.fetch == nil\n replace_variables config.build_settings.build_commands.build unless config.build_settings == nil || config.build_settings.build_commands.build == nil\n replace_variables config.build_settings.build_commands.test unless config.build_settings == nil || config.build_settings.build_commands.test == nil\n\n replace_variables config.build_settings.docker_settings.image unless config.build_settings == nil || config.build_settings.docker_settings.image == nil\n replace_variables config.build_settings.docker_settings.env unless config.build_settings == nil || config.build_settings.docker_settings.env == nil\n replace_variables config.build_settings.docker_settings.binds unless config.build_settings == nil || config.build_settings.docker_settings.binds == nil\n replace_variables config.build_settings.docker_settings.working_directory unless config.build_settings == nil || config.build_settings.docker_settings.working_directory == nil\n\n return config\n end",
"def tasks_for_all_configurations\n @configurations.keys.collect{ |name| \"#{@project_name}:#{name}\"}\n end",
"def copy_configs\n template \"config/compass.rb\"\n template \"config/html5_rails.yml\"\n end",
"def configured_servers\n\t\thosts = self.configured_hosts\n\t\treturn Mongrel2::Config::Server.where( id: hosts.select(:server_id) )\n\tend",
"def configuration\n $_temescal_configuration\n end",
"def all_additional_substitutions\n (0...length).reject{|pos| pos == left.length }.flat_map{|pos|\n all_additional_substitutions_at_position(pos).to_a\n }.to_h\n end",
"def configure(conf)\n super\n\n @convert.nil? or @convert.each do |field, type|\n if !VALID_CONVERSIONS.include?(type)\n raise ConfigError, \n \"convert #{type} is not one of #{VALID_CONVERSIONS.join(',')}.\"\n end\n end\n\n @gsub_parsed = []\n @gsub.nil? or \n @gsub.each_slice(3) do |field, needle, replacement|\n if [field, needle, replacement].any? {|n| n.nil?}\n raise ConfigError,\n \"gsub #{[field,needle,replacement]} requires 3 elements.\"\n end\n\n @gsub_parsed << {\n field: field,\n needle: (needle.index(\"%{\").nil?? Regexp.new(needle): needle),\n replacement: replacement\n }\n end\n end",
"def bg_update_sections\n unless (@@bg_update_sections)\n @@bg_update_sections = config_resolve_sections.find_all do |section|\n section[:bg_update] != false\n end\n end\n @@bg_update_sections\n end",
"def federation_configurations\n return @federation_configurations\n end",
"def to_configure_properties\n ['@security', '@channel_flags', '@clas', '@race', '@traits', '@sign', '@stuff']\n end",
"def templates_configuration\n yield @templates_configuration\n end",
"def final_values\n overrides = @stage.overridden_package_values[name]\n values.deep_merge(overrides)\n end",
"def reference_book_configurations()\n return Rails.cache.fetch(\"odsa_reference_book_configs\", expires_in: 6.hours) do\n config_dir = File.join(\"public\", \"OpenDSA\", \"config\")\n base_url = request.protocol + request.host_with_port + \"/OpenDSA/config/\"\n configs = []\n Dir.foreach(config_dir) do |entry|\n if entry.include?(\"_generated.json\") or not File.extname(entry) == '.json'\n next\n end\n url = base_url + File.basename(entry)\n begin\n title = JSON.parse(File.read(File.join(config_dir, entry)))[\"title\"]\n configs << {\n title: title,\n name: File.basename(entry, '.json'),\n url: url,\n }\n rescue\n error = Error.new(:class_name => 'book_config_parse_fail',\n :message => \"Failed to parse #{entry}\")\n error.save!\n end\n end\n configs.sort_by! { |x| x[:title] }\n end\n end",
"def configuration; end",
"def configuration; end",
"def configuration; end",
"def configuration; end",
"def configuration; end",
"def merge_dynamic_config\n return if GlobalConstant::EntityGroupDraft.kyc_entity_type != @entity_type\n field_config = GlobalConstant::CmsConfigurator.extra_kyc_field_instruction_text_config\n\n @params.keys.each do |x|\n @entity_config[x.to_s] = field_config if x.to_s.ends_with?(\n GlobalConstant::CmsConfigurator.extra_kyc_field_instruction_key_suffix)\n end\n\n end",
"def global_configurations\n @_global_configurations ||= []\n end",
"def config\n details = Chassis.pkgs.dup\n details << [\"tags\"] + Chassis.tags unless Chassis.tags.empty?\n details << [\"roles\"] + Chassis.roles unless Chassis.roles.empty?\n details << [\"kind\"] + [Chassis.node_kind] if Chassis.node_kind\n details << Chassis.extra_config if Chassis.extra_config\n details\n end",
"def configuration\n self[:configuration] || {}\n end",
"def get_config(*arguments)\n \t\targs = arguments.clone\n \t\t@config ||= {}\n \t\topt = args.rfm_extract_options!\n \t\tstrings = opt[:strings].rfm_force_array || []\n \t\tsymbols = opt[:use].rfm_force_array || []\n \t\tobjects = opt[:objects].rfm_force_array || []\n \t\targs.each do |arg|\n \t\t\tcase true\n \t\t\twhen arg.is_a?(String) ; strings << arg\n \t\t\twhen arg.is_a?(Symbol) ; symbols << arg\n \t\t\telse objects.unshift arg\n \t\t\tend\n \t\tend\n\n\t\t\trslt = config_merge_with_parent(symbols).merge(opt)\n\t\t\t#using = rslt[:using].rfm_force_array\n\t\t\tsanitize_config(rslt, CONFIG_DONT_STORE, false)\n\t\t\trslt[:using].delete \"\"\n\t\t\trslt[:parents].delete \"\"\n\t\t\trslt.merge(:strings=>strings, :objects=>objects)\n \tend",
"def map_config_extensions\n @extensions = Hash.new\n @config[\"types\"].each do |k,v|\n puts \"#{k} => #{v}\"\n v.each do |ext|\n @extensions[ext] = k\n end\n end\n return @extensions\n end"
] | [
"0.67082316",
"0.67082316",
"0.67082316",
"0.64707136",
"0.64707136",
"0.63352954",
"0.62769514",
"0.6205945",
"0.6161139",
"0.61302644",
"0.60717314",
"0.59082615",
"0.5874846",
"0.5815852",
"0.5788381",
"0.5767073",
"0.5767073",
"0.5767073",
"0.5710181",
"0.56625044",
"0.5659848",
"0.5659848",
"0.55862164",
"0.554878",
"0.552501",
"0.5517782",
"0.5500243",
"0.5484899",
"0.54844224",
"0.5478834",
"0.5476581",
"0.54587245",
"0.5453851",
"0.54511166",
"0.5441079",
"0.54408973",
"0.5418688",
"0.5404874",
"0.54037833",
"0.5390418",
"0.53841054",
"0.53702",
"0.5348417",
"0.53385144",
"0.53263414",
"0.5308229",
"0.5300956",
"0.52975225",
"0.52924424",
"0.52788115",
"0.52743185",
"0.526656",
"0.5259713",
"0.5241081",
"0.5241081",
"0.5235678",
"0.523111",
"0.522985",
"0.52210337",
"0.5217459",
"0.52054775",
"0.52025735",
"0.5182087",
"0.5176837",
"0.5174813",
"0.51729316",
"0.5156209",
"0.51504815",
"0.5144287",
"0.51362324",
"0.51303625",
"0.51278204",
"0.51258767",
"0.51220775",
"0.5116809",
"0.51111746",
"0.5106724",
"0.5097872",
"0.50933385",
"0.5074684",
"0.50696886",
"0.5069636",
"0.5061152",
"0.5052972",
"0.50513977",
"0.50483036",
"0.50450367",
"0.5038813",
"0.5037984",
"0.503605",
"0.503605",
"0.503605",
"0.503605",
"0.503605",
"0.5024598",
"0.50215495",
"0.5021446",
"0.5020039",
"0.5017092",
"0.50154746"
] | 0.5943522 | 11 |
Are there subauthorities configured for term fetch? | def term_subauthorities?
term_subauthority_count.positive?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def term_subauthorities\n @term_subauthorities ||= {} if term_config.nil? || !(term_config.key? :subauthorities)\n @term_subauthorities ||= term_config[:subauthorities]\n end",
"def term_subauthority_count\n term_subauthorities.size\n end",
"def subauthorities\n SUBAUTHORITIES.keys\n end",
"def term_subauthority?(subauth_name)\n subauth_name = subauth_name.to_sym if subauth_name.is_a? String\n term_subauthorities.key? subauth_name\n end",
"def advanced_search_authorized?\n authorized_for?(:action => :read)\n end",
"def term_required?( term )\n #puts \"=====> GenericWork.term_required? #{term}\"\n return true if [:author_email, :author_first_name, :author_last_name, :author_institution, :title, :creator, :contributor, :description, :publisher, :rights, :identifier, :department, :degree, :license].include? term\n false\n end",
"def term_multiple?( term )\n #puts \"=====> GenericWork.term_multiple? #{term}\"\n return true if [:keyword, :title, :contributor, :subject, :related_url, :sponsoring_agency, :admin_notes].include? term\n false\n end",
"def luxury_search_authorized?\n authorized_for?(:action => :read)\n end",
"def primary_terms\n terms - [:visibility, :collection_type_gid]\n end",
"def authorize_term(field, term)\n authorized_terms = []\n if field.include?(\"_facet\") or field.include?(\"_display\")\n authorized_terms << check_term(field.split(\"_\")[0], term) # the .split is b/c \"originator_display\" would be under the \"originator\" values in the yaml file\n else\n authorized_terms << term\n authorized_terms << check_term(field.split(\"_\")[0], term)\n end\n \n return authorized_terms.uniq\n \n end",
"def term_readonly?( term )\n #puts \"=====> GenericWork.term_readonly? #{term}\"\n return true if [:author_email, :author_institution, :date_created, :identifier, :publisher, :department, :degree, :license].include? term\n return true if term == :title && is_sis_thesis?\n false\n end",
"def secondary_terms\n [:creator,\n :contributor,\n :keyword,\n :license,\n :publisher,\n :date_created,\n :subject,\n :language,\n :identifier,\n :based_near,\n :campus,\n :related_url,\n :resource_type]\n end",
"def field_search_authorized?\r\n authorized_for?(:action => :read)\r\n end",
"def terms\n end",
"def required_authorization?\n unauthorized_commit_authors.any?\n end",
"def list_authorized?\n authorized_for?(:crud_type => :read)\n end",
"def list_authorized?\n authorized_for?(:crud_type => :read)\n end",
"def gated_discovery_filters\n return super if @access != :deposit\n [\"{!terms f=id}#{admin_set_ids_for_deposit.join(',')}\"]\n end",
"def terms\n\n end",
"def terms\n\n end",
"def terms\n\tend",
"def has_common_coauthor_with(other_authors)\n end",
"def has_additional_terms_of_use\n false\n end",
"def can_collection_query?\n org = active_org\n if org\n org.full_member?\n else\n single_user_access?\n end\n end",
"def brief_terms\n [\n #:relation,\n :asset_type,\n :uid,\n :pref_label\n ]\n end",
"def revision_authorized?\n authorized_for?(:action => :read)\n end",
"def read_terms\n object.tnc_last_accepted.present?\n end",
"def terms\n raise NotImplementedError\n end",
"def needs_permission_badge?\n solr_document.visibility != Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC\n end",
"def customize_authorized?\n authorized_for?(:action => :read)\n end",
"def secondary_terms\n []\n end",
"def secondary_terms\n [:gw_affiliation, :date_created,\n :description, :keyword,\n :identifier, :contributor, :publisher, :language,\n :based_near, :related_url, :bibliographic_citation]\n end",
"def has_terms?\n ! @data['terms'].nil?\n end",
"def check_term(term_type, term) \n if !@term_authority[term_type]\n authorized_term = term\n elsif !@term_authority[term_type][term].nil?\n @term_authority[term_type][term] == \"REMOVE\" ? authorized_term = \"\" : authorized_term = @term_authority[term_type][term]\n else\n authorized_term = term\n end\n \n return authorized_term\n \n end",
"def primary_terms\n [:title, :description, :source, :rights_note]\n end",
"def secondary_terms\n []\n end",
"def secondary_terms\n []\n end",
"def secondary_terms\n []\n end",
"def supports_term?\n term_config.present?\n end",
"def terms_for_editing\n terms_for_display\n end",
"def primary_terms\n fields = required_fields + [:rights_holder]\n return fields unless current_user.student?\n\n fields - [:rights_statement, :rights_holder]\n end",
"def terms_accepted?\n true\n end",
"def list_filter_authorized?\n authorized_for?(:action => :read)\n end",
"def primary_terms\n terms - self.class.hyrax_form_fields\n end",
"def is_authorized s, rdf_type, allowed_groups\n @authorizations ||= {}\n if @authorizations.has_key? [s, rdf_type, allowed_groups]\n @authorizations[s, rdf_type, allowed_groups]\n else\n\n authorized_query \"ASK WHERE { <#{s}> a <#{rdf_type}> }\", allowed_groups\n end\nend",
"def catalog_scoped?\n false\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 supported_terms\n term_help_messages.keys\n end",
"def terms\n [self]\n end",
"def organizations_in_vercinity\n\n\tend",
"def can_return_results\n if self.accession_list.blank? && self.search_terms.empty? && self.facet_filters.empty?\n errors.add(:base, \"You must supply either search terms, facet filters, or an accession list\")\n end\n end",
"def terms\n @term_hash.values\n end",
"def terms_agreement\n # @user instantiated by authentication before filter and matched to current user\n if request.post? && params[:commit_agreed]\n alter_current_user do |user|\n user.agreed_with_terms = true\n end\n redirect_back_or_default(user_path(current_user))\n else\n # FIXME: is this the right content for terms agreement and the right call for it?\n # FIXME: this seems flakey, do we have unique machine names for content rather than page name?\n page = ContentPage.find_by_page_name('Terms Of Use')\n @terms = TranslatedContentPage.find_by_content_page_id_and_language_id(page, @user.language_id) unless page.nil?\n end\n end",
"def is_categories?\n is_entries? && params[:_taxonomies_].present? && params[:_slug_].present? && is_not_page?\n end",
"def terms_for_display\n # 'type' is the RDF.type assertion, which is not present by default, but may be\n # provided in some RDF schemas\n self.descMetadata.class.fields + [:tags] - [:tag]\n end",
"def authorized?\n if self.respond_to?(\"mini_wiki_authorized\")\n @authorized = mini_wiki_authorized\n else\n @authorized = true;\n end\n end",
"def terms_of_use\n return @terms_of_use\n end",
"def authorized?(object, args, ctx)\n field_authorized?(object, ctx) && resolver_authorized?(object, ctx)\n end",
"def search_terms(resource)\n return nil unless resources.include? resource\n @data[resource][0].keys\n end",
"def authored_articles\n Article.where(author: self)\n end",
"def sublibraries_with_access\n @sublibraries_with_access ||= hits&.first&.stored(:sublibraries_with_access)\n end",
"def above_fold_terms\n [:maker,\n :date_original,\n :date_published,\n :resource_type,\n :genre_string,\n :identifier,\n :rights,\n ]\n end",
"def can_super_admin?\n can_add_orgs? || can_grant_api_to_orgs? || can_change_org?\n end",
"def term_subauthority_replacement_pattern\n return {} unless term_subauthorities?\n @term_subauthority_replacement_pattern ||= {} if term_config.nil? || !term_subauthorities?\n pattern = term_qa_replacement_patterns[:subauth]\n @term_subauthority_replacement_pattern ||= { pattern: pattern, default: term_url_mappings[pattern.to_sym][:default] }\n end",
"def search_all_terms\n render json: Article.with_all_terms(params[:query]).map(&:title)\n end",
"def term\n @term\n end",
"def primary_terms\n [:title, :creator, :description, :license]\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 searchauthor\n end",
"def terms\n @locations.map(&:term).uniq\n end",
"def read_all?\n return true if authorized_via_parent\n # This is expensive, so try to avoid it\n # TODO: look in to creating a cache for\n # these look ups that's invalidated upon\n # object save\n accessible = object.map { |ea| read?(ea) }\n accessible.all?\n end",
"def descriptive_resources\n find_related_frbr_objects( :is_described_by, :which_resources?) \n end",
"def descriptive_resources\n find_related_frbr_objects( :is_described_by, :which_resources?) \n end",
"def search_terms\n return @search_terms\n end",
"def index\n authorize!(:index,@user) unless @user.has_access?('Terms of Engagement')\n @termcondition = @matter.matter_termcondition || @matter.build_matter_termcondition\n @pagenumber=139\n add_breadcrumb t(:text_terms_of_engagement), matter_matter_termconditions_path(@matter)\n end",
"def multiple?(term)\n self.class.multiple?(term)\n end",
"def type_authorization?()\n return(true) if(@type == TAC_PLUS_AUTHOR)\n return(false)\n end",
"def has_access?(subproduct)\n unless subproduct == :Communication\n# return true if subproduct == :FinancialAccount\n @subproducts ? @subproducts.include?(subproduct.to_s) : (@subproducts = subproducts).include?(subproduct.to_s)\n else\n self.verified_lawyer_id_by_secretary.present?\n end\n end",
"def courses_in_term( term )\n cur = CoursesUser.find(:all, :conditions => [\"user_id = ? and term_id =?\", self.id, term.id])\n cur.sort! do |x,y| \n result = x.position <=> y.position\n result = x.course.title <=> y.course.title if result == 0\n result\n end \n end",
"def terms\n redirect_to '/404' unless Rails.configuration.terms\n\n if params[:accept] == \"true\"\n current_user.update_attributes(accepted_terms: true)\n login(current_user)\n end\n end",
"def characterization_terms(omdoc)\n h = {}\n omdoc.class.terminology.terms.each_pair do |key, target|\n # a key is a proxy if its target responds to proxied_term\n next unless target.respond_to? :proxied_term\n begin\n h[key] = omdoc.send(key)\n rescue NoMethodError\n next\n end\n end\n h.delete_if { |_k, v| v.empty? }\n end",
"def terms_and_conditions\n return @terms_and_conditions\n end",
"def index\n @terms = Term.where(:user_id => session[:user_id])\n end",
"def url_search_terms\n if openbis?\n []\n else\n super\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 can_super_admin?\n return self.can_add_orgs? || self.can_grant_api_to_orgs? || self.can_change_org?\n end",
"def granular?\n @granular ||= begin\n return false if resource_class.nil?\n return true if resource_type == 'Host'\n resource_class.included_modules.include?(Authorizable) && resource_class.respond_to?(:search_for)\n end\n end",
"def author?(user)\n authors.member?(user)\n end",
"def show\n @taxonomy_term = TaxonomyTerm.find(params[:id])\n \n @locations = apply_scopes(@taxonomy_term.locations).uniq().page(params[:page]).per(params[:per_page])\n \n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @taxonomy_term }\n end\n end",
"def by_any_approvals?\n includes_special_label?(IssuableFinder::Params::FILTER_ANY)\n end",
"def index\n @authorities = Authority.all\n end",
"def index\n @authorities = Authority.all\n end",
"def parse_terms()\n\t\tif next_TokenGrabbed(\"*\")\n\t\t\tputs \"Multiplicand Hit.\"\n\t\t\tif parse_factor()\n\t\t\t\tif parse_terms()\n\t\t\t\t\ttrue\n\t\t\t\telse\n\t\t\t\t\ttrue\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tfalse\n\t\t\tend\n\t\telse\n\t\t\tfalse\n\t\tend\n\tend",
"def can_grant_api_to_orgs?\n perms.include? Perm.grant_api\n end",
"def can_grant_api_to_orgs?\n perms.include? Perm.grant_api\n end",
"def display_acl?\n convention_admin? || super_admin?\n end",
"def is_agreement?\n return false if self.observation.taxon.nil?\n return true if self.taxon_id == self.observation.taxon_id\n self.taxon.in_taxon? self.observation.taxon\n end",
"def has_privilege?\n has_all? || has_direct?\n end",
"def index\n if params[:terms]\n # Search mode\n @organizations = []\n JSON.parse(params[:terms]).map { |t| @organizations = @organizations | MnoEnterprise::Organization.where(Hash[*t]).fetch }\n response.headers['X-Total-Count'] = @organizations.count\n else\n # Index mode\n query = MnoEnterprise::Organization\n query = query.limit(params[:limit]) if params[:limit]\n query = query.skip(params[:offset]) if params[:offset]\n query = query.order_by(params[:order_by]) if params[:order_by]\n query = query.where(params[:where]) if params[:where]\n all = query.all\n\n all.params[:sub_tenant_id] = params[:sub_tenant_id]\n all.params[:account_manager_id] = params[:account_manager_id]\n\n @organizations = all.fetch\n\n response.headers['X-Total-Count'] = @organizations.metadata[:pagination][:count]\n end\n end",
"def catalog?\n @resource_name == \"catalog\" && @actions[0] == \"*\"\n end"
] | [
"0.75910294",
"0.7062189",
"0.69789237",
"0.693804",
"0.63819087",
"0.6315325",
"0.62678456",
"0.62612593",
"0.62366945",
"0.6191987",
"0.59692997",
"0.5802569",
"0.5756488",
"0.5755255",
"0.5706198",
"0.5681793",
"0.5681793",
"0.56603545",
"0.56513065",
"0.56513065",
"0.5620056",
"0.55814487",
"0.5570208",
"0.55652225",
"0.5557429",
"0.5557338",
"0.55448925",
"0.55355436",
"0.55343735",
"0.5527406",
"0.5525476",
"0.55239224",
"0.55090773",
"0.55089223",
"0.5477792",
"0.5475836",
"0.5475836",
"0.5475836",
"0.5460463",
"0.5457172",
"0.5456191",
"0.54427075",
"0.5407903",
"0.53975356",
"0.53715444",
"0.5363327",
"0.53560925",
"0.5314926",
"0.531078",
"0.5309826",
"0.53073",
"0.52768475",
"0.5264933",
"0.5238038",
"0.5234729",
"0.5230984",
"0.52301836",
"0.52293825",
"0.52203816",
"0.5214709",
"0.5199899",
"0.5180209",
"0.5176326",
"0.51506853",
"0.51425904",
"0.5138776",
"0.5132818",
"0.5130191",
"0.51295745",
"0.51278216",
"0.512559",
"0.5123594",
"0.5123594",
"0.51182437",
"0.5112565",
"0.51116437",
"0.5110313",
"0.50958526",
"0.5091812",
"0.50915265",
"0.50909144",
"0.50884944",
"0.5073261",
"0.5067609",
"0.50586146",
"0.50466263",
"0.5044689",
"0.50420386",
"0.50387686",
"0.5031474",
"0.50299454",
"0.50299454",
"0.5028251",
"0.50256014",
"0.50256014",
"0.50188494",
"0.5018577",
"0.50164163",
"0.5012116",
"0.50097084"
] | 0.7887249 | 0 |
Is a specific subauthority configured for term fetch? | def term_subauthority?(subauth_name)
subauth_name = subauth_name.to_sym if subauth_name.is_a? String
term_subauthorities.key? subauth_name
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def term_subauthorities?\n term_subauthority_count.positive?\n end",
"def term_subauthorities\n @term_subauthorities ||= {} if term_config.nil? || !(term_config.key? :subauthorities)\n @term_subauthorities ||= term_config[:subauthorities]\n end",
"def term_subauthority_count\n term_subauthorities.size\n end",
"def is_subpart?\n case @raw_provider['organization_subpart']\n when 'yes'\n true\n when 'no'\n false\n else\n nil\n end\n end",
"def trusted_authority?(authority)\n @configuration['trust'].include?(authority)\n end",
"def term_required?( term )\n #puts \"=====> GenericWork.term_required? #{term}\"\n return true if [:author_email, :author_first_name, :author_last_name, :author_institution, :title, :creator, :contributor, :description, :publisher, :rights, :identifier, :department, :degree, :license].include? term\n false\n end",
"def supports_term?\n term_config.present?\n end",
"def subclients?\n subclients.any?\n end",
"def authority?\n false\n end",
"def luxury_search_authorized?\n authorized_for?(:action => :read)\n end",
"def has_access?(subproduct)\n unless subproduct == :Communication\n# return true if subproduct == :FinancialAccount\n @subproducts ? @subproducts.include?(subproduct.to_s) : (@subproducts = subproducts).include?(subproduct.to_s)\n else\n self.verified_lawyer_id_by_secretary.present?\n end\n end",
"def term_id_expects_uri?\n return false if term_config.nil? || !(term_config.key? :term_id)\n term_config[:term_id] == \"URI\"\n end",
"def advanced_search_authorized?\n authorized_for?(:action => :read)\n end",
"def can_collection_query?\n org = active_org\n if org\n org.full_member?\n else\n single_user_access?\n end\n end",
"def us_county?\n feature_code = featureCode.first\n parent_country = parentCountry.first\n sec_adm_level_code = 'www.geonames.org/ontology#A.ADM2'\n us_country_code = 'sws.geonames.org/6252001/'\n feature_code.respond_to?(:rdf_subject) && feature_code.rdf_subject.to_s.include?(sec_adm_level_code) && parent_country.respond_to?(:rdf_subject) && parent_country.rdf_subject.to_s.include?(us_country_code)\n end",
"def term_readonly?( term )\n #puts \"=====> GenericWork.term_readonly? #{term}\"\n return true if [:author_email, :author_institution, :date_created, :identifier, :publisher, :department, :degree, :license].include? term\n return true if term == :title && is_sis_thesis?\n false\n end",
"def term_multiple?( term )\n #puts \"=====> GenericWork.term_multiple? #{term}\"\n return true if [:keyword, :title, :contributor, :subject, :related_url, :sponsoring_agency, :admin_notes].include? term\n false\n end",
"def subauthorities\n SUBAUTHORITIES.keys\n end",
"def ontology_based?\n source_ontology.present? && ols_root_term_uri.present?\n end",
"def subconfig? key\n @schema.subconfig? key\n end",
"def catalog?\n @resource_name == \"catalog\" && @actions[0] == \"*\"\n end",
"def term_subauthority_replacement_pattern\n return {} unless term_subauthorities?\n @term_subauthority_replacement_pattern ||= {} if term_config.nil? || !term_subauthorities?\n pattern = term_qa_replacement_patterns[:subauth]\n @term_subauthority_replacement_pattern ||= { pattern: pattern, default: term_url_mappings[pattern.to_sym][:default] }\n end",
"def by_subdomain?\n conditions[:required_defaults].include?(:localize_subdomain)\n end",
"def subdomain_available?(subdomain)\n begin\n return put :subdomain_available?, {:subdomain => subdomain}\n rescue RestClient::UnprocessableEntity\n return false\n end\n end",
"def single_rs_member?\n ClusterConfig.instance.single_server? && ClusterConfig.instance.replica_set_name\nend",
"def single_rs_member?\n ClusterConfig.instance.single_server? && ClusterConfig.instance.replica_set_name\nend",
"def part_of_catalog?\n if params[:controller] =='catalog' || params[:controller]=='bookmarks' ||\n request.original_url.include?(\"request\") || params[:controller]=='search_history' ||\n params[:controller] == 'advanced_search' || params[:controller]=='aeon' || params[:controller]=='browse' ||\n params[:controller] == 'book_bags' || params[:controller] == 'errors'\n return true\n end\n end",
"def check_term(term_type, term) \n if !@term_authority[term_type]\n authorized_term = term\n elsif !@term_authority[term_type][term].nil?\n @term_authority[term_type][term] == \"REMOVE\" ? authorized_term = \"\" : authorized_term = @term_authority[term_type][term]\n else\n authorized_term = term\n end\n \n return authorized_term\n \n end",
"def type_authorization?()\n return(true) if(@type == TAC_PLUS_AUTHOR)\n return(false)\n end",
"def can?(auth, resource_type = :general)\n has_access_to? :access, resource_type, auth\n end",
"def term_id_expects_id?\n return false if term_config.nil? || !(term_config.key? :term_id)\n term_config[:term_id] == \"ID\"\n end",
"def granular?\n @granular ||= begin\n return false if resource_class.nil?\n return true if resource_type == 'Host'\n resource_class.included_modules.include?(Authorizable) && resource_class.respond_to?(:search_for)\n end\n end",
"def territorial_core?\n @node[\"territorial_core\"]\n end",
"def needs_subdomain?(options)\n options[:subdomainify].present? || # Presence.\n get_realm(options) != get_realm(options[:_recall]) # Realm transfer.\n end",
"def subconfig? key\n @validators[String(key).to_sym] == SUBCONFIG\n end",
"def is_agreement?\n return false if self.observation.taxon.nil?\n return true if self.taxon_id == self.observation.taxon_id\n self.taxon.in_taxon? self.observation.taxon\n end",
"def is_a_subdomain?\n subdomain?\n end",
"def is_sub?\n @sub\n end",
"def show?\n if user.type == 'ReferralAgency'\n user.tenants.include?(app.tenant)\n else\n user.properties.each do |property|\n return true if property.applications.include?(app)\n end\n false\n end\n end",
"def authorize?\n @root.attributes[\"ath\"].to_i == 1\n end",
"def isResearcher?\n return account_type == 1\n end",
"def publication_match_in_profile\n @info.available_related_content_types.include? 'emp'\n end",
"def index_for_authority(authority)\n SUBAUTHORITIES[authority]\n end",
"def usa_admin?\n has_role?(:admin) && jurisdiction&.name == 'USA'\n end",
"def top_level?\n serial == serial && issuer.to_s == subject.to_s\n end",
"def has_catalog?\n false\n end",
"def config_for_term_or_uri(term)\n return properties[term.to_s] unless term.kind_of? RDF::Resource\n properties.each_value { |v| return v if v.predicate == term.to_uri }\n end",
"def sub_domain_known?(domain)\n\t\tputs \"Validate sub-domain: #{domain}\" if @verbose\n\t\tdomain=domain.strip.downcase\n\t\tsubs=dump_sub_domains\n\t\treturn subs.include?(domain)\n\trescue Exception => ee\n\t\tputs \"Exception on method #{__method__}: #{ee}\"\n\tend",
"def is_assessment_term?\n @reportable.class.table_name == 'assessment_terms'\n end",
"def partner_staff?\n staff? && agencies.any? { |a| a.partner? }\n end",
"def authority\n\t\t\t@options[:authority]\n\t\tend",
"def runasdomain?\n @resource[:runasdomain]\n end",
"def treasurer?\n ASF::AuthGroup.find('treasurer').members.include? self\n end",
"def cas_configured?\n return true unless @facility.details[:configurable_835]\n @segments_list[:CAS][:CAS00][0].eql?('code_value') ? true : false\n end",
"def needs_permission_badge?\n solr_document.visibility != Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC\n end",
"def columbia?\n # Columbia bib ids are numeric, or numeric with 'b' prefix for Law,\n # ReCAP partner data is \"SCSB-xxxx\"\n !id.start_with?('SCSB')\n end",
"def type_authentication?()\n return(true) if(@type == TAC_PLUS_AUTHEN)\n return(false)\n end",
"def has_access? c\n access_rights[controller2right c] == '1'\n end",
"def field_search_authorized?\r\n authorized_for?(:action => :read)\r\n end",
"def config_for_term_or_uri(term)\n return properties[term.to_s] unless\n term.is_a?(RDF::Resource) && !term.is_a?(RDFSource)\n properties.each_value { |v| return v if v.predicate == term.to_uri }\n end",
"def isAuthorized? account\n return true if current_user.admin?\n house = House.where(:account => account)\n return false if (house.nil || current_user.tenantOnly?)\n end",
"def authorized?\n if self.respond_to?(\"mini_wiki_authorized\")\n @authorized = mini_wiki_authorized\n else\n @authorized = true;\n end\n end",
"def is_certificate_entry(aliaz)\n\n end",
"def catalog_scoped?\n false\n end",
"def is_lucene_enabled?\n results = query_esip_opensearch(\"arctic%20alaskan%20shrubs\")\n\n result_scores = results.xpath('//atom:feed/atom:entry/relevance:score', ATOM_NAMESPACE.merge(RELEVANCE_NAMESPACE))\n result_scores.map { |score| score.text }\n\n return result_scores.count > 0\n end",
"def partner_admin?\n admin? && agencies.any? { |a| a.partner? }\n end",
"def is_organization_admin?\n #self.is_head?\n level >= USER_LEVELS[\"organization_admin\"] && level <= USER_LEVELS[\"system_admin\"]\n end",
"def exists?\n begin\n rbac_role_resource.head\n true\n rescue RestClient::Forbidden\n true\n rescue RestClient::ResourceNotFound\n false\n end\n end",
"def can_be_loaned_for_solr\n result = \"no\"\n result = \"yes\" if available_for_loan == true\n result\n end",
"def sub? name\n @subs.include? name\n end",
"def scoped_to_tenant?\n !!scoped_to_tenant_id\n end",
"def active?\n if needs_sandbox?\n return false unless sandbox_active?\n end\n load_configuration_file\n if self.name.eql? 'Default'\n case policy = self.searchpolicy\n when Integer\n return true if policy < 3\n else\n return true if policy =~ /\\AdsAttrTypeStandard:[LN]SPSearchPath\\z/\n end\n end\n return false if cspsearchpath.nil?\n return false unless searchpolicy_is_custom?\n cspsearchpath.member?(@label)\n end",
"def replica_has_catalog_for_agent?(replica_catalogs, agent)\n replica_catalogs.each { |replica_catalog| return true if replica_catalog['certname'] == agent.hostname }\n host.logger.warn(\"replica doesn't have any catalogs for certname '#{agent.hostname}'\")\n false\n end",
"def organization?\n self.tier? && self.tier.is_a?(Organization)\n end",
"def finance_office?\n current_user.role && current_user.role.upcase.split(',').include?('CO') && current_user.section_id==2\n end",
"def has_access_to?(perform, resource_type, named, with_options = nil, alt_app_type_id: nil, force_reset: nil)\n @has_access_to ||= {}\n\n clear_has_access_to! if user_access_controls_updated?\n clear_role_names! if user_roles_updated?\n\n key = \"#{perform}-#{resource_type}-#{named}-#{with_options}-#{alt_app_type_id || app_type_id}\"\n return @has_access_to[key] if @has_access_to.key?(key) && !force_reset\n\n @has_access_to[key] =\n Admin::UserAccessControl.access_for? self,\n perform,\n resource_type,\n named,\n with_options,\n alt_app_type_id: alt_app_type_id\n end",
"def in_agreement_with?(identification)\n return false unless identification\n return false if identification.taxon_id.nil?\n return true if self.taxon_id == identification.taxon_id\n self.taxon.in_taxon? identification.taxon\n end",
"def in_agreement_with?(identification)\n return false unless identification\n return false if identification.taxon_id.nil?\n return true if self.taxon_id == identification.taxon_id\n self.taxon.in_taxon? identification.taxon\n end",
"def has_doc_subpkg?\n @has_doc_subpkg ||= @metadata[:contents].index RPM::Spec::SPEC_DOC_SUBPACKAGE_MATCHER\n end",
"def is_authorized s, rdf_type, allowed_groups\n @authorizations ||= {}\n if @authorizations.has_key? [s, rdf_type, allowed_groups]\n @authorizations[s, rdf_type, allowed_groups]\n else\n\n authorized_query \"ASK WHERE { <#{s}> a <#{rdf_type}> }\", allowed_groups\n end\nend",
"def campus_only?\n access == 'Campus Only Access (No Proxy)'\n end",
"def has_terms?\n ! @data['terms'].nil?\n end",
"def has_auth_criteria?\n\t\t\treturn self.has_positive_auth_criteria? || self.has_negative_auth_criteria?\n\t\tend",
"def us_fulltext?\n self.any? { |item| item.us_availability == HathiTrust::Constants::FT }\n end",
"def has_master?\n @has_master = !!user_configuration_from_key('master_solr')\n end",
"def system_vocab?\n # currently determined by whether it has a special key, which cannot be set by user defined CV's\n key.present? && SystemVocabs.database_key_known?(key)\n end",
"def complete_subtools?\n @complete_subtools\n end",
"def can_access?(kase)\n ca = self.access_to?(kase)\n ca || (!ca && (self.total_contacts_count > 0 || self.can_purchase_flex_contacts? || self.unlimited_premium_contacts?))\n end",
"def read_terms\n object.tnc_last_accepted.present?\n end",
"def is_institution_visible?\n return false if visibility.nil?\n return( visibility == Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_AUTHENTICATED )\n end",
"def master_has_catalog?(replica_catalog, master_catalogs)\n master_catalogs.each { |master_catalog| return true if replica_catalog['certname'] == master_catalog['certname'] }\n host.logger.warn(\"master doesn't have catalog with hash '#{replica_catalog['certname']}', which is on replica\")\n false\n end",
"def customize_authorized?\n authorized_for?(:action => :read)\n end",
"def can_read?(profile)\n \n can_access?(profile, [2,6])\n \n end",
"def translation_domain?\n @tenant.try(:subdomain) == Rails.configuration.translations_subdomain\n end",
"def sub?\n @badges.key? 'subscriber'\n end",
"def authen_type_chap?()\n return true if (@authen_type == TAC_PLUS_AUTHEN_TYPE_CHAP)\n return false\n end",
"def run_subset?(type)\n ENV[type] == \"true\" || ENV['ALL'] == \"true\" ? true : false\n end",
"def can_super_admin?\n can_add_orgs? || can_grant_api_to_orgs? || can_change_org?\n end",
"def external_user?\n case uri_options[:auth_mech]\n when :mongodb_x509, :aws\n true\n when nil, :scram, :scram256\n false\n else\n raise \"Unknown auth mechanism value: #{uri_options[:auth_mech]}\"\n end\n end",
"def has_subdomain?(subdomain)\n owned_subdomains.include?(subdomain)\n end"
] | [
"0.765371",
"0.6534615",
"0.64777064",
"0.6447676",
"0.6109477",
"0.59710646",
"0.58551747",
"0.58389294",
"0.58365357",
"0.5820499",
"0.57719266",
"0.5747871",
"0.5732477",
"0.5693589",
"0.56495875",
"0.55933917",
"0.55773175",
"0.556693",
"0.55357575",
"0.55251074",
"0.5497263",
"0.5480845",
"0.54688716",
"0.5446237",
"0.5437714",
"0.5437714",
"0.5419492",
"0.53982127",
"0.53789806",
"0.53542346",
"0.53490376",
"0.5320473",
"0.5313421",
"0.53016543",
"0.52970135",
"0.52860296",
"0.52821946",
"0.5280926",
"0.52749693",
"0.5269246",
"0.52664936",
"0.5265518",
"0.5265498",
"0.52641845",
"0.52474415",
"0.5244246",
"0.5238823",
"0.52375704",
"0.5237132",
"0.523664",
"0.5234849",
"0.5234099",
"0.5232611",
"0.5226312",
"0.52229416",
"0.522242",
"0.5213688",
"0.5210179",
"0.5204943",
"0.52008265",
"0.5198494",
"0.51900196",
"0.5189289",
"0.5185664",
"0.5183855",
"0.5174498",
"0.51676744",
"0.51585996",
"0.5153837",
"0.5137455",
"0.51373804",
"0.512889",
"0.5128749",
"0.51265657",
"0.51224065",
"0.5118045",
"0.5117028",
"0.5117028",
"0.5105902",
"0.510529",
"0.5098767",
"0.5095084",
"0.50947607",
"0.50906557",
"0.508871",
"0.50831276",
"0.5078058",
"0.5076829",
"0.50716835",
"0.5071586",
"0.5070479",
"0.506242",
"0.5057768",
"0.50509536",
"0.50480574",
"0.50413954",
"0.50391597",
"0.50373685",
"0.5036678",
"0.50339884"
] | 0.83130115 | 0 |
Return the number of subauthorities defined for term fetch | def term_subauthority_count
term_subauthorities.size
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def term_subauthorities\n @term_subauthorities ||= {} if term_config.nil? || !(term_config.key? :subauthorities)\n @term_subauthorities ||= term_config[:subauthorities]\n end",
"def term_subauthorities?\n term_subauthority_count.positive?\n end",
"def subauthorities\n SUBAUTHORITIES.keys\n end",
"def author_count\n revisions = Marginalia.revisions(params[:id])\n authors = []\n revisions.collect {|rev| authors << rev['user']}\n authors.uniq!\n render :text => authors.length\n end",
"def fetch_count_for(id)\n @result_terms.fetch(id.to_s.downcase, 0)\n end",
"def comic_count\r\n \tsorted_articles.length\r\n end",
"def total_terms\n return original_query_offset if normalized_page == 0\n (hits_requested * normalized_page) + original_query_offset\n end",
"def author_word_counts\n joined_authors.map { |author| [author.username, word_count_for(author)] }.sort_by{|a| -a[1] }\n end",
"def first_author_publications_cnt()\n self.investigator_abstracts.first_author_abstracts.length\n end",
"def cantidadAuthors()\n @authors.length()\n end",
"def number_of_concept_influences(login=nil)\n count_by_frbr(login, :is_influenced_by, :how_many_concepts?) \n end",
"def number_of_concept_influences(login=nil)\n count_by_frbr(login, :is_influenced_by, :how_many_concepts?) \n end",
"def descendant_count(*args)\n descendant_rels(*args).size\n end",
"def count(include_subcats = false)\n @count ||= begin\n out = {}\n ci = category_info\n\n out[@name] = {\n :pages => ci.pages.to_i\n }\n\n if include_subcats and ci.subcats.to_i > 0\n out[@name][:subcats] = {}\n members.each do |m|\n out[@name][:subcats].merge! self.class.new(@wiki_bot, m[\"title\"]).count(include_subcats)\n end\n end\n\n out\n end\n end",
"def term_subauthority?(subauth_name)\n subauth_name = subauth_name.to_sym if subauth_name.is_a? String\n term_subauthorities.key? subauth_name\n end",
"def query_7\n document_ids = Perpetuity[Document].select {|document| document.id}.to_a\n return document_ids.size\nend",
"def number_of_descriptive_resources(login=nil)\n count_by_frbr(login, :is_described_by, :how_many_resources?) \n end",
"def number_of_descriptive_resources(login=nil)\n count_by_frbr(login, :is_described_by, :how_many_resources?) \n end",
"def count_permitting( priv, keyword_args = {} )\n all_permitting( priv, keyword_args ).count\n end",
"def child_count(*args)\n child_rels(*args).size\n end",
"def count\n size = 0\n core_search.group(\"name.id, #{main_group_by_columns}\").each do |_x|\n size += 1\n end\n size\n end",
"def call\n uids = dataset ? grouped_uids_dataset : grouped_uids_corpus\n uids_to_term_counts(uids)\n end",
"def topics_count\n object.topics.count\n end",
"def book_count\n # ALL the books\n # if that particular book the author is me\n # all_my_books\n all_my_books.count\n #code\n end",
"def countNumIntran(res)\n\t\tiCount = 0\n\n\t\tif res == nil || res.length == 0\n\t\t\treturn iCount\n\t\tend\n\n\t\tres.each do |constituent|\n\t\t\t# verify Intransitive Verb Phrase\n\t\t\tif(constituent.pos == @vp)\n\t\t\t\t# (or no immediate children at all)\n\t\t\t\tif(constituent.children == nil || !constituent.has_children?)\n\t\t\t\t\tiCount = iCount + 1\n\t\t\t\telse\n\t\t\t\t\t# whose immediate (top-level) constituents include no NPs\n\t\t\t\t\t# containsNps = false\n\t\t\t\t\t# constituent.children.each do |child|\n\t\t\t\t\t# \tif(child.pos == @np)\n\t\t\t\t\t# \t\tcontainsNps = true\n\t\t\t\t\t# \t\tbreak\n\t\t\t\t\t# \tend\n\t\t\t\t\t# end\n\n\t\t\t\t\t# # no top-level constituents found\n\t\t\t\t\t# if(!containsNps)\n\t\t\t\t\t# \tiCount = iCount + 1\n\t\t\t\t\t# end\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tiCount = iCount + countNumIntran(constituent.children)\n\t\tend\n\t\treturn iCount\n\tend",
"def count_books author\n books = @books[author]\n if books == nil\n puts \"No such author\"\n else\n puts books.length\n end\n end",
"def qtd_oms\n clientes.count\n end",
"def x_get_tree_roots\n count_only_or_objects(false, MiqPolicySet.all, :description)\n end",
"def nested_notes_count\n count = notes.any? ? notes.count : 0\n subcategories.each do |category|\n next unless category.notes.any?\n\n count += category.notes.count\n end\n count\n end",
"def score_at(depth)\n return self.citations.count * depth\n end",
"def count_documents rdf_type, allowed_groups = nil\n sparql_query = <<SPARQL\n SELECT (COUNT(?doc) AS ?count) WHERE {\n ?doc a <#{rdf_type}>\n }\nSPARQL\n\n log.debug \"Counting documents for #{allowed_groups}\"\n\n query_result =\n if allowed_groups\n authorized_query sparql_query, allowed_groups\n else\n request_authorized_query sparql_query\n end\n\n documents_count = query_result.first[\"count\"].to_i\n\n log.info \"Found #{documents_count} documents for #{allowed_groups}.\"\n\n documents_count\nend",
"def number_of_concept_genres(login=nil)\n count_by_frbr(login, :has_as_its_genre, :how_many_concepts?) \n end",
"def number_of_concept_genres(login=nil)\n count_by_frbr(login, :has_as_its_genre, :how_many_concepts?) \n end",
"def member_and_collection_count_for_rails2(node)\n if :resources == node.message\n hash_node = node.arguments[2]\n if hash_node\n return (hash_node.grep_nodes_count(:node_type => :lit) - hash_node.grep_nodes_count(:node_type => :hash)) / 2\n end\n end\n 0\n end",
"def number_of_superwork_influences(login=nil)\n count_by_frbr(login, :is_influenced_by, :how_many_superworks?) \n end",
"def counts\n reply.documents[0][COUNTS]\n end",
"def subtree_count(*args)\n subtree_rels(*args).size\n end",
"def count_in_nested_set(*args)\n outer_scope, inner_scope = case args.length\n when 2 then [args[0], args[1]]\n when 1 then [nil, args[0]]\n else [nil, nil]\n end\n acts_as_nested_set_options[:class].with_scope(:find => (outer_scope || {})) do\n acts_as_nested_set_options[:class].count(inner_scope || {})\n end\n end",
"def nb_opinions() opinion_ids.size end",
"def first_author_publications_cnt()\n self.investigator_abstracts.find(:all,\n :conditions => [\"is_first_author = :is_first_author and end_date is null\",\n {:is_first_author => true}] ).length\n end",
"def num_cookmarks\n Rcpref.where([\"recipe_id = ? AND in_collection = ?\", self.id, true]).count\n end",
"def get_noun_words_count\n @redis.llen(\"store:nouns\").to_i\n end",
"def roles_count_total\n count = roles.to_a.count\n sub_circles.each do |sc|\n count += sc.roles_count_total\n end\n count\n end",
"def nr_of_chapters\n all_chapters.count\n end",
"def num_doctors\n doctors.count\n end",
"def number_of_performers(login=nil)\n count_by_frbr(login, :is_performed_by, :how_many_roles?) \n end",
"def number_of_performers(login=nil)\n count_by_frbr(login, :is_performed_by, :how_many_roles?) \n end",
"def member_and_collection_count_for_rails3(node)\n :resources == node.subject.message ? node.grep_nodes_count(:node_type => :call, :message => VERBS) : 0\n end",
"def artist_count\n self.artists.count\n end",
"def count; info['doc_count']; end",
"def entity_expansion_count; end",
"def term_map\n\t\t\tterm_set = Hash.new(0)\n\t\t\tself.to_terms.each do |term|\n\t\t\t\tterm_set[term] = term_set[term] + 1\n\t\t\tend\n\t\t\tterm_set\n\t\tend",
"def related_count(type)\n cyc.talk(\"(length (#{type.to_s.gsub(\"_\",\"-\")} #{self.to_cyc}))\").to_i\n end",
"def count_subjects\n Subject.count(:id)\n end",
"def ancestors_count(*args)\n ancestor_rels(*args).size\n end",
"def num_hits; @hits.size; end",
"def num_hits; @hits.size; end",
"def num_hits; @hits.size; end",
"def get_edorg_auth_count(auth)\n count = 0\n\n return 0 if auth.nil? || auth.edorgs.nil?\n\n auth.edorgs.each do |auth_edorg|\n puts auth_edorg\n count += 1 if auth_edorg.authorizedEdorg\n end\n\n return count\n end",
"def agreed_with_community\n responses = self.responses\n count = 0\n responses.each do |response|\n #count += 1 if response.verdict == response.question.get_community_verdict\n count += 1 if response.question.get_community_verdict(response.verdict)\n end\n return count\n end",
"def noun_count\n 20\nend",
"def nouns\n i = 0\n @synsets.each do |key, values|\n i += values.length\n end\n i\n end",
"def summarizeMain(subKeys = nil)\n counts = Hash.new\n total = 0\n @role.keys.each {|name|\n if (subKeys.nil? || subKeys.include?(name))\n category = @role[name].first\n if (counts[category].nil?)\n counts[category] = [name]\n else\n counts[category].push(name)\n end\n total += 1.0\n end\n }\n return counts, total\n end",
"def fulltree_count(*args)\n fulltree_rels(*args).size\n end",
"def getNbRecompense\n return 0\n end",
"def number_of_expression_parts(login=nil)\n count_by_frbr(login, :contains, :how_many_expressions?) \n end",
"def number_of_roles_dedicated(login=nil)\n count_by_frbr(login, :is_dedicated_to, :how_many_roles?) \n end",
"def count_scorable_city_reviews \n # Below - Collects all the scorable reviews to count for the city\n city_reviews = self.city_reviews.select do |review| \n review.is_scorable_review? == true\n end \n return city_reviews.count\n end",
"def sub_count(account_number)\n account = Recurly::Account.find account_number\n #puts account\n #puts \"Account billing_info: #{account.billing_info}\"\n puts \"subscriptions count for #{account.account_code}: #{account.subscriptions.count}\"\n account.subscriptions.count\n end",
"def count_of_associated_requests\n self.requests.functional.count\n end",
"def num_corpus_documents\n @corpus_size ||= begin\n solr_query = {}\n solr_query[:q] = '*:*'\n solr_query[:qt] = 'precise'\n solr_query[:rows] = 1\n solr_query[:start] = 0\n \n solr_response = Solr::Connection.find solr_query\n \n if solr_response[\"response\"] &&\n solr_response[\"response\"][\"numFound\"]\n solr_response[\"response\"][\"numFound\"]\n else\n # FIXME: Should we raise an error here?\n 1\n end\n end\n end",
"def api_count(args)\n query_str = args[:query]\n object_name = args[:entity].pluralize\n my_response = HTTParty.get(\"https://api.rechargeapps.com/#{object_name}/count?#{query_str}\",\n headers: HEADER)\n my_count = my_response['count'].to_i\n Resque.logger.info \"#{my_count} #{object_name}'s on Recharge API\"\n Resque.logger.info my_response\n my_count\n end",
"def number_of_realisations(login=nil)\n count_by_frbr(login, :is_realised_through, :how_many_expressions?) \n end",
"def total_class_count(name_of_class)\n begin\n # pluralize the incoming string\n method = name_of_class.underscore.pluralize\n count = self.send(\"#{method}\").size\n self.descendant_ids.each {|id| count += Agency.find(id).send(\"#{method}\").size}\n return count\n rescue NoMethodError\n end\n end",
"def number_of_superwork_evidences(login=nil)\n count_by_frbr(login, :is_evidence_of, :how_many_superworks?) \n end",
"def update_count\n self.term_taxonomies.update_column('count', self.term_taxonomies.posts.published.size) if self.term_taxonomies.present? && !self.term_taxonomies.try(:posts).nil?\n end",
"def company_count\n return 0 unless answer_id\n Card.search left_id: answer_id,\n right: { type_id: WikirateCompanyID },\n return: :count\nend",
"def offense_count\n revision = current_revision\n revision ? revision.offense_count : :unavailable\n end",
"def issues_descendant_count(issues)\n ids = issues.reject(&:leaf?).map {|issue| issue.descendants.ids}.flatten.uniq\n ids -= issues.map(&:id)\n ids.size\n end",
"def offense_counts; end",
"def offense_counts; end",
"def count\n # implement in subclasses\n end",
"def terms\n end",
"def counts\r\n @counts\r\n end",
"def get_all_documents_count\n get_all_documents_ids.count\n end",
"def terms\n\tend",
"def genre_count(term)\n #count the genres in object.get_genres\n genres = Hash.new(0)\n object.get_genres(term).each do |genre|\n case\n when genre.include?(\"rap\")\n genres[:rap]+=1\n when genre.include?(\"pop\")\n genres[:pop]+=1\n when genre.include?(\"country\")\n genres[:country]+=1\n when genre.include?(\"indie\")\n genres[:indie]+=1\n when genre.include?(\"hip\")\n genres[\"hip hop\"]+=1\n when genre.include?(\"rock\")\n genres[:rock]+=1\n when genre.include?(\"jazz\")\n genres[:jazz]+=1\n when genre.include?(\"instrumental\")\n genres[:instrumental]+=1\n when genre.include?(\"r&b\")\n genres[\"r&b\"]+=1\n else\n genres[:misc] +=1\n end\n end\n genres\n end",
"def count_scorable_department_reviews \n # Below - Collects all the scorable reviews to count for the city\n department_reviews = self.department_reviews.select do |review| \n review.is_scorable_review? == true\n end \n return department_reviews.count\n end",
"def number_of_commissioned_expressions(login=nil)\n count_by_frbr(login, :has_commissioned, :how_many_expressions?) \n end",
"def count_sub_percen(category)\n\t\tselect=self.user_program_form_values.where(:form_key_category=>category, :check=>true ).count\n\t\tall=self.user_program_form_values.where(:form_key_category=>category).count\n\t\tif all > 0\n\t\t\t(select*100) / all\n\t\telse\n\t\t\treturn 0\n\t\tend\n\tend",
"def compute_score_for_related_article(article)\n score = 0\n unless article.categories.blank?\n article.categories.each do |category|\n if category.in? categories\n score += 1\n end\n end\n end\n score\n end",
"def total_options\n descendants.count\n end",
"def count; end",
"def count; end",
"def count; end",
"def start_of_terms\n return 0 if normalized_page == 0\n total_terms - hits_requested\n end",
"def total_results\n opensearch_totalResults\n end",
"def count\n @options[:select] = \"COUNT\"\n @options.delete(:attributes_to_get)\n\n response = run\n\n while continue?(response)\n @options[:exclusive_start_key] = response.last_evaluated_key\n response = run(response)\n end\n\n response.count\n end",
"def add_document_terms(terms)\n\t\t\tterms.each_key do |term|\n\t\t\t\t@term_hash[term] = @term_hash[term] + 1\n\t\t\tend\n\t\tend",
"def terms\n\n end"
] | [
"0.7275419",
"0.7162359",
"0.6783471",
"0.65590227",
"0.596303",
"0.5954418",
"0.59074116",
"0.59045035",
"0.5845982",
"0.5794759",
"0.57620573",
"0.57620573",
"0.5733754",
"0.57333744",
"0.5708774",
"0.5674188",
"0.5631695",
"0.5631695",
"0.56295884",
"0.5615472",
"0.55641556",
"0.5549506",
"0.55298805",
"0.5526724",
"0.5523836",
"0.5515002",
"0.5500724",
"0.54874766",
"0.54757804",
"0.5456616",
"0.54513055",
"0.54494786",
"0.54494786",
"0.54414815",
"0.5435953",
"0.5423393",
"0.5414027",
"0.54136354",
"0.5406232",
"0.53919995",
"0.5382391",
"0.5376144",
"0.53711087",
"0.5359063",
"0.53439695",
"0.5343679",
"0.534295",
"0.5342627",
"0.5335816",
"0.53318506",
"0.5321642",
"0.5303363",
"0.5290912",
"0.5284395",
"0.5282947",
"0.52793276",
"0.52793276",
"0.52793276",
"0.5278071",
"0.52738154",
"0.52673244",
"0.52637476",
"0.52612764",
"0.5254633",
"0.5253075",
"0.5250743",
"0.5250428",
"0.52208596",
"0.52204597",
"0.52188385",
"0.5216355",
"0.52147603",
"0.5211854",
"0.5204564",
"0.5202957",
"0.5198593",
"0.5198461",
"0.518319",
"0.5181612",
"0.51804",
"0.51804",
"0.5171602",
"0.51703507",
"0.51568955",
"0.51531744",
"0.5141764",
"0.51414526",
"0.513808",
"0.51368934",
"0.51347387",
"0.5132719",
"0.512643",
"0.51260835",
"0.51260835",
"0.51260835",
"0.5122302",
"0.51217616",
"0.5119145",
"0.5117042",
"0.5116624"
] | 0.85006934 | 0 |
Return the list of subauthorities for term fetch | def term_subauthorities
@term_subauthorities ||= {} if term_config.nil? || !(term_config.key? :subauthorities)
@term_subauthorities ||= term_config[:subauthorities]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subauthorities\n SUBAUTHORITIES.keys\n end",
"def term_subauthority_count\n term_subauthorities.size\n end",
"def term_subauthorities?\n term_subauthority_count.positive?\n end",
"def secondary_terms\n []\n end",
"def secondary_terms\n []\n end",
"def secondary_terms\n []\n end",
"def term_subauthority?(subauth_name)\n subauth_name = subauth_name.to_sym if subauth_name.is_a? String\n term_subauthorities.key? subauth_name\n end",
"def secondary_terms\n []\n end",
"def subcategories_and_ids_list\n url_no_page = \"#{SUBCATEGORIES_URL}?#{TOKEN_PREFIX}#{OAUTH_TOKEN}&#{PAGE_PREFIX}\"\n subcategory_names_and_ids = []\n (1..4).each do |i|\n url = url_no_page + \"#{i}\"\n subcategories = JSON.parse(open(url).read)\n subcategories[\"subcategories\"].each do|subcategory|\n subcategory_names_and_ids << {name: subcategory[\"name\"], id: subcategory[\"id\"]}\n end\n end\n subcategory_names_and_ids\n end",
"def secondary_terms\n [:creator,\n :contributor,\n :keyword,\n :license,\n :publisher,\n :date_created,\n :subject,\n :language,\n :identifier,\n :based_near,\n :campus,\n :related_url,\n :resource_type]\n end",
"def terms\n @term_hash.values\n end",
"def get_subcategories\r\n sub_categories = Taxonomy.get_subcategories\r\n render json: sub_categories, root: 'categories', adapter: :json, status: :ok\r\n end",
"def get_authors\n @branches.collect(&:author_names).flatten.uniq.sort_by { |k| k.downcase }\n end",
"def terms\n [self]\n end",
"def get_related_authors\n tag = params['query']\n\n @articles = get_articles(tag) # gets all articles of this author\n # puts 'ARTICLES'\n # ap @articles\n\n @related_articles = []\n @authors = []\n\n # for each of the author's articles, get 1st degree articles and their respective authors\n @articles.each do |article|\n puts \"ARTIClE ID \"\n puts article.arxiv_id\n getRelatedPapers(article.arxiv_id, -1).each do |related|\n\n authors = related.authors\n authors.each do |author|\n\n if [email protected]?(author)\n @authors << author\n end\n\n end\n end\n end\n \n\n @found = 1\n if @authors == []\n @msg = \"None found, try again...\"\n @found = 0\n end\n\n render \"authors\"\n end",
"def all_child_terms\n get_all_child_lists\n return @all_child_terms\n end",
"def search_all_terms\n render json: Article.with_all_terms(params[:query]).map(&:title)\n end",
"def subaccounts()\n get('subAccounts')\n end",
"def index\n authors = Author.where('name LIKE ?', \"%#{params['term']}%\").order(:name)\n authors = authors.map { |e| { id: e.id, value: e.name } }\n authors << { id: -1, value: TOO_MANY_MESSAGE } if authors.size >= TOO_MANY\n render json: authors\n end",
"def course_students\n return student_terms.find_all_by_term_type(\"Course\")\n end",
"def terms\n end",
"def co_author_list \n if self.first_author \n list = [self.first_author]\n list.concat self.coauthors.reject{|ca|ca ==self.first_author}\n return list\n else\n return self.coauthors\n end\n end",
"def authorize_term(field, term)\n authorized_terms = []\n if field.include?(\"_facet\") or field.include?(\"_display\")\n authorized_terms << check_term(field.split(\"_\")[0], term) # the .split is b/c \"originator_display\" would be under the \"originator\" values in the yaml file\n else\n authorized_terms << term\n authorized_terms << check_term(field.split(\"_\")[0], term)\n end\n \n return authorized_terms.uniq\n \n end",
"def terms\n\n end",
"def terms\n\n end",
"def terms\n\tend",
"def all_subjects\n observations + profile_users + glossary_terms\n end",
"def term_list(terms)\n ignored = params.keys - ['q', 'solr_document_id', 'action', 'controller']\n list_id = request.original_url\n term_list = IIIF::Presentation::Resource.new('@id' => list_id)\n term_list['@context'] = 'http://iiif.io/api/search/1/context.json'\n term_list['@type'] = 'search:TermList'\n term_list['terms'] = terms\n term_list['ignored'] = ignored\n term_list.to_ordered_hash(force: true, include_context: false)\n end",
"def index\n @terms = Term.where(:user_id => session[:user_id])\n end",
"def primary_terms\n terms - [:visibility, :collection_type_gid]\n end",
"def subcategories\n @subcategories ||= Category.find_all_subcategories(category_name)\n end",
"def courses_in_term( term )\n cur = CoursesUser.find(:all, :conditions => [\"user_id = ? and term_id =?\", self.id, term.id])\n cur.sort! do |x,y| \n result = x.position <=> y.position\n result = x.course.title <=> y.course.title if result == 0\n result\n end \n end",
"def index\n render json: Term.roots\n .includes(:user)\n .map(&:serialize_list),\n status: :ok\n end",
"def index\n @authorities = Authority.all\n end",
"def index\n @authorities = Authority.all\n end",
"def secondary_terms\n [:gw_affiliation, :date_created,\n :description, :keyword,\n :identifier, :contributor, :publisher, :language,\n :based_near, :related_url, :bibliographic_citation]\n end",
"def authors\n author\n end",
"def get_terms(repositoryName='ComputerScience_test')\n repo = set_repository(repositoryName)\n \n # SparQL queries\n @repository.query.language = :sparql\n res = @repository.query.perform \"SELECT distinct ?Class ?Subclass WHERE { ?Subclass rdfs:subClassOf ?Class . } Order by ?Class \"\n terms = Set.new\n # I know this could be done more efficiently...\n res['values'].each do |pair|\n terms.add(pair[0])\n terms.add(pair[1]) \n end\n terms \n end",
"def expertise\n subcategories.map(&:name).to_sentence\n end",
"def authors\n @authors\n end",
"def list(q=nil)\n _params = {:q => q}\n return @master.call 'subaccounts/list', _params\n end",
"def index_ontology_terms_from_cache( doc, term_conf, cached_data )\n [:term,:term_name].each do |term_or_name|\n cached_data[term_or_name].each do |target|\n doc[ term_conf[\"idx\"][term_or_name.to_s].to_sym ].push( target )\n end\n doc[ term_conf[\"idx\"][\"breadcrumb\"].to_sym ].push( cached_data[term_or_name].join(\" | \") )\n end\n end",
"def terms\n @locations.map(&:term).uniq\n end",
"def terms\n @data.flatten.uniq\n end",
"def index\n @subcategories = @category.subcategories\n end",
"def terms_for_editing\n terms_for_display\n end",
"def student_terms\n @student_terms ||= StudentTerm.find_by_uid(uid)\n end",
"def index\n @admin_terms = Admin::Term.search(params[:query]).order('lower(title) ASC').page(params[:page]).per(32)\n #@admin_terms = Admin::Term.all\n end",
"def terms\n @data.map(&:uniq).flatten\n end",
"def get_courses (subdomain,subaccount_id)\n token = get_token\n courses = get_all_pages(\n token,\n \"https://#{subdomain}.instructure.com/api/v1/accounts/#{subaccount_id}/courses\"\n #needs to change for pageviews include[]=teachers&include[]=total_students&state[]=available&state[]=completed\"\n )\n end",
"def index\n conditions = { :block => false }\n conditions.merge!( :is_opinion => true ) if params[:opinion] == '1'\n conditions.merge!( :is_agency => true ) if params[:agency] == '1'\n unless params[:author_id].blank? && params[:author_ids].blank?\n author_ids = scan_multiple_value_param( :author_id, :first ) || scan_multiple_value_param( :author_ids )\n conditions.merge!( :id => author_ids )\n end\n params[:top] == '1' ? top() : ( !params[:q].blank? ? search( conditions ) : list( conditions ) )\n @authors.delete_if{ |a| a.story_authors.count < 2 } if params[:cf] == '1'\n rxml_data( @authors, :root => 'authors', :with_pagination => true )\n end",
"def list\n response = Tiptaplab.api.make_call(\"users/authorizations\")\n response.keys\n end",
"def index\n @termcats = Termcat.includes(:terms).order(:id)\n end",
"def index\n @authors = Author.order(:name).where(\"name like ?\", \"%#{params[:term]}%\")\n autoload_helper(@authors, :name)\n end",
"def index\n @q = Author.search(params[:q])\n @authors = @q.result(distinct: true).paginate(:page => params[:page]).order('last_name ASC')\n end",
"def search_terms\n return @search_terms\n end",
"def term_subauthority_replacement_pattern\n return {} unless term_subauthorities?\n @term_subauthority_replacement_pattern ||= {} if term_config.nil? || !term_subauthorities?\n pattern = term_qa_replacement_patterns[:subauth]\n @term_subauthority_replacement_pattern ||= { pattern: pattern, default: term_url_mappings[pattern.to_sym][:default] }\n end",
"def authored_articles\n Article.where(author: self)\n end",
"def authorities\r\n ptr = Api.proj_get_authorities_from_database(self.context)\r\n Strings.new(ptr)\r\n end",
"def terms\n TermsList.new(@contents.values)\n end",
"def term_list\n terms = Array.new\n\n self.notes.each do |note|\n note.scrubbed_notes.each do |word|\n term_index = terms.index(word)\n if term_index.nil?\n terms.push(word)\n end\n end\n end\n terms\n end",
"def brief_terms\n [\n #:relation,\n :asset_type,\n :uid,\n :pref_label\n ]\n end",
"def get_subc(category)\n retval = []\n #Category.where(category_id: category.id).each do |c| \n category.categories.each do |c| \n retval += [c] + get_subc(c)\n end\n retval\n end",
"def subentries\n\t\t# If we have our own subentries, use them.\n\t\town_subentries = Subentry.joins(:etymotheses).where(:etymotheses => {:etymology_id => id}).all\n\t\treturn own_subentries if own_subentries.present?\n\t\t\n\t\t# If we are next etymon of anything else, use that etymon's subentries.\n\t\tprev_etymon = Etymology.where(:next_etymon_id => id).first\n\t\treturn prev_etymon.subentries if prev_etymon\n\t\t\n\t\t# Default response\n\t\t[]\n\tend",
"def terms\n @terms ||= wayfinder.decorated_ephemera_terms.sort_by(&:label)\n end",
"def terms\n raise NotImplementedError\n end",
"def get_chapters\n @subject = Subject.find(params[:id]) unless params[:id].blank?\n if current_user.is?(\"EA\") or current_user.is?(\"IA\")\n list = @subject.chapters.map {|u| Hash[value: u.id, name: u.name]}\n else\n chapter_ids = ContentUserLayout.get_unlocked_chapters(@subject,current_user)\n if !chapter_ids.nil?\n list = @subject.chapters.where(:id=>chapter_ids).map {|u| Hash[value: u.id, name: u.name]}\n else\n list = @subject.chapters.map {|u| Hash[value: u.id, name: u.name]}\n end\n end\n render json: list\n end",
"def listAuthors\n @items = Author.all(:conditions => [\"name LIKE ?\", params[:query].downcase + '%' ], \n :order => :name,\n :select => :name)\n @items += Author.all(:conditions => [\"name LIKE ?\", '%' + params[:query].downcase + '%'],\n :order => :name,\n :select => :name)\n render :text => @items.collect { |x| x.name }.uniq.join(\"\\n\") \n end",
"def subcontractors_all\n @work_order_subcontractors = WorkOrderSubcontractor.by_id\n render json: serialized_work_order_subcontractors(@work_order_subcontractors)\n end",
"def primary_terms\n [:title, :description, :source, :rights_note]\n end",
"def toys_that_jet_owns_sub\n # Find all of the toys that Jet owns. Then list the the names of all \n # the other cats that own those toys as well as the toys names.\n # Exclude Jet from the results.\n # Order alphabetically by cat name. \n\n # USE A SUBQUERY\n execute(<<-SQL)\n SELECT\n cats.name, toys.name\n FROM cattoys\n JOIN cats ON cat_id = cats.id\n JOIN toys ON toy_id = toys.id\n WHERE\n toys.id IN (\n SELECT toys.id\n FROM cattoys\n JOIN cats ON cat_id = cats.id\n JOIN toys ON toy_id = toys.id\n WHERE cats.name = 'Jet'\n ) AND cats.name != 'Jet'\n ORDER BY cats.name;\n SQL\nend",
"def get_terms(params)\n send_get \"get_terms\", params\n end",
"def searchauthor\n end",
"def index\n @sub_per_users = SubPerUser.all\n end",
"def sub_accounts(conditions = {})\n client.accounts.list(conditions)\n end",
"def primary_terms\n terms - self.class.hyrax_form_fields\n end",
"def show_authors(result)\n author_array = []\n if result['Items'].present?\n flag = 0\n authorString = []\n result['Items'].each do |item|\n if item['Group'].present?\n if item['Group'] == \"Au\"\n # let Don and Michelle know what this cleaner function does\n newAuthor = processAPItags(item['Data'].to_s)\n # i'm duplicating the semicolor - fix\n newAuthor.gsub!(\"<br />\", \"; \")\n authorString.push(newAuthor)\n flag = 1\n end\n end\n end\n if flag == 1\n return truncate_article authorString.join(\"; \").html_safe\n end\n end\n contributors = result.fetch('RecordInfo', {}).fetch('BibRecord', {}).fetch('BibRelationships', {}).fetch('HasContributorRelationships', [])\n if not contributors.empty?\n contributors.each do |contributor|\n namefull = contributor.fetch('PersonEntity', {}).fetch('Name', {}).fetch('NameFull', nil)\n if namefull\n url_vars = {\"q\" => '\"' + namefull.gsub(\",\", \"\").gsub(\"%2C\", \"\").to_s + '\"', \"search_field\" => \"author\"}\n link2 = generate_next_url_newvar_from_hash(url_vars)\n author_link = '<a href=\"' + request.fullpath.split(\"?\")[0] + \"?\" + link2 + '\">' + namefull.to_s + '</a>'\n author_array.push(author_link)\n end\n\n end\n return author_array.join(\"; \").html_safe\n end\n return ''\n end",
"def show_all_authors\n @all = []\n search_techcrunch[\"articles\"].each do |article|\n @all << article[\"author\"]\n end\n unique_array = @all.uniq!.sort\n puts \"#{dashes}\\n\"\n unique_array.each_with_index do |author, index| puts \"#{index+1}. #{author}\"\n end\n return nil\n end",
"def fetch_related_objects(subject,association_name,*indices)\n check_subject_and_association(subject,association_name)\n __send__(plural_association_method(subject.type,association_name),subject.rod_id,*indices)\n end",
"def subquery_accessible entity\r\n result = []\r\n if entity.accessible?\r\n entity.children.each { |c|\r\n result.push c\r\n result.concat subquery_accessible(c)\r\n }\r\n end\r\n result\r\n end",
"def index\n @admin_tags = @login_author.tags\n end",
"def search_organizations(term, value)\n results = @organizations_indice.search(term: term, value: value)\n if perform_search_by_id?(term)\n results.each do |organization|\n # Get related tickets\n organization['tickets'] =\n @tickets_indice.search(term: 'organization_id', value: organization['_id'])\n\n # Get related users\n organization['users'] =\n @users_indice.search(term: 'organization_id', value: organization['_id'])\n end\n end\n results\n end",
"def search\n terms = @authority.search(url_search)\n render json: terms\n end",
"def traditional_authority\n district_id = DDEDistrict.find_by_name(\"#{params[:filter_value]}\").id\n traditional_authority_conditions = [\"name LIKE (?) AND district_id = ?\", \"%#{params[:search_string]}%\", district_id]\n\n traditional_authorities = DDETraditionalAuthority.find(:all,:conditions => traditional_authority_conditions, :order => 'name')\n traditional_authorities = traditional_authorities.map do |t_a|\n \"<li value=\\\"#{t_a.name}\\\">#{t_a.name}</li>\"\n end\n render :text => traditional_authorities.join('') + \"<li value='Other'>Other</li>\" and return\n end",
"def get_sub_accounts(subdomain,account_id)\n token = get_token\n subaccount_ids = get_all_pages(\n token,\n \"https://#{subdomain}.instructure.com/api/v1/accounts/#{account_id}/sub_accounts?recursive=true\").map{|s| s['id']}\n\n end",
"def index_for_authority(authority)\n SUBAUTHORITIES[authority]\n end",
"def index\n @term_relationships = TermRelationship.all\n end",
"def documents\n authorizations.map(&:document)\n end",
"def subentries\n # If we have our own subentries, use them.\n own_subentries = Subentry.joins(:etymotheses).where(etymotheses: { etymology_id: id })\n return own_subentries if own_subentries.exists?\n\n # If we are next etymon of anything else, use that etymon's subentries.\n prev_etymon = Etymology.where(next_etymon_id: id).first\n return prev_etymon.subentries if prev_etymon\n\n # Default response\n []\n end",
"def authors\n # 1. Find all of the books in this genre\n # 2. Return back the author for every book\n books.collect do |book|\n # Each book, I want the author\n book.author\n end.uniq\n end",
"def index\n @q = Author.ransack(params[:q])\n \n # The sortable_name field gives the last name downcased with \"ae\" etc substituted for umlauted vowels\n @authors = @q.result.paginate(:page => params[:page], :per_page => 14).order(sortable_name: :asc, firstnames: :asc)\n end",
"def get_all_authors\n count = params[:count] # Optional - and must be an integer. Cuts the amount of authors return down to the number specified.\n timeline = params[:timeline] # Optional - and must be boolean. Determines whether to return personality predictions by day, month, and year.\n traits = params[:traits] # Optional - value must be a substring of \"ESACO\". Determines which traits to return.\n puts \"count:#{count}\"\n puts \"timeline:#{timeline}\"\n puts \"traits:#{traits}\"\n\n request = Net::HTTP::Get.new(\"/personality-api/1/all_authors.json?count=#{count}&timeline=#{timeline}&traits=#{traits}\")\n request.basic_auth BmnPersonalityApiSkeletonRor::Application.config.user_name, BmnPersonalityApiSkeletonRor::Application.config.password\n response = @http.request(request)\n render :text => response.body\n\n end",
"def sub_categories(params = {})\n @sub_categories ||= client.categories.all(params.merge(parent: id))\n end",
"def get_children( node=self )\n sql = <<-SQL\n select\n subject_term.identifier as child_identifier,\n subject_term.term_name as child_term,\n predicate_term.term_name as relation,\n object_term.identifier as parent_identifier,\n object_term.term_name as parent_term\n from\n term_relationship tr\n join term as subject_term on tr.subject_term_pk = subject_term.term_pk\n join term as predicate_term on tr.predicate_term_pk = predicate_term.term_pk\n join term as object_term on tr.object_term_pk = object_term.term_pk\n where\n predicate_term.term_name in ('part_of','is_a','develops_from')\n and object_term.identifier = ?\n SQL\n \n OLS_DB[sql,node.term].each do |row|\n child = OntologyTerm.new( row[:child_identifier], row[:child_term] )\n node << child\n end\n end",
"def get_author_list(record)\n author_list = []\n authors_primary = record.find { |f| f.tag == '100' }\n begin\n author_primary = authors_primary.find { |s| s.code == 'a' }.value unless authors_primary.nil?\n rescue StandardError\n ''\n end\n author_list.push(clean_end_punctuation(author_primary)) unless author_primary.nil?\n authors_secondary = record.find_all { |f| f.tag == '700' }\n authors_secondary&.each do |l|\n unless l.find { |s| s.code == 'a' }.nil?\n author_list.push(clean_end_punctuation(l.find { |s| s.code == 'a' }.value)) unless l.find { |s| s.code == 'a' }.value.nil?\n end\n end\n author_list.uniq!\n author_list\n end",
"def collections\n return [] if name.nil?\n\n query = Solr::Query.new(\n collections_query,\n 100,\n fq: \"-ancestor_id_ssim:[* TO *]\"\n )\n query.to_a\n end",
"def subproducts\n if self.role?(:secretary) || self.role?(:team_manager)\n user_id = self.service_provider_id_by_telephony.present? ? ServiceProvider.find(self.service_provider_id_by_telephony).user_id : self.id\n employee_id = self.verified_lawyer_id_by_secretary\n @subproduct_assignment ||= SubproductAssignment.all(:include => [:product_licence, :subproduct], :conditions => ['user_id = ? AND employee_user_id = ?', user_id, employee_id])\n else\n @subproduct_assignment ||= SubproductAssignment.all(:include => :subproduct, :conditions => ['user_id = ?', self.id])\n end\n mysubproducts = []\n for myObj in @subproduct_assignment\n mysubproducts << myObj.subproduct.name.to_s\n end\n mysubproducts\n end",
"def search_tickets(term, value)\n results = @tickets_indice.search(term: term, value: value)\n if perform_search_by_id?(term)\n results.each do |ticket|\n # Get related organizations\n ticket['organizations'] =\n @organizations_indice.search_by_primary_key(value: ticket['organization_id'])\n\n # Get related users who are submitters\n ticket['submitters'] =\n @users_indice.search_by_primary_key(value: ticket['submitter_id'])\n\n # Get related users who are assignees\n ticket['assignees'] =\n @users_indice.search_by_primary_key(value: ticket['assignee_id'])\n end\n end\n results\n end",
"def categories\n expose Metadata.categories(@oauth_token)\n end",
"def index\n if params[:terms]\n # Search mode\n @organizations = []\n JSON.parse(params[:terms]).map { |t| @organizations = @organizations | MnoEnterprise::Organization.where(Hash[*t]).fetch }\n response.headers['X-Total-Count'] = @organizations.count\n else\n # Index mode\n query = MnoEnterprise::Organization\n query = query.limit(params[:limit]) if params[:limit]\n query = query.skip(params[:offset]) if params[:offset]\n query = query.order_by(params[:order_by]) if params[:order_by]\n query = query.where(params[:where]) if params[:where]\n all = query.all\n\n all.params[:sub_tenant_id] = params[:sub_tenant_id]\n all.params[:account_manager_id] = params[:account_manager_id]\n\n @organizations = all.fetch\n\n response.headers['X-Total-Count'] = @organizations.metadata[:pagination][:count]\n end\n end"
] | [
"0.76643497",
"0.69095445",
"0.6396478",
"0.61391807",
"0.61391807",
"0.61391807",
"0.6114977",
"0.6111542",
"0.5898662",
"0.5822158",
"0.57895225",
"0.57468915",
"0.57323104",
"0.5702708",
"0.5702091",
"0.5699518",
"0.5672731",
"0.5664483",
"0.565798",
"0.56277585",
"0.56123954",
"0.5609578",
"0.5594944",
"0.55899316",
"0.55899316",
"0.5579841",
"0.5540783",
"0.5524279",
"0.54938966",
"0.5491901",
"0.54718906",
"0.5469111",
"0.54596853",
"0.5446565",
"0.5446565",
"0.5444018",
"0.5431248",
"0.54037535",
"0.5393759",
"0.53889847",
"0.538089",
"0.53802717",
"0.53781104",
"0.53750396",
"0.5371941",
"0.53701067",
"0.53692365",
"0.53640467",
"0.53542876",
"0.53498197",
"0.5342781",
"0.5340692",
"0.53391725",
"0.5336772",
"0.53311646",
"0.53238505",
"0.53187454",
"0.5300421",
"0.5295385",
"0.528476",
"0.52783597",
"0.5277953",
"0.5254585",
"0.5249777",
"0.5244322",
"0.52424973",
"0.52326447",
"0.52297115",
"0.52114373",
"0.52071875",
"0.5203167",
"0.5201353",
"0.51997465",
"0.51909024",
"0.51842576",
"0.51814497",
"0.5178663",
"0.51682925",
"0.5152333",
"0.51511365",
"0.5147725",
"0.51405",
"0.5138555",
"0.51375806",
"0.5134026",
"0.5131759",
"0.5126428",
"0.5126216",
"0.5104271",
"0.5104057",
"0.51009506",
"0.509859",
"0.5096329",
"0.50850725",
"0.5084863",
"0.5065701",
"0.5060067",
"0.50555456",
"0.50468504",
"0.50441605"
] | 0.79320955 | 0 |
Return the replacement configurations | def term_subauthority_replacement_pattern
return {} unless term_subauthorities?
@term_subauthority_replacement_pattern ||= {} if term_config.nil? || !term_subauthorities?
pattern = term_qa_replacement_patterns[:subauth]
@term_subauthority_replacement_pattern ||= { pattern: pattern, default: term_url_mappings[pattern.to_sym][:default] }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def as_replacements; end",
"def as_replacements; end",
"def as_replacements; end",
"def replaces\n @replaces ||= []\n end",
"def replaces\n @replaces ||= []\n end",
"def configurations; end",
"def matched_configs\n [@full_config['environments'][environment], @full_config['nodes'][fqdn]]\n end",
"def configurations\n @configurations ||= []\n end",
"def configurations\n return @configurations if @configurations\n \n configurations = CONFIGURATIONS_CLASS.new\n configurations.extend(IndifferentAccess) if @use_indifferent_access\n \n ancestors.reverse.each do |ancestor|\n next unless ancestor.kind_of?(ClassMethods)\n ancestor.config_registry.each_pair do |key, value|\n if value.nil?\n configurations.delete(key)\n else\n configurations[key] = value\n end\n end\n end\n \n configurations\n end",
"def replacements; 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 term_replacements\n return @term_replacements unless @term_replacements.nil?\n @term_replacements = {}\n @term_replacements = term_url_mappings.select { |k, _v| !term_qa_replacement_patterns.value?(k.to_s) } unless term_config.nil? || term_url_mappings.nil?\n @term_replacements\n end",
"def configuration\n cfg = []\n @entries.each {|e| cfg.push(e.source)}\n return(cfg)\n end",
"def pool_configurations\n ActiveRecord::Base.configurations.map do |name, config|\n next unless name.to_s =~ /#{ReplicaPools.config.environment}_pool_(.*)_name_(.*)/\n [name, $1, $2]\n end.compact\n end",
"def smash_configs\n # private overrides public general config\n a = remove_environments(@general_config_pub)\n b = remove_environments(@general_config_priv)\n general = a.merge(b)\n\n # private overrides public collection config\n c = remove_environments(@collection_config_pub)\n d = remove_environments(@collection_config_priv)\n collection = c.merge(d)\n\n # collection overrides general config\n return general.merge(collection)\n end",
"def merged_config_for_generator\n return {}\n end",
"def configuration\n cfg = []\n @entries.each {|e| cfg.push(e.configuration)}\n return(cfg)\n end",
"def configuration\n cfg = []\n @entries.each {|e| cfg.push(e.configuration)}\n return(cfg)\n end",
"def configuration\n cfg = []\n @entries.each {|e| cfg.push(e.configuration)}\n return(cfg)\n end",
"def configurations\n if @configurations.blank?\n @configurations = FeedTools.configurations.dup\n end\n return @configurations\n end",
"def grifter_configuration\n @config.clone\n end",
"def configurations\n @configurations ||= begin\n if configurations = config.dig(\"gradle\", \"configurations\")\n Array(configurations)\n else\n DEFAULT_CONFIGURATIONS\n end\n end\n end",
"def configurations\n @configurations ||= begin\n if configurations = config.dig(\"gradle\", \"configurations\")\n Array(configurations)\n else\n DEFAULT_CONFIGURATIONS\n end\n end\n end",
"def config_files(override); end",
"def retriable_configuration\n Take2::Configuration::CONFIG_ATTRS.each_with_object({}) do |key, hash|\n hash[key] = send(key)\n end\n end",
"def applied_config\n @applied_config ||= {}\n end",
"def term_qa_replacement_patterns\n Config.config_value(term_config, :qa_replacement_patterns)\n end",
"def replacements_params\n params.\n permit(replacements: [:url, :replacement, :original]).\n fetch(:replacements, {})\n end",
"def configuration\n cfg = []\n @entries.each {|e| cfg.push(e.desc)}\n return(cfg)\n end",
"def old()\n\t\treturn @oldConfig\n\tend",
"def get_override_settings\n {}\n end",
"def sources\n @settings.sources.to_a.inject({}) do |result, (source_id, source)|\n result[source_id] = source[:adapter].configuration\n result\n end\n end",
"def configs\n @configuration.ids\n end",
"def merge_configs\n # Update our original_config - if someone has created a knife command\n # instance directly, they are likely ot have set cmd.config values directly\n # as well, at which point our saved original config is no longer up to date.\n @original_config = config.dup\n # other code may have a handle to the config object, so use Hash#replace to deliberately\n # update-in-place.\n config.replace(config_file_defaults.merge(default_config).merge(config_file_settings).merge(config))\n end",
"def configured_adapters\n # Get our adapters as above.\n adapters = ADAPTERS.dup\n\n # Get all configured custom adapters and iterate over them.\n QuirkyApi.adapters.all.each do |configured_adapter|\n # Get the index of the adapter that will be used to determine\n # placement on the custom adapter.\n index = adapters.index(configured_adapter[:adapter])\n\n # Get the pre-existing adapter at that index.\n old_adapter = adapters[index]\n\n # Determine the placement of the new adapter by the 'placement'\n # specified when you configured it (based upon insert_before/after).\n # '+1' here means the new adapter should go after the old one, '-1'\n # means it should go before the old one.\n case configured_adapter[:placement]\n # Append\n when '+1'\n # Put the new adapter immediately after the old adapter.\n adapters[index, 1] = [old_adapter, configured_adapter[:new_adapter]]\n # Prepend\n when '-1'\n # Put the ne wadapter immediately before the old adapter.\n adapters[index, 1] = [configured_adapter[:new_adapter], old_adapter]\n end\n end\n\n # Return all adapters such as they are.\n adapters\n end",
"def substitute_from_config_libraries(sql)\n Admin::ConfigLibrary.make_substitutions! sql, :sql\n sql\n end",
"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 configuration\n Stupidedi::Config.new.customize do |c|\n c.interchange.customize do |x|\n x.register(\"00401\") { Stupidedi::Versions::Interchanges::FourOhOne::InterchangeDef }\n end\n\n c.functional_group.customize do |x|\n x.register(\"004010\") { Stupidedi::Versions::FunctionalGroups::FortyTen::FunctionalGroupDef }\n end\n\n c.transaction_set.customize do |x|\n # Not using the barebone transaction set definition, as it doesn't have enough constraints to parse\n # the document with multiple levels of HL (not deterministic)\n # x.register(\"004010\", \"SH\", \"856\") { Stupidedi::Contrib::FortyTen::TransactionSetDefs::SH856 }\n \n # Modified the guide to include REF element for the Line Item HL\n x.register(\"004010\", \"SH\", \"856\") { Stupidedi::Contrib::FortyTen::Guides::SH856 }\n end\n end\n end",
"def all_configurations\n @all_configuration ||= Configuration.new(:all)\n end",
"def find_configurations\n @configurations = @user.configurations\n @config_by_key = @configurations.inject({}) do |map, cfg|\n values = map[cfg.api_key] || []\n values << cfg\n map[cfg.api_key] = values\n map\n end\n end",
"def configure()\n origConfig = @site.config['svgo'] || {}\n generatedConfig = origConfig.clone\n generatedConfig.delete_if {|k, v| k.end_with?('.svg')}\n\n if origConfig.key?(@name)\n generatedConfig.merge!(origConfig[@name])\n end\n\n generatedConfig\n end",
"def module_config\r\n []\r\n end",
"def configs_cascade\n [\n @opts, \n @opts_config, \n @env_config, \n @additional_config, \n @local_config, \n @global_config, \n @defaults\n ]\n end",
"def merge_configurations cfg,cfg2\n cfg['prefix']||=cfg2['prefix']\n raise \"Attempting to merge configurations with differing prefixes: '#{cfg['prefix']}' vs. '#{cfg2['prefix']}' \" if cfg['prefix']!=cfg2['prefix']\n cfg['include']||=[]\n cfg['depend']||=[]\n cfg['interface']||=[]\n cfg['include']+=cfg2['include'] if cfg2['include']\n cfg['depend']+=cfg2['depend'] if cfg2['depend']\n cfg['interface']+=cfg2['interface'] if cfg2['interface']\n return cfg\nend",
"def options\n @options = @options.select { |key, _val| CONFIGURATIONS.include?(key.to_sym) }\n end",
"def configurations=(new_configurations)\n @configurations = new_configurations\n end",
"def genPiledConf(conf = {})\n return genPiledDefaultConf().update(conf) ;\n end",
"def patches\n {:p0 =>\n \"https://trac.macports.org/export/82481/trunk/dports/net/cclive/files/patch-configure.diff\"\n }\n end",
"def extra_substitutions_data\n return @extra_substitutions_data if @extra_substitutions_data\n return unless extra_substitutions\n\n @extra_substitutions_data = YAML.safe_load(extra_substitutions, [Symbol])\n end",
"def flatten_configurations\n all_settings = all_configurations.settings\n flattened_configurations = []\n\n debug_configurations.each do |b|\n b.settings = default_debug_settings.merge!(all_settings).merge!(b.settings)\n flattened_configurations << b\n end\n\n release_configurations.each do |b|\n b.settings = default_release_settings.merge!(all_settings).merge!(b.settings)\n flattened_configurations << b\n end\n\n flattened_configurations\n end",
"def config_options\n {\n 'datacenter' => new_resource.datacenter,\n 'template_path' => new_resource.template_path,\n 'power_on' => true,\n 'datastore' => new_resource.datastore,\n 'wait' => true,\n 'hostname' => new_resource.hostname,\n 'name' => new_resource.name,\n 'customization_spec' => {\n 'domain' => new_resource.domain,\n 'ipsettings' => {\n 'ip' => new_resource.ip || node['vcac_vm']['ip'],\n 'gateway' => new_resource.gateway,\n 'subnetMask' => new_resource.subnet_mask,\n },\n }\n }\nend",
"def configs!\n @configs = begin\n # This global is set when Origen is first required, it generally means that what is considered\n # to be the pwd for the purposes of looking for a site_config file is the place from where the\n # user invoked Origen. Otherwise if the running app switches the PWD it can lead to confusing\n # behavior - this was a particular problem when testing the new app generator which switches the\n # pwd to /tmp to build the new app\n path = $_origen_invocation_pwd\n configs = []\n # Add any site_configs from where we are currently running from, i.e. the application\n # directory area\n until path.root?\n file = File.join(path, 'config', 'origen_site_config.yml')\n configs << YAML.load_file(file) if File.exist?(file) && YAML.load_file(file)\n file = File.join(path, 'origen_site_config.yml')\n configs << YAML.load_file(file) if File.exist?(file) && YAML.load_file(file)\n path = path.parent\n end\n\n # Add and any site_configs from the directory hierarchy where Ruby is installed\n path = Pathname.new($LOAD_PATH.last)\n until path.root?\n file = File.join(path, 'origen_site_config.yml')\n configs << YAML.load_file(file) if File.exist?(file) && YAML.load_file(file)\n path = path.parent\n end\n\n # Add the one from the Origen core as the lowest priority, this one defines\n # the default values\n configs << YAML.load_file(File.expand_path('../../../origen_site_config.yml', __FILE__))\n configs\n end\n\n # Add the site_config from the user's home directory as highest priority, if it exists\n # But, make sure we take the site installation's setup into account.\n # That is, if user's home directories are somewhere else, make sure we use that directory to the find\n # the user's overwrite file. The user can then override that if they want.\"\n user_config = File.join(File.expand_path(user_install_dir), 'origen_site_config.yml')\n if File.exist?(user_config)\n @configs.unshift(YAML.load_file(user_config)) if YAML.load_file(user_config)\n end\n\n @configs\n end",
"def config\n filter_config(static.merge(dynamic))\n end",
"def institutions_index_config\n blacklight_config.search_builder_class = CommonwealthInstitutionsSearchBuilder\n blacklight_config.view.delete(:gallery)\n blacklight_config.view.delete(:masonry)\n blacklight_config.view.delete(:slideshow)\n end",
"def names\n @configs.keys\n end",
"def names\n @configs.keys\n end",
"def as_options\n on_replace = if copy_on_replace? then :copy\n else\n :drop\n end\n\n { on_replace: on_replace }\n end",
"def reconfigure(overrides={})\n config.merge!(overrides)\n self\n end",
"def config_files\n @config_files\n end",
"def replaced_files; end",
"def get_actual_config\n @config\n end",
"def build_extension_configurations\n extension.configurations.each do |ext_configuration|\n extension_settings.new(key: ext_configuration[:key]) unless\n extension_settings.where(key: ext_configuration[:key]).present?\n end\n end",
"def configure\n load_all_configs \n end",
"def substitution_dict\n dict = {}\n\n # X__[]\n @states.each_with_index do |s, i|\n dict[s] = var :\"X__[#{i}]\"\n end\n\n # XL__[]\n size = @states_i_f.size\n @states_i_f[0...-size/2].each_with_index do |sl, i|\n dict[sl] = var :\"XL__[#{i}]\"\n end\n\n # XR__[]\n @states_i_f[(size/2)..-1].each_with_index do |sr, i|\n dict[sr] = var :\"XR__[#{i}]\"\n end\n\n # L__[]\n @lambdas.each_with_index do |l, i|\n dict[l] = var :\"L__[#{i}]\"\n end\n\n # LL__[]\n size = @lambdas_i_f.size\n @lambdas_i_f[0...-size/2].each_with_index do |ll, i|\n dict[ll] = var :\"LL__[#{i}]\"\n end\n\n # LR__[]\n @lambdas_i_f[(size/2)..-1].each_with_index do |lr, i|\n dict[lr] = var :\"LR__[#{i}]\"\n end\n \n # U__[]\n @controls.each_with_index do |c,i|\n dict[c] = var :\"U__[#{i}]\"\n end\n \n # OMEGA__[]\n @omegas.each_with_index do |o, i|\n dict[o] = var :\"OMEGA__[#{i}]\"\n end\n\n # P__[]\n @params.each_with_index do |p, i|\n dict[p] = var :\"P__[#{i}]\"\n end\n\n # V__[]\n @nu.each_with_index do |n, i|\n dict[n] = var :\"V__[#{i}]\"\n end\n\n # ModelPars[]\n @aux_params.each_with_index do |(p, _), i|\n dict[p] = var :\"ModelPars[#{i}]\"\n end\n\n return dict\n end",
"def config\n config = {}\n config['recipes'] = []\n config['recipes'] |= hash_path(@default_config, 'recipes', 'global') || []\n config['recipes'] |= hash_path(@default_config, 'recipes', @platform) || []\n @group_configs.each do |group_name, group_config|\n config['recipes'] |= hash_path(group_config, 'recipes', 'global') || []\n config['recipes'] |= hash_path(group_config, 'recipes', @platform) || []\n end\n people_recipes = @people_config['recipes'] || {}\n config['recipes'] |= people_recipes['global'] || []\n config['recipes'] |= people_recipes[@platform] || []\n config['attributes'] = {}\n config['attributes'].deep_merge!(@default_config['attributes'] || {}) { |key, old, new| Array.wrap(old) + Array.wrap(new) }\n @group_configs.each do |group_name, group_config|\n config['attributes'].deep_merge!(group_config['attributes']) { |key, old, new| Array.wrap(old) + Array.wrap(new) } unless group_config['attributes'].nil?\n end\n people_attributes = @people_config['attributes'] || {}\n config['attributes'].deep_merge!(people_attributes) { |key, old, new| Array.wrap(old) + Array.wrap(new) }\n config\n end",
"def replace_expressions!(node2rep)\n # By default, nothing to do.\n return {}\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 configuration\n @configuration ||= deep_merge(default_configuration, @factory_config)\n end",
"def c\n configuration\n end",
"def parametrize #alias\n self.configuration\n end",
"def options\n opts = {}\n self.configuration_options.each do |option|\n opts.merge!({option.name.to_sym => option.value})\n end\n opts\n end",
"def config_generator_options\n definition.config_generator_options\n end",
"def c\n configuration\n end",
"def configs(cfg)\n Dir.glob(cfg[\"tile_engines\"][\"conf_dir\"] + \"/*.conf.yml\").each do |item|\n\t engine_cfg = File.open(item){|fd| YAML.load(fd)}\n\t engine_cfg[\"mailer_config\"] = cfg[\"tile_engines\"][\"mailer_config\"]\n\t engine_cfg[\"config_path\"]=item\n\t yield engine_cfg\n end\n end",
"def option_sets_for_instances\n opt_sets = enabled_questionings.map do |qing|\n if qing.default.present? && qing.default =~ ODK::DynamicPatternParser::VALUE_REGEX\n referenced_option_sets(qing)\n end\n end\n opt_sets.flatten.compact.uniq\n end",
"def generate_config(watchers)\n main_stanza = []\n events_stanza = []\n http_stanza = []\n upstream_stanza = []\n location_stanza = []\n server_stanza = []\n watchers.each do |watcher|\n # if service doesnt has nginx block, skip it\n next unless watcher.nginx \n log.info \"#{watcher.name} - #{watcher.backends} - #{watcher.haproxy} - #{watcher.nginx}\"\n @watcher_configs[watcher.name] = parse_watcher_config(watcher)\n log.info @watcher_configs\n upstream_stanza << generate_upstream_stanza(watcher, @watcher_configs[watcher.name]['upstream']) \n location_stanza << generate_location_stanza(watcher,@watcher_configs[watcher.name]['location'])\n end\n\n main_config = get_main_config\n main_stanza = generate_main_stanza(main_config)\n\n event_config = get_event_config\n events_stanza = generate_event_stanza(event_config)\n\n http_config = get_http_config\n http_stanza = generate_http_stanza(http_config)\n close_bracket = [\"}\"]\n\n base_server_config = get_server_base_config\n server_stanza = generate_server_stanza(location_stanza,base_server_config)\n if http_stanza.empty?\n final_config = main_stanza << events_stanza << http_stanza << upstream_stanza << server_stanza \n else\n final_config = main_stanza << events_stanza << http_stanza << upstream_stanza << server_stanza << close_bracket \n end\n log.info \"config array is #{final_config}\"\n\n return final_config\n end",
"def config\n configuration\n end",
"def process config\n replace_variables config.template_location\n\n replace_variables config.generate_settings.command unless config.generate_settings == nil || config.generate_settings.command == nil\n replace_variables config.generate_settings.docker_file unless config.generate_settings == nil || config.generate_settings.docker_file == nil\n\n replace_variables config.build_settings.build_commands.fetch unless config.build_settings == nil || config.build_settings.build_commands.fetch == nil\n replace_variables config.build_settings.build_commands.build unless config.build_settings == nil || config.build_settings.build_commands.build == nil\n replace_variables config.build_settings.build_commands.test unless config.build_settings == nil || config.build_settings.build_commands.test == nil\n\n replace_variables config.build_settings.docker_settings.image unless config.build_settings == nil || config.build_settings.docker_settings.image == nil\n replace_variables config.build_settings.docker_settings.env unless config.build_settings == nil || config.build_settings.docker_settings.env == nil\n replace_variables config.build_settings.docker_settings.binds unless config.build_settings == nil || config.build_settings.docker_settings.binds == nil\n replace_variables config.build_settings.docker_settings.working_directory unless config.build_settings == nil || config.build_settings.docker_settings.working_directory == nil\n\n return config\n end",
"def tasks_for_all_configurations\n @configurations.keys.collect{ |name| \"#{@project_name}:#{name}\"}\n end",
"def copy_configs\n template \"config/compass.rb\"\n template \"config/html5_rails.yml\"\n end",
"def configured_servers\n\t\thosts = self.configured_hosts\n\t\treturn Mongrel2::Config::Server.where( id: hosts.select(:server_id) )\n\tend",
"def configuration\n $_temescal_configuration\n end",
"def all_additional_substitutions\n (0...length).reject{|pos| pos == left.length }.flat_map{|pos|\n all_additional_substitutions_at_position(pos).to_a\n }.to_h\n end",
"def configure(conf)\n super\n\n @convert.nil? or @convert.each do |field, type|\n if !VALID_CONVERSIONS.include?(type)\n raise ConfigError, \n \"convert #{type} is not one of #{VALID_CONVERSIONS.join(',')}.\"\n end\n end\n\n @gsub_parsed = []\n @gsub.nil? or \n @gsub.each_slice(3) do |field, needle, replacement|\n if [field, needle, replacement].any? {|n| n.nil?}\n raise ConfigError,\n \"gsub #{[field,needle,replacement]} requires 3 elements.\"\n end\n\n @gsub_parsed << {\n field: field,\n needle: (needle.index(\"%{\").nil?? Regexp.new(needle): needle),\n replacement: replacement\n }\n end\n end",
"def bg_update_sections\n unless (@@bg_update_sections)\n @@bg_update_sections = config_resolve_sections.find_all do |section|\n section[:bg_update] != false\n end\n end\n @@bg_update_sections\n end",
"def federation_configurations\n return @federation_configurations\n end",
"def to_configure_properties\n ['@security', '@channel_flags', '@clas', '@race', '@traits', '@sign', '@stuff']\n end",
"def templates_configuration\n yield @templates_configuration\n end",
"def final_values\n overrides = @stage.overridden_package_values[name]\n values.deep_merge(overrides)\n end",
"def reference_book_configurations()\n return Rails.cache.fetch(\"odsa_reference_book_configs\", expires_in: 6.hours) do\n config_dir = File.join(\"public\", \"OpenDSA\", \"config\")\n base_url = request.protocol + request.host_with_port + \"/OpenDSA/config/\"\n configs = []\n Dir.foreach(config_dir) do |entry|\n if entry.include?(\"_generated.json\") or not File.extname(entry) == '.json'\n next\n end\n url = base_url + File.basename(entry)\n begin\n title = JSON.parse(File.read(File.join(config_dir, entry)))[\"title\"]\n configs << {\n title: title,\n name: File.basename(entry, '.json'),\n url: url,\n }\n rescue\n error = Error.new(:class_name => 'book_config_parse_fail',\n :message => \"Failed to parse #{entry}\")\n error.save!\n end\n end\n configs.sort_by! { |x| x[:title] }\n end\n end",
"def configuration; end",
"def configuration; end",
"def configuration; end",
"def configuration; end",
"def configuration; end",
"def merge_dynamic_config\n return if GlobalConstant::EntityGroupDraft.kyc_entity_type != @entity_type\n field_config = GlobalConstant::CmsConfigurator.extra_kyc_field_instruction_text_config\n\n @params.keys.each do |x|\n @entity_config[x.to_s] = field_config if x.to_s.ends_with?(\n GlobalConstant::CmsConfigurator.extra_kyc_field_instruction_key_suffix)\n end\n\n end",
"def global_configurations\n @_global_configurations ||= []\n end",
"def config\n details = Chassis.pkgs.dup\n details << [\"tags\"] + Chassis.tags unless Chassis.tags.empty?\n details << [\"roles\"] + Chassis.roles unless Chassis.roles.empty?\n details << [\"kind\"] + [Chassis.node_kind] if Chassis.node_kind\n details << Chassis.extra_config if Chassis.extra_config\n details\n end",
"def configuration\n self[:configuration] || {}\n end",
"def get_config(*arguments)\n \t\targs = arguments.clone\n \t\t@config ||= {}\n \t\topt = args.rfm_extract_options!\n \t\tstrings = opt[:strings].rfm_force_array || []\n \t\tsymbols = opt[:use].rfm_force_array || []\n \t\tobjects = opt[:objects].rfm_force_array || []\n \t\targs.each do |arg|\n \t\t\tcase true\n \t\t\twhen arg.is_a?(String) ; strings << arg\n \t\t\twhen arg.is_a?(Symbol) ; symbols << arg\n \t\t\telse objects.unshift arg\n \t\t\tend\n \t\tend\n\n\t\t\trslt = config_merge_with_parent(symbols).merge(opt)\n\t\t\t#using = rslt[:using].rfm_force_array\n\t\t\tsanitize_config(rslt, CONFIG_DONT_STORE, false)\n\t\t\trslt[:using].delete \"\"\n\t\t\trslt[:parents].delete \"\"\n\t\t\trslt.merge(:strings=>strings, :objects=>objects)\n \tend",
"def map_config_extensions\n @extensions = Hash.new\n @config[\"types\"].each do |k,v|\n puts \"#{k} => #{v}\"\n v.each do |ext|\n @extensions[ext] = k\n end\n end\n return @extensions\n end"
] | [
"0.67082316",
"0.67082316",
"0.67082316",
"0.64707136",
"0.64707136",
"0.63352954",
"0.62769514",
"0.6205945",
"0.6161139",
"0.61302644",
"0.60717314",
"0.5943522",
"0.59082615",
"0.5874846",
"0.5815852",
"0.5788381",
"0.5767073",
"0.5767073",
"0.5767073",
"0.5710181",
"0.56625044",
"0.5659848",
"0.5659848",
"0.55862164",
"0.554878",
"0.552501",
"0.5517782",
"0.5500243",
"0.5484899",
"0.54844224",
"0.5478834",
"0.5476581",
"0.54587245",
"0.5453851",
"0.54511166",
"0.5441079",
"0.54408973",
"0.5418688",
"0.5404874",
"0.54037833",
"0.5390418",
"0.53841054",
"0.53702",
"0.5348417",
"0.53385144",
"0.53263414",
"0.5308229",
"0.5300956",
"0.52975225",
"0.52924424",
"0.52788115",
"0.52743185",
"0.526656",
"0.5259713",
"0.5241081",
"0.5241081",
"0.5235678",
"0.523111",
"0.522985",
"0.52210337",
"0.5217459",
"0.52054775",
"0.52025735",
"0.5182087",
"0.5176837",
"0.5174813",
"0.51729316",
"0.5156209",
"0.51504815",
"0.5144287",
"0.51362324",
"0.51303625",
"0.51278204",
"0.51258767",
"0.51220775",
"0.5116809",
"0.51111746",
"0.5106724",
"0.5097872",
"0.50933385",
"0.5074684",
"0.50696886",
"0.5069636",
"0.5061152",
"0.5052972",
"0.50513977",
"0.50483036",
"0.50450367",
"0.5038813",
"0.5037984",
"0.503605",
"0.503605",
"0.503605",
"0.503605",
"0.503605",
"0.5024598",
"0.50215495",
"0.5021446",
"0.5020039",
"0.5017092",
"0.50154746"
] | 0.0 | -1 |
This tries an average of 16 times to get aligned encryption | def encrypt(box, message)
while true
# We add even more randomness to erase any patterns in random_prefix
# It's not necessary for this one, but could be in more realistic attack
random_pad = "A" * rand(0..15)
encrypted = box.call(random_pad + alignment_block + message)
i = 0
while i + 80 < encrypted.size
blocks = encrypted[i, 80]
if blocks[0,16] == blocks[16,16] &&
blocks[0,16] != blocks[32,16] &&
blocks[0,16] == blocks[48,16] &&
blocks[0,16] == blocks[64,16]
return encrypted[i+80..-1]
end
i += 16
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def encrypt_block_size\n (size/8)-12\n end",
"def vigenere_cipher(message, keys)\n alphabet = (\"a\"..\"z\").to_a\n indices = message.split(\"\").map {|char| alphabet.index(char)}\n \n ciphered_message = \"\"\n indices.each_with_index do |n, i|\n shift_amount = keys[i % keys.length]\n new_index = (n + shift_amount) % alphabet.length\n ciphered_message += alphabet[new_index]\n end\n\n ciphered_message\nend",
"def vigenere_cipher(message, keys)\n alpha = (\"a\"..\"z\").to_a\n count = 0\n message.each_char.with_index do |char, idx|\n pos = alpha.index(char)\n #rather than count we can do key alpha[(pos + key[idx % key.length] )% 26]\n message[idx] = alpha[(pos + keys[count]) % alpha.length]\n count += 1\n count = 0 if count == keys.length\n end\n message\nend",
"def vigenere_cipher(message, keys)\n alphabetic = (\"a\"..\"z\").to_a\n encrypted = \"\"\n\n message.each_char.with_index do |char, i|\n num = keys[i % keys.length]\n index = alphabetic.index(char)\n encrypted += alphabetic[(index + num) % 26]\n end\n \n encrypted\nend",
"def encrypted_string\n blocks = initial_string.chars.each_slice(16).map(&:join)\n\n nonce = SecureRandom.random_bytes(8)\n counter = [0] * 8\n counter_bytes = counter.pack('C*')\n encryption = nonce + counter_bytes\n\n blocks.each do |block|\n cipher_block = block ^ encrypt_block(nonce + counter_bytes)\n encryption << cipher_block\n counter[-1] += 1\n counter_bytes = counter.pack('C*')\n end\n\n encryption\n end",
"def vigenere_cipher(message, keys)\n alphabet = (\"a\"..\"z\").to_a\n encrypted = \"\"\n\n message.each_char.with_index do |char, idx|\n shift = keys[idx % keys.length]\n encrypted += alphabet[(alphabet.index(char) + shift) % 26]\n end\n\n encrypted\nend",
"def pairs()\n g1 = generator(512, 16807) # 65 \n g2 = generator(191, 48271) # 191\n \n total = 0\n 40e6.to_i.times do \n v1 = g1.next.to_s(2).rjust(16,'0')\n v2 = g2.next.to_s(2).rjust(16,'0')\n \n total += 1 if v1[-16,16] == v2[-16,16]\n end\n \n total\nend",
"def vigenere_cipher(message, keys)\n alphabet = \"abcdefghijklmnopqrstuvwxyz\"\n cycle = 0\n result = \"\"\n\n message.each_char do |char|\n result += alphabet[(alphabet.index(char) + keys[cycle % keys.length]) % alphabet.length]\n cycle += 1\n end\n\n return result\nend",
"def step_6\n\t\[email protected] do |num|\n\t\t\t@final_encryption << @alphabet[num - 1]\n\t\tend\n\t\t@final_encryption\n\tend",
"def vigenere_cipher(message, keys)\n alphabet = \"abcdefghijklmnopqrstuvwxyz\"\n vigenere = \"\"\n\n message.each_char.with_index do |char, i|\n index = alphabet.index(char)\n key = keys[i % keys.length].to_i\n new_char = alphabet[(index + key) % 26] \n vigenere += new_char\n end\n\n vigenere\nend",
"def aes_key_core(k, i)\n t = 0\n 0.upto(3) do |j|\n t = aes_set_byte(t, (j-1) % 4, AES_SBOX[aes_get_byte(k, j)])\n end\n aes_set_byte(t, 0, aes_get_byte(t,0) ^ AES_RCON[i])\n end",
"def vigenere_cipher(message, keys)\n alpha = (\"a\"..\"z\").to_a\n new_string = \"\"\n message.each_char.with_index do |char, i|\n old_i = alpha.index(char)\n new_i = (old_i + keys[i % keys.length]) % 26\n new_string += alpha[new_i]\n end\n new_string\nend",
"def vigenere_cipher(message, keys)\n alphabet = ('a'..'z').to_a\n array = []\n\n i = 0\n\n message.each_char do |char|\n idx = alphabet.index(char)\n array << alphabet[(idx + keys[i]) % 26]\n if i < keys.length - 1\n i += 1\n else\n i = 0\n end\n end\n array.join('')\n \nend",
"def vigenere_cipher(message, keys)\n chars = message.split('')\n i = -1\n enc_chars = chars.map do |char|\n i = (i + 1) % keys.length\n encrypt_char(char, keys[i])\n end\n enc_chars.join\nend",
"def scramble( data )\n cipher = OpenSSL::Cipher::Cipher.new( @@algorithm )\n cipher.encrypt\n cipher.pkcs5_keyivgen( @@key, @@salt )\n @@salt + cipher.update( data ) + cipher.final\n end",
"def vigenere_cipher(message, keys)\n alphabet = ('a'..'z').to_a\n vigenere_str = \"\"\n\n message.each_char.with_index do |char, idx|\n old_idx = alphabet.index(char)\n temp_key = keys.shift\n keys.push(temp_key)\n new_idx = (old_idx + temp_key) % 26\n vigenere_str += alphabet[new_idx]\n end\n vigenere_str\nend",
"def splitdencrypt(data)\n\tdata = data.unpack(\"H*\")\n\tlengthkey = data[0].length / 16\n\tarray = Hash.new\n\tstart = 0\n\tfor i in 1..lengthkey\n\t array[i-1] = data[0].to_str.slice(start,16)\n\t start +=16\n\tend\n\treturn array\n end",
"def vigenere_cipher(message, keys)\n alpha = \"abcdefghijklmnopqrstuvwxyz\"\n new_str = \"\"\n if keys.length == 1\n message.each_char do |char|\n alpha_idx = alpha.index(char)\n new_idx = (alpha_idx + keys[0]) % 26\n new_str += alpha[new_idx]\n end\n else\n new_keys = keys\n message.each_char do |char|\n alpha_idx = alpha.index(char)\n new_idx = (alpha_idx + new_keys[0]) % 26\n new_str += alpha[new_idx]\n new_keys.rotate!(1)\n end\n end\n new_str\n \nend",
"def vigenere_cipher(string, key_sequence, alphabet)\r\n\r\nend",
"def vigenere_cipher(string, key_sequence)\n result = \"\"\n alphabet = (\"a\"..\"z\").to_a\n string.each_char.with_index do |ch, idx|\n key_idx = idx % key_sequence.length\n char_idx = (alphabet.index(ch) + key_sequence[key_idx]) % alphabet.length\n result << alphabet[char_idx]\n end\n result\nend",
"def encrypt(*tokens)\n digest = tokens.flatten.join(join_token)\n stretches.times { digest = Digest::MD5.digest(digest) }\n digest.unpack1(\"H*\")\n end",
"def vigenere_cipher(str, arr)\n alpha = (\"a\"..\"z\").to_a\n new_str = \"\"\n str.each_char.with_index do |char, i|\n pos = alpha.index(char)\n key = arr[i % arr.length]\n new_pos = (pos + key) % alpha.length\n new_str += alpha[new_pos]\n end\n new_str\nend",
"def encrypt_chunk(num1,num2,key)\n y,z,sum = num1,num2,0\n\n ITERATIONS.times do |i|\n y += ((z << 4) ^ (z >> 5)) + (z ^ sum) + key[sum & 3]\n y = y & 0xFFFFFFFF\n\n sum += DELTA \n sum = sum & 0xFFFFFFFF\n\n z += ((y << 4) ^ (y >> 5)) + (y ^ sum) + key[sum >> 11 & 3]\n z = z & 0xFFFFFFFF\n\n # ruby can keep on getting bigger because of Bignum so\n # you have to and with 0xFFFFFFFF to get the Fixnum\n # bytes\n\n end\n return [y,z]\n end",
"def vigenere_cipher(msg, arr)\n alphabet = (\"a\"..\"z\").to_a\n new_msg = \"\"\n msg.each_char.with_index do |char, i|\n pos= alphabet.index(char)\n key = arr[i % arr.length]\n new_pos = (pos + key) % alphabet.length\n new_msg += alphabet[new_pos]\n end\n new_msg\nend",
"def repeated_block_encrypt(key, plain, iterations)\n key_length = key.length\n iterations.times do\n tf = Twofish.new(key)\n cipher = tf.encrypt(plain)\n assert_equal(plain, tf.decrypt(cipher))\n key = (plain + key)[0, key_length]\n plain = cipher\n end\n plain\n end",
"def vigenere_cipher(string, key_sequence)\n\nend",
"def vigenere_cipher(string, key_sequence)\n alphabet = ('a'..'z').to_a\n keys = key_sequence.dup\n result = \"\"\n while result.length < string.length\n c = string[result.length] \n offset = (alphabet.index(c) + keys.first) % 26 \n result += alphabet[offset]\n keys.push(keys.shift)\n end\n result\nend",
"def crypt(message, key)\n repeated_key = key * ((message.length+2) / key.length)\n\n #puts message.length\n #puts repeated_key.length\n \n (0..message.length-1).map{|i|\n message[i] ^ repeated_key[i]\n }\n\nend",
"def caesar_cipher(message, n)\n\nend",
"def encrypt; end",
"def vigenere_cipher(message, key)\n key_index = 0 \n alpha = (\"a\"..\"z\").to_a\n new_str = \"\"\n\n message.each_char.with_index do|char,idx|\n new_str += alpha[(alpha.index(char) + key[key_index % key.length])%26]\n key_index += 1\n end\n new_str\nend",
"def md4(string, pad = true, registers = [0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476])\n\t# functions\n\tmask = (1 << 32) - 1\n\tf = proc {|x, y, z| x & y | x.^(mask) & z}\n\tg = proc {|x, y, z| x & y | x & z | y & z}\n\th = proc {|x, y, z| x ^ y ^ z}\n\tr = proc {|v, s| (v << s).&(mask) | (v.&(mask) >> (32 - s))}\n\n\t# initial hash\n\ta, b, c, d = registers\n\n\tif pad\n\t\tstring = md4padding(string)\n\tend\n\n\tif string.size % 64 != 0\n\t\tfail \"failed to pad to correct length\"\n\tend\n\n\tio = StringIO.new(string)\n\tblock = \"\"\n\n\twhile io.read(64, block)\n\t\tx = block.unpack(\"V16\")\n\n\t\t# Process this block.\n\t\taa, bb, cc, dd = a, b, c, d\n\n\t\t[0, 4, 8, 12].each {|i|\n\t\t\ta = r[a + f[b, c, d] + x[i], 3]; i += 1\n\t\t\td = r[d + f[a, b, c] + x[i], 7]; i += 1\n\t\t\tc = r[c + f[d, a, b] + x[i], 11]; i += 1\n\t\t\tb = r[b + f[c, d, a] + x[i], 19]\n\t\t}\n\n\t\t[0, 1, 2, 3].each {|i|\n\t\t\ta = r[a + g[b, c, d] + x[i] + 0x5a827999, 3]; i += 4\n\t\t\td = r[d + g[a, b, c] + x[i] + 0x5a827999, 5]; i += 4\n\t\t\tc = r[c + g[d, a, b] + x[i] + 0x5a827999, 9]; i += 4\n\t\t\tb = r[b + g[c, d, a] + x[i] + 0x5a827999, 13]\n\t\t}\n\n\t\t[0, 2, 1, 3].each {|i|\n\t\t\ta = r[a + h[b, c, d] + x[i] + 0x6ed9eba1, 3]; i += 8\n\t\t\td = r[d + h[a, b, c] + x[i] + 0x6ed9eba1, 9]; i -= 4\n\t\t\tc = r[c + h[d, a, b] + x[i] + 0x6ed9eba1, 11]; i += 8\n\t\t\tb = r[b + h[c, d, a] + x[i] + 0x6ed9eba1, 15]\n\t\t}\n\n\t\ta = (a + aa) & mask\n\t\tb = (b + bb) & mask\n\t\tc = (c + cc) & mask\n\t\td = (d + dd) & mask\n\tend\n\n\t[a, b, c, d].pack(\"V4\").bytes\nend",
"def vigenere(key, txt)\n shift_array = key.get_shift\n count = 0\n\n txt_array = txt.split('')\n ciph=[]\n\n txt_array.each do |a|\n a = a.ord\n shift = shift_array[count % shift_array.size]\n case a\n when (64..90) \n new_char = ((a - 64 + shift) % 26) + 64 \n count += 1\n when (97..122)\n new_char = ((a- 97 + shift) % 26) + 97\n count += 1\n else \n new_char = a \n end\n ciph.push(new_char.chr)\n end\n\n ciph = ciph.join('')\n puts \"#{ciph}\"\nend",
"def vigenere_cipher(str,keys)\n alpha = (\"a\"..\"z\").to_a\n new_str = \"\"\n\n str.each_char.with_index do |char,idx|\n old_pos = alpha.index(char)\n new_pos = old_pos + keys[idx % keys.length]\n new_str += alpha[new_pos % alpha.length]\n end\n\n new_str\n\nend",
"def encrypt(key, state)\n raise unless key.size == 16\n raise unless state.size == 16\n\n key = expand_key(key)\n\n round_key = key[0, 16]\n state = AES.add_round_key(state, round_key)\n\n (1..9).each do |i|\n round_key = key[16*i, 16]\n state = AES.sub_bytes(state)\n state = AES.shift_rows(state)\n state = AES.mix_columns(state)\n state = AES.add_round_key(state, round_key)\n end\n\n round_key = key[16*10, 16]\n state = AES.sub_bytes(state)\n state = AES.shift_rows(state)\n state = AES.add_round_key(state, round_key)\n end",
"def vigenere_cipher(message, keys)\n alphabet = (\"a\"..\"z\").to_a\n new_msg = \"\"\n\n message.each_char.with_index do |char|\n old_pos = alphabet.index(char)\n new_pos = old_pos + keys[idx % keys.length]\n new_msg += alphabet[new_pos % alphabet.length]\n end\n\n new_msg\nend",
"def vigenere_cipher(message, keys)\n new_string = ''\n alphabet = 'abcdefghijklmnopqrstuvwxyz'\n\n message.each_char.with_index do |char, idx|\n old_idx = alphabet.index(char)\n if keys.length == 1\n new_idx = keys[0]\n end\n new_idx = keys[idx % keys.length]\n new_pos = old_idx + new_idx\n new_string += alphabet[new_pos % 26]\n end\n\n new_string\nend",
"def crypt(text,key,operator = :+)\n index = 0\n text.upcase.each_byte.reduce(\"\") do |res, c|\n res << (65 + (c.send(operator, key[index % key.length].ord)) % 26).chr\n index += 1\n res\n end\nend",
"def vigenere_cipher(string, key_sequence, alphabet)\n #\n # your code goes here\n #\nend",
"def aes_cts_hmac_sha1_96(algorithm, raw_secret, salt)\n iterations = 4096\n cipher = OpenSSL::Cipher::AES.new(algorithm)\n key = OpenSSL::PKCS5.pbkdf2_hmac_sha1(raw_secret, salt, iterations, cipher.key_len)\n plaintext = \"kerberos\\x7B\\x9B\\x5B\\x2B\\x93\\x13\\x2B\\x93\".b\n result = ''.b\n loop do\n cipher.reset\n cipher.encrypt\n cipher.iv = \"\\x00\".b * 16\n cipher.key = key\n ciphertext = cipher.update(plaintext)\n result += ciphertext\n break unless result.size < cipher.key_len\n\n plaintext = ciphertext\n end\n result\n end",
"def vigenereCipher(string, key, alphabet)\n aryStr = string.split(\"\")\n nStr = Array.new\n i = 0\n while i < aryStr.length\n j = 0\n while j < key.length\n nStr << (alphabet[(alphabet.index(aryStr[i]) + key[j])])\n j += 1\n i += 1\n end\n end\n return nStr.join('')\nend",
"def vigenere_cipher(str, arr)\n alphabet = \"abcdefghijklmnopqrstuvwxyz\"\n results = \"\"\n str.each_char.with_index do |char, i|\n ind = (alphabet.index(char) + arr[0]) % 26\n results += alphabet[ind]\n arr.rotate!\n end\n results\nend",
"def vigenere_cipher(message, keys)\n alphabet = (\"a\"..\"z\").to_a\n cipher = message.chars.map.with_index do |c, i|\n # determine which key to use based on position in the message\n offset = keys[i % keys.length]\n new_idx = (alphabet.index(c) + offset) % 26\n alphabet[new_idx]\n end\n cipher.join(\"\")\nend",
"def vigenere_cipher(string, key_sequence)\n result = \"\"\n string.each_char.with_index do |c, idx|\n key_idx = idx % key_sequence.length\n key = key_sequence[key_idx]\n result << shift(c, key)\n end\n result\nend",
"def vigenere_cipher(str, k)\n alpha = (\"a\"..\"z\").to_a\n\n msg = (0...str.length).map do |i|\n old_pos = alpha.index(str[i])\n new_pos = (old_pos + k[i%k.length]) % alpha.length\n alpha[new_pos]\n end\n\n msg.join()\nend",
"def splitencrypt(data)\n\tlengthkey = data.length / 8;\n\ttemp = 0\n\tarray = Hash.new\n\tif data.length % 8 != 0\n\t temp = data.length - (8 * lengthkey)\n\t lengthkey += 1;\n\tend\n\tstart = 0\n\tfor i in 1..lengthkey\n\t array[i-1] = data.to_str.slice(start,8)\n\t start +=8\n\tend\n\tif temp != 0\n\t for k in 0...(8-temp)\n\t\tarray[i-1] << [\"00\"].pack('H*')\n\t end\n\tend\n\treturn array\n end",
"def vigenere_cipher(word, key_seq_arr)\n return word if key_seq_arr.empty?\n \n ciphered = \"\"\n word.chars.each_with_index do |char, i|\n # Can't modulo/divide by zero, so take first key manually\n if i == 0 || key_seq_arr.length == 1\n ciphered += cipher_char(char, key_seq_arr.first)\n else\n curr_key = i % key_seq_arr.length\n ciphered += cipher_char(char, key_seq_arr[curr_key])\n end\n end\n\n ciphered\nend",
"def encrypt (s,n)\n result = nil\n if n <= 0\n result = s\n end\n n.times do\n i = 0\n odds = []\n evens = []\n result ||= s\n result.chars.each do\n odds.push(result[i+1])\n evens.push(result[i])\n i += 2\n end\n result = odds.join + evens.join\n end\n return result\nend",
"def crypt(p0) end",
"def encryption_oracle\n # From an early-on AES-128-ECB exercise. 'YELLOW SUBMARINE' is the 128-bit key.\n ciphertext = URL::decode64('http://cryptopals.com/static/challenge-data/25.txt')\n plaintext = AES_128.decrypt(ciphertext, 'YELLOW SUBMARINE', :mode => :ECB)\n\n AES_128.encrypt(plaintext, AES_KEY, :mode => :CTR)\nend",
"def encrypt(text, n)\n n.times do\n text = text.chars\n odds = text.select.with_index { |let, ix| ix.odd? }.join(\"\")\n evens = text.reject.with_index { |let, ix| ix.odd? }.join(\"\")\n text = odds + evens\n end\n text\nend",
"def encryption_oracle(buffer)\n prefix_padding = rand(5..10).times.map { rand(0..255) }\n suffix_padding = rand(5..10).times.map { rand(0..255) }\n padded_buffer = pkcs7_pad(prefix_padding + buffer + suffix_padding, 16)\n key = 16.times.map { rand(0..255) }\n\n if rand(2).zero?\n puts 'Encrypting with ECB...'\n aes_ecb_encrypt(padded_buffer, key)\n else\n puts 'Encrypting with CBC...'\n iv = 16.times.map { rand(0..255) }\n aes_cbc_encrypt(padded_buffer, key, iv)\n end\nend",
"def encrypt(string, times = 65536)\n # You can change times to how much you like. but pay attention please!\n # Larger numbers will take more time to encrypt.\n # For example, if you use a large number such as 2^32, it'll be about\n # 5 billion times! It will take a very long time (maybe hours and days)\n # and damage your CPU.\n n = 0\n code = string\n while n < times\n code = Digest::SHA2.hexdigest(code)\n # You also can use MD5 or SHA1 algorithms. for more information,\n # check my project https://github.com/prp-e/rsha256 .\n n += 1\n end\n return code\n # Here, you can reverse the coded string, to make it more 'coded', or\n # You can code it in a different algorithm, too.\nend",
"def encrypt_message pub_key, message\n p_key = pub_key.shuffle[0 .. pub_key.length / 2] # randomly select half the values\n sum = 0\n p_key.each{ |i| sum += i}\n return sum + message\nend",
"def vigenere_cipher(str, arr)\n alpha = ('a'..'z').to_a\n new_msg = ''\n\n str.each_char.with_index do |char,idx|\n old_pos = alpha.index(char)\n new_pos = old_pos + arr[idx % arr.length]\n new_msg += alpha[new_pos % 26]\n end\n new_msg\nend",
"def vigenere_cipher(message, keys)\n key_idx = 0\n new_message = \"\"\n message.each_char do |char|\n new_message += cipher(char, keys[key_idx])\n key_idx = (key_idx + 1) % keys.length\n end\n\n new_message\nend",
"def caesar_cipher(str, shift)\n\nend",
"def asm_decrypt_rc4\n %!\n ;-----------------------------------------------------------------------------;\n ; Author: Michael Schierl (schierlm[at]gmx[dot]de)\n ; Version: 1.0 (29 December 2012)\n ;-----------------------------------------------------------------------------;\n ; Input: EBP - Data to decode\n ; ECX - Data length\n ; ESI - Key (16 bytes for simplicity)\n ; EDI - pointer to 0x100 bytes scratch space for S-box\n ; Direction flag has to be cleared\n ; Output: None. Data is decoded in place.\n ; Clobbers: EAX, EBX, ECX, EDX, EBP (stack is not used)\n\n ; Initialize S-box\n xor eax, eax ; Start with 0\n init:\n stosb ; Store next S-Box byte S[i] = i\n inc al ; increase byte to write (EDI is increased automatically)\n jnz init ; loop until we wrap around\n sub edi, 0x100 ; restore EDI\n ; permute S-box according to key\n xor ebx, ebx ; Clear EBX (EAX is already cleared)\n permute:\n add bl, [edi+eax] ; BL += S[AL] + KEY[AL % 16]\n mov edx, eax\n and dl, 0xF\n add bl, [esi+edx]\n mov dl, [edi+eax] ; swap S[AL] and S[BL]\n xchg dl, [edi+ebx]\n mov [edi+eax], dl\n inc al ; AL += 1 until we wrap around\n jnz permute\n ; decryption loop\n xor ebx, ebx ; Clear EBX (EAX is already cleared)\n decrypt:\n inc al ; AL += 1\n add bl, [edi+eax] ; BL += S[AL]\n mov dl, [edi+eax] ; swap S[AL] and S[BL]\n xchg dl, [edi+ebx]\n mov [edi+eax], dl\n add dl, [edi+ebx] ; DL = S[AL]+S[BL]\n mov dl, [edi+edx] ; DL = S[DL]\n xor [ebp], dl ; [EBP] ^= DL\n inc ebp ; advance data pointer\n dec ecx ; reduce counter\n jnz decrypt ; until finished\n !\n end",
"def encryption_oracle(input)\n #Hardcoded, secret string\n append = 'Um9sbGluJyBpbiBteSA1LjAKV2l0aCBteSByYWctdG9wIGRvd24gc28gbXkg'\n append << 'aGFpciBjYW4gYmxvdwpUaGUgZ2lybGllcyBvbiBzdGFuZGJ5IHdhdmluZyBq'\n append << 'dXN0IHRvIHNheSBoaQpEaWQgeW91IHN0b3A/IE5vLCBJIGp1c3QgZHJvdmUg'\n append << 'YnkK'\n append = append.unpack('m')\n\n str = input + append.join\n\n cipher = OpenSSL::Cipher.new('AES-128-ECB') \n cipher.encrypt \n cipher.key = 'O' * Blocksize;\n \n enc = cipher.update(str) + cipher.final\n #Hex encoded return\n return enc.unpack('H*').join\nend",
"def encrypt(text, n)\n for i in 0...n\n text = (text.chars.select.with_index{ |v,i| i % 2 != 0} + text.chars.select.with_index{ |v,i| i % 2 == 0}).join\n end\n text\nend",
"def scan(buffer, source_offset)\n\n blen = buffer.length\n entropic(buffer, AES_KEYBLOCK_MIN, ENTROPIC_MIN) do |i|\n\n # Exit if we dont have at least 240 bytes left\n return if (i + 240) > blen\n\n # Create a byte map to work in both little and big endian formats\n #[\"V\", \"N\"].each do |endian|\n\n [\"V\"].each do |endian|\n bmap = buffer[i, 240].unpack(\"#{endian}*\")\n\n # Check distance from 256-bit AES key\n xor_count_256 = 0\n 1.upto(7) do |row|\n 0.upto(7) do |column|\n break if (row == 7 and column == 4)\n case column\n when 0\n xor_count_256 += aes_popcount( aes_key_core( bmap[8*row-1], row) ^ bmap[8*(row-1)] ^ bmap[8*row] )\n when 4\n xor_count_256 += aes_popcount( aes_sbox_bytes( bmap[8*row+3]) ^ bmap[8*(row-1)+4] ^ bmap[8*row+4])\n else\n xor_count_256 += aes_popcount( bmap[8*row+column-1] ^ bmap[8*(row-1)+column] ^ bmap[8*row + column])\n end\n end\n end\n\n # We found a possible AES-256 key\n unless xor_count_256 > AES_XOR_LIMIT\n report_hit(:type => \"Key(AES-256)\", :data => bmap[0, 256/32].pack(\"#{endian}*\").unpack(\"C*\").map{|x| \"%.2x\" % x }.join, :offset => source_offset + i)\n next\n end\n\n # Check distance from 128-bit AES key\n xor_count_128 = 0\n 1.upto(10) do |row|\n 0.upto(3) do |column|\n before_count = xor_count_128\n case column\n when 0 \n xor_count_128 += aes_popcount( aes_key_core( bmap[4*row-1],row) ^ bmap[4*(row-1)] ^ bmap[4*row])\n else\n xor_count_128 += aes_popcount( (bmap[4*row + column-1] ^ bmap[4*(row-1)+column]) ^ bmap[4*row + column])\n end\n end\n end\n\n # We found a possible AES-128 key\n unless xor_count_128 > AES_XOR_LIMIT\n report_hit(:type => \"Key(AES-128)\", :data => bmap[0, 128/32].pack(\"#{endian}*\").unpack(\"C*\").map{|x| \"%.2x\" % x }.join, :offset => source_offset + i)\n end\n end\n end\n\n end",
"def encryptHex\r\n\t \r\n\t \tif @IV.empty?\r\n\t\t\t_iv = OpenSSL::Cipher::Cipher.new(\"aes-#{ @cipher }-#{ @mode }\").random_iv\r\n\t\telse\r\n\t\t\t_iv= @IV\r\n\t\tend\r\n\t\t\r\n\t\tEncryptor.default_options.merge!(:algorithm => \"aes-#{ @cipher }-#{ @mode }\", :key => @key, :iv => _iv)\r\n\t\t_cyper_text = Encryptor.encrypt(@data)\t\r\n\t\t_rt = _cyper_text.unpack(\"H*\")[0]\r\n\t\t\r\n\t\treturn _rt\r\n\t\t\r\n\t end",
"def folding_cipher(string)\n letters = (\"a\"..\"z\").to_a\n cipher = {}\n (0..12).each do |idx|\n front = letters[idx]\n back = letters[-(idx + 1)]\n cipher[front] = back\n cipher[back] = front\n end\n\n ciphered = \"\"\n string.each_char do |char|\n ciphered << cipher[char]\n end\n\n ciphered\nend",
"def caesar_cipher text, shift = 5 #shifts letters by 5 - by default\nletters = text.split(//)\nncrypted_string = \"\"\nletters.each do |x|\nif (x =~ /\\w/) && (x =~ /\\D/) && (x != \"_\") ##Checks with RegEx's whether the current array index' value is a word character + a non-digit character + not an underscore '_', so only a-z & A-Z letters pass the test and are affected by the following code.\nif x == x.upcase ##<-I do this so I can wrap back to A when Z's #ord index is exceeded. \"A\".ord == 65, \"Z\".ord == 90\nx = x.ord + shift\nif x > 90\nx -= 90\nx += 64\nend\nelsif x == x.downcase ##Same is done here for downcases as is done above for upcases. \"a\".ord == 97, \"z\".ord == 122\nx = x.ord + shift\nif x > 122\nx -= 122\nx += 96\nend\nend\nx.chr\nend\nncrypted_string << x\nend\nputs ncrypted_string\nend",
"def folding_cipher(string)\n alphabet = (\"a\"..\"z\").to_a\n hash = {}\n\n alphabet.each_with_index do |letter, idx|\n hash[letter] = alphabet[25 - idx]\n end\n\n string.chars.map! do |char|\n hash[char]\n end.join(\"\")\nend",
"def vigenere_cipher(string, key_sequence)\n alphabet = (\"a\"..\"z\").to_a\n alphabet.concat(alphabet) # double it to deal with wrapping\n \n chars = string.split('')\n count = 0\n \n for i in 0...chars.length\n # lookup the index of chars[i] in alphabet, then add to it using key sequence\n # and modulo to keep track of which step in the sequence you're at\n chars[i] = alphabet[alphabet.index(chars[i]) + key_sequence[count % key_sequence.length]]\n count += 1\n end\n chars.join('')\nend",
"def vigenere_cipher(string, keys)\n alpha = ('a'..'z').to_a\n new_word = \"\"\n\n string.each_char.with_index do |char, idx|\n old_idx = alpha.index(char)\n new_idx = old_idx + keys[idx % keys.length]\n new_char = alpha[new_idx % alpha.length]\n new_word += new_char\n end\n\n new_word\nend",
"def encrypt phrase, key\n alphabet = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\".split(\"\")\n cipherbet = get_cipherbet key\n result = \"\"\n phrase.each_char do |letter|\n encrypted_letter = encrypt_letter alphabet, cipherbet, letter\n result = result + encrypted_letter\n end\n return result\nend",
"def folding_cipher(string)\n alpha = ('a'..'z').to_a\n new_str = ''\n (0...string.length).each do |char_i|\n char_index = alpha.index(string[char_i])\n new_char_index = char_index + (25 - (char_index * 2))\n new_str << alpha[new_char_index]\n end\n new_str\nend",
"def caesar_cipher(string, shift)\nend",
"def breakXORCipher(cipherText)\n scoredTexts = Hash.new\n \n #Try all ASCII keys from \n for i in 32..126 do\n keyChar = i.chr\n \n possiblePlaintext = hexToASCII(singleByteXOR(cipherText.upcase, keyChar))\n scoredTexts[keyChar] = scorePlaintext(possiblePlaintext)\n \n if(scoredTexts[keyChar] == possiblePlaintext.length)\n puts cipherText\n puts possiblePlaintext \n puts keyChar + \" scored \" + scoredTexts[keyChar].to_s\n end\n end\nend",
"def translate_to_cipher(sentence)\n # this creates an array where each char represents one element and calls it alphabet\n alphabet = ('a'..'z').to_a\n # Takes the alphabet array, uses the zip array to assign merge element to sa key position in a hash, then maps those keys \n # to a new alphabet array that rotates each element by the element 4 positions later than it. \n cipher = Hash[alphabet.zip(alphabet.rotate(4))]\n # define spaces as an array of special char\n spaces = [\"@\", \"#\", \"$\", \"%\", \"^\", \"&\", \"*\"]\n \n #defines original_sentence as input converted to all lowercase letters\n original_sentence = sentence.downcase\n #creates array called encoded_sentence\n encoded_sentence = []\n\n # for each character in the string do\n original_sentence.each_char do |element|\n # if the cipher has the element, push the value of the element into the new array\n if cipher.include?(element)\n encoded_sentence << cipher[element]\n # if cipher has a space, select randomly from the 7 special chars, push sp char to new array\n elsif element == ' '\n encoded_sentence << spaces.sample\n # otherwise, push the element as is to the new arrray\n else \n encoded_sentence << element\n end\n end\n #output the encoded sentence array as a string\n return encoded_sentence.join\nend",
"def decrypt(prefix_count, so_far, block_num)\n r = 'a'*prefix_count\n # puts \"Decrypt; prefix_count: #{prefix_count} (#{r.length}) so_far: #{so_far} (#{so_far.length}) block_num: #{block_num}\"\n #raise unless (r.length + so_far.length) % 16 == 15\n short = encryption_oracle(r)[block_num*16..block_num*16+15] # ciphertext with start of unknown\n # ^ pulling the right byte, but need to include 15 bytes of of padding...\n\n (0..255).each do |ch|\n if block_num == 0\n t = r + so_far + ch.chr # padding + known unknown chars + test char in last position\n else\n t = so_far + ch.chr # no padding since we are in scan mode Now\n end\n test = encryption_oracle(t)[0..15]\n if short == test\n return ch\n end\n end\n nil\nend",
"def encrypt_phrase\n\t\tunencoded_array = @starting_phrase.split('').map{|v| v.ord - 65}\n\t\tone_time_array = @one_time_phrase.split('').map{|v| v.ord - 65}\n\t\tunencoded_array.each_with_index do |starting_value, index|\n\t\t\tencoding_value = starting_value + one_time_array[index] - 1\n\t\t\t@encrypted_message += ((encoding_value % 26) + 65).chr\n\t\tend\n\tend",
"def aphash( key, len=key.length )\n state = 0xAAAAAAAA\n len.times{ |i|\n if (i & 1) == 0\n state ^= (state << 7) ^ key[i] * (state >> 3)\n else\n state ^= ~( (state << 11) + key[i] ^ (state >> 5) )\n end\n }\n return state\nend",
"def encrypt(message)\n new_message = \"\"\n alphabet = \"abcdefghijklmnopqrstuvwxyz\"\n \n counter = 0\n while counter < message.length\n \n if alphabet.index(message[counter]) == 25\n new_message += alphabet[0]\n else\n new_message += message[counter].next\n end\n \n counter += 1\n end\n new_message\nend",
"def translate_to_cipher(sentence) #def method \n alphabet = ('a'..'z').to_a #create array of alphabet\n cipher = Hash[alphabet.zip(alphabet.rotate(4))]#creates a hash w/4letter rotation\n spaces = [\"@\", \"#\", \"$\", \"%\", \"^\", \"&\", \"*\"] # array of potential encoded space chars\n \n original_sentence = sentence.downcase #new var and set to downcase param\n encoded_sentence = [] #new array\n original_sentence.each_char do |element| #iterating through sentence.downcase by char\n if cipher.include?(element) #check to see if the element matches any of the hash keys\n encoded_sentence << cipher[element] # passes new array the hash value by calling the key\n elsif element == ' ' #checks for a space in sentence\n encoded_sentence << spaces.sample #sends in a random char from spaces array\n else\n encoded_sentence << element #if nothing else then just pass the encoded message the char\n end\n end\n \n return encoded_sentence.join #return encoded sentence array as one value\nend",
"def folding_cipher(string)\n\nend",
"def translate_to_cipher(sentence) # Defining method as translate_to_cipher, takes argument sentence\n alphabet = ('a'..'z').to_a # Sets variable alphabet, turns range into array \n cipher = Hash[alphabet.zip(alphabet.rotate(4))] # Creates a hash in which it takes the alphabet elements as keys and sets up values as 4 letters from the key\n spaces = [\"@\", \"#\", \"$\", \"%\", \"^\", \"&\", \"*\"] # Sets an array \"spaces\" \n \n original_sentence = sentence.downcase # Sets variable original_sentece to be argument but in lower case\n encoded_sentence = [] # Creates empty array encoded_sentence\n original_sentence.each_char do |element| # Begins a loops through each element of the original_sentence array \n if cipher.include?(element) # Checks to see if each element is present\n encoded_sentence << cipher[element] # If present, pushes the key from the cipher hash \n elsif element == ' ' # Checks to see if element is ''\n encoded_sentence << spaces.sample #If present, selects one of the elements from spaces and pushses to encoded_sentence\n else \n encoded_sentence << element #Otherwise, it pushes the element into the encoded_sentence\n end\n end\n \n return encoded_sentence.join #takes encoded sentence and joins it together\nend",
"def folding_cipher(str)\n\nend",
"def solve_cipher(string, n)\n\n#Split each element of the string to get and array and return an array where each element is x (to operate with each element)\n string.split('').map do |x|\n#Create a new variable that will be the new index for each element.\n new_index = x.ord + n\n \n#Define the new index value with if conditional statements.\n\n#The value for whitespace is its value -26 as it is not included in the alphanumerical rules defined above\nif x == ' '\n new_index = ' '.ord - 26\nend\n\n\n#Declare the values of the index where it is above z's\nif new_index > 'z'.ord\n new_index = 'a'.ord + new_index - 'z'.ord - 1\nend\n\n#Declare the values of the index where it is beyond a's\nif new_index < 'a'.ord\n new_index = 'z'.ord - ('a'.ord - new_index) + 1\nend\n \n #Make the function return the list of numbers converted into letters \n new_index.chr\n\nend.join\n\nend",
"def caesars_cipher(str, shift = 1)\n encrypted = ''\n\n ascii_nums = str.bytes\n ascii_nums.each do |i|\n encrypted << case i\n when 65..90\n ((i + shift - 65) % 26 + 65).chr\n when 97..122\n ((i + shift - 97) % 26 + 97).chr\n else\n i.chr\n end\n end\n encrypted\nend",
"def caesarCipherEncryptor(string, key)\n new_letters = []\n new_key = key % 26\n alphabet = (\"abcdefghijklmnopqrstuvwxyz\").chars\n\n string.each_char do |letter|\n new_letters.append(get_new_letter(letter, new_key, alphabet))\n end\n return new_letters.join\nend",
"def translate_to_cipher(sentence) #defines a variable that accepts a sentence as an argument\n alphabet = ('a'..'z').to_a #defines a variable that contains an array with all the letters of the alphabet\n cipher = Hash[alphabet.zip(alphabet.rotate(4))] #this line defines a new hash \"cipher\" which will contain the equivalencies of coded and decoded\n # characters. This is achieved with the zip method which creates an array out of whatever argument we input and then merges that new array with self\n # In this case the argument is alphabet rotate count 4, which means the new array will be comprised by the alphabet but starting in th letter 'e'\n spaces = [\"@\", \"#\", \"$\", \"%\", \"^\", \"&\", \"*\"] #creates an array comprised by a number of special characters\n \n original_sentence = sentence.downcase #creates a variable in which all of the sentence passed is changed into lower case\n encoded_sentence = [] #creates a new empty array\n original_sentence.each_char do |element| #starts a loop that will iterate through each character of original_sentence\n if cipher.include?(element) #if said character is in the cipher hash it will be changed to the rotated value and pushed into 'encoded_sentence'\n encoded_sentence << cipher[element]\n elsif element == ' '#otherwise, if what we meet is a space, replace it randomly with any of the symbols in spaces array\n encoded_sentence << spaces.sample\n else \n encoded_sentence << element #finally, if it isn't neither of them, the original character will be passed into the encoded sentence, without encoding it\n end\n end\n \n return encoded_sentence.join #this takes all the elements in the array and turns them into a string\nend",
"def calculate_diff(plain,cipher)\n\tplain = plain.unpack('C*').map{|c| c-'A'.ord}\n\tcipher = cipher.unpack('C*').map{|c| c-'A'.ord}\n\tdiff = cipher.zip(plain).map{|a| (a[0]-a[1]) % 26}\n\treturn diff\nend",
"def translate_to_cipher(sentence) #Defining the method and the input\n alphabet = ('a'..'z').to_a #creating a variable, alphabet and making it an array\n cipher = Hash[alphabet.zip(alphabet.rotate(4))] # creating variable, cipher. #zip method takes the\n # alphabet variable and generates a sequence of arrays that correspond to the .length of the arguments. \n #The #rotate method will rotate the elements of the array to create a new array. I don't exactly now what \n # they do when put together like this.\n spaces = [\"@\", \"#\", \"$\", \"%\", \"^\", \"&\", \"*\"] #creating variable, spaces, that includes an array of symbols.\n \n original_sentence = sentence.downcase #making the input lowercase\n encoded_sentence = [] #creating a new array, encoded_sentence\n original_sentence.each_char do |element| #loops through the original sentence and takes each character and impliments element\n if cipher.include?(element)\n encoded_sentence << cipher[element] # if the cipher includes the element, the loop returns the encoded_sentence including the cipher.\n elsif element == ' '\n encoded_sentence << spaces.sample # if the element is a space, the encoded_sentence includes the space.\n else \n encoded_sentence << element #otherwise the encoded sentence just includes the element.\n end\n end\n \n return encoded_sentence.join\nend",
"def encrypt(keys, plain)\n ::Fernet.generate(keys.last, plain)\n end",
"def caesar_cipher(str, num)\r\n alphabet = \"abcdefghijklmnopqrstuvwxyz\"\r\n cypher = alphabet.split(\"\").map.with_index do |char, i|\r\n if !(alphabet.split(\"\").index(char) + num >= alphabet.split(\"\").length)\r\n alphabet.split(\"\")[alphabet.split(\"\").index(char) + num]\r\n else\r\n alphabet.split(\"\")[alphabet.split(\"\").index(char) + num - alphabet.split(\"\").length]\r\n end\r\n end\r\n cryptography = ''\r\n str.each_char do |char|\r\n cryptography += cypher[alphabet.index(char)]\r\n end\r\n return cryptography\r\nend",
"def caesar_cipher(string, shift_factor)\n\n\n upc_alphabet_arr = ('A'..'Z').to_a\n downc_alphabet_arr = ('a'..'z').to_a\n\n\n string_chars_arr = string.chars\n\n new_chars_arr = []\n\n string_chars_arr.each do |char|\n if upc_alphabet_arr.include?(char)\n new_index = (upc_alphabet_arr.index(char) + shift_factor)%26\n new_char = upc_alphabet_arr[new_index]\n\n new_chars_arr << new_char\n\n elsif downc_alphabet_arr.include?(char)\n new_index = (downc_alphabet_arr.index(char) + shift_factor)%26\n new_char = downc_alphabet_arr[new_index]\n\n new_chars_arr << new_char\n\n else \n new_chars_arr << char\n end\n end\n\n new_string = new_chars_arr.join(\"\")\n puts new_string\nend",
"def encrypt_prepend_append(plain_txt, target_bytes64)\n AES.new.aes_ecb_encrypt(\n RANDOM_PLAIN_TXT + plain_txt + target_bytes64.unpack(\"m\")[0],\n KEY\n )\nend",
"def encrypt(alg, password, string)\n \n begin\n case alg\n when \"3DES\" then key = EzCrypto::Key.with_password(password, $system_salt, :algorithm => 'des3')\n when \"AES\" then key = EzCrypto::Key.with_password(password, $system_salt, :algoritmh => 'aes256')\n when \"Blowfish\" then key =EzCrypto::Key.with_password(password, $system_salt, :algoritmh => 'blowfish')\n when 'Plaintext' then return string\n else key = EzCrypto::Key.with_password(password, $system_salt, :algorithm => 'aes256') \n end\n encrypted_text = key.encrypt64(string)\n rescue => e\n p e.message\n end\n return encrypted_text\n \n end",
"def encrypt(str)\n result = []\n i = 0\n while str.size > 0\n chunk = counter(str)\n index = chunk[1]\n result << chunk\n str = str[index..-1]\n end\n result\nend",
"def transpose_blocks(data, size)\n blocks = Hash.new { |h, k| h[k] = [] }\n\n # Now that you probably know the KEYSIZE: break the ciphertext into blocks of\n # KEYSIZE length.\n data.split(\"\").each_slice(size) do |slice|\n slice.each_with_index do |char, i|\n # Now transpose the blocks: make a block that is the first byte of every\n # block, and a block that is the second byte of every block, and so on.\n blocks[i] << char\n end\n end\n\n blocks.each do |k, v|\n blocks[k] = v.join(\"\")\n end\nend",
"def encrypt(str)\n result = []\n \n consec_counter = 0\n\n str.chars.each_with_index do |current, idx|\n right = str[idx + 1]\n consec_counter += 1\n # a b a\n if right != current\n result << [current, consec_counter]\n consec_counter = 0\n end\n end\n result\nend",
"def key_for_string str\n Digest::MD5.hexdigest(str).to_i(16) & KEY_MAX\n end",
"def encryption_oracle(message)\n rand_key = SecureRandom.random_bytes(16)\n rand_iv = SecureRandom.random_bytes(16)\n front_bytes = SecureRandom.random_bytes(rand(5..10))\n end_bytes = SecureRandom.random_bytes(rand(5..10))\n\n padded_message = front_bytes + message + end_bytes\n\n (rand(1..2) == 1) ? encrypt_ecb(message, rand_key) : encrypt_cbc(message, rand_key, rand_iv)\nend",
"def encrypt(secret_password)\n# Create a character index\n index = 0\n# Create an empty string to have a return value\n encrypted_string = \"\"\n# Loop until you get to the last letter in the password\n while index < secret_password.length do\n encrypted_string += secret_password[index].next\n# Call the index plus 1\n index += 1\n end\n #return the implicit empty response at the end\n encrypted_string\n# end encryption method\nend",
"def folding_cipher(str)\nend",
"def crypto_attack(exploit_string)\r\n getsin_msg = fetch_getsin\r\n if getsin_msg.nil?\r\n return nil\r\n end\r\n\r\n getsin_kp = 'GetSIN' + datastore['LHOST'] + '|'\r\n keystream = get_keystream(getsin_msg, getsin_kp)\r\n\r\n if keystream.length < exploit_string.length\r\n missing_bytecount = exploit_string.length - keystream.length\r\n\r\n print_status(\"Missing #{missing_bytecount} bytes of keystream ...\")\r\n\r\n inferrence_segment = ''\r\n brute_max = 4\r\n\r\n if missing_bytecount > brute_max\r\n print_status(\"Using inferrence attack ...\")\r\n\r\n # Offsets to monitor for changes\r\n target_offset_range = []\r\n for i in (keystream.length + brute_max)..(keystream.length + missing_bytecount - 1)\r\n target_offset_range << i\r\n end\r\n\r\n # Store inference results\r\n inference_results = {}\r\n\r\n # As long as we haven't fully recovered all offsets through inference\r\n # We keep our observation window in a circular buffer with 4 slots with the buffer running between [head, tail]\r\n getsin_observation = [''] * 4\r\n buffer_head = 0\r\n\r\n for i in 0..2\r\n getsin_observation[i] = [fetch_getsin].pack('H*')\r\n Rex.sleep(0.5)\r\n end\r\n\r\n buffer_tail = 3\r\n\r\n # Actual inference attack happens here\r\n while !target_offset_range.empty?\r\n getsin_observation[buffer_tail] = [fetch_getsin].pack('H*')\r\n Rex.sleep(0.5)\r\n\r\n # We check if we spot a change within a position between two consecutive items within our circular buffer\r\n # (assuming preceding entries are static in that position) we observed a 'carry', ie. our observed position went from 9 to 0\r\n target_offset_range.each do |x|\r\n index = buffer_head\r\n\r\n while index != buffer_tail do\r\n next_index = (index + 1) % 4\r\n\r\n # The condition we impose is that observed character x has to differ between two observations and the character left of it has to differ in those same\r\n # observations as well while being constant in at least one previous or subsequent observation\r\n if (getsin_observation[index][x] != getsin_observation[next_index][x]) && (getsin_observation[index][x - 1] != getsin_observation[next_index][x - 1]) && ((getsin_observation[(index - 1) % 4][x - 1] == getsin_observation[index][x - 1]) || (getsin_observation[next_index][x - 1] == getsin_observation[(next_index + 1) % 4][x - 1]))\r\n target_offset_range.delete(x)\r\n inference_results[x] = xor_strings(getsin_observation[index][x], '9')\r\n break\r\n end\r\n index = next_index\r\n end\r\n end\r\n\r\n # Update circular buffer head & tail\r\n buffer_tail = (buffer_tail + 1) % 4\r\n # Move head to right once tail wraps around, discarding oldest item in circular buffer\r\n if buffer_tail == buffer_head\r\n buffer_head = (buffer_head + 1) % 4\r\n end\r\n end\r\n\r\n # Inferrence attack done, reconstruct final keystream segment\r\n inf_seg = [\"\\x00\"] * (keystream.length + missing_bytecount)\r\n inferrence_results.each do |x, val|\r\n inf_seg[x] = val\r\n end\r\n\r\n inferrence_segment = inf_seg.slice(keystream.length + brute_max, inf_seg.length).join\r\n missing_bytecount = brute_max\r\n end\r\n\r\n if missing_bytecount > brute_max\r\n print_status(\"Improper keystream recovery ...\")\r\n return nil\r\n end\r\n\r\n print_status(\"Initiating brute force ...\")\r\n\r\n # Bruteforce first missing_bytecount bytes of timestamp (maximum of brute_max)\r\n charset = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '0']\r\n char_range = missing_bytecount.times.map { charset }\r\n char_range.first.product(*char_range[1..-1]) do |x|\r\n p = x.join\r\n candidate_plaintext = getsin_kp + p\r\n candidate_keystream = get_keystream(getsin_msg, candidate_plaintext) + inferrence_segment\r\n filedata = try_exploit(exploit_string, candidate_keystream, true)\r\n\r\n if !filedata.nil?\r\n return filedata\r\n end\r\n end\r\n return nil\r\n end\r\n\r\n try_exploit(exploit_string, keystream, false)\r\n end",
"def encrypt(index, password)\n while index < password.length\n password[index] = password[index].next!\n index +=1\n end\nend"
] | [
"0.6412979",
"0.6404489",
"0.63950646",
"0.6393603",
"0.63792163",
"0.63783014",
"0.63331944",
"0.6328843",
"0.6294866",
"0.6278272",
"0.6272806",
"0.6262966",
"0.6238474",
"0.62333554",
"0.6211109",
"0.6193841",
"0.6171217",
"0.6158139",
"0.61558175",
"0.6109341",
"0.6105967",
"0.6089786",
"0.60829306",
"0.60754246",
"0.6074128",
"0.6065493",
"0.60643035",
"0.6033366",
"0.6021447",
"0.60009784",
"0.5977105",
"0.59637547",
"0.5946054",
"0.59424573",
"0.5941538",
"0.5940713",
"0.59334964",
"0.5929287",
"0.59232",
"0.59205925",
"0.591848",
"0.5907756",
"0.59036833",
"0.58997476",
"0.58955455",
"0.5894278",
"0.58933043",
"0.58685195",
"0.5853985",
"0.5848366",
"0.58457464",
"0.58365786",
"0.5834943",
"0.5828443",
"0.58103585",
"0.5796039",
"0.5795622",
"0.57841504",
"0.5779611",
"0.5777747",
"0.57754713",
"0.577405",
"0.5772432",
"0.57537013",
"0.57536316",
"0.5750437",
"0.574934",
"0.57378614",
"0.5717008",
"0.5715043",
"0.5712305",
"0.57020324",
"0.5701773",
"0.56989163",
"0.5691352",
"0.5668744",
"0.5667908",
"0.5666468",
"0.56635916",
"0.5639208",
"0.5636138",
"0.5631968",
"0.56251353",
"0.56132025",
"0.5611138",
"0.5608853",
"0.5608752",
"0.5604713",
"0.5598201",
"0.5592711",
"0.5590922",
"0.5590302",
"0.558697",
"0.5586149",
"0.55849904",
"0.5583608",
"0.5582918",
"0.5581882",
"0.55713934",
"0.55646765"
] | 0.6165188 | 17 |
See current Goodreads Notifications. Note, this will mark them as seen | def notifications(page = 1)
options = {"page" => page}
data = oauth_request("/notifications.xml", options)
Hashie::Mash.new(data)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def seen\n if @ok\n @ok = @notification.has_been_seen\n end\n @new_notifications = current_user.number_notifications_not_seen\n end",
"def mark_as_read\n if Notification.mark_as_read\n return_message(200, :ok)\n else\n return_message(200, :fail)\n end\n end",
"def saw_notification\n current_user.notice_seen = true\n current_user.save\n end",
"def show\n @notification.seen = true\n @notification.save\n end",
"def notifications\n end",
"def unread_notifications\n notifications_received.where('activities.created_at > ?', notifications_checked_at)\n end",
"def show\n # Title of the webpage\n @title = 'Notifications'\n\n # Getting all of the user's notifications, then those that are unread\n @all_notifications = Notification.where([\"user_id = :id\", { id: current_user.id }]).order(created_at: :desc)\n @notification_content = {}\n @unread_notification_ids = []\n\n @all_notifications.each do |notification|\n if notification.unread?\n # Mark all of the unread notifications as read, since they have now been opened\n @unread_notification_ids << notification.id\n notification.unread = false\n notification.save\n end\n\n # Get the pieces of the body of the notification\n if notification.body\n @notification_content[notification.id] = notification.body.split(/\\n/)\n end\n\n end\n\n # Clear the number of unread notifications for the user\n current_user.update_attribute(:unread_notifications, 0)\n end",
"def show\n @notifications = Notification.where(user: current_user).where(notification_obeject_id: params[:id]).where(read: false)\n @notifications.each do |note|\n note.read = true\n note.save\n end\n end",
"def mark_as_read\n @notifications = Notification.where(recipient: current_user).unread\n @notifications.update_all(read_at: Time.zone.now)\n render json: {success: true}\n end",
"def mark_as_read\n DeterLab.mark_notifications(current_user_id, [ params[:id] ], [ { isSet: true, tag: Notification::READ } ])\n render text: 'ok'\n end",
"def get_notifications\n \t\n \t@notifs = []\n\n \tif current_user\n @notifs = Notification.where(:user_id => current_user.id, :seen => false)\n \tend\n end",
"def show\n Notification.set_seen @notifications, \"quote\", @quote.id\n count_notification\n end",
"def show\n @message.mark_as_read(current_user)\n end",
"def mark_notification_as_read!\n notification = User.find(@userid).notifications\n @received_msg.each do |notify|\n notification.update(notify['id'], :checked => true);\n end\n end",
"def show_notifications # :norobots:\n pass_query_params\n data = []\n @observation = find_or_goto_index(Observation, params[:id].to_s)\n return unless @observation\n name_tracking_emails(@user.id).each do |q|\n fields = [:naming, :notification, :shown]\n naming_id, notification_id, shown = q.get_integers(fields)\n next unless shown.nil?\n notification = Notification.find(notification_id)\n if notification.note_template\n data.push([notification, Naming.find(naming_id)])\n end\n q.add_integer(:shown, 1)\n end\n @data = data.sort_by { rand }\n end",
"def show\n @conversation.mark_messages_as_read\n end",
"def follow_notification\n Notifications.follow_notification\n end",
"def mark_as_unread\n Notifyer::Notification.all.each do |n|\n n.update(is_read: false)\n end\n redirect_to :back\n end",
"def read_notifications\n # Update post notification\n post_notification = @message.sender\n .notifications_unread\n .where(\"origin_type = ? AND origin_id = ?\", 'Post', @post.id)\n .first\n post_notification.update_attributes(read: true) unless post_notification.nil?\n\n # Update post's messages notifications\n @post.messages.each do |message|\n message_notification = @message.sender\n .notifications_unread\n .where(\"origin_type = ? AND origin_id = ?\", 'Message', message.id)\n .first\n message_notification.update_attributes(read: true) unless message_notification.nil?\n end\n end",
"def mark_all_as_read\n @notifications = Notification.unread.for_user(current_api_v1_user)\n @notifications.update_all(read_at: Time.now) unless @notifications.blank?\n @notifications = Notification.where(recipient_id: current_api_v1_user.id)\n \n render json: @notifications\n end",
"def mark_notifications_read\n return if params[:notification_id].blank? or !user_signed_in?\n n = Notification.find(params[:notification_id])\n current_subject.mark_as_read n\n end",
"def index\n\t\t@notifications = Notification.where(recipient_id: current_user.id).unread\n\tend",
"def show\n @complaint.mark_as_read! for: current_user\n @unread_complain_ids = Complaint.unread_by(current_user).map(&:id)\n end",
"def display_notifications_in_tab(object)\n\t\tif current_petsitter\n\n\t\t\tif object.notificationforpetsitters.where('read_status = ? ' , false ).present?\n\n\t\t\t\treturn_html =\"<span style='color:#ff6666 ; font-weight:bolder;'>\" + \" <i class='fa fa-exclamation-circle' aria-hidden='true' ></i>\" + \" (\" + object.notificationforpetsitters.where('read_status = ? ' , false ).count.to_s + \")\" + \"</span>\"\n\t\t\t\treturn return_html.html_safe\n\n\t\t\tend\n\t\t\t\n\t\telsif current_petowner\n\n\t\t\tif object.notificationforpetowners.where('read_status = ? ' , false ).present?\n\n\t\t\t\treturn_html =\"<span style='color:#ff6666 ; font-weight:bolder;'>\" + \" <i class='fa fa-exclamation-circle' aria-hidden='true' ></i>\" + \" (\" + object.notificationforpetowners.where('read_status = ? ' , false ).count.to_s + \")\" + \"</span>\"\n\t\t\t\treturn return_html.html_safe\n\n\t\t\tend\n\n\t\tend\n\n\t\t\n\t\n\tend",
"def show\n @notification.update_column(:read_at, Time.now) unless @notification.read_at\n redirect_to url_to_notification(@notification)\n end",
"def notification\n notifications = Notification.where(\"user_id = ? AND viewed = ?\", current_user, false)\n flash[:notice] = \"Vous avez vendu #{notifications.size} bon(s)\" if notifications.size > 0\n notifications.each do |notification|\n notification.viewed = \"true\"\n notification.save\n end\n end",
"def check\n\n\t\t@unseenNotifications = {notifications: current_user.notifications.unseen.count}\n\t\trespond_to do |format|\n\n\t\t\tformat.json { render json: @unseenNotifications }\n\n\t\tend\n\n\tend",
"def notifications\n query_api_object Notification, \"/rest/notifications\", nil, \"GET\", \"notifications\"\n end",
"def unread\n @notifications = Notification.where(user_id: current_user.uid).where(is_read: false).page(params[:page]).order(created_at: :desc)\n end",
"def mark_all_readed\n doctor.notifications.update_all unreaded: false\n send_json doctor.notifications, true\n end",
"def list_notifications # :norobots:\n @notifications = Notification.find_all_by_user_id(@user.id, order: :flavor)\n end",
"def index\n @notices = Notice.all.where(client_id: current_client.id) if current_client\n end",
"def show\n @post = Post.find(params[:id])\n if params[:notice]\n Notification.update_all({:read => true}, {:id => params[:notice]})\n end\n end",
"def show\n \n @notification = Notification.find_by_sender_id_and_listing_id(current_user.id,@listing.id) if user_signed_in?\n end",
"def notify\n notify_unmentioned_reviewers\n notify_mentioned_event_staff if mention_names.any?\n end",
"def send_notifications\n end",
"def notify_new_findings\n # TODO: make the method avoid the creation of a Notification record\n end",
"def index\n @notifications = Notification.where(user: current_user)\n end",
"def notify_rating\n @pack = Packages.get_packages_rating(cookies[:user_id])\n if( @pack != nil )\n @pack.each do |t|\n @rating = Packages.get_packages_find_rating(t.id)\n @rate = Packages.get_packages_find_rate(t.id)\n @rates = Packages.get_packages_find_rates(t.id)\n if( @rating == true ) && ( @rates != nil )\n @notification = Notifications.create(@rate, \"You have been rated on a specific package\")\n end\n end\n end\n return;\n end",
"def old_notify_user (listing, sender, receiver)\n send_as :notification\n from sender.facebook_session.user \n recipients receiver.facebook_session.user\n #fbml \"<a href='#{FB_APP_HOME_URL}/listings/#{listing.id}'><b>#{listing.title}</b></a> has been approved.\"\n fbml \"Your listing: <a href='#{listings_path(listing.id)}}'><b>#{listing.title}</b></a> has been approved.\"\n end",
"def show\n if @notification.waiting?\n if @notification.should_be_deleted_after_view?\n @notification.update_attribute(:status, ::Users::Notification::Status::DELETED)\n\n elsif @notification.should_flag_viewed?\n @notification.update_attribute(:status, ::Users::Notification::Status::VIEWED)\n end\n set_referer_as_redirect_back\n end\n respond_to do |format|\n format.html { redirect_to @notification.uri }\n format.json { render json: @notification.as_json(relationship_to_user: auth_user)\n }\n end\n end",
"def unread_notifications_since_last_read\n notification.class.for_target(notification.target)\n .where(group_id: notification.group_id)\n .where(read_at: nil)\n .where('notify_user_notifications.created_at >= ?', last_read_notification.try(:read_at) || 24.hours.ago)\n .where.not(id: notification.id)\n .order(created_at: :desc)\n end",
"def show\n #TRACKER.track(current_user['email'], \"READ_EMAIL\", {\"email_id\" => @email.id, \"email_reference\" => @email.reference_id})\n TRACKER.track(current_user['email'], \"READ_EMAIL\", @email.id, @email.reference_id)\n end",
"def mark_notifications_as_read!(user)\n self.notifications.where(read: false, user_id: user.id).update_all(read: true)\n end",
"def show\n @notices = Notice.order(created_at: :desc).where(finalised: false)\n end",
"def index\n @notifications = current_user.notifications.unread.page(params[:page]).per(20)\n end",
"def list_notifications\n BrickFTP::API::Notification.all\n end",
"def list_notifications\n BrickFTP::API::Notification.all\n end",
"def mark_unread!\n update_is_read_status false\n end",
"def retrieve_notifications\n\tunread = self.notifications.where(\"read = ?\", false).order(\"created_at DESC\")\n\t\n\tif unread.count < 10\n\t\tread = self.notifications.where(\"read = ?\", true).order(\"created_at DESC\").limit(10 - unread.count)\n\t\t\n\t\tunread = unread.concat(read)\n\tend\n\t\n\treturn unread\n end",
"def index\n @front_page_notifications = FrontPageNotification.all\n end",
"def notifications\n return notification_data_source.notifications\n end",
"def unread\n @notifications = current_user.notifications.unread.page(params[:page]).per(5)\n end",
"def is_there_notification\n current_user.notifications\n end",
"def load_notifications\n # reload user data\n user = User.find current_user.id\n @notifications = user.notifications.order(\"updated_at DESC\")\n\n new_feeds = user.notification_readers.select {|feed| !feed.isRead?}\n new_feeds.each do |feed|\n feed.read_at = Time.zone.now\n feed.save!\n end\n end",
"def notification_badge\n if current_user.notifications.any?\n mi.notifications\n else\n mi.notifications_none\n end\n end",
"def show\n open_notification(@deal, self, current_user) if params[:opened]\n end",
"def index\n #Notifications\n @allNotifications = Notification.where(\"notify_app = true AND triggered = true\").order(start_time: :desc).limit(3)\n @triggeredNotifications = Notification.where(\"notify_app = true AND triggered = true\").count\n\n #Paneles\n @clients = Client.all\n end",
"def show\n @notifications = current_user.notifications.limit(3)\n end",
"def message_notifications\n notifications = Message.where(receiver_id: @current_user.id, read_status: 0)\n if notifications\n render json: {\n status: 'success',\n message: 'Your notifications',\n data: notifications.length()\n },\n status: :ok\n end\n end",
"def check_for_messages\n @message_unviewed = Message.all(:recipient_id => current_user.id, :viewed => false, :opportunity => Opportunity.all(:active => true))\n if @message_unviewed != []\n flash.now[:warning] = 'You have unread messages'\n end\n end",
"def message_notification\n fetch(:hipchat_announce, false)\n end",
"def mark_notifications_as_read(options = {})\n boolean_from_response :put, 'notifications', options\n end",
"def notifications_new\n @notifications = Submission.includes(:user, :problem, followings: :user).where(visible: true).order(\"lastcomment DESC\").paginate(page: params[:page]).to_a\n @new = true\n render :notifications\n end",
"def send_status_notification\n message = case @state\n when :hungry then \"I'm hungry!!!\"\n when :sick then \"I'm not feeling so well... :(\"\n when :playful then 'Come play with me!'\n end\n\n DesktopNotifications.notify(message) unless message.nil?\n end",
"def notifications_update\n @notifications = current_user.sk.followed_submissions.includes(:user, :problem).where(\"status > 0\").order(\"lastcomment DESC\").paginate(page: params[:page]).to_a\n @new = false\n render :notifications\n end",
"def mark_all_read\r\n @channel.mark_messages_read_for current_user\r\n respond_to do |format|\r\n format.html { redirect_to channel_messages_url(@channel), notice: 'Nachrichten als gelesen markiert.' }\r\n format.json { head :no_content }\r\n end\r\n end",
"def show\n @message = find_recipient_message\n redirect_to messages_inbox_index_path and return unless @message\n @message.mark_as_read\n end",
"def list(message)\n return if message.user.nick === ForrstBot::Bot.nick\n\n count = ForrstBot::Model::Note.filter(:user => message.user.nick).count\n\n if count > 0\n message.reply(\n \"You have #{count} note(s), speak in a channel I'm active in and \" \\\n + \"I'll send them to you.\",\n true\n )\n end\n end",
"def check_new_noti\n Settings.Repos.each do |repo|\n notis = @git_client.repository_events(repo.url)\n next if notis.empty?\n\n puts \"New Notification in #{repo.display_name}\"\n\n notis.each do |noti|\n event = launcher.git_client.get(noti.subject.latest_comment_url)\n next unless noti.subject.type == \"PullRequest\"\n message = @message_generator.noti2message repo, noti, event\n ChatWork::Message.create(room_id: repo.chatwork_box, body: message)\n end\n\n launcher.git_client.mark_repo_notifications_as_read(repo.url) if repo.auto_read\n end\n end",
"def read\n @entourage.join_requests\n .accepted\n .where(user: current_user)\n .update_all(last_message_read: DateTime.now)\n head :no_content\n end",
"def unread\n all(UNREAD)\n end",
"def load_notifications\n \t\tif current_user\n \t\t\t@notifications = current_user.notifications.limit 5\n \t\t\t@unseen_notifications_count = current_user.notifications.unseen.count\n \t\tend\n \tend",
"def index\n puts \"==========================\"\n puts \"INDEX\"\n @notifications = Notification.where({user: current_user})\n end",
"def all_notifications\n self.notifications.all\n end",
"def index\n @notification_contents = current_account.notification_contents.all\n end",
"def find_pending\n notifications.where sent: false\n end",
"def set_notifications\n\t\t@notifications = Notification.where(reciever_id: current_user).order(\"created_at DESC\")\n\tend",
"def notifications\n\t\tif signed_in?\n\t\t\tn = current_user.extra.notifications\n\t\t\tif n > 0\n\t\t\t\t\"(\" + n.to_s + \")\"\n\t\t\tend\n\t\tend\n\tend",
"def gift_notification(gift)\n @requester = gift.requester\n @owner = gift.owner\n @lacquer = gift.lacquer\n @user_url = \"http://www.lacquerloveandlend.com/users/#{@requester.id}\"\n @thank_you_email_url = \"http://www.lacquerloveandlend.com/new_transactional_message?gift_id=#{gift.id}\"\n\n mail(to: @requester.email, subject: \"You've received a gift on Lacquer Love&Lend!\")\n\n headers['X-MC-Track'] = \"opens, clicks_all\"\n end",
"def new_messages\r\n self.unread_messages\r\n end",
"def new_messages\r\n self.unread_messages\r\n end",
"def notifications\n @other_user = @login_user\n @notifications = DiscussionGroupUser.where(['user_id =? AND is_member=?', @login_user.id, false])\n @disc_notifications = NonSiteUser.where([\"email=? AND invitable_type=? and invitation_type=?\",@login_user.email,\"Discussion\",\"Invited\"])\n respond_to do |format|\n format.html\n end\n end",
"def notification_arns\n @stack.notification_arns\n end",
"def notification_count\n return NotificationReader.where(user: current_user, read_at: nil).count\n end",
"def badge; end",
"def index\n @users = User.all\n @notifications = Notification.where(recipient: current_user).unread\n end",
"def get_notifications\n @notifications = Broadcast.joins(:feeds).where(feeds: {name: \"notification\"}).order(created_at: :desc).limit(20)\n end",
"def index\n @notifylikes = Notifylike.all\n end",
"def watching_notification\n @sender = @watchable.user\n @user = @receiver\n path = \"/#{@watchable.class.name.downcase.pluralize}/#{@watchable.id}\"\n @notification = @user.notifications.find_by(path: path)\n subject = \"[bootcamp] #{@sender.login_name}さんの【 #{@watchable.notification_title} 】に#{@comment.user.login_name}さんがコメントしました。\"\n mail to: @user.email, subject: subject\n end",
"def notifications\n @current_user ||= User.find(session[:user_id]) if session[:user_id]\n @client = Octokit::Client.new(:access_token => @current_user.token)\n\n # get first 50 notifications (github paginates at 50)\n notifications = @client.notifications({all: true, per_page: 50})\n\n # if there are more pages, get page 2\n more_pages = @client.last_response.rels[:next]\n if more_pages\n notifications.concat more_pages.get.data\n end\n\n # Consider how to get more pages...\n # page_count = 0\n # while more_pages and page_count < 10\n # notifications.concat more_pages.get.data\n # page_count++\n # more_pages = @client.last_response.rels[:next]\n # end\n\n # iterate over notifications to:\n # add score value\n # add notification_url value\n @json = notifications.map do |notification|\n add_score_url_to_notification(notification, {favRepos: @current_user.UserPreference.repos})\n end\n\n respond_to do |format|\n format.json {\n render json: @json.to_json, status: 200\n }\n end\n end",
"def notify_new_finding\n # TODO: make the method avoid the creation of a Notification record\n end",
"def received_friend_requests\n self.followers.where(\"friend_status = 'PENDING'\")\n end",
"def feed\n\t\t# Microalert.from_buildings_followed_by(self) \n\t\t#Microalert.where(\"vocal_type = ? AND vocal_id = ?\", self.class.name, id)\n\t\t#Microalert.from_buildings_followed_by(self)\n\t\tMicroalert.from_all_followed_by(self) \n\tend",
"def get_notices\n @Noticias = Notice.all(:conditions => ['published = 1'], :order => \"id desc\", :limit => \"6\")\n end",
"def show\n @attachments = Attachment.where(notification_id: @_params[:id])\n\n @notification.mark_as_read!(true) if params[:cambiar_estado] == 'Leida'\n @notification.mark_as_read!(false) if params[:cambiar_estado] == 'NoLeida'\n end",
"def index\n @notices = Notice.all\n end",
"def mark_all_news_as_read\n where(:user_id => User.current_user_id).update_all(:read => 1)\n end",
"def show\n\n $new_unread_messages_cnt = Message.current_user_unread(current_user).unread_messages.length\n\n @userFriendships = Friendship.where(friend_id: current_user.id, status: \"pending\")\n @eventNotifs = EventNotif.where(user_id: current_user, is_checked: false)\n @friendships = Friendship.where(user_id: @user.id, friend_id: current_user.id, status: \"pending\")\n @acceptedFriendships = Friendship.where(user_id: @user.id, friend_id: current_user.id, status: \"accepted\")\n\n @interests = Interest.all\n\n @users = User.all\n @userNow = current_user\n @following = current_user.following\n\n\n collide = current_user.followingI.ids & @user.followingI.ids\n @collideInterests = Interest.find(params = collide).sort_by &:updated_at\n\n\n @user_groups = @user.groups.order(\"created_at DESC\")\n followingGroupsIds = @user.followingG.map(&:id)\n @groupsFollow = Group.find(params = followingGroupsIds).sort_by &:updated_at\n\n @user_events = @user.events.order(\"created_at DESC\")\n followingEventsIds = @user.followingE.map(&:id)\n @eventsFollow = Event.where(id: [followingEventsIds]).where('event_date > ?', Date.today).sort_by &:event_date\n\n @user_posts = @user.posts.order(\"created_at DESC\")\n\n if @user.date_of_birth.present?\n @age = current_user.age(current_user.date_of_birth)\n end\n \n end",
"def set_notifications\n @notifications = current_user.my_notifications\n end",
"def unread\n read_attribute(:unread)\n end"
] | [
"0.6556326",
"0.65034765",
"0.639331",
"0.6387553",
"0.6336311",
"0.6316533",
"0.62613624",
"0.6221774",
"0.62205684",
"0.62104297",
"0.6208574",
"0.62054366",
"0.6193375",
"0.6185426",
"0.6124191",
"0.61023325",
"0.60834783",
"0.60366696",
"0.59945333",
"0.5955392",
"0.59484637",
"0.5898734",
"0.5894442",
"0.5888964",
"0.5887536",
"0.5879139",
"0.58466274",
"0.5842343",
"0.5798164",
"0.57746166",
"0.5773127",
"0.5768981",
"0.5724767",
"0.57238656",
"0.5721964",
"0.57126296",
"0.57097447",
"0.5689993",
"0.5682502",
"0.5682422",
"0.5678317",
"0.5678074",
"0.5673244",
"0.5660192",
"0.5653754",
"0.56401074",
"0.56361794",
"0.56361794",
"0.5633277",
"0.56262946",
"0.56241673",
"0.56225675",
"0.5607675",
"0.56054515",
"0.5602447",
"0.5596925",
"0.5591625",
"0.5582988",
"0.55816597",
"0.556965",
"0.5554674",
"0.55528516",
"0.55494994",
"0.55468976",
"0.5536236",
"0.55216765",
"0.55210555",
"0.5520297",
"0.55168754",
"0.55131686",
"0.55114406",
"0.5508174",
"0.550436",
"0.5501997",
"0.54927725",
"0.5490323",
"0.5478718",
"0.5467981",
"0.5467061",
"0.5455725",
"0.5454294",
"0.5454294",
"0.5453826",
"0.54486835",
"0.5440307",
"0.5437864",
"0.5423034",
"0.5415056",
"0.5414889",
"0.541456",
"0.5408673",
"0.5396812",
"0.5393383",
"0.53771454",
"0.5369468",
"0.53655916",
"0.536313",
"0.534263",
"0.5341594",
"0.5341197",
"0.53384405"
] | 0.0 | -1 |
Problem 19 You are given the following information, but you may prefer to do some research for yourself. 1 Jan 1900 was a Monday. Thirty days has September, April, June and November. All the rest have thirtyone, Saving February alone, Which has twentyeight, rain or shine. And on leap years, twentynine. A leap year occurs on any year evenly divisible by 4, but not on a century unless it is divisible by 400. How many Sundays fell on the first of the month during the twentieth century (1 Jan 1901 to 31 Dec 2000)? | def sundayCounter
days = [31,28,31,30,31,30,31,31,30,31,30,31]
date, sundays = 0, 1
(1901...2000).each do
(0..11).each do |month|
date = (date + days[month]) % 7
sundays += 1 if date == 6
end
end
sundays
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def countSundaysYear(year, startDay)\n\tsundays = 0\n\tday = startDay % 7\n\tif(isLeapYear(year))\n\t\tyear = $MonthsLeap\n\telse\n\t\tyear = $Months\n\tend\n\t\n\tyear.each do |x|\n\t\tif(day == 0)\n\t\t\tsundays += 1\n\t\tend\n\t\tday = ((day + x) % 7)\n\t\t\n\tend\n\t\n\treturn sundays\nend",
"def total_sundays\r\n\tthirty_days = [4,6,9,11]\r\n\tthirtyone_days = [1,3,5,7,8,10,12]\r\n\t\r\n\ttotal_sunday = 0\r\n\tday_of_first = 2 # 0-6 = sunday - saturday (1 = monday)\r\n\t(1901..2000).each do |year|\r\n\t\t(1..12).each do |month|\r\n\t\t\tif thirty_days.include? month\r\n\t\t\t\tday_of_first = ((day_of_first + 30) % 7)\r\n\t\t\t\ttotal_sunday += 1 if day_of_first == 0\r\n\t\t\telsif thirtyone_days.include? month\r\n\t\t\t\tday_of_first = ((day_of_first + 31) % 7)\r\n\t\t\t\ttotal_sunday += 1 if day_of_first == 0\r\n\t\t\telsif year % 4 == 0 and year % 400 == 0\r\n\t\t\t\tday_of_first = ((day_of_first + 29) % 7)\r\n\t\t\t\ttotal_sunday += 1 if day_of_first == 0\r\n\t\t\telse\r\n\t\t\t\tday_of_first = ((day_of_first + 28) % 7)\r\n\t\t\t\ttotal_sunday += 1 if day_of_first == 0\r\n\t\t\tend\r\n\t\tend\r\n\tend\r\n\treturn total_sunday\r\nend",
"def find_days_from_sunday(year, month, date)\r\n\tresult = 0\r\n\tfull_years = year - 1900\r\n\t# add 365 for each full year\r\n\tresult += full_years * 365\r\n\t# add 1 for each full leap year\r\n\tresult += (full_years - 1) / 4\r\n\r\n\tmonth_days = [31,28,31,30,31,30,31,31,30,31,30,31]\r\n\t# add days for full months in final calendar year\r\n\tresult += month_days[0...(month - 1)].inject(0,:+)\r\n\t# add 1 for leap day in final calendar year\r\n\tresult += 1 if (month > 2) && (year % 4 == 0) && (year % 100 != 0)\r\n\r\n\t# add for number of days into final month\r\n\tresult += date\r\n\r\n\t# add one for dates Dec 31 1899 or earlier\r\n\tresult += 1 if year <= 1899\r\n\r\n\tresult\r\nend",
"def counting_sundays\n cumulative_sum = []\n\n (1900..2000).each do |year|\n (1..12).each do |month|\n cumulative_sum << days_in_month(month, year) + (cumulative_sum.last.nil? ? 0 : cumulative_sum.last)\n end\n end\n\n # Note that the cumulative sum represents the number of days before the start of each month\n # (i.e. cumulative_sum[0] == 31 == days before February 1900). Since we exclude the first\n # year, we count the number of Sundays from cumulative_sum[11..end]\n sundays = cumulative_sum[11..cumulative_sum.length - 1].inject(0) { |sum, e| (e % 7 == 6) ? sum + 1 : sum }\n return sundays\nend",
"def count_sunday_months(begin_date_full, end_date_full)\r\n\t# handle inputs in any order\r\n\tbegin_date_full, end_date_full = [begin_date_full, end_date_full].sort\r\n\r\n\tyear, month, begin_day = begin_date_full\r\n\tend_year, end_month, end_day = end_date_full\r\n\r\n\t# find next first of month if the begin_date isn't the first of the month\r\n\tif begin_day != 1\r\n\t\tyear += 1 if (month == 12)\r\n\t\tmonth = (month % 12) + 1\r\n\tend\r\n\r\n\tmonth_days = {\r\n\t\t1 => 31,\r\n\t\t2 => 28,\r\n\t\t3 => 31,\r\n\t\t4 => 30,\r\n\t\t5 => 31,\r\n\t\t6 => 30,\r\n\t\t7 => 31,\r\n\t\t8 => 31,\r\n\t\t9 => 30,\r\n\t\t10 => 31,\r\n\t\t11 => 30,\r\n\t\t12 => 31\r\n\t\t}\r\n\r\n\t# since Jan 1 1900 was a monday and 1900 is not a leap year,\r\n\t# Jan 1 1901 should be 366 days from Sun, Dec 31 1899.\r\n\t# But I am using a helper method to allow this method to work for any input dates\r\n\tdays_from_sunday = find_days_from_sunday(year, month, 1)\r\n\tsunday_count = 0\r\n\r\n\tuntil (year == end_year && month > end_month) || (year > end_year)\r\n\t\t# increment count if the number of days from Sun, 12/31/1899 is divisible by 7\r\n\t\tsunday_count += 1 if (days_from_sunday % 7 == 0)\r\n\r\n\t\t# go to first day of next month\r\n\t\tdays_from_sunday += month_days[month]\r\n\t\t# add 1 for leap days\r\n\t\tdays_from_sunday += 1 if (month == 2) && (year % 4 == 0) && (year % 100 != 0)\r\n\r\n\t\t# increment date\r\n\t\tyear += 1 if month == 12\r\n\t\tmonth = (month % 12) + 1\r\n\tend\r\n\r\n\tsunday_count\r\nend",
"def first_sun?(days, year)\n\t(days % 7 == 0 && year > 1900) ? 1 : 0\n\tend",
"def fridays_in_year(year)\n current_week = 1\n current_day = 5\n current_date = DateTime.commercial(year, current_week, current_day)\n fridays_per_month = Array.new(12,0)\n while current_date.year == year\n fridays_per_month[current_date.month - 1] += 1\n current_date += 7\n end\n fridays_per_month\nend",
"def days_in_lunar_date(y)\n sum = 348\n i = 0x8000\n while i > 0x8\n if ((@@lunar_info[y - 1900] & i) != 0)\n sum += 1\n end\n i >>= 1\n end\n\n sum + leap_days(y)\n end",
"def days_in_year(year)\n ::Montrose::Utils.days_in_month(2, year) + 337\n end",
"def day_of_year\n count = @t_day\n @@days_in_months.each_index do |key|\n break if key >= @t_month\n val = @@days_in_months[key]\n \n if key == 2 and Datet.gregorian_leap?(@t_year)\n count += 29\n else\n count += val.to_i\n end\n end\n \n return count\n end",
"def days_in_year(year)\n Time.days_in_month(2, year) + 337\n end",
"def days_in_year(year = current.year)\n days_in_month(2, year) + 337\n end",
"def count_sundays_in_twentieth_century()\r\n\tstart_date = Date.new(1901, 1, 1)\r\n\tend_date = Date.new(2000, 12, 31)\r\n\r\n\tselector = (start_date..end_date).select{ |check| check.sunday? && check.day == 1 }\r\n\treturn selector.size\r\nend",
"def solve( start = Date.new( 1901, 1, 1 ), stop = Date.new( 2000, 12, 31 ) )\n total = 0\n \n # Move to the first Sunday in the range, if not there already.\n start += (7 - start.wday) if !start.sunday?\n\n # Move forward a week at a time, counting the first-of-months we see.\n while start <= stop\n total += 1 if 1 == start.day\n start += 7\n end\n\n total\n end",
"def day_of_programmer(year)\n\n days = 215 # total number of days for 7 months (jan - aug except feb).\n # Feb days will be vary. 256th day of the year comes in september\n if year <= 1917 # according to Julian calender\n if (year % 4) == 0\n feb_days = 29\n else\n feb_days = 28\n end\n elsif year == 1918\n feb_days = 15\n else # according to Gregorian\n if (year % 400 == 0) || ((year % 4 == 0) && (year % 100 != 0))\n feb_days = 29\n else\n feb_days = 28\n end\n end\n\n total_days = 256 - (feb_days + days) # 8 months days\n print \"#{total_days}.09.#{year}\"\n\nend",
"def unlucky_days(year)\r\n (1..12).count { |month| Time.new(year, month, 13).friday? }\r\n end",
"def friday_13th(year)\n days = %w(Sunday Monday Tuesday Wednesday Thursday Friday Saturday)\n days_in_month = {'January' => 31, 'February' => 28, 'March' => 31, 'April' => 30, \n 'May' => 31, 'June' => 30, 'July' => 31, 'August' => 31, \n 'September' => 30, 'October' => 31, 'November' => 30, 'December' => 31}\n years = (1753...year).to_a\n total_days = years.map do |year|\n if leap_year?(year)\n 366\n else\n 365\n end\n end\n day = total_days.reduce(:+) % 7\n\n jan_1st_of_year = day + 1\n\n days_in_month['February'] = 29 if leap_year?(year)\n first_of_month = [jan_1st_of_year]\n\n carry_over = jan_1st_of_year\n\n days_in_month.each do |month, days|\n next if month == 'December'\n first_of_month << (days + first_of_month[-1]) % 7\n end\n first_of_month.map! do |day|\n days[day]\n end\n number_of_friday_13ths = first_of_month.select do |day|\n day == 'Sunday'\n end\n number_of_friday_13ths.count\nend",
"def test_01d_number_of_days_in_a_weird_leap_year\n cal = IndividualMonth.new(2100, 2)\n assert_equal(28, cal.number_days_in_a_month)\n end",
"def weeks_in_year\n return (self-(self.yday-1)).wday == 6 && self.leap? ? 54 : 53\n end",
"def friday_13th(year)\n date = Date.new(year)\n unlucky_days = 0\n 365.times do\n date = date + 1\n if date.friday? == true && date.mday == 13\n unlucky_days += 1\n end\n end\n unlucky_days\nend",
"def daysInYear\n if leapYear?\n return 366\n else\n return 365\n end\n end",
"def five_fridays(year)\n fridays = Hash.new(0)\n friday = Date.new(year)\n loop do\n break if friday.friday?\n\n friday += 1\n end\n\n while friday.year == year\n fridays[friday.month] += 1\n\n friday += 7\n end\n fridays.values.select { |month| month == 5 }.size\nend",
"def dayOfWeek\n days = 0;\n tempYear = MIN_YEAR\n while tempYear < @year\n days += SimpleDate.daysInYear(tempYear).to_i\n tempYear+=1\n end\n\n days = days + ordinalDate\n #puts \"days #{days}\"\n days = days % 7\n\n end",
"def friday_13th(year)\n\n first_of_month = Date.new(year.to_i, 1, 1)\n\n # If January starts on Sunday, the year will have 3 Friday 13ths\n return 3 if first_of_month.sunday?\n\n bad_fridays = 0\n \n 11.times do \n first_of_month = first_of_month.next_month\n bad_fridays += 1 if first_of_month.sunday?\n end\n bad_fridays\nend",
"def test_01c_number_of_days_in_a_weird_leap_year\n cal = IndividualMonth.new(2000, 2)\n assert_equal(29, cal.number_days_in_a_month)\n end",
"def friday_13th(year)\n# Input integer (year)\n# Output integer (count of friday 13ths)\n# create a date obj on jan 13, year\n# step through months, iterate a counter when month 13th is friday\n# return count\n\n count = 0\n month = 1\n date = Date.new(year, month, 13)\n \n loop do\n count += 1 if Date.new(year, month, 13).friday?\n month += 1\n break if month > 12\n end\n\n count\nend",
"def leap_days(y)\n if (leap_month(y) != 0)\n if ((@@lunar_info[y - 1900] & 0x10000) != 0)\n return 30\n else\n return 29\n end\n else\n return 0\n end\n end",
"def nwrug_meet_for year, month\n beginning_of_month = Date.civil(year, month, 1)\n nwrug = beginning_of_month + (18 - beginning_of_month.wday)\n nwrug += 7 if beginning_of_month.wday > 4\n\n # Make sure we skip to the next month if we've gone past this month's meet\n if nwrug < Date.today\n if month == 12\n month = 1\n year += 1\n else\n month += 1\n end\n nwrug = nwrug_meet_for year, month\n end\n\n nwrug\nend",
"def friday_13th(year)\n month = 1\n count = 0\n loop do\n count += 1 if Date.new(year, month, 13).friday?\n break if month == 12\n month += 1\n end\n count\nend",
"def friday_13th(year)\n thirteenth = Date.new(year, 1, 13)\n count = 0\n 12.times do |month|\n count += 1 if thirteenth.friday?\n thirteenth = thirteenth.next_month\n end\n count\nend",
"def happy_birth_day\n\tdays = []\n\tmonths = []\n\tyears = []\n\t31.times do |d|\n\t\tdays << d\n\t\tdays.delete(0)\n\tend\n\t12.times do |m|\n\t\tmonths << m\n\t\tmonths.delete(0)\n\tend\n\t2019.times do |y|\n\t\tyears << y\n\t\tyears.delete(0)\n\tend\n\tif months.sample == 2\n\t\tdays.delete(31)\n\t\tdays.delete(30)\n\t\tdays.delete(29)\n\t\treturn \"#{months.sample}/#{days.sample}/#{years.sample}\"\n\telsif months.sample == 2 && years.sample % 100 == 0 && years.sample % 400 == 0\n\t\tdays.delete(31)\n\t\tdays.delete(30)\n\t\treturn \"#{months.sample}/#{days.sample}/#{years.sample}\"\n\telsif months.sample == 2 && years.sample % 4 == 0 && years.sample % 100 != 0\n\t\tdays.delete(31)\n\t\tdays.delete(30)\n\t\treturn \"#{months.sample}/#{days.sample}/#{years.sample}\"\n\telsif months.sample == 4 || months.sample == 6 || months.sample == 9 || months.sample == 11\n\t\tdays.delete(31)\n\t\treturn \"#{months.sample}/#{days.sample}/#{years.sample}\"\n\telse\n\t\treturn \"#{months.sample}/#{days.sample}/#{years.sample}\"\n\tend\nend",
"def friday_13th(year)\n count_of_friday_13th = 0\n 1.upto(12) do |month|\n t = Time.local(year, month, 13)\n count_of_friday_13th += 1 if t.friday?\n end\n count_of_friday_13th\nend",
"def count_sundays(first, last)\r\n (first..last).select { |n| n.sunday? && n.mday == 1 }.size\r\nend",
"def leapyear(n)\n start = (n % 100 != 0 && n % 4 == 0) || (n % 100 == 0 && n % 400 == 0) ? n : n + (4 - (n % 4))\n (0...100).step(4).each do |e|\n year = start + e\n if year % 100 != 0\n puts year\n elsif year % 400 == 0\n puts year\n end\n end\nend",
"def count_leap_years(current, future)\n common = 0\n leap = 0\n while current <= future do\n if current % 4 != 0\n common += 1\n elsif current % 100 == 0 and current % 400 != 0\n common += 1\n else\n leap += 1\n end\n current += 1\n end\n leap\n end",
"def get_num_feb_days_cur_yr(yr)\n\tif (0 == yr.to_i.modulo($leap_num_yr))\n\t\treturn $num_days_29feb\n\telse\n\t\treturn $num_days_28feb\n\tend\nend",
"def five_fridays(year)\n num_days = {\n 1=>31, 2=>28, 3=>31, 4=>30, 5=>31, 6=>30,\n 7=>31, 8=>31, 9=>30, 10=>31, 11=>30, 12=>31\n }\n\n five_fridays = 0\n num_days[2] = 29 if Date.new(year).leap?\n\n 1.upto(12) do |month|\n num_fridays = 0\n 1.upto(num_days[month]) do |day|\n date = Date.new(year, month, day)\n num_fridays += 1 if date.friday?\n end\n five_fridays += 1 if num_fridays >= 5\n end\n\n five_fridays\nend",
"def your_birthday_is_on_a_friday_in_the_year(birthday)\n while birthday.friday? == false\n birthday += (60 * 60 * 24 * 365)\n end\n birthday.year\n # rspec was after a year, but the question was asking for a day\n # not the clearest of questions. Should state \"someones\" bday, not\n # the users\nend",
"def real_study_years\n if finished?\n end_date = finished_on.to_time\n elsif absolved?\n end_date = disert_theme.defense_passed_on.to_time\n else\n end_date = Time.now\n end\n return (end_date - enrolled_on.to_time).div(1.year) + 1\n end",
"def day_number_of_the_year day, month, hash \n if month > 1\n for i in 1...month\n day += hash[i]\n end\n end\n day\nend",
"def friday_13th(year)\n require \"Date\"\n num_of_fri_13ths = 0\n months = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]\n months.each {|month| num_of_fri_13ths += 1 if Date.new(year, month, 13).friday?}\n num_of_fri_13ths\nend",
"def five_fridays(year)\n date = Date.new(year)\n month = 1\n\n month_count = 0\n friday_count = 1\n\n date = date.next_day until date.friday?\n\n while date.year == year\n 7.times { date = date.next_day }\n if date.month == month\n friday_count += 1\n else\n month_count += 1 if friday_count == 5\n friday_count = 1\n month += 1\n end\n end\n month_count\nend",
"def leap_year?(n)\n if n%4==0 && n%100!=0\n return true\n elsif n%400==0\n return true\n else\n return false\n end\nend",
"def unusual_day_4(num)\n if one_30_last(num)\n calendar_date(num, 1)\n elsif one_30_not_last(num) || two_30_one_31_last(num)\n calendar_date(num, 2)\n elsif two_30_one_31_not_last(num) || two_30_two_31\n calendar_date(num, 3)\n end\nend",
"def test_01b_number_of_days_in_a_normal_nonleap_year \n cal = IndividualMonth.new(2013, 2)\n assert_equal(28, cal.number_days_in_a_month)\n end",
"def compute_actual_days_worked(year, start_date, end_date)\n working_days_in_year = Float(52*5)\n\n if Date.new(year, 1, 1) < start_date\n start_date_to_consider = start_date\n else\n start_date_to_consider = Date.new(year, 1, 1)\n end\n\n if Date.new(year, 1, 1).end_of_year < end_date\n end_date_to_consider = Date.new(year, 1, 1).end_of_year\n else\n end_date_to_consider = end_date\n end\n\n # we have to add one to include last day of work. We multiply by working_days_in_year/365 to remove weekends.\n ((end_date_to_consider - start_date_to_consider + 1).to_i * (working_days_in_year/365)).to_i #actual days worked in 'year'\n end",
"def get_normalized_day dd\n date = Date.strptime(dd)\n if date.year == YEAR_ZERO\n return date.yday - DAY_ZERO\n elsif date.year > YEAR_ZERO\n # TODO - This is broken...\n return (((date.year - 1) - YEAR_ZERO) * ((Date.leap? date.year) ? 366 : 365)) + (365 - DAY_ZERO) + date.yday\n end\n raise Exception.new \"Something is wrong with the year for this entry\"\n end",
"def friday_13th(year)\n count = 0\n 1.upto(12) do |month|\n count += 1 if Time.new(year, month, 13).friday?\n end\n count\nend",
"def leap_year_1752?(year)\n if year % 100 == 0 && year % 400 == 0\n true\n elsif year % 4 == 0 && !(year % 100 == 0)\n true\n else\n false\n end\nend",
"def your_birthday_is_on_a_friday_in_the_year(birthday)\n # Key: tells you the YEAR where birthday will be on a Fri\n # each year = moves up 2 days\n loop {\n if birthday.friday? == true\n return birthday.year\n end\n # key -> don't need to account for day of week change in addition, only 1 year onwards - the .friday? will work out what day of the week it is\n birthday = birthday + (365*24*60*60) }\nend",
"def leap_year?(year)\n divisible?(year, 400) || divisible?(year, 4) && !divisible?(year, 100)\nend",
"def advent_days(year:)\n min_day .. max_day(year: year)\n end",
"def new_years_day_for(year)\n nyd = Date.new(year,1,1)\n if nyd.saturday?\n Date.new(year,1,3)\n elsif nyd.sunday?\n Date.new(year,1,2)\n else\n nyd\n end\n end",
"def dayOfProgrammer(year)\n leapYearJulian = -> (y){y % 4 == 0}\n leapYearGregorian = -> (y){y % 400 == 0 || (y % 4 == 0 && y % 100 != 0)}\n isLeap = -> (y){ y > 1917 ? leapYearGregorian.(y) : leapYearJulian.(y) }\n\n corrigeMes = -> (m){m > 7 ? m+1 : m}\n calcFev = -> (y){ y != 1918 ? ( isLeap.(y) ? 29 : 28 ) : 15 }\n calcMes = -> (m){corrigeMes.(m) % 2 == 0 ? 30 : 31}\n\n calendar = (1..12).each.map{|x| x == 2 ? calcFev.(year) : calcMes.(x) }\n \n mes = calendar.each_with_index.select{|v, i| i > 0 && calendar[0,i].reduce(:+) >= 256}.first[1] - 1\n dia = 256 - calendar[0,mes].reduce(:+)\n \n return \"%02d.%02d.%02d\" % [dia, mes+1, year]\nend",
"def sundays_first_of_month(start_date,end_date)\n start_date_normalized=normalize(start_date)\n end_date_normalized=normalize(end_date)\n\n count=0\n \n (start_date_normalized[1]..12).each do |month|\n if Time.new(start_date_normalized[0],month,start_date_normalized[2]).strftime('%A')=='Sunday'\n count += 1\n end\n end\n\n while Time.new(start_date_normalized[0],start_date_normalized[1],start_date_normalized[2])<Time.new(end_date_normalized[0],end_date_normalized[1],end_date_normalized[2])\n (1..12).each do |month|\n if Time.new(start_date_normalized[0],month,start_date_normalized[2]).strftime('%A')=='Sunday'\n count += 1\n end\n end\n start_date_normalized[2]+=1\n end\n count\nend",
"def hash_days_number year\n hash = { 1 => 31, 2 => 28, 3 => 31, 4 => 30, 5 => 31, 6 => 30,\n 7 => 31, 8 => 31, 9 => 30, 10 => 31, 11 => 30, 12 => 31 }\n\n hash[2] = 29 if leap? year\n hash\nend",
"def is_sunday?(days_since_1900)\n # Monday was 1st, so Sunday is when 7 divides evenly into number of days\n # since the known Monday\n (days_since_1900 % 7 == 0)\nend",
"def your_birthday_is_on_a_friday_in_the_year(birthday)\n month = birthday.strftime(\"%m\").to_i\n day = birthday.strftime(\"%d\").to_i\n year = birthday.strftime(\"%Y\").to_i\n loop do\n year = year += 1\n time = Time.new(year, month, day)\n break if time.strftime(\"%u\") == \"5\"\n end\n year\nend",
"def leap_year?(year)\n if divisible?(year, 400)\n true\n elsif divisible?(year, 100)\n false\n else\n divisible?(year, 4)\n end\nend",
"def friday_13th(year)\n (1..12).count { |month| Date.new(year, month, 13).friday? }\nend",
"def leap_year?(num)\n if num%4 == 0 && num%100 !=0\n true\n elsif num%400 == 0\n true\n elsif num%4 == 0 && num%100 == 0 && num%400 != 0\n false\n elsif num%4 != 0\n false\n end\nend",
"def friday_13th?(year)\n fridays = 0\n 1.upto(12) do |month|\n fridays += 1 if Time.new(year, month, 13).friday?\n end\n fridays\nend",
"def calc_days_in_month month, year\n months_with_30 = [4, 6, 9, 11]\n months_with_31 = [1, 3, 5, 7, 8, 10, 12]\n if months_with_30.include? month\n 30\n elsif months_with_31.include? month\n 31\n elsif (year % 4 == 0) && !(year % 100 == 0) || (year % 400 == 0)\n 29\n else\n 28\n end\n end",
"def day_of_year\n (seconds_since_start_of_year / D_SECS).to_i + 1\n end",
"def minutes_in_decade(start_year = 1900)\n days = 0\n start_year.step.take(10).each do |year|\n days += 365\n days += 1 if year % 4 == 0 && (year % 100 != 0 || year % 400 == 0)\n end\n days * 24 * 60 * 60\nend",
"def century(year)\r\n cent = (year.to_f / 100).ceil.to_s\r\n\r\n if cent.end_with?(\"1\") && !(cent.end_with?(\"11\"))\r\n cent << \"st\"\r\n elsif cent.end_with?(\"2\") && !(cent.end_with?(\"12\"))\r\n cent << \"nd\"\r\n elsif cent.end_with?(\"3\") && !(cent.end_with?(\"13\"))\r\n cent << \"rd\"\r\n else\r\n cent << \"th\"\r\n end\r\nend",
"def year_rome_founded\n bce(753)\n end",
"def leap_day?(input) = day_of_year(input) > 365",
"def count_of_days_in(month)\n 28 + (month + (month / 8)) % 2 + 2 % month + 2 * (1 / month)\nend",
"def faith_years\n (Time.now.year - 1991).ordinalize\n end",
"def years_for_date_of_work(repo_d)\n start, start_qualifier, finish, finish_qualifier = repo_d.start, repo_d.start_qualifier, repo_d.finish, repo_d.finish_qualifier\n\n if start.nil? || start.blank?\n return []\n end\n\n case start_qualifier\n when \"Undated\"\n # We're ignoring finish here, if start is undated, it's undated buddy.\n []\n when \"decade\"\n # We're ignoring finish_date in this case\n first_three = start.strip.slice(0..2)\n return [] unless first_three =~ /\\A\\d+\\Z/ # not a good date\n\n return ((first_three + \"0\").to_i .. (first_three + \"9\").to_i).to_a\n when \"century\"\n # We're ignoring finish_date in this case\n first_two = start.strip.slice(0..1)\n return [] unless first_two =~ /\\A\\d+\\Z/ # not a good date\n\n return ((first_two + \"00\").to_i .. (first_two + \"99\").to_i).to_a\n when /\\A\\s*(\\d\\d\\d\\d)\\s*-\\s*(\\d\\d\\d\\d)/\n # we have a date range in start date, just use that ignore finish date\n # Catalogers aren't _supposed_ to enter this, but the 'hint' is\n # confusing and I think some may have.\n return ($1.to_i .. $2.to_i).to_a\n end\n\n # For all other types of start date (circa, before, after, as well as blank)\n # we're just going to index it as the date we've got, if we've got one.\n start_year = start.slice(0..3)\n return [] unless start_year =~ /\\A\\d+\\Z/ # not a good date\n start_year = start_year.to_i\n\n finish_year = (finish || \"\").slice(0..3).to_i # will be 0 if was blank or non-numeric\n\n # If finish year is before start year, or empty (in which case it'll be 0),\n # just use start date, best we can do.\n if finish_year <= start_year\n return [start_year]\n else\n # we have both years, ignore 'before' or 'circa' qualifiers\n # on finish, don't know what we'd do with those, just treat it\n # like a year.\n return (start_year..finish_year).to_a\n end\n end",
"def account_for_leap_year(date)\n if leap_year_date?(dob) and !leap_year_date?(date) \n date += 1\n end\n date\n end",
"def leap_year?(x)\n if x.to_i % 4 == 0\n if x.to_i % 100 == 0\n if x.to_i % 400 == 0\n return true\n else\n return false\n end\n else\n return true\n end\n else\n return false\n end\nend",
"def jul_leap_year? year\n if year < 1752\n return year % 4 == 0 ? true : false\n else\n return year % 4 == 0 && year % 100 != 0 || year % 400 == 0 ? true : false\n end\nend",
"def get_days(year,month)\r\n # the number of days within a month is determined by the year\r\n case month\r\n when \"January\", \"March\", \"May\", \"July\", \"August\", \"October\", \"December\"\r\n days = 31\r\n when \"April\", \"June\", \"September\", \"November\"\r\n days = 30\r\n else\r\n if year.to_i % 400 == 0 # feb has 28 days when a year divisible by 400\r\n days = 28\r\n elsif year.to_i % 4 == 0\r\n days = 29\r\n else\r\n days = 28\r\n end\r\n end # end statement for case month when ...\r\n return days\r\n end",
"def leap_year?(x)\n if x % 4 === 0 or x % 100 == 0\n if x % 100 === 0 && x % 400 != 0\n false\n else\n true\n end\n else\n false\n end\nend",
"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 what_century(year)\n year % 100 == 0 ? year / 100 : year / 100 + 1\nend",
"def leap_year?(year)\r\n if year < 1752 && year % 4 == 0\r\n true\r\n elsif year % 400 == 0\r\n true\r\n elsif year % 100 == 0\r\n false\r\n else\r\n year % 4 == 0\r\n end\r\nend",
"def first_day\n m = set_month\n q = 1\n y = set_year\n h = (q + (((m+1) * 26)/10) + y + (y/4) + (6 * (y/100)) + (y/400)) % 7\n end",
"def leap_year?(year)\n if year <= 1752\n year % 4 == 0\n else\n (year % 4 == 0 && year % 100 != 0) || year % 400 == 0\n end\nend",
"def friday_13th_2(yr)\n 1.upto(12).count { |mon| Time.new(yr, mon, 13).friday? }\nend",
"def days_in_year\n 365.25\nend",
"def day_in_year\n day = self.day\n \n 1.upto(self.month - 1) do |month_no|\n day += Datet.days_in_month(self.year, month_no)\n end\n \n return day\n end",
"def test_16a_zellers_congruence\n cal = IndividualMonth.new(2012, 2)\n assert_equal(4, cal.number_days_in_1st_week)\n end",
"def leap_year_further?(year)\n if year % 4 == 0\n if year % 100 == 0\n if year % 400 == 0\n true\n else\n false\n end\n else\n if year % 4 == 0\n true\n else\n false\n end\n end\n else\n false\n end\nend",
"def friday_13th(yr)\n total = 0\n 1.upto(12) { |mon| total += 1 if Time.new(yr, mon, 13).friday? }\n total\nend",
"def leap_year?(yr1)\r\n if yr1 % 4 > 0\r\n false\r\n elsif yr1 % 100 == 0\r\n if yr1 % 400 == 0\r\n true\r\n else\r\n false\r\n end\r\n elsif yr1 % 4 == 0\r\n true\r\n end\r\nend",
"def unusual_day_2(num)\n if page.has_no_text?('29', count: 2)\n february(num)\n else\n not_february(num)\n end\nend",
"def get_single_digit_century(dates)\n dates.each do |f_date|\n matches = f_date.scan(/\\d{1}th/)\n next if matches.empty?\n\n if matches.length == 1\n @pub_year = (matches.first[0, 2].to_i - 1).to_s + '--'\n return @pub_year\n else\n # when there are multiple matches, check for ones with CE after them\n matches.each do |match|\n pos = f_date.index(Regexp.new(match + '...CE'))\n pos = pos ? pos.to_i : f_date.index(Regexp.new(match + ' century CE'))\n pos = pos ? pos.to_i : 0\n if f_date.include?(match + ' CE') || pos > 0\n @pub_year = (match[0, 1].to_i - 1).to_s + '--'\n return @pub_year\n end\n end\n end\n end\n nil\n end",
"def five_friday(year)\n month_count = 0\n 1.upto(12) do |month|\n fridays = Date.new(year, month, 1).step(Date.new(year, month, -1)).select { |day| day.friday? }.size\n month_count += 1 if fridays == 5\n end\n month_count\nend",
"def years_alive(birthday)\n #days in the months array\n days_in_months=[31,28,31,30,31,30,31,31,30,31,30,31]\n \n #current date \n the_time=Time.now.to_s.split(\" \")\n date=the_time[0].split(\"-\")\n \n #save each part of the date as a separate variable\n year=date[0].to_f\n month=date[1].to_f\n day=date[2].to_f\n \n #person's date\n user_date=birthday.split(\"/\")\n user_year=user_date[2].to_f\n user_month=user_date[0].to_f\n user_day=user_date[1].to_f\n\n #additional days to years_age(years_age is expressed in days)\n i=0 #counter\n extra_days=0\n days_in_months.each do |days|\n i+=1\n if i < month\n extra_days+=days\n end\n end\n \n #people who haven't had their birthday yet this year\n if user_month > month || (user_month==month && user_day > day)\n years_age = (year - user_year - 1)*365\n k=0\n more_days=0\n days_in_months.each do |days|\n k+=1\n if k > user_month\n more_days+=days\n end\n end\n days_age = extra_days+day+more_days+days_in_months[user_month-1]-user_day\n #people who have had their birthday this year\n else \n years_age=(year - user_year)*365\n j=0\n less_days=0\n subtract_days=days_in_months.each do |month|\n j+=1\n if user_month > j \n less_days+=month\n end\n end\n days_age=extra_days+day-less_days-user_day\n puts days_age\n end\n #factoring in leap years\n leap_years=((years_age/4)/365).floor\n #total of everything\n days_age+years_age+leap_years\nend",
"def is_leap_year year\n\n (year % 100 == 0 && year % 400 == 0) || \n (year % 100 != 0 && year % 4 == 0)\n\nend",
"def days_in_year\n return Datet.days_in_year(@t_year)\n end",
"def leap_year?(year)\n \n if year < 1752\n year % 4 == 0 \n else \n (year % 4 == 0 && year % 100 != 0) || (year % 400 == 0)\n end\n\nend",
"def leap_year?(year)\n #PSEUDOCODE\n #every four years is a leap year\n #2012,2016,2020 are leap years\n #check if input is divisble 4\n #2000 is a leap year because it is divisible by 400\n #1900 is NOT a leap year because its divisble by 100 but not 400\n\n year % 4 == 0 && (year % 100 !=0 || year % 400 ==0)\n\nend",
"def leap_year?(years)\r\n\tleap = years % 4\r\n\tleaps = years % 100\r\n\tleaped = years % 400\r\n\tif leap == 0 && leaps == 0 && leaped != 0\r\n\t\treturn false\r\n\telsif leap == 0 && leaps != 0\r\n\t\treturn true\r\n\telsif leap == 0 && leaps == 0 && leaped == 0\r\n\t\treturn true\r\n\telse\r\n\t\treturn false\r\n\tend\r\nend",
"def leap_year? year\n year % 4 == 0 && year % 100 != 0 || year % 400 == 0\nend",
"def leap_year?(year)\n if year < 1752\n if year % 4 == 0 then true\n else false\n end\n elsif year % 400 == 0\n true\n elsif year % 4 == 0 && year % 100 == 0 \n false\n elsif year % 4 == 0\n true\n else false\n end\nend",
"def leap_year?(year)\n if year%400==0\n return true\n elsif year%4==0 && year%100!=0\n return true\n elsif year%4==0 && year%100==0 && year%400!=0\n return false\n else return false\n end\nend"
] | [
"0.7031975",
"0.69888425",
"0.6858229",
"0.6805469",
"0.68043214",
"0.6795406",
"0.67244285",
"0.6660073",
"0.6636704",
"0.6620901",
"0.65219444",
"0.64850533",
"0.64824045",
"0.64739656",
"0.6443859",
"0.6441277",
"0.6403524",
"0.63678235",
"0.63574046",
"0.6337407",
"0.6311948",
"0.6310029",
"0.63055784",
"0.6295189",
"0.6291571",
"0.6288003",
"0.6274902",
"0.6256772",
"0.6250807",
"0.6219692",
"0.61980027",
"0.6191583",
"0.6190467",
"0.61788875",
"0.6169334",
"0.6161187",
"0.6150377",
"0.6140981",
"0.61229885",
"0.6121829",
"0.6069058",
"0.6061089",
"0.60602903",
"0.6027144",
"0.6002224",
"0.59835017",
"0.59834874",
"0.5980705",
"0.597161",
"0.59711134",
"0.59679544",
"0.59550697",
"0.5949108",
"0.59378755",
"0.5930387",
"0.5917614",
"0.5903557",
"0.5894678",
"0.58704746",
"0.5865293",
"0.5863161",
"0.5858243",
"0.58548653",
"0.58529484",
"0.5852554",
"0.58490074",
"0.58297265",
"0.5819696",
"0.5819471",
"0.5817638",
"0.5812525",
"0.5793715",
"0.5788815",
"0.5787024",
"0.57837725",
"0.5779471",
"0.577632",
"0.57759506",
"0.57713336",
"0.5764896",
"0.57636905",
"0.57610035",
"0.5757996",
"0.57554984",
"0.5749487",
"0.5748426",
"0.5743093",
"0.5737539",
"0.5733437",
"0.5726335",
"0.57234275",
"0.5722379",
"0.57148474",
"0.5710653",
"0.5709937",
"0.5707488",
"0.5706251",
"0.5705801",
"0.57041234",
"0.57022625"
] | 0.652602 | 10 |
origin_price should be input as rounded up integer dollar val | def initialize(make, model, make_year, origin_price)
@make = make
@model = model
@make_year = make_year
@origin_price = origin_price
@current_value = current_value
@dealer_price = current_value + dealer_markup
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def price_in_cents\n Integer(price*100 + 0.5)\n end",
"def price_adjustment \n price_adjustment_fixed / 100.0 \n end",
"def price_in_cents\n\t\tInteger(price * 100 + 0.5)\n\tend",
"def price_in_cents\n\t\tInteger(price * 100 + 0.50)\n\tend",
"def price_in_cents\n\t\tInteger(@price*100 + 0.5)\n\tend",
"def convert_price_to_dollar\n \tself.price = self.price.to_f/100\n end",
"def price_in_cents\n Integer( price * 100 + 0.5 ) # +0.5 Because floating-point numbers don’t always have an exact internal representation.\n end",
"def base_price\n price / multiplier\n end",
"def price\n BigDecimal('5.0')\n end",
"def price\n BigDecimal('3.0')\n end",
"def price_in_dollars\n price_in_cents/100.0 unless price_in_cents.nil?\n end",
"def check_price\n self.price = self.price.to_f\n end",
"def cost_in_dollars\n self.cost / 100.to_f\n end",
"def price\n (price_in_cents / 100.0) unless price_in_cents.nil?\n end",
"def round_to_nearest_cash_value; end",
"def promo_price\n price*0.75\n end",
"def adjusted_price(supplier_code, markup, cost_price)\n # make sure return value is sane and in Rands\n def sane(value)\n return 0 if value < 0\n value / 100.0\n end\n \n # cost price is in cents which helps with calculations\n price = cost_price.to_i * (1 + markup) \n return sane(price - 200) if @trouble_suppliers.include? supplier_code.to_i \n return sane(cost_price.to_i * (1.1 + markup)).ceil if @premium_suppliers.include? supplier_code.to_i\n sane(price)\nend",
"def cents; end",
"def formatted_price\n price / 100.0\n end",
"def price_in_cents= (price)\n @price = price / 100.0\n end",
"def starting_price\r\n Money.new(starting_price_cents, starting_price_currency).format(with_currency: true)\r\n end",
"def price_in_cents\n read_attribute(:price) \n end",
"def round_dollar_amt ( dollar_amt )\n dollar_amt.slice!(/\\..*$/)\n dollar_amt = Integer(dollar_amt)\n end",
"def rent_price(price)\n format(\"%.0f\", (price * 7.0) / 100)\n end",
"def full_price\n price + tax_evaluation\n end",
"def get_base_price(base_price)\n value = base_price.gsub('$', '').gsub('.', '').gsub(',', '')\n price_nil?(value)\n non_digits_price?(value)\n base_price.gsub('$', '').gsub(',', '').to_f\n\n end",
"def price_in_sterling \n\t\tprice * 1.5\n\tend",
"def tax\n price.to_f * 0.09\n end",
"def currency_conversion(price = 0.0)\n exchange = 6.98\n price * exchange\nend",
"def pretty_price\n \"$#{price_in_cents / 100.0}\"\n end",
"def cigaret_price\n 0.30\n end",
"def conv_price_single\n (price_single || 0).to_r.round(SK::Calc.precision)\n end",
"def clean_price(input)\n input[0] == \"$\" ? input[1..-1].to_f : input.to_f\n end",
"def price\n base_price * discount_factor\n end",
"def my_price\n envisage_to_my_price\n end",
"def mid_price\n price\n end",
"def rounded_tax(raw_tax)\n (raw_tax * 20).ceil.round / 20.0\n end",
"def price=(dollars)\n self.price_in_cents = dollars.to_f * 100\n end",
"def prepare_amount amount\n BigDecimal.new(amount)/100\n end",
"def price\n (original_price * (1 - discount_rate)).to_i\n end",
"def gross\n \"%.2f\" % params['amount'].to_f\n end",
"def price\n return base_price - quantity_discount + shipping\nend",
"def euros price\n price ? number_to_currency(price , :precision => 2 , :unit => \"€\") : 0.0\n end",
"def price_in_usd\n case @currency\n when :inr\n @price_per_share.to_i * 50\n when :gbp\n @price_per_share.to_i * 2\n else\n @price_per_share.to_i\n end\n end",
"def price\n MoneyUtils.format(self.price_basis)\n end",
"def price_with_vat\n # si el valor es nil, devolvera igualmente nil:\n return nil if price.nil?\n # de lo contrario, se aplica formula de IVA:\n price * (100 + BOOK_VAT) / 100\n end",
"def calcTaxes price\r\n taxrate = 0.95\r\n return taxrate * price\r\nend",
"def tax\n \"#{price}\".to_i * 0.09 \n end",
"def calcuate_tax\n @price * 0.12\n end",
"def apply_tax(price, tax)\n return (price * tax / BigDecimal.new(5)).ceil / BigDecimal.new(20) #rounding up to nearest 0.05\n end",
"def price # getter for rent in cents\n\t\tread_attribute(:price_in_cents)\n\tend",
"def us_dollar(cents); end",
"def price\n ConversionTool.convert_to_currency(self.unit_price)\n end",
"def price_in_cents\n (cart.total_price*100).round\n end",
"def price\n price = read_attribute(:price)\n if User.current and User.current.currency\n price.to_d * User.current.currency.exchange_rate.to_d\n else\n price.to_d\n end\n end",
"def price\n b = read_attribute(:price)\n b.to_d * User.current.currency.exchange_rate.to_d\n end",
"def price=(value)\n if value.kind_of?(Integer)\n super\n elsif value.kind_of?(String) && !value.include?('.') # Looks like an integer\n super\n else\n raise 'expected price to be an Integer representing the number of cents.'\n end\n end",
"def price(opts = {})\n constituents.price(opts).to_f\n end",
"def extra_price_for(object, base_price = nil)\n base_price ||= base_price_for(object)\n\n case object\n when Conversation\n base_price.div(2, 8) * [0, object.messages.outbound.sum(:segments) - 2].max\n\n else\n BigDecimal.new 0\n end\n end",
"def price_to_integer\n self.price = self.price.to_i\n end",
"def formatted_price\n price_in_dollars = price_in_cents.to_f / 100\n sprintf(\"%.2f\", price_in_dollars) # <= What's all this business?\n end",
"def base_price_for(object)\n case object\n when Conversation\n object.draft? ? BigDecimal.new(0) : base_price_for(object.customer_number)\n\n when PhoneNumber\n base_price_for(object.number.country.alpha2)\n\n when MiniPhoneNumber\n base_price_for(object.country.alpha2)\n\n when Country\n base_price_for(object.alpha2)\n\n else\n return base_price_for(MiniPhoneNumber.new(object)) if Country.plausible_phone_number?(object)\n \n raise SignalCloud::UnpriceableObjectError, object unless prices.include?(object)\n\n BigDecimal.new prices[object], 8\n end\n end",
"def price=(value)\n if value.kind_of?(Integer)\n super\n elsif value.kind_of?(String) && !value.include?('.') # Looks like an integer\n super\n elsif value.blank?\n super\n else\n raise \"expected price to be an Integer representing the number of cents. Got: #{value}\"\n end\n end",
"def price\n 2.50\n end",
"def price\n b = read_attribute(:price)\n user = User.current.blank? ? User.where(id: 0).first : User.current\n b.to_d * user.currency.exchange_rate.to_d\n end",
"def price\n center_location = Geokit::LatLng.new(*ORIGIN)\n address_location = Geokit::LatLng.new(*address.to_location)\n distance = center_location.distance_to(address_location)\n\n return 0 if distance <= Configurable.free_delivery_distance\n\n ((distance - Configurable.free_delivery_distance) * Configurable.price_per_km).round\n end",
"def calculate_sell_price_using_account_pricing_tier cogs\n if cogs.nil?\n nil\n else\n account_pricing_tier = AccountPricingTier.where(:account_id => account, :product => product).first()\n\n if account_pricing_tier.nil?\n # Assume GP of 25% if no pricing tier exists\n sell_price = cogs / (1 - 25.0 / 100)\n else\n pricing_tier = PricingTier.find(account_pricing_tier.pricing_tier_id)\n sell_price = cogs / (1 - pricing_tier.gross_profit / 100)\n end\n sell_price\n end\n end",
"def calculate_sell_price_using_account_pricing_tier cogs\n if cogs.nil?\n nil\n else\n account_pricing_tier = AccountPricingTier.where(:account_id => account, :product => product).first()\n\n if account_pricing_tier.nil?\n # Assume GP of 25% if no pricing tier exists\n sell_price = cogs / (1 - 25.0 / 100)\n else\n pricing_tier = PricingTier.find(account_pricing_tier.pricing_tier_id)\n sell_price = cogs / (1 - pricing_tier.gross_profit / 100)\n end\n sell_price\n end\n end",
"def get_doubled_normalised_price_again(price_as_integer)\n if price_as_integer > 0\n \"€#{price_as_integer * 2}.00\"\n else\n nil\n end\n end",
"def price\n on_sale? ? sale_price : original_price\n end",
"def format_price price\n \"$#{'%.2f' % price}\"\n end",
"def original_price\n order.total_price_with_taxes\n end",
"def new_sale_price \n noi(num_years_to_hold + 1) / cap_rate(num_years_to_hold + 1)\n end",
"def get_doubled_normalised_price_yet_again(price_as_integer)\n # Yes, there are many ways to fix this better - it's just an example :-)\n if price_as_integer >= 0\n \"€#{price_as_integer * 2}.00\"\n else\n \"-€#{price_as_integer.abs * 2}.00\"\n end\n end",
"def converted_price(exr)\n b = read_attribute(:price)\n b.to_d * exr.to_d\n end",
"def converted_price(exr)\n b = read_attribute(:price)\n b.to_d * exr.to_d\n end",
"def update_price(raw_price)\n model.price = raw_price * 1.10 # our markup is 10%\n model.save!\n end",
"def final_price\n price * (100 - discount) / 100\n end",
"def payment_price\n recurring_payments? ? (price / recurring_number) : price\n end",
"def amount_calc\n quantity * price\n end",
"def formatted_price\n price_in_dollars = price_in_cents.to_f / 100\n sprintf(\"%.2f\", price_in_dollars)\n end",
"def original_price\n @price || item.price\n end",
"def tax_amount(amount)\n return ((amount * 8.9)/100).round(2)\nend",
"def cents(origin = Ratio[1,1])\n n = self.to_f\n m = origin.to_f\n Math.log2(n / m) * 1200.0\n end",
"def dealer_markup\n (origin_price*0.08).round\n end",
"def sell_price\r\n price\r\n end",
"def price_in_cents=(cents)\n\t\t@price = cents / 100.0\n\tend",
"def price_in_cents=(cents)\n\t\t@price = cents / 100.0\n\tend",
"def price_string=(val)\n\t\tif val =~ /(\\d+(\\.\\d+)?)/\n\t\t\tself.price_cents = ($1.to_f * 100).to_i # convert to cents\n\t\telse\n\t\t\traise \"Couldn't turn this into a price: #{val.inspect}\"\n\t\tend\n\tend",
"def round_tax(tax)\n\t\t(tax * 20.0).ceil / 20.0\n\tend",
"def price= price\n if User.current and User.current.currency\n converted_price = (price.to_d / User.current.currency.exchange_rate.to_d).to_d\n else\n converted_price = price\n end\n write_attribute(:price, converted_price)\n self.price_with_vat = calculate_price_with_vat\n end",
"def amount\n price\n end",
"def gross_price\n @gross_price = @net_price *(100 +VAT_RATE)/100\n end",
"def price=(price)\n @price = price.to_f\n end",
"def price_of_gold(ounces)\ndollar_value = ounces*1336\nend",
"def buyback_price=(p)\n self.buy_price_cents = (self.string_to_float(p, :locale => self.vendor.region) * 100).round\n end",
"def price\n price_per_day = @car.price_per_day - (@car.price_per_day * get_discount)\n\n amount = days * price_per_day + (@distance * @car.price_per_km)\n amount.to_i\n end",
"def price(price_range)\n set_range_parameter(:price, price_range)\n end",
"def calculate_price(_flavor)\n end",
"def price=(value)\n if value.instance_of?(String)\n cents = MoneyUtils.parse(value)\n else\n begin\n cents = Integer(value)\n rescue\n cents = nil\n end\n end\n if cents\n self.price_basis = cents\n else\n errors.add(:price_basis, \"price can't be empty\")\n end\n end",
"def calculate_price_with_vat\n if @tax and self.price\n if User.current and User.current.currency\n converted_price = (self.price.to_d / User.current.currency.exchange_rate.to_d).to_d\n else\n converted_price = self.price\n end\n price_with_vat = @tax.apply_tax(converted_price)\n return price_with_vat\n else\n nil\n end\n end"
] | [
"0.7081104",
"0.7062171",
"0.7015531",
"0.69937783",
"0.6971159",
"0.69410735",
"0.6865865",
"0.6708257",
"0.6700364",
"0.6696963",
"0.6649046",
"0.6646286",
"0.6624281",
"0.66184884",
"0.6600148",
"0.65886587",
"0.6532084",
"0.6522088",
"0.6519116",
"0.6512718",
"0.6457268",
"0.6454902",
"0.6447381",
"0.64274204",
"0.6424657",
"0.64228237",
"0.64196706",
"0.6410853",
"0.63997537",
"0.6393949",
"0.636668",
"0.63546723",
"0.6349432",
"0.63378435",
"0.6337763",
"0.63350654",
"0.6333897",
"0.6329589",
"0.6327727",
"0.63273746",
"0.63197666",
"0.6316837",
"0.63049203",
"0.629043",
"0.62832767",
"0.62750024",
"0.6267843",
"0.62663424",
"0.62604284",
"0.62578887",
"0.62494457",
"0.62368715",
"0.6233869",
"0.6233614",
"0.6231193",
"0.6228813",
"0.62211716",
"0.6219986",
"0.6211839",
"0.6199918",
"0.61889035",
"0.6187132",
"0.61822426",
"0.6176057",
"0.6162876",
"0.61589754",
"0.61555",
"0.61555",
"0.6146547",
"0.6134177",
"0.6133108",
"0.6112826",
"0.61122686",
"0.61063653",
"0.61061335",
"0.61061335",
"0.6104534",
"0.6099432",
"0.6091489",
"0.60768104",
"0.6076162",
"0.6072508",
"0.6069724",
"0.60632914",
"0.60628414",
"0.60614544",
"0.606043",
"0.606043",
"0.6056893",
"0.60558784",
"0.6051263",
"0.6049416",
"0.60488063",
"0.6047523",
"0.60421383",
"0.6039241",
"0.6029541",
"0.60293835",
"0.6027144",
"0.60268366",
"0.602431"
] | 0.0 | -1 |
markup arbitrarily determined here to be 8% of MSRP (origin price) | def dealer_markup
(origin_price*0.08).round
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def markup_tirerack(price)\n (((price + 12.50) * 1.35) * 1.16) \n end",
"def base_markup_price\n @base_price + (@base_price * Flat_Markup_Rate)\n end",
"def mark_up_amt\n rounder5(self.vehicle.price * 0.082)\n end",
"def calculate_markup()\n markup = @selling_price - @buying_cost\n return markup\n end",
"def markup_percent\n return nil if trade_price.nil? || retail_price.nil? || trade_price == 0\n if tax_category.included_in_retail?\n 100 * (retail_price - trade_price_with_tax) / trade_price_with_tax\n else\n 100 * (retail_price - trade_price) / trade_price\n end\n end",
"def final_price\n base_markup_price + add_markup_person + add_markup_materials\n end",
"def get_markup(code) \n @markups_for_codes.each do |key, value| \n return value/100.00 if key.include?(code.to_i)\n end \n @default_markup/100.00\nend",
"def calculated_price\n msrp\n end",
"def sales_price\n Dowstore.priceMarkup(commodity.price,0,2)\n end",
"def add_markup_materials\n if Material_Markup_Rate[\"#{@material}\"]\n markup = Material_Markup_Rate[\"#{@material}\"]\n else\n markup= 0.00\n end\n base_markup_price * markup\n end",
"def mark_up()\n return @retail_price-@buying_cost\n end",
"def price_in_sterling \n\t\tprice * 1.5\n\tend",
"def rating; \"Д/379 (stub)\"; end",
"def adjusted_price(supplier_code, markup, cost_price)\n # make sure return value is sane and in Rands\n def sane(value)\n return 0 if value < 0\n value / 100.0\n end\n \n # cost price is in cents which helps with calculations\n price = cost_price.to_i * (1 + markup) \n return sane(price - 200) if @trouble_suppliers.include? supplier_code.to_i \n return sane(cost_price.to_i * (1.1 + markup)).ceil if @premium_suppliers.include? supplier_code.to_i\n sane(price)\nend",
"def get_price\n @price = @contents[/(?<=(\"priceLarge\">)).*?(?=<)/]\n if @price == nil\n @price =@contents[/(?<=(\"rentPrice\">)).*?(?=<)/]\n end\n @price\n end",
"def human_price\n #return self.price.to_s + '元' + '(待审)' if self.type_id !='团购价' or self.is_valid.nil?# and self.reviews.sum(:status) < STATUS_LOW\n self.price == 0.0 ? \"免费\" :\"#{\"%0.2f\" %self.price}元\"\n end",
"def sales_price\r\n\t\tmarkup = @aquisition_cost*1.10\r\n\t\tmarkup.to_s\r\n\tend",
"def add_markup_person\n base_markup_price * @person * Person_Markup_Rate\n end",
"def product_selling_price_after_tax\n product_markup_price * (1 - county.tax_factor) \n end",
"def update_price(raw_price)\n model.price = raw_price * 1.10 # our markup is 10%\n model.save!\n end",
"def price\n haul == \"Medium\" ? AssignmentParameters.spill_medium : AssignmentParameters.spill_short\n end",
"def metadata_prices(structure)\n lowest_price = structure.prices.min{ |a, b| a.amount <=> b.amount }.amount\n\n \"À partir de #{lowest_price} €\"\n end",
"def get_price_middleman\n price ? price : 'N/a'\n end",
"def cigaret_price\n 0.30\n end",
"def auto_price(multiplier)\n return unless @blueprint\n @markup = (self.base_price * multiplier) - self.base_price\n end",
"def mid_price\n price\n end",
"def calculate_price_of_next_foobar\n @initial_foobar_px = (@initial_foobar_px * (1+@percentage_px_increase)).round(2) # assumes that each subsequent price is rounded off to 2 digits immediately to imitate real life\n end",
"def promo_price\n price*0.75\n end",
"def rent_price(price)\n format(\"%.0f\", (price * 7.0) / 100)\n end",
"def special_prices\n prices\n end",
"def get_price_middleman_entero\n price ? price : 0\n end",
"def price\n $tracer.trace(format_method(__method__))\n return ToolTag.new(@tag.child(\"h3\"), format_method(__method__)).inner_text\n end",
"def describe_price\r\n\t\ta = []\r\n\t\ta << sprintf('$%.2f per item', per_item) unless per_item.zero?\r\n\t\ta << sprintf('$%.2f per kg', per_kg) unless per_kg.zero?\r\n\t\ta << sprintf('$%.2f', flat_rate) unless flat_rate.zero?\r\n\t\tif formula and !formula.empty?\r\n\t\t\tif formula_description and !formula_description.empty?\r\n\t\t\t\ta << formula_description\r\n\t\t\telse\r\n\t\t\t\ta << formula.gsub('I', \"'number of items'\").gsub('W', \"'total weight'\").gsub('V', \"'total value'\")\r\n\t\t\tend\r\n\t\tend\r\n\r\n\t\ta.empty? ? ((name == '[ to be advised ]') ? nil : 'no charge') : a.join(' + ')\r\n\tend",
"def disc_amount\n $tracer.trace(format_method(__method__))\n return ToolTag.new(@tag.find.tr.className(\"/^discount$/\").td.className(\"/^right$/\"), format_method(__method__))\n end",
"def process_specification_page(response_body, short_dataset_only=true)\n hash = {}\n\n if !response_body.nil?\n doc = Nokogiri.HTML(response_body)\n\n # msrp\n hash['msrp'] = nil\n x = doc.css('#style-price a').first\n hash['msrp'] = x.text.gsub('$', '').gsub(',', '').to_i if !x.nil? && x.text.length > 0\n\n get_specifications_value(doc, hash, 'style', 'Style Name')\n get_specifications_value(doc, hash, 'body_style', 'Body Style')\n get_specifications_value(doc, hash, 'passenger_doors', 'Passenger Doors', integer: true)\n get_specifications_value(doc, hash, 'transmission', 'Transmission')\n\n # DIMENSIONS\n get_specifications_value(doc, hash, 'epa_classification', 'EPA Classification')\n get_specifications_value(doc, hash, 'passenger_capacity', 'Passenger Capacity', integer: true)\n get_specifications_value(doc, hash, 'front_head_room', 'Front Head Room (in)', float: true)\n get_specifications_value(doc, hash, 'front_shoulder_room', 'Front Shoulder Room (in)', float: true)\n get_specifications_value(doc, hash, 'front_hip_room', 'Front Hip Room (in)', float: true)\n get_specifications_value(doc, hash, 'front_leg_room', 'Front Leg Room (in)', float: true)\n get_specifications_value(doc, hash, 'second_head_room', 'Second Head Room (in)', float: true)\n get_specifications_value(doc, hash, 'second_shoulder_room', 'Second Shoulder Room (in)', float: true)\n get_specifications_value(doc, hash, 'second_hip_room', 'Second Hip Room (in)', float: true)\n get_specifications_value(doc, hash, 'second_leg_room', 'Second Leg Room (in)', float: true)\n get_specifications_value(doc, hash, 'third_head_room', 'Third Head Room (in)', float: true)\n get_specifications_value(doc, hash, 'third_shoulder_room', 'Third Shoulder Room (in)', float: true)\n get_specifications_value(doc, hash, 'third_hip_room', 'Third Hip Room (in)', float: true)\n get_specifications_value(doc, hash, 'third_leg_room', 'Third Leg Room (in)', float: true)\n\n get_specifications_value(doc, hash, 'width', 'Width, Max w/o mirrors (in)', float: true)\n get_specifications_value(doc, hash, 'height', 'Height, Overall (in)', float: true)\n get_specifications_value(doc, hash, 'length', 'Length, Overall (in)', float: true)\n get_specifications_value(doc, hash, 'ground_clearance', 'Min Ground Clearance (in)', float: true)\n\n get_specifications_value(doc, hash, 'trunk_volume', 'Trunk Volume (ft³)', float: true)\n get_specifications_value(doc, hash, 'cargo_area_width', 'Cargo Box Width @ Wheelhousings (in)', float: true)\n get_specifications_value(doc, hash, 'cargo_area_height', 'Cargo Box (Area) Height (in)', float: true)\n get_specifications_value(doc, hash, 'cargo_area_length_floor_to_seat2', 'Cargo Area Length @ Floor to Seat 2 (in)', float: true)\n get_specifications_value(doc, hash, 'cargo_area_volume_to_seat1', 'Cargo Volume to Seat 1 (ft³)', float: true)\n get_specifications_value(doc, hash, 'cargo_area_volume_to_seat2', 'Cargo Volume to Seat 2 (ft³)', float: true)\n get_specifications_value(doc, hash, 'cargo_are_volume_to_seat3', 'Cargo Volume to Seat 3 (ft³)', float: true)\n\n\n # FUEL ECONOMY\n get_specifications_value(doc, hash, 'fuel_tank_capacity', 'Fuel Tank Capacity, Approx (gal)', integer: true)\n get_specifications_value(doc, hash, 'mpg_city', 'EPA Fuel Economy Est - City (MPG)', integer: true)\n get_specifications_value(doc, hash, 'mpg_highway', 'EPA Fuel Economy Est - Hwy (MPG)', integer: true)\n get_specifications_value(doc, hash, 'mpg_combined', 'Fuel Economy Est-Combined (MPG)', integer: true)\n get_specifications_value(doc, hash, 'battery_range', 'Battery Range (mi)')\n get_specifications_value(doc, hash, 'mpg_equivalent_city', 'EPA MPG Equivalent - City')\n get_specifications_value(doc, hash, 'mpg_equivalent_hwy', 'EPA MPG Equivalent - Hwy')\n get_specifications_value(doc, hash, 'mpg_equivalent_combined', 'EPA MPG Equivalent - Combined')\n\n\n # PERFORMANCE SPECS\n get_specifications_value(doc, hash, 'engine_type', 'Engine Type')\n get_specifications_value(doc, hash, 'engine_displacement', 'Displacement')\n get_specifications_value(doc, hash, 'horsepower', 'SAE Net Horsepower @ RPM')\n get_specifications_value(doc, hash, 'fuel_system', 'Fuel System')\n\n get_specifications_value(doc, hash, 'brakes_abs', 'Brake ABS System')\n get_specifications_value(doc, hash, 'brakes_disc_front', 'Disc - Front (Yes or )')\n get_specifications_value(doc, hash, 'brakes_disc_rear', 'Disc - Rear (Yes or )')\n get_specifications_value(doc, hash, 'brakes_drum_rear', 'Drum - Rear (Yes or )')\n\n get_specifications_value(doc, hash, 'steering_type', 'Steering Type')\n get_specifications_value(doc, hash, 'turning_diameter', 'Turning Diameter - Curb to Curb (ft)', float: true)\n\n\n # SAFETY FEATURES\n get_specifications_value(doc, hash, 'air_bag_front_driver', 'Air Bag-Frontal-Driver')\n get_specifications_value(doc, hash, 'air_bag_front_passenger', 'Air Bag-Frontal-Passenger')\n get_specifications_value(doc, hash, 'air_bag_front_passenger_switch', 'Air Bag-Passenger Switch (On/Off)')\n get_specifications_value(doc, hash, 'air_bag_side_head_front', 'Air Bag-Side Head-Front')\n get_specifications_value(doc, hash, 'air_bag_side_body_front', 'Air Bag-Side Body-Front')\n get_specifications_value(doc, hash, 'air_bag_side_head_rear', 'Air Bag-Side Head-Rear')\n get_specifications_value(doc, hash, 'air_bag_side_body_rear', 'Air Bag-Side Body-Rear')\n get_specifications_value(doc, hash, 'brakes_abs', 'Brakes-ABS')\n get_specifications_value(doc, hash, 'child_door_locks', 'Child Safety Rear Door Locks')\n get_specifications_value(doc, hash, 'other_features', 'Other Features')\n\n\n\n # if the entire dataset is desired, continue\n if !short_dataset_only\n\n # DIMENSIONS\n get_specifications_value(doc, hash, 'base_curb_weight', 'Base Curb Weight (lbs)', integer: true)\n get_specifications_value(doc, hash, 'passenger_volume', 'Passenger Volume (ft³)', float: true)\n get_specifications_value(doc, hash, '', 'Gross Combined Wt Rating (lbs)')\n get_specifications_value(doc, hash, '', 'Curb Weight - Front (lbs)')\n get_specifications_value(doc, hash, '', 'Curb Weight - Rear (lbs)')\n get_specifications_value(doc, hash, '', 'Gross Axle Wt Rating - Front (lbs)')\n get_specifications_value(doc, hash, '', 'Gross Axle Wt Rating - Rear (lbs)')\n get_specifications_value(doc, hash, '', 'Gross Vehicle Weight Rating Cap (lbs)')\n\n get_specifications_value(doc, hash, 'wheelbase', 'Wheelbase (in)', float: true)\n get_specifications_value(doc, hash, 'track_width_front', 'Track Width, Front (in)', float: true)\n get_specifications_value(doc, hash, 'track_width_rear', 'Track Width, Rear (in)', float: true)\n get_specifications_value(doc, hash, 'liftover_height', 'Liftover Height (in)', float: true)\n get_specifications_value(doc, hash, '', 'Ground Clearance, Front (in)')\n get_specifications_value(doc, hash, '', 'Overhang, Rear w/o bumper (in)')\n get_specifications_value(doc, hash, '', 'Ground to Top of Frame (in)')\n get_specifications_value(doc, hash, '', 'Cab to End of Frame (in)')\n get_specifications_value(doc, hash, '', 'Ground Clearance, Rear (in)')\n get_specifications_value(doc, hash, '', 'Length, Overall w/o rear bumper (in)')\n get_specifications_value(doc, hash, '', 'Front Bumper to Back of Cab (in)')\n get_specifications_value(doc, hash, '', 'Frame Width, Rear (in)')\n get_specifications_value(doc, hash, '', 'Overhang, Front (in)')\n get_specifications_value(doc, hash, '', 'Ground to Top of Load Floor (in)')\n get_specifications_value(doc, hash, '', 'Cab to Axle (in)')\n get_specifications_value(doc, hash, '', 'Rear Door Type')\n get_specifications_value(doc, hash, '', 'Rear Door Opening Height (in)')\n get_specifications_value(doc, hash, '', 'Step Up Height - Side (in)')\n get_specifications_value(doc, hash, '', 'Side Door Opening Width (in)')\n get_specifications_value(doc, hash, '', 'Overhang, Rear w/bumper (in)')\n get_specifications_value(doc, hash, '', 'Rear Door Opening Width (in)')\n get_specifications_value(doc, hash, '', 'Step Up Height - Front (in)')\n get_specifications_value(doc, hash, '', 'Length, Overall w/rear bumper (in)')\n get_specifications_value(doc, hash, '', 'Side Door Opening Height (in)')\n\n\n get_specifications_value(doc, hash, '', 'Cargo Box Length @ Floor (in)')\n get_specifications_value(doc, hash, '', 'Cargo Box Width @ Floor (in)')\n get_specifications_value(doc, hash, '', 'Cargo Box Width @ Top, Rear (in)')\n get_specifications_value(doc, hash, '', 'Cargo Volume (ft³)')\n get_specifications_value(doc, hash, '', 'Ext\\'d Cab Cargo Volume (ft³)')\n get_specifications_value(doc, hash, '', 'Cargo Area Width @ Beltline (in)')\n get_specifications_value(doc, hash, '', 'Cargo Area Length @ Floor to Seat 1 (in)')\n get_specifications_value(doc, hash, '', 'Tailgate Width (in)')\n get_specifications_value(doc, hash, '', 'Cargo Area Length @ Floor to Seat 4 (in)')\n get_specifications_value(doc, hash, '', 'Cargo Area Length @ Floor to Console (in)')\n get_specifications_value(doc, hash, '', 'Cargo Area Length @ Floor to Seat 3 (in)')\n get_specifications_value(doc, hash, '', 'Cargo Volume to Seat 4 (ft³)')\n get_specifications_value(doc, hash, '', 'Cargo Volume with Rear Seat Up (ft³)')\n get_specifications_value(doc, hash, '', 'Cargo Volume with Rear Seat Down (ft³)')\n\n # PERFORMANCE SPECS\n get_specifications_value(doc, hash, 'torque', 'SAE Net Torque @ RPM')\n get_specifications_value(doc, hash, 'engine_order_code', 'Engine Order Code')\n\n get_specifications_value(doc, hash, '', 'Aux Fuel Tank Location')\n get_specifications_value(doc, hash, '', 'Aux Fuel Tank Capacity, Approx (gal)')\n get_specifications_value(doc, hash, '', 'Fuel Tank Location')\n\n get_specifications_value(doc, hash, '', 'Engine Oil Cooler')\n\n get_specifications_value(doc, hash, 'drivetrain', 'Drivetrain')\n get_specifications_value(doc, hash, 'first_gear_ratio', 'First Gear Ratio (:1)')\n get_specifications_value(doc, hash, '', 'Second Gear Ratio (:1)')\n get_specifications_value(doc, hash, '', 'Third Gear Ratio (:1)')\n get_specifications_value(doc, hash, '', 'Fourth Gear Ratio (:1)')\n get_specifications_value(doc, hash, '', 'Fifth Gear Ratio (:1)')\n get_specifications_value(doc, hash, '', 'Sixth Gear Ratio (:1)')\n get_specifications_value(doc, hash, '', 'Seventh Gear Ratio (:1)')\n get_specifications_value(doc, hash, '', 'Eighth Gear Ratio (:1)')\n get_specifications_value(doc, hash, '', 'Clutch Size (in)')\n get_specifications_value(doc, hash, '', 'Transfer Case Gear Ratio (:1), Low')\n get_specifications_value(doc, hash, '', 'Transfer Case Model')\n get_specifications_value(doc, hash, '', 'Trans Power Take Off')\n get_specifications_value(doc, hash, '', 'Transfer Case Power Take Off')\n get_specifications_value(doc, hash, '', 'Transfer Case Gear Ratio (:1), High')\n get_specifications_value(doc, hash, '', 'Trans PTO Access')\n\n get_specifications_value(doc, hash, '', 'Axle Type - Front')\n get_specifications_value(doc, hash, '', 'Axle Capacity - Front (lbs)')\n get_specifications_value(doc, hash, '', 'Axle Ratio (:1) - Front')\n get_specifications_value(doc, hash, '', 'Axle Type - Rear')\n get_specifications_value(doc, hash, '', 'Axle Ratio (:1) - Rear')\n get_specifications_value(doc, hash, '', 'Axle Capacity - Rear (lbs)')\n get_specifications_value(doc, hash, '', 'Spring Capacity - Front (lbs)')\n get_specifications_value(doc, hash, '', 'Shock Absorber Diameter - Front (mm)')\n get_specifications_value(doc, hash, '', 'Stabilizer Bar Diameter - Front (in)')\n get_specifications_value(doc, hash, '', 'Spring Capacity - Rear (lbs)')\n get_specifications_value(doc, hash, '', 'Shock Absorber Diameter - Rear (mm)')\n get_specifications_value(doc, hash, '', 'Stabilizer Bar Diameter - Rear (in)')\n\n get_specifications_value(doc, hash, 'reverse_ratio', 'Reverse Ratio (:1)', float: true)\n get_specifications_value(doc, hash, 'final_drive_axle_ratio', 'Final Drive Axle Ratio (:1)', float: true)\n get_specifications_value(doc, hash, 'trans_type', 'Trans Type')\n get_specifications_value(doc, hash, 'trans_desc_cont', 'Trans Description Cont.')\n get_specifications_value(doc, hash, 'trans_desc_cont2', 'Trans Description Cont. Again')\n get_specifications_value(doc, hash, 'trans_order_code', 'Trans Order Code')\n\n get_specifications_value(doc, hash, 'brakes_front_drum_thickness', 'Front Brake Rotor Diam x Thickness (in)', float: true)\n get_specifications_value(doc, hash, 'brakes_rear_drum_thickness', 'Rear Brake Rotor Diam x Thickness (in)', float: true)\n get_specifications_value(doc, hash, 'brakes_rear_drum_width', 'Rear Drum Diam x Width (in)', float: true)\n get_specifications_value(doc, hash, '', 'Brake Type')\n get_specifications_value(doc, hash, '', 'Brake ABS System (Second Line)')\n\n get_specifications_value(doc, hash, '', 'Steering Ratio (:1), On Center')\n get_specifications_value(doc, hash, '', 'Turning Diameter - Wall to Wall (ft)')\n get_specifications_value(doc, hash, '', 'Steering Ratio (:1), At Lock')\n\n get_specifications_value(doc, hash, '', 'Revolutions/Mile @ 45 mph - Rear')\n get_specifications_value(doc, hash, '', 'Spare Tire Capacity (lbs)')\n get_specifications_value(doc, hash, '', 'Front Tire Capacity (lbs)')\n get_specifications_value(doc, hash, '', 'Revolutions/Mile @ 45 mph - Spare')\n get_specifications_value(doc, hash, '', 'Revolutions/Mile @ 45 mph - Front')\n get_specifications_value(doc, hash, '', 'Rear Tire Capacity (lbs)')\n\n get_specifications_value(doc, hash, 'tire_front_size', 'Front Tire Size')\n get_specifications_value(doc, hash, 'tire_front_code', 'Front Tire Order Code')\n get_specifications_value(doc, hash, 'tire_rear_size', 'Rear Tire Size')\n get_specifications_value(doc, hash, 'tire_rear_code', 'Rear Tire Order Code')\n get_specifications_value(doc, hash, 'tire_spare_size', 'Spare Tire Size')\n get_specifications_value(doc, hash, 'tire_spare_code', 'Spare Tire Order Code')\n\n get_specifications_value(doc, hash, 'wheel_front_size', 'Front Wheel Size (in)')\n get_specifications_value(doc, hash, 'wheel_front_material', 'Front Wheel Material')\n get_specifications_value(doc, hash, 'wheel_rear_size', 'Rear Wheel Size (in)')\n get_specifications_value(doc, hash, 'wheel_rear_material', 'Rear Wheel Material')\n get_specifications_value(doc, hash, 'wheel_spare_size', 'Spare Wheel Size (in)')\n get_specifications_value(doc, hash, 'wheel_spare_material', 'Spare Wheel Material')\n\n get_specifications_value(doc, hash, 'suspension_type_front', 'Suspension Type - Front')\n get_specifications_value(doc, hash, 'suspension_type_front2', 'Suspension Type - Front (Cont.)')\n get_specifications_value(doc, hash, 'suspension_type_rear', 'Suspension Type - Rear')\n get_specifications_value(doc, hash, 'suspension_type_rear2', 'Suspension Type - Rear (Cont.)')\n\n\n # SAFETY FEATURES\n get_specifications_value(doc, hash, 'daytime_lights', 'Daytime Running Lights')\n get_specifications_value(doc, hash, 'fog_lamps', 'Fog Lamps')\n get_specifications_value(doc, hash, 'night_vision', 'Night Vision')\n get_specifications_value(doc, hash, 'backup_camera', 'Back-Up Camera')\n get_specifications_value(doc, hash, 'parking_aid', 'Parking Aid')\n get_specifications_value(doc, hash, 'traction_control', 'Traction Control')\n get_specifications_value(doc, hash, 'tire_pressure_monitor', 'Tire Pressure Monitor')\n get_specifications_value(doc, hash, 'stability_control', 'Stability Control')\n get_specifications_value(doc, hash, 'rollover_protection_bars', 'Rollover Protection Bars')\n\n\n # WARRANTY\n get_specifications_value(doc, hash, 'warranty_years', 'Basic Years', integer: true)\n get_specifications_value(doc, hash, 'warranty_miles', 'Basic Miles/km')\n get_specifications_value(doc, hash, 'warranty_drivetrain_year', 'Drivetrain Years', integer: true)\n get_specifications_value(doc, hash, 'warranty_drivetrain_mils', 'Drivetrain Miles/km')\n get_specifications_value(doc, hash, 'warranty_corrosion_years', 'Corrosion Years', integer: true)\n get_specifications_value(doc, hash, 'warranty_corrosion_miles', 'Corrosion Miles/km')\n get_specifications_value(doc, hash, 'warranty_roadside_years', 'Roadside Assistance Years', integer: true)\n get_specifications_value(doc, hash, 'warranty_roadside_miles', 'Roadside Assistance Miles/km')\n get_specifications_value(doc, hash, '', 'Hybrid/Electric Components Miles/km')\n get_specifications_value(doc, hash, '', 'Hybrid/Electric Components Years')\n get_specifications_value(doc, hash, '', 'Maintenance Miles/km')\n get_specifications_value(doc, hash, '', 'Maintenance Years')\n get_specifications_value(doc, hash, '', 'Drivetrain Note')\n get_specifications_value(doc, hash, '', 'Maintenance Note')\n get_specifications_value(doc, hash, '', 'Roadside Assistance Note')\n get_specifications_value(doc, hash, '', 'Emissions Miles/km')\n get_specifications_value(doc, hash, '', 'Emissions Years')\n\n\n\n # OTHER SPECS\n get_specifications_value(doc, hash, 'cold_cranking_amps', 'Cold Cranking Amps @ 0° F (Primary)', integer: true)\n get_specifications_value(doc, hash, '', 'Total Cooling System Capacity (qts)')\n get_specifications_value(doc, hash, '', 'Maximum Alternator Watts')\n get_specifications_value(doc, hash, '', 'Cold Cranking Amps @ 0° F (2nd)')\n get_specifications_value(doc, hash, 'max_alternator_capacity', 'Maximum Alternator Capacity (amps)', integer: true)\n get_specifications_value(doc, hash, 'max_trailering_capacity', 'Maximum Trailering Capacity (lbs)', integer: true)\n get_specifications_value(doc, hash, 'max_trailer_weight_distributing_hitch', 'Wt Distributing Hitch - Max Trailer Wt. (lbs)', integer: true)\n get_specifications_value(doc, hash, 'max_tongue_weight_distributing_hitch', 'Wt Distributing Hitch - Max Tongue Wt. (lbs)', integer: true)\n get_specifications_value(doc, hash, 'max_trailer_weight_dead_weight_hitch', 'Dead Weight Hitch - Max Trailer Wt. (lbs)', integer: true)\n get_specifications_value(doc, hash, 'max_tongue_weight_dead_weight_hitch', 'Dead Weight Hitch - Max Tongue Wt. (lbs)', integer: true)\n get_specifications_value(doc, hash, '', 'Fifth Wheel Hitch - Max Tongue Wt. (lbs)')\n get_specifications_value(doc, hash, '', 'Fifth Wheel Hitch - Max Trailer Wt. (lbs)')\n get_specifications_value(doc, hash, '', 'Wt Distributing Hitch - Max Trailer Wt. (lbs)')\n\n end\n\n end\n\n return hash\nend",
"def get_price(n)\n description = Nokogiri::HTML(@description_xpath[n].text).text\n if description.include?(\"Tickets\")\n convert_to_price(description.split(\"Tickets\")[1].split(\"Contact\")[0])\n elsif description.include?(\"Admission\")\n convert_to_price(description.split(\"Admission\")[1].split(\"Contact\")[0])\n else\n 0\n end\n end",
"def calculate_markup(base_price, number_of_workers, package_type)\n fail ArgumentError, 'Invalid base price' if invalid_numeric_input?(base_price)\n fail ArgumentError, 'Invalid number of workers' if invalid_numeric_input?(number_of_workers)\n\n flat_fee = 1.05\n base_price_with_flat_markup = base_price * flat_fee\n worker_markup = base_price_with_flat_markup * number_of_workers * 0.012\n material_markup = if MATERIAL_MARKUPS.include?(package_type)\n base_price_with_flat_markup * MATERIAL_MARKUPS[package_type]\n else\n 0.0\n end\n\n total_fee = (base_price_with_flat_markup + worker_markup + material_markup)\n return total_fee.round(2)\n end",
"def market_price_for_drug\n rand(500) + 10\n end",
"def product_price\n $tracer.trace(__method__)\n return ToolTag.new(span.className(create_ats_regex_string(\"ats-wis-price\")), __method__)\n end",
"def suitable_halfs\n required_amount\n end",
"def get_value_html(product)\n if value = get_value_01(product)\n stars_html(value)\n end\n end",
"def get_weight\n ((@contents[/(?<=(Shipping Weight:<\\/b>)\\s).*(?=\\s\\()/])[/\\d*.\\d*/]).to_f.round_to(2)\n\n end",
"def get_low_price(td)\n nil\n # if td.css('a').size == 0 # no listing complete\n # nil\n # elsif td.css('a div').size == 1\n # true\n # else\n # td.text.gsub(/[^\\d.]/,'').to_f\n # end\n end",
"def calculate_price_in_micro_units\n 0\n end",
"def full_price\n\t\t\t\t@aftertax = @baseprice * @taxrate\n\t\tend",
"def full_price\n price + tax_evaluation\n end",
"def car_price(price_text)\n\tprice = price_text.css('span.result-price').text\n\tprice = price.gsub(/\\D/,'').to_i\nend",
"def base_price\n price / multiplier\n end",
"def as_us_dollar; end",
"def price_string=(price_string)\n\n gold, silver, copper = 0, 0, 0\n gold = $1.to_i if price_string =~ /(\\d+)g/\n silver = $1.to_i if price_string =~ /(\\d+)s/\n copper = $1.to_i if price_string =~ /(\\d+)c/\n\n value = copper + silver * 100 + gold * 10000\n self.price = value\n\n end",
"def price\n base_price * discount_factor\n end",
"def grab_price\n\t\tcurrent_price = \"$\" + @price_span.content\n\t\t#close_price = \"$\" + @close_span\n\t\tputs \"The greatest car company in the world has a stock price of \"\n\t\tputs current_price\n\t\t#puts \"Yesterday the stock closed at #{close_price}.\"\n\n\tend",
"def special_prices\n customized_special_prices || prices\n end",
"def new_sale_price \n noi(num_years_to_hold + 1) / cap_rate(num_years_to_hold + 1)\n end",
"def effective_rate; end",
"def price\n 2.50\n end",
"def formatted_price\n price / 100.0\n end",
"def payment_term; end",
"def net_single_base\n conv_price_single * ( 1 - (conv_discount / 100 ) )\n end",
"def price\n # puts \"$#{(num_beds*1000) + (num_baths*500)}\"\n (num_beds*1000) + (num_baths*500)\n end",
"def tax\n\t\t@value * 0.16\n\tend",
"def fixed_price\n data.fixed_price\n end",
"def wrt_brand_stk(stock, format = 6)\n $report_file.puts(\"Number of Products:\" + \"%#{format}s\" % stock.to_s)\nend",
"def price_string\n\n money = self.price || 0\n copper = money % 100\n amount = (money - copper) / 100\n silver = amount % 100\n gold = (amount - silver) / 100\n\n parts = []\n parts << \"#{number_with_delimiter(gold.to_i)}g\" if gold > 0\n parts << \"#{silver.to_i}s\" if silver > 0\n parts << \"#{copper.to_i}c\" if copper > 0\n\n parts.join(' ')\n \n end",
"def update_price(price)\n model.price = price # * 1.10 # our markup is 10%\n model.save!\n end",
"def tax\n \"#{price}\".to_i * 0.09 \n end",
"def explained_price_for(artno)\n prices_for(artno.to_i).first.explained_price\n end",
"def tax(amount)\n if amount <= 240\n 0\n elsif amount <= 480\n amount * 0.15\n else\n amount * 0.28\n end\nend",
"def calculate(policy, mrg)\n case policy\n when 'Flexible'\n base_price * mrg\n when 'Fixed'\n base_price + mrg\n when 'Prestige'\n base_price + mrg\n end\n end",
"def get_price\n item_prc_1\n end",
"def price\n price_tier ? price_tier : 'Unknown'\n end",
"def price_display\n 'INR ' + price.to_s\n end",
"def shiny_rate\n 16\n end",
"def price\n MoneyUtils.format(self.price_basis)\n end",
"def price\n return base_price - quantity_discount + shipping\nend",
"def get_tirerack_variant_minprice(variants)\n markup_tirerack(variants.map {|v| v[:price]}.sort.first)\n end",
"def price_y\n contents_height / 2 + line_height / 2\n end",
"def tag_rate\n marc.load_source false\n ((marc.all_tags.map{|e| e.tag}.uniq.size.to_f / (template_tags(record_type).uniq.size.to_f * 100)) * 100).round(2)\n end",
"def set_gojek_cost(line_items)\n\t\tline_items.any? ? 'Rp 15,000' : 'Rp 0'\n\tend",
"def test_discount_price\n assert_equal(0.48, Stub.new.calculate_discount_price(\"2%\",24.0))\n end",
"def unified_genotyper_strand_call_conf(data)\n \"30.0\"\nend",
"def output_price(final_price)\n price = '%.2f' % final_price\n formatted_price= price.to_s.reverse.scan(/(?:\\d*\\.)?\\d{1,3}-?/).join(',').reverse\n @price = \"$#{formatted_price}\"\n end",
"def calcTaxes price\r\n taxrate = 0.95\r\n return taxrate * price\r\nend",
"def policy2(label, content)\n in_range = lambda {|value, min, max| value >= min && value <= max}\n\n case label\n when \"byr\"\n return in_range.call(content.to_i, 1920, 2002)\n when \"iyr\"\n return in_range.call(content.to_i, 2010, 2020)\n when \"eyr\"\n return in_range.call(content.to_i, 2020, 2030)\n when \"hgt\"\n units = content[-2..-1]\n value = content[0..-3].to_i\n\n case units\n when \"cm\"\n return in_range.call(value, 150, 193)\n when \"in\"\n return in_range.call(value, 59, 76)\n end\n when \"hcl\"\n return content =~ /^#(\\d|[a-f]){6}$/\n when \"ecl\"\n return content =~ /^(amb|blu|brn|gry|grn|hzl|oth)$/\n when \"pid\"\n return content =~ /^\\d{9}$/\n end\nend",
"def price_based_on_vehicle(pickup_postcode, delivery_postcode, vehicle)\n basic_price =calcul_basic_price(pickup_postcode, delivery_postcode)\n price_based_on_vehicle = basic_price + basic_price * vehicle.markup\n end",
"def eth_value\n return eth_portfolio * eth_price\n end",
"def cost\n 0.89\n end",
"def promo_code_multiplier\n return 1.0 unless promo_code.present?\n\n (100 - promo_code.discount) / 100.0\n end",
"def parse_price(e)\n # prices can be restricted\n begin\n return e.css('span')[1].content.gsub(',', '.').to_f\n rescue\n return 0.0\n end\n end",
"def price_adjustment \n price_adjustment_fixed / 100.0 \n end",
"def price_sans_tax\n price_as_price.sans_tax\n end",
"def wrt_brand_avg_prc(brand_avg_prc, format = 6)\n $report_file.puts(\"Average Product Price:\" + \"%#{format}s\" % \"$\" + brand_avg_prc.to_s)\nend",
"def total_bill(s)\n big_plates = s.scan(/r/).count\n free_plates = big_plates / 5\n charge = (big_plates - free_plates) * 2\nend",
"def get_band()\n return(get_cmd('BN;',0.1,0.5,3).gsub(/^BN/,'').gsub(/;$/,'').to_i)\nend",
"def grasa\n\t\t1.2*imc+0.23*@edad-10.8*@sexo-5.4\n\tend",
"def rate; end",
"def rate; end",
"def pur_pro_price\n $tracer.trace(format_method(__method__))\n return ToolTag.new(@tag.find.div.id(\"/purProPriceDiv/\"), format_method(__method__), @spec)\n end",
"def lsr\n # NOTE: force type coersion to decimal\n [1.0*purchase_price / strike_price, 1].min\n rescue\n 1.0\n end",
"def discount_value\n return '20' if taxons.find_by(id: 126) # Taxon 20% Descuento\n return '25' if taxons.find_by(id: 128) # Taxon 25% Descuento\n return '30' if taxons.find_by(id: 127) # Taxon 30% Descuento\n return '33' if taxons.find_by(id: 134) # Taxon 33% Descuento\n end"
] | [
"0.74036324",
"0.6854294",
"0.6535629",
"0.6514163",
"0.647483",
"0.6389953",
"0.6388788",
"0.6351148",
"0.63147366",
"0.6259358",
"0.61915433",
"0.6176857",
"0.60935986",
"0.60457134",
"0.60196584",
"0.5968887",
"0.59479433",
"0.5946795",
"0.59375715",
"0.5900401",
"0.5897785",
"0.58465564",
"0.58373445",
"0.5827787",
"0.58170545",
"0.57886696",
"0.57431644",
"0.57393056",
"0.57246304",
"0.5720636",
"0.56933635",
"0.5680241",
"0.565945",
"0.56371117",
"0.5628797",
"0.5623825",
"0.5617981",
"0.56163716",
"0.5614678",
"0.5597948",
"0.5591615",
"0.5574665",
"0.5570068",
"0.55584365",
"0.55525386",
"0.5547344",
"0.55381936",
"0.55169725",
"0.55105126",
"0.5508958",
"0.5504167",
"0.5501683",
"0.54845816",
"0.5464839",
"0.5464141",
"0.5463391",
"0.54539883",
"0.5432995",
"0.5429899",
"0.54271203",
"0.542199",
"0.54049134",
"0.5399294",
"0.5395428",
"0.5390666",
"0.53888637",
"0.53802824",
"0.537724",
"0.53749466",
"0.5370206",
"0.5368203",
"0.5367818",
"0.5360877",
"0.53607893",
"0.53607017",
"0.53571874",
"0.53546333",
"0.5350264",
"0.5349019",
"0.5344064",
"0.53425",
"0.5342482",
"0.533994",
"0.5336679",
"0.5335249",
"0.53313214",
"0.53287256",
"0.5327583",
"0.53262013",
"0.5313435",
"0.5311712",
"0.5311431",
"0.5309962",
"0.53094316",
"0.53042436",
"0.5296806",
"0.5296806",
"0.5296535",
"0.5295872",
"0.52824354"
] | 0.74139893 | 0 |
As part of 101 lesson requirements. I will need three pieces of information: the loan amount the Annual Percentage Rate (APR) the loan duration from the above, I will calculate the following two things: 1) monthly interest Rate 2) loan duration in months This is the formula: m = p (j / (1 (1 + j)(n))) m = monthly payment, p = loan amount, j = monthly interest rate, n = loan duration in months the code should be run through Rubocop | def prompt(message)
puts("=>#{message}")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculate_monthly_pay(loan_amount, interest_rate, loan_duration)\n loan_amount * (interest_rate * ( 1 + interest_rate) * loan_duration) /\n (interest_rate * ( 1 + interest_rate) * (loan_duration - 1))\nend",
"def calculate_apr\n payment_ratio = monthly_payment_with_fees / loan_amount\n f = lambda {|k| (k**(self.period + 1) - (k**self.period * (payment_ratio + 1)) + payment_ratio)}\n f_deriv = lambda { |k| ((self.period + 1) * k**self.period) - (self.period * (payment_ratio + 1) * k**(self.period - 1))}\n\n root = newton_raphson(f, f_deriv, monthly_interest_rate + 1)\n 100 * 12 * (root - 1).to_f\n end",
"def year_to_month_rate_convert(apr_in_decimals, loan_duration)\n ((1 + (apr_in_decimals / loan_duration))**loan_duration) - 1\nend",
"def calculation(duration, loan, apr)\n loan * (apr / (1 - (1 + apr)**(-duration)))\nend",
"def calculate_n_months(loan_duration)\n 12 * loan_duration\nend",
"def monthly_payment(salary_per_annum)\n return salary_per_annum / 12\nend",
"def mortgage_calc principle, annual_interest, years\n n = years * 12\n r = (annual_interest / 100)/ 12 #since this is usually expressed as a percentage\n return (principle * r * (1 + r)**n / ((1 + r)**n - 1)).round(2)\nend",
"def get_monthly_payments(loan, interest, months)\n loan * (interest / (1 - (1 + interest)**(-months)))\nend",
"def apr\n payment_ratio = self.monthly_payment_with_fees / self.loan_amount\n f = lambda { |k| (k**(self.period + 1) - (k**self.period * (payment_ratio + 1)) + payment_ratio) }\n f_deriv = lambda { |k| ((self.period + 1) * k**self.period) - (self.period * (payment_ratio + 1) * k**(self.period - 1)) }\n\n root = newton_raphson(f, f_deriv, self.monthly_interest_rate + 1)\n 100 * 12 * (root - 1).to_f\n end",
"def loan_dur_month(loan_duration)\n loan_duration.to_i * 12\nend",
"def loan_calc(loan_amount,interest_rate,loan_term,loan_type)\n if loan_type.downcase == \"pi\"\n r = interest_rate/12\n n = loan_term*12\n d = ( ( ( (1+r)**n) - 1) / (r*(1+r)**n))\n result = loan_amount/d\n\n elsif loan_type.downcase == \"io\"\n r = interest_rate/12\n result = loan_amount * r\n end #end if\nend",
"def calculate_apr\n payment_ratio = pmt / principal_calculation\n duration = @duration\n f = lambda {|k| (k**(duration + 1) - (k**duration * (payment_ratio + 1)) + payment_ratio)}\n f_deriv = lambda { |k| ((duration + 1) * k**duration) - (duration * (payment_ratio + 1) * k**(duration - 1))}\n\n root = newton_raphson(f, f_deriv, monthly_rate + 1)\n 100 * 12 * (root -1).to_f\n end",
"def get_monthly_rate(apr)\n (apr / 100) / 12\nend",
"def payment\n loan_amount / 12\n end",
"def calculate_loan(rate, n_periods, total_loan_amount)\n fixed_payment = (rate /\n (1 - ((1 + rate)**(n_periods * - 1)))) * total_loan_amount\n\n fixed_payment.to_f\nend",
"def required_annual_savings\n needed_amount_less_savings / years_to_retirement\n end",
"def pmt (interest_rate, nper, pv)\n\t#monthly_payment = 1.00\n\tmonthly_payment = (pv*interest_rate*((1+interest_rate)**nper))/(((1+interest_rate)**nper)-1)\n\treturn monthly_payment\nend",
"def calculate(quote)\n loan_amt = loan_amount(quote)\n monthly_pmt = loan_amt / pv_of_1_dollar_payments\n {\n debt_rate: debt_rate,\n loan_amount: loan_amt.round(2),\n monthly_payment: monthly_pmt.round(2)\n }\n end",
"def pmt(rate, nper, pv)\n\n # =========================================================\n #the required output already accounts for monthly nature by dividing the 0.0404 by 12. it also already puts the percentage in decimal form so no need to adjust for rate on the back end\n part1 = (pv * rate)\n part2 = 1 - (1 + rate)**-nper\n\n monthly_payment = part1 / part2\n\n # Your code to implement the method goes here.\n # You shouldn't have to write or change code anywhere else.\n # =========================================================\nend",
"def calculate_interest principle, days_since\n (principle * APR / 365 * days_since).round(2)\n end",
"def calculate_monthly_mortgage(rate, principal, years)\n\tnew_rate = rate.to_f / 12\n\tnum_payments = 12 * years\n\tmonthly_payment = principal * ((new_rate * (1 + new_rate) ** num_payments)/((1 + new_rate) ** num_payments - 1))\n\treturn monthly_payment.round(2)\nend",
"def amortize(rate)\n # For the purposes of calculating a payment, the relevant time\n # period is the remaining number of periods in the loan, not\n # necessarily the duration of the rate itself.\n periods = @periods - @period\n amount = Amortization.payment @balance, rate.monthly, periods\n\n pmt = Payment.new(amount, :period => @period)\n if @block then pmt.modify(&@block) end\n \n rate.duration.times do\n # Do this first in case the balance is zero already.\n if @balance.zero? then break end\n\n # Compute and record interest on the outstanding balance.\n int = (@balance * rate.monthly).round(2)\n interest = Interest.new(int, :period => @period)\n @balance += interest.amount\n @transactions << interest.dup\n\n # Record payment. Don't pay more than the outstanding balance.\n if pmt.amount.abs > @balance then pmt.amount = -@balance end\n @transactions << pmt.dup\n @balance += pmt.amount\n \n @period += 1\n end\n end",
"def monthly_interest\n\t\tinterest_rate / (100 * 12)\n\tend",
"def referrals_needed_per_month\n 5 * monthly_transaction_goal\n end",
"def work_out_input(array)\n loan_amount = array[0]\n mounthly_rate = array[1]\n n_mounths = array[2]\n mounthly_payment = loan_amount * (\n mounthly_rate / (\n 1 - (1 + mounthly_rate)**-n_mounths))\n mounthly_payment.round(2)\nend",
"def unit_payment(mort_disc, interest, numberOfMonths,payment)\n (mort_disc * payment) / ((1.0 + interest) ** (numberOfMonths / 12.0))\n end",
"def frm(r, n, po)\n\t## \n\t# interest rate is converted to fraction and made a monthly\n\tr = r.to_f/100/12\n\t##\n\t#number of years is converted to number of months\n\tn = n * 12\n\t##\n\t#monthly payment is calculated\n\tc = (r / (1 - (1+r) ** -n) ) * po\n\treturn c\nend",
"def calculate(loan_value, financing_time_months, interest_rate, loan_date = Date.today)\n balance = loan_value\n installment = installment_value(interest_rate, financing_time_months, loan_value)\n installment_date = loan_date.next_month\n iof = 0\n\n financing_time_months.step(1, -1) do |_|\n amortization = installment - interest_part(balance, interest_rate)\n\n days = past_days(loan_date, installment_date)\n\n iof += amortization*(@iof_day*(minimal_days(days)))\n iof += amortization*@iof_additional\n\n balance -= amortization\n installment_date = installment_date.next_month\n end\n\n loan_iof(iof, loan_value)\n end",
"def rate\n Rate.new(self.interest/100, :apr, duration: self.tenure * 12)\n end",
"def pmt(interest_rate,payments,principal)\n numerator =interest_rate*principal*(1 + interest_rate)**payments\n denominator= (1+ interest_rate)**payments - 1\n return numerator/denominator.to_f\nend",
"def total_annual_rent_collected\n units.map { |unit| unit.is_vacant ? 0 : unit.monthly_rent }.reduce(:+) * 12\n end",
"def total_amount_owed(principal, interest_rate_percentage, number_of_years)\n annual_percentage_rate = interest_rate_percentage / 100\n principal * (1 + annual_percentage_rate * number_of_years)\nend",
"def installment_value(interest_rate, financing_time_months, loan_value)\n @installment_calculator.calculate(interest_rate, financing_time_months, loan_value)\n end",
"def patient_monthly_costs_before_dh\n\t$pt_costs_monthy_no_dh = []\n\n\t$pokitdok_call.each do |drug|\n\t\t$pt_costs_monthy_no_dh << drug['retail']['oop_30_day']['amount'].to_f\n\tend\n\n\t$pt_costs_monthy_no_dh.inject(:+).round(2)\nend",
"def daily_interest\n @apr / 100.0 / 365\n end",
"def patient_monthly_costs_before_dh\n\t\t$pt_costs_monthy_no_dh = []\n\n\t\t$pokitdok_call.each do |drug|\n\t\t\t$pt_costs_monthy_no_dh << drug['retail']['oop_30_day']['amount'].to_f\n\t\tend\n\n\t\t$pt_costs_monthy_no_dh.inject(:+).round(2)\n\tend",
"def provide_mortgage_4?(salary, deposit, property_value, bankrupt)\n loan_amount = property_value - deposit\n property_value >= 650000 ? min_deposit = 0.2 : min_deposit = 0.05 # 20%\n max_multiplier = 5 # how many annual incomes can be borrowed\n !bankrupt && deposit >= property_value * min_deposit && \n (salary * max_multiplier >= loan_amount || deposit >= property_value * 0.75)\nend",
"def total_payments\n\t\tammortization * 12\n\tend",
"def loan_amt\n (self.buying_price*1000) * (1 - (self.deposit/100))\n end",
"def total_retirement_saving(your_age)\n child_age = your_age / 2\n saving_per_year = child_age * child_age\n years_to_retire = 65 - child_age\n saving_per_year * years_to_retire\nend",
"def monthly_rate(*args)\n if duration.present? && paid?\n rate(*args) / duration_in_months\n else\n rate(*args)\n end\n end",
"def annual_salary\n hourly_rate * 1950\n end",
"def annualized_portfolio_amount_needed\n savings_portion_needed * 12.0\n end",
"def fixed_monthly_payment(amount, months, ir )\n amount*( ir * ( 1 + ir ) **months )/(( 1 + ir )**months - 1 )\nend",
"def monthly_rate\n\t\t yearly? ? rate / 12 : rate\n\t\t end",
"def provide_mortgage_2?(salary, deposit, property_value)\n loan_amount = property_value - deposit\n property_value >= 650000 ? min_deposit = 0.2 : min_deposit = 0.05 # 20%\n max_multiplier = 5 # how many annual incomes can be borrowed\n deposit >= property_value * min_deposit && \n salary * max_multiplier >= loan_amount\nend",
"def add_monthly_interest\n\t\t@debt *= 1.015\n\t\t@balance *= 1.0003\n\tend",
"def calculaEstimativaBatimentos(anos)\n estimativaBatimentos = anos * 365 * 24 * 60 * 80\n return estimativaBatimentos\nend",
"def patient_monthly_costs_during_dh\n\t$pt_costs_monthy_during_dh = []\n\n\t$pokitdok_call.each do |drug|\t\n\t\t#Patient pays no more than 45% of ⇒ plan’s cost for covered brand-name prescription drugs + pharmacy’s dispensing fee\n\t\tif drug['tier'] == 1\n\t\t\t$pt_costs_monthy_during_dh << (drug['retail']['total_cost_30_day']['amount'].to_f * 0.58)\n\n\t\t#patient pays 58% of cost, 58% of cost goes toward geting out of donut hole\t\t\t\n\t\telsif drug['tier'] == 2 \n\t\t\t$pt_costs_monthy_during_dh << (drug['retail']['total_cost_30_day']['amount'].to_f * 0.45)\n\t\telsif drug['tier'] == 3\n\t\t\t$pt_costs_monthy_during_dh << (drug['retail']['total_cost_30_day']['amount'].to_f * 0.45)\n\t\telse\n\t\t\t$pt_costs_monthy_during_dh << drug['retail']['total_cost_30_day']['amount'].to_f\n\t\tend\n\tend\n\n\t$pt_costs_monthy_during_dh.inject(:+).round(2)\nend",
"def debt_payment\n loan_proceeds = 0\n debt_rate * loan_proceeds\n end",
"def monthly_payment\n\t\tc = monthly_interest\n\t\tif interest_only?\n\t\t\tc * amount\n\t\telse\n\t\t\tn = total_payments\n\t\t\t(amount * ((c * ((1 + c)**n)) / (((1 + c)**n) - 1))).round(2)\n\t\tend\n\tend",
"def monthly_rate\n yearly? ? rate / 12 : rate\n end",
"def salary_advance\n advs = @faculty.employee_advance_payments.belongs_to_month(@generation_date.strftime(\"%b\")).belongs_to_year(@generation_date.strftime(\"%Y\"))\n advs.inject(0){|sum, adv| sum+adv.amount_in_rupees}\n end",
"def provide_mortgage_3?(salary, deposit, property_value)\n loan_amount = property_value - deposit\n property_value >= 650000 ? min_deposit = 0.2 : min_deposit = 0.05 # 20%\n max_multiplier = 5 # how many annual incomes can be borrowed\n deposit >= property_value * min_deposit && \n (salary * max_multiplier >= loan_amount || deposit >= property_value * 0.75)\nend",
"def calculate_payment_amount(params, insurance_cost, interest_rate)\n mortgage_principle = params['asking_price'] - params['down_payment'] + insurance_cost\n number_of_payments = SCHEDULE_MAP[params['payment_schedule']] * params['amortization_period']\n nominal_interest_rate = (interest_rate / SCHEDULE_MAP[params['payment_schedule']]) / 100\n\n numerator = (mortgage_principle * nominal_interest_rate * (1 + nominal_interest_rate)**number_of_payments)\n denominator = (1 + nominal_interest_rate)**number_of_payments - 1\n\n (numerator / denominator).round(2)\n end",
"def loan_calc()\n\t# Initialize variables\n\tp = 0 # - Principal\n\tr = 0 # - Rate of interest\n\tn = 0 # - Number of years\n\n\t# Get the input from the user as floats\n\t# - Get principal amount / loan amount\n\twhile p <= 0 do\n\t\tprint \"Please enter principal amount for loan (must be a positive number):\\n\"\n\t\tp = gets.chomp.to_f\n\tend\n\n\t# - Get rate of interest in percent\n\twhile r <= 0 do\n\t\tprint \"Please enter interest rate for loan (must be a positive number):\\n\"\n\t\tr = gets.chomp.to_f\n\tend\n\n\t# - Get number of years / the duration of the loan\n\twhile n <= 0 do\n\t\tprint \"Please enter duration of the loan in years (must be a positive number):\\n\"\n\t\tn = gets.chomp.to_f\n\tend\n\n\t# Calculate the monthly payment for the loan\n\tm = (p * r / 1200) / (1 - (1.0 + r / 1200.0) ** (-12 * n))\n\n\t# Round to the nearest cent\n\tm = m.round(2)\n\n\t# Give the user their output\n\tprint \"This is the monthly payment for the loan, rounded to the nearest cent:\\n\", m, \"\\n\"\n\t\n\t# Make another call to this same function if the user answered 'Y' for yes, exit if 'N' for no, or prompt again if input is invalid \n\tanswer = \"\"\n\twhile answer != 'y' and answer != 'n' do\n\t\tprint \"Would you like to go again? Y/N\\n\"\n\t\tanswer = gets.chomp.downcase\n\t\tif (answer == 'y')\n\t\t\tloan_calc()\n\t\telsif (answer == 'n')\n\t\t\treturn\n\t\telse\n\t\t\tprint \"Sorry, that doesn't seem to be a valid response. Only type 'Y' or 'N'\\n\"\n\t\tend\n\tend\nend",
"def pmt\n factor = (1.0 + monthly_rate)**duration\n second_factor =\n if monthly_rate.zero?\n duration\n else\n (factor - 1) * (1 + monthly_rate * ptype) / monthly_rate\n end\n\n -((future_value + amount * factor) / second_factor)\n end",
"def rental_mth\n self.rental*1000/12\n end",
"def calculate_years(principal, interest, tax, desired)\n# principal amount\n year = 0\n while principal < desired\n year += 1\n income = principal * interest\n principal += income - income * tax\n end\n year\nend",
"def annualy_insurance\n return @capital * @insurance * -1\n end",
"def nper\n z = payment * (1.0 + monthly_rate * ptype) / monthly_rate\n\n Math.log(-future_value + z / (amount + z)) / Math.log(1.0 + monthly_rate)\n end",
"def patient_monthly_costs_during_dh\n\t\t$pt_costs_monthy_during_dh = []\n\n\t\t$pokitdok_call.each do |drug|\n\t\t\t#Patient pays no more than 45% of ⇒ plan’s cost for covered brand-name prescription drugs + pharmacy’s dispensing fee\n\t\t\tif drug['tier'] == 1\n\t\t\t\t$pt_costs_monthy_during_dh << (drug['retail']['total_cost_30_day']['amount'].to_f * 0.58)\n\n\t\t\t#patient pays 58% of cost, 58% of cost goes toward geting out of donut hole\n\t\t\telsif drug['tier'] == 2\n\t\t\t\t$pt_costs_monthy_during_dh << (drug['retail']['total_cost_30_day']['amount'].to_f * 0.45)\n\t\t\telsif drug['tier'] == 3\n\t\t\t\t$pt_costs_monthy_during_dh << (drug['retail']['total_cost_30_day']['amount'].to_f * 0.45)\n\t\t\telse\n\t\t\t\t$pt_costs_monthy_during_dh << drug['retail']['total_cost_30_day']['amount'].to_f\n\t\t\tend\n\t\tend\n\n\t\t$pt_costs_monthy_during_dh.inject(:+).round(2)\n\tend",
"def debt_rate\n ten_year_treasury + bps(200)\n end",
"def yearly_rate(*args)\n if paid?\n if yearly?\n rate(*args) / duration_parts[0] #number of years\n else\n rate(*args) / duration_in_months * 12\n end\n else\n nil\n end\n end",
"def calculate_payment\n x = @periodic_rate * @principal * ((1 + @periodic_rate)**@periods)\n y = ((1 + @periodic_rate)**@periods) - 1\n (x / y).round(2)\n end",
"def adjusted_capital\n return 0.0 if @capital <= 0.0\n return 0.0 if @interest_rate <= 0.0 || @duration <= 0.0\n (@income/ @duration) * ADJ_FACTOR\nend",
"def payment(rate, bal, term)\n # Convert annual rate to monthly and make it decimal.\n r = rate / 1200\n\n # Numerator\n n = r * bal\n\n # Denominator\n d = 1 - (1 + r)**-term\n\n # Calc the monthly payment.\n pmt = n / d\n end",
"def pv\n factor = (1.0 + monthly_rate)**duration\n second_factor = (factor - 1) * (1 + monthly_rate * ptype) / monthly_rate\n\n -(future_value + (payment.to_f * second_factor)) / factor\n end",
"def provide_mortgage_3?(salary, deposit, property_value)\n loan_amount = property_value - deposit\n min_deposit = property_value >= 650_000 ? 0.2 : 0.05\n max_multiplier = 5 # how many annual income can be borrowed\n deposit >= property_value * min_deposit && (salary * max_multiplier >= loan_amount || deposit >= property_value * 0.75)\nend",
"def prorated_price_for(year,month)\n m_days = amount_of_days_reserved_in(year,month)\n \n return 0 if m_days == 0\n \n if m_days == days_in(month)\n @monthly_price\n elsif m_days == days_in(month).round(-1) / 2\n @monthly_price / 2 # put this in here just to get line 2 of notes to pass ;)\n else\n (@monthly_price / days_in(month)) * m_days\n end\n end",
"def provide_mortgage_4?(salary, deposit, property_value, bankrupt)\n return false if bankrupt\n loan_amount = property_value - deposit\n min_deposit = property_value >= 650_000 ? 0.2 : 0.05\n max_multiplier = 5 # how many annual income can be borrowed\n deposit >= property_value * min_deposit && (salary * max_multiplier >= loan_amount || deposit >= property_value * 0.75)\nend",
"def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n \n if @population_density >= 200\n num_months = 0.5\n elsif @population_density >= 150\n num_months = 1\n elsif @population_density >= 100\n num_months = 1.5\n elsif @population_density >= 50\n num_months = 2\n else\n num_months = 2.5\n end\n\n puts \" and will spread across the state in #{num_months} months.\\n\\n\"\n\n end",
"def calculate\n # Percentage of understanding is calculated by following\n self.progress_rate = ((sum_of_point.to_f / total_count.to_f) * 100.00).round(2)\n end",
"def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0 #this can be made into a class attribute allowing a getter\n\n if @population_density >= 200\n speed += 0.5\n elsif @population_density >= 150\n speed += 1\n elsif @population_density >= 100\n speed += 1.5\n elsif @population_density >= 50\n speed += 2\n else\n speed += 2.5\n end\n #Print method can be removed allowing information to be printed in the driver code\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end",
"def nb_year(p0, percent, aug, p)\n years = 0\n while p >= p0 do\n p0 += (percent/100.0 * p0) + aug\n years += 1\n end\n p years\nend",
"def annual_bonus\n if @faculty.eligible_for_annual_bonus_payment?(@generation_date)\n last_annual_bonus_paid_on = @faculty.last_annual_bonus_paid_on\n unless last_annual_bonus_paid_on.present?\n last_annual_bonus_paid_on = Date.new(@generation_date.year-1, @faculty.rule_engine(:bonus_payment_month)+1, 1)\n end\n EmployerContribution.belongs_to_employee(@faculty).generated_after(last_annual_bonus_paid_on).inject(0){|sum, contrib| sum+contrib.bonus_payment}\n end\n end",
"def calculate_life_plan(life_plan = LifePlan.new)\n results = []\n\n years_ahead = life_plan.total_years\n\n years_ahead.times do |year_count|\n year_results = calculate_next_year(\n life_plan.contribution_for(year_count),\n life_plan.withdraw_for(year_count)\n )\n\n @current_balance = year_results.average\n results << year_results\n end\n\n results\n end",
"def provide_mortgage_2?(salary, deposit, property_value) \n loan_amount = property_value - deposit\n min_deposit = property_value >= 650_000 ? 0.2 : 0.05 # ternary operator: expr ? value_if_true : value_if_false\n max_multiplier = 5 # how many annual incomes can be borrowed\n deposit >= property_value * min_deposit && salary * max_multiplier >= loan_amount\nend",
"def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n\n # if @population_density >= 200\n # speed += 0.5\n # elsif @population_density >= 150\n # speed += 1\n # elsif @population_density >= 100\n # speed += 1.5\n # elsif @population_density >= 50\n # speed += 2\n # else\n # speed += 2.5\n # end\n\n speed += case @population_density\n when 0...50\n 2.5\n when 50...100\n 2\n when 100...150\n 1.5\n when 150...200\n 1\n else\n 0.5\n end\n \n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end",
"def calculateInterest\n\t\tinterest = 0\n\t\[email protected] do |trans|\n\t\t\tinterest += -1 * ((31 - trans[0]) * trans[-1] * @APR / 365)\n\t\tend\n\t\tinterest < 0 ? 0 : interest.round(2)\n\tend",
"def calc_years_till\n (calc_months_till / 12.00).round(2)\n end",
"def month_payment(dept)\n result = Hash.new\n credit_percent = (dept * @percent/12)\n credit_payment = (@base - credit_percent)\n result[:res_credit_payment] = credit_payment\n result[:res_credit_percent] = credit_percent\n result[:res_credit] = @base\n result[:res_remainder] = (dept - credit_payment)\n result\n end",
"def paid_principal(amortization=self.amortization, duration=self.holding_period_mth)\n total_payment = -amortization.payments[0...duration].sum\n total_interest = amortization.interest[0...duration].sum\n\n total_payment - total_interest\n end",
"def months_to_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n\n if @population_density >= 200\n 0.5\n elsif @population_density >= 150\n 1\n elsif @population_density >= 100\n 1.5\n elsif @population_density >= 50\n 2\n else\n 2.5\n end\n\n\n end",
"def calculate_max_mortgage(params, interest_rate)\n number_of_payments = SCHEDULE_MAP[params['payment_schedule']] * params['amortization_period']\n nominal_interest_rate = (interest_rate / SCHEDULE_MAP[params['payment_schedule']]) / 100\n\n numerator = params['payment_amount'] * ((1 + nominal_interest_rate)**number_of_payments - 1)\n denominator = nominal_interest_rate * (1 + nominal_interest_rate)**number_of_payments\n\n max_mortgage = (numerator / denominator).round(2)\n max_mortgage += params['down_payment'] if params['down_payment'].present?\n max_mortgage\n end",
"def speed_of_spread#in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n\n if @population_density >= 200\n speed += 0.5\n elsif @population_density >= 150\n speed += 1\n elsif @population_density >= 100\n speed += 1.5\n elsif @population_density >= 50\n speed += 2\n else\n speed += 2.5\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end",
"def loyalty_allowance\n if @faculty.eligible_for_loyality_allowance?(@generation_date)\n ((component_criterias[:loyalty_allowance]/100)*basic) #* eligibility_fraction)\n end\n end",
"def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n time_in_months = 0.0\n \n case @population_density\n when 1..49 then time_in_months += 2.5\n when 50..99 then time_in_months += 2\n when 100..149 then time_in_months += 1.5\n when 150..199 then time_in_months += 1.0\n else time_in_months += 0.5\n end\n\n puts \" and it will spread across the state in #{time_in_months} months.\\n\\n\"\n\n end",
"def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n @months_to_spread = 0.0\n\n if @population_density >= 200\n @months_to_spread += 0.5\n elsif @population_density >= 150\n @months_to_spread += 1\n elsif @population_density >= 100\n @months_to_spread += 1.5\n elsif @population_density >= 50\n @months_to_spread += 2\n else\n @months_to_spread += 2.5\n end\n\n end",
"def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n @months_to_spread = 0.0\n\n if @population_density >= 200\n @months_to_spread += 0.5\n elsif @population_density >= 150\n @months_to_spread += 1\n elsif @population_density >= 100\n @months_to_spread += 1.5\n elsif @population_density >= 50\n @months_to_spread += 2\n else\n @months_to_spread += 2.5\n end\n\n end",
"def initialize(args)\n @old_loan_amount = args[:old_loan_amount].to_f\n @periods = args[:periods].to_f\n @new_interest_rate = args[:new_interest_rate].to_f / 12\n @new_interest_rate_cash_out = args[:new_interest_rate_cash_out] / 12\n @lender_credit = args[:lender_credit].to_f\n @lender_credit_cashout = args[:lender_credit_cashout].to_f\n @estimated_closing_costs = args[:estimated_closing_costs].to_f\n @estimated_closing_costs_cash_out = args[:estimated_closing_costs_cash_out].to_f\n @current_home_value = args[:current_home_value].to_f\n @original_loan_date = args[:original_loan_date]\n @old_interest_rate = args[:old_interest_rate] / 12\n @start_due_date = (Time.zone.now + 2.months).beginning_of_month\n end",
"def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n\n if @population_density >= 200\n speed += 0.5\n elsif @population_density >= 150\n speed += 1\n elsif @population_density >= 100\n speed += 1.5\n elsif @population_density >= 50\n speed += 2\n else\n speed += 2.5\n end\n\n \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end",
"def speed_of_spread #in months\r\n # We are still perfecting our formula here. The speed is also affected\r\n # by additional factors we haven't added into this functionality.\r\n speed = 0.0\r\n\r\n # if @population_density >= 200\r\n # speed += 0.5\r\n # elsif @population_density >= 150\r\n # speed += 1\r\n # elsif @population_density >= 100\r\n # speed += 1.5\r\n # elsif @population_density >= 50\r\n # speed += 2\r\n # else\r\n # speed += 2.5\r\n # end\r\n\r\n puts \" and will spread across the state in #{@speed} months.\\n\\n\"\r\n\r\n end",
"def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n if @population_density >= 200\n @number_of_months += 0.5\n elsif @population_density >= 150\n @number_of_months += 1\n elsif @population_density >= 100\n @number_of_months += 1.5\n elsif @population_density >= 50\n @number_of_months += 2\n else\n @number_of_months += 2.5\n end\n end",
"def interest\n return (@capital / 100) * @rate\n end",
"def present_given_annuity(annuity, interest, term)\n (annuity.to_f * (((1 + interest.to_f) ** term) -1) / (interest.to_f * (1 + interest.to_f) ** term )).round(4)\n end",
"def monthly_costs_toward_getting_out_dh\n\t$costs_toward_dh = []\n\n\t$pokitdok_call.each do |drug|\t\n\t\t#Patient pays no more than 45% of ⇒ plan’s cost for covered brand-name prescription drugs + pharmacy’s dispensing fee\n\t\tif drug['tier'] == 1\n\t\t\t$costs_toward_dh << drug['retail']['total_cost_30_day']['amount'].to_f * 0.58\n\n\t\t#patient pays 58% of cost, 58% of cost goes toward geting out of donut hole\t\t\t\n\t\telsif drug['tier'] == 2\n\t\t\t$costs_toward_dh << drug['retail']['total_cost_30_day']['amount'].to_f * 0.45\n\n\t\telsif drug['tier'] == 3\n\t\t\t$costs_toward_dh << drug['retail']['total_cost_30_day']['amount'].to_f * 0.45\n\t\tend\n\tend\n\n\t$costs_toward_dh.inject(:+).round(2)\nend",
"def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n months = 0.0\n case population_range\n when \"low\"\n months = 2.5\n when \"low_med\"\n months = 2\n when \"med\"\n months = 1.5\n when \"med_high\"\n months = 1\n when \"high\"\n months = 0.5\n end\n\n # puts \" and will spread across the state in #{speed} months.\\n\\n\"\n months\n end",
"def grow_one_year(starting_balance, growth_rate)\n starting_balance * (1.0 + growth_rate)\nend",
"def target_number_of_ama_hearings(time_period)\n decisions_in_days = (time_period.to_f / 1.year) * nonpriority_decisions_per_year\n (decisions_in_days * docket_proportions[:hearing]).round\n end",
"def calculate_interest(principal, roi, time)\n rate = roi.to_f / 100\n amount = principal.to_f * (1 + rate * time.to_f)\n\n amount\nend"
] | [
"0.7767276",
"0.741205",
"0.7370564",
"0.7325309",
"0.72984415",
"0.7290021",
"0.7176764",
"0.7147285",
"0.7076989",
"0.7007485",
"0.6972636",
"0.69348717",
"0.6841337",
"0.6819061",
"0.67889756",
"0.67024094",
"0.66294926",
"0.6604359",
"0.6534027",
"0.64861894",
"0.6484733",
"0.64543164",
"0.6438877",
"0.6424425",
"0.64110273",
"0.6397221",
"0.6319518",
"0.63123655",
"0.62747014",
"0.6272118",
"0.6257523",
"0.6237943",
"0.6235766",
"0.6224966",
"0.6180172",
"0.6163547",
"0.61285603",
"0.61224633",
"0.61148804",
"0.60943735",
"0.6091476",
"0.607741",
"0.6073206",
"0.6067293",
"0.60540164",
"0.6044624",
"0.60380834",
"0.60219085",
"0.60209846",
"0.6017113",
"0.5990237",
"0.59756035",
"0.59713376",
"0.5959818",
"0.5948908",
"0.5944571",
"0.5907845",
"0.5881723",
"0.5875601",
"0.58548343",
"0.58409667",
"0.58250904",
"0.5821564",
"0.5814215",
"0.58060384",
"0.5803436",
"0.58028316",
"0.57950383",
"0.57912564",
"0.5774853",
"0.57502717",
"0.5746063",
"0.5744993",
"0.57393044",
"0.57318974",
"0.57294047",
"0.5724689",
"0.5722095",
"0.5716749",
"0.5716168",
"0.5715228",
"0.57121867",
"0.5704948",
"0.57032263",
"0.56995934",
"0.569865",
"0.56939733",
"0.5688687",
"0.5686592",
"0.5686592",
"0.56821674",
"0.5667508",
"0.56652284",
"0.56598175",
"0.56434727",
"0.564282",
"0.56385916",
"0.56359243",
"0.5631893",
"0.56302553",
"0.56265056"
] | 0.0 | -1 |
Recursive Depth First Search | def find(root, data)
current_node = root
if current_node.title == data
return current_node
elsif current_node.left != nil
find(current_node.left, data)
elsif current_node.right != nil
find(current_node.right, data)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def DFS(root, target)\n ## base case: \n return nil if root.nil?\n return root if root.value == target\n ##indecutive step: \n ## DFS on the left side then DFS on the right side \n root.children.each do |child|\n search_result = DFS(child, target) ## better to save the actual value then check the value then return nil\n return search_result unless search_result.nil?\n end \n return nil\nend",
"def depth_first_search(node)\n return if node.nil?\n node.visit\n node.connections.each do |conn|\n depth_first_search(conn) unless conn.visited\n end\nend",
"def dfs(root, target)\n return root if root.value == target\n root.children.each do |child|\n search_result = dfs(child, target)\n return search_result unless search_result.nil?\n end\n\n nil\nend",
"def depth_first_search(find,tree)\n current = tree[0]\n answer = \"\"\n stack = [tree[0]]\n visited = [tree[0]]\n \n condition = false\n until condition == true\n connections = [current.find_right_child[0],current.find_left_child[0]].compact\n puts current.value\n puts connections.count\n puts \"---\"\n \n if current.value == find\n answer = current\n condition = true\n elsif visited.count == tree.count\n answer = nil\n condition = true\n else\n if connections.count < 1\n stack.pop\n current = stack[-1]\n elsif connections.count == 1\n if visited.include?(connections[0])\n stack.pop\n current = stack[-1]\n else\n current = connections[0]\n stack.push(current)\n visited.push(current)\n end\n else\n if visited.include?(connections[0]) && visited.include?(connections[1])\n stack.pop\n current = stack[-1]\n elsif !visited.include?(connections[0])\n current = connections[0]\n stack.push(current)\n visited.push(current)\n else\n current = connections[1]\n stack.push(current)\n visited.push(current)\n end\n end\n end\n end\n puts answer ? answer : \"Value not found!\"\n puts answer.value if answer != nil\nend",
"def depth_search(data_to_find, node)\n if data_to_find < node.data && node.left\n @depth += 1\n depth_search(data_to_find, node.left)\n elsif data_to_find > node.data && node.right\n @depth += 1\n depth_search(data_to_find, node.right)\n elsif data_to_find == node.data\n @depth += 1\n else\n @depth = 0\n end\n end",
"def depth_search(node, proc)\n res = nil\n counter = 0\n number_of_children = node.children.length\n\n while counter < number_of_children\n return res if res\n\n child = node.children[counter]\n res = proc.call(child)\n return res if res\n\n res = depth_search(child, proc)\n counter += 1\n end\n res\n end",
"def depth_first_search(target)\n stack = [@root]\n visited = []\n\n until stack.empty?\n node = stack[-1]\n visited << node\n return \"Found target: #{target} at node #{node}\" if node.value == target\n if node.left && !visited.include?(node.left)\n stack << node.left\n elsif node.right && !visited.include?(node.right)\n stack << node.right\n else\n stack.pop\n end\n end\n end",
"def dfs_rec(target,current,array_length,stack,visited)\n left = current.find_left_child[0]\n right = current.find_right_child[0]\n parent = current.find_parent[0]\n if current.value == target\n return current\n elsif visited.length == array_length\n return nil\n elsif !left.nil? && !visited.include?(left)\n stack.push(left)\n visited.push(left)\n dfs_rec(target,left,array_length,stack,visited)\n elsif !right.nil? && !visited.include?(right)\n stack.push(right)\n visited.push(right)\n dfs_rec(target,right,array_length,stack,visited)\n else\n stack.pop\n dfs_rec(target,parent,array_length,stack,visited)\n end\nend",
"def dfs_recursive(query, node=@tree) \n return nil if node.nil?\n return node if query == node.value\n\n# left search equals if the left child is not nil then call the method with target & left child node parameters, otherwise is nil\n left_search = node.left_child != nil ? dfs_recursive(query, node.left_child) : nil\n\n# return if left search does not result in nil\n return left_search if left_search != nil\n right_search = node.right_child != nil ? dfs_recursive(query, node.right_child) : nil\n return right_search if right_search != nil \n end",
"def depth_first(node, visited = Set.new())\n return nil if visited.include?(node.val)\n\n puts node.val\n visited.add(node.val)\n\n node.neighbors.each do |neighbor|\n depth_first(neighbor, visited);\n end\nend",
"def recursive_search(path,current_depth)\n # If we haven't hit our max depth\n if current_depth < @depth \n sub_hash = @wiki\n # Follow our path down the hash\n path.each do |node|\n sub_hash = sub_hash[node]\n end\n\n # Expand this node of the sub-tree\n sub_hash.keys.each do |link|\n sub_hash[link] = get_links(\"http://en.wikipedia.org#{link}\")\n # Here's our magic recursion, add this node to the\n # path, increment our depth, and traverse that\n recursive_search(path+[link],current_depth+1)\n end\n\n end\nend",
"def depth_first_search(query)\n stack = [@tree]\n\n loop do\n# exit when empty stack\n return nil if stack.empty?\n\n# node is equal to top of stack\n node = stack.pop\n \n# return node if match\n return node if query == node.value\n\n# i think it is pushing every descendant of the parent?\n stack.push node.left_child if node.left_child != nil\n stack.push node.right_child if node.right_child != nil\n end\n end",
"def search_tree(node, depth = 0, path = [])\n node.each do |subnode|\n if subnode[TREE_NODE_NAMES[depth]].is_a?(Array)\n search_tree(subnode[TREE_NODE_NAMES[depth]], depth + 1, path + [subnode['id']])\n else\n # The deepest node is reached.\n # If an id found is interesting, preserve the path\n if ids.include?(subnode['id'])\n paths << path + [subnode['id']]\n ids_found << subnode['id']\n end\n\n # If all ids were found - stop searching\n return if ids - ids_found == []\n end\n end\n end",
"def depth_first_search!(node)\n node.marked = true\n node.type = \"M\"\n node.adj.each do |n|\n if n.marked == false\n depth_first_search(n)\n end\n end\n end",
"def depth_first_search_recursive(source)\n visited.add(source)\n\n source.neighbors.each do |neighbor|\n unless visited.include?(neighbor)\n depth_first_search_recursive(neighbor)\n meta[neighbor] = source\n end\n end\n end",
"def depth_first_search(target)\n # create an array that acts like a stack\n stack = [self]\n # visited array keeps the visited nodes\n visited = []\n \n # search until there are no nodes left\n until stack.length == 0\n # get the last element in the stack\n node = stack[-1]\n\n # mark current node as visited\n visited << node\n\n # return the current node if the target value found\n return node if node.value == target\n \n # if there is unvisited left node, add it to stack\n if node.left && !visited.include?(node.left)\n stack << node.left\n # else if there is unvisited right node, add it to stack\n elsif node.right && !visited.include?(node.right)\n stack << node.right\n # if there are no visited children, pop the node from stack\n else\n stack.pop\n end\n end\n nil\n end",
"def depth_first_search(data)\n node = nil\n @list << @root if @root\n\n until @list.empty?\n # Get next node from the stack\n node = @list.pop\n puts \"Visiting node #{node.value}\" if @debug\n break if node.value == data\n # Push each child on the stack, making sure the left child\n # will be popped off the stack first (LIFO)\n @list << node.right if node.right\n @list << node.left if node.left\n end\n @list.clear # remove any remaining items from the stack\n\t node\n end",
"def depth_first_search node= self.root, value\n\t\tstack =[node]\n\n\t\twhile stack.length > 0\n\t\t\tcurrent = stack.pop\n\t\t\treturn \"Value #{value} found in #{current.to_s}\" if current.value == value\n\t\t\tstack.push(current.left) if current.left\n\t\t\tstack.push(current.right) if current.right\n\t\tend\n\tend",
"def dfs_rec(tree, value)\n return nil if tree.nil?\n\n p tree.value\n return tree if tree.value == value\n\n left = dfs_rec(tree.left, value)\n return left if left && left.value == value\n\n\n right = dfs_rec(tree.right, value)\n return right if right && right.value == value\n\nend",
"def depth_first_search(target)\n stack = Array.new\n stack.push(@root)\n\n while !stack.empty?\n\n element = stack.pop\n\n return element if element.value == target\n\n stack.push(element.leftchild) if !element.leftchild.nil?\n stack.push(element.rightchild) if !element.rightchild.nil?\n\n end\n\n return nil\n end",
"def dfs(tree, target)\n\n node_stack = [ ]\n\n #push root\n node_stack.push(tree[0])\n\n # can also set current_node and do `while current_node`\n while node_stack.length > 0\n\n # pop first\n node = node_stack.pop\n\n # then do or look for something, generally w conditional\n if node == target\n return true\n else\n # seems multiple ways to do, but doing right before left\n # makes sense to me, even though most do left before right.\n # With my way, the left is pop'd first and you go down left\n # side first\n\n #### BELOW IS NOT RIGHT -- THERE HAS TO BE SOME RECURSSION HERE\n # This actually is starting to make sense: https://github.com/brianstorti/ruby-graph-algorithms/blob/master/depth_first_search/depth_first_search.rb\n #http://haozeng.github.io/blog/2014/01/05/trees-in-ruby/\n #https://github.com/breadoliveoilsalt/depth-first-search-lab-v-000/blob/solution/index.js\n if node.left\n node_stack.push(node.left)\n end\n if node.right\n node_stack.push(node.right)\n end\n end\n end\n\n return false\n\nend",
"def dfs_rec(tree, value)\n return nil if tree.nil?\n\n left = dfs_rec(tree.left, value)\n return left if left && left.value == value\n\n\n right = dfs_rec(tree.right, value)\n return right if right && right.value == value\n\n p tree.value\n return tree if tree.value == value\n\nend",
"def dfs_rec(value, node = Node.get_root_node)\n\n if !node.nil?\n puts \"Searching node #{node.value}\"\n if !node.value.nil?\n if node.value == value\n puts \"Found #{value} at node #{node}!\"\n return node\n end\n end\n else\n nil\n end\n\n left_child = node.left_child\n right_child = node.right_child\n\n if left_child.nil?\n puts \"No left child.\"\n else\n puts \"Left child is #{left_child.value}\"\n end\n\n if right_child.nil?\n puts \"No right child.\"\n else\n puts \"Right child is #{right_child.value}.\"\n end\n\n left_child.nil? ? nil : dfs_rec(value, left_child)\n right_child.nil? ? nil : dfs_rec(value, right_child)\nend",
"def dfs(root, depth)\n return if root.nil?\n @f[depth] = @f[depth].to_i + root.val\n dfs(root.left, depth + 1) if root.left\n dfs(root.right, depth + 1) if root.right\nend",
"def depth_first_search(target)\n return @root if @root.value == target\n search_stack = [@root]\n until search_stack.empty?\n test_node = search_stack.pop\n\n if test_node.value == target\n return test_node\n else\n search_stack << test_node.right_child unless test_node.right_child.nil?\n search_stack << test_node.left_child unless test_node.left_child.nil?\n end\n end\n\n nil\n\tend",
"def dfs_rec(tree, value, args = {})\r\n verbose = args.fetch(:verbose, false)\r\n return nil if tree == nil \r\n return nil if tree.visited == true\r\n tree.visited = true\r\n return tree if tree.value == value\r\n puts \"current = #{tree}\" if verbose\r\n left = dfs_rec(tree.children[0], value, args)\r\n return left if left != nil\r\n right = dfs_rec(tree.children[1], value, args)\r\n return right # if right != nil\r\n end",
"def depth_first_search\n visited = {}\n timestamp = {}\n tree_edges = {}\n back_edges = {}\n cross_edges = {}\n forward_edges = {}\n count = 0\n\n dfs_visit = Proc.new { |from|\n\tvisited[from] = true\n\ttimestamp[from] = [count += 1]\n\t@graph[from].each_key do |to|\n\t if visited[to]\n\t if timestamp[to].size > 1\n\t if timestamp[from].first < timestamp[to].first\n\t\t# forward edge (black)\n\t\tp \"#{from} -> #{to} : forward edge\" if $DEBUG\n\t\tforward_edges[from] = to\n\t else\n\t\t# cross edge (black)\n\t\tp \"#{from} -> #{to} : cross edge\" if $DEBUG\n\t\tcross_edges[from] = to\n\t end\n\t else\n\t # back edge (gray)\n\t p \"#{from} -> #{to} : back edge\" if $DEBUG\n\t back_edges[from] = to\n\t end\n\t else\n\t # tree edge (white)\n\t p \"#{from} -> #{to} : tree edge\" if $DEBUG\n\t tree_edges[to] = from\n\t dfs_visit.call(to)\n\t end\n\tend\n\ttimestamp[from].push(count += 1)\n }\n\n @graph.each_key do |node|\n\tunless visited[node]\n\t dfs_visit.call(node)\n\tend\n end\n return timestamp, tree_edges, back_edges, cross_edges, forward_edges\n end",
"def depth_first_search(array)\n array.append(self.name)\n self.children.each do |child|\n child.depth_first_search(array)\n end\n return array\n\n end",
"def DFS(rootNode,searchValue)\n\tstack = []\n\tpath = []\n\tpath[0] =rootNode\n\t# Initializes the stack with rootNode\n\tstack[0]=rootNode\n\t# while there is something in the stack keep running\n\twhile stack.length != 0\n\t\t# if checkFunction(searchValue,stack[0]) == true\n\t\tif checkFunction(searchValue,stack[0]) == true\n\t\t\t# return true and path\n\t\t\treturn TracePath(stack[0])\n\t\t# else\n\t\telse\n\t\t\t#remove stack[0] from the stack and inmidiately stores it in temp\n\t\t\ttemp = stack.shift\n\t\t\t#if there is right brach in the formely stack[0] now stored in temp\n\t\t\tif temp.getRB\n\t\t\t\t#insert the rigth branch at the beginning of the stack\n\t\t\t\tstack.unshift(temp.getRB)\n\t\t\tend\n\t\t\t#if there is left branch in the formely stack[0] now stored in temp\n\t\t\tif temp.getLB\n\t\t\t\t#insert the left brach at the beginning of the stack.\n\t\t\t\tstack.unshift(temp.getLB)\n\t\t\t\t\n\t\t\tend\n\t\t\t#insert the temp in the path array to keep track of the path used for the search\n\t\t\tputs temp.display\n\t\tend\n\tend\n\t# return false becuase at this point the function did not find the value\n\treturn false\nend",
"def dfs_object(root_node, target)\n #two base cases\n return root_node if root_node.value == target\n # return nil if root_node.parent.nil? #when there are no parents, we know we're back at the actual root of the tree\n\n root_node.children.each do |child_node|\n result = dfs(child_node, target)\n\n #returning nil at this point would cut short\n if result #is not nil\n return result\n end\n end\n\n nil\nend",
"def depth_first_search(value, stack = [Node.get_root_node])\n node = stack[0]\n\n if !node.value.nil?\n puts \"Searching node #{node.value}...\"\n if node.value == value\n puts \"Found #{value} at node #{node}!\"\n return node\n end\n end\n\n left_child = node.left_child\n right_child = node.right_child\n\n if !left_child.nil?\n puts \"Left child is #{left_child.value}.\"\n else\n puts \"No left child.\"\n end\n\n if !right_child.nil?\n puts \"Right child is #{right_child.value}.\"\n else\n puts \"No right child.\"\n end\n\n if !left_child.nil?\n stack << left_child\n stack.shift\n return node if !depth_first_search(value, stack).nil?\n else\n nil\n end\n\n if !right_child.nil?\n stack << right_child\n stack.shift\n return node if !depth_first_search(value, stack).nil?\n else\n nil\n end\n\nend",
"def depthFirstSearch(target, node)\n\treturn nil if node.nil? # checks if node is nil\n\tif node.data == target\n\t\treturn node\n\telse\n\t\tnode.children.each do |n|\n\t\t\tt = depthFirstSearch(target, n) # checks child for target\n\t\t\tnext if t.nil?\n\t\t\treturn t\n\t\tend\n\tend\n\treturn nil\nend",
"def depth_first_search(tree, value, args = {})\r\n verbose = args.fetch(:verbose, false)\r\n return nil if tree == nil\r\n next_node = [tree]\r\n while !next_node.empty?\r\n current = next_node.pop\r\n if verbose\r\n puts \"current = #{current}\"\r\n puts \"head = #{next_node[0]}\"\r\n end\r\n # visited not strictly necessary for future proofs it \r\n if current.visited == false\r\n current.visited = true\r\n return current if current.value == value\r\n current.children.each { |child| next_node.push child if child } \r\n end\r\n end\r\n nil\r\n end",
"def search_recursive(root,target_value)\n\n return root if root.payload == target_value\n\n root.children.each do |child|\n node = search_recursive(child,target_value)\n return node if node\n end\n\n return nil\n\nend",
"def depth_first_search(tree, value)\n tgt_node = nil\n \n stack = Array(tree)\n \n while !stack.empty?\n cur_node = stack.pop\n \n\tif cur_node.value == value\n\t tgt_node = cur_node\n\t break\n\tend\n\t\n\tcur_node.children.reverse_each { |child| stack.push(child) unless child.nil? }\n end\n \n tgt_node\nend",
"def depthfirst?\n false\n end",
"def dfs(root, result)\n return if root.nil?\n result << root.val if root.left.nil? && root.right.nil?\n dfs(root.left, result)\n dfs(root.right, result)\nend",
"def depth_first_search(v)\r\n if @root == nil\r\n puts \"Tree is empty\"\r\n end\r\n queue = [@root]\r\n current_node = @root\r\n while not queue.empty?\r\n current_node = queue[0]\r\n queue.unshift(current_node.left_child) unless current_node.left_child.nil?\r\n queue.unshift(current_node.right_child) unless current_node.right_child.nil?\r\n if current_node.value == v\r\n return \"Found at node \" + current_node.to_s\r\n end\r\n queue.shift\r\n end\r\n return \"Value not found.\"\r\n end",
"def depth_first_search(value)\n search_stack = [@root_node]\n\n until search_stack.empty?\n curr_node = search_stack.pop\n return curr_node if curr_node.value == value\n search_stack << curr_node.left unless curr_node.left.nil?\n search_stack << curr_node.right unless curr_node.right.nil?\n end\n return nil\n end",
"def depth_first_search(adj_matrix, source_index, end_index)\n node_stack = [source_index]\n # The code uses a forever loop and then breaks when we encounter certain conditions.\n loop do\n curr_node = node_stack.pop\n return false if curr_node == nil\n return true if curr_node == end_index\n\n # Out of the adjacency matrix, pick the “children” of curr_node by checking the 1’s in the adjacency matrix\n children = (0..adj_matrix.length-1).to_a.select do |i| \n adj_matrix[curr_node][i] == 1\n end\n \n # Take those nodes and push them onto the end of the stack\n node_stack = node_stack + children\n end\n end",
"def depth_of(data_to_find)\n @depth = 0\n if @head.nil?\n return @depth\n else\n depth_search(data_to_find, head)\n end\n return @depth\n end",
"def depth_first_search(target)\n stack = [@root]\n while ! stack.empty?\n node = stack.pop\n if node.value == target\n return node\n else \n if node.value < target && node.right_child != nil\n stack = stack << node.right_child\n end\n if node.value > target && node.left_child != nil\n stack = stack << node.left_child\n end\n end\n end\n return nil\n end",
"def dfs(tree)\n # Return the tree if the root value matches the search value\n if @stack[-1].nil?\n return nil\n elsif @stack[-1]['value'] == @value || @stack[-1] == @value\n return @stack[-1]\n end\n \n # Add left tree to the stack if it exists, otherwise the right branch if it exists\n if @stack[-1]['branches']['left'].nil? == false\n @stack << tree['branches']['left']\n dfs(@stack[-1])\n elsif @stack[-1]['branches']['right'].nil? == false\n @stack << tree['branches']['right']\n elsif @stack[-1]['branches']['left'].nil? == false && @stack[-1]['branches']['right'].nil? == false\n @stack.pop\n end\n \n end",
"def depth_first_search\n visited = {}\n timestamp = {}\n tree_edges = {}\n back_edges = {}\n cross_edges = {}\n forward_edges = {}\n count = 0\n\n # begin workaround removing depencency to order of Hash#each\n if @index.empty? then\n preference_of_nodes = nil\n else\n preference_of_nodes = {}.merge(@index)\n i = preference_of_nodes.values.max\n @graph.each_key do |node0|\n preference_of_nodes[node0] ||= (i += 1)\n end\n end\n # end workaround removing depencency to order of Hash#each\n\n dfs_visit = Proc.new { |from|\n visited[from] = true\n timestamp[from] = [count += 1]\n ary = @graph[from].keys\n # begin workaround removing depencency to order of Hash#each\n if preference_of_nodes then\n ary = ary.sort_by { |node0| preference_of_nodes[node0] }\n end\n # end workaround removing depencency to order of Hash#each\n ary.each do |to|\n if visited[to]\n if timestamp[to].size > 1\n if timestamp[from].first < timestamp[to].first\n \t# forward edge (black)\n \tp \"#{from} -> #{to} : forward edge\" if $DEBUG\n \tforward_edges[from] = to\n else\n \t# cross edge (black)\n \tp \"#{from} -> #{to} : cross edge\" if $DEBUG\n \tcross_edges[from] = to\n end\n else\n # back edge (gray)\n p \"#{from} -> #{to} : back edge\" if $DEBUG\n back_edges[from] = to\n end\n else\n # tree edge (white)\n p \"#{from} -> #{to} : tree edge\" if $DEBUG\n tree_edges[to] = from\n dfs_visit.call(to)\n end\n end\n timestamp[from].push(count += 1)\n }\n\n ary = @graph.keys\n # begin workaround removing depencency to order of Hash#each\n if preference_of_nodes then\n ary = ary.sort_by { |node0| preference_of_nodes[node0] }\n end\n # end workaround removing depencency to order of Hash#each\n ary.each do |node|\n unless visited[node]\n dfs_visit.call(node)\n end\n end\n return timestamp, tree_edges, back_edges, cross_edges, forward_edges\n end",
"def dfs(target)\n return self if self.value == target\n # debugger\n self.children.each do |node|\n dfs(node)\n # if node.value == target\n # return node\n # else\n # node.dfs(target)\n # end\n end\n return nil if self.children.empty?\n p new_arr\n end",
"def dfs_rec(target, current_node=@root)\n return if current_node.nil?\n return current_node if current_node.value == target\n dfs_rec(target, current_node.left_child) ||\n dfs_rec(target, current_node.right_child)\n\tend",
"def depth_helper(node, arr, depth)\n if node.left.nil? && node.right.nil? \n arr << depth\n return\n else \n depth += 1 \n if node.left\n depth_helper(node.left, arr, depth) \n end \n if node.right\n depth_helper(node.right, arr, depth)\n end \n end \n end",
"def iterative_depth_first(target)\n return self if @value == target\n stack = []\n stack << self\n while !stack.empty?\n popped = stack.pop\n return popped if popped.get_value == target\n right_child = popped.get_right_pointer\n if !right_child.nil?\n stack << right_child\n end\n left_child = popped.get_left_pointer\n if !left_child.nil?\n stack << left_child\n end\n end\n return nil\n end",
"def tree_search(problem, fringe)\n # \"\"\"Search through the successors of a problem to find a goal.\n # The argument fringe should be an empty queue.\n # Don't worry about repeated paths to a state. [Fig. 3.8]\"\"\"\n # Since we dont worry about repeated paths this can lead to infinite loops\n fringe.append(Node.new(problem.initial))\n while fringe.len > 0\n node = fringe.pop()\n return node if problem.goal_test(node.state) if node\n fringe.extend(node.expand(problem)) if node\n end\n return nil\nend",
"def depth_first(node, target)\n if node.children\n node.children.each do |child|\n depth_first(child, target)\n end\n end\n return 'Found your target' if node.payload == target\n 'No luck'\nend",
"def dfs(node, target)\n return nil if (node.nil?) \n return node if (node.val == target) \n left = dfs(node.left, target)\n right = dfs(node.right, target)\n left || right\nend",
"def dfs(root, target)\n return false if root.nil?\n return true if root.val == target\n\n return dfs(root.left, target) || dfs(root.right, target)\nend",
"def depth_first(value)\n\tend",
"def dfs(root)\n return if root.nil?\n @stack << root\n @hash[root] = [root.val]\n @stack.each do |node|\n @hash[node] << root.left&.val\n @hash[node] << root.right&.val\n end\n dfs(root.left)\n dfs(root.right)\n @stack.pop\nend",
"def dfs(root, sum, flag)\n return if root.nil?\n @count += 1 if root.val == sum\n dfs(root.left, sum - root.val, false)\n dfs(root.right, sum - root.val, false)\n if flag\n dfs(root.left, sum, true)\n dfs(root.right, sum, true)\n end\nend",
"def dfs_rec(target, node = @root)\n return \"Found target: #{target} at node #{node}\" if node.value == target # base case\n\n left_check = dfs_rec(target, node.left) if node.left\n right_check = dfs_rec(target, node.right) if node.right\n\n return left_check if left_check\n return right_check if right_check\n end",
"def dfs_rec(data, node = @root)\n if node\n puts \"Visiting node #{node.value}\" if @debug\n if data != node.value\n left = dfs_rec(data, node.left)\n if !left\n node = dfs_rec(data, node.right)\n else\n node = left\n end\n end\n end\n node\n end",
"def depth\n if empty?\n 0\n else\n if @left==nil || @right==nil\n if (@left==nil&&@right==nil) then 1\n else -1\n end\n else\n left, right = @left.depth, @right.depth\n if left==-1||right==-1||left!=right then -1\n else 1+left\n end\n end\n end\n end",
"def depth_first_search_pre_order_with_debug(data)\n search_order = [] # For Debug output\n stack = [@root]\n node_match = nil\n match_found = false\n until stack.empty? || match_found || @root.nil?\n cur_node = stack.pop\n next_node_value = cur_node.nil? ? \"nil\" : cur_node.value # For Debug output\n search_order << next_node_value # For Debug output\n if cur_node.value == data\n match_found = true\n node_match = cur_node\n end\n right = cur_node.right_child\n stack.push(right) unless right.nil?\n left = cur_node.left_child\n stack.push(left) unless left.nil?\n end\n puts \"Pre_order depth-first search order for nodes visited:\" # For Debug output\n p search_order # For Debug output\n puts \"\\nTotal nodes visited: #{search_order.size}\" # For Debug output\n return node_match\n end",
"def recursive => nil",
"def depth_first_recursion(v, visited)\n # Mark the current node as visited and print it\n visited[v] = true\n # print v.to_s + ' '\n\n head = @adjList[v]\n\n head.each_index do |index|\n n = head[index]\n depth_first_recursion(n, visited) unless visited[n]\n end\n end",
"def dfs_rec(target)\n dfs_recursive_helper(target,@root)\n end",
"def bfs_search(root)\n queue = []\n\n root.marked = true\n queue.push(root)\n\n while queue.length != 0\n current = queue.shift\n visit(current)\n\n current.adjacent.each do |node|\n if !node.marked\n node.marked = true\n queue.push(node)\n end\n end\n end\nend",
"def bsearch_tree(node, target)\n return target if node == target\n y = nil\n node.each do |x|\n if x.is_a? node.class\n y = bsearch_tree(x, target)\n else\n return target if x == target\n end\n end\n y\nend",
"def dfs_levels(node, result, depth = 0)\n return if node.nil?\n\n result[depth] ||= [node.val.to_i, 1]\n\n result[depth] = [(result[depth].first + node.val.to_i), result[depth].last + 1]\n\n dfs_levels(node.left, result, depth + 1)\n dfs_levels(node.right, result, depth + 1)\nend",
"def dfs_rec node= self.root, value\n\t\tif node.value == value\n\t\t\treturn \"Value #{value} found in #{node.to_s}\"\n\t\telse\n\t\t\t dfs_rec(node.left, value) if node.left\n\t\t\t dfs_rec(node.right, value) if node.right\n\t\tend\n\tend",
"def dfs_recursive(vertex, goal_vertex)\n @stack.push(vertex) # Add vertex to frontier\n return 1 if vertex == goal_vertex # If goal_vertex is reached, return 1. ! Not necessarily shortest path !\n @explored[vertex.label] = true # Mark vertex as being explored\n vertex.edges.each { |edge| # Expand current vertex\n unless @explored.has_key? edge.label # If already explored, then ignore the vertex\n return 1 if dfs_recursive(edge, goal_vertex) == 1 # Recursively do depth_first on the vertices\n end\n }\n @stack.pop() #Backtracking so popping the vertex from the stack\n end",
"def dfs_iterative(target)\n stack = [self]\n\n until stack.empty?\n node = stack.pop\n\n return node if node.value == target\n\n node.children.each do |child|\n stack << child\n end\n end\n\n nil\n end",
"def traverse\n @result.clear\n @queue.clear\n\n @queue.enqueue(@node)\n @result.push @node\n\n\n while not @queue.empty?\n node = @queue.dequeue\n return @result unless node\n # puts \"Visiting node: #{node}\"\n return node if (@search and node==@search)\n node && node.children.each do |node|\n unless @result.include?(node)\n @result.push(node)\n @queue.enqueue(node)\n end\n end\n end\n return result\n end",
"def dfs(node)\n preorder, visited = [], []\n dfs_visit(node, visited, preorder)\n preorder\nend",
"def dfs(root, target_file, path = root.name)\n return path if root.name == target_file\n\n children = get_children(path)\n children.each do |child_path|\n child_node = Node.new(child_path.basename.to_s)\n root.children << child_node\n result = dfs(child_node, target_file, child_path)\n if result \n return result\n end\n end\n nil\nend",
"def search_dfs(node, target, visited)\n return if visited[node] == true\n return node if node == target\n visited[node] = true\n res = nil\n @graph[node].each do |nabe|\n if !visited[nabe]\n if (res = search_dfs(nabe, target, visited)) == target\n break\n end\n end\n end\n res\n end",
"def ids_recursive(vertex, goal_vertex, depth, max_depth)\n @stack.push(vertex) # Add vertex to frontier\n return 1 if vertex == goal_vertex # If goal_vertex is reached, return 1. ! Not necessarily shortest path !\n @stack.pop() && return if depth == max_depth\n @explored[vertex.label] = true # Mark vertex as being explored\n depth = depth + 1\n vertex.edges.each { |edge| # Expand current vertex\n unless @explored.has_key? edge.label # If already explored, then ignore the vertex\n return 1 if ids_recursive(edge, goal_vertex, depth, max_depth) == 1 # Recursively do depth_first on the vertices\n end\n }\n @stack.pop() #Backtracking so popping the vertex from the stack\n end",
"def find(rating)\n find_depth(rating, @root)\n end",
"def dfs_rec(cur_node, value)\n return nil if cur_node.nil?\n \n if cur_node.value == value\n\tcur_node\n else\n tgt_node = nil\n cur_node.children.each do |child| \n\t tgt_node = dfs_rec(child, value)\n\t break unless tgt_node.nil?\n\tend\n\ttgt_node\n end\nend",
"def dfs\n visited = Hash.new(false)\n @v.each do |vertex| \n visited.merge(explore(vertex)) if !visited[vertex]\n end\n return visited\n end",
"def dfs\n visited = {}\n vertexes.keys.each {|v| visited[v] = false}\n unvisited = find_first_unvisited visited\n search_results = []\n until unvisited.is_nothing?\n #find a depth first search tree and hash containing the order that each node is visited\n dpst = explore(unvisited.from_just)\n if dpst.is_nothing?\n return Nothing.new\n else\n dpst = dpst.from_just\n end\n if search_results.empty?\n search_results.push dpst\n else\n search_results.each_with_index do |result, i|\n tree = dpst[:tree]\n found = false\n result.each do |v|\n if tree[v] and result.length < tree.keys.length\n results[i] = dpst\n found = true\n break\n end\n end\n break if found\n end\n end\n # Mark each point in the path as visited\n dpst[:visit_order].each do |k|\n visited[k] = true\n end\n unvisited = find_first_unvisited visited\n end\n search_results\n end",
"def recursive_depth_first(target)\n match = @left.recursive_depth_first(target) unless @left.nil?\n return match unless match.nil?\n return self if @value == target\n return (@right.nil?) ? nil : @right.recursive_depth_first(target)\n end",
"def depth_traversal(node, &block)\n yield node.value # print the current block\n\n # recurse down to the left child\n depth_traversal(node.left, &block) if node.left\n\n # recurse down to the right child\n depth_traversal(node.right, &block) if node.right\nend",
"def breadth_first_search(find,tree)\n current = tree[0]\n answer = \"\"\n queue = []\n visited = [tree[0]]\n \n condition = false\n until condition == true\n connections = [current.find_right_child[0],current.find_left_child[0]].compact\n if current.value == find\n answer = current\n condition = true\n elsif visited.count == tree.count\n answer = nil\n condition = true\n else\n connections.each do |i|\n if i.value == find\n answer = i\n condition = true\n elsif !visited.include?(i)\n visited.push(i)\n queue.push(i)\n end\n end\n end\n current = queue.shift\n end\n puts answer ? answer : \"Value not found!\"\n puts answer.value if answer != nil\nend",
"def depth; end",
"def depth_first_search_pre_order(data)\n stack = [@root]\n node_match = nil\n match_found = false\n until stack.empty? || match_found || @root.nil?\n cur_node = stack.pop\n if cur_node.value == data\n match_found = true\n node_match = cur_node\n end\n right = cur_node.right_child\n stack.push(right) unless right.nil?\n left = cur_node.left_child\n stack.push(left) unless left.nil?\n end\n return node_match\n end",
"def test_depth_of_method\n tree = BinarySearchTree.new\n tree.insert(50, \"movie a\")\n tree.insert(45, \"movie b\")\n tree.insert(40, \"movie c\")\n tree.insert(35, \"movie d\")\n assert_equal 3, tree.depth_of(35)\n end",
"def depth_of(score)\n if include?(score) #This is calling the method on line 44\n 1 + @root_node.depth_of(score) \n else \n nil\n end \nend",
"def test_recursive_methods\n assert_equal 0, find_node(1).ancestors_r.size\n assert_equal 8, find_node(1).descendants_r.size\n assert_equal 4, find_node('1_1_2_1_1').ancestors_r.size\n end",
"def optimize_depth_array()\n\n @root = @all_depths[0].first[1]\n\n # for each depth in tree\n @all_depths[1..@all_depths.length-1].each do |depth|\n # for each item in depth (could be node or array of nodes)\n depth.each do |sec_id, item|\n if (item.class == Node)\n node = item\n parent = get_parent(node.path)\n parent.add_child(node)\n else # item is array of nodes\n item.each do |node|\n parent = get_parent(node.path)\n parent.add_child(node)\n end\n end\n end\n end\n\n end",
"def solution(t)\n # write your code in Ruby 2.2\n depth = 0\n childs = []\n\n childs << t.l if t.l\n childs << t.r if t.r\n\n while not childs.empty? do\n depth += 1\n\n cc = []\n childs.each do |t|\n cc << t.l if t.l\n cc << t.r if t.r\n end\n\n childs = cc\n end\n\n depth\nend",
"def breadth_first_search_with_debug(data)\n search_order = [] # For Debug output\n queue = [@root]\n node_match = nil\n match_found = false\n until queue.empty? || match_found || @root.nil?\n cur_node = queue.first\n next_node_value = cur_node.nil? ? \"nil\" : cur_node.value # For Debug output\n search_order << next_node_value # For Debug output\n if cur_node.value == data\n match_found = true\n node_match = cur_node\n else\n queue.push(cur_node.left_child) unless cur_node.left_child.nil?\n queue.push(cur_node.right_child) unless cur_node.right_child.nil?\n queue.shift\n end\n end\n puts \"Breadth-first search order for nodes visited:\" # For Debug output\n p search_order # For Debug output\n puts \"\\nTotal nodes visited: #{search_order.size}\" # For Debug output\n return node_match\n end",
"def recursiveTreeTraversal(element)\n if StereotypesHelper.hasStereotype(element, $veStereotype)\n findRefinedParameters(element)\n end\n for child in element.getOwnedElement()\n recursiveTreeTraversal(child)\n end\nend",
"def dfs_rec(data)\n @root.each { |node| return node if data == node.data }\n end",
"def traverse_tree?(positions, letters, game)\n return true if letters == []\n next_positions = indexes_of_letter(letters.shift, game)\n positions.each do |position|\n neighbours = adjacent_from_array(position, next_positions)\n return traverse_tree?(neighbours, letters, game) if neighbours.any?\n end\n return false\nend",
"def search(path, final_point)\n\n current = path.first\n puts \"current.center = #{current.center}\"\n puts \"final_point.center = #{final_point.center}\"\n puts \"path.size = #{path.size}\"\n puts \"path = #{path.map{ |p| [p.center,p.wp_visited?].flatten }}\"\n puts \"current.wp_visited? = #{current.wp_visited?}\"\n\nbinding.pry # => debugger\n\n if wp_distance2(current, final_point) < 1.0\n puts \"found\"\n return path.reverse\n end\n\n wp_adjacents = sort_and_filter(current.wp_adjacents, final_point)\n\n wp_adjacents.each do |wp|\n search(path.unshift(wp), final_point)\nbinding.pry # => debugger\n wp.wp_mark\n end\n end",
"def depth=(_arg0); end",
"def depth_first_search(vis = DFSVisitor.new(self), &b)\n each_vertex do |u|\n unless vis.finished_vertex?(u)\n vis.handle_start_vertex(u)\n depth_first_visit(u, vis, &b)\n end\n end\n end",
"def find_path(target)\n queue = [root_node]\n until queue.empty?\n p current_node = queue.shift\n p queue\n return current_node if current_node.value == target\n current_node.children.each do |child|\n queue << child\n end\n end\n nil\nend",
"def depth\n depth_support(self.root)\n end",
"def my_depth\n 1\n end",
"def bfs(root, target)\n return nil if target.nil? || root.nil? # nothing to do if there is no target or root to begin the search\n queue = Queue.new\n queue.enq(root)\n result = nil\n while !queue.empty?\n value = queue.deq\n p value[:value]\n if value[:value] == target\n result = value\n break\n end\n\n # keep moving the levels in tree by pushing left and right nodes of tree in queue\n queue.enq(value[:left]) if value[:left]\n queue.enq(value[:right]) if value[:right]\n end\n\n result # returns node found in BST else default value nil\nend",
"def inorder_traversal_rec(root)\n res = []\n inorder_dfs(root, res)\n res\nend",
"def search(alpha, beta, depth)\n return evaluate if depth == 0\n @nodes += 1\n generate_moves do |m|\n next unless make_move(m)\n x = -search(-beta, -alpha, depth - 1)\n unmake_move(m)\n if x > alpha\n return beta if x >= beta\n alpha = x\n @root = m if @ply == 0\n end\n end\n alpha\n end",
"def node_depths(root)\n sum_of_depths = 0\n stack = [{\"node\"=> root, \"depth\"=> 0}]\n\n while stack.length > 0\n node_info = stack.pop()\n node, depth = node_info[\"node\"], node_info[\"depth\"]\n if node.nil?\n next\n end\n sum_of_depths += depth\n stack.append({\"node\"=> node.left, \"depth\"=> depth + 1})\n stack.append({\"node\"=> node.right, \"depth\"=> depth + 1})\n end\n return sum_of_depths\n\nend"
] | [
"0.75888014",
"0.7499341",
"0.74279803",
"0.7419357",
"0.73943675",
"0.73359835",
"0.72105503",
"0.71925867",
"0.7169048",
"0.71621275",
"0.7159493",
"0.7157254",
"0.7154016",
"0.71169007",
"0.7078584",
"0.7065554",
"0.7062552",
"0.70263875",
"0.69791156",
"0.69565874",
"0.6943485",
"0.6921448",
"0.69196206",
"0.69144833",
"0.6910898",
"0.68431693",
"0.6833238",
"0.68221974",
"0.6821388",
"0.67565155",
"0.67505306",
"0.6740349",
"0.6739645",
"0.6734544",
"0.6733564",
"0.6732535",
"0.6713992",
"0.66778284",
"0.6676318",
"0.6665601",
"0.6658821",
"0.6647364",
"0.66341525",
"0.6618442",
"0.659086",
"0.6589279",
"0.6587202",
"0.6584525",
"0.65502846",
"0.6533219",
"0.6521603",
"0.6517001",
"0.6448865",
"0.6405538",
"0.6390084",
"0.6385618",
"0.63815385",
"0.637722",
"0.6363798",
"0.63630277",
"0.6361431",
"0.6358319",
"0.63433826",
"0.6338784",
"0.6330458",
"0.63197136",
"0.6307105",
"0.6288758",
"0.628348",
"0.626475",
"0.625951",
"0.625641",
"0.6250635",
"0.62504536",
"0.62308097",
"0.62277985",
"0.6224901",
"0.62203646",
"0.61935985",
"0.6170266",
"0.6166174",
"0.6165137",
"0.6146717",
"0.61303854",
"0.6127348",
"0.61115956",
"0.61022735",
"0.60869956",
"0.6079977",
"0.6078602",
"0.60774535",
"0.6072765",
"0.60648185",
"0.60567075",
"0.6055712",
"0.603905",
"0.60288423",
"0.6012225",
"0.601133",
"0.601116",
"0.6005056"
] | 0.0 | -1 |
Recursive Breadth First Search | def printf(children=nil)
new_children = []
if children == nil
children = [@root.left, @root.right]
puts @root.title.to_s + ": " + @root.rating.to_s
end
children.each do |ch|
if ch != nil
puts ch.title.to_s + ": " + ch.rating.to_s
new_children.push(ch.left) if ch.left
new_children.push(ch.right) if ch.right
end
end
if new_children != []
printf(new_children)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def use_breadth_first(item, graph, logic_function = ->(x){graph[x].empty?} , returned = \"steps\" )\r\n search_queue = []\r\n steps = {}\r\n search_queue = search_queue.concat(graph[item])\r\n searched = []\r\n #Setting up initial steps \r\n if !search_queue.empty?\r\n search_queue.each do |term|\r\n steps[term] = 1\r\n end\r\n end\r\n #Here goes the graph algorithm\r\n while !search_queue.empty?\r\n person = search_queue.shift()\r\n if !( searched.include?(person) )\r\n\r\n if logic_function.call(person)\r\n if returned == \"steps\"\r\n return steps[person]\r\n end\r\n if returned == \"found\"\r\n return true\r\n end\r\n else\r\n if !(graph[person].nil?) \r\n graph[person].each do |related|\r\n steps[related] = steps[person] + 1 #Setting up the steps of parents of the current element in the queue\r\n end\r\n search_queue = search_queue.concat(graph[person])\r\n end\r\n end\r\n\r\n end\r\n end\r\n return false\r\nend",
"def bfs_search(root)\n queue = []\n\n root.marked = true\n queue.push(root)\n\n while queue.length != 0\n current = queue.shift\n visit(current)\n\n current.adjacent.each do |node|\n if !node.marked\n node.marked = true\n queue.push(node)\n end\n end\n end\nend",
"def breadth_first_search(find,tree)\n current = tree[0]\n answer = \"\"\n queue = []\n visited = [tree[0]]\n \n condition = false\n until condition == true\n connections = [current.find_right_child[0],current.find_left_child[0]].compact\n if current.value == find\n answer = current\n condition = true\n elsif visited.count == tree.count\n answer = nil\n condition = true\n else\n connections.each do |i|\n if i.value == find\n answer = i\n condition = true\n elsif !visited.include?(i)\n visited.push(i)\n queue.push(i)\n end\n end\n end\n current = queue.shift\n end\n puts answer ? answer : \"Value not found!\"\n puts answer.value if answer != nil\nend",
"def breadth_first_search(data)\n node = nil\n @list << @root if @root\n\n until @list.empty?\n # get next node from the queue\n node = @list.shift\n puts \"Visiting node #{node.value}\" if @debug\n break if node.value == data\n # place each child in the queue, from left to right\n @list << node.left if node.left\n @list << node.right if node.right\n end\n @list.clear # remove any remaining items from the queue\n\t node\n end",
"def breadthFirstSearch(target, node)\n\tqueue = []\n\tqueue << node # creates array\n\tqueue.each do |n| # checks each child\n\t\treturn n if n.data == target\n\t\tn.children.each { |c| queue.push(c) }\n\tend\n\treturn nil # return if found nothing\nend",
"def bfs\n # this is 'really' a traversal, but this type of search is similar to what we'll be doing with graphs and it's called 'breadth first search'\n list = []\n return list if @root.nil?\n queue = [@root]\n\n until queue.empty?\n # big O of shift is O(n)\n current = queue.shift\n # how to check if current has a left subtree?\n queue.push(current.left) unless current.left.nil?\n queue.push(current.right) unless current.right.nil?\n\n list << { key: current.key, value: current.value}\n end\n end",
"def breadth_first_search(node, search_val = nil)\n return unless node\n visit_queue = [node]\n\n while (!visit_queue.empty?)\n node = visit_queue.shift\n node.visit\n return node if node.value == search_val\n node.connections.each do |conn|\n next if conn.marked\n conn.marked = true\n visit_queue.push(conn)\n end\n end\nend",
"def breadth_first_search node= self.root, value\n\t\tqueue = [node]\n\t\twhile queue.length > 0\n\t\t\tcurrent = queue.pop\n\t\t\treturn \"Value #{value} found in #{current.to_s}\" if current.value == value\n\t\t\tqueue.unshift(current.left) if current.left\n\t\t\tqueue.unshift(current.right) if current.right\n\t\tend\n\tend",
"def bfs_search(queue, item)\n root = @tree.root\n queue.add(root)\n current_node = queue.pop\n until current_node == item || current_node.nil?\n queue.add(current_node.left_child)\n queue.add(current_node.add_child)\n current_node = queue.pop\n end\n return current_node\nend",
"def traverse_bfs\n q = Queue.new\n q.push @tree\n \n loop do\n break if q.empty?\n node = q.shift\n if block_given?\n yield node\n else\n @visited << node.data\n end\n node.children.each{ |n| q.push n } if node.children\n end\n end",
"def bfs(root)\n # NOTE implement real queue for performance\n queue = []\n root.marked = true\n queue.push(root)\n\n while !queue.empty?\n node = queue.shift\n node.visit\n\n node.adjacent.each do |node|\n if node.marked == false\n node.marked = true\n queue.push(node)\n end\n end\n end\nend",
"def bfs(starting_node, target_value)\n return starting_node if starting_node.value == target_value\n queue = [starting_node]\n until queue.empty?\n queue += starting_node.neighbors\n queue.each { |neighbor| bfs(neighbor, tar) }\n end\n nil\nend",
"def breadth_first_search(target)\n queue = [@root]\n visited = []\n\n until queue.empty?\n node = queue[0]\n visited << node\n return \"Found target: #{target} at node #{node}\" if node.value == target\n if node.left && !visited.include?(node.left)\n queue << node.left\n end\n if node.right && !visited.include?(node.right)\n queue << node.right\n end\n queue.shift\n end\n end",
"def breadth_first_search_with_debug(data)\n search_order = [] # For Debug output\n queue = [@root]\n node_match = nil\n match_found = false\n until queue.empty? || match_found || @root.nil?\n cur_node = queue.first\n next_node_value = cur_node.nil? ? \"nil\" : cur_node.value # For Debug output\n search_order << next_node_value # For Debug output\n if cur_node.value == data\n match_found = true\n node_match = cur_node\n else\n queue.push(cur_node.left_child) unless cur_node.left_child.nil?\n queue.push(cur_node.right_child) unless cur_node.right_child.nil?\n queue.shift\n end\n end\n puts \"Breadth-first search order for nodes visited:\" # For Debug output\n p search_order # For Debug output\n puts \"\\nTotal nodes visited: #{search_order.size}\" # For Debug output\n return node_match\n end",
"def bfs(tree)\n Enumerator.new do |yielder|\n queue = [tree]\n while !queue.empty?\n node = queue.shift\n children = node[1..-1]\n yielder << node.first\n children.each do |child|\n queue << child\n end\n end\n end\nend",
"def breadth_first_search(tree, value)\n tgt_node = nil\n \n queue = Array(tree)\n \n while !queue.empty?\n cur_node = queue.shift \n \n\tif cur_node.value == value\n\t tgt_node = cur_node\n\t break\n\tend\n\t\n\tcur_node.children.each { |child| queue << child unless child.nil? }\n end\n \n tgt_node\nend",
"def tree_search(problem, fringe)\n # \"\"\"Search through the successors of a problem to find a goal.\n # The argument fringe should be an empty queue.\n # Don't worry about repeated paths to a state. [Fig. 3.8]\"\"\"\n # Since we dont worry about repeated paths this can lead to infinite loops\n fringe.append(Node.new(problem.initial))\n while fringe.len > 0\n node = fringe.pop()\n return node if problem.goal_test(node.state) if node\n fringe.extend(node.expand(problem)) if node\n end\n return nil\nend",
"def breadth_first_search(v)\r\n if @root == nil\r\n puts \"Tree is empty\"\r\n end\r\n queue = [@root]\r\n current_node = @root\r\n while not queue.empty?\r\n current_node = queue[0]\r\n if current_node.value == v\r\n return \"Found at node \" + current_node.to_s\r\n end\r\n queue << current_node.left_child if not current_node.left_child.nil?\r\n queue << current_node.right_child if not current_node.right_child.nil?\r\n queue.shift\r\n end\r\n return \"Value not found.\"\r\n end",
"def breadth_first_search target_value, root=@root\n return nil if empty?\n\n queue = [root]\n\n until queue.empty?\n current = queue.shift\n\n # Return value if found\n return current if current.value == target_value\n\n # Add children to the queue, if they exist\n queue << current.left unless current.left.nil?\n queue << current.right unless current.right.nil?\n end\n\n # returns nil if value not found\n nil\n end",
"def breadthFirstSearch(array)\n queue = [self]\n\n while queue.length > 0\n current = queue.shift\n array.append(current.name)\n for child in current.children\n queue.append(child)\n end\n end\n\n return array\n\n end",
"def breadth_first\n return do_breadth_first( [Node.new(@start)], Set.new, @dest)\n end",
"def breadth_first_search(target)\n queue = Array.new\n queue.unshift(@root)\n\n while !queue.empty?\n\n element = queue.shift\n\n return element if element.value == target\n\n queue << element.leftchild if !element.leftchild.nil?\n queue << element.rightchild if !element.rightchild.nil?\n\n end\n\n return nil\n\n end",
"def bread_first_search(first)\n puts sprintf(\"%-25s %s\", \"Queue: [ bottom - top ]\", \"Visited list\")\n enqueue(first)\n insert_visited(first)\n print\n\n while !queue.empty?\n element = dequeue # => |V|\n @source.fetch(element).each do |s| \n unless @visited.include?(s) # => |E|\n enqueue(s)\n @T.push([element,s]) \n insert_visited(s) \n end\n end\n print\n end\n # spanning tree\n p @T\n end",
"def bfs(root, target)\n queue = []\n queue << root\n\n until queue.empty?\n current = queue.shift\n\n next if current.nil?\n return true if current.val == target\n\n queue << current.left\n queue << current.right\n end\n\n return false\nend",
"def breadth_first_search(value)\n search_queue = [@root_node]\n\n until search_queue.empty?\n curr_node = search_queue.shift\n return curr_node if curr_node.value == value\n search_queue << curr_node.left unless curr_node.left.nil?\n search_queue << curr_node.right unless curr_node.right.nil?\n end\n return nil\n end",
"def printBreadthFirst()\n # println(\"printBreadthFirst\");\n #\n # // queues for pushing and saving all elements in \"breadth first search\" style\n # ArrayList items = new ArrayList();\n # ArrayList depths = new ArrayList();\n # ArrayList indicesParent = new ArrayList();\n #\n # // add first elements and startingpoint\n # items.add(this);\n # depths.add(0);\n # indicesParent.add(-1);\n #\n # // tmp vars for running in while loop\n # int index = 0;\n # int itemCount = 1;\n #\n # while (itemCount > index) {\n # FileSystemItem item = (FileSystemItem) items.get(index);\n # int depth = (Integer) depths.get(index);\n # int indexToParent = (Integer) indicesParent.get(index);\n #\n # // print four spaces for each level of depth + debug println\n # for (int i = 0; i < depth; i++) print(\" \");\n # println(index+\" \"+indexToParent+\"<-->\"+index+\" (\"+depth+\") \"+item.file.getName());\n #\n # // is current node a directory?\n # // yes -> push all children to the end of the items\n # if (item.file.isDirectory()) {\n # for (int i = 0; i < item.childCount; i++) {\n # items.add(item.children[i]);\n # depths.add(depth+1);\n # indicesParent.add(index);\n # }\n # itemCount += item.childCount;\n # }\n # index++;\n # }\n # println(index+\" files\");\n end",
"def breadth_first_search(root)\n visited = {}\n distance = {}\n predecessor = {}\n\n visited[root] = true\n distance[root] = 0\n predecessor[root] = nil\n\n queue = [ root ]\n\n while from = queue.shift\n next unless @graph[from]\n @graph[from].each_key do |to|\n unless visited[to]\n visited[to] = true\n distance[to] = distance[from] + 1\n predecessor[to] = from\n queue.push(to)\n end\n end\n end\n return distance, predecessor\n end",
"def find_breadth_traversal_tree(in_order,post_order,level, h)\n # level => 0F 0T 1F 1T etc\n if in_order.size == nil || in_order.size == 0\n puts \"finish\"\n elsif in_order.size == 1\n # finish\n yield(level, in_order[0])\n puts \"#{level} \\t #{in_order[0]}\"\n else \n # this is not finished yet\n max_index_in_post = 0\n max_index_in_in = 0\n in_order.each_with_index do |in_ele,in_index|\n post_index = post_order.index(in_ele)\n\n if post_index > max_index_in_post\n max_index_in_post = post_index\n max_index_in_in = in_index\n end\n\n end\n current_root = in_order[max_index_in_in]\n yield(level, current_root)\n puts \"#{level} \\t #{current_root}\"\n\n level[0] = (Integer(level[0])+1).to_s\n next_level_f = level+\"F\"\n next_level_t = level+\"T\"\n front_of_in = in_order[0...max_index_in_in]\n tail_of_in = in_order[(max_index_in_in+1)...in_order.size]\n \n #\n find_breadth_traversal_tree(front_of_in,post_order,next_level_f, h) {|level,ele| h[level] = ele}\n find_breadth_traversal_tree(tail_of_in,post_order,next_level_t, h) {|level,ele| h[level] = ele}\n\n #\n end # end of else\n\n\nend",
"def bsearch_tree(node, target)\n return target if node == target\n y = nil\n node.each do |x|\n if x.is_a? node.class\n y = bsearch_tree(x, target)\n else\n return target if x == target\n end\n end\n y\nend",
"def breadth_first_search(root)\n visited = {}\n distance = {}\n predecessor = {}\n\n visited[root] = true\n distance[root] = 0\n predecessor[root] = nil\n\n queue = [ root ]\n\n while from = queue.shift\n\tnext unless @graph[from]\n\t@graph[from].each_key do |to|\n\t unless visited[to]\n\t visited[to] = true\n\t distance[to] = distance[from] + 1\n\t predecessor[to] = from\n\t queue.push(to)\n\t end\n\tend\n end\n return distance, predecessor\n end",
"def breadth_first_search(target)\n queue = [@root]\n while ! queue.empty?\n node = queue.shift\n if node.value == target\n return node\n else\n if node.value > target && node.left_child != nil\n queue = queue << node.left_child\n end\n if node.value < target && node.right_child != nil \n queue = queue << node.right_child\n end\n end\n end\n return nil\n end",
"def bfs_iterative(target)\n queue = [self]\n\n until queue.empty?\n node = queue.shift\n\n return node if node.value == target\n\n node.children.each do |child|\n queue << child\n end\n end\n\n nil\n end",
"def breadth_first_search(start_node, target_value)\n\t\tvisited = [start_node]\t\t\t\n\t\tqueue = [start_node]\n\t\n\t\twhile ( queue.length > 0 )\t\n\n\t\t\t# dequeue\n\t\t\tvertex = queue.shift\n\t\t\treturn vertex if target_value.name == vertex.name\n\t\n\t\t\t# visit all adjacent unvisited vertexes, mark visited, enqueue\n\t\t\tNode.childPointers.each do |child|\n\t\t\t\tif !eval(\"vertex.#{child}.nil?\")\n\t\t\t\t\tif !eval(\"visited.include?vertex.#{child}\")\n\t\t\t\t\t\tvisited << eval(\"vertex.#{child}\")\n\t\t\t\t\t\teval(\"vertex.#{child}.prev = vertex\")\n\t\t\t\t\t\tqueue << eval(\"vertex.#{child}\")\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n\t\tnil\n\tend",
"def bfs(starting_node, target_value)\n visited = Set.new()\n queue = [starting_node]\n until queue.empty?\n dequeued = queue.shift\n return dequeued if dequeued.val == target_value\n visited.add(dequeued)\n dequeued.neighbors.each do |neighbor|\n queue << neighbor unless visited.include?(neighbor)\n end\n end\n nil\nend",
"def bfs(starting_node, target_value)\n queue = [starting_node]\n visited = Set.new()\n\n starting_node.neighbors.each do |neighb_nodes|\n\n return queue.first.value if queue.first.value == target_value\n\n visited.add(queue.shift) \n\n queue.push(neighb_nodes) unless visited.include?(neighb_nodes)\n \n end\n nil\nend",
"def breadth_first_search(data)\n queue = [@root]\n node_match = nil\n match_found = false\n until queue.empty? || match_found || @root.nil?\n cur_node = queue.first\n if cur_node.value == data\n match_found = true\n node_match = cur_node\n else\n queue.push(cur_node.left_child) unless cur_node.left_child.nil?\n queue.push(cur_node.right_child) unless cur_node.right_child.nil?\n queue.shift\n end\n end\n return node_match\n end",
"def bfs(starting_node, target_value)\n queue = [starting_node]\n checked_nodes = Set.new\n\n until queue.empty?\n current = queue.shift\n unless checked_nodes.include?(current)\n checked_nodes.add(current)\n return current if current.value == target_value\n queue += current.neighbors\n end\n end\n nil\nend",
"def breadth_first\n result = []\n queue = [self]\n while !queue.empty?\n node = queue.shift\n result << node\n node.children.sort.each do |child|\n queue << child\n end\n end\n return result\n end",
"def breadth_first_search?(graph, start, goal)\n visited = Hash.new(false)\n queue = Queue.new\n queue.push(start)\n visited[start] = true\n until queue.empty? do\n node = queue.pop\n return true if node == goal\n add_to_queue(graph, queue, node, visited)\n end\n false\n end",
"def path_finder \n until queue.empty? \n current_node = queue.shift()\n generate_neighbours(current_node)\n current_node.neighbour_nodes.each do |neighbour|\n track_visited(current_node, neighbour)\n correct_node?(neighbour) ? (return neighbour.visited) : (queue << neighbour)\n end\n end\n end",
"def depth_first_search(node)\n return if node.nil?\n node.visit\n node.connections.each do |conn|\n depth_first_search(conn) unless conn.visited\n end\nend",
"def bfs(start, goal = :goalNode?)\n require 'set'\n visited = Set.new\n frontier = []\n frontier << start\n\n until frontier.empty?\n current = frontier.shift\n\n next if visited.include? current\n visited << current\n\n found = false\n found = if block_given?\n yield(current)\n else\n send(goal, current)\n end\n\n if !found\n current.connections.each do |node|\n frontier << node\n end\n else\n return current\n end\n end\n :goal_node_not_found\nend",
"def traverse\n @result.clear\n @queue.clear\n\n @queue.enqueue(@node)\n @result.push @node\n\n\n while not @queue.empty?\n node = @queue.dequeue\n return @result unless node\n # puts \"Visiting node: #{node}\"\n return node if (@search and node==@search)\n node && node.children.each do |node|\n unless @result.include?(node)\n @result.push(node)\n @queue.enqueue(node)\n end\n end\n end\n return result\n end",
"def bfs(val) \n queue = [self] \n\n until queue.empty? \n if queue.first.value == val\n return queue.first\n else\n queue.concat(queue.shift.children) #you add [] + children's children\n end\n end\n nil #if noting == val\n end",
"def breadth_first_search(start, target)\n queue = [ @vertices[start] ]\n visited = []\n until queue.empty?\n vertex = queue.shift\n break if vertex.key == target\n visited << vertex\n vertex.neighbors.each { |key| queue << @vertices[key] unless visited.include?(@vertices[key])}\n end\n visited\n end",
"def bfs(graph, starting_point)\n q = Queue.new()\n q.enq(starting_point)\n visited = [] \n loop do \n node = q.deq\n visited.push(node) unless visited.include?(node) \n graph.values[node].each{ |x| q.enq(x) }\n break if visited.length == graph.length\n end \n visited\n end",
"def dfs_rec(target,current,array_length,stack,visited)\n left = current.find_left_child[0]\n right = current.find_right_child[0]\n parent = current.find_parent[0]\n if current.value == target\n return current\n elsif visited.length == array_length\n return nil\n elsif !left.nil? && !visited.include?(left)\n stack.push(left)\n visited.push(left)\n dfs_rec(target,left,array_length,stack,visited)\n elsif !right.nil? && !visited.include?(right)\n stack.push(right)\n visited.push(right)\n dfs_rec(target,right,array_length,stack,visited)\n else\n stack.pop\n dfs_rec(target,parent,array_length,stack,visited)\n end\nend",
"def breadth_first(node, target)\n # Setup\n queue = Queue.new\n queue.enqueue(node)\n # While queue exists\n while queue.elements?\n # Pop bottom off\n current_node = queue.dequeue\n # Check if it is target or nil\n return 'Could not locate your payload :(' if current_node.nil?\n return 'Found your target' if current_node.payload == target\n # Otherwise add its children to\n # back of line for checking\n add_kids_to_queue(current_node, queue)\n end\nend",
"def breadth_first\n queue = []\n values = []\n queue << @root\n\n while queue.size > 0\n node = queue.shift\n queue << node.left unless node.left.nil?\n queue << node.right unless node.right.nil?\n\n values << node.value\n end\n\n values\n end",
"def bfs(target_pos) #this is called on the root node \n tar_x, tar_y = target_pos \n\n arr = [self]\n\n until arr.empty?\n current_check = arr.shift \n return current_check if current_check.root_node == target_pos\n arr.concat(current_check.children)\n end\n nil\n end",
"def bfs\n return [] if @root.nil?\n queue = []\n list = []\n queue.push(@root)\n while queue.length > 0\n curr_node = queue[0]\n list << {key: curr_node.key, value: curr_node.value}\n queue.push(curr_node.left) if curr_node.left\n queue.push(curr_node.right) if curr_node.right\n queue.shift\n end\n return list \n end",
"def breadthTraversal(path, parent = nil)\n\[email protected] Job.new(path, parent)\n\n\twhile not @jobs.empty?\n\t\tbtraverse(@jobs.pop)\n\tend\nend",
"def breadth_first(value_to_find)\r\n current_node = self\r\n queue = MyQueue.new \r\n\r\n while current_node != nil\r\n if current_node.payload == value_to_find\r\n return current_node\r\n end\r\n current_node.children.each do |child|\r\n queue.enqueue(child)\r\n end\r\n current_node = queue.dequeue\r\n end\r\n end",
"def bfs\n q = []\n list = []\n\n return [] if @root.nil?\n\n current_node = @root\n \n q.push(current_node)\n # put current node into queue\n while q.length != 0\n # put current node into list and delete from queue\n # add current node's children into the queue\n list.push({key: q[0].key, value: q[0].value})\n q.shift\n \n if current_node.left != nil \n q.push(current_node.left) \n end \n\n if current_node.right != nil \n q.push(current_node.right)\n end\n current_node = q[0] \n end \n\n return list\n end",
"def DFS(root, target)\n ## base case: \n return nil if root.nil?\n return root if root.value == target\n ##indecutive step: \n ## DFS on the left side then DFS on the right side \n root.children.each do |child|\n search_result = DFS(child, target) ## better to save the actual value then check the value then return nil\n return search_result unless search_result.nil?\n end \n return nil\nend",
"def bfs\n bfs_queue = []\n curr = @root\n node_list = []\n while curr\n visit(curr, node_list)\n bfs_queue << curr.left if curr.left\n bfs_queue << curr.right if curr.right\n curr = bfs_queue.shift\n end\n return node_list\n end",
"def bfs(tree, value)\n q = MyQueue.new\n q.enqueue(tree)\n current_tree = q.dequeue() #need to do something when i dequeue \n \n while current_tree != nil\n puts current_tree.payload\n\n if current_tree.payload != value\n current_tree.children.each do |leaf|\n q.enqueue(leaf)\n end\n else\n q = MyQueue.new\n end\n current_tree = q.dequeue()\n end\nend",
"def bradth_first_search(start_vertex, stop_vertex)\n queue = Array.new()\n queue << search_vertex(start_vertex)\n until queue.empty?\n temp_vertex = queue.shift()\n break if temp_vertex.value == stop_vertex\n vertex_edges = temp_vertex.edges.head\n until vertex_edges == nil\n current = search_vertex(vertex_edges.value)\n if current.visited == false\n current.visited = true\n current.parent = temp_vertex.value\n queue << current\n end\n vertex_edges = vertex_edges.link\n end\n temp_vertex.visited = true\n end\n graph_traversal(start_vertex, stop_vertex)\n end",
"def bfs(target)\n visited = {}\n @graph.keys.each { |key| visited[key] = false }\n node = @graph.keys[0]\n queue = Queue.new\n queue << node\n while !(queue.length == 0)\n visited[node] = true\n puts \"node is #{node}\"\n return node if node == target\n @graph[node].each do |nabe|\n queue << nabe unless visited[nabe] == true\n end\n node = queue.pop\n end\n end",
"def breadth_first_scan(root, &block)\n puts \"=== \".light_black + root.light_cyan + \" ===\".light_black if $verbose\n\n root = slashed(root)\n \n dirs, files = listdir(root)\n path_id = File.lstat(root).ino\n \n if seenpath = $visited[path_id]\n STDERR.puts \"*** WARNING: Already seen #{root.inspect} as #{seenpath.inspect}\".red if $verbose\n else\n $visited[path_id] = root\n \n dirs.each { |f| yield root, f }\n files.each { |f| yield root, f }\n \n for dir in dirs\n breadth_first_scan(root+dir, &block)\n end\n end\nend",
"def bfs(root, target)\n return nil if target.nil? || root.nil? # nothing to do if there is no target or root to begin the search\n queue = Queue.new\n queue.enq(root)\n result = nil\n while !queue.empty?\n value = queue.deq\n p value[:value]\n if value[:value] == target\n result = value\n break\n end\n\n # keep moving the levels in tree by pushing left and right nodes of tree in queue\n queue.enq(value[:left]) if value[:left]\n queue.enq(value[:right]) if value[:right]\n end\n\n result # returns node found in BST else default value nil\nend",
"def search_bfs(value)\n return false unless @root_node\n queue = Array.new\n queue.push(@root_node)\n\n while !queue.empty?\n node = queue.shift\n if node.value == value\n return value\n else\n queue.push(node.left) unless node.left.nil?\n queue.push(node.right) unless node.right.nil?\n end\n end\n return nil\n end",
"def breadth_first(value)\n\tend",
"def nodes_breadthfirst(node = self.root, &block)\n @nodes = []\n iterate_breadthfirst(node, &block)\n ensure\n @nodes = nil\n end",
"def breadth_first(a=[])\n unless a.length == 0\n s = []\n a.each do |z|\n if z.key?('v')\n print \"#{z['v']} \"\n s.push(z['l'])\n s.push(z['r'])\n end\n end\n breadth_first(s)\n end\n \nend",
"def bfs(start_node_num)\n node = find_node(start_node_num)\n _clear_visited\n ret_list = [node.value]\n # Your code here\n q = Queue.new\n q << node\n node.visited = true\n\n until q.empty?\n current = q.pop\n current.edges.each do |edge|\n next if edge.node_to.visited\n q << edge.node_to\n edge.node_to.visited = true\n ret_list << edge.node_to.value\n end\n end\n\n return ret_list\n end",
"def breadth_first_scan(root, &block)\n root = slashed(root)\n \n dirs, files = listdir(root)\n path_id = File.lstat(root).ino\n \n if seenpath = $visited[path_id]\n STDERR.puts \"*** WARNING: Already seen #{root.inspect} as #{seenpath.inspect}\".red if $verbose\n else\n $visited[path_id] = root\n \n dirs.each { |f| yield root, f }\n files.each { |f| yield root, f }\n \n for dir in dirs\n breadth_first_scan(root+dir, &block)\n end\n end\nend",
"def bfs(target)\n queue = [self]\n until queue.empty?\n return queue.first if queue.first.position == target\n queue += queue.first.children\n queue.shift\n end \n end",
"def breadth_first_search(target)\n\t\tsearch_queue = []\n\t\tinitial_node = @root\n\t\tsearch_queue << initial_node\n\n\t\treturn nil if @root.nil?\n\n\t\tuntil search_queue.empty?\n\t\t\ttest_node = search_queue.shift\n\n\t\t\tif test_node.value == target\n\t\t\t\treturn test_node\n\t\t\telse\n\t\t\t\tsearch_queue << test_node.left_child unless test_node.left_child.nil?\n\t\t\t\tsearch_queue << test_node.right_child unless test_node.right_child.nil?\n\t\t\tend\n\t\tend\n\t\tnil\n\tend",
"def calc\n # If the searches have not started\n if breadth_first_search.visited.empty?\n # Calculate the two searches\n calc_breadth_first\n calc_dijkstra\n end\n end",
"def breadth_traversal(top_node)\n # start with the first nodes\n nodes = [top_node]\n nodes_to_iterate = [top_node]\n\n # while we have more nodes to print\n while (!nodes_to_iterate.empty?)\n next_nodes = [] # start with an empty list\n # for each node we iterate over in this, find their children\n nodes_to_iterate.each do |n|\n # add the next nodes we iterate\n next_nodes.concat(n.children)\n end\n\n #\n nodes.concat(next_nodes)\n nodes_to_iterate = next_nodes\n end\n\n # print them out in order\n # nb: (this could be a nested structure so you could print out\n # each row on a separate line, which might be cool)\n nodes.each {|n| yield n.value }\nend",
"def depth_first_search!(node)\n node.marked = true\n node.type = \"M\"\n node.adj.each do |n|\n if n.marked == false\n depth_first_search(n)\n end\n end\n end",
"def search root, target\n queue = [root]\n\n until queue.empty?\n current = queue.shift\n return current if current.x == target.x && current.y == target.y\n\n current.make_children.each { |child| queue << child }\n end\nend",
"def bfs\r\n q = Queue.new\r\n visited = Set.new\r\n\r\n q << [0, panda]\r\n visited << panda\r\n\r\n until q.empty?\r\n level, current_panda = q.shift\r\n unvisited = @members[current_panda].select { |v| !visited.include? v }\r\n unvisited.each do |v|\r\n q << [level + 1, v]\r\n visited << v\r\n end\r\n end\r\n end",
"def depth_first_search(find,tree)\n current = tree[0]\n answer = \"\"\n stack = [tree[0]]\n visited = [tree[0]]\n \n condition = false\n until condition == true\n connections = [current.find_right_child[0],current.find_left_child[0]].compact\n puts current.value\n puts connections.count\n puts \"---\"\n \n if current.value == find\n answer = current\n condition = true\n elsif visited.count == tree.count\n answer = nil\n condition = true\n else\n if connections.count < 1\n stack.pop\n current = stack[-1]\n elsif connections.count == 1\n if visited.include?(connections[0])\n stack.pop\n current = stack[-1]\n else\n current = connections[0]\n stack.push(current)\n visited.push(current)\n end\n else\n if visited.include?(connections[0]) && visited.include?(connections[1])\n stack.pop\n current = stack[-1]\n elsif !visited.include?(connections[0])\n current = connections[0]\n stack.push(current)\n visited.push(current)\n else\n current = connections[1]\n stack.push(current)\n visited.push(current)\n end\n end\n end\n end\n puts answer ? answer : \"Value not found!\"\n puts answer.value if answer != nil\nend",
"def BFT_iterative(root)\n print '[\"I\", \"O\", \"H\", \"L\", \"R\", \"T\", \"M\", \"A\", \"G\"]' + \"\\n\"\n if root == nil\n return\n end\n q = Queue.new\n q.enqueue(root)\n\n while !q.empty?\n root = q.dequeue # I\n print(\"#{root.value}\\n\") \n if !root.left.nil?\n q.enqueue(root.left)\n end\n if !root.left.nil?\n q.enqueue(root.right)\n end\n end\n end",
"def dfs(root, target)\n return root if root.value == target\n root.children.each do |child|\n search_result = dfs(child, target)\n return search_result unless search_result.nil?\n end\n\n nil\nend",
"def find_order_bfs\n queue = []\n @num_courses.times { |v| queue.push(v) if @in_degrees[v].zero? } # 入度为0的全都放入\n\n visited = []\n until queue.empty?\n node_key = queue.shift\n\n visited.unshift(node_key) # 注意顺序\n\n @nodes[node_key]&.each do |neighbor|\n @in_degrees[neighbor] -= 1\n queue.push(neighbor) if @in_degrees[neighbor].zero?\n end\n end\n\n visited.size == @num_courses ? visited : []\n end",
"def bfs(target_value)\n child_arr = [self]\n # children.each {|child| children_arr << child }\n while child_arr.length > 0\n node_to_check = child_arr.shift\n return node_to_check if node_to_check.value == target_value\n node_to_check.children.each { |child| child_arr << child }\n end\n nil\n end",
"def bfs\n result = []\n\n return result if @root.nil?\n\n queue = [@root]\n\n while !queue.empty?\n node = queue.shift\n\n result << { key: node.key, value: node.value }\n\n if node.left\n queue << node.left\n end\n\n if node.right\n queue << node.right\n end\n end\n\n return result\n end",
"def bfs\n list = []\n if @root\n queue = []\n queue << @root\n queue.each do |current|\n list << {key: current.key, value: current.value}\n queue << current.left if current.left\n queue << current.right if current.right\n end\n end\n return list\n end",
"def bfs(current = @root, array = [])\n if current == nil\n return array\n else\n bfs(current.left, array)\n array << { key: current.key, value: current.value }\n bfs(current.right, array)\n end\n end",
"def bfs(target)\n q = [self]\n until q.empty?\n shifted = q.shift\n return shifted if shifted.value == target\n q += shifted.children\n # debugger\n end\n nil\n end",
"def depth_first(node, visited = Set.new())\n return nil if visited.include?(node.val)\n\n puts node.val\n visited.add(node.val)\n\n node.neighbors.each do |neighbor|\n depth_first(neighbor, visited);\n end\nend",
"def bfs\n closed = []\n fringe = initialize_fringe\n\n loop do\n return nil if fringe.empty? # No solution\n current = fringe.pop\n city = current[:city]\n return current if done? city # Found the solution?\n unless closed.include? city # Expand if we haven't visited the city\n closed.push city\n expand(current).each do |c|\n fringe.unshift(c) # Add to front to ensure FIFO\n end\n end\n end\n end",
"def find_path(target)\n queue = [root_node]\n until queue.empty?\n p current_node = queue.shift\n p queue\n return current_node if current_node.value == target\n current_node.children.each do |child|\n queue << child\n end\n end\n nil\nend",
"def bfs( start, &block )\n start.distance = 0\n start.predecessor = nil\n start.gray!\n vq = Queue.new()\n vq.enqueue(start)\n while vq.size > 0\n current = vq.dequeue()\n current.get_connections.each do |nbr|\n if nbr.white?\n nbr.gray!\n nbr.distance = current.distance + 1\n nbr.predecessor = current\n vq.enqueue(nbr)\n end\n end\n current.black!\n yield current if block_given?\n end\n # clean up vertices attributes set during bfs\n @vertices.keys.each do |key|\n @vertices[key].distance = nil\n @vertices[key].predecessor = nil\n @vertices[key].color = nil\n end\n end",
"def breadth_first_search(graph, source, target = nil)\n # queue: first-in, first-out (FIFO). keeps track of which vertices have already\n # been visited but have not yet been visited from, so we know where to search.\n queue = Queue.new\n\n # a `Set` instance is a collection of unordered values with no duplicates\n # maintain a list of visited nodes and prevent checking a node more than once\n visited = Set.new\n\n # shortest path information, if applicable\n meta = {}\n\n # enqueue the source key (push it to the empty queue)\n queue.enq(source)\n\n until queue.empty?\n # current node, which we `shift` from the queue\n current = queue.deq\n\n # print the shortest path if it was found\n return path(source, current, meta) if target && current == target\n\n # we don't have to keep track of distance here, since we have a method\n # to access each of the node's neighbors. the neighbors are stored in a set.\n # process each neighboring vertex of the current node,\n # i.e. traverse all outgoing edges from the current node.\n current.neighbors.each do |neighbor|\n # if the neighbor node is unvisited, we ignore this edge\n unless visited.include?(neighbor)\n queue.enq(neighbor)\n visited.add(neighbor) # we just enqueued this node, so mark it as visited\n meta[neighbor] = current # record the path (only done once, b/c of `unless`)\n end\n end\n end\nend",
"def dfs(root, result)\n return if root.nil?\n result << root.val if root.left.nil? && root.right.nil?\n dfs(root.left, result)\n dfs(root.right, result)\nend",
"def breadth_first_traverse(s)\n a = []\n # marking visited nodes\n visited = Array.new(@vertices)\n # create a queue for BFS\n queue = Queue.new\n\n # mark the current node as visited and enqueue it\n visited[s] = true\n queue.enqueue(s)\n\n until queue.empty?\n\n # Dequeue a vertex from queue and print it or push it into 'a' array\n s = queue.poll\n\n # print \"#{s} \"\n a.push(s)\n\n # get all adjacent vertices of the dequeued vertex s\n # if a adjacent has not been visited, then mark it\n # visited and dequeue it\n adjacent_vertices = @adjList[s]\n\n i = 0\n while i < adjacent_vertices.length\n\n n = adjacent_vertices[i]\n\n unless visited[n]\n visited[n] = true\n queue.enqueue(n)\n end\n\n i += 1\n end\n\n end\n # returning the list on BFS order\n a\n end",
"def depth_first_search\n visited = {}\n timestamp = {}\n tree_edges = {}\n back_edges = {}\n cross_edges = {}\n forward_edges = {}\n count = 0\n\n # begin workaround removing depencency to order of Hash#each\n if @index.empty? then\n preference_of_nodes = nil\n else\n preference_of_nodes = {}.merge(@index)\n i = preference_of_nodes.values.max\n @graph.each_key do |node0|\n preference_of_nodes[node0] ||= (i += 1)\n end\n end\n # end workaround removing depencency to order of Hash#each\n\n dfs_visit = Proc.new { |from|\n visited[from] = true\n timestamp[from] = [count += 1]\n ary = @graph[from].keys\n # begin workaround removing depencency to order of Hash#each\n if preference_of_nodes then\n ary = ary.sort_by { |node0| preference_of_nodes[node0] }\n end\n # end workaround removing depencency to order of Hash#each\n ary.each do |to|\n if visited[to]\n if timestamp[to].size > 1\n if timestamp[from].first < timestamp[to].first\n \t# forward edge (black)\n \tp \"#{from} -> #{to} : forward edge\" if $DEBUG\n \tforward_edges[from] = to\n else\n \t# cross edge (black)\n \tp \"#{from} -> #{to} : cross edge\" if $DEBUG\n \tcross_edges[from] = to\n end\n else\n # back edge (gray)\n p \"#{from} -> #{to} : back edge\" if $DEBUG\n back_edges[from] = to\n end\n else\n # tree edge (white)\n p \"#{from} -> #{to} : tree edge\" if $DEBUG\n tree_edges[to] = from\n dfs_visit.call(to)\n end\n end\n timestamp[from].push(count += 1)\n }\n\n ary = @graph.keys\n # begin workaround removing depencency to order of Hash#each\n if preference_of_nodes then\n ary = ary.sort_by { |node0| preference_of_nodes[node0] }\n end\n # end workaround removing depencency to order of Hash#each\n ary.each do |node|\n unless visited[node]\n dfs_visit.call(node)\n end\n end\n return timestamp, tree_edges, back_edges, cross_edges, forward_edges\n end",
"def bfs(target_value)\n queue = []\n queue << self\n\n while queue.empty? == false\n check = queue.pop\n \n if check.value == target_value\n return check.value\n else\n queue.unshift(*check.children)\n end\n end\n \n false\n end",
"def dfs(tree, target)\n\n node_stack = [ ]\n\n #push root\n node_stack.push(tree[0])\n\n # can also set current_node and do `while current_node`\n while node_stack.length > 0\n\n # pop first\n node = node_stack.pop\n\n # then do or look for something, generally w conditional\n if node == target\n return true\n else\n # seems multiple ways to do, but doing right before left\n # makes sense to me, even though most do left before right.\n # With my way, the left is pop'd first and you go down left\n # side first\n\n #### BELOW IS NOT RIGHT -- THERE HAS TO BE SOME RECURSSION HERE\n # This actually is starting to make sense: https://github.com/brianstorti/ruby-graph-algorithms/blob/master/depth_first_search/depth_first_search.rb\n #http://haozeng.github.io/blog/2014/01/05/trees-in-ruby/\n #https://github.com/breadoliveoilsalt/depth-first-search-lab-v-000/blob/solution/index.js\n if node.left\n node_stack.push(node.left)\n end\n if node.right\n node_stack.push(node.right)\n end\n end\n end\n\n return false\n\nend",
"def dfs(target)\n return self if self.value == target\n # debugger\n self.children.each do |node|\n dfs(node)\n # if node.value == target\n # return node\n # else\n # node.dfs(target)\n # end\n end\n return nil if self.children.empty?\n p new_arr\n end",
"def floodfill_tree bn_id, &blk\n info \"Fill #{bn_id}\"\n return bn_id if node_visited?(bn_id)\n _q.push(bn_id)\n\n index = 0\n while _q.length > 0 do\n #bn = blk.call(bn_id)\n bns = Http.get_bns _q\n bns.each do |bn|\n bn_data = get_node_data_from_xml_doc(bn)\n set_node(bn_data)\n children = get_children_from_xml_doc(bn).map do |child_bn| \n get_node_data_from_xml_doc(child_bn)\n end\n children.each do |child|\n #floodfill_tree child[:id], &blk\n _q.push(child[:id])\n add_child bn_data[:id], child[:id]\n end\n ancestors = get_ancestors_from_xml_doc(bn)\n ancestors.each do |parent|\n parent_data = get_node_data_from_xml_doc parent\n #floodfill_tree parent_data[:id], &blk\n _q.push(parent_data[:id])\n add_ancestor bn_data[:id], parent_data[:id]\n # First 2 levels of ancestors are virtual nodes\n # Add them with this request\n current_parent_bn_id = parent_data[:id]\n grandparent = get_ancestors_from_xml_doc(parent)\n while grandparent.length > 0\n # MAybe Bug\n grandparent_data = get_node_data_from_xml_doc parent\n set_node grandparent_data\n add_ancestor current_parent_bn_id, grandparent_data[:id]\n current_parent_bn_id = grandparent_data[:id]\n grandparent = get_ancestors_from_xml_doc(grandparent)\n end\n end\n # a node is visited when all neighbours are visited\n visit_node bn_data[:id]\n end\n info \"To process #{_q.inspect}\"\n _q.reject!{|e| node_visited?(e)}\n info \"To process #{_q.length} node(s)\"\n index += 1\n save if (index%100 == 0)\n end\n save\n end",
"def bfs\n return [] unless @root\n q = [@root]\n out = []\n\n until q.empty? do\n current = q.shift\n out << { key: current.key, value: current.value }\n q << current.left if current.left\n q << current.right if current.right\n end\n\n return out\n end",
"def reconstruct_bst_from_traversal(pre_order)\n reconstruct_bst_rec(0, pre_order.length - 1, pre_order)\nend",
"def depth_first_search(query)\n stack = [@tree]\n\n loop do\n# exit when empty stack\n return nil if stack.empty?\n\n# node is equal to top of stack\n node = stack.pop\n \n# return node if match\n return node if query == node.value\n\n# i think it is pushing every descendant of the parent?\n stack.push node.left_child if node.left_child != nil\n stack.push node.right_child if node.right_child != nil\n end\n end",
"def depth_first_search(adj_matrix, source_index, end_index)\n node_stack = [source_index]\n # The code uses a forever loop and then breaks when we encounter certain conditions.\n loop do\n curr_node = node_stack.pop\n return false if curr_node == nil\n return true if curr_node == end_index\n\n # Out of the adjacency matrix, pick the “children” of curr_node by checking the 1’s in the adjacency matrix\n children = (0..adj_matrix.length-1).to_a.select do |i| \n adj_matrix[curr_node][i] == 1\n end\n \n # Take those nodes and push them onto the end of the stack\n node_stack = node_stack + children\n end\n end",
"def depth_search(node, proc)\n res = nil\n counter = 0\n number_of_children = node.children.length\n\n while counter < number_of_children\n return res if res\n\n child = node.children[counter]\n res = proc.call(child)\n return res if res\n\n res = depth_search(child, proc)\n counter += 1\n end\n res\n end",
"def search(start, goal)\n openset = Set.new\n closedset = Set.new\n current = start\n\n if @maximize_cost # serves to invert the comparison\n openset_min_max = openset.method(:max_by)\n flip = -1\n else\n openset_min_max = openset.method(:min_by)\n flip = 1\n end\n\n openset.add(current)\n while not openset.empty?\n current = openset_min_max.call{|o| o.g + o.h }\n if current == goal\n path = []\n while current.parent\n path << current\n current = current.parent\n end\n path << current\n return path.reverse\n end\n openset.delete(current)\n closedset.add(current)\n @graph[current].each do |node|\n next if closedset.include? node\n\n if openset.include? node\n new_g = current.g + current.move_cost(node)\n if (node.g - new_g) * flip > 0\n node.g = new_g\n node.parent = current\n end\n else\n node.g = current.g + current.move_cost(node)\n node.h = heuristic(node, start, goal)\n node.parent = current\n openset.add(node)\n end\n end\n end\n return nil\n end"
] | [
"0.75271535",
"0.75112754",
"0.7444565",
"0.73405594",
"0.7280742",
"0.7275826",
"0.7228846",
"0.72257054",
"0.720302",
"0.716926",
"0.7132503",
"0.707997",
"0.7053239",
"0.7046879",
"0.7041311",
"0.70368093",
"0.699208",
"0.6980703",
"0.697969",
"0.6918669",
"0.6910106",
"0.69035757",
"0.6897758",
"0.6884241",
"0.68732744",
"0.6855555",
"0.68345016",
"0.6824646",
"0.6820387",
"0.6818346",
"0.6811189",
"0.6802927",
"0.68003076",
"0.67972916",
"0.6784708",
"0.6781779",
"0.67739266",
"0.670916",
"0.67066395",
"0.6696835",
"0.66933674",
"0.6679349",
"0.66632515",
"0.6661777",
"0.66403365",
"0.6616171",
"0.6607134",
"0.66060156",
"0.66044587",
"0.66004544",
"0.658294",
"0.6582788",
"0.65814704",
"0.65692073",
"0.6561769",
"0.6555714",
"0.65373534",
"0.653298",
"0.6509015",
"0.65049696",
"0.6493069",
"0.6487512",
"0.6484804",
"0.64695895",
"0.64660597",
"0.64455676",
"0.6445384",
"0.64317495",
"0.6424222",
"0.64202327",
"0.64173913",
"0.64119405",
"0.6395987",
"0.6386566",
"0.6383464",
"0.63282853",
"0.6328077",
"0.6302597",
"0.6300117",
"0.6251557",
"0.6242018",
"0.6239372",
"0.6200723",
"0.6195501",
"0.619351",
"0.6178805",
"0.6178033",
"0.61662406",
"0.61653596",
"0.6157338",
"0.6150221",
"0.6144438",
"0.61373574",
"0.6134485",
"0.6133479",
"0.6131301",
"0.61308813",
"0.6126622",
"0.61265934",
"0.6121615",
"0.6087244"
] | 0.0 | -1 |
Lambda for OCLC Number | def argot_oclc_number(config)
lambda do |rec, acc|
st = {}
config.each do |key, spec|
extractor = MarcExtractor.cached(spec, separator: nil)
oclc_num = extractor.extract(rec).collect! do |o|
Marc21Semantics.oclcnum_extract(o)
end.compact
oclc_num = oclc_num.uniq
if key == 'value'
st[key] = oclc_num.first if oclc_num
else
st[key] = oclc_num unless oclc_num.empty?
end
end
val = st['value']
acc << st unless val.nil? || val.empty?
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_proc\n lambda do |v|\n n = Version::Number.parse(v)\n n.send(operator, number)\n end\n end",
"def oclcnum(extract_fields = \"035a\")\n extractor = MarcExtractor.new(extract_fields, :separator => nil)\n\n lambda do |record, accumulator|\n list = extractor.extract(record).collect! do |o|\n Marc21Semantics.oclcnum_extract(o)\n end.compact\n\n accumulator.concat list.uniq if list\n end\n end",
"def closureasaurus( n )\n\tlambda {|val| val*n }\nend",
"def number=(_arg0); end",
"def arthamatic_operation(number)\n\tnumber + 3\nend",
"def dyslexic_accounting(number)\n # code goes here\nend",
"def number; end",
"def number; end",
"def ot_currency_code\n end",
"def call_num(reg_key, addr, i_reg, m_spec)\n end",
"def argot_rollup_id(spec)\n lambda do |rec, acc|\n extractor = MarcExtractor.cached(spec, separator: nil)\n oclc_num = extractor.extract(rec).collect! do |o|\n Marc21Semantics.oclcnum_extract(o)\n end.compact\n acc << \"OCLC#{oclc_num.first}\"\n end\n end",
"def to_integer(proc)\n\tproc[-> n { n + 1 }][0]\nend",
"def WorldCatCheckControlNumbers(opts={})\n sRecord = \"\"\n @LastResponseCode = \"\"\n base_uri = WORLDCAT_METADATA_CHECK_CONTROL_NUMBERS_URI\n helper = Helper.new(:wskey => @wskey, :secret => @secret, :principalID=>@principalID, :principalDNS => @principalDNS)\n\n base_uri += \"?oclcNumbers=\" + opts[:oclcNumber]\n response = helper.MakeHTTPRequest(:url => base_uri, :method => \"GET\", :accept => \"application/atom+json\")\n @debug_info = helper.debug_string + \"\\n\\n\" + base_uri\n @LastResponseCode = response\n sRecord = response\n return sRecord\n end",
"def consume_number; end",
"def pc_to_cnc(nc, oct, mod=12)\n (oct*mod)+nc\n end",
"def pcos_get_number(*args)\n @p.pcos_get_number(self, *args)\n end",
"def digit; end",
"def cc_number_label\n #unit_test_no_generate: cc_number_label, span.className(create_ats_regex_string(\"ats-ccnumlbl\"))\n $tracer.trace(__method__)\n return ToolTag.new(span.className(create_ats_regex_string(\"ats-ccnumlbl\")), __method__)\n end",
"def exec_lambda expr\n wolfram_result expr\n end",
"def roman_numeral number\n\nend",
"def digits(cc_num)\n cc_num.to_i.digits\nend",
"def op_code\n 2004\n end",
"def single_number(nums)\n nums.reduce(&:^)\n #亦可 nums.reduce(:^)\nend",
"def num; end",
"def num; end",
"def on_numeric(n)\n n\n end",
"def on_numeric(n)\n n\n end",
"def lambda; end",
"def make_call (number, international_code = 1, area_code = 646)\n puts \"Calling #{international_code}-#{area_code}-#{number}\"\n end",
"def numcase_number numcase\n return 0 if numcase.nil?\n return 0 if numcase.n < 5\n return numcase.n\n end",
"def power_proc_generator\n value = 1\n lambda { value += value }\nend",
"def lambda_math\n math = lambda do\n return 1 + 1\n end\n math.call\n return \"hey\"\nend",
"def plus number\n Proc.new do |leftop|\n leftop + number\n end\nend",
"def op_code\n 2002\n end",
"def cuadrado(x)\n x * x\nend",
"def company_number\n 1\n end",
"def luhnother(ccNumber)\n ccNumber = ccNumber.gsub(/\\d/,'').split(//).collect { |digit| digit.to_i }\n parity = ccNumber.length % 2\n sum = 0\n ccNumber.each_with_index do |digit,index|\n digit = digit * 2 if index%2==parity\n digit = digit - 9 if digit > 9\n sum = sum + digit\n end\n return (sum%10)==0\nend",
"def luhnother(ccNumber)\n ccNumber = ccNumber.gsub(/\\d/,'').split(//).collect { |digit| digit.to_i }\n parity = ccNumber.length % 2\n sum = 0\n ccNumber.each_with_index do |digit,index|\n digit = digit * 2 if index%2==parity\n digit = digit - 9 if digit > 9\n sum = sum + digit\n end\n return (sum%10)==0\nend",
"def calculate number\n @left_operand = number\n\n return result()\n end",
"def bsb_number; end",
"def check_miraban num\nend",
"def czech_organisation_number; end",
"def rpn_calculator(str)\nend",
"def phone_number_with_country_code; end",
"def plus_one(number)\n number + 1\nend",
"def call_meeee(number, zumba, &block)\n block.call(number)\nend",
"def int_value(param)\n return \"$#{param.to_s}\"\nend",
"def closure\n n = -25\n return Proc.new { \"n was #{n}, n is now #{n += 1}\"}\n end",
"def extraNumber(a, b, c)\n \nend",
"def credit_card_number; end",
"def subtractClosure(num)\n return lambda {|x| num - x}\nend",
"def total_node_number_cps(tree)\n callcc{|cc|\n helper_2(tree.root, cc, 0)\n }\nend",
"def getNumber _args\n \"getNumber _args;\" \n end",
"def vat_number; end",
"def south_african_close_corporation_registration_number; end",
"def check(number)\n \n end",
"def factorial_cps(n)\n callcc{ |c|\n helper(n,c,1)\n }\nend",
"def numberedOctocat (number)\n\t\tcURL($baseURL+\"?number=#{number}\")\n\tend",
"def call_meeee(number, zumba)\n block.call\nend",
"def zero num_function = nil\n num_function ? num_function.call(0) : 0\nend",
"def digit_list(number)\n # Thank you rubocop for the &:to_i syntax\n number.to_s.chars.map &:to_i\nend",
"def bank_bloc(num)\n return \"Total of $\" + num.to_s\nend",
"def credit_card_number_label\n\t $tracer.trace(__method__)\n return ToolTag.new(span.className(create_ats_regex_string(\"ats-ccnumlbl\")), __method__)\n\tend",
"def z_function(number)\n return 0 if number < 5\n number/5 + z_function(number/5)\nend",
"def ctof(c)\n c * 9.0/5.0 + 32.0\nend",
"def mod11(number); end",
"def area_code\n number[0..2]\n end",
"def lucas(number)\n golden_ratio = (1 + 5**0.5) / 2\n (golden_ratio**number).round.to_i\nrescue StandardError\n 'Error: Provide number only!'\nend",
"def convert_to_number\n @roman_util.compute_number\n end",
"def lucas_number(n) # 3\n return 2 if n == 0\n return 1 if n == 1\n\n lucas_number(n-1) + lucas_number(n-2) \n # 3 = 2 + 1\n # lucas_number(2) => lucas_number()\n # lucas_number(1) => 1\n # (3-1) + (3-2) 2 + 1\nend",
"def f(a)\n return lsin(a) + calcpi() / 2\nend",
"def digit \n\t\n\t$cst.add_branch(\"digit\")\n\t\n\tmatch_token(\"T_DIGIT\", $tokens[$index])\n\t\n\t$cst.ascend\n\t\nend",
"def si_next_no(company, posted_at)\n code = ''\n year = posted_at.year\n company = company.to_s if company.is_a? Fixnum\n company = company.rjust(3, '0')\n year = year.to_s if year.is_a? Fixnum\n year = year.rjust(4, '0')\n last_no = SupplierInvoice.where(\"internal_no LIKE ?\", \"#{company}#{year}%\").order(:internal_no).maximum(:internal_no)\n if last_no.nil?\n code = company + year + '000001'\n else\n last_no = last_no[7..12].to_i + 1\n code = company + year + last_no.to_s.rjust(6, '0')\n end\n code\n end",
"def vat_number(country: T.unsafe(nil)); end",
"def make_phone_call(number, international_code = '+254', area_code = 7)\n puts \"calling #{international_code}-#{area_code}#{number}\"\nend",
"def ctof(c)\n\tc * (9.0 / 5.0) + 32\nend",
"def ctof(celsius)\n\n (celsius * 9/5) + 32\n\nend",
"def po_num\n unescape params['x_po_num']\n end",
"def bsb_number\n compile_bsb_number\n end",
"def plus_one(num_2)\n return num_2 +1\n\nend",
"def plus(number)\n @operation = '+' \n @number = number\nend",
"def number\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 1 )\n value = nil\n __DEC_NUMBER1__ = nil\n __HEX_NUMBER2__ = nil\n\n begin\n # at line 22:2: ( DEC_NUMBER | HEX_NUMBER )\n alt_1 = 2\n look_1_0 = @input.peek( 1 )\n\n if ( look_1_0 == DEC_NUMBER )\n alt_1 = 1\n elsif ( look_1_0 == HEX_NUMBER )\n alt_1 = 2\n else\n raise NoViableAlternative( \"\", 1, 0 )\n end\n case alt_1\n when 1\n # at line 22:4: DEC_NUMBER\n __DEC_NUMBER1__ = match( DEC_NUMBER, TOKENS_FOLLOWING_DEC_NUMBER_IN_number_180 )\n # --> action\n value = __DEC_NUMBER1__.text.to_i \n # <-- action\n\n when 2\n # at line 23:4: HEX_NUMBER\n __HEX_NUMBER2__ = match( HEX_NUMBER, TOKENS_FOLLOWING_HEX_NUMBER_IN_number_187 )\n # --> action\n value = __HEX_NUMBER2__.text[2..-1].to_i(16) \n # <-- action\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 1 )\n\n end\n \n return value\n end",
"def phone_number; end",
"def phone_number; end",
"def do_this_with_parameter(a_number)\n # Do something with that number\n end",
"def ^(p0) end",
"def ^(p0) end",
"def ^(p0) end",
"def ^(p0) end",
"def ^(p0) end",
"def nci bc, ctx\n CodeInterpreter.new bc, ctx\nend",
"def spanish_citizen_number; end",
"def soc(num)\n if num == 1\n return num\n else\n total = num**3 + soc(num-1)\n end\nend",
"def factorial(n, cc)\n if n.zero?\n proc { cc.call(1) }\n else\n factorial n-1, proc { |x| cc.call(n * x) }\n end\n end",
"def Integer(p0) end",
"def digit!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 46 )\n\n \n # - - - - main rule block - - - -\n # at line 392:10: '0' .. '9'\n match_range( 0x30, 0x39 )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 46 )\n\n end",
"def k_num!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 47 )\n\n\n\n type = K_NUM\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 441:4: ( 'round' | 'aleatorio' | 'between' )\n # at line 441:4: ( 'round' | 'aleatorio' | 'between' )\n alt_14 = 3\n case look_14 = @input.peek( 1 )\n when 0x72 then alt_14 = 1\n when 0x61 then alt_14 = 2\n when 0x62 then alt_14 = 3\n else\n raise NoViableAlternative( \"\", 14, 0 )\n\n end\n case alt_14\n when 1\n # at line 441:5: 'round'\n match( \"round\" )\n\n\n when 2\n # at line 441:13: 'aleatorio'\n match( \"aleatorio\" )\n\n\n when 3\n # at line 441:25: 'between'\n match( \"between\" )\n\n\n end\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__, 47 )\n\n\n end",
"def square_of_number(number)\n number * number\nend",
"def crackle(number)\n\treturn \"Crackle\" if number % 3 == 0\nend",
"def next_number(number)\n\n return number + 1\n\nend"
] | [
"0.6357634",
"0.5922278",
"0.57377696",
"0.5723621",
"0.5705648",
"0.5604444",
"0.56027",
"0.56027",
"0.557201",
"0.5550252",
"0.5523592",
"0.5519715",
"0.549374",
"0.5487778",
"0.5479818",
"0.54736334",
"0.54540896",
"0.5410149",
"0.5382446",
"0.53263617",
"0.532513",
"0.53099114",
"0.5304894",
"0.53048766",
"0.53048766",
"0.53001446",
"0.53001446",
"0.52995104",
"0.52930266",
"0.5292768",
"0.52869534",
"0.5269857",
"0.526033",
"0.5252988",
"0.52479345",
"0.524186",
"0.5241554",
"0.5241554",
"0.52350485",
"0.52141637",
"0.52133137",
"0.5212158",
"0.5206597",
"0.5197255",
"0.5185582",
"0.51845664",
"0.51791626",
"0.5176649",
"0.5166917",
"0.5162186",
"0.5151043",
"0.5150203",
"0.5147553",
"0.5146475",
"0.51436734",
"0.5143399",
"0.5142309",
"0.513448",
"0.5114146",
"0.5107962",
"0.51072776",
"0.51055634",
"0.5094506",
"0.50865775",
"0.50845027",
"0.5072745",
"0.5066406",
"0.50649583",
"0.5063343",
"0.50618047",
"0.5056917",
"0.5053791",
"0.50508195",
"0.50494355",
"0.50470257",
"0.50426507",
"0.50394017",
"0.50304985",
"0.50232947",
"0.5022239",
"0.5018554",
"0.50176656",
"0.5015996",
"0.5015996",
"0.5013427",
"0.50133556",
"0.50133556",
"0.50133556",
"0.50133556",
"0.50133556",
"0.50094485",
"0.5005378",
"0.5002104",
"0.500164",
"0.5000871",
"0.4999715",
"0.499881",
"0.49939835",
"0.4991043",
"0.4989012"
] | 0.60230523 | 1 |
Lambda for Rollup ID | def argot_rollup_id(spec)
lambda do |rec, acc|
extractor = MarcExtractor.cached(spec, separator: nil)
oclc_num = extractor.extract(rec).collect! do |o|
Marc21Semantics.oclcnum_extract(o)
end.compact
acc << "OCLC#{oclc_num.first}"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_id \n end",
"def id=(_arg0); end",
"def id=(_arg0); end",
"def id=(_arg0); end",
"def id_number; end",
"def source_record_id_proc\n @source_record_id_proc ||= lambda do |source_xml_record|\n if ( source_xml_record &&\n source_xml_record.kind_of?(Nokogiri::XML::Node) )\n source_xml_record['id'] || (el = source_xml_record.at_xpath('./id') && el.text)\n end\n end\n end",
"def to_param\n self.increment_id\n end",
"def then_sequence_urn_id\n Instance.first.prefix + Instance.sep + seth_prefix + Instance.sep + id.to_s.rjust(Instance.just, '0')\n end",
"def code\n \"%05i\" % id unless new_record?\n end",
"def key_for(id)\n lamb = @key_lambda || lambda { |id| \"deferred-job:#{id}\" }\n lamb.call id\n end",
"def id() end",
"def event_id_getter\n lambda { |x| x[\"id\"] } #maybe not right?\n end",
"def minimum_id(...)\n end",
"def generate_id\n id_generator.call\n end",
"def id\n DistZip.to_s.dash_case\n end",
"def unique_id\n \"#{@table.name}-#{@id}\"\n end",
"def object_id() end",
"def id_hash_generator(number)\n{:id => number }\nend",
"def id_generator; end",
"def cs_transaction_uuid\n \"mbs_\" + id\n end",
"def source_record_id_proc\n @source_record_id_proc ||= lambda do |source_marc_record|\n if ( source_marc_record &&\n source_marc_record.kind_of?(MARC::Record) &&\n source_marc_record['001'] )\n source_marc_record['001'].value\n end\n end\n end",
"def local_id; end",
"def make_id\n \"#{self.class.name.downcase}#{id}\"\n end",
"def id\n sale_id.to_i\n end",
"def operation_unique_id(payment)\n \"#{payment.number}-#{random_suffix}\"\n end",
"def numid=(_); end",
"def key_id=(_arg0); end",
"def to_generate_record_id(&block_)\n @record_id_generator = block_ || Logger._get_default_record_id_generator\n end",
"def make_id\n new_id = @id\n @id += 1\n new_id\n end",
"def _id\n @id\n end",
"def hash\n \tcustom_unique_id.hash\n end",
"def calculate_invoice_identifier\n invoice_array = Invoice.where(year: Time.now.strftime(\"%Y\").to_i, category: @event.category)\n return 1 if invoice_array.empty?\n latest_identifier = invoice_array.last.invoice_identifier\n latest_identifier + 1\n end",
"def unique_id\n $unique_id_increment = ($unique_id_increment || 0) + 1\n return (Time.new.to_f * 1000).to_i.to_s + $unique_id_increment.to_s\nend",
"def id\n new_resource.bucket_name || new_resource.name\n end",
"def principal_id\n self.class.to_s + \"-#{id}\"\n end",
"def id\n `return #{@element}.id ? #{self}.Y(#{@element}.id) : #{nil};`\n end",
"def investor_guid\n \"#{investor_type.underscore}-#{investor_id}\"\n end",
"def code\n id ? id.to_s(36) : nil\n end",
"def gen_id(i_cal_evt)\n return Base32.encode(i_cal_evt.uid.to_s + i_cal_evt.recurrence_id.to_s + i_cal_evt.sequence.to_s)\n end",
"def id\n #NOOP\n end",
"def id; 1; end",
"def id ; @record.id if @record ; end",
"def loop_sequence_urn_id\n Instance.first.prefix + Instance.sep + selp_prefix + Instance.sep + id.to_s.rjust(Instance.just, '0')\n end",
"def target_id; seq2.entry_id; end",
"def make_unique_id(item)\n return item['id'] if item['id']\n\n unique_id = \"\"\n unique_id << item.title if item.title\n\n if summary = item.summary\n if summary.length < 200\n unique_id << summary\n else\n first_100 = summary[0,100]\n unique_id << first_100 unless first_100.nil?\n n = [100,summary.length].min\n last_100 = summary[-n..-1]\n unique_id << last_100 unless last_100.nil?\n end\n end\n\n Digest::SHA1.hexdigest(unique_id)\n end",
"def id\n @operation.id\n end",
"def external_id; end",
"def uwt_id\n GraphQL::Schema::UniqueWithinType.encode(self.class.name, id)\n end",
"def payer_id\n payer_of_first_check = checks.first.payer\n job = checks.first.job\n payer_type = job.payer_group if !job.blank?\n output_config = facility.output_config(payer_type)\n case output_config.grouping\n when 'By Check'\n payer_of_first_check.supply_payid if payer_of_first_check\n when 'By Payer','By Payer Id'\n payer_wise_payer_id(output_config)\n when 'By Batch', 'By Batch Date', 'By Cut'\n generic_payer_id(output_config)\n end\n end",
"def rp_id; end",
"def id()\n #This is a stub, used for indexing\n end",
"def orchestrate_primary_key\n id\n end",
"def generate_id\n id = @ids.first[:count]\n @ids.where(:id => 1).update(:count => id + 1)\n id\n end",
"def _wp_filter_build_unique_id(tag, function, priority)\n return function if function.is_a?(String)\n\n # TODO continue\n if !function.is_a?(Array) # is_object( function )\n # Closures are currently implemented as objects.\n function = [function, '']\n else\n # function = (array) function;\n end\n\n if !function.is_a?(Array) # is_object( function[0] )\n # Object class calling.\n ( function[0].object_id.to_s ) + function[1] # spl_object_hash\n elsif function[0].is_a? String\n # Static calling.\n function[0] + '::' + function[1]\n end\n\n end",
"def replace_name_with_id (repo_name)\n return Hubstats::Repo.where(full_name: repo_name).first.id.to_i\nend",
"def appeal_status_id\n \"A#{id}\"\n end",
"def generate_id\n id = @id\n @id += 1\n id\n end",
"def id\n return @args[:id]\n end",
"def next_id\n next_id = \"sdc:\" + (current_id.to_i + 1).to_s\n next_id\n end",
"def get_id\n @id ||= 0\n @id += 1\n @id\n end",
"def uid(idx)\n sprintf(\"%s%.2d\", id, idx)\n end",
"def item_id(input_name:, op:)\n fv = op.input(input_name)\n fv.part.try(:id) || fv.item.id\n end",
"def next_id\n (@curr_id +=1).to_s\n end",
"def get_id()\n @id\n end",
"def get_id()\n @id\n end",
"def __id__() end",
"def increment_public_id\n if self.public_id.blank?\n self.public_id = Compound.exists? ? Compound.order(:public_id).last.public_id.next : 'RDDB00001'\n end\n end",
"def basic_generate_id(str); end",
"def compound_id\n \"#{self.exhibit_id}-#{self.id}\"\n end",
"def id\n @values.fetch('ai.operation.id') { \n @values['ai.operation.id'] = nil\n }\n end",
"def container_id\n super.to_i rescue nil\n end",
"def id; 1; end",
"def id; end",
"def id; end",
"def id; end",
"def id; end",
"def id; end",
"def id; end",
"def id; end",
"def id; end",
"def id; end",
"def id; end",
"def id; end",
"def id; end",
"def unique_name(id)\n id.to_s\n end",
"def sequence_id\n object.sequence._id.to_s\n end",
"def to_param\n commit_id\n end",
"def gen_name\n\t\tlast_id = Bill.last ? Bill.last.id + 1 : 1\n\t\t\"#{last_id}-1-1\"\n\tend",
"def generate_next_callout_id\n generate_callout_id(@list_index, @co_index)\n end",
"def to_param\n sequential_id.to_s\n end",
"def generate_callout_id(list_index, co_index)\n \"CO#{list_index}-#{co_index}\"\n end",
"def to_id\n \"[#{ self.id }]\" unless id.nil?\n end",
"def id\n __id\n end",
"def id\n (published_at.to_date.to_s(:db).gsub('-','') + published_at.min.to_s + published_at.sec.to_s).to_i\n end",
"def id\n @grit_commit.id\n end",
"def request_id=(_arg0); end",
"def add_dummy_update_id\n add_dummy_create_id\n end",
"def id\n get_val(:id)\n end",
"def get_install_id\n @redis.setnx(\"tessen:install_id\", rand(36**12).to_s(36)) do |created|\n @redis.get(\"tessen:install_id\") do |install_id|\n yield install_id\n end\n end\n end",
"def id\n @__metadata__.key || @id\n end"
] | [
"0.5741075",
"0.5738728",
"0.5738728",
"0.5738728",
"0.56978136",
"0.55969846",
"0.55409384",
"0.55069935",
"0.5503045",
"0.5482689",
"0.5459605",
"0.54581225",
"0.5438138",
"0.5433964",
"0.541559",
"0.5391834",
"0.5383986",
"0.5342479",
"0.5276477",
"0.5270603",
"0.52628195",
"0.5259457",
"0.52522486",
"0.5247118",
"0.52435166",
"0.5224997",
"0.5208808",
"0.5202326",
"0.5195105",
"0.51756954",
"0.5161717",
"0.51520437",
"0.51454633",
"0.51289517",
"0.5119338",
"0.5118716",
"0.51187015",
"0.5107451",
"0.5105947",
"0.51005733",
"0.5093904",
"0.5091355",
"0.5089632",
"0.50884616",
"0.5079664",
"0.507826",
"0.507648",
"0.50763786",
"0.5074412",
"0.5072211",
"0.5070455",
"0.5065717",
"0.5065023",
"0.5064401",
"0.50585103",
"0.5053918",
"0.5051576",
"0.5049857",
"0.5040657",
"0.50394946",
"0.50387156",
"0.50320166",
"0.50170386",
"0.50166416",
"0.50166416",
"0.501265",
"0.50121987",
"0.5011364",
"0.5007384",
"0.5002056",
"0.4997853",
"0.49964058",
"0.49943084",
"0.49943084",
"0.49943084",
"0.49943084",
"0.49943084",
"0.49943084",
"0.49943084",
"0.49943084",
"0.49943084",
"0.49943084",
"0.49943084",
"0.49943084",
"0.4991303",
"0.49902183",
"0.49857682",
"0.49816728",
"0.49792576",
"0.4974641",
"0.49738395",
"0.49733755",
"0.49690756",
"0.4967854",
"0.49672103",
"0.49653298",
"0.49552572",
"0.4952587",
"0.49520987",
"0.49501643"
] | 0.5822824 | 0 |
Lambda for Generic Vernacular Object | def argot_gvo(spec)
lambda do |rec, acc|
gvo = ArgotSemantics.get_gvo(rec, spec)
acc << gvo if gvo
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lambda; end",
"def call(object); end",
"def initialize\n @get_target_type = ->t{t}\n @get_target_field = ->f{f.name}\n @get_target_key = ->f{f.name}\n yield(self) if block_given?\n end",
"def to_proc\n ->(**properties) { perform(**properties) }\n end",
"def to_proc()\n #This is a stub, used for indexing\n end",
"def to_proc() end",
"def to_proc() end",
"def fmap(*)\n raise NotImplementedError\n end",
"def value_of v, *args\n if v.is_a? Symbol\n context.get v\n elsif v.respond_to? :call\n context.instance_exec *args, &v\n else\n v\n end\n end",
"def V(*args)\n end",
"def to_proc\n lambda { |x| }\n end",
"def to_proc() self ; end",
"def transform(value, instance); end",
"def otCreate(rconstant, &block)\n otObj = $otObjectService.createObject(rconstant.java_class)\n yield otObj\n otObj\nend",
"def invoke; end",
"def meta_eval &blk; metaclass.instance_eval &blk; end",
"def meta_eval &blk; metaclass.instance_eval &blk; end",
"def __init__ context\n function = Virtual::CompiledMethod.new(:__init__ , [] , Virtual::Integer)\n clazz = Virtual::BootSpace.space.get_or_create_class :Kernel\n method = clazz.resolve_method :main\n me = Virtual::Self.new(Virtual::Reference)\n code = Virtual::Set.new(Virtual::Self.new(me.type), me)\n function.add_code(code)\n function.add_code Virtual::MethodCall.new(method)\n return function\n end",
"def generic?; true; end",
"def method_name\n :lambda\n end",
"def to_proc\n self\n end",
"def lambda=(_); end",
"def custom_tap(object)\n\tyield(object)\n\tobject\nend",
"def convert_type_proc(v)\n case v\n when Java::OrgPostgresqlJdbc4::Jdbc4Array\n PGArrayConverter.new(method(:convert_type_proc))\n when Java::OrgPostgresqlUtil::PGobject\n PG_OBJECT_METHOD\n else\n super\n end\n end",
"def on_tlambda(token)\n log \"TLAMBDA: '#{token}'\"\n super(token)\n end",
"def transition_for(object, requirements = T.unsafe(nil)); end",
"def liquid_method_missing(method); end",
"def instance_type=(_arg0); end",
"def functor_t\n raise NotImplementedError\n end",
"def to_proc\n -> target { self.call(target) }\n end",
"def to_proc\n -> target { self.call(target) }\n end",
"def to_proc\n method(:transform).to_proc\n end",
"def to_proc\n -> x { actual(x) }\n end",
"def make_lambda(filter)\n case filter\n when Symbol\n lambda { |target, _, &blk| target.send filter, &blk }\n when Conditionals::Value then filter\n when ::Proc\n if filter.arity > 1\n return lambda { |target, _, &block|\n raise ArgumentError unless block\n target.instance_exec(target, block, &filter)\n }\n end\n\n if filter.arity <= 0\n lambda { |target, _| target.instance_exec(&filter) }\n else\n lambda { |target, _| target.instance_exec(target, &filter) }\n end\n else\n scopes = Array(chain_config[:scope])\n method_to_call = scopes.map{ |s| public_send(s) }.join(\"_\")\n\n lambda { |target, _, &blk|\n filter.public_send method_to_call, target, &blk\n }\n end\n end",
"def create_lambda(arg)\n case arg\n when Proc then arg\n when Symbol then lambda { |request| request[arg] }\n else raise \"Canot create a lambda expression from this argument: #{arg.inspect}!\"\n end\n end",
"def create_lambda(arg)\n case arg\n when Proc then arg\n when Symbol then lambda { |request| request[arg] }\n else raise \"Canot create a lambda expression from this argument: #{arg.inspect}!\"\n end\n end",
"def a(objName, &block)\n \n template = make_template(objName,&block)\n\n @objToTemplates[objName] = template\n \n # this allows the client to do something like user * 5\n # define_method objName -> template\n self.class.send(:define_method,objName.to_sym) {template}\n \n \n template\nend",
"def on_tlambda *xs\n unless @found\n @level += 1\n end\n super\n end",
"def lambda_tester\n puts \"To string: #{self}\"\n puts \"kind: #{self.kind}\"\n case self.kind\n when :variable\n puts \"value: #{self.value}\"\n when :abstraction\n puts \"bound_var: #{self.bound_var}\"\n puts \"body: #{self.body}\"\n when :application\n puts \"function: #{self.function}\"\n puts \"argument: #{self.argument}\"\n end\n end",
"def get(object); end",
"def transform_Collector(o, scope)\n o\n end",
"def tvData _obj, _args\n \"_obj tvData _args;\" \n end",
"def accept(visitor); end",
"def accept(visitor); end",
"def validatable_object(&block)\n klass= Class.new(Validatable)\n klass.class_eval(&block) if block_given?\n def klass.name\n \"ValidatableObjectInstance\"\n end\n klass\nend",
"def check_with(&lambda)\n self.evalLambda = lambda\n end",
"def to_proc\n lambda{ call }\n end",
"def _V(data) ; end",
"def to_proc\n if value = @value\n lambda{ value }\n else\n block = @block\n lambda do |*args|\n instance_exec(*args, &block)\n end\n end\n end",
"def eval_as_proc(obj)\n obj.respond_to?(:call) ? obj.call : obj\n end",
"def object; end",
"def object; end",
"def object; end",
"def object; end",
"def object; end",
"def object; end",
"def object; end",
"def object; end",
"def object; end",
"def object; end",
"def object; end",
"def object; end",
"def object; end",
"def object; end",
"def object; end",
"def take_as(objType, name)\n @visitor = Visitor.new(objType)\n @visitor.name = name\n @visitor\n end",
"def transform(t)\n ovwrite_me t.vectormult(self)\n end",
"def wrap(object); end",
"def Reac(obj=nil, &block)\n if block\n Reac::Proc.new(block)\n else\n if obj.is_a?(Array)\n Reac::Array.new(obj)\n else\n Reac::Value.new(obj)\n end\n end\nend",
"def to_proc\n proc { |value| self.(value) }\n end",
"def to_proc\n proc { |value| self.(value) }\n end",
"def to_proc\n proc { |value| self.(value) }\n end",
"def rucas &block\n self.instance_eval(&block)\n end",
"def to_proc\n ->(*args) {call(*args)}\n end",
"def method_missing(*args, &block)\n __value.public_send(*args, &block)\n end",
"def dynamic; end",
"def on_transform(&blk)\n @transform_handler = blk\n self\n end",
"def model(make_of_model: T.unsafe(nil)); end",
"def reflection; end",
"def reflection; end",
"def inside_t1\n yield\n end",
"def initialize(*)\n super\n reduce(public, any)\n end",
"def to_proc\n Proc.new {|*args| self.invoke(*args) }\n end",
"def const(v)\n proc {|_|v}\n end",
"def handle_pipeline(object, &block)\n object.is_a?(Redis::Future) ? object.add_transformation(&block) : block.call(object)\n end",
"def as_block\n lambda do |rec|\n call(rec)\n end\n end",
"def initialize(from, to, ops)\n @from = from.is_a?(Symbol) ? Unit.get(from) : from\n @to = to.is_a?(Symbol) ? Unit.get(to) : to\n raise(Error::Transformation, \"Put your lambda in an array\") if block_given?\n @ops = ops\n end",
"def load_event_for_template event\n def event.object; eventable; end\n def event.object_type; eventable_type; end\n\n event\n end",
"def spike_lamb_wrap\n PipeProc.new do |coll|\n coll.map do |tuple|\n tuple[1].map do |test|\n dp = DecoratedProc.new do \n obj = tuple[0].new\n obj.try :set_up\n obj.send test\n obj.try :tear_down\n end\n dp.message = \"#{tuple[0].name}::#{test.to_s}\"\n dp\n end\n end\n end\nend",
"def method_missing(method, *args, &block)\n object.public_send(method, *args, &block)\n end",
"def method_missing(call)\n object.send(call)\n end",
"def _get_instance_variable context , name = Virtual::Integer\n get_function = Virtual::MethodSource.create_method(:Object,:_get_instance_variable , [ ] )\n return get_function\n # me = get_function.receiver\n # var_name = get_function.args.first\n # return_to = get_function.return_type\n #\n # index_function = ::Virtual.machine.space.get_class_by_name(:Object).resolve_method(:index_of)\n # # get_function.push( [me] )\n # # index = get_function.call( index_function )\n #\n # after_body = get_function.new_block(\"after_index\")\n # get_function.current after_body\n #\n # # get_function.pop([me])\n # # return_to.at_index( get_function , me , return_to )\n #\n # # get_function.set_return return_to\n # return get_function\n end",
"def method_missing(method_id, object)\n return object(object)\n end",
"def processor(params = T.unsafe(nil)); end",
"def call(object, context = T.unsafe(nil), *args, &block); end",
"def register_typed_action lambda\n RubyScriptProvidedTypedHandler.register_script_typed_handler RubyScriptHandlerImpl.new(lambda)\nend",
"def reflector; end",
"def reflector; end",
"def convert(object); end",
"def test_can_pass_a_lambda_to_lambda_indexed_in_a_list\n result = interpret <<-EOC\na=~{callme: ->(fn) { %fn }}\n%a[callme:](->() {4})\nEOC\n assert_eq result, 4\n end",
"def initialize(object,name,type=nil,description=nil,value=nil)\n super(name,type,description)\n\n @object = object\n\n if (self.value.nil? && !value.nil?)\n self.value = case value\n when Proc\n if value.arity > 0\n value.call(@object)\n else\n value.call()\n end\n else\n begin\n value.clone\n rescue TypeError\n value\n end\n end\n end\n end"
] | [
"0.60795176",
"0.5592288",
"0.5591423",
"0.5572634",
"0.555421",
"0.5429147",
"0.5429147",
"0.5367591",
"0.53259087",
"0.5301907",
"0.52794814",
"0.5279038",
"0.5251005",
"0.52347434",
"0.51998305",
"0.51756805",
"0.51756805",
"0.51631045",
"0.513148",
"0.51228267",
"0.5118996",
"0.5118809",
"0.5112355",
"0.51091975",
"0.510658",
"0.50813985",
"0.50641733",
"0.5059657",
"0.5057346",
"0.5051539",
"0.5051539",
"0.5016275",
"0.5013397",
"0.50130177",
"0.500921",
"0.500921",
"0.5008884",
"0.4986233",
"0.49859387",
"0.49798423",
"0.497676",
"0.4965462",
"0.49552777",
"0.49552777",
"0.49466372",
"0.4934213",
"0.49290556",
"0.49102592",
"0.49026555",
"0.48877025",
"0.48852593",
"0.48852593",
"0.48852593",
"0.48852593",
"0.48852593",
"0.48852593",
"0.48852593",
"0.48852593",
"0.48852593",
"0.48852593",
"0.48852593",
"0.48852593",
"0.48852593",
"0.48852593",
"0.48852593",
"0.48642516",
"0.48605162",
"0.48512074",
"0.4850949",
"0.4845114",
"0.4845114",
"0.4845114",
"0.48220557",
"0.4814657",
"0.4812746",
"0.4806386",
"0.4805811",
"0.4805296",
"0.4801327",
"0.4801327",
"0.4798293",
"0.4795008",
"0.479343",
"0.47928154",
"0.4789048",
"0.47599685",
"0.47577864",
"0.47486562",
"0.47473824",
"0.47468874",
"0.47432348",
"0.47414032",
"0.47393563",
"0.47374648",
"0.47362202",
"0.47322506",
"0.47316584",
"0.47316584",
"0.4731511",
"0.4728546",
"0.47245005"
] | 0.0 | -1 |
Converts an array of string to a delimited hierarchical facet value as expected by blacklighthierarchy. e.g. [foo, bar, baz] => [ foo, foo:bar, foo:bar:baz ] | def array_to_hierarchy_facet(args, delimiter = ':')
result = []
args.each_with_object([]) do |part, acc|
acc << part
result << acc.join(delimiter)
end
result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def explode_hierarchical_strings(array_of_strings, delimiter = ':')\n split_arrays = array_of_strings.map { |s| s.split(delimiter) }\n result = arrays_to_hierarchy(split_arrays)\n result.flatten.uniq\n end",
"def hierarchies(array)\n count = 0\n array.reduce([]) { |acc, value| acc << array.slice(0, count += 1) }\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 format_comb(arr)\n ret = []\n arr.each do |sub_arr|\n if sub_arr.size > 1\n # use dash to connect the multiple strings \n ret << sub_arr.inject('') {|acc, e| acc + e + '-' }[0..-2]\n elsif sub_arr.size == 1\n ret << sub_arr[0]\n else\n # do nothing...\n end\n end\n return ret\n end",
"def convert_array(arr)\n return '' if arr.nil?\n result = ''\n case arr\n when String, Fixnum then result << arr.to_s\n when NilClass then result << ''\n when Array\n case arr.first\n when String, Fixnum\n result << '<ul>'\n arr.each do |a|\n result << \"<li>#{convert_array(a)}</li>\" unless a.empty?\n end\n result << '</ul>'\n when NilClass then result << ''\n when Array\n result << '<ul>'\n arr.each do |a|\n result << convert_array(a)\n end\n result << '</ul>'\n when Hash\n # Change the formatting of sub-tables for easier viewing\n result << '<span class=\"ReportCSSChildTable ReportCSS\"><table><thead><tr>'\n arr.first.keys.each { |a| result << \"<td>#{convert_array(a)}</td>\" }\n result << '</tr></thead><tbody>'\n arr.each do|a|\n result << '<tr>'\n a.values.each { |b| result << \"<td>#{convert_array(b)}</td>\" }\n result << '</tr>'\n end\n result << '</tbody></table></span>'\n else\n result << 'Unknown value!!'\n end\n else\n result << 'Unknown value!'\n end\n end",
"def join_nested_strings(array)\n string_array = []\n count = 0\n while count < array.length do\n\n inner_count = 0\n while inner_count < array[count].length do\n if array[count][inner_count].class == String\n string_array << array[count][inner_count]\n else\n string_array = string_array\n end\n inner_count += 1\n\n end\n count += 1\n end\n string_array.join(\" \")\nend",
"def treeify(arr, pre)\n arr.map { |elem| (elem.is_a? Array) ? treeify(elem, pre + \"-\") : nodeify(pre, elem) }\n end",
"def list(arr)\n return \"\" if arr.empty?\n\n str = []\n\n arr.each do |hsh|\n hsh.each do |k, v|\n str << v\n end\n end\n \n return str[0] if str.length < 2\n\n names = ''\n idx = 0\n\n until idx == str.length - 2\n names << str[idx] + ', '\n idx += 1\n end\n names << str[-2] + ' & '\n names << str[-1]\n \nend",
"def my_split(array) \n splitted = []\n array.each do |element|\n element.split(//).each { |each_splitted| splitted << each_splitted }\n end\n splitted\n end",
"def decode_hierarchy_option(array_value, use_codes_instead_of_es_codes)\n if !array_value.kind_of?(Array)\n array_value = [array_value]\n end\n value_ids = []\n array_value.each do |value|\n value_id = check_option_exists(value, use_codes_instead_of_es_codes)\n value_ids << value_id\n end\n value_ids\n end",
"def resolve_labels(g)\n g.map! { |a|\n # if input was foo|bar...|baz, where ... is wildcard, a looks like [\"foo/B\",\"bar.../AB\",\"baz\"]\n aa = [] # new version of a with labels and wildcards resolved\n a.each { |b|\n parts = ''\n if b=~/(.*)\\/(.*)/ then\n b,parts = [$1,$2]\n end\n aa = aa + label_to_list(b,parts) # label_to_list can return a list with >1 element if there's a wildcard, 0 elts if no match\n }\n if aa.length==0 then\n aa = [[-1,'','']]\n end # later code assumes not empty list\n aa\n }\n return g\nend",
"def kesha_maker(array)\n array.collect do |element|\n split_element_to_array = element.split(\"\")\n split_element_to_array[2] = \"$\"\n joined_array = split_element_to_array.join\n joined_array\n end\nend",
"def clean_facets_array(facets_array)\n Array(facets_array).map {|text| fix_subfield_demarcators(text) }.compact.uniq\n end",
"def toPathList(arr); arr.join(File::PATH_SEPARATOR) end",
"def render_facet_hierarchy_item(field_name, data, key)\n item = data[:_]\n subset = data.reject { |k,v| ! k.is_a?(String) }\n \n li_class = subset.empty? ? 'h-leaf' : 'h-node'\n li = ul = ''\n \n if item.nil?\n li = key\n elsif facet_in_params?(field_name, item.qvalue)\n li = render_selected_qfacet_value(field_name, item)\n else\n li = render_qfacet_value(field_name, item)\n end\n \n unless subset.empty?\n subul = subset.keys.sort.collect do |subkey| \n render_facet_hierarchy_item(field_name, subset[subkey], subkey) \n end.join('')\n ul = \"<ul>#{subul}</ul>\".html_safe\n end\n \n %{<li class=\"#{li_class}\">#{li.html_safe}#{ul.html_safe}</li>}.html_safe\nend",
"def flatten(arr)\n\n flat = []\n\n arr.each do |el|\n if el.class != Array\n flat << el \n else\n #flatten(el).each {|char| flat << char}\n flat.push(*flatten(el))\n end\n end\n flat \nend",
"def prettyify_array(gemspec_ruby, array_name); end",
"def join_domain( arr )\n arr.map {|i|\n if /\\A\\[.*\\]\\z/ === i\n i\n else\n quote_atom(i)\n end\n }.join('.')\n end",
"def split_strip_compact_array(values_str_array, delimiter = \",\")\n return [] if not values_str_array\n values_str_array.inject([]) {|s,x| s + split_strip_compact(x, delimiter)}\nend",
"def join_split(arr=nil)\n\t\tarr.join.split(\"\") if not arr.nil? and arr.respond_to? :push\n\tend",
"def strify_array( array )\n\t\tarray = [ array ] if !array.is_a?( Array )\n\t\tarray.map do |m|\n\t\t\tm = (Array === m) ? strify_array(m) : m\n\t\t\tm = (Hash === m) ? strify_hash(m) : m\n\t\t\tSymbol === m ? m.to_s : m\n\t\tend\n\tend",
"def formatted_teams(array)\n array.map { |team| team.name } * \", \"\n end",
"def fn_join(value)\n unless value.last.is_a?(Array)\n val = value.last.to_s.split(\",\")\n else\n val = value.last\n end\n val.join(value.first)\n end",
"def embed_array(array, graph)\n if array.all? { |item| item.is_a?(Hash) }\n if array.all? { |item| item.key?(\"@language\") }\n array.map { |item| item[\"@value\"] }.join(\", \")\n else\n array.map { |item| embed(item, graph) }\n end\n else\n strings = array.select { |item| item.is_a?(String) }.join(\", \")\n others = array.select { |item| !item.is_a?(String) }.map { |item| embed(item, graph) }\n [strings, others].join(\" \").strip\n end\n end",
"def name(arr)\n\tarr.join(' ')\nend",
"def group_by_depth(arr)\n output = []\n\n nested = false\n arr.each do |x|\n\n if output.last\n\n last_line = output.last[-1]\n\n if line_depth(last_line) == line_depth(x)\n\n if x =~ /Features:/ && last_line =~ /Page: \\d/\n nested = true\n end\n\n if nested\n output.last << x\n else\n output << [x]\n end\n\n elsif line_depth(last_line) > line_depth(x)\n # we are outdenting\n nested = false\n output << [x]\n\n elsif line_depth(last_line) < line_depth(x)\n # we are indenting further\n nested = true\n output.last << x\n end\n else\n output << [x]\n end\n end\n\n output\n end",
"def fixed_array\n reformated_array.map! do |element|\n element.join(\", \").split(\", \")\n end \nend",
"def word_mesh(arr)\n \"\".tap do |m|\n arr.each_cons(2) do |a,b|\n until a.end_with?(b)\n b = b.chop\n return \"failed to mesh\" if b.empty?\n end\n m << b\n end\n end\nend",
"def array_to_html array, type\n '<ul> <li>' +\n array.join('</li><li>')\n + '</li> </ul>'\nend",
"def split_by(array, delim)\n ret = []\n a = []\n array.each do |i|\n if i == delim then\n ret << a\n a = []\n else\n a << i\n end\n end\n ret << a unless a.empty?\n return ret\n end",
"def build_tags(tags, category)\n \t\ttags = tags.split(',').map{ |tag| tag.strip } << category\n \t\ttags.flatten\n \tend",
"def bracketed_list(values)\n temp=\"\"\n temp += \"[\"\n values.each {|val| temp += \"#{val.to_s}, \"}\n temp += \"]\"\n return temp\nend",
"def join_split(array=nil, *rest)\n\tarray.join.split(//) if not array.nil? and array.respond_to? :join\nend",
"def encode_array(arr)\n arr.join ','\n end",
"def oxford_comma(array)\n if array.length == 1\n array.join\n elsif array.length == 2\n array.join(\" and \")\n elsif array.length > 2\n element_storage = array.pop\n new_array = [\"and\"]\n new_array.push(element_storage)\n new_string = new_array.join(\" \")\n array.push(new_string)\n final_array = array.join(\", \")\n end\nend",
"def kesha_maker(array)\n kesha_array = []\n\n array.each do |name|\n name_array = name.split(\"\")\n name_array[2] = \"$\"\n result = name_array.join\n kesha_array << result\n end\n\n kesha_array\nend",
"def remove_initial_and_format_change(info) # removes middle initial for space_names and pipe_names AND puts comma_names into nested arrays\n if !info[0].include?(\"|\") && !info[0].include?(\",\")\n info.map! {|element| element.split(\" \")}\n info.each {|element| element.slice!(-4)} \n info\n elsif info[0].include?(\"|\")\n info.map! {|element| element.split(\" | \")}\n info.each {|element| element.slice!(-4)} \n info\n else\n info.map! {|element| element.split(\", \" )} \n end\nend",
"def render_tree(elements, symbols, parents = [])\n i = 0\n x = elements.map do |li|\n last = elements.length == i+1\n\n current = indentation(parents, last, symbols) + li[:value]\n\n children = \"\"\n if li[:children].length > 0\n children = \"\\n\" + render_tree(li[:children], symbols, parents + [last])\n end\n\n i += 1\n current + children\n end\n\n x.join(\"\\n\")\n end",
"def prettyify_array(gemspec_ruby, array_name)\n gemspec_ruby.gsub(/s\\.#{array_name.to_s} = \\[.+?\\]/) do |match|\n leadin, files = match[0..-2].split(\"[\")\n leadin + \"[\\n #{files.split(\",\").join(\",\\n \")}\\n ]\"\n end\n end",
"def prettyify_array(gemspec_ruby, array_name)\n gemspec_ruby.gsub(/s\\.#{array_name.to_s} = \\[.+?\\]/) do |match|\n leadin, files = match[0..-2].split(\"[\")\n leadin + \"[\\n #{files.split(\",\").join(\",\\n \")}\\n ]\"\n end\n end",
"def stringify_line_array(array)\n new_array = array.map { |item| item.to_s =~ /[A-Z]{1}\\b/ ? item.to_s.insert(item.to_s =~ /[A-Z]{1}\\b/, \" \").capitalize : item.to_s.capitalize }\n new_array.map! { |item| item.split.map(&:capitalize)*' ' }\n end",
"def stringified_choices(arr = Array(options[:choices]))\n arr.collect {|entry| entry.is_a?(Array) ? stringified_choices(entry) : entry.to_s}\n end",
"def corp_stacks_str_arr(arr = [])\n @corp_stacks.each.with_index do |stack, index|\n arr << \"- Railroad Company stack #{index + 1}: #{stack.map(&:name).reverse.join(', ')}\" unless stack.empty?\n end\n arr\n end",
"def quote_array(value)\n \"(#{value.map { |entry| quote_value(entry) }.join(', ')})\"\n end",
"def flatten_repetition(list, named) # :nodoc:\n if list.any? { |e| e.instance_of?(Hash) }\n # If keyed subtrees are in the array, we'll want to discard all \n # strings inbetween. To keep them, name them. \n return list.select { |e| e.instance_of?(Hash) }\n end\n\n if list.any? { |e| e.instance_of?(Array) }\n # If any arrays are nested in this array, flatten all arrays to this\n # level. \n return list.\n select { |e| e.instance_of?(Array) }.\n flatten(1)\n end\n \n # Consistent handling of empty lists, when we act on a named result \n return [] if named && list.empty?\n \n # If there are only strings, concatenate them and return that. \n foldl(list) { |s,e| s+e }\n end",
"def formatStepList(stepList)\n formattedList = []\n for direction in stepList\n for step in direction\n formattedList.push(step)\n end\n end\n return formattedList\nend",
"def printArray(array)\n array.flatten!\n string = \"\"\n array.each {|letter| string << \"#{letter},\"}\n string.chomp(\",\")\nend",
"def labels(hash_or_item, separator: '.')\n return nil unless hash_or_item.instance_of? Hash\n label_array = hash_or_item.map do |key, value|\n if value.instance_of? Hash\n labels(value, separator: separator).map { |v| prefix(key.to_s+separator, v) }.flatten\n else\n key.to_s\n end\n end\n label_array.flatten\nend",
"def stringify_array( array )\n\t\t\treturn array.collect do |item|\n\t\t\t\tcase item\n\t\t\t\twhen Symbol\n\t\t\t\t\titem.to_s\n\t\t\t\twhen Array\n\t\t\t\t\tstringify_array( item )\n\t\t\t\telse\n\t\t\t\t\titem\n\t\t\t\tend\n\t\t\tend\n\t\tend",
"def stringify_array( array )\n\t\t\treturn array.collect do |item|\n\t\t\t\tcase item\n\t\t\t\twhen Symbol\n\t\t\t\t\titem.to_s\n\t\t\t\twhen Array\n\t\t\t\t\tstringify_array( item )\n\t\t\t\telse\n\t\t\t\t\titem\n\t\t\t\tend\n\t\t\tend\n\t\tend",
"def stringify_array( array )\n\t\t\treturn array.collect do |item|\n\t\t\t\tcase item\n\t\t\t\twhen Symbol\n\t\t\t\t\titem.to_s\n\t\t\t\twhen Array\n\t\t\t\t\tstringify_array( item )\n\t\t\t\telse\n\t\t\t\t\titem\n\t\t\t\tend\n\t\t\tend\n\t\tend",
"def array_string(array, **opt)\n list_separator = opt[:list_separator] || LIST_SEPARATOR\n normalized_list(array, **opt).join(list_separator)\n end",
"def make_list(array)\n string = \"\"\n array.each_with_index do |item, index|\n index < array.length-1? c = \", \": c = \"\"\n formatted_item = \"#{index +1}. #{item}#{c}\"\n string = string.concat(formatted_item)\n end\n string\nend",
"def arrayorize(value)\n case value\n when nil then return []\n when String then value.to_s.split\n when Symbol then value.to_s.split\n else value\n end\n end",
"def makelist(list)\n case list\n when String\n list = list.split(/[:;]/)\n else\n list = Array(list).map{ |path| path.to_s }\n end\n list.reject{ |path| path.strip.empty? }\n end",
"def makelist(list)\n case list\n when String\n list = list.split(/[:;]/)\n else\n list = Array(list).map{ |path| path.to_s }\n end\n list.reject{ |path| path.strip.empty? }\n end",
"def makelist(list)\n case list\n when String\n list = list.split(/[:;]/)\n else\n list = Array(list).map{ |path| path.to_s }\n end\n list.reject{ |path| path.strip.empty? }\n end",
"def convertObjectsArrToStringArr(arr)\r\n i = 0\r\n stringArr = []\r\n while i < arr.length\r\n holder = arr[i].to_s\r\n if(holder != \"\")\r\n if(holder[0] != \"#\")\r\n if(!holder.include? \"::\")\r\n stringArr.append(holder)\r\n end\r\n end\r\n end\r\n #p holder\r\n # puts stringArr[i]\r\n i += 1\r\n end\r\n return stringArr\r\n end",
"def partlist(arr)\n len = arr.length\n i = 0\n masterArr = []\n while i < len - 1 do\n masterArr << [arr[0..i].join(\" \")] + [arr[i+1..len].join(\" \")]\n i += 1\n end\n masterArr\nend",
"def format_to_array(value)\n case value\n when Array then value\n when String then value.split(separator)\n else raise InvalidTagFormat\n end\n end",
"def kesha_maker(array)\n array.map do |elem|\n word_splice = elem.split(\"\")\n word_splice[2] = \"$\"\n word_splice.join\n end\nend",
"def stringify(arr)\n arr.map { |s| s.to_s }.join(\"<br>\")\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 chld\n labels.join\n end",
"def make_crumb(crumb)\n return ['Home', '/'] if crumb.empty?\n if crumb.instance_of? String\n break_off_crumbs(crumb)\n elsif crumb.instance_of? Array\n return crumb if crumb.size > 1\n return ['Home', '/'] if crumb[0].empty?\n title = crumb[0].split('/').last.split(/_|\\s/).each { |word| word.capitalize! }.join(' ') unless crumb[0].nil?\n [title, crumb[0]]\n end\n end",
"def custom_join(array, delimiter = \"\")\r\n string = \"\"\r\n last_index = array.length - 1\r\n array.each_with_index do |elem, index|\r\n string << elem\r\n string << delimiter unless index == last_index\r\n end\r\n string\r\nend",
"def arr_to_hc(arr)\n return arr.to_s.gsub(\"\\\"\", \"\\'\")\n end",
"def strings(array)\n string = \"\"\n array.each do |word|\n if word == array[-1]\n string << word\n else\n string << word + \", \"\n end\n end\n p string\nend",
"def ancestors_string= str\n @ancestors = str.split(\"|\")\n end",
"def ancestors_string= str\n @ancestors = str.split(\"|\")\n end",
"def to_array_form(external_ref_path)\n # TODO: use regexp disjunction\n external_ref_path.gsub(/^node\\[/, '').gsub(/^service\\[/, '').gsub(/\\]$/, '').split('][')\n end",
"def list_lights(arr)\n case arr.size\n when 1\n arr.first\n when 2\n arr.join(' and ')\n else\n arr[0...-2].join(', ') + ', ' + arr[-2..-1].join(', and ')\n end\nend",
"def separate_comma(digits_array)\n\n formatted_digits = digits_array.to_s.split(//)\n #p formatted_digits\n\n reverse_digits = formatted_digits.reverse\n #p reverse_digits\n\n slice_three = []\n reverse_digits.each_slice(3) {|slice| slice_three.push(slice)}\n #p slice_three\n\n join_subarrays = slice_three.map(&:join)\n #p join_subarrays\n\n insert_commas = []\n insert_commas = join_subarrays.join(',')\n #p insert_commas\n\n final = insert_commas.reverse\n p final\n\nend",
"def unique_hierarchy(data)\n headings = %w(title h1 h2 h3 h4 h5 h6)\n headings.map { |heading| data[heading.to_sym] }.compact.join(' > ')\n end",
"def namify(paths)\n first = paths[0]\n rest = paths[1..-1].reduce([]) { |a, e| a << \"[#{e}]\" }.join('')\n \"#{first}#{rest}\"\n end",
"def generate_str(arr)\n # Create a string for each of the lights arrays.\n# Loop through array\n # Add current element to new string\n# If array is 2 elements long and its the next to last element\n# Add \"and\"\n # If current element is next to last\n # add \", and\"\n # Else\n # if current element is not the last element\n# add \",\"\n str = \"\"\n counter = 0\n loop do\n str << arr[counter].to_s\n\n if arr.size == 2 && counter == arr.size-2\n str << \" and \"\n elsif counter == arr.size-2\n str << \", and \"\n elsif counter != arr.size-1\n str << \", \"\n end\n\n counter += 1\n break if counter == arr.size\n end\n\n str\nend",
"def selector_to_str(value)\n return value.value if value.is_a?(Sass::Script::String)\n return unless value.is_a?(Sass::Script::List)\n\n if value.separator == :comma\n return value.to_a.map do |complex|\n next complex.value if complex.is_a?(Sass::Script::String)\n return unless complex.is_a?(Sass::Script::List) && complex.separator == :space\n return unless (str = selector_to_str(complex))\n str\n end.join(', ')\n end\n\n value.to_a.map do |compound|\n return unless compound.is_a?(Sass::Script::String)\n compound.value\n end.join(' ')\n end",
"def from_pig_bag\n self.split(\"),(\").map{|t| t.gsub(/[\\{\\}]/, '').from_pig_tuple} rescue []\n end",
"def serialize(root, array)\n if root == nil\n array.push('N')\n return\n else\n array.push(root.val)\n serialize(root.left, array)\n serialize(root.right, array)\n end\n array.join(\",\")\nend",
"def normalize_value(value)\n case value\n when Range then normalize_range(value)\n when Array then value.map! {|v| v.is_a?(Range) ? normalize_range(v) : v }.join(',')\n else value.to_s\n end\n end",
"def join_nested_strings(src)\n words = []\n row_idx = 0\n while row_idx < src.length do\n sub_array = src[row_idx]\n row_idx += 1\n ele_idx = 0\n while ele_idx < sub_array.count do\n ele = sub_array[ele_idx]\n if ele.is_a? String \n words.push(ele)\n end\n ele_idx += 1\n end\n end\n words.join(\" \")\nend",
"def group_divider (array_of_names)\n\tcounter = 0\n\tgroup_num = 0\n\tgroup_storage = []\n\tif array_of_names == nil\n\t\treturn nil\n\telsif\n\t\tarray_of_names.length < 3\n\t\tp \"It's no fun in a group less than 3 people.\"\n\telsif array_of_names.length == 3\n\t\tp \"Group 1: \" + array_of_names.join(\", \")\n\telsif array_of_names.length % 4 != 0\n\t\t\n\t\twhile counter < array_of_names.length \n\t\t\tgroup_storage << array_of_names[counter..counter + 3]\n\t\t\tcounter += 4\n\t\t\tif group_storage[group_num].length == 2\n\t\t\t\tgroup_storage.last << group_storage.first.pop\n\t\t\telsif group_storage[group_num].length == 1\n\t\t\t\tgroup_storage.first << group_storage.pop.pop\n\t\t\tend\n\t\t\tgroup_num += 1\n\t\tend\n\telse\n\t\t\n\t\twhile counter < array_of_names.length \n\t\t\tgroup_storage << array_of_names[counter..counter + 3]\n\t\t\tcounter += 4\n\t\tend\n\t\t\n\tend\n\t\n\tgroup_name_assign = 1\n\twhile group_name_assign <= group_storage.length\n\t\tp \"Group #{group_name_assign}: \" + group_storage[group_name_assign - 1].join(\", \")\n\t\tgroup_name_assign += 1\n\tend\t\nend",
"def encode_list(value)\n encode_string(value.map { |s| encode_string(s) }.join)\n end",
"def human_string(array)\n length = array.length\n \n new_string = array[0...-1].join(\", \")\n new_string << \" and #{array[-1]}\"\n \n return new_string\nend",
"def full_hierarchy\n hierarchy = []\n current_location = self\n hierarchy << current_location.name\n while(1)\n if (current_location.location)\n location = current_location.location\n hierarchy << location.name\n current_location = location\n else\n break\n end\n end\n hierarchy.reverse.map {|h| h}.join(\", \")\n end",
"def array_to_string(value)\n result = ''\n value.each { |value| result += to_cli_value(value) + ',' }\n result = '[' + result.chomp(',') + ']'\n end",
"def my_join(array, separator)\n\tarray_string = \" \"\n\tarray.each{ |a| array_string << a + separator }\n\treturn array_string\nend",
"def join_keys *segments\n segments.map(&:to_s).select(&:present?).join(\".\")\n end",
"def to_s\n result = \"[ \"\n @tree.each do | pair |\n result += \"(\"+ pair.key.to_s + \",\" + pair.value.to_s + \") \"\n end\n result += \"]\"\n return result\n end",
"def flatten(tokens)\n tokens.shift\n tokens.join(' ')\nend",
"def suffix_tree text, suff_arr, lcp\n sufs = suff_arr.map{|i| text[i..(text.length - 1)]}\n labels = []\nend",
"def replace_delimiter(flat_json_data_hash)\n\t\tdelimiter = \"##\"\n\t\tflat_json_data_hash.each do |key, value|\n\t\t\tif value.include?(delimiter)\n\t\t\t\tvalue = I18n.t(value.gsub! delimiter, '.')\n\t\t\t\tflat_json_data_hash[key] = value\n\t\t\tend\n\t\tend\n\t\treturn flat_json_data_hash\n\tend",
"def produce_tree(ary); end",
"def my_join(arr, separator = \"\")\n join = \"\"\n idx = 0\n while idx < arr.length\n join = join + arr[idx]\n if idx != arr.length - 1 # Don't want to add the separator after the last element\n join = join + separator\n end\n idx = idx + 1\n end\n join\nend",
"def normalize_array(array)\n array.map(&:to_s)\n end",
"def normalize_array(array)\n array.map(&:to_s)\n end",
"def grapher(array)\n hash = Hash.new { |hash, key| hash[key] = [] }\n array.each do |pair|\n hash[pair[0]] ||= []\n hash[pair[0]] << pair[1]\n end\n hash\nend",
"def from_pig_tuple\n self.gsub(/[\\(\\)]/, '').split(',')\n end",
"def category_names_string(arguments = {})\n seperator = arguments.fetch(:seperator){\", \"}\n\n self.categories.pluck(:name).join(seperator)\n end",
"def normalize\n inject({}) do |hash, kv|\n k, v = kv\n v = v.is_a?(Array) ? v.join(',') : v.to_s\n hash[k.to_s.split('_').map {|w| w[0, 1] = w[0, 1].upcase; w }.join] = v\n hash\n end\n end"
] | [
"0.70578915",
"0.64761114",
"0.5879758",
"0.56592804",
"0.55354136",
"0.5523862",
"0.54923004",
"0.5476224",
"0.54631925",
"0.5461544",
"0.54139006",
"0.53507465",
"0.533705",
"0.5281066",
"0.5243991",
"0.52384645",
"0.51868445",
"0.5181798",
"0.5178788",
"0.5171019",
"0.5158279",
"0.5123999",
"0.5073728",
"0.5051549",
"0.50504696",
"0.5048047",
"0.5046684",
"0.50404257",
"0.50194126",
"0.5002289",
"0.4991317",
"0.49750566",
"0.49723434",
"0.49620456",
"0.49565327",
"0.49511772",
"0.49424025",
"0.49299514",
"0.4919323",
"0.4919323",
"0.49173748",
"0.491622",
"0.49150428",
"0.4912193",
"0.49088803",
"0.49027157",
"0.4896769",
"0.48913714",
"0.48860198",
"0.48860198",
"0.48860198",
"0.4879029",
"0.4874304",
"0.48729205",
"0.4865946",
"0.4865946",
"0.4865946",
"0.48531833",
"0.48464698",
"0.4840631",
"0.4840502",
"0.4837189",
"0.4830003",
"0.48260173",
"0.48207188",
"0.48198932",
"0.4815386",
"0.4815376",
"0.48100132",
"0.48100132",
"0.4805755",
"0.4803704",
"0.480245",
"0.4798585",
"0.47957623",
"0.47952124",
"0.47898042",
"0.4784345",
"0.47823787",
"0.47788408",
"0.47747386",
"0.47558796",
"0.47501522",
"0.47466406",
"0.4746495",
"0.47459066",
"0.47356412",
"0.4729805",
"0.47276005",
"0.47274184",
"0.47230697",
"0.4720443",
"0.47190526",
"0.47155496",
"0.47145224",
"0.47145224",
"0.47114995",
"0.47081354",
"0.47079486",
"0.47067663"
] | 0.7959872 | 0 |
Converts array of strings representing a hierarchical values to delimited hierarchical facet values as expected by blacklighthierarchy ['a:b:c', 'a:b:d'] => ['a', 'a:b', 'a:b:c', 'a:b:d'] | def explode_hierarchical_strings(array_of_strings, delimiter = ':')
split_arrays = array_of_strings.map { |s| s.split(delimiter) }
result = arrays_to_hierarchy(split_arrays)
result.flatten.uniq
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def array_to_hierarchy_facet(args, delimiter = ':')\n result = []\n args.each_with_object([]) do |part, acc|\n acc << part\n result << acc.join(delimiter)\n end\n result\n end",
"def hierarchies(array)\n count = 0\n array.reduce([]) { |acc, value| acc << array.slice(0, count += 1) }\n end",
"def group_by_depth(arr)\n output = []\n\n nested = false\n arr.each do |x|\n\n if output.last\n\n last_line = output.last[-1]\n\n if line_depth(last_line) == line_depth(x)\n\n if x =~ /Features:/ && last_line =~ /Page: \\d/\n nested = true\n end\n\n if nested\n output.last << x\n else\n output << [x]\n end\n\n elsif line_depth(last_line) > line_depth(x)\n # we are outdenting\n nested = false\n output << [x]\n\n elsif line_depth(last_line) < line_depth(x)\n # we are indenting further\n nested = true\n output.last << x\n end\n else\n output << [x]\n end\n end\n\n output\n end",
"def resolve_labels(g)\n g.map! { |a|\n # if input was foo|bar...|baz, where ... is wildcard, a looks like [\"foo/B\",\"bar.../AB\",\"baz\"]\n aa = [] # new version of a with labels and wildcards resolved\n a.each { |b|\n parts = ''\n if b=~/(.*)\\/(.*)/ then\n b,parts = [$1,$2]\n end\n aa = aa + label_to_list(b,parts) # label_to_list can return a list with >1 element if there's a wildcard, 0 elts if no match\n }\n if aa.length==0 then\n aa = [[-1,'','']]\n end # later code assumes not empty list\n aa\n }\n return g\nend",
"def decode_hierarchy_option(array_value, use_codes_instead_of_es_codes)\n if !array_value.kind_of?(Array)\n array_value = [array_value]\n end\n value_ids = []\n array_value.each do |value|\n value_id = check_option_exists(value, use_codes_instead_of_es_codes)\n value_ids << value_id\n end\n value_ids\n end",
"def my_split(array) \n splitted = []\n array.each do |element|\n element.split(//).each { |each_splitted| splitted << each_splitted }\n end\n splitted\n end",
"def flatten(arr)\n\n flat = []\n\n arr.each do |el|\n if el.class != Array\n flat << el \n else\n #flatten(el).each {|char| flat << char}\n flat.push(*flatten(el))\n end\n end\n flat \nend",
"def treeify(arr, pre)\n arr.map { |elem| (elem.is_a? Array) ? treeify(elem, pre + \"-\") : nodeify(pre, elem) }\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 unique_hierarchy(data)\n headings = %w(title h1 h2 h3 h4 h5 h6)\n headings.map { |heading| data[heading.to_sym] }.compact.join(' > ')\n end",
"def get_array_of_mapped_folder_names\n array = []\n flattened_diffs = @mapped_diffs.flatten \n i = 1 \n while i <= Babygitter.folder_levels.max\n folder_names = []\n for diff in flattened_diffs\n folder_names << diff.filename.scan(build_regexp(i)) \n end\n i += 1\n array << folder_names.flatten.uniq \n end\n array\n end",
"def format_comb(arr)\n ret = []\n arr.each do |sub_arr|\n if sub_arr.size > 1\n # use dash to connect the multiple strings \n ret << sub_arr.inject('') {|acc, e| acc + e + '-' }[0..-2]\n elsif sub_arr.size == 1\n ret << sub_arr[0]\n else\n # do nothing...\n end\n end\n return ret\n end",
"def config_flatten_order(*path, depth: 0)\n result = []\n path.map! { |p| p.is_a?(Array) ? p.compact_blank : p }.compact_blank!\n while path.present? && !path.first.is_a?(Array)\n part = path.shift\n unless part.is_a?(Symbol) || (part.is_a?(String) && part.include?('.'))\n part = part.to_s.to_sym\n end\n result << part\n end\n if (branches = path.shift)\n down_one = depth + 1\n branches = config_flatten_order(*branches, depth: down_one).flatten(1)\n if path.present?\n remainder = config_flatten_order(*path, depth: down_one).flatten(1)\n branches = branches.product(remainder)\n end\n result = branches.map { |branch| [*result, *branch].flatten }\n else\n result = [result]\n end\n if depth.zero?\n result.uniq!\n result.map! do |entry|\n entry.flat_map do |item|\n if item.is_a?(String)\n item.split('.').compact_blank.map(&:to_sym)\n else\n item\n end\n end\n end\n end\n result\n end",
"def flatten\n # strip & remove the space surrounding '/'\n str = strip.gsub(%r{\\s*\\/\\s*}, '/')\n return str unless str.include? '/'\n return f_semicolon(str) if str.include?(';')\n return f_parenthese(str) if str.include? '('\n f_convert(str)\n end",
"def _flatten(data, recursive_key = '')\n data.each_with_object({}) do |(k, v), ret|\n key = recursive_key + k.to_s\n key = key.gsub(/[^a-zA-Z]/, '_')\n begin\n if v.is_a? Hash\n ret.merge! _flatten(v, key + '_')\n elsif v.is_a? Array\n v.each do |x|\n if x.is_a? String\n ret[key] = v.join(',')\n else \n ret.merge! _flatten(x, key + '_')\n end\n end\n else\n ret[key] = v\n end\n rescue\n pp [v, v.class, v.size, v.length, v.empty?]\n end\n end\nend",
"def render_facet_hierarchy_item(field_name, data, key)\n item = data[:_]\n subset = data.reject { |k,v| ! k.is_a?(String) }\n \n li_class = subset.empty? ? 'h-leaf' : 'h-node'\n li = ul = ''\n \n if item.nil?\n li = key\n elsif facet_in_params?(field_name, item.qvalue)\n li = render_selected_qfacet_value(field_name, item)\n else\n li = render_qfacet_value(field_name, item)\n end\n \n unless subset.empty?\n subul = subset.keys.sort.collect do |subkey| \n render_facet_hierarchy_item(field_name, subset[subkey], subkey) \n end.join('')\n ul = \"<ul>#{subul}</ul>\".html_safe\n end\n \n %{<li class=\"#{li_class}\">#{li.html_safe}#{ul.html_safe}</li>}.html_safe\nend",
"def join_nested_strings(array)\n string_array = []\n count = 0\n while count < array.length do\n\n inner_count = 0\n while inner_count < array[count].length do\n if array[count][inner_count].class == String\n string_array << array[count][inner_count]\n else\n string_array = string_array\n end\n inner_count += 1\n\n end\n count += 1\n end\n string_array.join(\" \")\nend",
"def flatten(value)\n if value.is_a?(Array)\n value.flatten.map{ |v| flatten(v) }\n elsif value.is_a?(Hash)\n value.to_a.sort_by do |k| \n k[0].to_s\n end.map { |v| flatten(v) }.flatten\n else\n value.to_s\n end\n end",
"def render_tree(elements, symbols, parents = [])\n i = 0\n x = elements.map do |li|\n last = elements.length == i+1\n\n current = indentation(parents, last, symbols) + li[:value]\n\n children = \"\"\n if li[:children].length > 0\n children = \"\\n\" + render_tree(li[:children], symbols, parents + [last])\n end\n\n i += 1\n current + children\n end\n\n x.join(\"\\n\")\n end",
"def convert_array(arr)\n return '' if arr.nil?\n result = ''\n case arr\n when String, Fixnum then result << arr.to_s\n when NilClass then result << ''\n when Array\n case arr.first\n when String, Fixnum\n result << '<ul>'\n arr.each do |a|\n result << \"<li>#{convert_array(a)}</li>\" unless a.empty?\n end\n result << '</ul>'\n when NilClass then result << ''\n when Array\n result << '<ul>'\n arr.each do |a|\n result << convert_array(a)\n end\n result << '</ul>'\n when Hash\n # Change the formatting of sub-tables for easier viewing\n result << '<span class=\"ReportCSSChildTable ReportCSS\"><table><thead><tr>'\n arr.first.keys.each { |a| result << \"<td>#{convert_array(a)}</td>\" }\n result << '</tr></thead><tbody>'\n arr.each do|a|\n result << '<tr>'\n a.values.each { |b| result << \"<td>#{convert_array(b)}</td>\" }\n result << '</tr>'\n end\n result << '</tbody></table></span>'\n else\n result << 'Unknown value!!'\n end\n else\n result << 'Unknown value!'\n end\n end",
"def slugified_categories\n Array(@obj.data[\"categories\"]).each_with_object(Set.new) do |category, set|\n set << Utils.slugify(category.to_s)\n end.to_a.join(\"/\")\n end",
"def flattened_children\n no_frags = []\n children.each do |node|\n if node.is_a? Rxhp::Fragment\n no_frags += node.children\n else\n no_frags.push node\n end\n end\n\n previous = nil\n no_consecutive_strings = []\n no_frags.each do |node|\n if node.is_a?(String) && previous.is_a?(String)\n previous << node\n else\n no_consecutive_strings.push node\n previous = node\n end\n end\n\n no_consecutive_strings\n end",
"def full_hierarchy\n hierarchy = []\n current_location = self\n hierarchy << current_location.name\n while(1)\n if (current_location.location)\n location = current_location.location\n hierarchy << location.name\n current_location = location\n else\n break\n end\n end\n hierarchy.reverse.map {|h| h}.join(\", \")\n end",
"def toPathList(arr); arr.join(File::PATH_SEPARATOR) 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 flatten_repetition(list, named) # :nodoc:\n if list.any? { |e| e.instance_of?(Hash) }\n # If keyed subtrees are in the array, we'll want to discard all \n # strings inbetween. To keep them, name them. \n return list.select { |e| e.instance_of?(Hash) }\n end\n\n if list.any? { |e| e.instance_of?(Array) }\n # If any arrays are nested in this array, flatten all arrays to this\n # level. \n return list.\n select { |e| e.instance_of?(Array) }.\n flatten(1)\n end\n \n # Consistent handling of empty lists, when we act on a named result \n return [] if named && list.empty?\n \n # If there are only strings, concatenate them and return that. \n foldl(list) { |s,e| s+e }\n end",
"def to_array_form(external_ref_path)\n # TODO: use regexp disjunction\n external_ref_path.gsub(/^node\\[/, '').gsub(/^service\\[/, '').gsub(/\\]$/, '').split('][')\n end",
"def get_categories_to_split\n categories_to_split = []\n @distinct_categories.each do |category_type|\n categories_to_split << category_type if category_needs_split?(category_type)\n end\n categories_to_split\n end",
"def acts_as_family_tree_breadcrumb(aaft_instance, sep=' > ')\n if aaft_instance.parent.nil?\n grandparent = aaft_instance.all_parent_relations.collect(&:parent_node).detect(&:parent)\n trail = grandparent.nil? ? [aaft_instance] : grandparent.all_parents + [grandparent, aaft_instance]\n else\n trail = aaft_instance.all_parents + [aaft_instance]\n end\n trail.collect do |r|\n block_given? ? yield(r) : r.to_s\n end.join(sep)\n end",
"def acts_as_family_tree_breadcrumb(aaft_instance, sep=' > ')\n if aaft_instance.parent.nil?\n grandparent = aaft_instance.all_parent_relations.collect(&:parent_node).detect(&:parent)\n trail = grandparent.nil? ? [aaft_instance] : grandparent.all_parents + [grandparent, aaft_instance]\n else\n trail = aaft_instance.all_parents + [aaft_instance]\n end\n trail.collect do |r|\n block_given? ? yield(r) : r.to_s\n end.join(sep)\n end",
"def hierarchy()\n\t\t\t\tfullName().split( \"::\" )\n\t\t\tend",
"def remove_initial_and_format_change(info) # removes middle initial for space_names and pipe_names AND puts comma_names into nested arrays\n if !info[0].include?(\"|\") && !info[0].include?(\",\")\n info.map! {|element| element.split(\" \")}\n info.each {|element| element.slice!(-4)} \n info\n elsif info[0].include?(\"|\")\n info.map! {|element| element.split(\" | \")}\n info.each {|element| element.slice!(-4)} \n info\n else\n info.map! {|element| element.split(\", \" )} \n end\nend",
"def path_ids\n ancestry_ascendente_directo.split(',').map{|a| a.to_i if a.present?}.compact\n end",
"def formatStepList(stepList)\n formattedList = []\n for direction in stepList\n for step in direction\n formattedList.push(step)\n end\n end\n return formattedList\nend",
"def ancestors_string= str\n @ancestors = str.split(\"|\")\n end",
"def ancestors_string= str\n @ancestors = str.split(\"|\")\n end",
"def to_a\n extracted_children = children.map { |c| c.respond_to?(:to_a) ? c.to_a : c }\n extracted_children.zip(Array.new(children.length, separator)).flatten[0..-2]\n end",
"def labels(hash_or_item, separator: '.')\n return nil unless hash_or_item.instance_of? Hash\n label_array = hash_or_item.map do |key, value|\n if value.instance_of? Hash\n labels(value, separator: separator).map { |v| prefix(key.to_s+separator, v) }.flatten\n else\n key.to_s\n end\n end\n label_array.flatten\nend",
"def string_to_nested_array(str)\n arr1 = str.split(',')\n arr2 = []\n for i in 0..arr1.size - 1\n arr2[i] = arr1[i].split(':')\n end\n return arr2\nend",
"def split_by(array, delim)\n ret = []\n a = []\n array.each do |i|\n if i == delim then\n ret << a\n a = []\n else\n a << i\n end\n end\n ret << a unless a.empty?\n return ret\n end",
"def get_groups_a\n\n return [] if self.groups.nil? or self.groups.empty?\n\n array = self.groups.split('|')\n array.compact!\n array.delete('')\n\n return array\n end",
"def lookup_unbounded( value )\n elements = []\n if value.has_key?( \"children\" )\n value[\"children\"].each do |key, value|\n elements << key if value[\"unbounded\"]\n if value.has_key?( \"children\" )\n elements << lookup_unbounded( value )\n end\n end\n end\n elements\n end",
"def clean_facets_array(facets_array)\n Array(facets_array).map {|text| fix_subfield_demarcators(text) }.compact.uniq\n end",
"def suffix_tree text, suff_arr, lcp\n sufs = suff_arr.map{|i| text[i..(text.length - 1)]}\n labels = []\nend",
"def tree_levels_text_array\n text_rows = []\n num_levels = num_tree_levels\n # set string size for spacing and \"nil\" nodes (with default if tree too big)\n max_length = (num_levels > 4) ? 2 : max_node_value_length\n blank_node = \"_\" * max_length # text for nil nodes\n cell_pad = \" \" * max_length # text for cell padding / spacing\n all_nodes = all_node_values_with_nil # array of all node values (breadth_first order)\n level = 0\n cur_node = 0 # Track position in array \"all_nodes\"\n # track each tree level\n while level < num_levels\n level_exponent = num_levels - level - 1 # sets exponent series range\n # inner_padding: num spacing cell-pads between nodes (not before 1st node)\n inner_padding = sum_base_to_exponent_series(2, 0, level_exponent)\n # outer_padding: num spacing cell-pads before first node\n outer_padding = inner_padding - 2**(level_exponent)\n row_string = \"\"\n row_string << cell_pad * outer_padding\n num_nodes_in_row = 2**level # all_nodes is a \"complete binary tree\"\n # \"counter\" avoids adding inner_padding after last node on each level\n counter = 1\n # track the node placement, from array \"all_nodes\"\n num_nodes_in_row.times do\n next_value = all_nodes[cur_node].nil? ? blank_node : all_nodes[cur_node].to_s\n row_string << next_value\n row_string << cell_pad * inner_padding unless counter == num_nodes_in_row\n cur_node += 1\n counter += 1\n end\n row_string << \" (Root)\" if level == 0\n text_rows.push(row_string)\n level += 1 # must adjust padding before incrementing level\n end\n # Add display note if tree is empty\n text_rows[0] = \"(Empty Tree: Root = nil)\" if text_rows.empty?\n return text_rows\n end",
"def clean (sec)\n\tsec2 = []\n\tlast = nil\n\tsec.each do |bar|\n\t\tbar2 = []\n\t\tbar.each do |c|\n\n\t\t\tif (c == \"/\")\n\t\t\t\tbar2 << last\n\t\t\t\tnext\n\t\t\tend\n\n\t\t\tnext if (c == \"sus\")\n\t\t\tlast = c\n\t\t\tbar2 << c \n\n\t\tend\n\t\tsec2 << bar2\n\tend\n\tsec2\nend",
"def separators\n @separators.merge(definition.separators(@children.find(&:segment?)))\n end",
"def split_strip_compact_array(values_str_array, delimiter = \",\")\n return [] if not values_str_array\n values_str_array.inject([]) {|s,x| s + split_strip_compact(x, delimiter)}\nend",
"def flatt(arr, flat_arr = [])\n arr.each do |element|\n if element.is_a?(Array)\n flatt(element, flat_arr)\n else\n flat_arr << element\n end\n end\n flat_arr\nend",
"def break_off_crumbs(uri)\n crumbs = []\n split_uri = uri.split('/')\n split_uri.each_with_index do |crumb, i|\n crumbs << make_crumb([split_uri[0..i].join('/')])\n end\n crumbs\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 list(arr)\n return \"\" if arr.empty?\n\n str = []\n\n arr.each do |hsh|\n hsh.each do |k, v|\n str << v\n end\n end\n \n return str[0] if str.length < 2\n\n names = ''\n idx = 0\n\n until idx == str.length - 2\n names << str[idx] + ', '\n idx += 1\n end\n names << str[-2] + ' & '\n names << str[-1]\n \nend",
"def partlist(arr)\n len = arr.length\n i = 0\n masterArr = []\n while i < len - 1 do\n masterArr << [arr[0..i].join(\" \")] + [arr[i+1..len].join(\" \")]\n i += 1\n end\n masterArr\nend",
"def children_for(list)\n list.map do |key, value|\n value = Array(value).flatten\n if value.any?\n after = \" \" * string.inspect.length + \" \"\n description = Hansi.render(THEME[:orange], key.to_s)\n Tree.new(description, *value, after: after, prefix_color: PREFIX_COLOR)\n end\n end\n end",
"def flatten\n\t\t\treturn @root.generate_from(@substitutions).join('\\n')\n\t\tend",
"def valuePath(node, delimiter=' ')\n result = []\n while (node.parent != nil) do\n reverseAddValues(result, node.incomingEdgeStartOffset, node.incomingEdgeEndOffset)\n node = node.parent\n end\n result.reverse!\n return result.join(delimiter)\n end",
"def split_paths(path)\n dir_list = path.split('/').drop(1) # drops the \"\" because of the first \"/\"\n path_list = ['/'+dir_list.first]\n dir_list.drop(1).each do |dir|\n path = path_list.last + '/' + dir\n path_list.push path\n end\n path_list\nend",
"def my_controlled_flatten(level = nil)\n flattened = []\n\n self.each do |ele|\n if ele.is_a?(Array) && level != 0\n flattened += (level.nil? ? ele.my_controlled_flatten : ele.my_controlled_flatten(level - 1))\n else\n flattened << ele\n end\n end\n\n flattened\n end",
"def my_controlled_flatten(level = nil)\n flattened = []\n\n self.each do |ele|\n if ele.is_a?(Array) && level != 0\n flattened += (level.nil? ? ele.my_controlled_flatten : ele.my_controlled_flatten(level - 1))\n else\n flattened << ele\n end\n end\n\n flattened\n end",
"def nested_array_to_html(nodes)\n classes = \"depth-#{ nodes.first[:depth] }\"\n classes += \" folder-tree\" if nodes.first[:depth].zero?\n\n html = \"<ul class=\\\"#{ classes }\\\">\"\n nodes.each do |node|\n html += \"<li>\"\n\n if node[:children]\n html += '<i class=\"icon-folder-close\"></i>'\n else\n html += '<i class=\"icon-file-alt\"></i>'\n end\n\n html += \"<span class=\\\"name\\\">#{ node[:name].strip }</span>\"\n unless (node[:children].nil? || node[:children].empty?)\n html += nested_array_to_html(node[:children]) \n end\n html += '</li>'\n end\n\n html += '</ul>'\n\n html\n end",
"def team_colors(team_name)\n colors = []\n #top level\n game_hash.each do |location, team_data|\n #1st (team name)\n if team_data[:team_name].join == team_name\n #2nd level\n team_data.each do |team_deets, values|\n #colors pair\n if team_deets == :colors\n colors << values\n end\n end\n end\n end\n colors = colors.flatten\nend",
"def word_mesh(arr)\n \"\".tap do |m|\n arr.each_cons(2) do |a,b|\n until a.end_with?(b)\n b = b.chop\n return \"failed to mesh\" if b.empty?\n end\n m << b\n end\n end\nend",
"def format_to_array(value)\n case value\n when Array then value\n when String then value.split(separator)\n else raise InvalidTagFormat\n end\n end",
"def flatten(data, path = Path.new([]))\n case data\n when Array\n data.each_with_index.map do |d,i|\n pathi = path + [i]\n pathi.add_index path.length\n flatten(d, pathi)\n end\n when Hash\n data.map {|k,v| flatten(v, path + [k.to_s])}\n else \n leaf = Leaf.new(path,data)\n @leaves << leaf\n end\n @leaves\n end",
"def makelist(list)\n case list\n when String\n list = list.split(/[:;]/)\n else\n list = Array(list).map{ |path| path.to_s }\n end\n list.reject{ |path| path.strip.empty? }\n end",
"def makelist(list)\n case list\n when String\n list = list.split(/[:;]/)\n else\n list = Array(list).map{ |path| path.to_s }\n end\n list.reject{ |path| path.strip.empty? }\n end",
"def makelist(list)\n case list\n when String\n list = list.split(/[:;]/)\n else\n list = Array(list).map{ |path| path.to_s }\n end\n list.reject{ |path| path.strip.empty? }\n end",
"def a_u_path(node)\n path = \"[\"\n node_arr = []\n while node.parent\n node_arr.push(node.name)\n node = node.parent\n end \n path << \"'#{node.name}'\"\n node_arr.reverse_each do |n|\n path << \",#{n}\"\n end\n path << \"]\"\n end",
"def split(separator)\n lambda do |rec, acc|\n acc.replace( acc.flat_map { |v| v.split(separator) } )\n end\n end",
"def join_nested_strings(src)\n words = []\n row_idx = 0\n while row_idx < src.length do\n sub_array = src[row_idx]\n row_idx += 1\n ele_idx = 0\n while ele_idx < sub_array.count do\n ele = sub_array[ele_idx]\n if ele.is_a? String \n words.push(ele)\n end\n ele_idx += 1\n end\n end\n words.join(\" \")\nend",
"def normalize_value(value)\n case value\n when Range then normalize_range(value)\n when Array then value.map! {|v| v.is_a?(Range) ? normalize_range(v) : v }.join(',')\n else value.to_s\n end\n end",
"def variations(values)\n first = values.first\n\n if values.length == 1 #base case\n return first\n else\n rest_of_values = variations(values[1..-1])\n \n first.map do | first_el |\n rest_of_values.map do | rest_el | \n \"#{first_el}#{rest_el}\" \n end\n end.flatten \n\n end\nend",
"def _SplitAndJoinParts(path, pop) \n pathParts = path.split(\"/\")[0..-(pop+1)]\n \n result = JoinPaths(pathParts)\n \n # we face an absolute linux part\n if(path.start_with?(\"/\"))\n result = \"/\" + result\n end\n \n return result\n end",
"def produce_tree(ary); end",
"def flat(a)\n\tnew_arr = []\n\ta.each do |el|\n\t\tif el.is_a? Array\n\t\t\tel.each do |n|\n\t\t\t\tif el.is_a? Array\n\t\t\t\t\ta << n\n\t\t\t\telse\n\t\t\t\t\tnew_arr << n\n\t\t\t\tend\n\t\t\tend\n\t\telse\n\t\t\tnew_arr << el\t\n\t\tend\n\tend\n\tp new_arr\nend",
"def at_depth(depth , *strings)\n prefix = \" \" * 2 * depth\n strings.collect{|str| prefix + str}.join(\"\\n\")\n end",
"def kesha_maker(array)\n array.collect do |element|\n split_element_to_array = element.split(\"\")\n split_element_to_array[2] = \"$\"\n joined_array = split_element_to_array.join\n joined_array\n end\nend",
"def convert_1_level_deep(arr, result=[])\n arr.flatten.each_slice(3) { |ele| result.push(ele)}\n result\nend",
"def dn_flatten hash, ancestor=[ ]\n result = { }\n for key,value in hash\n present = ancestor + [key]\n if value.is_a? Hash and !value.empty?\n result.merge! dn_flatten value, present\n else\n result.merge! present.join('.') => value\n end\n end\n result\n end",
"def flattenize(replacements = nil)\n replace = replacements || Louisville::StringExtensions.pre_ascii_replacements\n Louisville::StringExtensions.downcase(asciify(replace)).gsub(/[^a-z\\s\\d]/, \"\").to_s\n end",
"def change_separator(items)\n items.map do |item|\n item[\"internal_name\"] = item.fetch(\"internal_name\").gsub(\" / \", \": \")\n item\n end\n end",
"def map_value(thing)\n case thing\n when ::Hash\n thing.camelize_recursive\n when Array\n thing.map { |v| map_value(v) }\n else\n thing\n end\nend",
"def flatten(data, level = 0)\n return [data] unless data.is_a?(Array) \n flat = []\n data.each do |ele|\n if ele.is_a?(Array)\n flat += flatten(ele, level + 1)\n else\n flat << ele\n end\n end\n flat\nend",
"def normalize(input)\n no_dots = remove_dots(input)\n\n final = []\n while i = no_dots.index('..')\n if i == 0\n final << no_dots.shift\n else\n no_dots.delete_at(i-1)\n no_dots.delete_at(i-1)\n end\n end\n\n (final+no_dots).join('/')\nend",
"def tree2path_helper(tree, current, path)\n path << '/' << current\n if !tree.children.empty?\n set = []\n # use reverse to be consistent with the sample in the problem\n tree.children.reverse_each do |child|\n set << child.data unless child.data.include?('-')\n end\n acc = set.inject('') {|acc, e| acc + e + '|'}[0..-2]\n tree2path_helper(tree.children[0], acc, path)\n end\n end",
"def make_crumb(crumb)\n return ['Home', '/'] if crumb.empty?\n if crumb.instance_of? String\n break_off_crumbs(crumb)\n elsif crumb.instance_of? Array\n return crumb if crumb.size > 1\n return ['Home', '/'] if crumb[0].empty?\n title = crumb[0].split('/').last.split(/_|\\s/).each { |word| word.capitalize! }.join(' ') unless crumb[0].nil?\n [title, crumb[0]]\n end\n end",
"def arrayorize(value)\n case value\n when nil then return []\n when String then value.to_s.split\n when Symbol then value.to_s.split\n else value\n end\n end",
"def level_down(s)\nreturn s.split(\"/\").insert(-2, \"*\").join(\"/\")\nend",
"def level_up\n $levels.push('/..')\nend",
"def test_fix_nested_array\n array = [1, [2], [3, [4,[5]]], 6]\n array = array.flatten\n assert_equal [1,2,3,4,5,6], array\n end",
"def gather_prefixes(tlds)\n prefixes = []\n while tlds.length > 0\n prefix = tlds.first[0]\n i = tlds.index {|tld| tld[0] != prefix} || tlds.length\n group = tlds[0...i].map {|tld| tld[1..-1]}\n if (j = group.index(''))\n group.delete_at(j)\n group << ''\n end\n r = (group.length == 1) ? group.first : gather_prefixes(group)\n prefixes << \"#{prefix}#{r}\"\n tlds = tlds[i..-1]\n end\n \"(?:#{prefixes.join('|')})\"\nend",
"def pre_order_array(tree)\n output = tree.nil? || tree.data == 0 ? \"\" : tree.data.to_s + \" \"\n left = tree.left.nil? ? \"\" : pre_order_array(tree.left)\n right = tree.right.nil? ? \"\" : pre_order_array(tree.right)\n output + left + right\nend",
"def convertObjectsArrToStringArr(arr)\r\n i = 0\r\n stringArr = []\r\n while i < arr.length\r\n holder = arr[i].to_s\r\n if(holder != \"\")\r\n if(holder[0] != \"#\")\r\n if(!holder.include? \"::\")\r\n stringArr.append(holder)\r\n end\r\n end\r\n end\r\n #p holder\r\n # puts stringArr[i]\r\n i += 1\r\n end\r\n return stringArr\r\n end",
"def flatten(tokens)\n tokens.shift\n tokens.join(' ')\nend",
"def flatten() end",
"def team_names\n team_names = []\n #top level\n game_hash.each do |location, team_data|\n #2nd level\n team_data.each do |team_deets, values|\n #find team name pair\n if team_deets == :team_name\n team_names << team_data[team_deets]\n end\n end\n end\n team_names = team_names.flatten\nend",
"def get_subgroup_names\n names = Array.new\n @subgroup.keys.each do |key|\n keypcs = key.split/:/\n names << keypcs[1]\n end\n return names\n end",
"def PermuteAll( arr_in )\n return arr_in if arr_in.count <= 1\n joinset = [\".\",\"-\",\"_\"]\n \n arr_out = []\n for k in 0..arr_in.count-1 do\n recurse = Array.new(arr_in)\n recurse.delete_at(k)\n temp = PermuteAll( recurse )\n for j in 0..temp.count-1 do\n arr_out += [arr_in[k] + temp[j]]\n joinset.each do |lolcat|\n arr_out += [arr_in[k] + lolcat + temp[j]]\n end\n end\n end\n return arr_out\n end",
"def serialize(root, array)\n if root == nil\n array.push('N')\n return\n else\n array.push(root.val)\n serialize(root.left, array)\n serialize(root.right, array)\n end\n array.join(\",\")\nend",
"def split(grid, n)\n grid.split('/').each_slice(n).map do |rows|\n results = Array.new(rows.first.length / n) {[]}\n rows.map {|row| row.split('').each_slice(n).each_with_index {|r, i| results[i] << r.join('')}}\n results.map {|r| r.join('/')}\n end\nend"
] | [
"0.75897133",
"0.68396264",
"0.56584704",
"0.5637435",
"0.5493297",
"0.5491261",
"0.547969",
"0.5433971",
"0.541508",
"0.53570455",
"0.52750045",
"0.5250995",
"0.52423036",
"0.5211978",
"0.5209984",
"0.517046",
"0.51555926",
"0.51446605",
"0.5127346",
"0.509258",
"0.50875884",
"0.507025",
"0.5065035",
"0.50631166",
"0.50172675",
"0.49991754",
"0.49883288",
"0.4964732",
"0.49630636",
"0.49630636",
"0.49463883",
"0.4941093",
"0.4930575",
"0.4917969",
"0.4908523",
"0.4908523",
"0.49000278",
"0.48996803",
"0.48957348",
"0.4886474",
"0.48861945",
"0.48853984",
"0.4883718",
"0.4867183",
"0.48668855",
"0.4864902",
"0.48604548",
"0.48505485",
"0.48315755",
"0.4826761",
"0.4824712",
"0.48233658",
"0.4811327",
"0.48076963",
"0.48050725",
"0.48047662",
"0.4797461",
"0.47861883",
"0.4785929",
"0.47824556",
"0.477721",
"0.47754556",
"0.47724432",
"0.4764787",
"0.4761679",
"0.4761679",
"0.4761679",
"0.47606945",
"0.47546118",
"0.47461346",
"0.47396216",
"0.4739606",
"0.4729133",
"0.47286046",
"0.4710736",
"0.47104755",
"0.4701849",
"0.4691403",
"0.46863413",
"0.46850523",
"0.46794862",
"0.46720457",
"0.46713626",
"0.466738",
"0.46671927",
"0.46654767",
"0.4663818",
"0.46634585",
"0.46616295",
"0.46587893",
"0.46537268",
"0.4653482",
"0.46504012",
"0.46486387",
"0.46478382",
"0.46419722",
"0.4634784",
"0.46339935",
"0.46338382",
"0.46334785"
] | 0.7194458 | 1 |
Generate and deliver the +New Pending Interest Point+ email for this +Interest Point+. | def notify_administrators!
AdminMailer.new_pending_interest_point(self).deliver!
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def appointment_pending(appoint_obj)\n @doctor = Doctor.find_by_id(appoint_obj.doctor_id)\n @patient = Patient.find_by_id(appoint_obj.patient_id)\n mail(:to => @doctor.email, :subject => \"New Appointment\")\n end",
"def create\n @interest = GtInterest.new(:email => params[:email], :priority_code => params[:priority_code])\n if @interest.save\n @status = 200\n\n # Don't want to email when using this model to test \"subscribe via email\" signups\n unless /subscribe_to_roll:.+/.match(params[:priority_code])\n ShelbyGT_EM.next_tick { GtInterestMailer.interest_autoresponse(@interest.email).deliver }\n end\n else\n render_error(400, \"must have a valid email\")\n end\n end",
"def fulfillment_new_invoice(invoice) \n @invoice = invoice\n sc = invoice.site.store_config\n mail(:to => sc.fulfillment_email, :subject => 'New Order')\n end",
"def send_notification_emails!(new_induction_record, was_withdrawn_participant)\n lead_provider_profiles_in = lead_provider&.users&.map(&:lead_provider_profile) || []\n lead_provider_profiles_out = existing_lead_provider&.users&.map(&:lead_provider_profile) || []\n\n Induction::SendTransferNotificationEmails.call(\n induction_record: new_induction_record,\n was_withdrawn_participant:,\n same_delivery_partner: transfer_has_the_same_delivery_partner?,\n same_provider: transfer_has_the_same_provider?,\n switch_to_schools_programme: switching_programme?,\n lead_provider_profiles_in:,\n lead_provider_profiles_out:,\n )\n end",
"def send_final_exam_invitation!\n update_attribute(:final_exam_invitation_sent_at, Time.now)\n end",
"def provider_transfer_in_notification\n induction_record = params[:induction_record]\n lead_provider_profile = params[:lead_provider_profile]\n\n template_mail(\n TRANSFER_IN_FOR_PROVIDER_TEMPLATE,\n to: lead_provider_profile.user.email,\n rails_mailer: mailer_name,\n rails_mail_template: action_name,\n personalisation: {\n joining_date: induction_record.start_date.to_date.to_fs(:govuk),\n external_participant_id: induction_record.participant_profile.participant_identity.user_id,\n },\n ).tag(:provider_transfer_in_notification).associate_with(lead_provider_profile, as: :lead_provider_profile)\n end",
"def polled_delivery( recipient_email , pending_deliveries )\n @recipient_email = recipient_email \n @user = User.find_by_email @recipient_email \n @pending_deliveries = pending_deliveries\n time = Time.now\n \n mail( :to => recipient_email, \n :subject => \"pilipoto | Updates (#{pending_deliveries.count}): #{time}\", \n :bcc => [\"[email protected]\"] )\n \n end",
"def withdraw_note(addresses, publication_title) \n #send note to publication creator that the pub has been withdrawn\n #they can checkout the comments to see if there is more info about the withdraw\n \n @publication_title= publication_title \n\n mail(:to => addresses, :subject => publication_title + \" has been withdrawn.\")\n \n end",
"def response(expo_attendee_id)\n @expo_attendee = ExpoAttendee.find(expo_attendee_id)\n mail(to: @expo_attendee.email, subject: \"#{@expo_attendee.first_name} , you've entered the draw to win two free movie tickets.\")\n end",
"def participant_transfer_in_notification\n induction_record = params[:induction_record]\n\n participant_profile = induction_record.participant_profile\n preferred_identity_email = induction_record.preferred_identity.email\n\n template_id = if participant_profile.ect?\n TRANSFER_IN_FOR_ECT_TEMPLATE\n else\n TRANSFER_IN_FOR_MENTOR_TEMPLATE\n end\n\n template_mail(\n template_id,\n to: preferred_identity_email,\n rails_mailer: mailer_name,\n rails_mail_template: action_name,\n personalisation: {\n transferring_ppt_name: participant_profile.user.full_name,\n joining_date: induction_record.start_date.to_date.to_fs(:govuk),\n new_school_name: induction_record.school.name,\n },\n ).tag(:participant_transfer_in_notification).associate_with(participant_profile, as: :participant_profile)\n end",
"def provider_new_school_transfer_notification\n induction_record = params[:induction_record]\n lead_provider_profile = params[:lead_provider_profile]\n\n template_mail(\n NEW_SCHOOL_TRANSFER_FOR_PROVIDER,\n to: lead_provider_profile.user.email,\n rails_mailer: mailer_name,\n rails_mail_template: action_name,\n personalisation: {\n joining_date: induction_record.start_date.to_date.to_fs(:govuk),\n external_participant_id: induction_record.participant_profile.participant_identity.user_id,\n },\n ).tag(:provider_new_school_transfer_notification).associate_with(lead_provider_profile, as: :lead_provider_profile)\n end",
"def transaction_fee_invoice\n NotificationsMailer.with(sports_centre: SportsCentre.first, amountPaid: 32.00, poliId: \"345678976543\").transaction_fee_invoice\n end",
"def new_notification\n mail(to: \"[email protected]\", subject: 'New Notification', sent_on: Time.now)\n end",
"def paypal_ipn\n notify = Paypal::Notification.new(request.raw_post)\n \n if notify.acknowledge\n transaction = Transaction.where(order_id: notify.params['invoice']).first\n if notify.complete? and transaction.gross_amount.to_s == notify.params['mc_gross']\n transaction.fee = notify.params['mc_fee']\n transaction.completed!\n else\n transaction.failed!\n end\n if transaction.save\n Mailatron4000::Orders.confirmation_email(transaction.order) rescue Rails.logger.warn(\"PayPal IPN: Order #{transaction.order.id} confirmation email failed to send\")\n end\n end\n\n render nothing: true\n end",
"def do_pending \n make_activation_code\n ClaimingMailer.deliver_confirmation_request(self) if self.email && self.activation_code\n end",
"def email_approved_proposal\n ProposalMailer.email_approved_proposal\n end",
"def provider_existing_school_transfer_notification\n induction_record = params[:induction_record]\n lead_provider_profile = params[:lead_provider_profile]\n\n template_mail(\n EXISTING_SCHOOL_TRANSFER_FOR_PROVIDER,\n to: lead_provider_profile.user.email,\n rails_mailer: mailer_name,\n rails_mail_template: action_name,\n personalisation: {\n joining_date: induction_record.start_date.to_fs(:govuk),\n external_participant_id: induction_record.participant_profile.participant_identity.user_id,\n },\n ).tag(:provider_existing_school_transfer_notification).associate_with(lead_provider_profile, as: :lead_provider_profile)\n end",
"def ipn\n if @notification.complete?\n Payment.create!(:person_id => @person.id, :amount => @notification.amount,:token => params[:txn_id],:state => \"Complete\") \n logger.info(\"Created payment for person #{@person.id} for #{@notification.amount}\")\n else\n logger.warn(\"Received an incomplete IPN notification from Paypal: #{@notification.inspect}\")\n end\n render :nothing => true\n rescue\n logger.error(\"Received Paypal IPN notification #{@notification.inspect} for #{@person.inspect} but could not record the payment due to #{$!.message} at #{$!.backtrace.join(',')}\")\n render :nothing => true, :status => 500\n end",
"def create\n @invitation_request = InvitationRequest.new(invitation_request_params)\n\n respond_to do |format|\n if @invitation_request.save\n format.html { redirect_to root_path, notice: 'Invitation received. We will notify you soon!' }\n format.json { render :show, status: :created, location: @invitation_request }\n else\n @interests = Interest.all\n format.html { render :new }\n format.json { render json: @invitation_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def do_pending\n make_activation_code\n # send the user an email with an activation code\n UserMailer.deliver_signup_notification(self)\n end",
"def incident_notification(incident)\n \t@incident = incident\n @user = incident.assigned_to\n @url = incident_url(incident)\n mail(:to => @user.email, :subject => \"You have a new Incident!\");\n end",
"def proposal_to_a_board_members\n @inv = Invitation.find params[:inv]\n @acc = Accept.find params[:acc]\n\n @summary = []\n @summary << \"L'evento\"\n @summary << \", organizzato da #{@inv.organizer},\" unless @inv.organizer.blank?\n @summary << \" avrà luogo\"\n @summary << \" a #{@inv.location}\" unless @inv.location.blank?\n @summary << \" in data #{I18n.localize(@inv.from_date_and_time.to_date, format: :long_w_weekday)}\" if @inv.from_date_and_time\n @summary << \" e\" if [email protected]? || @inv.from_date_and_time\n @summary << \" avrà per tema '#{@inv.title}'.\"\n @summary = @summary.join\n # @url =\n @preheader = \"Proposta di partecipazione ad un evento in rappresentanza di ARERA\"\n\n user = Rails.env==\"development\" ? User.find_by(username: ENV[\"test_username\"]) : @acc.user\n\n Sidekiq::Logging.logger.info \"Sending an email 'Proposta di incarico' to #{user.display_name} [#{user.email}]\"\n mail(to: user.email, subject: 'Proposta di incarico')\n\n end",
"def notification(inquiry)\n @inquiry = inquiry\n\n mail :to => @inquiry.email, :subject => \"New Inquiry\"\n end",
"def send_announcement_email\n self.send_at = Time.zone.now\n save!\n UserMailer.announcement_notice(self).deliver\n end",
"def send_invoice\n if payment_at_changed? && payment_at.present?\n payable.try(:payment_completed!, self)\n if payable_type == 'UserGroup'\n UserMailer.payment_completed(user, self).deliver\n end\n end\n end",
"def new_participant_notification(participant)\n @participant = participant\n @pid = @participant.id\n @name = @participant.name\n @greeting = \"Hi\"\n @event_name = @participant.event.name\n @start_time = @participant.event.start_time.to_formatted_s(:long)\n\n mail to: \"#{@name} <#{@participant.email}>\", subject: \"Confirmation Needed: #{@event_name}\"\n end",
"def new_invoice(user_id, payment_id)\n @user = User.find_by_id(user_id)\n @payment = Payment.find_by_id(payment_id)\n\n mail :to => recipient(@user.email), :subject => \"New 25c Invoice!\"\n end",
"def claim_your_reward\n InviteMailer.claim_your_reward\n end",
"def create_notification!\n ::Users::Notifications::NewBuyRequest.create(\n recipient_user_id: buyer.parent_id, sender_user_id: buyer_id, related_model_type:'Trading::BuyRequest', related_model_id: self.id,\n uri: Rails.application.routes.url_helpers.buy_request_path(self)\n )\n ::NotificationMail.create_from_mail(buyer_id, buyer.parent_id, UserMailer.new_buy_request(self.items.first, buyer) )\n end",
"def send_request_notification_email\n ReservationMailer.request_notification(self).deliver_now\n end",
"def send_invite\n\t\tMyMailer.new_invite(self).deliver_now\n\t\t#MyMailer.new_invite(self).deliver_later!(wait_until: 5.minutes.from_now)\n\tend",
"def send_invite\n\t\tMyMailer.new_invite(self).deliver_now\n\t\t#MyMailer.new_invite(self).deliver_later!(wait_until: 5.minutes.from_now)\n\tend",
"def ep_notify(form_answer_id, collaborator_id)\n @form_answer = FormAnswer.find(form_answer_id).decorate\n @user = @form_answer.user.decorate\n collaborator = User.find(collaborator_id)\n\n @current_year = @form_answer.award_year.year\n @subject = \"King's Awards for Enterprise Promotion: Thank you for your nomination\"\n\n send_mail_if_not_bounces ENV['GOV_UK_NOTIFY_API_TEMPLATE_ID'], to: collaborator.email, subject: subject_with_env_prefix(@subject)\n end",
"def funded_email_to_creator\n Pony.mail(:to => self.email, :from => '[email protected]', :subject => 'the gift you created is now funded!', :body => 'yay! some people owe you money.')\n end",
"def payment_upcoming\n @greeting = \"Hi\"\n\n mail to: \"[email protected]\"\n end",
"def send_overdue_notice(notice)\n p \"Reminder #{get_name} #{notice}\"\n end",
"def send_overdue_notice(notice)\n p \"Reminder #{get_name} #{notice}\"\n end",
"def create_notification\n subject = \"#{student_request.name} \"\n body = \"#{student_request.name} (#{student_request.email}) needs tutorial.\"\n tutor_request.notify(subject, body, self)\n end",
"def dispute_notification(id, amount, currency)\n @id, @amount, @currency = id, amount, currency\n \n mail to: \"[email protected]\",\n subject: \"Hikarigo dispute created. Attention may be needed\"\n end",
"def provider_transfer_out_notification\n induction_record = params[:induction_record]\n lead_provider_profile = params[:lead_provider_profile]\n\n template_mail(\n TRANSFER_OUT_FOR_PROVIDER_TEMPLATE,\n to: lead_provider_profile.user.email,\n rails_mailer: mailer_name,\n rails_mail_template: action_name,\n personalisation: {\n joining_date: induction_record.start_date.to_date.to_fs(:govuk),\n external_participant_id: induction_record.participant_profile.participant_identity.user_id,\n },\n ).tag(:provider_transfer_out_notification).associate_with(lead_provider_profile, as: :lead_provider_profile)\n end",
"def post_shipment_notifier(shipment)\n @shipment = shipment\n subject = \"WARNING: No InstaTrace Shipments Posted in 24 hours\" \n mail(:to => EMAIL_NOTIFY_POST_SHIPMENT_API, :subject => subject) if shipment.hawb && shipment.created_at\n end",
"def send_claim_email\n\n template = {\n :template => File.join('reviewer_invites', 'claim'),\n :locals => {\n :entity => self.entity,\n :claim_digest => self.claim_digest\n }\n }\n message = {\n :subject => \"Claim Your Invite\",\n :to => [ { :email => self.email } ],\n :merge_vars => [{\n \"rcpt\" => self.email,\n \"vars\" => [{ \"content\" => \"there\", \"name\" => \"name\" }]\n }]\n }\n Applyance::Lib::Emails::Sender::send_template(template, message)\n\n end",
"def shipped(order)\n @order = order\n\n mail to: order.email, subject: '8 facts you will never believe! Doctors hate it!'\n end",
"def new_idea(idea)\n begin\n m = Mandrill::API.new\n template = m.templates.render 'GetViable New Idea Added', [{:name => \"first_name\", :content => idea.user.name}, {:name => \"idea_name\", :content => idea.title}]\n mail_job = mail(:to => idea.user.email, :subject => \"Getting started with #{idea.title}\") do |format|\n format.html { template['html'] }\n #format.text { render \"test\" }\n end\n mail_job.deliver\n rescue Exception => e\n\n end\n end",
"def create\n @information_request = InformationRequest.new(params[:information_request])\n @information_request.request_timestamp = Time.now\n\n respond_to do |format|\n if @information_request.save\n InfoRequestConfirmation.requested(@information_request).deliver # send email\n format.html { redirect_to root_path, notice: 'Thank You! Your request for information has been successfully processed.' }\n #format.json { render json: @information_request, status: :created, location: @information_request }\n else\n format.html { render action: \"new\" }\n format.json { render json: @information_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def reminder_email2(all_payments)\n @all_payments = all_payments\n @url = generate_url(User.find_by_email(@all_payments.first.email))\n #loaner_email = User.find(@all_payments.first.user_id).email\n\n mail(:to => @all_payments.first.email, :subject => \"Reminder that you owe some money\")\n end",
"def set_pending_interest\n @pending_interest = PendingInterest.find(params[:id])\n end",
"def send_notification(new_state, current_user_id, recipient_id)\n if current_user_id != user_id\n UserMailer.new_event(id, user.email).deliver_now\n end\n\n if ['verification', 'approval', 'execution'].include? new_state\n if recipient_id != user_id # must not be double delivering\n recipient_email = User.find_by(id: recipient_id).try(:email)\n UserMailer.new_event(id, recipient_email).deliver_now\n end\n end\n end",
"def send_fundraiser_featured_notification\n person.send_email :fundraiser_featured_notification, fundraiser: self\n end",
"def create\n pending_request = PendingTutorRequest.create(tutor_request_params)\n tutee = User.find(params[:student_id])\n course = Course.find(TutorSubject.find(params[:tutor_subject_id]).course_id)\n\n course_code = course.course_prefix + course.course_code\n\n data = {\n course: course_code,\n tutee: tutee.first_name\n }\n\n notifcation_params = { 'user_id' => params[:tutor_id],\n 'title' => 'Request',\n 'body' => 'You have a new pending request for ' + course_code,\n 'icon' => 'request_new',\n 'color' => 'lightgrey',\n 'type' => 'request',\n 'associated_data' => data.to_json }\n\n if pending_request.valid?\n Notifications.send_notification(notifcation_params)\n json_response(pending_request, :created)\n else\n json_response(pending_request.errors, :unprocessable_entity)\n end\n end",
"def email_not_approved_proposal\n ProposalMailer.email_not_approved_proposal\n end",
"def allocation_notfification\n CandidateMailer.allocation_email(self).deliver\n end",
"def send_email\n # There is a deliver_later method which we could use\n InvoiceMailer.email_invoice(self).deliver_now\n self.sent_by_email = true\n self.save\n end",
"def send_new_booking_request_notifications\n\n if pay_now\n notify_manager_pay_now\n notify_request_to_customer_pay_now\n else\n notify_manager\n notify_request_to_customer\n end\n\n end",
"def invoice\n NotificationsMailer.invoice\n end",
"def create (attendee)\n\n # respond_to do |format|\n\n # Sends email to user when user is created.\n ItineraryMailer.sample_email(attendee).deliver_now\n\n\n # format.html { redirect_to attendee, notice: 'Attendee was successfully created.' }\n # format.json { render :show, status: :created, location: attendee }\n # else\n # format.html { render :new }\n # format.json { render json: @attendee.errors, status: :unprocessable_entity }\n # end\n end",
"def perform(ipn_id)\n ipn = InstantPaymentNotification.find(ipn_id)\n params = ipn.params\n order = Order.find_by_request_id(params['custom'])\n ipn.update(\n payment_status: params['payment_status'],\n notify_version: params['notify_version'],\n request_id: params['custom'],\n verify_sign: params['verify_sign'],\n payer_email: params['payer_email'],\n txn_id: params['txn_id'],\n order_id: order.try(:id)\n )\n if order.blank?\n Rails.logger.debug('Order is blank')\n ExceptionNotifier.notify_exception(InvalidIPNException.new, data: { message: \"IPN #{ipn.id} cannot be associated with an Order\" })\n return nil\n end\n if !order.status.blank? && order.status.upcase == 'COMPLETED'\n Rails.logger.debug('Order status is already set to completed')\n ExceptionNotifier.notify_exception(InvalidIPNException.new, data: { message: \"IPN #{ipn.id} seems to have been sent more than once, as the Order was already marked completed.\" })\n return nil\n end\n\n if ipn.valid_ipn?\n order.transaction_id = ipn.txn_id\n order.status = ipn.payment_status.upcase if ipn.payment_status\n if order.includes_physical_item?\n # Assuming that because the street address is blank, there is no other address info, and we can save address info\n # coming to us from paypal\n unless order.address_street1?\n order.first_name = params['first_name']\n order.last_name = params['last_name']\n order.address_city = params['address_city']\n order.address_country = params['address_country']\n order.address_name = params['address_name']\n order.address_state = params['address_state']\n order.address_street1 = params['address_street']\n order.address_zip = params['address_zip']\n end\n order.shipping_status = 3 # 3 = pending\n end\n order.save\n\n # Everything looks good, mark as processed.\n ipn.update(processed: true)\n\n Download.restock_for_order(order) if order.includes_digital_item?\n\n # Now that the order is validated and everything is saved, I'll email the user to let them know about it.\n begin\n if order.user.guest?\n link_to_downloads = order.retrieve_link_to_downloads\n OrderMailer.guest_order_confirmation(order.user_id, order.id, link_to_downloads).deliver_later\n else\n OrderMailer.order_confirmation(order.user_id, order.id).deliver_later\n end\n rescue StandardError => e\n Rails.logger.debug('could not send order confirmation email')\n ExceptionNotifier.notify_exception(e, data: { message: \"Failed trying to send order confirmation email for #{order.to_json}: #{e.message}\" })\n end\n\n handle_physical_items(order) if order.includes_physical_item?\n else\n Rails.logger.debug('PAYPAL IPN is invalid')\n order.transaction_id = ipn.txn_id\n order.status = ipn.payment_status\n order.save\n end\n end",
"def notify_user\n NotiMailer.notification_proposal(self.homework.user.email, self, self.homework).deliver\n end",
"def trial_ending(user)\n mail to: user.email, subject: \"Only 72 Hours Left of Review Alerts!\"\n end",
"def new_data_request_notification(project_id)\n\t\tbegin\n @project = Project.find(project_id)\n lead_ids = UserProjectRole.find(:all, :conditions=>[\"project_id=? and role=?\", project_id, \"lead\"], :select=>['user_id'])\n lead_ids = lead_ids.empty? ? [] : lead_ids.collect{|x| x.user_id}\n lead_emails = User.find(:all, :conditions=>[\"id IN (?)\",lead_ids], :select=>[\"email\"])\n \n from DEFAULT_FROM\n reply_to DEFAULT_REPLY_TO\n subject \"SRDR - New Download Request Received\"\n recipients lead_emails.collect{|x| x.email}.join(\",\")\n sent_on Time.now\n\n\t\trescue Exception=>e \n puts \"ERROR SENDING REQUEST NOTIFACTION: #{e.message}\\n#{e.backtrace}\\n\\n\"\n end\n\tend",
"def newly_created_opportunity\n # users = User.on_new_opportunity_subscriber\n user = User.find(97)\n opportunity = Opportunity.find(@opportunity_id)\n #NotificationMailer.newly_created_opportunities(user, opportunity).deliver_now\n opportunity.opportunity_email_notification.update_recently_added\n puts \"Notificação oportunidade criada recentemente\"\n end",
"def new_pledge\n @greeting = \"Hi\"\n\n mail to: \"[email protected]\"\n end",
"def create\n @responsibility_request = ResponsibilityRequest.new(params[:responsibility_request])\n @service = Service.find(params[:responsibility_request][:subject_id])\n \n respond_to do |format|\n if @responsibility_request.save\n flash[:notice] = \"You request was successfully received\"\n \n # mail those responsible\n Delayed::Job.enqueue(ServiceCatalographer::Jobs::ServiceOwnerRequestNotification.new(@service.all_responsibles,\n base_host, @service, current_user ))\n # Send confirmation mail to user\n # logger.info(\"Sending confirmation mail to requester: #{current_user.email}\")\n Delayed::Job.enqueue(ServiceCatalographer::Jobs::ServiceClaimantRequestNotification.new(current_user, base_host, @service))\n \n format.html { redirect_to(@service) }\n format.xml {disable_action}\n else\n flash[:error] = \"Could not process your request\"\n format.html { redirect_to(@service) }\n format.xml {disable_action}\n end\n end\n end",
"def create\n @email = DirectEmail.new(params[:direct_email])\n @email.state = \"Approved\"\n if params[:direct_email][:student_id]\n @email.student = Student.find(params[:direct_email][:student_id])\n end\n if @email.save\n @email.send_email!\n respond_with @email, status: :created, location: @email\n else\n respond_with @email, status: :unprocessable_entity\n end\n end",
"def pending order\n @order = order\n\n mail(to: order.email, \n from: \"#{Store.settings.name} <#{Store.settings.email}>\",\n subject: \"#{Store.settings.name} Order ##{@order.id} pending payment\"\n ) do |format|\n format.html { render \"themes/#{Store.settings.theme.name}/emails/orders/pending\", layout: \"../themes/#{Store.settings.theme.name}/layout/email\" }\n format.text { render \"themes/#{Store.settings.theme.name}/emails/orders/pending\", layout: \"../themes/#{Store.settings.theme.name}/layout/email\" }\n end\n end",
"def create\n attendance = Attendance.new(params[:attendance])\n event = Event.find(attendance.event_id)\n #fill out the vote and selection allowances for attendees\n attendance.votes_remaining = event.votes_per_attendee\n attendance.selections_remaining = event.selections_per_attendee\n \n if attendance.save\n Notifier.invite_email(attendance).deliver\n redirect_to(event, :notice => 'Invitation was successfully created.')\n else\n flash[:error] = 'Sorry, could not create invitation.'\n redirect_to(event)\n end\n end",
"def pickup_scheduled(pickup_id)\n @pickup = Pickup.find(pickup_id)\n @greeting = \"Hi\"\n\n mail(to: \"#{@pickup.name} <#{@pickup.email}>\", subject: 'Your eCycle pickup is scheduled')\n end",
"def send_emails_new_person\n NewPersonJob.perform_later(id, full_name)\n end",
"def create\n\t\tsuper\n\t\tif params[\"requestPromotion\"] == 'true'\n\t\t\tuser = User.where(:email => params[\"email\"]).first\n\t\t\trequest = PromotionRequest.create!(\n\t\t\t\t:user => user\n\t\t\t)\n\n\t\t\t@recipients = Professor.where(:toBeNotified => true)\n\t\t\[email protected] do |recipient|\n\t\t\t\tputs \"Sending an email about new account\"\n\t\t\t\tNotifyProfessorsOfPromotionRequestMailer.with(request: request, recipient: recipient).notify_professors_of_promotion_request.deliver_now\n\t\t\tend\n\t\tend\n\tend",
"def shipped\n order = Order.last\n\n OrderMailer.shipped(order)\n end",
"def shipped\n OrderNotifierMailer.shipped\n end",
"def pickup_notification(pickup, sent_at = Time.now)\n subject \"#{SOLUTION_OWNER} Pickup Reminder\"\n recipients pickup.client_user.email\n bcc pickup.solution_owner_user.email\n from SYSTEM_EMAIL\n sent_on sent_at\n body pickup_mail_data(pickup)\n end",
"def interview_request(interview, employer, candidate)\n @interview = interview\n @employer = employer\n @candidate = candidate\n \n subject = \"Takeoff - Interview Request\"\n \n mail to: \"[email protected]\", subject: subject\n \n \n end",
"def send_eighty_g_reciept_notification(donation)\n begin\n # send mail for 80g reciept\n donour = Donour.find(donation.donour_id)\n product = CfrProduct.where(:id => donation.product_id, :is_other_product => 1)\n product_or_event_name = ''\n if product.present?\n product_or_event_name = product.name.to_s\n else\n product_or_event_name = 'General Donation'\n end\n\n if donour.present?\n donour_name = donour.first_name\n if donour.last_name.present?\n donour_name += ' ' + donour.last_name\n end\n if donour.email_id.present?\n begin\n session[:donor_name] = donour_name\n session[:donation_amount] = donation.donation_amount.to_s\n session[:don_id] = donation.id.to_s\n session[:donor_address] = donour.address.to_s\n session[:created_at] = donation.created_at.day.to_s + \"/\" + donation.created_at.mon.to_s + \"/\" + donation.created_at.year.to_s\n \n number = donation.donation_amount.to_s\n amt_parts = number.to_s.split(\".\")\n dec_result = amt_parts.count > 1 ? amt_parts[1].to_s : 0\n \n amt_rupees_text = \"#{wordify number.to_i}\"\n amt_paise_text = nil\n \n begin\n if dec_result.to_i > 0\n amt_paise_text = \"#{wordify dec_result.to_i}\" + ' paise'\n end\n rescue\n amt_paise_text = nil\n end\n if amt_paise_text.nil?\n session[:donation_amount_text] = amt_rupees_text + ' rupees'\n else\n session[:donation_amount_text] = amt_rupees_text + ' rupees and ' + amt_paise_text\n end\n \n pdf_80g_reciept = WickedPdf.new.pdf_from_string(\n render_to_string('pdf_templates/don_receipt_80g.pdf.erb')\n )\n email_text = confirmation_mail_template_with_eighty_g(donour_name, donour.email_id,\n donation.donation_amount.to_s, \n donation.id.to_s, \n product_or_event_name)\n puts \"Emails \" + donour.email_id\n send_mails_with_attachment(donour.email_id, 'Donation Confirmation', email_text, pdf_80g_reciept, 'DonationReciept.pdf')\n session[:donor_name], session[:donation_amount], session[:don_id], session[:donation_amount_text], session[:donor_address] = ''\n \n rescue Exception => e\n logger.warn \"Unable to send mail: #{e}\" \n end\n end \n end\n rescue Exception => ex\n logger.warn \"Unable to send notification: #{ex}\" \n end \n end",
"def attendee_confirmation(attendee)\n @attendee = attendee\n @url = \"http://www.TMSbigideaday.org\"\n subject = \"Thanks for signing up for The Mountain School's Big Idea Day\"\n\n mail to: @attendee.email,\n subject: subject.to_s\n end",
"def shipping_invoice_ready(invoice) \n @invoice = invoice\n sc = invoice.site.store_config\n mail(:to => sc.shipping_email, :subject => 'Order ready for shipping')\n end",
"def schedule(i_tip_message)\n # Not sending any emails if the system considers the update\n # insignificant.\n unless i_tip_message.significant_change\n unless i_tip_message.schedule_status\n i_tip_message.schedule_status = '1.0;We got the message, but it\\'s not significant enough to warrant an email'\n end\n return nil\n end\n\n summary = i_tip_message.message['VEVENT']['SUMMARY'].to_s\n\n return nil unless Uri.parse(i_tip_message.sender)[:scheme] == 'mailto'\n return nil unless Uri.parse(i_tip_message.recipient)[:scheme] == 'mailto'\n\n sender = i_tip_message.sender[7..-1]\n recipient = i_tip_message.recipient[7..-1]\n\n sender = \"#{i_tip_message.sender_name} <#{sender}>\" if i_tip_message.sender_name\n recipient = \"#{i_tip_message.recipient_name} <#{recipient}>\" if i_tip_message.recipient_name\n\n subject = 'SabreDAV iTIP message'\n case i_tip_message.method.upcase\n when 'REPLY'\n subject = 'Re: ' + summary\n when 'REQUEST'\n subject = summary\n when 'CANCEL'\n subject = 'Cancelled: ' + summary\n end\n\n headers = {\n 'Reply-To' => sender,\n 'From' => @sender_email,\n 'Content-Type' => \"text/calendar; charset=UTF-8; method=#{i_tip_message.method}\"\n }\n\n headers['X-Sabre-Version'] = Dav::Version::VERSION if Dav::Server.expose_version\n\n mail(\n recipient,\n subject,\n i_tip_message.message.serialize,\n headers\n )\n i_tip_message.schedule_status = '1.1; Scheduling message is sent via iMip'\n end",
"def new_payments(payments)\n mailInfo = getEmailDefaults(\"#{payments.length} New Payment(s)\", '[email protected]')\n @payments = payments\n mail(mailInfo)\n end",
"def new_proposal(proposal)\n @proposals = proposal\n mail to: proposal.user.email, subject: \"Thanks for submitting your proposal\"\n end",
"def send_email(estimate)\n if Rails.env.production?\n ProviderMailer.delay.estimate_email(estimate)\n else\n ProviderMailer.estimate_email(estimate).deliver\n end\n end",
"def create\r\n @appoint_responsible = AppointResponsible.new\r\n @instruction = Instruction.new(instruction_params)\r\n @instruction.user_id = current_user.id\r\n @instruction.email = current_user.email\r\n\r\n respond_to do |format|\r\n if @instruction.save\r\n\r\n logger.debug(\"========\")\r\n logger.debug(params[:account_transfer][:inheritor_email])\r\n\r\n account_transfer = AccountTransfer.new(\r\n inheritor_email: params[:account_transfer][:inheritor_email],\r\n transferable_type: \"Instruction\",\r\n transmitter_id: current_user.id,\r\n transferable_id: @instruction.id\r\n )\r\n\r\n inheritor = User.find_by_email(params[:account_transfer][:inheritor_email])\r\n account_transfer.inheritor_id = inheritor.id if inheritor\r\n\r\n if account_transfer.save\r\n UserMailer.with(inheritor: @inheritor).welcome_email.deliver_later\r\n format.html { redirect_to root_url, notice: 'Instruction was successfully created.' }\r\n format.json { render :show, status: :created, location: @instruction }\r\n else\r\n format.html { render :new }\r\n format.json { render json: @instruction.errors, status: :unprocessable_entity }\r\n end\r\n else\r\n format.html { render :new }\r\n format.json { render json: @instruction.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def generate\n invoice.generate!\n flash[:notice] = \"The invoice has been generated and assigned the identifier #{invoice.identifier}\"\n respond_with(invoice)\n end",
"def send_approve_email\n 'send_approve_email'\n end",
"def new\n InvitationMailer.request_invitation(@league, current_user, _invitation_params[:email], _invitation_params[:message]).deliver\n render json: { message: { type: SUCCESS, content: \"An invite request for #{_invitation_params[:email]} has been sent to the commish\" } }, status: :ok\n end",
"def send_pledge_reminder!\n UserMailer.payment_reminder_pledge(user, self).deliver\n end",
"def order_in_progress\n @greeting = \"Hi\"\n\n mail to: \"[email protected]\"\n end",
"def booking_invoice\n NotificationsMailer.with(sports_centre: SportsCentre.first, order: Order.first).booking_invoice\n end",
"def send_invoice_reminder(project)\n MemberMailer.invoice_reminder_for_project_admin(self, project).deliver_now\n end",
"def new_apply_email(feedback_params)\n @firstname = feedback_params[:firstname]\n @lastname = feedback_params[:lastname]\n @telephone = feedback_params[:telephone]\n @email = feedback_params[:email]\n @address = feedback_params[:address]\n @landlord = feedback_params[:landlord]\n @landlordnum = feedback_params[:landlordnum]\n @employer = feedback_params[:employer]\n @employername = feedback_params[:employername]\n @employernum = feedback_params[:employernum]\n @income = feedback_params[:income]\n # Initialize the message here\n # mail(to: [\"[email protected]\",\"[email protected]\", \"[email protected]\", \"[email protected]\", \"[email protected]\", \"[email protected]\"], subject: 'There is a new institution registration pending')\n mail(to: [\"*Some Email*\", \"*Some Email*\"], subject: 'Akridge LLC: A new applicant has applied')\n end",
"def send_request_confirmation_email\n ReservationMailer.request_confirmation(self).deliver_now\n end",
"def send_mail_on_creation(rent)\n RentMailer.success_rent_email(rent.id).deliver_later\n end",
"def create\n SellersMailer.delay.apply_reminder(current_user.id)\n\n # Delay slightly to make it seem like it wasn't automatic ;)\n SellersMailer.delay_for(rand(5.minutes..15.minutes)).apply(current_user.id)\n \n render json: {}, status: 200\n end",
"def sendout\n # do tricky HL7 and PIT stuff with narrative\n for recipient in self.user.interested_parties\n if recipient.wedgetail != created_by # don't sent back to original sender\n # do tricky encryption and email stuff for recipient\n om = OutgoingMessage.new(:recipient_id=>recipient.wedgetail)\n self.outgoing_messages << om\n om.sendout recipient\n om.save!\n end\n end\n end",
"def create\n @email = Email.new(params[:event_email])\n @email.state = \"Pending\"\n if @email.save\n respond_with @email, status: :created, location: @email\n else\n respond_with @email, status: :unprocessable_entity\n end\n end",
"def ipn\n # Create a notify object we must\n notify = Paypal::Notification.new(request.raw_post)\n\n #we must make sure this transaction id is not already completed\n\n if notify.acknowledge\n begin\n # if notify.complete?\n end\n else\n # another reason to be suspicious\n end\n\n render :nothing => true\n end",
"def new_review_email(user, business)\n @user = user\n @business = business\n mail(:to => @user.email, :subject => \"Your review has been posted on CONSIGN.NYC\")\n end",
"def new_interview\n UserMailer.new_interview\n end",
"def investment_email(investor,investment_opportunity)\n @investor = investor\n @investment_opportunity = investment_opportunity\n mail(from: \"[email protected]\",to: \"[email protected]\",reply_to: @investor.email, subject: \"Emerging Frontiers Investment Inquiry\")\n end",
"def shipped (order)\n @order=order\n\n mail to: order.email, subject: \"You are receiveing the first Mail from Depot App\"\n end",
"def issued\n @greeting = \"Hi\"\n\n mail to: \"[email protected]\"\n end"
] | [
"0.6468352",
"0.62967336",
"0.6296137",
"0.6221056",
"0.6101837",
"0.60765684",
"0.6039849",
"0.60067147",
"0.59220046",
"0.59165615",
"0.5905543",
"0.5903814",
"0.5892711",
"0.5867239",
"0.5867175",
"0.58389395",
"0.58187854",
"0.5817787",
"0.5804259",
"0.5802057",
"0.5774271",
"0.5770648",
"0.57636005",
"0.57476026",
"0.57432127",
"0.5714278",
"0.5693787",
"0.56874955",
"0.56867635",
"0.56844264",
"0.5653379",
"0.5653379",
"0.564588",
"0.564566",
"0.56440234",
"0.56314707",
"0.56314707",
"0.56309605",
"0.56305504",
"0.56277823",
"0.5625986",
"0.56231546",
"0.56229925",
"0.56185263",
"0.56166846",
"0.56110364",
"0.56106144",
"0.56078357",
"0.5595123",
"0.5594754",
"0.558928",
"0.55882967",
"0.5585449",
"0.5580393",
"0.5579572",
"0.5577975",
"0.5577069",
"0.5575653",
"0.5572639",
"0.55686647",
"0.5566392",
"0.55607516",
"0.5560596",
"0.55395883",
"0.55386055",
"0.55286115",
"0.5519279",
"0.55186945",
"0.55154896",
"0.5515288",
"0.5512813",
"0.5511076",
"0.55075634",
"0.55045474",
"0.54976",
"0.5496847",
"0.54967785",
"0.5493177",
"0.54880404",
"0.54762506",
"0.5474498",
"0.5472441",
"0.5469084",
"0.5455633",
"0.54538256",
"0.54537374",
"0.54502714",
"0.54490614",
"0.54487437",
"0.5448196",
"0.54453754",
"0.5441912",
"0.5438067",
"0.5437081",
"0.54362637",
"0.5434615",
"0.5428688",
"0.54282856",
"0.5427239",
"0.54258984"
] | 0.64498854 | 1 |
Ensure the given +latitude+ and +longitude+ coordinates are rounded to six decimal places. | def normalize_coordinates
self.latitude = latitude.round(6) unless self.latitude.nil?
self.longitude = longitude.round(6) unless self.longitude.nil?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def round_float(float, places); end",
"def compute_latitude_precision\n if code_length <= 10\n return 20**(code_length/-2.0 + 2).floor\n end\n\n (20**-3).to_f/GRID_ROWS**(code_length - 10)\n end",
"def latitude=(lat)\n write_attribute(:latitude, lat.round(10)) if lat\n end",
"def lat_f\n lat.to_f\n end",
"def round(float, decimal_places)\n sprintf(\"%.#{decimal_places}f\", float)\n end",
"def round_to(decimal_places)\n to_f.round(decimal_places)\n end",
"def check_coordinates(trace)\n coordinates = trace[:coordinates] || trace.coordinates\n\n coordinates.each do |c|\n lat = c[:latitude] || c.latitude\n long = c[:longitude] || c.longitude\n\n expect(lat).to be_a(Float)\n expect(long).to be_a(Float)\n end\n end",
"def test_lat_lon_format\n note = build(:note, :latitude => 0.00004 * GeoRecord::SCALE, :longitude => 0.00008 * GeoRecord::SCALE)\n\n assert_equal \"0.0000400\", note.lat.to_s\n assert_equal \"0.0000800\", note.lon.to_s\n end",
"def lat\n round(@lat)\n end",
"def initialize latitude, longitude\n @latitude = latitude.to_f\n @longitude = longitude.to_f\n end",
"def is_nearby?(user_lat, user_long, bus_lat, bus_long)\n Math.hypot((user_lat - bus_lat), (user_long - bus_long)) <= .01\n end",
"def is_nearby(user_latitude,user_longitude, bus_latitude, bus_longitude)\n (user_longitude - bus_longitude).abs <= 0.01 && (user_latitude - bus_latitude).abs \nend",
"def valid?\n [email protected]? && [email protected]? && @lat.to_f.abs < 90 && @lon.to_f.abs < 90\n end",
"def test_round_totals\n # tax, total want to be rounded\n @order.tax = 0.068\n assert_equal @order.tax_cost, 0.88\n assert_equal 1326.38, @order.total\n end",
"def round_to(decimal_places)\n (self * 10**decimal_places).round.to_f / 10**decimal_places\n end",
"def construct_latitude\n unless [@latitude_degrees, @latitude_minutes, @latitude_milli_minutes, @latitude_hemisphere].all? { |attr| attr.blank? }\n default_to_zero :@latitude_minutes, :@latitude_milli_minutes\n lat_deg = to_bounded_float @latitude_degrees, 90, :@latitude_degrees_invalid\n lat_min = to_bounded_float @latitude_minutes, 59, :@latitude_minutes_invalid\n lat_milli_min = to_bounded_float @latitude_milli_minutes, 999, :@latitude_milli_minutes_invalid\n lat_hem = to_hemisphere @latitude_hemisphere, %w(N S), :@latitude_hemisphere_invalid\n\n unless @latitude_degrees_invalid || @latitude_minutes_invalid ||\n @latitude_milli_minutes_invalid || @latitude_hemisphere_invalid\n self.latitude = coordinates_to_float lat_deg, lat_min, lat_milli_min, lat_hem\n end\n end\n end",
"def latitude=(lat)\n @lat = lat.to_f if lat\n end",
"def coordinate_format=(*args)\n\t self.integer_places, self.decimal_places = args.flatten.map {|a| a.to_i }\n\t @total_places = self.decimal_places + self.integer_places\n\tend",
"def ensure_params_have_values\n @attributes[:lat] = 33.1243208 unless @attributes[:lat].present? \n @attributes[:lon] = -117.32582479999996 unless @attributes[:lon].present? \n @attributes[:radius].present? ? @_search_radius = @attributes[:radius] : self.set_radius\n end",
"def round_float(fp_number, d_place)\n assert_nothing_raised do\n return (fp_number * 10**d_place).round.to_f / 10**d_place\n end\n end",
"def is_nearby(user_latitude, user_longitude, bus_latitude, bus_longitude)\n (user_longitude - bus_longitude).abs <= 0.01 && (user_latitude - bus_latitude).abs <= 0.01\n end",
"def decimal_places; end",
"def is_nearby(user_latitude, user_longitude, bus_latitude, bus_longitude)\n (user_longitude - bus_longitude).abs <= 0.01 && (user_latitude - bus_latitude).abs <= 0.01\n end",
"def test_006_convert_inches_to_feet\r\n result = convert_inches_to_feet('36.0')\r\n assert close_enough(3.0, result)\r\n end",
"def get_square(lat,lon)\n return [ ((lat * 100.0).round)/100.0,\n ((lon * 100.0).round)/100.0 ]\n \nend",
"def is_nearby?(user_lat, user_long, bus_lat, bus_long)\n\n# max distance is about 0.6 miles away 0.01 degrees\n\nmax_distance = 0.01\n\ndifference_latitudes = user_lat - bus_lat.to_f\ndifference_longitudes = user_long - bus_long.to_f\n\ndistance = Math.sqrt(difference_latitudes ** 2 + difference_longitudes ** 2)\n\ndistance <= max_distance\n\nend",
"def float_round(number)\n\t\tnumber.round if number.respond_to? :round\n\tend",
"def round(float)\n float.round\n end",
"def valid_lat_long?\n float?(latitude) && float?(longitude) &&\n latitude.to_f.between?(VALID_LATITUDE[:min], VALID_LATITUDE[:max]) &&\n longitude.to_f.between?(VALID_LONGITUDE[:min], VALID_LONGITUDE[:max])\n end",
"def in_range?(radius:, location:)\n (((location.latitude - @latitude) ** 2) + ((location.longitude - @longitude) ** 2)) < (radius ** 2)\n end",
"def deltas_rounded(array_of_lat_lng_pairs)\n rounded = round_to_precision array_of_lat_lng_pairs\n calculate_deltas rounded\n end",
"def round value\n Float(format('%.5g', value))\n end",
"def lat=(lat)\n @lat = lat.to_f if lat\n end",
"def lat=(lat)\n @lat = lat.to_f if lat\n end",
"def must_have_at_least_three_border_points_or_center_point \n if (self.latitude.nil? || self.longitude.nil?) && border_points.length < 3\n errors.add(:latitude, \"You must enter a center point or at least 3 border points\")\n end\n end",
"def is_nearby?(user_lat, user_long, bus_lat, bus_long)\n\t\t(user_lat - bus_lat).abs <= 0.01 && (user_long - bus_long).abs <= 0.01\n\n\tend",
"def precision(f)\n return (f * GeoRecord::SCALE).round.to_f / GeoRecord::SCALE\n end",
"def location_format_gnip\n unless @lat.nil? || @long.nil? || @radius.nil?\n location = \"point_radius:[#{@long} #{@lat} #{@radius}]\"\n # prepend space for the rule if hashtags have been set\n location.prepend(\" \") if @hashtags.any?\n location\n else\n ''\n end\n end",
"def decimal_latitude\n @ce.andand.latitude.to_s\n end",
"def coordinates?(latitude, longitude)\n coordinate?(latitude) && coordinate?(longitude)\n end",
"def geo_validation(options)\n options[:message].location.latitude.to_i == RUBIZZA[:latitude] &&\n options[:message].location.longitude.to_i == RUBIZZA[:longitude]\n end",
"def coordinate?(value)\n !! value.to_f\n end",
"def radius(row)\n return nil if row.obs_lat.present?\n\n r1 = lat_radius(row)\n r2 = long_radius(row)\n return nil if !r1 || !r2\n\n [r1, r2].max.to_f.round\n end",
"def valid?\n lat && lng && lat >= -90 && lat <= 90 && lng >= -180 && lng <= 180\n end",
"def valid?\n lat && lng\n end",
"def valid?\n lat && lng\n end",
"def coordinates_changed?\n if self.address_changed?\n unless self.lat_changed? || self.lng_changed?\n self.errors.add(:address, 'cannot be geo-located. Please try to be more specific')\n return false\n end\n end\n true\n end",
"def test_whichways_badlat\n bboxes = [[0, 0.1, 0.1, 0], [-0.1, 80, 0.1, 70], [0.24, 54.35, 0.25, 54.33]]\n check_bboxes_are_bad bboxes do |map, bbox|\n assert_boundary_error map, \" The server said: The minimum latitude must be less than the maximum latitude, but it wasn't\", bbox.inspect\n end\n end",
"def rounding_method; end",
"def coordinate_to_decimal\n\t\treturn nil if self.blank?\n\t\tresult = 0.0\n\t\tminus = false\n\t\t\n\t\t# Degrees\n\t\tsplitted_1 = self.split(\"°\")\n\t\treturn nil if splitted_1.length != 2\n\t\tresult += splitted_1[0].to_i.to_f\n\n\t\t# Minus correction\n\t\tif result < 0.0\n\t\t\tminus = true\n\t\t\tresult = -result\n\t\tend\n\n\t\t# Minutes\n\t\tsplitted_2 = splitted_1[1].split(\"'\")\n\t\treturn nil if splitted_2.length != 2\n\t\tresult += (splitted_2[0].to_i.to_f / 60.to_f).to_f\n\n\t\t# Seconds\n\t\tresult += (splitted_2[1].to_f / 3600.to_f).to_f\n\n\t\t# Minus correction\n\t\tif minus\n\t\t\tresult = -result\n\t\tend\n\n\t\treturn result\n\tend",
"def round() end",
"def nearby?(lat, lon)\n # assumes flat plane\n Math.sqrt(([email protected]) ** 2 + ([email protected]) ** 2)\n end",
"def round(degrees_F = 68, exponent = 2) \r\n ((convert degrees_F) * 10.0 ** exponent).round / 10.0 ** exponent\r\n# convert degrees_F.round(exponent) \r\nend",
"def near?(lat, long, mile_radius)\n # omitted\n end",
"def round_tax(tax)\n\t\t(tax * 20.0).ceil / 20.0\n\tend",
"def test_grid_to_spherical_55_00_12_45\n assert_almost_equal [12.75, 55.00], Mercator.grid_to_spherical(6097106.672, 356083.438, @datum, @projection)\n end",
"def latitude=(latitude)\n if !latitude.nil? && latitude > 90\n fail ArgumentError, 'invalid value for \"latitude\", must be smaller than or equal to 90.'\n end\n\n if !latitude.nil? && latitude < 0\n fail ArgumentError, 'invalid value for \"latitude\", must be greater than or equal to 0.'\n end\n\n @latitude = latitude\n end",
"def coordinate_bounds(latitude, longitude, radius)\n radius = radius.to_f\n factor = (Math::cos(latitude * Math::PI / 180.0) * 69.0).abs\n [\n latitude - (radius / 69.0),\n latitude + (radius / 69.0),\n longitude - (radius / factor),\n longitude + (radius / factor)\n ]\n end",
"def round_prec(digits)\n #This is a stub, used for indexing\n end",
"def initialize(latitude_a, longitude_a, latitude_b, longitude_b)\n @latitude_a = to_radians(latitude_a.to_f)\n @latitude_b = to_radians(latitude_b.to_f)\n @latitude_difference = to_radians(latitude_b.to_f - latitude_a.to_f)\n @longitude_difference = to_radians(longitude_b.to_f - longitude_a.to_f)\n @earths_radius_in_km = 6371\n end",
"def round!; @x, @y = @x.round, @y.round; self; end",
"def LatLongToString(lat, lng)\n lat = \"#{lat.round + 90}\"\n lng = \"#{lng.round + 180}\"\n\n if lat.size < 3\n (3 - lat.size).times{ lat = '0'+lat }\n end\n\n if lng.size < 3\n (3 - lng.size).times{ lng = '0'+lng }\n end\n\n lat+lng\nend",
"def latitude\n latitude_times_1000000.nil? ? nil : latitude_times_1000000 / 1_000_000.0\n end",
"def check_geocode\n unless self.latitude\n geocode\n end\n end",
"def test_out_of_bounds\n assert_raise Proj4::LatitudeOrLongitudeExceededLimitsError do\n @proj_gk.forward( Proj4::Point.new( deg2rad(190), deg2rad(92) ) ) \n end\n end",
"def eur(cents); end",
"def apply_validations_for_decimal\n apply_validations_for_float\n end",
"def lat_lon\n [latitude, longitude].join(',')\n end",
"def valid_radius?\n float?(radius) &&\n radius.to_f.positive? &&\n radius.to_f <= MAXIMUM_SEARCH_RADIUS_IN_KM\n end",
"def test_wgs84_to_gk\n point = @proj_wgs84.transform(@proj_gk, Proj4::Point.new(@lon * Proj4::DEG_TO_RAD, @lat * Proj4::DEG_TO_RAD, 0))\n assert_equal @rw, point.x.round\n assert_equal @hw, point.y.round\n assert_in_delta @zw, point.z, PRECISION\n end",
"def is_nearby?(user_lat, user_long, bus_lat, bus_long)\n # Max distance in degrees, approx 0.6 miles\n max_distance = 0.01\n\n difference_latitudes = user_lat - bus_lat.to_f\n difference_longitudes = user_long - bus_long.to_f\n\n distance = Math.sqrt(difference_latitudes ** 2 + difference_longitudes ** 2)\n\n distance <= max_distance\n end",
"def longitude=(lng)\n @lng = lng.to_f if lng\n end",
"def round_to(precision=0)\n mulitplier = 10.0 ** (precision)\n (((((self)*mulitplier).round).to_f)/mulitplier)\n end",
"def inBounds lat, lon\n lat <= max_latitude && lat >= min_latitude && lon <= max_longitude && lon >= min_longitude\n end",
"def latitude?\n if latitude.nil?\n errors.add(:base, \"GPS location not present\")\n return false\n end\n return true\n end",
"def lat_check(l)\n circ_bounds(l * 1.0, 90.0, -90.0)\n end",
"def validate(lat1, lon1, lat2, lon2)\n [lat1, lat2].each do |lat|\n if lat > 90 || lat < -90\n msg = \"Latitude '#{lat}' is invalid - must be between -90 and 90\"\n raise Error, msg\n end\n end\n\n [lon1, lon2].each do |lon|\n if lon > 180 || lon < -180\n msg = \"Longitude '#{lon}' is invalid - must be between -180 and 180\"\n raise Error, msg\n end\n end\n end",
"def round_to_hour(f)\r\n (f/0.125).round*0.125\r\n end",
"def round_to_hour(f)\r\n (f/0.125).round*0.125\r\n end",
"def round_to_hour(f)\r\n (f/0.125).round*0.125\r\n end",
"def round(num, decimals=3)\n return \"\" unless num\n \"%.#{decimals}f\" % num\n end",
"def round_up_number(float)\n\tn = 3.142\n\tn.ceil\nend",
"def validate_round(input)\n if input < 1 || input > 10\n false\n else\n true\n end\n end",
"def round(value)\n ( (value.to_f + @min_margin) / @multiple_of ).ceil * @multiple_of\n end",
"def compare_with_expected_precision(calculation, expected_result, calculated_result)\n expected_precision = get_precision_of expected_result\n expected_result = expected_result.to_f\n rounded_calculation = calculated_result.round(expected_precision)\n assert_equal expected_result, rounded_calculation,\n \"Expected a #{calculation} of #{expected_result}, but got #{rounded_calculation}\"\nend",
"def test_should_round_prices\n non_rounded = order_shipping_types(:ups_non_rounded_number)\n assert_equal(50, non_rounded.calculate_price(0))\n end",
"def latitude\n location.latitude if location.latitude\n end",
"def round(number, precision)\n ((number * 10**precision).round.to_f) / (10**precision)\n end",
"def latitude; end",
"def with_rounding_mode(mode); end",
"def latlng_good?\n self.addr_latlng && self.addr_latlng.lat && self.addr_latlng.lng\n end",
"def rounded_tax(raw_tax)\n (raw_tax * 20).ceil.round / 20.0\n end",
"def round!\n @x, @y = @x.round, @y.round\n self\n end",
"def initialize(lat = nil, lng = nil)\n lat = lat.to_f if lat && !lat.is_a?(Numeric)\n lng = lng.to_f if lng && !lng.is_a?(Numeric)\n @lat = lat\n @lng = lng\n end",
"def initialize(lat = nil, lng = nil)\n lat = lat.to_f if lat && !lat.is_a?(Numeric)\n lng = lng.to_f if lng && !lng.is_a?(Numeric)\n @lat = lat\n @lng = lng\n end",
"def round!(prec)\n bounds = [@min, @max].map { |bound| bound.round(prec) }\n initialize(*bounds)\n return self\n end",
"def pretty_distance_from(latitude, longitude, accuracy=0)\n #\"%0.2f miles\" % (distance_from(latitude, longitude) / METERS_PER_MILE)\n distance = \"%0.0f meters\" % distance_from(latitude, longitude)\n end",
"def has_location?\n # Since we require presence of both lat&lon, checking for one\n # property is good enough.\n lat.present?\n end",
"def trip_cost(distance, miles_per_gal, price_per_gal)\n result = (((distance.to_f / 100) * miles_per_gal) * price_per_gal) #can also do distance / 100.0 because as long as one of the numbers is a floating point it will return a decimal number\n return result\nend",
"def clip_latitude(latitude)\n [ 90, [-90, latitude].max ].min\n end"
] | [
"0.60885",
"0.57529616",
"0.5489223",
"0.5427365",
"0.5411109",
"0.53360134",
"0.5324703",
"0.52733594",
"0.5253657",
"0.5242261",
"0.5209345",
"0.5122058",
"0.51209885",
"0.5113649",
"0.50571954",
"0.50546175",
"0.5041673",
"0.50359476",
"0.5034785",
"0.50304675",
"0.5005363",
"0.4982908",
"0.49637753",
"0.49611273",
"0.49531668",
"0.49478796",
"0.4941151",
"0.4934983",
"0.4929062",
"0.49040487",
"0.4900602",
"0.489716",
"0.48732802",
"0.48732802",
"0.48654625",
"0.48497686",
"0.48475853",
"0.48470536",
"0.48254168",
"0.4821127",
"0.4819677",
"0.48180184",
"0.47989595",
"0.47985265",
"0.47899035",
"0.47899035",
"0.47748283",
"0.47714338",
"0.476988",
"0.47653666",
"0.47548357",
"0.47515532",
"0.47514495",
"0.4738839",
"0.47385284",
"0.47253016",
"0.4720588",
"0.47105592",
"0.4704448",
"0.47032583",
"0.46963552",
"0.4695581",
"0.46789294",
"0.46764216",
"0.46714717",
"0.46688583",
"0.4660045",
"0.46516284",
"0.46506584",
"0.4636283",
"0.4634334",
"0.46307388",
"0.4626152",
"0.46215513",
"0.46211743",
"0.46210623",
"0.46136233",
"0.46119016",
"0.46119016",
"0.46119016",
"0.46075746",
"0.4600626",
"0.45991373",
"0.45913437",
"0.4590614",
"0.45840997",
"0.45825595",
"0.45821607",
"0.45821542",
"0.4576081",
"0.45712674",
"0.4563582",
"0.45610616",
"0.45600238",
"0.45600238",
"0.45554498",
"0.4553598",
"0.4552808",
"0.45521867",
"0.45372778"
] | 0.6582302 | 0 |
Should return "/v2.0/teachers/5798dc36fd5e25eb150010b5" from example above | def extract_canonical_uri
user_info['links'].find { |link| link['rel'] == 'canonical' }['uri']
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def beer_url(id)\n \"/beer/a/#{id}/\"\n end",
"def person_url(id)\n 'https://swapi.co/api/people/' + id.to_s\nend",
"def api_url(id)\n name = get_tourney_name(id)\n return \"https://api.challonge.com/v1/tournaments/uxie#{id}#{name}\"\nend",
"def url_for(base_url,msg)\n if msg[:id]\n if base_url.end_with?('/')\n \"#{base_url}#{msg[:id]}.json\"\n else\n \"#{base_url}/#{msg[:id]}.json\"\n end\n else\n base_url\n end\nend",
"def to_uri\n\"urn:uuid:\" + self.to_s\nend",
"def get_resource_name( url )\n new_url = url.gsub( '(.:format)', '' )\n\n return $1 if new_url =~ /\\/(\\w+)\\/:id$/ # /users/:id (users)\n return $1 if new_url =~ /\\/(\\w+)\\/:id\\/edit$/ # /users/:id/edit (users)\n return $1 if new_url =~ /^\\/(\\w+)$/ # /users (users)\n return $1 if new_url =~ /\\/:\\w*id\\/(\\w+)$/ # /users/:id/images (images)\n return $1 if new_url =~ /\\/:\\w*id\\/(\\w+)\\/\\w+$/ # /users/:id/config/edit (users)\n return $1 if new_url =~ /^\\/(\\w+)\\/\\w+$/ # /users/edit (users)\n return $1 if new_url =~ /\\/(\\w+)\\/\\w+\\/\\w+$/ # /users/password/edit (users)\n return url\n end",
"def web_path\n # 47 char is \"/\"\n return path[0] == 47 ? path : \"/\" + path\n end",
"def id_path\n full_path.collect(&:id).join(\":\")\n end",
"def partner_ref_url(resource)\n uri = URI.parse(root_url)\n uri.query = URI.encode_www_form(partner: resource.name)\n uri.to_s\n end",
"def show\n #getting an id of a student\n @URI = request.original_url\n @URI = @URI.split('/').last \n \n end",
"def review_url(beer_id, sort_suffix, page_number)\n \"/beer/a/#{beer_id}/#{sort_suffix}/#{page_number}/\"\n end",
"def pathto id\n str = '%08d' % id\n str = '0' + str if str.length % 2 == 1\n @datapath + '/' + str.scan(/../).join('/')\n end",
"def _path uri, subject\n [uri.request_uri, subject].join\nend",
"def _path uri, subject\n [uri.request_uri, subject].join\nend",
"def get_colleague_path()\n\t\tcase current_teacher.colleague_status(@teacher.id)\n\t\t\t# 2 returns an unused dummy URL\n\t\t\twhen (0..2)\n\t\t\t\treturn confadd_path(@teacher.id.to_s)\n\t\t\twhen 3\n\t\t\t\treturn confremove_path(@teacher.id.to_s)\n\t\tend\n\tend",
"def path\n \"/user/#{id}\"\n end",
"def nested_path\n ['', nested_url].join('/')\n end",
"def related_url\n return OrderedStringHelper.deserialize(super )\n end",
"def related_url\n return OrderedStringHelper.deserialize(super )\n end",
"def request_path\n \"/nodes/id/681e84fd-b06b-4044-9c51-2b74a9e2dc24/storage/id/d66570fa-9d51-4f6e-ab26-bdace295353e\"\nend",
"def test_format_path\n schema = Heroics::Schema.new(SAMPLE_SCHEMA)\n link = schema.resource('resource').link('info')\n assert_equal(['/resource/44724831-bf66-4bc2-865f-e2c4c2b14c78', nil],\n link.format_path(['44724831-bf66-4bc2-865f-e2c4c2b14c78']))\n end",
"def sub_path\n \"#{\"%02x\" % (id.to_i % 256)}/#{id}\"\n end",
"def tt_path\n segments[2..-1].join('/')\n end",
"def nested_path\n ['', nested_url].join('/')\n end",
"def nested_path\n ['', nested_url].join('/')\n end",
"def path_component\n path_component = \"/#{self.class.endpoint_name}\"\n if key_value\n path_component += '/' + key_value\n end\n path_component\nend",
"def url_for(string); end",
"def plain_path\n\t\t# same as above\n\t\tRails.application.routes.url_helpers.plain_fyle_path(id: self.id.to_s.rjust(3, \"0\"), format: 'txt')\n\tend",
"def uri_path(str)\n str.gsub(%r{[^/]+}n) { uri_segment($&) }\n end",
"def plain_url\n\t\t# same as above\n\t\tRails.application.routes.url_helpers.plain_fyle_url(id: self.id.to_s.rjust(3, \"0\"), format: 'txt')\n\tend",
"def user_id\n return link.split(\"/\")[2]\n end",
"def split_path\n to_s.split_path\n end",
"def api_gift_url\n return nil unless (extended_api_gift_url = read_attribute(:api_gift_url))\n encrypt_remove_pre_and_postfix(extended_api_gift_url, 'api_gift_url', 42)\n end",
"def id(string)\n return if string.blank?\n\n URI(string)\n .path\n .split(\"/\")\n .last\n .to_i\n end",
"def to_param\n \"#{id}-#{name.to_safe_uri}\"\n end",
"def get_full_path_id\n full_path_id = self.id[0..1] + '/' + self.id[2..3] + '/' + self.id[4..5] + '/' + self.id[6..7] + '/' + self.id\n end",
"def partial_path(opts)\n validate_uuid(opts)\n\n opts[:uuid][0, 2].downcase\n end",
"def druid\n id.split(/:/).last\n end",
"def api_url(path)\n return path if path.include?('//')\n \"#{api_root}/#{api_version}/#{tenancy_code}/#{path}\"\n end",
"def id\n \"#{controller.url}/#{name}\"[1..-1].gsub('/', '_')\n end",
"def partitioned_path(id)\n (\"%06d\" % id).scan(/.../)\n end",
"def rest_url\n # Transifex API doc says always use a trailing slash even if the last element is a slug\n build_nodes_url.to_s + '/'\n end",
"def base_uri\n users_path(self)\n end",
"def identifier\n match_path(3..-1)\n end",
"def test_id_to_uuid\n url = \"https://vault.heroku.com/apps/1234\"\n uuid = UUIDTools::UUID.sha1_create(UUIDTools::UUID_URL_NAMESPACE, url).to_s\n assert_equal(uuid, Vault::App.id_to_uuid(1234))\n end",
"def return_api_path(array)\n api_version = '1.0'\n return \"/#{api_version}/#{array.join('/')}\"\n end",
"def paramaterize params\n segments = @url.split('/')\n segments.map { |item| item[0] == ':' ? params.shift : item }.join('/')\n end",
"def get_user_bracket(url)\n\n\nend",
"def to_param\n if url\n url.gsub(/[\\/\\ \\.]/,'-')+\"-\"+id.to_s\n end\n end",
"def makeURL(path)\n \"#{self.api_endpt + path}?token=#{self.token}\"\n end",
"def cyd_contest_link(consumer)\n result = \"http://contest.claimyouredeal.com/contest/viewContest/userId:\"\n random_key = generate_random_key\n result << encrypted_consumer_id(consumer, random_key)\n result << \",token:\"\n result << hashed_token(random_key)\n result << \",key:\"\n result << random_key\n result\n end",
"def create_url(subpath='')\n paths = [ api_version, resources_path, subpath ]\n paths.select{|s| s != ''}.join('/')\n end",
"def dir_name string\n string.split('/')[0..-2].join('/')\nend",
"def to_endpoint id\n t=id.split('/')\n domain = t[1..-2].join('_')\n type = t[-1]\n \"freebase_tsv_#{domain}__#{type}\"\nend",
"def prepare_uri path\n \"#{@uri}/accounts/#{@client.account}#{path}\"\n end",
"def generate_id(v)\n @collection_id + '-' + v.downcase.gsub(/\\/+/, '_').gsub(/;+|\\.+/, '').gsub(/ /, '-')\n end",
"def slashless_url(url)\n url.chomp('/')\n end",
"def id_partition\n (\"%09d\".freeze % self.id).scan(/\\d{3}/).join(\"/\".freeze)\n end",
"def base_uri\n users_path( self )\n end",
"def url(prefix, stem)\n if prefix == ''\n \"/#{stem}/#{self.id}\"\n else\n \"#{prefix}/#{stem}/#{self.id}\"\n end\n end",
"def urns2_path(component_id, authpath)\n query = OID_Q_BASE.merge(storedProcedure: \"getDrs2ObjectUrn\",\n ownerCode: \"#{authpath}\",\n localName: \"#{component_id}\")\n\n OLIVIA.request_uri + '?' + URI.encode_www_form(query)\n end",
"def seller_url\r\n ['http:', user.user_url].join('//') rescue nil\r\n end",
"def url\n\t\t\"/\" + parents.reverse.map(&:slug).join(\"/\")\n\tend",
"def get_parent_id_folder(id)\n if id.to_s.length > 4\n id.to_s[0..id.to_s.length-2]\n else\n id.to_s\n end\nend",
"def url\n \"#{@client.url}#{self.class.path}#{@user1.username};#{@user2.username}\"\n end",
"def voter_attestation_url(voter)\n leo_attestation_url(@voter, :protocol => 'https')\nend",
"def to_s\n url_value = value.to_s.tr('#;\\'\"\"', '').gsub(' ', '%20')\n id? ? \"/#{value}\" : \"#{name}=#{url_value}\"\n end",
"def url\n @client.url + self.class.path + @sport.to_s\n end",
"def unique_path\n unique_name.split(\"/\") rescue [unique_name]\n end",
"def random_uri\r\n\t\t\"/\" + Rex::Text.rand_text_alphanumeric(rand(10) + 6)\r\n\tend",
"def url(path)\n \"#{API}/#{path}\"\n end",
"def to_param\n \"#{id}-#{name.to_safe_uri rescue nil}\"\n end",
"def to_param\n \"#{id}-#{name.to_safe_uri rescue nil}\"\n end",
"def id_partition\n (\"%09d\" % id).scan(/\\d{3}/).join(\"/\")\n end",
"def test_username\n self.child_id.split(' ', 2).map(&:downcase).join\n end",
"def tt_path\n segments[1..-1].join('/')\n end",
"def url\n \"#{@partnership.url}/#{@sport}\"\n end",
"def getApiRoute(endpoint)\n apiRoute = $drugbank_api + $drugbank_region\n\n if $drugbank_region != \"\"\n apiRoute = apiRoute + \"/\" \n end \n\n return apiRoute + endpoint\n\nend",
"def trip_id\n url.to_s =~ /information\\/[a-z]+\\/[^\\/]+\\/([^\\/]+)/\n $1\n end",
"def normalize_friendly_id(string)\n super[0..59]\n end",
"def get_id\n allowed_params = params.permit(:id, :ref, :path)\n\n id = [allowed_params[:id] || allowed_params[:ref]]\n id << \"/\" + allowed_params[:path] unless allowed_params[:path].blank?\n id.join\n end",
"def page_path( tagged, page )\n if tagged then\n \"/people/#{$params[ :user ]}/#{$params[ :product ]}/everything/tags/#{tagged}?page=#{page}\"\n else\n \"/people/#{$params[ :user ]}/#{$params[ :product ]}?page=#{page}\"\n end\nend",
"def ward_url\n \"/ward/\"+self.name.sub(/^St\\./,'St').gsub(' ','_')\n end",
"def generate_url(api_key, page_number, username)\n %W[\n ws.audioscrobbler.com\n /2.0/?method=user.getrecenttracks&user=#{username}&api_key=#{api_key}&format=json&page=#{page_number}\n ]\n end",
"def base_href\n '/api/v1'\n end",
"def normalize_path(url); end",
"def normalize_path(url); end",
"def to_param\n \"#{self.uid}-#{self.team_a}-vs-#{self.team_b}\".parameterize\n end",
"def elastics_id\n Digest::MD5.hexdigest url\n end",
"def subscription_id\n id.split(%r{\\/}).reject(&:empty?)[1]\n end",
"def get_api_url_for(path)\n\t\treturn ('https://api.spotify.com' << path)\n\tend",
"def normalize_friendly_id(input)\n input.to_s.to_url\n end",
"def normalize_friendly_id(input)\n input.to_s.to_url\n end",
"def normalize_friendly_id(input)\n input.to_s.to_url\n end",
"def normalize_friendly_id(input)\n input.to_s.to_url\n end",
"def create_url\n #we trim away all periods and break apart the name by spaces to use to acquire the url of the poet in the Poetry Foundation website\n name_no_periods = @name.tr(\".\", \"\")\n name_no_periods = name_no_periods.split(\" \")\n\n #we use name_no_periods to generate the url for the poet (example url: \"https://www.poetryfoundation.org/poets/ben-jonson\")\n url = \"https://www.poetryfoundation.org/poets/\"\n name_no_periods.each { |part| url = \"#{url}#{part}-\"}\n\n #this leaves an extra hyphen at the end, but we can just cut that off in the return.\n url = url.chop\n end",
"def url(path)\n \"#{self.api_root}/#{self.api_version}/#{self.tenancy_code}/#{path}\"\n end",
"def id\n \n id = path_info.split(\"/\")[1]\n\n # Fix for /path/id.with.dot like /person/full.name - where format is \"json\" (derived from either Accept or Content-Type)\n if [\"html\", \"json\", \"xml\"].include? format\n if not id.nil? # for POST id is null\n id = id.gsub(/\\.(html|json|xml)$/, \"\")\n end\n \n else\n \n # Otherwise, remove trailing .json or .xml\n if id =~ /[.]/\n id = id.split(\".\")\n id.pop\n id = id.join(\".\")\n end\n \n end\n \n if id == [] or id.nil?\n id == \"\"\n end\n \n id\n \n end",
"def goodreads_id\n @url.match(/\\/(\\d+)\\./)[1] rescue nil\n end",
"def uri_normalizer; end",
"def normalize_url(value)\n svalue = value.to_s\n pref = @req.api_prefix\n suffix = @req.api_suffix\n svalue.match(pref) ? svalue : \"#{pref}/#{svalue}#{suffix}\"\n end"
] | [
"0.6007966",
"0.5977593",
"0.5583188",
"0.54437757",
"0.527635",
"0.5251688",
"0.5192246",
"0.5156103",
"0.51297456",
"0.51263756",
"0.5124937",
"0.51007396",
"0.5092284",
"0.5092284",
"0.50903",
"0.50868124",
"0.5076263",
"0.5073722",
"0.5073722",
"0.50692886",
"0.5060033",
"0.50580066",
"0.504187",
"0.5041767",
"0.5041767",
"0.50296175",
"0.5023207",
"0.50106096",
"0.5008909",
"0.50052744",
"0.500491",
"0.5004872",
"0.49884945",
"0.49867326",
"0.498545",
"0.4979109",
"0.49773273",
"0.49672285",
"0.49650988",
"0.49600807",
"0.495543",
"0.49436507",
"0.4926844",
"0.49240732",
"0.49231064",
"0.49156168",
"0.4908717",
"0.49033475",
"0.49029353",
"0.49022943",
"0.4900158",
"0.48986632",
"0.48944193",
"0.48941624",
"0.4892137",
"0.48858872",
"0.48847237",
"0.4883761",
"0.48828664",
"0.4871264",
"0.48693812",
"0.4868502",
"0.4863607",
"0.48626107",
"0.48620182",
"0.48609027",
"0.48393294",
"0.48392022",
"0.48203376",
"0.4819263",
"0.48168358",
"0.48142028",
"0.48142028",
"0.48085728",
"0.48076165",
"0.4804879",
"0.48010856",
"0.47983313",
"0.47894585",
"0.47864613",
"0.47862136",
"0.4784367",
"0.47831222",
"0.47827163",
"0.47817793",
"0.47807357",
"0.47807357",
"0.4772821",
"0.47704336",
"0.4770022",
"0.47671443",
"0.47651395",
"0.47651395",
"0.47651395",
"0.47651395",
"0.4761248",
"0.4738787",
"0.4737118",
"0.47350806",
"0.47344026",
"0.4730518"
] | 0.0 | -1 |
Fix unknown redirect uri bug by NOT appending the query string to the callback url. | def callback_url
full_host + script_name + callback_path
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sanitize_redirect_url\n referer = params[:referer].blank? ? request.referer : params[:referer]\n\n if referer && (referer =~ %r|^https?://#{request.host}#{root_path}| ||\n referer =~ %r|^https?://#{request.host}:#{request.port}#{root_path}|)\n #self-referencing absolute url, make it relative\n referer.sub!(%r|^https?://#{request.host}(:#{request.port})?|, '')\n elsif referer && referer =~ %r|^(\\w+:)?//|\n Rails.logger.debug(\"#post_auth_redirect_url will NOT use third party url for post login redirect: #{referer}\")\n referer = nil\n end\n\n if referer && referer_blacklist.any? {|blacklisted| referer.starts_with?(blacklisted) }\n Rails.logger.debug(\"#post_auth_redirect_url will NOT use a blacklisted url for post login redirect: #{referer}\")\n referer = nil\n elsif referer && referer[0,1] != '/'\n Rails.logger.debug(\"#post_auth_redirect_url will NOT use partial path for post login redirect: #{referer}\")\n referer = nil\n end\n\n return referer || root_path\n end",
"def redirect_uri_for base_url\n return @callback_uri if uri_is_postmessage?(@callback_uri) || !URI(@callback_uri).scheme.nil?\n raise format(MISSING_ABSOLUTE_URL_ERROR, @callback_uri) if base_url.nil? || URI(base_url).scheme.nil?\n URI.join(base_url, @callback_uri).to_s\n end",
"def safari_fix\n\t\tif (params.has_key?(:redirect))\n\t\t\turl = params[:redirect]\n\t\t\turl += (url.include?('?'))?'&':'?'\n\t\t\turl += 'safari_fix=true'\n\t\telse\n\t\t\turl = :root\n\t\tend\n\t\t\n\t\tredirect_to url and return\n\tend",
"def redirect_uri= new_redirect_uri\n new_redirect_uri = Addressable::URI.parse new_redirect_uri\n # TODO: - Better solution to allow google postmessage flow. For now, make an exception to the spec.\n unless new_redirect_uri.nil? || new_redirect_uri.absolute? || uri_is_postmessage?(new_redirect_uri) ||\n uri_is_oob?(new_redirect_uri)\n raise ArgumentError, \"Redirect URI must be an absolute URI.\"\n end\n @redirect_uri = new_redirect_uri\n end",
"def hashify_query_string\n if request.query_string && request.query_string.length > 0\n redirect_to request.url.gsub('?', '#')\n return true\n end\n return false\n end",
"def redirect_url\n\t\tcallback_url\n\tend",
"def redirect_original(request, state_params, site)\n response = Rack::Response.new\n # Note that app_callback_url is added by OmniAuth.config.before_request_phase\n # any value provided by a client will be overwritten in that method so that we\n # don't use/trust values sent by the client\n return_url = state_params[\"app_callback_url\"]\n query = query_string(request, SecureRandom.hex(64))\n return_url << \"?\"\n return_url << signed_query_string(query, site.secret)\n response.redirect return_url\n response.finish\n end",
"def redirect_uri\n @redirect_uri ||= root_url[0..-2] + oauth_callback_path\n end",
"def redirected(uri)\n @uris << uri.to_s\n update_code(:redirected, %i(unknown redirected))\n end",
"def redirect_to_url(callback_url)\n client_details = \"client_id=#{self.client_id}\"\n return callback_url + \"?#{client_details}\"\n end",
"def follow_redirect?; end",
"def redirect_original(request, state_params, site)\n response = Rack::Response.new\n # Note that app_callback_url is added by OmniAuth.config.before_request_phase\n # any value provided by a client will be overwritten in that method so that we\n # don't use/trust values sent by the client\n return_url = state_params[\"app_callback_url\"]\n query = OauthStateMiddleware.query_string(request.params, SecureRandom.hex(64))\n return_url << \"?\"\n return_url << signed_query_string(query, site.secret)\n response.redirect return_url\n response.finish\n end",
"def merge_default_redirect_params(redirect_route, extra_params={})\n merged_redirect_url = redirect_route.dup\n extra_params.each do |key, value|\n if value.present?\n if redirect_route.include?('?')\n merged_redirect_url += \"&#{key}=#{value}\"\n else\n merged_redirect_url += \"?#{key}=#{value}\"\n end\n end\n end\n merged_redirect_url\n end",
"def merge_default_redirect_params(redirect_route, extra_params={})\n merged_redirect_url = redirect_route.dup\n extra_params.each do |key, value|\n if value.present?\n if redirect_route.include?('?')\n merged_redirect_url += \"&#{key}=#{value}\"\n else\n merged_redirect_url += \"?#{key}=#{value}\"\n end\n end\n end\n merged_redirect_url\n end",
"def actual_uri\n redirects_to or uri\n end",
"def expand_redirect_url(redirect_url, base_url)\n uri = URI.parse(redirect_url)\n uri = URI.parse(base_url) + redirect_url if uri.relative?\n uri\n end",
"def redirect_after_unsuccessful_authentication\n params_hsh = {}\n params_hsh[:client_app] = params[:client_app] if params[:client_app]\n params_hsh[:redirect_back_url] = params[:redirect_back_url] if params[:redirect_back_url]\n redirect_to add_query_params(default_sign_in_url, params_hsh)\n return\n end",
"def oauth_redirect_uri\n uri = URI.parse(request.url)\n uri.path = '/sk_auth/callback'\n uri.query = nil\n uri.to_s\n end",
"def callback_url\n options[:redirect_uri] || (full_host + script_name + callback_path)\n end",
"def callback_url\n options[:redirect_uri] || (full_host + script_name + callback_path)\n end",
"def redirect_uri\n host = headers['Host']\n uri = \"#{path}/\"\n uri = \"#{uri}?#{query}\" unless (query || '').empty?\n uri = \"http://#{host}#{uri}\" if host\n uri\n end",
"def do_post_redirect(post_redirect)\n uri = post_redirect.uri\n\n session[:post_redirect_token] = post_redirect.token\n\n # XXX what is the built in Ruby URI munging function that can do this\n # choice of & vs. ? more elegantly than this dumb if statement?\n if uri.include?(\"?\")\n if uri.include?(\"#\")\n uri.sub!(\"#\", \"&post_redirect=1#\")\n else\n uri += \"&post_redirect=1\"\n end\n else\n if uri.include?(\"#\")\n uri.sub!(\"#\", \"?post_redirect=1#\")\n else\n uri += \"?post_redirect=1\"\n end\n end\n redirect_to uri\n end",
"def clean_destination_url\n if !self.url.blank? and self.url !~ REGEX_LINK_HAS_PROTOCOL\n self.url.insert(0, URL_PROTOCOL_HTTP)\n end\n end",
"def set_RedirectURI(value)\n set_input(\"RedirectURI\", value)\n end",
"def set_RedirectURI(value)\n set_input(\"RedirectURI\", value)\n end",
"def set_redirect\n @redirect = params[:origin_url] == nil ? bookmarks_path : params[:origin_url]\n end",
"def fix_path(path)\n if path.count('?') > 1\n return path.gsub('?', '&').sub('&', '?')\n else\n return path\n end\n end",
"def openid_redirect_uri=(_arg0); end",
"def redirect?; end",
"def redirect_url; end",
"def valid_redirect_uri?(redirect_uri)\n true\n end",
"def follow_redirect!(**args); end",
"def filter_redirect; end",
"def filter_redirect; end",
"def fix_url\n\t if self.url and not self.url.match(/^(http|https):\\/\\/.*/)\n\t self.url = 'http://' + self.url\n end\n\tend",
"def post_auth_redirect_url\n referer = params[:referer] || request.referer\n \n if referer && (referer =~ %r|^https?://#{request.host}#{root_path}| ||\n referer =~ %r|^https?://#{request.host}:#{request.port}#{root_path}|)\n #self-referencing absolute url, make it relative\n referer.sub!(%r|^https?://#{request.host}(:#{request.port})?|, '')\n elsif referer && referer =~ %r|^(\\w+:)?//|\n Rails.logger.debug(\"#post_auth_redirect_url will NOT use third party url for post login redirect: #{referer}\")\n referer = nil\n end\n \n if referer && referer_blacklist.any? {|blacklisted| referer.starts_with?(blacklisted) }\n Rails.logger.debug(\"#post_auth_redirect_url will NOT use a blacklisted url for post login redirect: #{referer}\")\n referer = nil\n elsif referer && referer[0,1] != '/'\n Rails.logger.debug(\"#post_auth_redirect_url will NOT use partial path for post login redirect: #{referer}\")\n referer = nil\n end\n \n return referer || root_path \n end",
"def facebook_path_scrub(url)\n return url.gsub('facebook/', '').gsub('/facebook', '')\n end",
"def redirect(uri)\n [ 303, {'Content-Length'=>'0', 'Content-Type'=>'text/plain',\n 'Location' => uri},\n [] ]\n end",
"def escape_redirect(url)\n uri = URI.parse(url)\n \"\".html_safe + uri.path + '?' + uri.query.html_safe\n end",
"def redirect(uri, verb = T.unsafe(nil)); end",
"def follow_redirections\n self.url = RequestHelper.add_scheme(RequestHelper.decode_uri(self.url.strip))\n attempts = 0\n code = '301'\n path = []\n\n while attempts < 5 && RequestHelper::REDIRECT_HTTP_CODES.include?(code) && !path.include?(self.url)\n attempts += 1\n path << self.url\n response = self.request_media_url(self.url)\n code = response.code\n\n if RequestHelper::REDIRECT_HTTP_CODES.include?(code)\n redirect_url = self.url_from_location(response, path)\n self.url = redirect_url if redirect_url\n end\n end\n end",
"def clean_url\n return # Not yet implemented\n end",
"def redirect_unsupported_format_requests\n unless request.format.nil? || mimes_for_respond_to.keys.include?(request.format.to_sym)\n param_str = create_query_string(request.query_parameters)\n\n redirect_to(\"#{request.path}.json#{param_str}\", status: 303)\n end\n end",
"def callback_url\n if @authorization_code_from_signed_request_in_cookie\n ''\n else\n # Fixes regression in omniauth-oauth2 v1.4.0 by https://github.com/intridea/omniauth-oauth2/commit/85fdbe117c2a4400d001a6368cc359d88f40abc7\n options[:callback_url] || (full_host + script_name + callback_path)\n end\n end",
"def clean_destination_url\n if !self.url.blank? and self.url !~ REGEX_LINK_HAS_PROTOCOL\n self.url.insert(0, URL_PROTOCOL_HTTP)\n end\n end",
"def tracking_callback\n return if AhoyEmail.tracking_callback_url.blank?\n return if callback_params[:atid].blank?\n\n begin\n uri = URI(\"#{AhoyEmail.tracking_callback_url}/#{callback_params[:atid]}/#{callback_params[:utm_action]}\")\n dupe_callback_params = callback_params.to_h\n dupe_callback_params[:redirect] = false\n dupe_callback_params[:url] = \"#{request.scheme}://#{request.host.include?(\"www.\") ? request.host : \"www.#{request.host}\"}#{request.path}\"\n uri.query = URI.encode_www_form(dupe_callback_params)\n Net::HTTP.get_response(uri)\n rescue StandardError => e\n Honeybadger.notify(e)\n end\n end",
"def full_url\n mini_url = MiniUrl.find_by(url_code: params[:url_code])\n # raise not found exception for url code not present in db\n unless mini_url\n raise Exceptions::EmptyObjectError.new('Unable to find url for redirection.')\n end\n render location: mini_url.url, status: 307\n # increase redirect count and update after responding with actual url\n mini_url.redirect_count += 1\n unless mini_url.update\n logger.error \"Some error in updating redirect count for mini url - #{mini_url.url_code}\"\n end\n rescue Exceptions::EmptyObjectError => e\n render json: {error: e}, status: 404\n end",
"def clean_url!\n remove_urchin\n case uri.host\n when 'www.youtube.com'\n self.url = \"#{uri.scheme}://#{uri.host}/watch?v=#{self.params['v'][0]}\"\n when 'boingboing.net'\n self.url = \"#{uri.scheme}://#{uri.host}#{uri.path}\"\n end\n end",
"def cleanup_parameters\n original_count = params.keys.size\n\n # Eliminate \"noise\" parameters.\n params.delete_if { |k, v| k.blank? || v.blank? }\n %w[utf8 commit].each { |k| params.delete(k) }\n\n # If parameters were removed, redirect to the corrected URL.\n will_redirect unless params.keys.size == original_count\n end",
"def fix_urls\n return unless self.url\n self.url.gsub!(/^(.*)/, 'http://\\1') unless self.url =~ %r{^http://} or self.url.empty?\n end",
"def redir_missing_locale\n explicit_locale = params[:locale]\n return if explicit_locale.present?\n\n # Don't bother redirecting some formats\n return if DO_NOT_REDIRECT_LOCALE.include?(params[:format])\n\n #\n # No locale, determine the best locale and redirect.\n #\n best_locale = find_best_locale\n preferred_url = force_locale_url(request.original_url, best_locale)\n # It's not clear what status code to provide on a locale-based redirect.\n # However, we must avoid 301 (Moved Permanently), because it is certainly\n # not a permanent move.\n # We previously used use 300 (Multiple Choices),\n # because that code indicates there's a redirect based on agent choices\n # (which is certainly true), by doing this:\n # redirect_to preferred_url, status: :multiple_choices # 300\n # It worked on staging, but causes problems in production when trying\n # to redirect the root path, so as emergency we're\n # switching to \"found\" (302) which is supported by everyone.\n redirect_to preferred_url, status: :found\n end",
"def filter_redirect=(_arg0); end",
"def filter_redirect=(_arg0); end",
"def redirect_ok=(follow); end",
"def fixup_args ()\n\n print \"Using Ruby version: #{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}\\n\"\n\n if $my_base_url[-4..-1] != \"/slm\" && $my_base_url[-5..-1] != \"/slm/\"\n print \"Fixup: Modifing URL from <#{$my_base_url}>\"\n if $my_base_url[-1..-1] == \"/\"\n $my_base_url.concat(\"slm\")\n else\n $my_base_url.concat(\"/slm\")\n end\n print \" to <#{$my_base_url}>\\n\"\n end\nend",
"def fix_oneoff url\n begin\n uri = URI.parse url\n return (\"\" == uri.path) ? url + '/' : url\n rescue\n #puts \"Ran into issue processing #{url}\"\n end\n end",
"def update_permanent_uri(options={})\n for uri, response in @redirects\n break if response.status != \"301\"\n self.resource.permanent_uri =\n Addressable::URI.parse(response.headers[\"Location\"])\n end\n end",
"def fix_url\n self.url = UrlNormalizer.normalize_entry_url self.url, self\n end",
"def fixup_url\n unless @view.app.url.starts_with?('http')\n unless @view.app.url.starts_with?('www')\n @view.app.url = 'www.' << @view.app.url\n end\n @view.app.url = 'http://' << @view.app.url\n end\n @view.app.url\n end",
"def redirect\n if !params[:redirect].blank? && redirection = Redirect.find_by_redirect_url(params[:redirect])\n query_string = URI.parse(request.url).query rescue nil\n redirect = query_string.blank? ? redirection.url : \"#{redirection.url}?#{query_string}\"\n redirect_to redirect\n elsif params[:redirect].blank?\n Rails.logger.warn \"Redirect with no parameter requested.\"\n head :status => 404\n else\n Rails.logger.warn \"Unknown redirection requested: #{params[:redirect]}\"\n head :status => 404\n end\n end",
"def too_many_redirects\n update_code(:too_many_redirects, %i(unknown redirected))\n end",
"def redirect(url); end",
"def get_response_with_redirect(uri)\n r = Net::HTTP.get_response(uri)\n if r.code == \"301\"\n r = Net::HTTP.get_response(URI.parse(r.header['location']))\n end\n r\nend",
"def follow_redirections\n self.url = self.add_scheme(decoded_uri(self.url.strip))\n attempts = 0\n code = '301'\n path = []\n\n while attempts < 5 && %w(301 302).include?(code) && !path.include?(self.url)\n attempts += 1\n path << self.url\n response = self.request_media_url\n code = response.code\n self.set_url_from_location(response, path)\n end\n end",
"def call new_env\n old = new_env['REQUEST_URI']\n new = new_env['REQUEST_URI'].gsub(DOTS_AND_SLASHES, '/'.freeze).gsub(DOTS, '.'.freeze)\n if new != old \n DA99.redirect new, 301\n else\n @app.call new_env\n end\n end",
"def clean_query_string(q)\n ERB::Util.url_encode(q.gsub(/-|\\(|\\)|:/, \"\"))\n end",
"def safe_redirect(url)\n url ||= '/explore'\n url = url_for(url) if url.is_a?(Hash)\n return url if RAILS_ENV == 'development' || RAILS_ENV == 'test'\n # Remember that kroogi.eu (and many more) is/are just as valid as kroogi.com. AND, we have krugi.net ...\n return url if url && (url.starts_with?('/') || kroogi_url?(url))\n return url\n #raise Kroogi::NotPermitted, url\n end",
"def skipped_test_raises_error_on_invalid_redirect_location\n assert_raise(ArgumentError) {\n http.get \"/redirect-to?url=foo\"\n }\n end",
"def fix_protocol\n use_https = is_logged_in || [\"login\", \"login_action\"].include?(action_name)\n\n if Rails.env.production?\n if use_https && request.protocol != \"https://\"\n return redirect_to \"https://#{request.url[(request.protocol.size)..(-1)]}\"\n end\n\n if !use_https && request.protocol != APP_PROTOCOL\n return redirect_to \"#{APP_PROTOCOL}#{request.url[(request.protocol.size)..(-1)]}\"\n end\n end\n end",
"def final_url\n call_once\n @headers[\"location\"] || @request.getURI.to_string\n end",
"def redirect_uri\n @payload.present? ? @payload['redirect'] : @redirect_uri\n end",
"def alter_url(url)\n facebook_link = Domainatrix.parse(url)\n if !facebook_link.nil? and facebook_link.path != \"\" and facebook_link.path.size != 1\n if facebook_link.path.include?(\"pages\")\n facebook_link.path.split(\"/\").each do |f| \n # Detect a facebook id numbder \n if f.to_i > 0 \n url = \"http://graph.facebook.com/\" + f.to_s\n end\n end\n else\n url = \"http://graph.facebook.com#{facebook_link.path}\"\n end\n else \n url = nil\n end \n url\n end",
"def bad_url_redirect\n flash[:error] = 'That URL does not exist.'\n redirect_to root_url\n end",
"def redirect\n\t\tlogger.error \"CUSTOM_ERROR: Attempt to connect with bad url extension: #{params[:from]}\"\n\t\tredirect_to root_url\n end",
"def redirect(location, status = '302'); request.redirect(location, status); end",
"def chase_redirect(url)\n u = URI.parse(url)\n (0..9).each do\n opts = { use_ssl: u.scheme == 'https',\n ca_file: Chef::Config[:ssl_ca_file] }\n resp = Net::HTTP.start(u.host, u.port, opts) { |h| h.head(u.to_s) }\n return u.to_s unless resp.is_a?(Net::HTTPRedirection)\n u = URI.parse(resp['location'])\n end\n nil\n end",
"def redirect where, opts={}\n where = current.request.env['HTTP_REFERER'].or('/') if where == :back\n where = \"#{current.request.path}#{where}\" if where[0,1] == '?'\n where = current.host + where unless where.include?('://')\n\n # local redirect\n if where.include?(current.host)\n redirect_var = Lux.config.redirect_var || :_r\n\n url = Url.new where\n url[redirect_var] = current.request.params[redirect_var].to_i + 1\n\n where =\n if opts.delete(:silent)\n url.delete redirect_var\n url.to_s\n else\n url[redirect_var] > 3 ? '/' : url.to_s\n end\n end\n\n @status = opts.delete(:status) || 302\n opts.map { |k,v| flash.send(k, v) }\n\n @body = %[redirecting to #{where}\\n\\n#{opts.values.join(\"\\n\")}]\n\n @headers['location'] = where\n @headers['access-control-expose-headers'] ||= 'Location'\n\n throw :done\n end",
"def redirect(*args)\n # If this is an ajax and/or rpc request skip the redirect.\n # Allows to write more reusable code.\n\n return if request.script?\n \n if args.last.is_a? Hash\n status = args.last.fetch(:status, 303)\n else\n status = 303\n end\n\n uri = encode_uri(*args)\n\n # gmosx, THINK: this may be unnecessary!\n\n unless uri =~ /^http/\n uri = \"#{@context.host_uri}/#{uri.gsub(/^\\//, '')}\"\n end\n\n @context.status = status\n @out = \"<html><a href=\\\"#{uri}\\\">#{uri}</a>.</html>\\n\"\n @context.response_headers['location'] = uri\n\n raise RenderExit\n end",
"def redirect_to_back fallback = root_url\n if !request.env[\"HTTP_REFERER\"].blank? and request.env[\"HTTP_REFERER\"] != request.env[\"REQUEST_URI\"]\n redirect_to :back\n else\n redirect_to fallback\n end\n end",
"def callback\n @callback ||= ERB::Util.url_encode(\"#{request.url}&callback\")\n end",
"def path_after_locale_change(locale:, redirect_uri:)\n \"/#{locale}/#{redirect_uri}\"\n end",
"def rc_facebook_normalized_request_uri\n uri = if rc_facebook_in_canvas?\n # rails 3 uses newer rack which has fullpath\n \"http://apps.facebook.com/#{rc_facebook_oget(:canvas)}\" +\n (request.respond_to?(:fullpath) ?\n request.fullpath : request.request_uri)\n else\n request.url\n end\n\n rc_facebook_filter_uri(uri)\n end",
"def redirect_location\n http_redirect? ? @get_resp.header['location'] : nil\n end",
"def redirect_location\n http_redirect? ? @get_resp.header['location'] : nil\n end",
"def build_url(redirect_uri,type)\n path = redirect_uri.split('#',2).first if redirect_uri.include? \"#\"\n path = redirect_uri.split('?',2).first if redirect_uri.include? \"?\"\n case type\n when \"token\"\n return path + \"?access_token=#{self.access_token}\"\n when \"code\"\n return path + \"?request_token=#{self.code}\"\n end\n end",
"def redirect_ok=(_arg0); end",
"def search_redirect\n # URI::encode handles spaces and other characters in search field\n redirect_to \"/blog/search/#{URI::encode params[:query]}\"\n end",
"def do_fallback action\n do_redirect fallback_path\n end",
"def on_request_uri(cli, req)\r\n\t\tsend_response(cli, %Q{window.location.replace('#{datastore['Website']}');})\r\n\tend",
"def redirect_uri=(redirect_uri)\n if !redirect_uri.nil? && redirect_uri.to_s.length > 256\n fail ArgumentError, 'invalid value for \"redirect_uri\", the character length must be smaller than or equal to 256.'\n end\n\n if !redirect_uri.nil? && redirect_uri.to_s.length < 1\n fail ArgumentError, 'invalid value for \"redirect_uri\", the character length must be great than or equal to 1.'\n end\n\n @redirect_uri = redirect_uri\n end",
"def check_external_site_request\n unless params.empty?\n external_url_keys = params.keys & Conf.external_site_integrations.keys.collect {|s| s + \"_url\"}\n\n if external_url_keys.size == 1\n external_url_key = external_url_keys.first\n external_url = CGI.unescape(params[external_url_key])\n\n if %w(http https).include?(URI.parse(external_url).scheme)\n session[:came_from] = external_url_key[0..-5] # Strip the _url part\n session[:return_url] = external_url\n else\n raise(\"Invalid return URL given for #{external_url_key}: \\n\\t#{external_url}\")\n end\n elsif external_url_keys.size > 1\n raise(\"#{external_url_keys.size} external URLs specified. Can only cope with one!\")\n end\n end\n end",
"def redirect_ok; end",
"def redirect_ok; end",
"def max_redirects; end",
"def modify_uri\n uri = @request.uri\n @conf.aliases.each do |a|\n if uri.include? a\n uri = uri.sub(a, @conf.alias_path(a))\n end\n end\n if uri != @request.uri\n return uri\n end\n @conf.script_aliases.each do |a|\n if uri.include? a\n uri = uri.sub(a, @conf.script_alias_path(a))\n end\n end\n uri\n end",
"def signed_open_id_connect_initiation_url(login_hint:)\n URI(open_id_connect_initiation_url).tap do |uri|\n uri.query = {\n iss: Rails.application.secrets.issuer,\n login_hint: login_hint,\n target_link_uri: target_link_uri\n # lti_message_hint: 'xxx'\n }.to_query\n end\n end",
"def redirects; end",
"def redirect(auth)\n return auth.redirect_uri.split('#',2).first\n end",
"def redirection_to\n URI(\"#{ENV['DOMAIN_URL']}/deposits/?#{query_params}\").to_s\n end",
"def failure\n origin_locale = get_origin_locale(request, available_locales())\n I18n.locale = origin_locale if origin_locale\n error_message = params[:error_reason] || \"login error\"\n kind = request.env[\"omniauth.error.strategy\"].name.to_s || \"Facebook\"\n flash[:error] = t(\"devise.omniauth_callbacks.failure\",:kind => kind.humanize, :reason => error_message.humanize)\n redirect_to search_path\n end",
"def query_string=(nqs)\n @query_string_with_qmark = nqs.gsub(/^([^\\?])/, '?\\1')\n @headers[\"REQUEST_URI\"] = @headers[\"REQUEST_URI\"].split(/\\?/).shift + @query_string_with_qmark\n if nqs.blank?\n @headers.delete \"QUERY_STRING\"\n else\n @headers[\"QUERY_STRING\"] = nqs.gsub(/^\\?/, '')\n end\n end"
] | [
"0.6365701",
"0.63536686",
"0.61407256",
"0.6077731",
"0.6034369",
"0.6021571",
"0.58974534",
"0.588566",
"0.5851072",
"0.5834352",
"0.5813037",
"0.5809574",
"0.5778022",
"0.5778022",
"0.57420623",
"0.5735997",
"0.57337517",
"0.57075775",
"0.5703975",
"0.5703975",
"0.5674207",
"0.56524247",
"0.56300974",
"0.56294024",
"0.56294024",
"0.56273293",
"0.5619046",
"0.5601446",
"0.55802727",
"0.5570664",
"0.5564681",
"0.5558939",
"0.55556715",
"0.55556715",
"0.55512214",
"0.5549434",
"0.55453354",
"0.5541385",
"0.5519448",
"0.55189997",
"0.5492577",
"0.5482214",
"0.5469829",
"0.5469597",
"0.5469247",
"0.5460633",
"0.5456565",
"0.5443777",
"0.5439321",
"0.5434432",
"0.54323906",
"0.5419763",
"0.5419763",
"0.54197526",
"0.541461",
"0.54138094",
"0.54057014",
"0.5401285",
"0.537956",
"0.53693897",
"0.53596646",
"0.53558993",
"0.5354645",
"0.5346275",
"0.53318185",
"0.5327719",
"0.53160053",
"0.5313669",
"0.53132176",
"0.53092474",
"0.5304985",
"0.53037506",
"0.5300098",
"0.52827525",
"0.52770793",
"0.52752787",
"0.5274022",
"0.52691215",
"0.5263865",
"0.5259522",
"0.5255689",
"0.5252244",
"0.5244767",
"0.5244767",
"0.5243616",
"0.5242607",
"0.5242138",
"0.5222425",
"0.522107",
"0.52146894",
"0.521006",
"0.520865",
"0.520865",
"0.5200573",
"0.5192279",
"0.51744324",
"0.5168292",
"0.51643974",
"0.51621795",
"0.5161253",
"0.5155335"
] | 0.0 | -1 |
Get the result of the $findAndModify. | def result
query.modify(update, options)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def execute\n return performModify(true)\n end",
"def returnModified\n @modified\n end",
"def find(id)\n item = raw_find(id)\n item && item.dup\n end",
"def find(id)\n find_result\n end",
"def find_one(&block)\r\n copy_and_return(@records.find(&block))\r\n end",
"def save\n doc['_id'] ||= BSON::ObjectId.new\n\n self.class.collection.find_one_and_update(doc.slice('_id'), doc, { :upsert => true })\n\n doc\n end",
"def execute(input_set = nil)\n resp = super(input_set)\n results = UpdateDocumentResultSet.new(resp)\n return results\n end",
"def find\n\t\tif defined?(@collection)\n\t\t\treturn @collection.find\n \tend\n\tend",
"def GetModified\n @modified\n end",
"def GetModified\n @modified\n end",
"def GetModified\n @modified\n end",
"def GetModified\n @modified\n end",
"def GetModified\n @modified\n end",
"def find(id)\n @document\n end",
"def find(id)\n @document\n end",
"def find_one(criteria, options = {})\n criteria = normalize_criteria criteria\n hash = self.collection.find_one(criteria, options)\n self.normalize(hash) if hash\n end",
"def get\n res = orchio_get\n (res.success?) ? res.result.update_rails(self) : false\n end",
"def update(params)\n @number = params[:number].to_i\n @first_name = params[:first_name]\n @last_name = params[:last_name]\n @gender = params[:gender]\n @group = params[:group]\n @secs = params[:secs].to_i\n\n params.slice!(:number, :first_name, :last_name, :gender, :group, :secs)\n # self.class.collection.find(:_id => @id).update_one(params) #THIS SHOULD WORK FIND() NEEDS IMPROVEMENT\n # self.class.collection.find(:_id => BSON::ObjectId.from_string(@id)).replace_one(params)\n self.class.collection.find(:_id => BSON::ObjectId.from_string(@id)).update_one(params)\n end",
"def execute(input_set = nil)\n resp = super(input_set)\n results = UpdateCollectionResultSet.new(resp)\n return results\n end",
"def find!\n @total_found = 0\n @results = nil\n return results\n end",
"def existing\n return self.class.find_by_unique_id(unique_id)\n end",
"def _find_or_update_or_build_collection!\n return _flexi_collection if _flexi_collection.present?\n\n # Find existing collection\n self._flexi_collection = COLLECTION.where(\n namespace: self.class.get_flexi_namespace,\n name: self.class.flexi_collection_name,\n partition_id: self.class.flexi_partition_id\n ).first\n\n # Update if schema changed\n if self._flexi_collection\n _update_schema\n else\n _build_collection\n end\n\n self._flexi_collection\n end",
"def save\n doc = collection.find_one()\n collection.update({\"_id\" => doc[\"_id\"]}, {'boom' => to_json})\n end",
"def find id\n model.find id\n end",
"def find_for_update(resource_id:)\n search.find_by(id: resource_id)\n end",
"def find\n\t\tif !defined?(@collection)\n\t\t\treturn false\n\t\telse\n\t\t\treturn @collection.find\n\t\tend\n end",
"def find(id)\n finder_or_run(:find, id)\n end",
"def find(query)\n @coll.find(query).first\n end",
"def find( id )\n model.get( id ).extend( InstanceMethods )\n end",
"def execute\n klass.collection.find(selector, process_options) || []\n end",
"def refind!\n @product = Product.find(@product.id)\n end",
"def command\n document = BSON::Document.new\n (filter[:$query] || filter).each do |field, value|\n document.store(field.to_s, value)\n end\n document\n end",
"def save\n repository.put(self) if modified?\n id\n end",
"def find(id)\n repository.find(self, id)\n end",
"def find(criteria, options = {})\n criteria = normalize_criteria criteria\n self.collection.find(criteria, options).map do |hash|\n self.normalize hash\n end\n end",
"def find! id, options = {}\n\n find( id, options ) ||\n raise( MongoMapper::DocumentNotFound.new(\"#{self.to_s} with id #{id} not found\") )\n\n end",
"def find(id); end",
"def find(id); end",
"def reload\n @attributes = collection.find_one(:_id => id).with_indifferent_access\n end",
"def to_a\n deserialize(find)\n end",
"def find_and_update_attributes(id, attr)\n object = find(id)\n object.update_attributes( attr ) if object\n end",
"def update_find\n @user = User.new\n @users_array = User.select(\"id, email\")\n \n render \"update_find\"\n end",
"def update_without_callbacks\n self.class.collection.save(to_mongo_value)\n end",
"def find(id)\n repository.find(id).documents.first\n end",
"def finder_result\n @result ||= self.class.result_for(self.send(self.class.sharded_column))\n end",
"def dbvalidationmul(table_name)\nmongo_client = Mongo::Client.new($mongo_connect_string)\n@list=mongo_client[:\"#{table_name}\"].find.to_a\n# mongo collections have fields called \"_id\" which is not returned by api response\n# deleting the \"_id\" field from mongo response to map api response\[email protected] do |l|\nl.delete(\"_id\")\nend\nputs \"===========================================\"\nputs @list\nputs \"===========================================\"\nreturn @list\nend",
"def find_or_create(*args)\n result = find(*args)\n result.empty? ? create!(*args) : result.first\n end",
"def get_file_and_bump shortened\n @coll.find_one_and_update({ shortened: shortened },\n { \"$inc\" => { \"accessed.count\" => 1 },\n \"$set\" => { \"accessed.time\" => Time.now.utc } },\n return_document: :after )\n end",
"def persist\n prepare do\n current = document[field]\n return nil unless current\n document[field] = value.inject(current) do |result, (bit, val)|\n result = result & val if bit.to_s == \"and\"\n result = result | val if bit.to_s == \"or\"\n result\n end\n document[field].tap do\n collection.update(document.atomic_selector, operation(\"$bit\"), options)\n document.remove_change(field)\n end\n end\n end",
"def to_bson\n #----------\n self\n end",
"def to_bson\n #----------\n self\n end",
"def to_bson\n #----------\n self\n end",
"def getPythonLastChange()\r\n return MongoDBConnector.instance.getPythonLastChange(@name)\r\n end",
"def find(query={}, opts={})\n Mongomatic::Cursor.new(self, collection.find(query, opts))\n end",
"def find(id)\n @collection[id.to_s]\n end",
"def find_last_updated_mir\n @team.meeting_individual_results.exists? ? @team.meeting_individual_results.sort_by_updated_at('DESC').first.updated_at : 0\n end",
"def mongoize\n self\n end",
"def find(id)\n @candidates.each do |item|\n if item[:id]==id\n @result = item\n end\n end\n @result\nend",
"def find(id)\n\nend",
"def find(id)\n @@conn.exec_params(\"SELECT * FROM contacts WHERE id=$1;\", [id]) do |results|\n return create_from_row(results[0])\n end \n end",
"def find(id)\n id = id.to_s\n return nil unless index[id]\n return cache[id] if cache? && cache.key?(id)\n p = index[id][:partition]\n v = S3Object.value(File.join(basedir, p), bucket_name)\n data = v[index[id][:offset]..(index[id][:offset] + index[id][:length])]\n #puts \"Data: #{data}\"\n document = Marshal.load(data)\n cache[id] = document if cache?\n document\n end",
"def find(id)\n @objects[id]\n end",
"def find(id)\r\n find_one do |record|\r\n record.id == id\r\n end\r\n end",
"def merge_mongo_and_solr(collection, resp)\n\t\t\tsolr_objects = resp['response']['docs']\n\t\t\tmkey,skey = @mongo_match_by.split(\"::\")\n collection.each_with_index do |document,index|\n\t\t\t\tmid = document.fetch(\"#{mkey}\")\n sdoc = solr_objects.find {|sd| sd[\"#{skey}\"] == \"#{mid}\"}\n for pkey in @mongo_projection_keys.split(\",\")\n if document.has_key?(\"#{pkey}\")\n sdoc[\"#{pkey}\"] = document.fetch(\"#{pkey}\")\n end\n end\n end\n\t\t\tresp['response']['docs'] = solr_objects\n\t\t\treturn resp\n\t\tend",
"def find(id)\n first(\"Id = '#{id}'\")\n end",
"def find\n raise \"Method not implemented\"\n end",
"def execute(input_set = nil)\n resp = super(input_set)\n results = FindResultSet.new(resp)\n return results\n end",
"def find\n super.first\n end",
"def find(id)\n end",
"def update\n @return.update\n end",
"def execute(input_set = nil)\n resp = super(input_set)\n results = UpdateEntryResultSet.new(resp)\n return results\n end",
"def execute(input_set = nil)\n resp = super(input_set)\n results = UpdateEntryResultSet.new(resp)\n return results\n end",
"def execute(input_set = nil)\n resp = super(input_set)\n results = UpdateEntryResultSet.new(resp)\n return results\n end",
"def execute(input_set = nil)\n resp = super(input_set)\n results = UpdateEntryResultSet.new(resp)\n return results\n end",
"def execute(input_set = nil)\n resp = super(input_set)\n results = UpdateEntryResultSet.new(resp)\n return results\n end",
"def find id\n @objs_list[id] if @objs_list\n end",
"def save\n temp = eval(self.class.name.to_s + \".find(\" + self.id.to_s + \")\") unless self.new_record? ## moze to zmienic, zeby nie odwolywac sie dodatkowo do bazy ? ;)\n \n ##DO ZMIANY PO ZAINSTALOWANIU BORTA \n self.edited_by = 33\n #self.edited_by = current_user.id\n self.user_stamp = @user_stamp\n \n wrk1 = self.changed? & !self.new_record?\n wrk2 = super\n\n archiving temp unless !(wrk1 & wrk2)\n \n wrk2\n end",
"def find_record\n if record\n self.new_session = false\n return record\n end\n \n find_with.each do |find_method|\n if send(\"valid_#{find_method}?\")\n self.new_session = false\n return record\n end\n end\n nil\n end",
"def merge_mongo_and_solr(collection, resp)\n solr_objects = resp['response']['docs']\n mkey,skey = @mongo_match_by.split(\"::\")\n collection.each_with_index do |document,index|\n mid = document.fetch(\"#{mkey}\")\n sdoc = solr_objects.find {|sd| sd[\"#{skey}\"] == \"#{mid}\"}\n if sdoc.nil?\n log.warn \"Solr document with #{skey}: #{mid} not found\"\n else\n for pkey in @mongo_projection_keys.split(\",\")\n if document.has_key?(\"#{pkey}\")\n sdoc[\"#{pkey}\"] = document.fetch(\"#{pkey}\")\n end\n end\n end\n end\n resp['response']['docs'] = solr_objects\n return resp\n end",
"def find_and_replace\n existing = ActsAsReplaceable::HelperMethods.find_existing(self)\n\n if existing.length > 1\n raise RecordNotUnique, \"#{existing.length} duplicate #{self.class.model_name.human.pluralize} present in database\"\n end\n\n replace_with(existing.first) if existing.first\n end",
"def find_and_update_atomically(id, attrs, opts = {})\n find_and_save_atomically(id, opts) {|r| r.assign_attributes attrs }\n end",
"def save!\n if @_id\n retval = collection.update({ '_id' => @_id}, @data.to_hash)\n else\n retval = collection.save(@data.to_hash)\n end\n\n !!retval\n end",
"def find(options = {})\n if(options.class == Integer)\n model = self.new(quickbook_gateway.get(\"#{entity.downcase}/#{options}\")[entity]) \n model.is_new_record = false\n return model\n end\n \n return self.find_all(options, 1)[0]\n end",
"def result\n @result ||= run_collection_command_or_block\n end",
"def modified_by_user(user_id, source_id, number_to_return = :all, starting_index = 0)\n # ids = PublicEarth::Db::Place.many.modified_by_user(user_id, source_id, number_to_return == :all && 250 || number_to_return, starting_index).map { |result| result['modified_by_user'] }\n ids = PublicEarth::Db::Place.many.modified_by_user(user_id, source_id).map { |result| result['modified_by_user'] }\n PublicEarth::Db::Place.find_from_search(*ids)\n end",
"def find; end",
"def test_save_update\r\n @found = TestLibrary.find( :first, :order => 'sloupec' )\r\n \r\n if @found == nil\r\n assert false, \"Vratilo se nil\"\r\n end\r\n \r\n @found.autor = \"Pepa\"\r\n \r\n if @found.save.is_a? Numeric\r\n assert true\r\n else \r\n assert false, @found.save\r\n end\r\n end",
"def find_locally(id)\n if @all.present?\n @all.find { |model| model.id == id }\n end\n end",
"def find_or_create_documents!\n @find_or_create_documents ||= save!\n end",
"def GetUserId(user)\r\n \r\n mongoSession = Moped::Session.new(['127.0.0.1:27017']) # our mongo database is local\r\n mongoSession.use(\"enhabit\") # this is our current database\r\n\r\n begin\r\n queryObj = Hash.new\r\n queryObj[\"Username\"] = user\r\n \r\n account = Array.new\r\n mongoSession.with(safe: true) do |session|\r\n account = session[:accounts].find(queryObj).to_a\r\n end\r\n \r\n if account.count == 0\r\n return nil\r\n else\r\n return account[0][\"UserId\"]\r\n end\r\n rescue Moped::Errors::OperationFailure => e\r\n return nil\r\n end\r\nend",
"def find_and_update_resource\n model = class_name.find(params[:id])\n model.tap do |m|\n m.update get_secure_params\n set_resource_ivar m\n end\n end",
"def queryAndConvert() \n\t\tres = self.query()\n\t\treturn res.convert()\n end",
"def update\n result_set = @current_items\n\n {:ResultSet =>\n {\n :Result => result_set\n },\n }.to_json\n end",
"def update(params)\n @number=params[:number].to_i\n @first_name=params[:first_name]\n @last_name=params[:last_name]\n @secs=params[:secs].to_i\n @gender=params[:gender]\n @group=params[:group]\n\n params.slice!(:number, :first_name, :last_name, :gender, :group, :secs)\n \n self.class.collection.find(:_id=>BSON::ObjectId.from_string(@id)).replace_one(params)\n end",
"def update_document(fields, safe = false)\n collection.update({\"_id\" => self.id}, fields, :safe => safe)\n reload\n end",
"def find(*args)\n records = super\n @after.call(records) if @after\n records\n end",
"def set_update\n @recepient = Recepient.find(params[:id]) \n end",
"def save\n if new?\n return create()\n else\n return update()\n end\n end",
"def find(*args)\n list = []\n if args.first == :all\n result = Rhom::RhomDbAdapter::select_from_table(Rhom::TABLE_NAME,\n '*',\n {\"source_id\"=>get_source_id,\"update_type\"=>'query'},\n {\"order by\"=>'object'})\n else\n obj = strip_braces(args.first.to_s)\n result = Rhom::RhomDbAdapter::select_from_table(Rhom::TABLE_NAME,\n '*',\n {\"object\"=>obj})\n end\n list = get_list(result)\n if list.length == 1\n return list[0]\n end\n list\n end",
"def mongo_value\n value\n end"
] | [
"0.5862556",
"0.55104643",
"0.54943925",
"0.5474354",
"0.5413498",
"0.53044766",
"0.5205306",
"0.5123025",
"0.51167256",
"0.51167256",
"0.51167256",
"0.51167256",
"0.51167256",
"0.50995266",
"0.50995266",
"0.5090242",
"0.5065189",
"0.50116605",
"0.49801886",
"0.49383828",
"0.49256763",
"0.4908184",
"0.4905239",
"0.4888568",
"0.48515546",
"0.48423362",
"0.48351985",
"0.48178697",
"0.48105666",
"0.48089847",
"0.4792847",
"0.47909567",
"0.47886738",
"0.4769349",
"0.47687548",
"0.47556156",
"0.47373053",
"0.47373053",
"0.4736958",
"0.4735738",
"0.47280106",
"0.47269914",
"0.47196403",
"0.4693319",
"0.4690454",
"0.4678472",
"0.46670642",
"0.4639131",
"0.46321142",
"0.46269625",
"0.46269625",
"0.46269625",
"0.46030453",
"0.45969248",
"0.45922253",
"0.45879412",
"0.45871475",
"0.45822704",
"0.45681557",
"0.4567912",
"0.45668733",
"0.45649585",
"0.4563954",
"0.45537877",
"0.45510325",
"0.4550403",
"0.454966",
"0.4543605",
"0.45317736",
"0.45313975",
"0.45295405",
"0.45295405",
"0.45295405",
"0.45295405",
"0.45295405",
"0.45290726",
"0.452252",
"0.4517562",
"0.45119828",
"0.45098853",
"0.4503516",
"0.44876614",
"0.4484722",
"0.4477976",
"0.44760355",
"0.44757387",
"0.44698632",
"0.4468364",
"0.44617242",
"0.44591466",
"0.44576156",
"0.44573948",
"0.4431942",
"0.44314635",
"0.4426294",
"0.44233087",
"0.4421257",
"0.44177437",
"0.44162944",
"0.44126967"
] | 0.6770018 | 0 |
Apply criteria specific options query, sort, fields. | def apply_criteria_options
if spec = criteria.options[:sort]
query.sort(spec)
end
if spec = criteria.options[:fields]
query.select(spec)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def apply_criteria_options\n unless criteria.selector.empty?\n command[:pipeline][0][\"$match\"] = criteria.selector\n end\n if sort = criteria.options[:sort]\n command[:pipeline][0][\"$sort\"] = sort\n end\n if limit = criteria.options[:limit]\n command[:pipeline][0][\"$limit\"] = limit\n end\n if skip = criteria.options[:skip]\n command[:pipeline][0][\"$skip\"] = skip\n end\n if fields = criteria.options[:fields]\n command[:pipeline][0][\"$project\"] = fields\n end\n end",
"def apply_options(options) \r\n if options.kind_of? Hash\r\n conditions = options.delete(:conditions) || {}\r\n \r\n conditions.each do | c_name, c_value |\r\n c_name = c_name.to_s\r\n \r\n case c_name\r\n when /list\\Z/i\r\n # List filters\r\n list = query.__send__(c_name.camelize)\r\n c_value = [c_value] unless c_value.kind_of?(Array)\r\n c_value.each { |i| list.Add(i) }\r\n when /range\\Z/i\r\n # Range filters\r\n c_value = parse_range_value(c_value)\r\n range_filter = filter_for(c_name)\r\n range_name = c_name.match(/(.*)_range\\Z/i)[1]\r\n if range_name == 'modified_date'\r\n # Modified Date Range use the IQBDateTimeType which requires a\\\r\n # boolean 'asDateOnly' value.\r\n range_filter.__send__(\"from_#{range_name}=\", c_value.first, true) if c_value.first\r\n range_filter.__send__(\"to_#{range_name}=\", c_value.last, true) if c_value.last\r\n else\r\n range_filter.__send__(\"from_#{range_name}=\", c_value.first) if c_value.first\r\n range_filter.__send__(\"to_#{range_name}=\", c_value.last) if c_value.last\r\n end\r\n when /status\\Z/i\r\n # Status filters\r\n filter.__send__(\"#{c_name}=\", c_value)\r\n else\r\n # Reference filters - Only using FullNameList for now\r\n ref_filter = filter_for(c_name)\r\n c_value = [c_value] unless c_value.respond_to?(:each)\r\n c_value.each do | val |\r\n ref_filter.FullNameList.Add(val)\r\n end\r\n end\r\n end\r\n \r\n add_owner_ids(options.delete(:owner_id))\r\n add_limit(options.delete(:limit))\r\n add_includes(options.delete(:include))\r\n\r\n options.each do |key, value|\r\n self.send(key.to_s.camelize).SetValue(value)\r\n end\r\n end\r\n end",
"def query(conditions = [], order = [], limit = 250)\n conditions.select!{ |h| Proc === self.class.searchable[h[:field].to_sym]}\n @conditions = conditions\n @order = Hash[order].reject { |field, dir| field.nil? || !self.class.sortable[field.to_sym] }.\n map{ |field, dir| (dir == 'asc') ? self.class.sortable[field.to_sym].asc : self.class.sortable[field.to_sym].desc }\n @limit = limit\n dataset\n end",
"def apply_search_criteria( ds, options )\n\t\tif (( criteria = options[:criteria] ))\n\t\t\tcriteria.each do |field, value|\n\t\t\t\tself.log.debug \" applying criteria: %p => %p\" % [ field.to_s, value ]\n\t\t\t\tds = ds.select {|uuid| @storage[uuid][field.to_s] == value }\n\t\t\tend\n\t\tend\n\n\t\treturn ds\n\tend",
"def find_options\n opt = {:conditions => conditions, :limit => @limit, :order => \"#{@id_clause} #{@order}\"}\n if columns = @options[:select]\n opt[:select] = columns\n end\n opt[:joins] = @joins if @joins\n opt\n end",
"def apply_finder_options(options)\n relation = clone\n return relation if options.nil?\n\n finders = options.dup\n finders[:select] = finders.delete(:fields)\n conditions = finders.slice!(*VALID_FIND_OPTIONS)\n\n finders.delete_if { |key, value| value.nil? && key != :limit }\n\n ([:joins, :select, :group, :order, :having, :limit, :offset, :from, :lock, :readonly] & finders.keys).each do |finder|\n relation = relation.send(finder, finders[finder])\n end\n\n relation = relation.where(conditions) if conditions.any?\n relation = relation.where(finders[:conditions]) if options.has_key?(:conditions)\n relation = relation.includes(finders[:include]) if options.has_key?(:include)\n relation = relation.extending(finders[:extend]) if options.has_key?(:extend)\n\n relation\n end",
"def set_filter_options\n @sort_modes = Organization.sort_modes\n @view_modes = Organization.view_modes\n\n @current_sort_mode = if @sort_modes.keys.include?(params[:sort_by])\n params[:sort_by]\n else\n @sort_modes.keys.first\n end\n\n @current_view_mode = if @view_modes.keys.include?(params[:view])\n params[:view]\n else\n @view_modes.keys.first\n end\n\n @query = params[:query]\n end",
"def clauses\n { sortby: sort_by_params, limit: limit_params }.compact\n end",
"def collection_search_params_logic\n base_logic = [:default_solr_parameters, :add_query_to_solr, :add_access_controls_to_solr_params]\n base_logic += [:add_collection_filter, :some_rows]\n base_logic\n end",
"def adjust_for_parameters(params)\n params = params[\"filter\"] if params[\"filter\"]\n \n #self.paginate = false\n if params && params[\"paginate\"]\n self.paginate = true\n self.paginate = false if params[\"do_viewall\"]\n elsif params && params[\"viewall\"]\n self.paginate = false\n self.paginate = true if params[\"do_paginate\"]\n end\n \n #--- set up perpage\n if params && params[\"perpage\"]\n self.set_items_per_page(params[:perpage])\n end\n\n params[\"dropdowns\"].each_pair do |name,value|\n dropdowns[name][\"value\"] = value if dropdowns[name]\n end if params && params[\"dropdowns\"] # do params\n \n params[\"custom_fields\"].each_pair do |name,value|\n custom_fields[name][\"value\"] = CUSTOM_DEFAULT_VALUE \n custom_fields[name][\"value\"] = value if custom_fields[name] && value!=CUSTOM_VALUE_FOR_ALL \n end if params && params[\"custom_fields\"] # do params\n \n params[\"boolean_fields\"].each_pair do |name,value|\n boolean_fields[name][\"value\"] = BOOLEAN_VALUE_FOR_ALL \n boolean_fields[name][\"value\"] = value if boolean_fields[name] && value!=BOOLEAN_VALUE_FOR_ALL \n end if params && params[\"boolean_fields\"] # do params\n \n if params[:sort_by] #&& params[:old_sort_by] && params[:old_sort_by_order]\n \n self.sort_by = params[:sort_by]\n self.sort_by_order = params[:old_sort_by_order] == 'ASC' ? 'ASC' : 'DESC'\n if params[:old_sort_by] == params[:sort_by] && params[:sort_by_order_flip] == 'yes'\n self.sort_by_order = params[:old_sort_by_order] == 'DESC' ? 'ASC' : 'DESC' \n end\n \n self.sql_sortorder = \"#{self.sort_by} #{self.sort_by_order}\"\n self.sql_sortorder += \", #{self.secondary_sort}\" unless self.secondary_sort.blank?\n \n end # if sort_order \n \n params[\"dates\"].each_pair do |name,value|\n if dates[name]\n dates[name][\"value\"] = Date.new(\n value[\"date(1i)\"].to_i,\n value[\"date(2i)\"].to_i,\n value[\"date(3i)\"].to_i\n )\n end\n end if params && params[\"dates\"] # do params\n \n self.search_string = RFilter.sanitize_sql(params[\"search_for\"]) if params && params[\"search_for\"]\n\n generate_sql_conditions\n end",
"def filter_and_sort_options(opts={})\n raise ArgumentError, 'parameter hash expected' unless opts.respond_to? :symbolize_keys\n opts.symbolize_keys!\n \n limit, page = calculate_limit_and_page(opts)\n sort = determine_sort(opts)\n conditions, values = get_conditions_and_values(opts)\n \n {:page => page, :per_page => limit, :order => sort, :include => extjs_filterable_options[:include],\n :conditions => [conditions.join(\" and \")].concat(values)}\n end",
"def merge_finder_options_with_or!(options={})\n options.reject! {|k,v| v.blank?}\n self[:select] = [self[:select], options.delete(:select)].compact.join(\", \")\n self[:conditions] = ActiveRecord::Base.sanitize_and_merge_conditions_with_or(self[:conditions], options.delete(:conditions))\n self[:order] = ActiveRecord::Base.sanitize_and_merge_order(self[:order], options.delete(:order))\n self[:joins] = ActiveRecord::Base.sanitize_and_merge_joins(self[:joins], options.delete(:joins))\n self.reject! {|k,v| v.blank?}\n self.merge!(options)\n end",
"def set_search_fields(fields, precision)\n condition = nil\n # when the results have match with all fields\n condition = \"AND\" if params[\"Match all\"]\n fields.each do |field|\n @results = @data.search_by params[field], field, condition, precision unless params[field]==\"\"\n end\n end",
"def find_options options={}\r\n con = conditions\r\n par = parameters\r\n inc = includes\r\n cond_ary = nil\r\n if conditions\r\n cond_ary=[con]\r\n cond_ary += par if par\r\n end\r\n options[:conditions] = cond_ary if cond_ary\r\n options[:include] = includes if includes\r\n options \r\n end",
"def relation_condition_option_perform\n # Build the relation depending on the various options (query methods).\n relation = AllTypesObject.all\n\n # Set the right condition options\n @condition_options = {\n apply_method: params[:apply_method],\n argument_type: params[:argument_type],\n placeholder_style: params[:argument_type_option],\n hash_style: params[:argument_type_option]\n }\n\n # Apply the conditions.\n relation = build_and_apply_conditions(relation, :where, params[:conditions])\n\n # The query will be automatically performed (probably using to_a) in the view to display the results.\n @all_types_objects = relation.to_a # Perform the query execution here, because for (strange reasons) the error format is different when they are executed from within the view\n\n respond_with(@all_types_objects)\n end",
"def take_further_actions\n if options[:check_bounds]\n min_max_bounds = CsvImportAnalyzer::CsvCheckBounds.new(options)\n res = min_max_bounds.get_min_max_values\n options[:min_max_bounds] = res[:min_max]\n options[:uniques] = res[:uniques]\n end\n query = CsvImportAnalyzer::SqlQueryBuilder.new(options)\n query.generate_query\n end",
"def options\n @criteria_hash.options\n end",
"def search_fields(options)\n search_fields = options.delete(:use_key)\n if search_fields\n search_fields = [search_fields] unless search_fields.is_a?(Array)\n search_fields = search_fields.sort_by{|f| f.to_s}\n else\n search_fields = options[:conditions].to_a.sort_by{|f| f.first.to_s}.map(&:first)\n end\n\n # If no seach field fall back on :created_at or :id\n if search_fields.empty?\n if property_names.include?(:created_at)\n search_fields << :created_at\n else\n search_fields << :_id\n end\n end\n\n # Deal with missing underscore automatically\n search_fields << :_id if search_fields.delete(:id)\n search_fields << :_rev if search_fields.delete(:rev)\n search_fields\n end",
"def configure_sorting_and_filtering_and_facet_counts\n set_view_as_options\n @view_as = params[:view_as].blank? ? @collection.view_style_or_default : ViewStyle.find(params[:view_as])\n set_sort_options\n @sort_by = params[:sort_by].blank? ? @collection.sort_style_or_default : SortStyle.find(params[:sort_by])\n @filter = params[:filter]\n @page = params[:page]\n @selected_collection_items = params[:collection_items] || []\n\n # NOTE - you still need these counts on the Update page:\n @facet_counts = EOL::Solr::CollectionItems.get_facet_counts(@collection.id)\n end",
"def advanced_search_options(params, offset = 0, per_page = 5)\n boolean_opr = validate_boolean_opr(params)\n description = params[:description] || \"\"\n \n query = {}\n query[:for_all] = boolean_opr == \"all\" ? description : \"\"\n query[:for_one] = boolean_opr == \"any\" ? description : \"\"\n query[:for_exact] = boolean_opr == \"exact\" ? description : \"\"\n query[:for_none] = \"\"\n query[:for_jt] = \"\"\n query[:for_com] = \"\"\n query[:for_loc] = params[:location] || \"\"\n query[:radius] = validate_radius( params )\n query[:postedDate] = validate_fromage( params )\n query[:jtype] = validate_job_type( params )\n query[:startPage] = (offset / per_page) + 1 unless Integer(offset/per_page) == 0 # \"+ 1\" ?\n query[:limit] = per_page\n query[:sort] = validate_sort( params )\n \n return query\n end",
"def process_grid(opts = {})\n klass = opts[:klass] || nil\n column_defs = opts[:column_defs] || nil\n q = opts[:q] || nil\n filter_params = opts[:filter_params] || nil\n page = opts[:page] || DEFAULT_PAGE\n per_page = opts[:per_page] || DEFAULT_PER_PAGE\n sort_info = opts[:sort_info] || DEFAULT_SORT_INFO\n enable_paging = opts[:enable_paging].nil? ? DEFAULT_ENABLE_PAGING : opts[:enable_paging].to_bool\n join_objects = opts[:join_objects] || []\n field_lookup = opts[:field_lookup] || {}\n custom_where_query = opts[:custom_where_query] || nil\n group_by_query = opts[:group_by_query] || nil\n\n # Enforce default values\n page ||= DEFAULT_PAGE\n per_page ||= DEFAULT_PER_PAGE\n sort_info ||= DEFAULT_SORT_INFO\n\n # Parse parameters into correct format\n column_defs = parse_params(column_defs)\n filter_params = parse_params(filter_params)\n page = page.to_i\n per_page = per_page.to_i\n sort_info = parse_params(sort_info)\n field_lookup = parse_params(field_lookup)\n\n # Check for client errors\n raise \"Invalid per_page parameter. Valid values are #{VALID_PER_PAGES}\" unless VALID_PER_PAGES.include?(per_page)\n sort_info ||= {}\n\n # select\n select_query = process_select(klass, column_defs, field_lookup)\n objects = klass.select(select_query)\n\n # join (optional)\n objects = [join_objects].flatten.compact.inject(objects, :joins) unless [join_objects].flatten.compact.empty?\n\n # where\n objects = objects.where(custom_where_query) if custom_where_query\n if filter_params\n where_query = process_advanced_search_query_where(column_defs, filter_params, field_lookup)\n else\n where_query = process_where(column_defs, q, field_lookup)\n end\n objects = objects.where(where_query)\n\n # group\n if group_by_query\n objects = objects.group(group_by_query)\n\n # Convert objects from group_by_query to array\n # so its size can be grokked\n objects.to_a\n end\n\n # Force per_page value with total_entries and page value with 1.\n # Happens when pagination is disabled.\n unless enable_paging\n per_page = objects.size\n page = 1\n end\n\n # pagination\n # TODO: @ralibi this is fix for total entries when using group by query and\n # pagination\n objects = objects.paginate(page: page, per_page: per_page, total_entries: objects.size)\n\n # order\n order_query = process_order(sort_info, field_lookup)\n objects = objects.reorder(order_query) unless objects.empty?\n\n objects\n end",
"def criteria\r\n model = controller_name.singularize.camelize.constantize\r\n locals = {}\r\n\r\n case params[:id]\r\n when \"activate_filters\"\r\n action = \"acts_as_criteria/activate_filter\"\r\n when \"activate_simple\"\r\n action = \"acts_as_criteria/activate_simple\"\r\n when \"new_filter_row\"\r\n unless params[:col_name].blank?\r\n col_name = params[:col_name]\r\n @filter = { :col_name => col_name, :col_text => model.criteria_options[:filter][:columns][:\"#{col_name}\"][:text] || col_name,:col_subtype => model.col_subtype(col_name), :col_options => model.criteria_options[:filter][:columns][:\"#{col_name}\"] }\r\n action = \"acts_as_criteria/new_filter_row\"\r\n else\r\n action = \"acts_as_criteria/invalid_action\"\r\n end\r\n when \"destroy_filter_row\"\r\n unless params[:col_name].blank?\r\n locals = { :col_name => params[:col_name] }\r\n action = \"acts_as_criteria/destroy_filter_row\"\r\n else\r\n action = \"acts_as_criteria/invalid_action\"\r\n end\r\n when \"clear_filters\"\r\n instance_variable_set(\"@current_query\", nil)\r\n unless model.criteria_options[:mantain_current_query].blank?\r\n model.criteria_options[:mantain_current_query].call(nil, controller_name, session)\r\n end \r\n action = \"acts_as_criteria/clear_filters\"\r\n when \"save_filters\"\r\n if params[:criteria_select_filter].blank?\r\n filter = UserFilter.new(:user_id => params[:user_id], :assigned_to => params[:user_id], :name => params[:filter_name], :description => params[:filter_description], :criteria => criteria_hash_to_query_string, :asset => controller_name)\r\n else\r\n if model.criteria_options[:restrict].blank?\r\n filter = UserFilter.find(:first, :conditions => { :user_id => @current_user.id, :id => params[:criteria_select_filter] })\r\n else\r\n restrict = model.criteria_options[:restrict]\r\n filter = UserFilter.send(:\"#{restrict[:method]}\", @current_user).find(:first, :conditions => { :id => params[:criteria_select_filter] })\r\n end\r\n filter.criteria = criteria_hash_to_query_string\r\n end\r\n \r\n if filter.save\r\n message = model.criteria_options[:i18n] ? model.criteria_options[:i18n].call(\"msg_successful_saved_filter\") : \"Succefully saved filter\"\r\n flash[:notice] = message\r\n else\r\n message = model.criteria_options[:i18n] ? model.criteria_options[:i18n].call(\"msg_failed_save_filter\") : \"The filter can't be saved\"\r\n flash[:error] = message\r\n end\r\n action = \"acts_as_criteria/save_filters\"\r\n else\r\n action = \"acts_as_criteria/invalid_action\"\r\n end\r\n \r\n respond_to do |format|\r\n format.js { render :template => action, :locals => locals }\r\n end \r\n end",
"def merge_finder_options_with_or(options={})\n result = self.dup\n options.reject! {|k,v| v.blank?}\n result[:select] = [self[:select], options.delete(:select)].compact.join(\", \")\n result[:conditions] = ActiveRecord::Base.sanitize_and_merge_conditions_with_or(self[:conditions], options.delete(:conditions))\n result[:order] = ActiveRecord::Base.sanitize_and_merge_order(self[:order], options.delete(:order))\n result[:joins] = ActiveRecord::Base.sanitize_and_merge_joins(self[:joins], options.delete(:joins))\n result.reject {|k,v| v.blank?}.merge(options)\n end",
"def __sort_option__\n multi.inject({}) do |options, criteria|\n options.merge!(criteria.__sort_pair__)\n options\n end\n end",
"def search conditions, options = {}\n options = {\n :limit => false,\n :offset => 0\n }.merge(options)\n\n remote.search normalize_conditions(conditions),\n options[:offset],\n options[:limit],\n options[:order],\n options[:context],\n options[:count]\n end",
"def query_options\n # todo: support more options?\n options = {}\n options.merge!({:limit => limit_value.to_json}) if limit_value\n options.merge!({:skip => @options[:skip].to_json}) if @options[:skip]\n options.merge!({:reversed => reversed?.to_json}) if reversed?\n options.merge!({:order => @options[:order]}) if @options[:order]\n options.merge!({:cursor => @options[:cursor]}) if @options[:cursor]\n options\n end",
"def build_order_options(arguments, crit)\n case arguments\n when Hash\n if arguments.size > 1\n raise ArgumentError, \"Please don't use hash to define multiple orders \" +\n \"due to the fact that hash doesn't have order this may cause unpredictable results\"\n end\n arguments.each_pair do |field, direction|\n merge_options(crit.options[:sort], [ localize(field), direction ])\n end\n when Array\n merge_options(crit.options[:sort], arguments.map{ |field| localize(field) })\n when Complex\n merge_options(crit.options[:sort], [ localize(arguments.key), arguments.operator.to_sym ])\n end\n end",
"def build\n criteria_fields.inject({}) do |criteria_hash, field|\n value = field_value field \n set_criteria(criteria_hash, field, value) unless skip?(field, value)\n criteria_hash\n end\n end",
"def searchable_by *fields\n self.fields = process_fields(fields)\n end",
"def count_options\n query_options.dup.tap do |co|\n co[:conditions] = conditions_clause unless conditions_clause.empty?\n end\n end",
"def scaffold_get_objects(options)\n optionshash = {}\n data = self.all\n if options[:conditions]\n conditions = options[:conditions]\n if conditions && Array === conditions && conditions.length > 0\n if String === conditions[0]\n data = data.all(:conditions => conditions)\n else\n conditions.each do |cond|\n next if cond.nil?\n data = case cond\n when Hash, String then data.all(:conditions => [cond.gsub(\"NULL\",\"?\"),nil])\n when Array then \n if cond.length==1\n data.all(:conditions => [cond[0].gsub(\"NULL\",\"?\"),nil])\n else\n data.all(:conditions => cond)\n end\n when Proc then data.all(&cond)\n end\n end\n end\n end\n end\n slice = nil\n if options[:limit]\n startpos = options[:offset] || 0\n endpos = options[:limit]\n slice = [startpos,endpos]\n end\n # TODO includes break SQL generation\n # optionshash[:links] = options[:include] if options[:include]\n # optionshash[:links] = [optionshash[:links]] unless optionshash[:links].is_a?(Array)\n if options[:order] then\n optionshash[:order] = get_ordering_options(options[:order])\n end\n if slice then\n q = data.all(optionshash).slice(*slice)\n else\n q = data.all(optionshash)\n end\n #p repository.adapter.send(\"select_statement\",q.query)\n q.to_a\n end",
"def sort_criteria\n @sort_criteria ||=\n sort_params.reduce('') do |sum, (key, value)|\n comparables = [\"a[:#{key}]\", \"b[:#{key}]\"]\n comparables.reverse! if value == :desc\n sum + \"comp = comp == 0 ? #{comparables.join(' <=> ')} : comp; \"\n end\n end",
"def merge_finder_options_with_and!(options={})\n options.reject! {|k,v| v.blank?}\n self[:select] = [self[:select], options.delete(:select)].compact.join(\", \")\n self[:conditions] = ActiveRecord::Base.sanitize_and_merge_conditions_with_and(self[:conditions], options.delete(:conditions))\n self[:order] = ActiveRecord::Base.sanitize_and_merge_order(self[:order], options.delete(:order))\n self[:joins] = ActiveRecord::Base.sanitize_and_merge_joins(self[:joins], options.delete(:joins))\n self.reject! {|k,v| v.blank?}\n self.merge!(options)\n end",
"def contacts(options={})\n order_option = [group_by_sort_order, options[:order]].reject {|s| s.blank?}.join(',')\n order_option = nil if order_option.blank?\n\n # joins = (order_option && order_option.include?('authors')) ? \"LEFT OUTER JOIN users authors ON authors.id = #{Contact.table_name}.author_id\" : nil\n\n joins = []\n if order_option\n if order_option.include?('authors')\n joins << \"LEFT OUTER JOIN users authors ON authors.id = #{Contact.table_name}.author_id\"\n end\n order_option.scan(/cf_\\d+/).uniq.each do |name|\n column = available_columns.detect {|c| c.name.to_s == name}\n join = column && column.custom_field.join_for_order_statement\n if join\n joins << join\n end\n end\n end\n joins = joins.any? ? joins.join(' ') : nil\n\n\n scope = Contact.scoped({})\n\n options[:search].split(' ').collect{ |search_string| scope = scope.live_search(search_string) } unless options[:search].blank?\n options[:include] << :assigned_to if (order_option && order_option.include?('users'))\n scope.visible.scoped(:conditions => options[:conditions]).find :all, :include => ([:projects, :address] + (options[:include] || [])).uniq,\n :conditions => statement,\n :order => order_option,\n :joins => joins,\n :limit => options[:limit],\n :offset => options[:offset]\n rescue ::ActiveRecord::StatementInvalid => e\n raise StatementInvalid.new(e.message)\n end",
"def advancedSort\n @sortField = params[:sortField]#field to search on \n @searchField =params[:searchField]# value to search for\n @sortField2 = params[:sortField2]\n @searchField2 =params[:searchField2]\n @graphField = params[:graphField] #datapoint to build graph around\n \n if @sortField2 == \" \"#check if default second value was changed\n @records = Record.where(@sortField => @searchField) #if not only use the first search field\n else#otherwise use both seach fields\n @records = Record.where(@sortField => @searchField, @sortField2 => @searchField2 )\n end\n @sortedSet = @records.order(@graphField)\n end",
"def get_criteria\n parameters = params[:analysis] ? params[:analysis] : params\n criteria = { name: parameters[:name] }\n criteria[:collection] = parameters[:collection] if parameters[:collection].present?\n if parameters[:date_from].present?\n criteria[:attribute] = :date\n criteria[:value] = date_from..date_to\n return criteria\n end\n [:size, :color, :fabric].each do |attr|\n if parameters[attr].present?\n criteria[:attribute] = \"pieces.#{attr}\"\n criteria[:value] = parameters[attr]\n return criteria\n end\n end\n criteria\n end",
"def apply_sorting(query, sort_params)\n (sort_params[:sort] || {}).each do |idx, order|\n order = (order.to_i % 2 == 0) ? :asc : :desc\n filter = ajax_filters.find { |f| f.position == idx.to_i }\n\n next if filter.blank?\n\n klass = filter.klass || query.klass\n column = filter.column\n\n if filter.sorter_query.present?\n query = filter.sorter_query.call(query, order)\n else\n query = query.reorder(\"#{klass.table_name}.#{column} #{order} NULLS LAST\")\n end\n end\n\n query\n end",
"def legacy_options\n {\n :conditions => options[:where],\n :include => options[:includes],\n :limit => options[:limit],\n :order => options[:order],\n :offset => options[:offset],\n :select => options[:select],\n :group => options[:group],\n }.delete_blanks\n end",
"def extract_conditions!(options = {})\n\t\t\t\torder = normalize_order(options.delete(:order))\n\t\t\t\tlimit = options.delete(:limit)\n\t\t\t\toffset = options.delete(:offset)\n\t\t\t\tconditions = options.delete(:conditions) || options\n\t\t\t\t[conditions, order, limit, offset]\n\t\t\tend",
"def find_options\n count_options.tap do |fo|\n fo[:order] = sorter.to_find_option if sorter.to_find_option\n fo.merge!({:offset => (page - 1)*page_size, :limit => page_size}) unless page_size.zero?\n end\n end",
"def search(criteria = {})\r\n \r\n end",
"def prepare_search(options = {})\n logger.debug(\"List, Search, or Group records\")\n \n @period_options = Period.options_by_midpoint\n @start_period_options = [[\"Start Period\",\"\"]]\n @start_period_options.concat @period_options\n @end_period_options = [[\"End Period\",\"\"]]\n @end_period_options.concat @period_options\n\n @kingdom_options = Kingdom.options\n @phylum_options = Phylum.options\n @environment_options = Environment.options\n @motility_options = Motility.options\n\n\n ## Create a list of things that can be used to group bodysize search results\n @groups = Hash.new\n @groups[\"kingdom_id\"] = ResultGroupField.new(\"kingdom_id\", :display_name => \"Kingdom\")\n @groups[\"phylum_id\"] = ResultGroupField.new(\"phylum_id\", :display_name => \"Phylum\")\n @groups[\"class_classification\"] = ResultGroupField.new(\"class_classification\", :display_name => \"Class\", :attribute_name => \"class_classification\")\n @groups[\"environment_id\"] = ResultGroupField.new(\"environment_id\", :display_name => \"Environment\")\n @groups[\"motility_id\"] = ResultGroupField.new(\"motility_id\", :display_name => \"Motility\")\n\n @graph_group_options = @groups.map { |key, group| [group.display_name, group.field_name] }\n\n @groups[\"period_id\"] = ResultGroupField.new(\"period_id\", :display_name => \"Period\")\n @group_options = @groups.map { |key, group| [group.display_name, group.field_name] }\n \n\n # Override default search values with anything in the session\n search_values = Hash.new\n if session[:search]\n session[:search].each { |key, value| search_values[key.to_sym] = session[:search][key] }\n end\n \n # Override default and session values with anything in params\n if options\n options.each { |key, value| search_values[key.to_sym] = options[key] }\n end\n \n if params[:page]\n search_values[:page] = params[:page]\n end\n\n # Save the search criteria \n session[:search] = search_values.dup\n session[:search][:show_all] = false\n\n\n if search_values && search_values[:use_log10_biovolume] && search_values[:use_log10_biovolume] == \"1\"\n @data_field = \"log10_biovolume\"\n else\n @data_field = \"biovolume\"\n end\n\n # Default records\n \n \n @bodysizes = current_user.accessible_bodysize_records({ :page => params[:page] || 1, :per_page => 20 })\n \n \n search(search_values)\n end",
"def advanced_search_options_via_search_form(params, offset, per_page)\n query = {}\n query[:q] = params[:description] || \"\"\n query[:l] = params[:location] || \"\"\n query[:radius] = validate_radius( params )\n query[:postedDate] = validate_fromage( params )\n query[:jtype] = validate_job_type( params )\n query[:startPage] = (offset / per_page)\n query[:limit] = per_page\n query[:sort] = validate_sort( params )\n \n return query\n end",
"def groupable_columns_options(query, columns)\n columns_options = columns.collect do |column|\n #######################\n # Smile specific #245965 Rapport : critères, indication type champ personnalisé\n # Smile specific : New hook\n criteria_order = nil\n column_label = column.caption\n\n criteria_order_hook, column_label_hook = Query.column_label_and_order_hook(query, column)\n\n if criteria_order_hook\n criteria_order = criteria_order_hook\n column_label = column_label_hook\n end\n # END -- Smile specific #245965 Rapport : critères, indication type champ personnalisé\n #######################\n\n ################\n # Smile specific #245965 Rapport : critères, indication type champ personnalisé\n # Smile specific : column.caption -> column_label\n # Smile specific : added third value in array for order\n [column_label, column.name, criteria_order]\n end\n\n ################\n # Smile specific #245965 Rapport : critères, indication type champ personnalisé\n # Smile specific : sort with criteria order\n sort_options_by_label_and_order!(columns_options)\n\n ################\n # Smile specific #245965 Rapport : critères, indication type champ personnalisé\n # Smile specific : remove last element used to sort => will remain [column_label, column.name]\n columns_options = columns_options.collect{|k| [k[0], k[1]]}\n end",
"def conditions(conditions={})\n @options[:conditions].merge!(conditions) if conditions.kind_of?(Hash)\n end",
"def find_with_searchlogic(*args)\n options = args.extract_options!\n options = filter_options_with_searchlogic(options)\n args << options\n find_without_searchlogic(*args)\n end",
"def set_conditions_and_sort_order(query, sdb_type)\n conditions = [\"simpledb_type = '#{sdb_type}'\"]\n # look for query.order.first and insure in conditions\n # raise if order if greater than 1\n\n if query.order && query.order.length > 0\n query_object = query.order[0]\n #anything sorted on must be a condition for SDB\n conditions << \"#{query_object.property.name} IS NOT NULL\" \n order = \"order by #{query_object.property.name} #{query_object.direction}\"\n else\n order = \"\"\n end\n\n query.conditions.each do |operator, attribute, value|\n operator = case operator\n when :eql then '='\n when :not then '!='\n when :gt then '>'\n when :gte then '>='\n when :lt then '<'\n when :lte then '<='\n else raise \"Invalid query operator: #{operator.inspect}\" \n end\n conditions << \"#{attribute.name} #{operator} '#{value}'\"\n end\n [conditions,order]\n end",
"def apply_filters(query, options)\n if @model_ids && options[:mview]\n query = query.where(model_id: @model_ids)\n elsif @model_ids\n query = query.where('scenarios.model_id' => @model_ids)\n end\n query = query.where(scenario_id: @scenario_ids) if @scenario_ids\n query = query.where(indicator_id: @indicator_ids) if @indicator_ids\n query = query.where(location_id: @location_ids) if @location_ids\n query = query.joins(:indicator).where(indicators: {subcategory_id: apply_category_filter}) if @category_ids\n puts query.to_sql.inspect\n query\n end",
"def finder_options(options={})\n clear_default_fields\n\n select = \"#{finder_table_name}.*\"\n order = self.sort_order || \"#{finder_table_name}.created_at ASC\"\n group = \"#{finder_table_name}.#{primary_key}\"\n\n conditions = []\n conditions << if self.state =~ /^read$/\n sanitize_sql(['? = messages.receiver_id AND messages.id IN (SELECT messages.id FROM messages ' +\n 'LEFT OUTER JOIN readings ON messages.id = readings.readable_id AND readings.readable_type = \\'Message\\' ' + \n 'WHERE readings.readable_id = messages.id AND readings.readable_type = \\'Message\\' AND readings.person_id = ?)',\n self.person.id, self.person.id])\n elsif self.state =~ /^unread$/\n sanitize_sql(['? = messages.receiver_id AND messages.id NOT IN (SELECT messages.id FROM messages ' +\n 'LEFT OUTER JOIN readings ON messages.id = readings.readable_id AND readings.readable_type = \\'Message\\' ' + \n 'WHERE readings.readable_id = messages.id AND readings.readable_type = \\'Message\\' AND readings.person_id = ?)',\n self.person.id, self.person.id])\n end\n \n conditions << sanitize_sql([\"messages.status IN (?)\", ['delivered', 'done', 'read']])\n conditions = conditions.compact.reject(&:blank?).join(\" AND \")\n \n result = {:select => select, :order => order, :group => group, :conditions => conditions,\n :include => :readings}.merge_finder_options(options)\n \n reset_default_fields\n result\n end",
"def sortable_fields(context = nil)\n @_query_fields ||= {}\n if searchable?\n super(context) + @_query_fields.keys + ['_score']\n else\n super(context)\n end\n end",
"def do_params_filter_and_sort scope\n do_params_sort do_params_filter scope\n end",
"def query_options(options)\n options.each_with_object({}) do |(key, val), hash|\n case key\n when :date\n hash[:ShowDate] = val.to_ShowDate\n when :movie_id\n hash[:movie_id] = val\n when :movie_source\n # Set both movie_id and ShowDate.\n movie_source = val\n hash.merge! query_options(movie_id: movie_source.external_id)\n hash.merge! query_options(date: movie_source.released_on) if movie_source.released_on\n when :postal_code\n hash[:SearchZip] = val.to_s.gsub(' ', '')\n else\n raise \"unknown option: #{key}\"\n end\n end\n end",
"def execute *args\n if args.first == :query\n self\n else\n opts = args.last.is_a?(Hash) ? args.last : {}\n results = []\n\n pagination = opts.delete(:paginate) || {}\n model.send(:with_scope, :find => opts) do\n @conditions.paginate(pagination) unless pagination.empty?\n results = model.find args[0], to_find_parameters\n if @conditions.paginate?\n paginate_result_set results, to_find_parameters\n end\n end\n results\n end\n end",
"def items(options={})\n order = [group_by_sort_clause, sort_criteria_clause, options[:order]]\n order = order.flatten.reject(&:blank?).compact.uniq.join(\",\")\n order = nil if order.blank?\n \n includes = [options[:include], sort_criteria.map { |n, o| include_for(n) }]\n includes << include_for(group_by) if grouped? && include_for(group_by)\n includes = includes.flatten.reject(&:blank?).compact.uniq\n includes = nil if includes.blank?\n\n queryable_class.all options.merge(\n :conditions => self.class.merge_conditions(to_sql, options[:conditions]),\n :order => order,\n :include => includes)\n rescue ::ActiveRecord::StatementInvalid => e\n raise StatementInvalid.new(e.message)\n end",
"def __sort_option__\n split(/,/).inject({}) do |hash, spec|\n hash.tap do |_hash|\n field, direction = spec.strip.split(/\\s/)\n _hash[field.to_sym] = Mongoid::Criteria::Translator.to_direction(direction)\n end\n end\n end",
"def find_options_for_open_rewarded(options={})\n {:conditions => [\"kases.status IN (?) AND kases.price_cents > 0 AND kases.template != ?\", [\"open\"], true],\n :order => \"kases.updated_at DESC\"}.merge_finder_options(options)\n end",
"def build_list_options\n conditions = []\n conditions_str = []\n @search_titles = []\n @search_filters ||= {}\n # convert, from k-params to k-fields\n params_keys = {}\n params.delete_if { |kp,v|\n unless (kf = ParamToField[kp.to_sym]).nil? then\n @search_filters[ kf ] = v\n params_keys[ kf ] = kp\n true\n end\n }\n\n if @search_filters[:addressbook_group_id] then \n if filter_instance = AddressbookGroup.find_by_id(@search_filters[:addressbook_group_id]) \n conditions_str << \"addressbook_group_phones.addressbook_group_id = ?\"\n conditions << @search_filters[:addressbook_group_id]\n @search_titles << ['addressbook group', filter_instance]\n else\n @search_filters.delete(:addressbook_group_id)\n end\n end\n\n=begin\n if @search_filters[:department_id] then \n filter_instance = Department.find_by_id(@search_filters[:department_id])\n if filter_instance then\n conditions_str << \"addressbook_contacts.department_id = ?\"\n conditions << @search_filters[:department_id]\n @search_titles << ['department', filter_instance]\n else\n @search_filters.delete(:department_id)\n end\n end\n if @search_filters[:user_id] then \n filter_instance = User.find_by_id(@search_filters[:user_id])\n if filter_instance then\n conditions_str << \"addressbook_contacts.user_id = ?\"\n conditions << @search_filters[:user_id]\n @search_titles << ['user', filter_instance]\n else\n @search_filters.delete(:user_id)\n end\n end\n=end\n \n #conditions_str << \"addressbook_contacts.public = ?\"\n #conditions << params[:public]\n \n #if !params[:public] then\n # conditions_str << \"addressbook_contacts.user_id = ? \"\n # conditions << self.current_user.id\n #end\n \n if @search_filters[:search_text] then\n search_fields = %w(name email description address city country birthday)\n unless search_fields.empty? then\n conditions_str << '(' + search_fields.map{ |c| \"`addressbook_contacts`.`#{c}` LIKE ?\" }.join(' OR ') + ')'\n search_fields.size.times { conditions << \"%#{@search_filters[:search_text]}%\" }\n end \n @search_titles << ['text', @search_filters[:search_text]] \n end\n \n \n # store again to params (for next link)\n @search_filters.each_pair { |kf,v| params[ params_keys[kf] ] = v }\n \n # return conditions array\n conditions.unshift( conditions_str.join(' AND ') ) unless conditions_str.empty?\n conditions unless conditions.empty?\n end",
"def prepare_query(q_hash, options={})\n terms = options.fetch(:terms, {})\n limit = options.fetch(:limit, -1)\n skip = options.fetch(:skip, -1)\n order = options.fetch(:order, {})\n\n # Load the query but don't return any field data since we don't need it\n query = {\n 'fields' => [],\n 'query' => q_hash\n }\n\n # If we have terms that must match (such as user_id) set them\n if terms.length > 0\n if q_hash.include?('term')\n q_hash['term'].merge! terms\n else\n if q_hash.include?('bool')\n if !q_hash['bool'].include?('must')\n q_hash['bool']['must'] = []\n end\n\n q_hash['bool']['must'] << {term: terms}\n else\n query['query'] = {\n 'bool' => {\n 'must' => [q_hash]\n }\n }\n\n query['query']['bool']['must'] << {term: terms}\n end\n end\n end\n\n # Set the limit\n if limit > 0\n query['size'] = limit\n end\n\n # Set the number of records to skip\n if skip > 0\n query['from'] = skip\n end\n\n # Set the sort order, sorting by _score last\n if !query.include? 'sort'\n query['sort'] = []\n end\n\n order.map do |k, v|\n query['sort'] << {k => v}\n end\n\n if query['sort'].select { |x| x.keys.first == '_score' }.count == 0\n query['sort'] << {'_score' => 'desc'}\n end\n\n query\n end",
"def query_sort(query)\n return query unless has_sort_params?\n\n apply_sort(query, @table, @sorting[:order_by], @valid_fields + @custom_fields2.keys, @sorting[:direction])\n end",
"def manipulate_sort_and_rows_params(solr_parameters)\n blacklight_sort = blacklight_params[:sort]\n if blacklight_params[:action] == 'bento'\n # rows should never be 0; skip next conditional clauses\n elsif blacklight_params[:q].nil? && blacklight_params[:f].nil? && blacklight_params[:search_field].blank?\n # these are conditions under which no actual record results are displayed; so set rows=0\n # `:landing` action should also be caught by this block\n solr_parameters[:sort] = ''\n solr_parameters[:rows] = 0\n return\n elsif blacklight_params[:search_field] == 'subject_correlation'\n solr_parameters[:presentation_domain] = '{!filters param=$fq excludeTags=cluster,no_correlation}'\n solr_parameters[:sort] = ''\n solr_parameters[:rows] = 0\n return\n end\n return if blacklight_sort.present? && blacklight_sort != 'score desc'\n access_f = blacklight_params.dig(:f, :access_f)\n if !blacklight_params[:q].present?\n # no q param (with or without facets) causes the default 'score' sort\n # to return results in a different random order each time b/c there's\n # no scoring to apply. if there's no q and user hasn't explicitly chosen\n # a sort, we sort by id to provide stable deterministic ordering.\n if blacklight_config.induce_sort\n induced_sort = blacklight_config.induce_sort.call(blacklight_params)\n if induced_sort\n solr_parameters[:sort] = induced_sort\n return\n end\n end\n sort = 'elvl_rank_isort asc,last_update_isort desc'\n if access_f.nil? || access_f.empty?\n # nothing\n elsif access_f.include? 'At the library'\n if access_f.size == 1\n # privilege physical holdings\n sort = \"min(def(hld_count_isort,0),1) desc,#{sort}\"\n end\n else\n # privilege online holdings\n sort = \"min(def(prt_count_isort,0),1) desc,#{sort}\"\n end\n else\n sort = solr_parameters[:sort]\n sort = 'score desc' if !sort.present?\n if access_f == nil || access_f.empty?\n sort << @@DEFAULT_INDUCED_SORT\n elsif access_f.size == 1 && access_f.first == 'At the library'\n sort << @@AT_THE_LIBRARY_INDUCED_SORT\n else\n sort << @@ONLINE_INDUCED_SORT\n end\n end\n solr_parameters[:sort] = sort\n end",
"def find_class_options_for_query_with_or(query, options={})\n options\n end",
"def initialize(criteria)\n @criteria = criteria\n if klass.hereditary? && !criteria.selector.keys.include?(:_type)\n @criteria = criteria.in(:_type => criteria.klass._types)\n end\n @criteria.enslave if klass.enslaved?\n @criteria.cache if klass.cached?\n end",
"def conditions_for(fields=[])\n predicate = []\n values = []\n fields.each do |field|\n predicate << \"lower(#{field.to_s}) like ?\"\n values << \"'%' + @search_key.downcase + '%'\"\n end\n eval(\"[\\\"#{predicate.join(' OR ')}\\\", #{values.join(',')}]\")\n end",
"def &(criteria)\n Criteria.new self.criteria + criteria.criteria, self.options.merge(criteria.options)\n end",
"def process_params(opts)\n #nil should default to all for most of these, use empty strings here so we can check for allowed values easily below\n defaults = { #really, they're all nil, don't need any of this\n :type => nil, #public/private/both\n :report => nil, #what contaminant to report on, nil is simply a record in the db (ie all)\n :time => nil, #defaults to all records in existence\n :operation => nil #:count, reports, histogram, cot (change over time), coverage; defaults to counts of records\n #TODO if we're really just serving data, we should probably put a max number of records...\n #also be ready for a format\n }\n \n allowed_options = { # TODO the good way to do this would be to see if we respond_to?(:operation) or it's in the table\n :type => [:public, :private, nil],\n :report => [:arsenic,:tds,:salinity,:fluoride,:iron,:tc,:fc,:ph,:hardness,nil], #:all, :date?\n :time => [nil], \n :operation => [:count, :avg, :max, :min, :histogram],\n :gt => Numeric\n }\n #convert string values of keys to symbols and then load it into defaults\n ret = defaults.merge(opts.inject({}){|hsh,(k,v)| hsh[k.to_sym] = v; hsh}) \n #TODO the below is poorly executed, there's gotta be a better way to do this\n #TODO check all the geo data to make sure it exists/it's sanitary\n #check the type\n ret[:type] = check_allowed_param(defaults[:type], allowed_options[:type], ret[:type]) \n #check the report\n ret[:report] = check_allowed_param(defaults[:report], allowed_options[:report], ret[:report])\n #check the time\n ret[:time] = check_allowed_param(defaults[:time], allowed_options[:time], ret[:time])\n #check the operation,\n ret[:operation] = check_allowed_param(defaults[:operation], allowed_options[:operation], ret[:operation])\n ret[:gt] = check_allowed_param(defaults[:gt], allowed_options[:gt], ret[:gt])\n ret\n end",
"def apply_query_methods(relation, params, only = nil)\n # Simple options\n # Add the limit option (numeric value).\n relation = relation.limit(params[:limit]) if (only.nil? || only.include?(:limit)) && params[:limit].present?\n # Add the offset option (numeric value).\n relation = relation.offset(params[:offset]) if (only.nil? || only.include?(:offset)) && params[:offset].present?\n # Add the distinct (previously uniq) option (boolean value).\n relation = relation.distinct(params[:distinct]) if (only.nil? || only.include?(:distinct)) && params[:distinct].present?\n\n # Conditions\n # Build and apply the where conditions.\n relation = build_and_apply_conditions(relation, :where, params[:where]) if (only.nil? || only.include?(:where)) && params[:where].present?\n # Build and apply the having conditions.\n if (only.nil? || only.include?(:having)) && params[:having].present?\n relation = build_and_apply_conditions(relation, :having, params[:having])\n # relation the database columns used in the having clause to the group clause or else an exception will occur.\n having_columns = params[:having].select { |column, value| value.present? }.keys\n relation = relation.group('id') if having_columns.present?\n end\n\n # Associations\n # Add the eager_load option (string value).\n relation = relation.eager_load(*params[:eager_load]) if (only.nil? || only.include?(:eager_load)) && params[:eager_load].present? # We only test the list argument type were we supply a list of strings. This is equivalent to calling the method with a single, list or array of strings/symbols.\n # Add the includes option (string value).\n relation = relation.includes(*params[:includes]) if (only.nil? || only.include?(:includes)) && params[:includes].present? # We only test the list argument type were we supply a list of strings. This is equivalent to calling the method with a single, list or array of strings/symbols.\n # Add the joins option (string value).\n relation = relation.joins(*params[:joins].map(&:to_sym)) if (only.nil? || only.include?(:joins)) && params[:joins].present? # We only test the list argument type were we supply a list of symbols (since strings are used as plain SQL and thus we know this is not safe). This is equivalent to calling the method with a single, list or array of symbols.\n # Add the preload option (string value).\n relation = relation.preload(*params[:preload]) if (only.nil? || only.include?(:preload)) && params[:preload].present? # We only test the list argument type were we supply a list of strings. This is equivalent to calling the method with a single, list or array of strings/symbols.\n\n # Others\n params[:create_with] = params[:create_with].reject { |k,v| v.blank? } # Remove blank values, so create_with will not be unnecessary set.\n relation = relation.create_with(params[:create_with]) if (only.nil? || only.include?(:create_with)) && params[:create_with].present?\n\n relation\n end",
"def extract_conditions!(options = {})\n order = normalize_order(options.delete(:order))\n limit = options.delete(:limit)\n offset = options.delete(:offset)\n conditions = options.delete(:conditions) || options\n\n [conditions, order, limit, offset]\n end",
"def query(*conditions)\n filters = (conditions + @mapping.conditions).compact.join(\" and \")\n filters = \" where #{filters}\" unless filters.empty?\n\n \"select #{lookups} from #{@record_type}#{filters}\"\n end",
"def parse_paging_options(options, default_opts = {})\n if default_opts.blank?\n # This conditions will order records by directory and name first.\n default_opts = {\n :sort_criteria => \"curriculums.created_at DESC\"\n }\n end\n paging_options(options, default_opts)\n end",
"def set_matters_revenue_conditions(conditions_hash)\n search = \"company_id = :company_id \"\n if params[:date_selected]\n conditions_hash[:start_date] = params[:date_start].to_time\n conditions_hash[:end_date] = params[:date_end].to_time + (23.9*60*60)\n end\n search += \" AND matter_type_id = :matter_type_id\" unless params[:report][:summarize_by].blank?\n search += \" AND created_at Between :date_start AND :date_end \" if params[:date_selected].eql?(\"1\")\n\n search\n end",
"def find_options_for_visible(options={})\n {:conditions => [\"reputations.status IN (?)\", ['active', 'cashed']]}.merge_finder_options(options)\n end",
"def criteria\n @criteria ||= _association.criteria(_base)\n end",
"def apply_conditions(query, conditions)\n conditions.each do |condition|\n query = apply_condition(query, condition)\n end\n query\n end",
"def where(conditions = {})\n conditions.each_pair do |property, value|\n @options[\"?#{property}\"] = value\n end\n self\n end",
"def build_find_params(options)\n keyconditions = []\n keyparameters = []\n parameters = []\n includes = []\n joins = []\n\n # Build SQL WHERE clause using the AST\n sql = @ast.to_sql(self, definition) do |notification, value|\n\n # Handle the notifications encountered during the SQL generation:\n # Store the parameters, includes, etc so that they can be added to\n # the find-hash later on.\n case notification\n when :keycondition then keyconditions << value\n when :keyparameter then keyparameters << value\n when :parameter then parameters << value\n when :include then includes << value\n when :joins then joins << value\n else raise ScopedSearch::QueryNotSupported, \"Cannot handle #{notification.inspect}: #{value.inspect}\"\n end\n end\n # Build SQL ORDER BY clause\n order = order_by(options[:order]) do |notification, value|\n case notification\n when :parameter then parameters << value\n when :include then includes << value\n when :joins then joins << value\n else raise ScopedSearch::QueryNotSupported, \"Cannot handle #{notification.inspect}: #{value.inspect}\"\n end\n end\n sql = (keyconditions + (sql.blank? ? [] : [sql]) ).map {|c| \"(#{c})\"}.join(\" AND \")\n # Build hash for ActiveRecord::Base#find for the named scope\n find_attributes = {}\n find_attributes[:conditions] = [sql] + keyparameters + parameters unless sql.blank?\n find_attributes[:include] = includes.uniq unless includes.empty?\n find_attributes[:joins] = joins.uniq unless joins.empty?\n find_attributes[:order] = order unless order.nil?\n\n # p find_attributes # Uncomment for debugging\n return find_attributes\n end",
"def update!(**args)\n @exclude_conditions = args[:exclude_conditions] if args.key?(:exclude_conditions)\n @include_conditions = args[:include_conditions] if args.key?(:include_conditions)\n end",
"def agregate_order_by(params, options)\n case params[:order_by].to_s\n when \"direction\" then\n order_by = \"destinations.direction_code\"\n when \"destination\" then\n order_by = \"destinations.name\"\n when \"customer_orig\" then\n order_by = \"nice_user\"\n when \"customer_term\" then\n order_by = \"terminators.name\"\n when \"billed_orig\" then\n order_by = \"originating_billed\"\n when \"billed_term\" then\n order_by = \"terminating_billed\"\n when \"billsec_orig\" then\n order_by = \"originating_billsec\"\n when \"billsec_term\" then\n order_by = \"terminating_billsec\"\n when \"duration\" then\n order_by = \"duration\"\n when \"answered_calls\" then\n order_by = \"answered_calls\"\n when \"total_calls\" then\n order_by = \"total_calls\"\n when \"asr\" then\n order_by = \"asr\"\n when \"acd\" then\n order_by = \"acd\"\n else\n options[:order_by] ? order_by = options[:order_by] : order_by = \"\"\n end\n\n without = order_by\n order_by = \"users.first_name \" + (options[:order_desc] == 1 ? \"DESC\" : \"ASC\") + \", users.last_name\" if order_by.to_s == \"users.first_name\"\n order_by = \"ds.direction_code \" + (options[:order_desc] == 1 ? \"DESC\" : \"ASC\") + \", ds.name\" if order_by.to_s == \"destinations.name\"\n order_by = \"ds.direction_code \" + (options[:order_desc] == 1 ? \"DESC\" : \"ASC\") + \", ds.subcode\" if order_by.to_s == \"destinations.name\"\n order_by = \"t.name\" if order_by.to_s == \"terminators.name\"\n\n order_by += \" ASC\" if options[:order_desc] == 0 and order_by != \"\"\n order_by += \" DESC\" if options[:order_desc] == 1 and order_by != \"\"\n return without, order_by\n end",
"def apply_limit\n @query = @query.limit(@options[:limit])\n end",
"def sort_by(options)\n self.sort = options\n end",
"def add_adv_search_clauses(solr_parameters)\n return if search_state.clause_params.blank?\n\n defaults = { must: [], must_not: [], should: [] }\n default_op = blacklight_params[:op]&.to_sym || :must\n solr_parameters[:mm] = 1 if default_op == :should && search_state.clause_params.values.any? { |clause| }\n\n search_state.clause_params.each_value do |clause|\n op, query = adv_search_clause(clause, default_op)\n next unless defaults.key?(op)\n\n solr_parameters.append_boolean_query(op, query)\n end\n end",
"def filter_by_associations_add_conditions?\n super || self[:order] || self[:eager_limit_strategy] || self[:filter_limit_strategy]\n end",
"def parse_paging_options(options, default_opts = {})\n if default_opts.blank?\n # This conditions will order records by directory and name first.\n default_opts = {\n :sort_criteria => \"due_date ASC\"\n }\n end\n paging_options(options, default_opts)\n end",
"def method_missing(method_id, *arguments)\n if match = /find_(all_by|by)_([_a-zA-Z]\\w*)/.match(method_id.to_s)\n finder = determine_finder(match)\n\n facets = extract_attribute_names_from_match(match)\n super unless all_attributes_exists?(facets)\n\n #Overrride facets to use appropriate attribute name for current locale\n facets.collect! {|attr_name| respond_to?(:globalize_facets) && globalize_facets.include?(attr_name.intern) ? localized_facet(attr_name) : attr_name}\n\n attributes = construct_attributes_from_arguments(facets, arguments)\n\n case extra_options = arguments[facets.size]\n when nil\n options = { :conditions => attributes }\n set_readonly_option!(options)\n ActiveSupport::Deprecation.silence { send(finder, options) }\n\n when Hash\n finder_options = extra_options.merge(:conditions => attributes)\n validate_find_options(finder_options)\n set_readonly_option!(finder_options)\n\n if extra_options[:conditions]\n with_scope(:find => { :conditions => extra_options[:conditions] }) do\n ActiveSupport::Deprecation.silence { send(finder, finder_options) }\n end\n else\n ActiveSupport::Deprecation.silence { send(finder, finder_options) }\n end\n\n else\n raise ArgumentError, \"Unrecognized arguments for #{method_id}: #{extra_options.inspect}\"\n end\n elsif match = /find_or_(initialize|create)_by_([_a-zA-Z]\\w*)/.match(method_id.to_s)\n instantiator = determine_instantiator(match)\n facets = extract_attribute_names_from_match(match)\n super unless all_attributes_exists?(facets)\n\n if arguments[0].is_a?(Hash)\n attributes = arguments[0].with_indifferent_access\n find_attributes = attributes.slice(*facets)\n else\n find_attributes = attributes = construct_attributes_from_arguments(facets, arguments)\n end\n options = { :conditions => find_attributes }\n set_readonly_option!(options)\n\n find_initial(options) || send(instantiator, attributes)\n else\n super\n end\n end",
"def extract_conditions!(options = {})\n order = normalize_order(options.delete(:order))\n limit = options.delete(:limit)\n offset = options.delete(:offset)\n conditions = options.delete(:conditions) || options\n\n [conditions, order, limit, offset]\n end",
"def update!(**args)\n @custom_property_filter = args[:custom_property_filter] if args.key?(:custom_property_filter)\n @custom_weights_metadata = args[:custom_weights_metadata] if args.key?(:custom_weights_metadata)\n @document_creator_filter = args[:document_creator_filter] if args.key?(:document_creator_filter)\n @document_name_filter = args[:document_name_filter] if args.key?(:document_name_filter)\n @document_schema_names = args[:document_schema_names] if args.key?(:document_schema_names)\n @file_type_filter = args[:file_type_filter] if args.key?(:file_type_filter)\n @folder_name_filter = args[:folder_name_filter] if args.key?(:folder_name_filter)\n @is_nl_query = args[:is_nl_query] if args.key?(:is_nl_query)\n @property_filter = args[:property_filter] if args.key?(:property_filter)\n @query = args[:query] if args.key?(:query)\n @query_context = args[:query_context] if args.key?(:query_context)\n @time_filters = args[:time_filters] if args.key?(:time_filters)\n end",
"def do_search(params)\n\n # This first section sets up basic search parameters based on what was requested.\n\n format = params[:format].present? ? params[:format] : 'none'\n\n order = params[:order].present? ? {field: params[:order].split[0], direction: params[:order].split[1]} : {}\n limit = params[:limit].present? ? params[:limit].to_i : 50\n page = params[:limit] ? (params[:offset].to_i / params[:limit].to_i) + 1 : 1\n s_op = params[:op].present? ? params[:op] : 'AND'\n role = params[:role].present? ? params[:role] : 'guest'\n\n linking_tool = params[:linking_tool].present?\n\n options = options_for_search(params)\n\n reviewed = params[:reviewed] && params[:reviewed] == \"1\" ? false : nil\n\n # Each model has a custom version of these functions (and a list of valid fields) to permit only the\n # appropriate search fields for each model. \n\n # \"Params\" are any fulltext fields\n # \"Filters\" are all non-fulltext fields (numbers, booleans, exact string matches)\n # \"Dates\" are specifically for fields that need to allow date comparison\n\n filters = filters_for_search(params)\n dates = dates_for_search(params)\n params = params_for_search(params)\n \n s = self.search do\n \n # Fulltext search is defined as a lambda function, since it needs to be able to be combined with non-fulltext\n # search options as the user decides.\n\n fulltext_search = lambda { |p, o| \n if params.present?\n p.each do |field, value|\n\n # Since there are unlimited rows for the advanced search, the user can submit multiple values for the same field\n # i.e. \"Title\" for an Entry could be \"Bible\" and \"Book\" separately. So, they are iterated over:\n\n value = Array(value)\n if value.kind_of? Array\n value.each do |v|\n\n # Each search field can also be qualified in various ways\n\n op = Array(options[field + \"_option\"]).shift\n \n # If searching for this 'without' the term, right now just add a '-' to the beginning of query to negate it\n \n if op && op == 'does not contain'\n fulltext \"-\" + v.gsub(' ', '+'), :fields => [field]\n elsif op && op == 'blank'\n with field.gsub('_search', ''), nil\n elsif op && op == 'not blank'\n without field.gsub('_search', ''), nil\n elsif op && op == 'before'\n with(field).less_than v\n elsif op && op == 'after'\n with(field).greater_than v\n else\n fulltext v, :fields => [field]\n end\n end\n end\n end\n end\n }\n\n if not reviewed.nil?\n with :reviewed, false\n end\n\n # The same process for exact-match fields, but this time the search is being run and narrowed (i.e. it is not\n # using a lambda function)\n\n if filters.present?\n filters.each do |field, value|\n value = Array(value)\n value.each do |v|\n op = Array(options[field + \"_option\"]).shift\n if op && op == 'blank'\n with field, nil\n elsif op && op == 'not blank'\n without field, nil\n elsif v.blank? # ignore blank\n elsif op && op == 'less than'\n with(field).less_than v\n elsif op && op == 'greater than'\n with(field).greater_than v\n elsif op && op == 'without'\n without field, v\n elsif v.kind_of?(Array) && v.all? { |v2| v2.blank? } # make sure it's not an array of blanks \n else\n if ['true', 'false'].include? v\n v = (v == 'true')\n end\n with field, v\n end\n end\n end\n end\n\n # The same process for Dates, but with different interpretations of the search field options to correspond\n # with date-based searching\n\n if dates.present?\n dates.each do |field, value|\n value = Array(value)\n value.each do |v|\n v = v.split(/[-\\/]/).join(\"\").ljust(8, '01')\n op = Array(options[field + \"_option\"]).shift\n begin\n if op && op == 'before'\n with(field).between(Date.new(0,1,1)..Date.parse(v))\n elsif op && op == 'after'\n with(field).between(Date.parse(v)..Date.today)\n elsif op && op == 'near'\n d = Date.parse(v)\n with(field).between((d - 1.month)..(d + 1.month))\n elsif op && op == 'exact'\n with(field, v)\n end\n rescue ArgumentError\n @error = \"Error in Date Search - please use format YYYY/MM/DD or similar\"\n end\n end\n end\n end\n\n # In order to use SUNSPOT'S 'and'/'or' options together with non-fulltext fields,\n # we create a lambda function for fulltext searching (above)\n\n # ( This may be an idiosycracy of Sunspot only, but that is the reason for this roundabout approach ) \n\n if s_op == 'OR'\n any do\n fulltext_search.call(params, options)\n end\n else\n all do\n fulltext_search.call(params, options)\n end\n end\n\n # Unfortunately, sunspot does not natively support MIXING fulltext and exact searches using the \"OR\" operator \n # - so we do that manually\n # \n # params[:fq] refer to 'filter queries', or queries that refer to a fixed set of objects (exact strings, numbers, etc.)\n # params[:q] refers to fulltext queries\n\n # What this block of code does is check whether the 'OR' operator is used, and if it has been added by sunspot correctly\n # to the Solr query - if not, it is added in the proper place\n\n adjust_solr_params do |params|\n new_q = []\n p_fq = []\n params[:fq].each do |fq|\n if not fq.include? \"type\"\n new_q.push('_query_:\"{!edismax} ' + fq + '\"')\n else\n p_fq.push(fq)\n end\n end\n params[:fq] = p_fq\n if params[:q].blank?\n # nothing here...\n elsif not params[:q].include? s_op\n params[:q] = '(_query_:\"{!edismax qf=\\'' + params[:qf] + '\\'}' + params[:q].gsub('\"', '\\\"') + '\")'\n params.delete(:qf)\n end\n if params[:q].blank?\n if new_q.length > 0\n params[:q] = new_q.join(\" #{s_op} \")\n else\n params[:q] = \"*\"\n end\n else\n params[:q] = ([params[:q]] + new_q).join(\" #{s_op} \")\n end\n if linking_tool\n # NOTE: remove 'approved' thing here to make unapproved records show up in linking tool...\n params[:q] = '(' + params[:q] + ') AND (_query_:\"{!edismax qf=\\'deprecated\\'}false\") AND (_query_:\"{!edismax qf=\\'draft\\'}false\")'\n elsif role != \"admin\" && self.model_name.to_s == 'Entry'\n params[:q] = '(' + params[:q] + ') AND (_query_:\"{!edismax qf=\\'draft\\'}false\")'\n end\n end\n\n # Finally, page number, count and order_by field are accounted for, and the search results are returned\n\n paginate :per_page => limit, :page => page\n\n order.present? ? order_by(order[:field], order[:direction]) : order_by(:score, :desc)\n\n end\n\n return s\n end",
"def criterion_list searchable_attr = {}, formats ={}, criteria = {}\n\n searchable_attr.each{|attr|\n criterion_key = attr_2_criterion_sym(attr)\n #operator_key = attr_2_operator(attr)\n if params[criterion_key] then\n if not params[criterion_key].blank? then\n if criterion_key.to_s.ends_with?('_date') || criterion_key.to_s.ends_with?('_at') then\n # This is a bit shakey: duck programming at its \"best\" providing you know ath all date attributes must end with \"_date\"\n #criteria[attr] = DateTime.strptime(params[criterion_key], ((formats[criterion_key].nil?)?t($DF + \"default\") : t(formats[criterion_key])))\n criteria[attr] = DateTime.strptime(params[criterion_key], ((formats[criterion_key].nil?)?$DATE_TRANSFER_FORMAT : t(formats[criterion_key])))\n else\n criteria[attr] =params[criterion_key]\n end\n #else\n \n \n end # not blank\n end \n }\n return criteria\n end",
"def appctrl_search_sort_and_paginate( model, options = {} )\n base_obj = options.delete( :base_obj ) || model\n method = options.delete( :method ) || :all\n includes = options.delete( :include ) || {}\n default_sorting = options.delete( :default_sorting ) || { 'down' => '', 'field' => 'name' }\n always_sort_by = options.delete( :always_sort_by )\n extra_conditions = options.delete( :extra_conditions )\n is_translatable = model.respond_to?( :columns_for_translation )\n\n # We use a 'tableized' model name for the preferences key so that subclass\n # models work OK - e.g. \"Auditer\", a subclass of \"Audit\".\n\n appctrl_apply_sorting_preferences( default_sorting, model.model_name.tableize )\n\n # Build search conditions and merge with caller-supplied extra conditions.\n\n search_query = appctrl_build_search_conditions( model ) do | column |\n if block_given?\n yield( column )\n else\n nil\n end\n end\n\n @search_results = ! search_query.flatten.join.empty?\n\n unless ( extra_conditions.nil? )\n str = search_query[ 0 ]\n\n if ( str.empty? )\n str = extra_conditions[ 0 ]\n else\n str = \"( #{ extra_conditions[ 0 ] } ) AND ( #{ str } )\"\n end\n\n search_values = search_query[ 1..-1 ] || []\n extra_values = extra_conditions[ 1..-1 ] || []\n\n search_query = [ str ] + extra_values + search_values\n end\n\n # Compile the pagination options based on the above data and fetch the\n # relevant item list. Note that the column name for sorting may need to\n # be patched up if the model supports translatable columns, so do this\n # in passing.\n\n sort_params = params[ :sort ]\n\n if ( is_translatable && ! sort_params.nil? )\n column = sort_params[ 'field' ]\n\n # The user may have sorted on this column with language settings for a\n # particular locale, causing the locale-specific name to be saved in the\n # user's preferences. If the locale configuration later changes - e.g.\n # user changes languages or a new translation is added which better\n # matches the user's specified language - the code would then fail as it\n # would try to access a sorting column which didn't match the name based\n # on the new current locale. Thus, convert the column name to a locale\n # netural form, then get the definitely-for-this-locale version.\n\n unless ( column.nil? )\n column = model.untranslated_column( column ) # Make locale neutral...\n column = model.translated_column( column ) # ...then match current locale\n\n sort_params[ 'field' ] = column\n end\n end\n\n pagination_options = model.sort_by( sort_params )\n\n unless ( always_sort_by.nil? )\n order = pagination_options[ :order ] || ''\n\n unless ( order.include? always_sort_by )\n order += ', ' unless order.blank?\n pagination_options[ :order ] = order + always_sort_by\n end\n end\n\n pagination_options.merge!( {\n :page => params[ :page ],\n :conditions => search_query,\n :include => includes\n } )\n\n if ( method == :all )\n @items = base_obj.paginate( pagination_options )\n elsif ( options.has_key?( :method_arg ) )\n @items = base_obj.send( method, options.delete( :method_arg ) ).paginate( pagination_options )\n else\n @items = base_obj.send( method ).paginate( pagination_options )\n end\n\n # Render the default index.html.erb view for normal requests or, for AJAX\n # requests, render the list table partial.\n\n if ( request.xhr? )\n return render( :partial => \"#{ model.model_name.tableize }/list\" )\n end\n end",
"def update!(**args)\n @data_source_restrictions = args[:data_source_restrictions] if args.key?(:data_source_restrictions)\n @facet_options = args[:facet_options] if args.key?(:facet_options)\n @page_size = args[:page_size] if args.key?(:page_size)\n @query = args[:query] if args.key?(:query)\n @query_interpretation_options = args[:query_interpretation_options] if args.key?(:query_interpretation_options)\n @request_options = args[:request_options] if args.key?(:request_options)\n @sort_options = args[:sort_options] if args.key?(:sort_options)\n @start = args[:start] if args.key?(:start)\n end",
"def add_searchlogic_defaults!(options)\n options[:params_scope] = :search unless options.has_key?(:params_scope)\n options[:search_obj] ||= instance_variable_get(\"@#{options[:params_scope]}\")\n raise(ArgumentError, \"@search object could not be inferred, please specify: :search_obj => @search or :params_scope => :search_obj_name\") unless options[:search_obj].is_a?(Searchlogic::Search::Base)\n options\n end",
"def apply_dataset_options(type, request, ds)\n ds = apply_filter(type, request, ds)\n if order = order_for(type, request)\n ds = ds.order(*order)\n end\n if eager = eager_for(type, request)\n ds = ds.eager(eager)\n end\n if eager_graph = eager_graph_for(type, request)\n ds = ds.eager_graph(eager_graph)\n end\n ds\n end",
"def build_conditions!(options = {}, &block)\n conditions = @reflection.klass.build_conditions!(options, &block)\n conditions.scope = scope(:find)[:conditions]\n conditions\n end",
"def update!(**args)\n @conditions = args[:conditions] if args.key?(:conditions)\n @coverage_percentage = args[:coverage_percentage] if args.key?(:coverage_percentage)\n @criterion_name = args[:criterion_name] if args.key?(:criterion_name)\n end",
"def find_options_for_query(query, options={})\n find_options_for_find_by_query(query, find_by_query_columns, options)\n end",
"def build_conditions(options = {}, &block)\n conditions = @reflection.klass.build_conditions(options, &block)\n conditions.scope = scope(:find)[:conditions]\n conditions\n end",
"def process_criteria_array(criteria, options = {})\n initiate_criteria(options)\n \n criteria.delete_if{|c| (c[2].blank? or c[2]==@skip_value or c[2] == nil)}\n \n criteria.each do |c|\n create_sql(c[0], c[1], c[2].class == Array)\n @final_conditions.push c[2]\n end\n \n finalize_criteria(options)\n end",
"def conditions_to_fields(conditions); end",
"def apply!(collection, value:, active_sorts_hash:, params: {})\n if type == :scope\n if active_sorts_hash.keys.include?(param)\n collection.public_send(internal_name, *mapped_scope_params(active_sorts_hash[param], params))\n elsif default.present?\n # Stubbed because currently Sift::Sort does not respect default\n # default.call(collection)\n collection\n else\n collection\n end\n elsif type == :string || type == :text\n if active_sorts_hash.keys.include?(param)\n collection.order(\"LOWER(#{internal_name}) #{individual_sort_hash(active_sorts_hash)[internal_name]}\")\n else\n collection\n end\n else\n collection.order(individual_sort_hash(active_sorts_hash))\n end\n end",
"def list(options={})\n listings = self\n options.each_pair do |key, value|\n if !value.blank? and (self.column_names.include?key.to_s or self.reflections.keys.include?key.to_sym)\n listings = listings.send(\"where_#{key.to_s}\".to_sym, value) \n end\n end\n return Post.with_pagination ? listings.paginate(:page => options[:page], :per_page => options[:per_page]) : listings.all\n end",
"def initialize(criteria, options={})\n @criteria = parse(criteria).freeze\n @options = options.freeze\n end"
] | [
"0.8088539",
"0.70572263",
"0.6368393",
"0.63588494",
"0.6208496",
"0.6161933",
"0.6133352",
"0.60946697",
"0.6013391",
"0.58840793",
"0.5879875",
"0.5849001",
"0.5837559",
"0.58297706",
"0.58201605",
"0.5810793",
"0.5763901",
"0.5757591",
"0.5730743",
"0.5725456",
"0.57129854",
"0.5687034",
"0.56699485",
"0.5645463",
"0.564071",
"0.56295913",
"0.56216955",
"0.56213564",
"0.5601807",
"0.55972654",
"0.5575006",
"0.55527496",
"0.55507934",
"0.5538355",
"0.55209583",
"0.55160666",
"0.5504424",
"0.54962665",
"0.54810935",
"0.547962",
"0.54700047",
"0.54506147",
"0.5449224",
"0.5429278",
"0.54236484",
"0.53958946",
"0.5393573",
"0.53811",
"0.53678596",
"0.53640044",
"0.5361069",
"0.53574014",
"0.5352348",
"0.5347576",
"0.5338996",
"0.53308403",
"0.5327486",
"0.53264606",
"0.5323",
"0.53123283",
"0.53037506",
"0.5295514",
"0.5276943",
"0.52649593",
"0.5244354",
"0.52420336",
"0.5240726",
"0.52355343",
"0.523176",
"0.5230367",
"0.5216428",
"0.52102655",
"0.5206955",
"0.5205908",
"0.5203911",
"0.52018",
"0.5189566",
"0.5183957",
"0.51726085",
"0.5163955",
"0.5161866",
"0.51614237",
"0.5160972",
"0.51566166",
"0.51545024",
"0.5153862",
"0.5148103",
"0.51455754",
"0.5141634",
"0.51398987",
"0.51344115",
"0.5133307",
"0.5133214",
"0.5132788",
"0.5128931",
"0.511378",
"0.51117474",
"0.5105222",
"0.5104379",
"0.50971127"
] | 0.88595235 | 0 |
GET /commonquestions GET /commonquestions.json | def index
@commonquestions = Commonquestion.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def questions\n self.class.get(\"/2.2/questions\", @options)\n end",
"def get_question_list\n json= RestClient.get(\"http://localhost:3000/questions\")\n JSON.parse(json)\n end",
"def get_questions\n items = get_items\n make_response(HttpStatus::OK, make_result_list(items))\nend",
"def check_questions\n response = Request.get_request(URL_QUESTION)\n questions = []\n if response.success?\n data = Request.manage_response(response)\n end\n data.each do |question|\n questions << Question.new(question)\n end\n questions\nend",
"def responses\n question=Question.find(params[:questionId])\n render :json=> question.response\n end",
"def index\n @question_categories = QuestionCategory.with_questions()\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @question_categories }\n end\n end",
"def index\n render json: @test_module.test_questions, status: :ok\n end",
"def index\n @questions = Question.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @questions }\n end\n end",
"def index\n @my_questions = MyQuestion.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @my_questions }\n end\n end",
"def questions\n # Get a list of questionnaires that belong to instances of the current race\n if @course\n questionnaire_ids = @course.questionnaire_ids\n elsif @instance\n questionnaire_ids = @instance.questionnaire_ids\n else\n questionnaire_ids = []\n end\n\n # Collect question_ids that are used in those questionnaires\n question_ids = Set.new\n Questionnaire.where(:id => questionnaire_ids).find_each do |questionnaire|\n question_ids.merge(questionnaire.question_ids)\n end\n\n @questions = Question.find(question_ids.to_a)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @questions.to_json }\n end\n end",
"def index\n if get_event\n @v1_questions = @event.questions\n render json: @v1_questions\n else\n @v1_questions = V1::Question.all\n render json: @v1_questions\n end\n end",
"def index\n params.require(:course)\n @questions = Course.find(params[:course]).questions.select {|q| q.answered == false}\n\n render json: @questions\n end",
"def index\n @api_v1_questions = Api::V1::Question.all\n end",
"def index\n @questions = Question.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @questions }\n end\n end",
"def commonquestion_params\n params.require(:commonquestion).permit(:commonquestion_id, :question_text, :options, :answer_option_number, :question_id, :parttype_id, :questiontype_id)\n end",
"def index\n url = @httpIp + '/pet.com/api/question/getAllQuestions'\n uri = URI(url)\n response = Net::HTTP.get(uri)\n # @questions = JSON.parse(response, object_class: OpenStruct)\n @questions = Kaminari.paginate_array(JSON.parse(response, object_class: OpenStruct)).page(params[:page]).per(7)\n end",
"def index\n if params[:aspect_id]\n @questions = Aspect.find(params[:aspect_id]).questions.all\n else\n @questions = Question.all\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @questions }\n end\n end",
"def show\n @critical_question = CriticalQuestion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @critical_question }\n end\n end",
"def my_scn\n\t if @questions.present?\n\t\t\t# response to the JSON\n\t\t\trender json: { success: true, \"questions\" => @questions.as_json('my_scn') }\n\t else\n\t render :json=> { success: false, message: \"Questions are not present\" },:status=> 203\n\t end\n\tend",
"def index\n find_questions\n end",
"def set_commonquestion\n @commonquestion = Commonquestion.find(params[:id])\n end",
"def index\n @questions = @subsection.questions.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @questions }\n end\n end",
"def show\n @question_category = QuestionCategory.with_questions(question_category_id: params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question_category }\n end\n end",
"def get_random\n @question = Question.get_random\n\n unless @question\n render json: { error: \"random question can't be found\" }.to_json, status: 404\n end\n end",
"def questions_list \n #render json: {status: 200, questions: Quiz.all, msg: \"Success.\"}\n render json: {status: 200, questions: Quiz.all.map{|que| [id: que.id, question: que.question, options: [que.opt1,que.opt2,que.opt3,que.opt4], answer: que.answer]}.flatten, msg: \"Success.\"}\n end",
"def index\n @questions = @questionable.questions\n end",
"def index\n render status: :ok, json: @simple_question_alternatives\n end",
"def show\n \n @dquestion = Dquestion.find(params[:id])\n session[:quest_id] = @dquestion.id\n @danswers = Danswer.where(dquestion_id: @dquestion.id)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: [@dtest, @dquestion] }\n end\n end",
"def show\n if @v1_question\n render json: @v1_question\n else\n render json: get_errors, status: :unprocessable_entity\n end\n end",
"def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question }\n end\n end",
"def get_one\n question_data = Question.new.get_one( params[:id] )\n return render json: question_data\n end",
"def fetch_question(uri)\n request = HTTParty.get(uri)\n response = JSON.parse(request.body).first\n question = response[\"question\"]\n if validate_question(question)\n response = \"Surprise Round! Instead of the question you were expecting, we'll ask you this. \\n\"\n new_uri = gather_uri()\n response += fetch_question(new_uri)\n end\n response = sanitize_question_response(response)\n response\nend",
"def index\n @survey_questions = SurveyQuestion.all\n render json: @survey_questions.to_json(include: {\n answer_options: {\n include: {\n chosen_answers: {}\n } \n }\n })\n end",
"def index\n @questions = @time_series.questions.sorted\n @datasets = @time_series.datasets.sorted\n add_common_options\n\n respond_to do |format|\n format.html\n format.js { render json: @questions}\n end\n end",
"def show\n render_json @question\n end",
"def new\n @question = Question.new\n @category = Category.new\n @sample = Question.all.pop\n @samples = @sample.kludgy_related_similar()\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question }\n end\n end",
"def show\n @cards_question = Cards::Question.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cards_question }\n end\n end",
"def index\n @survey_questions = get_survey_questions\n end",
"def index\n @survey_questions = get_survey_questions\n end",
"def index\n @questions = Question.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.json { render :text => @questions.to_json }\n format.xml { render :xml => @questions.to_xml }\n end\n end",
"def show\n @qa = Qa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :xml => @qa.to_json(:include => [:answer, :question]) }\n end\n end",
"def most_answers_questions\n\t\tquestions = Question.most_answers_questions\n\t\t#checking questions is present or not.\n\t\tif questions.present?\n \trender :json=> {success: true, \"question\" => questions.as_json(\"question_data\") }\n\t # render json: { success: true, response: @questions.map{ |f| QuestionSerializer.new(f).as_json( root: false ) } }\n\t else\n\t render :json=> { success: false, message: \"Questions are not present\" },:status=> 203\n\t end\n\tend",
"def show\n @my_question = MyQuestion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @my_question }\n end\n end",
"def index\n render_json(current_user.created_questions)\n end",
"def by_category_and_difficulty\n questions = Question.q_by_category(params[:category_id], params[:difficulty])\n # byebug\n # some method that returns questions based on params category_Id and difficulty\n render json: questions.to_json(\n :methods => :shuffle\n )\n end",
"def show\n if current_user == nil\n redirect_to home_login_url\n else\n @question = Question.where(:id => params[:id])[0]\n @user = User.where(:id => @question.user_id).first\n if @user == nil\n @user = User.where(:id => 15).first\n end\n @categories = @question.categories\n \n @sample = Question.all.pop\n @samples = @sample.kludgy_related_similar()\n @different_samples = sample.kludgy_related_other()\n\n # @followed = current_user.followed_questions.where(:question_id => params[:id]).size != 0\n #@followed_user = current_user.followed_users.where(:followed_user_id => @question.user_id).size != 0\n\n # @num_events = 0\n # @question.challenges.each { |challenge|\n # @num_events += challenge.events.length\n # }\n puts 'do we play by the same rules brah?'\n @q = @question\n if @q.nil?\n @resp_id = nil\n else\n @resp_id = @q.id\n @responses = ResponseTemplate.where(:item_id => @q.producible_id).where(:parent_id => nil)\n end\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question }\n end\n end\n end",
"def show\r\n @intern_question = InternQuestion.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @intern_question }\r\n end\r\n end",
"def getanswerable\n @the_question = Question.find(params[:id])\n @user_id = session[:user_id]\n if @the_question.user.id == @user_id\n render json: [{question: @the_question}]\n end\n end",
"def get_questions int_id\r\n @all_questions = Questionare.find_by_interview_id int_id\r\n end",
"def index\n #if we search throught questions by tags, for example:\n # localhost:3000/questions?tag=Action \n if params[:tag]\n @tag = Tag.find_or_initialize_by(name: params[:tag])\n @questions = @tag.questions.all.all_with_answer_counts.order('updated_at DESC')\n # curl -H \"Accept: application/json\" http://localhost:3000/questions\n respond_to do |format|\n format.html { render }\n format.json { render json: @questions }\n end\n else\n @questions = Question.all.all_with_answer_counts.order('updated_at DESC')\n respond_to do |format|\n format.html { render }\n format.json { render json: @questions }\n end\n end\n end",
"def create\n @commonquestion = Commonquestion.new(commonquestion_params)\n\n @commonquestion.question_id = params[:question_id]\n @commonquestion.parttype_id = params[:parttype_id]\n @commonquestion.questiontype_id = params[:questiontype_id]\n\n respond_to do |format|\n if @commonquestion.save\n format.html { redirect_to @commonquestion, notice: 'Commonquestion was successfully created.' }\n format.json { render :show, status: :created, location: @commonquestion }\n else\n format.html { render :new }\n format.json { render json: @commonquestion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @time_series_question = @time_series.questions.find(params[:id])\n @datasets = @time_series.datasets.sorted\n add_common_options\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @time_series_question }\n end\n end",
"def index\n @questions = Question.all \n @message = get_data[:message]\n @specialist_id = get_data[:specialist_id]\n @patient_id = get_data[:patient_id]\n end",
"def show\n @category_question = CategoryQuestion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @category_question }\n end\n end",
"def show\n @test_question = TestQuestion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @test_question }\n end\n end",
"def index\n @questions = Question.all\n end",
"def index\n @questions = Question.all\n end",
"def index\n @questions = Question.all\n end",
"def index\n @questions = Question.all\n end",
"def index\n @questions = Question.all\n end",
"def index\n @questions = Question.all\n end",
"def index\n @questions = Question.all\n end",
"def index\n @questions = Question.all\n end",
"def index\n @questions = Question.all\n end",
"def index\n @questions = Question.all\n end",
"def index\n @questions = Question.all\n end",
"def index\n @questions = Question.all\n end",
"def index\n @questions = Question.all\n end",
"def index\n @questions = Question.all\n end",
"def index\n @questions = Question.all\n end",
"def index\n @questions = Question.all\n end",
"def index\n @questions = Question.all\n end",
"def index\n @questions = Question.all\n end",
"def index\n @questions = Question.all\n end",
"def index\n @question_answers = Question::Answer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @question_answers }\n end\n end",
"def index\n @question_options = QuestionOption.find_all_by_question_id(@question.id)\n\n respond_to do |format|\n format.json { render :json => @question_options.to_json }\n format.xml { render :xml => @question_options.to_xml }\n end\n end",
"def index\n @dquestions = Dquestion.where(dtest_id: @dtest.id)\n #@dquestions = Dquestion.find_all_by_dtest_id(@dtest.id)\n\n #respond_to do |format|\n # format.html # index.html.erb\n # format.json { render json: [@dtest, @dquestion] }\n #end\n end",
"def get_questions(number)\n @questions_array = get_from_url(@questions_conn, QUESTIONS_OBTAINTION_KEY, {size: number})\n end",
"def show\n @question = current_node.questions.find(params[:id])\n @question.viewed!(request.remote_ip)\n @answers = (@question.answers.page params[:page]).order_by(current_order)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question }\n end\n end",
"def question(survey_id, page_id, question_id, options = {})\n response = self.class.get(\"/v3/surveys/#{survey_id}/pages/#{page_id}/questions/#{question_id}\", query: options)\n response.parsed_response\n end",
"def show\n @common = Common.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @common }\n end\n end",
"def questions\r\n return @questions \r\nend",
"def index\n @questions = @course.questions.all\n end",
"def index\n @questions = @course.questions.all\n end",
"def show\n @question = Question.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question }\n end\n end",
"def show\n @question = Question.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question }\n end\n end",
"def show\n @question = Question.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question }\n end\n end",
"def show\n @question = Question.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question }\n end\n end",
"def single_tag_questions\n\t# Listing the all the questions related to the tag\n\t\tquestions = Question.with_all_tags(params[:tag])\n\t\t#checking questions is present or not.\n\t\tif questions.present?\n \trender :json=> {success: true, \"question\" => questions.as_json(\"question_data\") }\n\t else\n\t render :json=> { success: false, message: \"Questions are not present\" },:status=> 203\n\t end\n\tend",
"def questions\n @pages.collect { |p| p.questions }.flatten\n end",
"def show\n @question_category = QuestionCategory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question_category }\n end\n end",
"def destroy\n @commonquestion.destroy\n respond_to do |format|\n format.html { redirect_to commonquestions_url, notice: 'Commonquestion was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def general_application_questions\n GENERAL_APPLICATION_QUESTIONS.reduce([]) do |arr, app_question|\n db_attr, prompt = app_question\n if self.send(\"app_ques_#{db_attr}\".to_sym)\n arr << { prompt: prompt + ':' }\n end\n arr\n end\n end",
"def get_questionnaires\n @get_questionnaires ||= questionnaire_service.search('context-type-value': get_use_context)\n end",
"def index\n @responses = @survey.responses\n @questions = Question.all\n end",
"def index\n @survey_question_items = SurveyQuestionItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @survey_question_items }\n end\n end",
"def index\n @questions = @page.questions.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @questions }\n end\n end",
"def show\n @question = Question.find(params[:id])\n\t@choice0 = @question.choices[0]\n\t@choice1 = @question.choices[1]\n#\t@comment0 = @choice0.comments.build(:choice_id => @choice0.id, :user_id => current_user.id)\n#\t@comment1 = @choice1.comments.build(:choice_id => @choice1.id, :user_id => current_user.id)\n#\t@comment0 = @choice0.comments.build()\n#\t@comment1 = @choice1.comments.build()\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question }\n end\n end",
"def show\n @base_question = BaseQuestion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @base_question }\n end\n end",
"def show\n @question = Question.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @question }\n end\n end"
] | [
"0.72750646",
"0.71509826",
"0.70095444",
"0.6462304",
"0.64283323",
"0.64195925",
"0.63508797",
"0.6302301",
"0.6289258",
"0.6273065",
"0.6269526",
"0.6268268",
"0.6259093",
"0.6258808",
"0.6236391",
"0.6234356",
"0.6164906",
"0.61386216",
"0.6108544",
"0.60882604",
"0.60879064",
"0.6058204",
"0.6057027",
"0.6040411",
"0.6040167",
"0.59814876",
"0.5968885",
"0.59459066",
"0.5944649",
"0.59390974",
"0.59351873",
"0.59327096",
"0.59307367",
"0.5929551",
"0.59283674",
"0.59274083",
"0.5912402",
"0.59073013",
"0.59073013",
"0.5896968",
"0.588845",
"0.587443",
"0.58720577",
"0.5864281",
"0.58636475",
"0.58590806",
"0.5856383",
"0.5840164",
"0.583367",
"0.583323",
"0.5818948",
"0.581716",
"0.5816368",
"0.5807228",
"0.57883376",
"0.5776875",
"0.5776875",
"0.5776875",
"0.5776875",
"0.5776875",
"0.5776875",
"0.5776875",
"0.5776875",
"0.5776875",
"0.5776875",
"0.5776875",
"0.5776875",
"0.5776875",
"0.5776875",
"0.5776875",
"0.5776875",
"0.5776875",
"0.5776875",
"0.5776875",
"0.5772468",
"0.5755442",
"0.5754778",
"0.5753371",
"0.5747456",
"0.5746842",
"0.5745051",
"0.57306176",
"0.5720089",
"0.5720089",
"0.57155263",
"0.571402",
"0.571402",
"0.571402",
"0.5713823",
"0.57120264",
"0.57112414",
"0.57090545",
"0.5707969",
"0.57053447",
"0.569713",
"0.5690431",
"0.56883407",
"0.5681295",
"0.56773746",
"0.56695825"
] | 0.7370706 | 0 |
GET /commonquestions/1 GET /commonquestions/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_question_list\n json= RestClient.get(\"http://localhost:3000/questions\")\n JSON.parse(json)\n end",
"def questions\n self.class.get(\"/2.2/questions\", @options)\n end",
"def index\n @commonquestions = Commonquestion.all\n end",
"def get_questions\n items = get_items\n make_response(HttpStatus::OK, make_result_list(items))\nend",
"def get_one\n question_data = Question.new.get_one( params[:id] )\n return render json: question_data\n end",
"def responses\n question=Question.find(params[:questionId])\n render :json=> question.response\n end",
"def index\n @api_v1_questions = Api::V1::Question.all\n end",
"def show\n if @v1_question\n render json: @v1_question\n else\n render json: get_errors, status: :unprocessable_entity\n end\n end",
"def show\n @critical_question = CriticalQuestion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @critical_question }\n end\n end",
"def index\n @questions = Question.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @questions }\n end\n end",
"def index\n render json: @test_module.test_questions, status: :ok\n end",
"def index\n @question_categories = QuestionCategory.with_questions()\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @question_categories }\n end\n end",
"def index\n @my_questions = MyQuestion.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @my_questions }\n end\n end",
"def index\n @questions = Question.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @questions }\n end\n end",
"def index\n if get_event\n @v1_questions = @event.questions\n render json: @v1_questions\n else\n @v1_questions = V1::Question.all\n render json: @v1_questions\n end\n end",
"def show\n @question_category = QuestionCategory.with_questions(question_category_id: params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question_category }\n end\n end",
"def check_questions\n response = Request.get_request(URL_QUESTION)\n questions = []\n if response.success?\n data = Request.manage_response(response)\n end\n data.each do |question|\n questions << Question.new(question)\n end\n questions\nend",
"def index\n if params[:aspect_id]\n @questions = Aspect.find(params[:aspect_id]).questions.all\n else\n @questions = Question.all\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @questions }\n end\n end",
"def show\n @my_question = MyQuestion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @my_question }\n end\n end",
"def show\r\n @intern_question = InternQuestion.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @intern_question }\r\n end\r\n end",
"def get_random\n @question = Question.get_random\n\n unless @question\n render json: { error: \"random question can't be found\" }.to_json, status: 404\n end\n end",
"def index\n url = @httpIp + '/pet.com/api/question/getAllQuestions'\n uri = URI(url)\n response = Net::HTTP.get(uri)\n # @questions = JSON.parse(response, object_class: OpenStruct)\n @questions = Kaminari.paginate_array(JSON.parse(response, object_class: OpenStruct)).page(params[:page]).per(7)\n end",
"def index\n params.require(:course)\n @questions = Course.find(params[:course]).questions.select {|q| q.answered == false}\n\n render json: @questions\n end",
"def questions\n # Get a list of questionnaires that belong to instances of the current race\n if @course\n questionnaire_ids = @course.questionnaire_ids\n elsif @instance\n questionnaire_ids = @instance.questionnaire_ids\n else\n questionnaire_ids = []\n end\n\n # Collect question_ids that are used in those questionnaires\n question_ids = Set.new\n Questionnaire.where(:id => questionnaire_ids).find_each do |questionnaire|\n question_ids.merge(questionnaire.question_ids)\n end\n\n @questions = Question.find(question_ids.to_a)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @questions.to_json }\n end\n end",
"def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question }\n end\n end",
"def show\n @test_question = TestQuestion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @test_question }\n end\n end",
"def show\n @base_question = BaseQuestion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @base_question }\n end\n end",
"def show\n @category_question = CategoryQuestion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @category_question }\n end\n end",
"def index\n @questions = @subsection.questions.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @questions }\n end\n end",
"def show\n @cards_question = Cards::Question.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cards_question }\n end\n end",
"def new\n @question = Question.new\n @category = Category.new\n @sample = Question.all.pop\n @samples = @sample.kludgy_related_similar()\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question }\n end\n end",
"def show\n @question = Question.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question }\n end\n end",
"def show\n @question = Question.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question }\n end\n end",
"def show\n @question = Question.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question }\n end\n end",
"def show\n @question = Question.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question }\n end\n end",
"def index\n find_questions\n end",
"def show\n \t\tquestion = Question.find(params[:id])\n \t\tputs \"QUESTION: #{question.name}\"\n \t\trender json: question\n \tend",
"def fetch_question(uri)\n request = HTTParty.get(uri)\n response = JSON.parse(request.body).first\n question = response[\"question\"]\n if validate_question(question)\n response = \"Surprise Round! Instead of the question you were expecting, we'll ask you this. \\n\"\n new_uri = gather_uri()\n response += fetch_question(new_uri)\n end\n response = sanitize_question_response(response)\n response\nend",
"def show\n @qa = Qa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :xml => @qa.to_json(:include => [:answer, :question]) }\n end\n end",
"def show\n render_json @question\n end",
"def get_questions int_id\r\n @all_questions = Questionare.find_by_interview_id int_id\r\n end",
"def show\n @question = Question.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @question }\n end\n end",
"def show\n @question = Question.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @question }\n end\n end",
"def show\n \n @dquestion = Dquestion.find(params[:id])\n session[:quest_id] = @dquestion.id\n @danswers = Danswer.where(dquestion_id: @dquestion.id)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: [@dtest, @dquestion] }\n end\n end",
"def index\n render status: :ok, json: @simple_question_alternatives\n end",
"def show\n @question_category = QuestionCategory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question_category }\n end\n end",
"def my_scn\n\t if @questions.present?\n\t\t\t# response to the JSON\n\t\t\trender json: { success: true, \"questions\" => @questions.as_json('my_scn') }\n\t else\n\t render :json=> { success: false, message: \"Questions are not present\" },:status=> 203\n\t end\n\tend",
"def index\n @questions = Question.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.json { render :text => @questions.to_json }\n format.xml { render :xml => @questions.to_xml }\n end\n end",
"def show\n @question = Question.find(params[:id])\n\t@choice0 = @question.choices[0]\n\t@choice1 = @question.choices[1]\n#\t@comment0 = @choice0.comments.build(:choice_id => @choice0.id, :user_id => current_user.id)\n#\t@comment1 = @choice1.comments.build(:choice_id => @choice1.id, :user_id => current_user.id)\n#\t@comment0 = @choice0.comments.build()\n#\t@comment1 = @choice1.comments.build()\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question }\n end\n end",
"def show\n @questionnaire = Questionnaire.find(params[:id])\n\n respond_to do |format|\n format.html\n format.json { render json: @questionnaire }\n end\n end",
"def set_commonquestion\n @commonquestion = Commonquestion.find(params[:id])\n end",
"def index\n @questions = @questionable.questions\n end",
"def show\n @question = current_node.questions.find(params[:id])\n @question.viewed!(request.remote_ip)\n @answers = (@question.answers.page params[:page]).order_by(current_order)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question }\n end\n end",
"def show\n @questions_option = QuestionsOption.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @questions_option }\n end\n end",
"def getanswerable\n @the_question = Question.find(params[:id])\n @user_id = session[:user_id]\n if @the_question.user.id == @user_id\n render json: [{question: @the_question}]\n end\n end",
"def show\n @form = Form.where(id: params[:id]).includes(:questions => :answers).first\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @form }\n end\n end",
"def new\n @knowledge_points = KnowledgePoint.all\n @question = Question.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @question }\n end\n end",
"def index\n render_json(current_user.created_questions)\n end",
"def by_category_and_difficulty\n questions = Question.q_by_category(params[:category_id], params[:difficulty])\n # byebug\n # some method that returns questions based on params category_Id and difficulty\n render json: questions.to_json(\n :methods => :shuffle\n )\n end",
"def question\n Question.find_by_id(questions_id)\n end",
"def show\n if current_user == nil\n redirect_to home_login_url\n else\n @question = Question.where(:id => params[:id])[0]\n @user = User.where(:id => @question.user_id).first\n if @user == nil\n @user = User.where(:id => 15).first\n end\n @categories = @question.categories\n \n @sample = Question.all.pop\n @samples = @sample.kludgy_related_similar()\n @different_samples = sample.kludgy_related_other()\n\n # @followed = current_user.followed_questions.where(:question_id => params[:id]).size != 0\n #@followed_user = current_user.followed_users.where(:followed_user_id => @question.user_id).size != 0\n\n # @num_events = 0\n # @question.challenges.each { |challenge|\n # @num_events += challenge.events.length\n # }\n puts 'do we play by the same rules brah?'\n @q = @question\n if @q.nil?\n @resp_id = nil\n else\n @resp_id = @q.id\n @responses = ResponseTemplate.where(:item_id => @q.producible_id).where(:parent_id => nil)\n end\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question }\n end\n end\n end",
"def get_questions(number)\n @questions_array = get_from_url(@questions_conn, QUESTIONS_OBTAINTION_KEY, {size: number})\n end",
"def show\n @poll_question = PollQuestion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @poll_question }\n end\n end",
"def questions_list \n #render json: {status: 200, questions: Quiz.all, msg: \"Success.\"}\n render json: {status: 200, questions: Quiz.all.map{|que| [id: que.id, question: que.question, options: [que.opt1,que.opt2,que.opt3,que.opt4], answer: que.answer]}.flatten, msg: \"Success.\"}\n end",
"def show\n authorize! :answer, @questionnaire\n\n respond_to do |format|\n format.html {\n @answer_set = AnswerSet.new()\n @answer_set.questionnaire_id = @questionnaire.id\n @answer_set.init_questionnaire(@questionnaire)\n }\n format.json { render :json => @questionnaire.questions.to_json }\n end\n end",
"def show\n @time_series_question = @time_series.questions.find(params[:id])\n @datasets = @time_series.datasets.sorted\n add_common_options\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @time_series_question }\n end\n end",
"def index\n @question_answers = Question::Answer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @question_answers }\n end\n end",
"def show\n @question_response = QuestionResponse.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question_response }\n end\n end",
"def show\n @questions = Question.find(params[:id])\n end",
"def show\n @questionnaire = Questionnaire.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @questionnaire }\n end\n end",
"def show\n @questionnaire = Questionnaire.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @questionnaire }\n end\n end",
"def show\n @questionset = Questionset.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @questionset }\n end\n end",
"def answer_a_question\n user = current_user\n render_401 and return unless user\n question = ShortQuestion.find_by_id(params[:id])\n render_404 and return unless question\n\n obj = {\n :qid => params[:id],\n :answer => params[:choice]\n }\n \n answers = {}\n $r.multi do\n $r.lpush(\"user:#{user.id}:questions\", obj)\n $r.hincrby(\"question:#{question.id}:answers\", \"choice#{params[:choice]}\", 1)\n choices = $r.hget(\"question:#{question.id}:answers\", :num_choices)\n for i in 1..choices\n answers[i] = $r.hget(\"question:#{question.id}:answers\", \"choice#{i}\")\n end\n end\n render :json => {\n :success => true,\n :answers => answers\n }\n end",
"def index\n @survey_questions = SurveyQuestion.all\n render json: @survey_questions.to_json(include: {\n answer_options: {\n include: {\n chosen_answers: {}\n } \n }\n })\n end",
"def show\n @survey_question = SurveyQuestion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n #format.json { render json: @survey_question }\n end\n end",
"def choose_question\n if params.dig(:assessment, :type).present? && params.dig(:assessment, :type_id).present?\n type = params[:assessment][:type].camelize.constantize.where(id: params[:assessment][:type_id]).first rescue ''\n if type.present?\n all_questions = fetch_all_questions(type)\n if all_questions.count > 0\n assessment_questions = Assessment.fetch_assessment_questions(all_questions.ids, current_user.id)\n render json: calculate_remaining_qusts(all_questions, assessment_questions).order(\"RANDOM()\").limit(2).select(:id, :content, :options)\n else\n render json: {'type': 'No data found for selected type'}\n end\n else\n render json: {'type': 'Invalid selected type or type id'}\n end\n else\n render json: {'Input': 'Invalid inputs'}\n end\n end",
"def index\n @survey_questions = get_survey_questions\n end",
"def index\n @survey_questions = get_survey_questions\n end",
"def index\n @question_options = QuestionOption.find_all_by_question_id(@question.id)\n\n respond_to do |format|\n format.json { render :json => @question_options.to_json }\n format.xml { render :xml => @question_options.to_xml }\n end\n end",
"def index\n @questions = Question.all \n @message = get_data[:message]\n @specialist_id = get_data[:specialist_id]\n @patient_id = get_data[:patient_id]\n end",
"def show\n @data_collection = DataCollection.find(params[:id])\n @questionnaires = @data_collection.questionnaires\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @data_collection }\n end\n end",
"def index\n @questions = Question.all\n end",
"def index\n @questions = Question.all\n end",
"def index\n @questions = Question.all\n end",
"def index\n @questions = Question.all\n end",
"def index\n @questions = Question.all\n end",
"def index\n @questions = Question.all\n end",
"def index\n @questions = Question.all\n end",
"def index\n @questions = Question.all\n end",
"def index\n @questions = Question.all\n end",
"def index\n @questions = Question.all\n end",
"def index\n @questions = Question.all\n end",
"def index\n @questions = Question.all\n end",
"def index\n @questions = Question.all\n end",
"def index\n @questions = Question.all\n end",
"def index\n @questions = Question.all\n end",
"def index\n @questions = Question.all\n end",
"def index\n @questions = Question.all\n end",
"def index\n @questions = Question.all\n end",
"def index\n @questions = Question.all\n end",
"def new\n @critical_question = CriticalQuestion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @critical_question }\n end\n end"
] | [
"0.7184319",
"0.71793646",
"0.7100766",
"0.686292",
"0.6730551",
"0.6579878",
"0.656613",
"0.6557363",
"0.65492606",
"0.6527257",
"0.65143925",
"0.6509181",
"0.6507267",
"0.64820874",
"0.6428335",
"0.638812",
"0.6345387",
"0.6337881",
"0.63206947",
"0.6283913",
"0.6269919",
"0.6265697",
"0.625889",
"0.623935",
"0.6219017",
"0.6203272",
"0.6203064",
"0.61982554",
"0.6196027",
"0.6190181",
"0.6185243",
"0.6177052",
"0.61756355",
"0.61756355",
"0.61756355",
"0.6172485",
"0.61680144",
"0.61655915",
"0.6158375",
"0.61565316",
"0.61388886",
"0.61291265",
"0.61291265",
"0.612482",
"0.6123059",
"0.6114538",
"0.6084808",
"0.60829365",
"0.6066685",
"0.60655886",
"0.6061127",
"0.6060954",
"0.60383993",
"0.603628",
"0.6024236",
"0.6022777",
"0.60115314",
"0.6011375",
"0.60084087",
"0.6002188",
"0.6001424",
"0.5995536",
"0.5978784",
"0.5977853",
"0.5973361",
"0.5972552",
"0.5965101",
"0.59621495",
"0.5948216",
"0.5947957",
"0.5947957",
"0.59360874",
"0.5935277",
"0.59340554",
"0.59327716",
"0.59294677",
"0.592573",
"0.592573",
"0.59215754",
"0.5917112",
"0.59161013",
"0.59160596",
"0.59160596",
"0.59160596",
"0.59160596",
"0.59160596",
"0.59160596",
"0.59160596",
"0.59160596",
"0.59160596",
"0.59160596",
"0.59160596",
"0.59160596",
"0.59160596",
"0.59160596",
"0.59160596",
"0.59160596",
"0.59160596",
"0.59160596",
"0.59160596",
"0.59148127"
] | 0.0 | -1 |
POST /commonquestions POST /commonquestions.json | def create
@commonquestion = Commonquestion.new(commonquestion_params)
@commonquestion.question_id = params[:question_id]
@commonquestion.parttype_id = params[:parttype_id]
@commonquestion.questiontype_id = params[:questiontype_id]
respond_to do |format|
if @commonquestion.save
format.html { redirect_to @commonquestion, notice: 'Commonquestion was successfully created.' }
format.json { render :show, status: :created, location: @commonquestion }
else
format.html { render :new }
format.json { render json: @commonquestion.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def commonquestion_params\n params.require(:commonquestion).permit(:commonquestion_id, :question_text, :options, :answer_option_number, :question_id, :parttype_id, :questiontype_id)\n end",
"def add_question\n\t\t\tif(current_instructor.quizzes.exists?(:id => params[:quiz_id]))\n\t\t\t\tquiz = current_instructor.quizzes.find(params[:quiz_id])\n\t\t\t\tno = quiz.no_of_MCQ + quiz.no_of_rearrangeQ\t\n\t\t\t\tno.times do |n|\n\t\t\t\t\tquestion = Question.create((params[\"_json\"][n]).permit([:text, :mark, :right_answer, :choices => []]))\n\t\t\t\t\tquiz.questions << question\n\t\t\t\tend\n\t\t\t\trender json: { info: \"created\"}, status: 201\n\t\t\telse\n\t\t\t\trender json: { error:\"Quiz is not found\" }, status: 422\n\t\t\tend\n\t\tend",
"def create\n @question = SurveyQuestion.new(question_params)\n if @question.save\n render json: @question\n else\n render json: @question.errors.full_messages.join(\", \"), status: :unprocessable_entity\n end\n end",
"def question_params\n params.require(:question).permit(:content, :response_type_id, :parent_id, :category_id, :groups,\n :version_independent_id, :description, :other_allowed, :subcategory_id,\n concepts_attributes: [:id, :value, :display_name, :code_system],\n data_collection_methods: [])\n end",
"def create\n @question = Question.new(question_params)\n\n if @question.save\n render json: @question\n else\n render status: 400, nothing: true\n end\n end",
"def create\n json = params[:survey]\n json[:questions] = JSON.parse(json[:questions])\n json[:questions].each_with_index do |question, idx|\n json[:questions][idx]['id'] = idx + 1\n end\n @survey = Survey.new(json)\n respond_to do |format|\n if @survey.save\n format.html { redirect_to @survey, notice: 'Survey was successfully created.' }\n format.json { render json: @survey, status: :created, location: @survey }\n else\n format.html { render action: \"new\" }\n format.json { render json: @survey.errors, status: :unprocessable_entity }\n end\n end\n end",
"def manage_question(body)\n upload_questions(JSON.parse(body)['questions'])\n get_questions\nend",
"def create\n # puts params\n questions = JSON.parse(params[:questions])\n q_hash = questions[\"questions\"]\n @assignment = Assignment.new\n @assignment.course_id = params[:course_id]\n @assignment.type = \"Homework\"\n @assignment.start_date = params[:start_date]\n @assignment.end_date = params[:end_date]\n @assignment.name = params[:name]\n # Following is the question hash\n q_hash.each do |key, value|\n a_hash = key[\"answers\"]\n question = key[\"question\"]\n puts question\n new_question = Question.new\n new_question.description = question\n new_question.type = \"MultipleChoice\"\n # Answer hash\n a_hash.each do |k,v|\n puts k[\"is_correct\"]\n puts k[\"description\"]\n new_answer = Answer.new\n new_answer.description = k[\"description\"]\n new_answer.is_correct = k[\"is_correct\"]\n new_question.association(:answers).add_to_target(new_answer)\n end\n @assignment.association(:questions).add_to_target(new_question)\n end\n \n if @assignment.save\n render :show, status: :created, location: @assignment\n else\n render json: @assignment.errors, status: :unprocessable_entity\n end\n end",
"def create\n @time_series_question = @time_series.questions.build(params[:time_series_question])\n\n respond_to do |format|\n if @time_series_question.save\n format.html { redirect_to time_series_question_path(@owner, @time_series, @time_series_question), flash: {success: t('app.msgs.success_created', :obj => t('mongoid.models.time_series_question.one'))} }\n format.json { render json: @time_series_question, status: :created, location: @time_series_question }\n else\n @datasets = @time_series.datasets.sorted\n\n # get the list of questions for each dataset in the time series that are not already in the time series\n @questions = {}\n @datasets.each do |dataset|\n @questions[ts_dataset.dataset_id.to_s] = ts_dataset.dataset.questions.for_analysis_not_in_codes(@time_series.questions.codes_for_dataset(dataset.dataset_id))\n end\n\n add_common_options\n\n @is_new = true\n\n format.html { render action: \"new\" }\n format.json { render json: @time_series_question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @question = Question.new(params[:question])\n\n respond_to do |format|\n if @question.save\n format.html { redirect_to api_v1_question_path(@question), notice: 'Question was successfully created.' }\n format.json { render json: @question, status: :created, location: @question }\n else\n format.html { render action: \"new\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_question\n form_param = params.require(:form).permit(:id)\n\n render json: Question.add_new_question(form_param)\n end",
"def question_params\n params.require(:question).permit(:title, :quest, :answer,:category)\n end",
"def question_params\n params.require(:question).permit(:title, :body)\n #require returns question array\n #of everything being posted, work with the questions part, and allow these two things to be submitted\n end",
"def create\n @mongo_question = MongoQuestion.new(mongo_question_params)\n @mongo_question.topics = params['mongo_question']['topics']\n respond_to do |format|\n if @mongo_question.save\n format.html { redirect_to @mongo_question, notice: 'Mongo question was successfully created.' }\n format.json { render :show, status: :created, location: @mongo_question }\n else\n format.html { render :new }\n format.json { render json: @mongo_question.errors, status: :unprocessable_entity }\n end\n end\n\n Question.create mongo_id: @mongo_question._id, registrant_id: current_registrant_id\n end",
"def create\n @v1_question = V1::Question.new(v1_question_params)\n\n if @v1_question.save\n render json: @v1_question, status: :created\n else\n render json: get_errors, status: :unprocessable_entity\n end\n end",
"def check_questions\n response = Request.get_request(URL_QUESTION)\n questions = []\n if response.success?\n data = Request.manage_response(response)\n end\n data.each do |question|\n questions << Question.new(question)\n end\n questions\nend",
"def create\n @test_question = TestQuestion.new(params[:test_question])\n\n respond_to do |format|\n if @test_question.save\n format.html { redirect_to @test_question, :notice => 'Test question was successfully created.' }\n format.json { render :json => @test_question, :status => :created, :location => @test_question }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @test_question.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def question_params\n params.require(:question).permit(:trivia_id, :quiz_id, :response, :is_correct)\n end",
"def create\n respond_to do |format|\n if @question.save\n @question_link = QuizQuestion.create!(:qtype => params[:qtype], :qid => @question.id, :quizid => params[:quizid], :points => params[:points])\n @question_link.save\n @question.update(:questionid => @question_link.id)\n @quiz = Quiz.find_by_id(params[:quizid])\n format.html { redirect_to admin_quiz_path(@quiz), notice: 'Quiz multiple choice question was successfully created.' }\n format.json { render :show, status: :created, location: @question }\n else\n format.html { render :new }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def question(data)\n xml = xml_root(\"questions\")\n\n arrayed(data).each do |name|\n xml.root << (XML::Node.new(\"question\") << name)\n end\n\n send_and_process('questions/add', 'questions/question', xml)\n end",
"def index\n @commonquestions = Commonquestion.all\n end",
"def create\n @critical_question = CriticalQuestion.new(params[:critical_question])\n\n respond_to do |format|\n if @critical_question.save\n format.html { redirect_to @critical_question, notice: 'Critical question was successfully created.' }\n format.json { render json: @critical_question, status: :created, location: @critical_question }\n else\n format.html { render action: \"new\" }\n format.json { render json: @critical_question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n \n respond_to do |format|\n \n if !params[:questions].nil? \n params[:questions].each {\n |q| \n type = Question.find_by_id(q[0]).question_type\n answer = (type == 2 ? Answer.find_by_id(q[1]).correct : nil)\n Response.new( \n {\n \"question_id\" => q[0],\n \"answer_id\" => type == 2 ? q[1] : nil,\n \"text\" => type == 1 ? q[1] : nil,\n \"user_id\" => current_user.id,\n \"question_group_id\" => params[:response][:question_group_id],\n \"correct\" => answer\n }\n ).save\n }\n format.html { redirect_to '/responses', notice: 'Your responses were successfully saved.' }\n else\n @response = Response.new(params[:response])\n if @response.save\n format.html { redirect_to @response, notice: 'Response was successfully created.' }\n format.json { render json: @response, status: :created, location: @response }\n end\n end\n end\n end",
"def create\n\t# Finding the current surgeon \n\tsurgeon = current_user\n\t# creating the question with current surgeon\n\tquestion = surgeon.questions.new(question_params)\n\tif question.save\n\t# response to the JSON\n\t\trender json: { success: true,message: \"Question Successfully Created.\", response: QuestionSerializer.new(question).as_json(root: false) },:status=>200\n else\n render :json=> { success: false, message: question.errors },:status=> 203\n end\n\tend",
"def question_params\n params.require(:question).permit(:question, :answer, :correct)\n end",
"def create\n @add_question = AddQuestion.new(add_question_params)\n\n respond_to do |format|\n if @add_question.save\n format.json { head :no_content }\n else\n format.html { render :new }\n format.json { render json: @add_question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n question = @current_user.question.create!(question_params)\n render json: { question: question }\n end",
"def question_params\n params.require(:question).permit(:question)\n end",
"def create\n workout = Workout.find params[:workout_id]\n result = Question.create(workout, { \n :body => params[:body], \n :answer_type => params[:answer_type] }, \n params[:answers].values\n )\n\n @question = result[:question]\n\n respond_to do |format|\n unless @question.persisted?\n format.json { render :json => @question.errors.full_messages, :status => :unprocessable_entity }\n else\n format.json { render :json => @question.as_json({:include => :answers}) }\n end\n \n end\n\n end",
"def create_mod\n if params[:title] != nil && params[:content] != nil && params[:subId] != nil && params[:userId] != nil && params[:groupId] != nil\n @question.title = params[:title]\n @question.content = params[:content]\n @question.subId = params[:subId].to_i\n @question.userId = params[:userId].to_i\n @question.groupId = params[:groupId].to_i\n\n question_json = @question.to_h.to_json\n\n url = @httpIp+'/pet.com/api/question/createQuestion'\n uri = URI(url)\n res = Net::HTTP.post(uri, question_json, \"Content-Type\" => \"application/json\")\n puts res.body\n flash[:notice] = \"successfully created\"\n redirect_to questions_path\n\n end\n end",
"def create\n @quiz = Quiz.new(quiz_params)\n questions_arr.each do |i|\n question = Question.new(question_params(i))\n choices_arr(i).each do |j|\n choice = Choice.new(choice_params(j))\n choice.save\n question.choices << choice\n end\n @quiz.questions << question\n end\n\n if @quiz.save\n User.find(params[:user_id]).quizzes << @quiz\n render json: @quiz, status: :created, location: @quiz\n else\n render json: @quiz.errors, status: :unprocessable_entity\n end\n end",
"def create\n @test_question = TestQuestion.new(test_question_params)\n\n respond_to do |format|\n if @test_question.save\n format.html { redirect_to @test_question, notice: 'Test question was successfully created.' }\n format.json { render :show, status: :created, location: @test_question }\n else\n format.html { render :new }\n format.json { render json: @test_question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @test_question = TestQuestion.new(test_question_params)\n\n respond_to do |format|\n if @test_question.save\n format.html { redirect_to @test_question, notice: 'Test question was successfully created.' }\n format.json { render :show, status: :created, location: @test_question }\n else\n format.html { render :new }\n format.json { render json: @test_question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def question_params\n params.require(:question).permit(:question, :answer)\n end",
"def question_params\n params.require(:question).permit(:question, :answer)\n end",
"def create\n @action = \"save\"\n if params[:qtype].nil?\n flash[:notice] = \"Please select the format of the question you want to create.\"\n respond_to do |format|\n format.html { redirect_to action: \"new\" }\n #format.json { render json: @question }\n end\n return\n end\n\n @question = Question.new\n @boards = get_boards\n @question.build_context\n\n if params[:qtype]=='multichoice'\n @question.qtype = 'multichoice'\n @qtype = 'New MCQ Question'\n (1..4).each do\n @question.question_answers.build\n end\n #@choices = Array.new(3) { @question.question_multichoice.build }\n respond_to do |format|\n format.html { render \"multichoice\" }\n #format.json { render json: @question }\n end\n end\n\n if params[:qtype]=='truefalse'\n @question.qtype = 'truefalse'\n @qtype = 'New True/False Question'\n @question.question_answers_attributes = [{:answer=>'True'},{:answer=>'False'}]\n respond_to do |format|\n format.html { render \"truefalse\" }\n #format.json { render json: @question }\n end\n end\n\n if params[:qtype]=='match'\n @question.qtype = 'match'\n @qtype = 'New Match the Following Question'\n (1..4).each do\n @question.question_match_subs.build\n end\n respond_to do |format|\n format.html { render \"match\" }\n #format.json { render json: @question }\n end\n end\n\n if params[:qtype]=='parajumble'\n @question.qtype = 'parajumble'\n @qtype = 'New Parajumble Question'\n @question.question_parajumbles_attributes = [{:order=>1},{:order=>2},{:order=>3},{:order=>4}]\n respond_to do |format|\n format.html { render \"parajumble\" }\n #format.json { render json: @question }\n end\n end\n\n if params[:qtype]=='fib'\n @question.qtype = \"fib\"\n @qtype = \"New Fill In The Blank Question\"\n @question.question_fill_blanks.build\n respond_to do |format|\n format.html {render \"fib\"}\n end\n end\n\n\n return\n respond_to do |format|\n format.html { render action: \"new\" }\n #format.json { render json: @question }\n end\n return\n @question = Question.new(params[:question])\n\n respond_to do |format|\n if @question.save\n format.html { redirect_to @question, notice: 'Question was successfully created.' }\n format.json { render json: @question, status: :created, location: @question }\n else\n format.html { render action: \"new\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_new_questions\n questionnaire_id = params[:id]\n # If the questionnaire is being used in the active period of an assignment, delete existing responses before adding new questions\n if AnswerHelper.check_and_delete_responses(questionnaire_id)\n flash[:success] = 'You have successfully added a new question. Any existing reviews for the questionnaire have been deleted!'\n else\n flash[:success] = 'You have successfully added a new question.'\n end\n\n questionnaire = Questionnaire.find(questionnaire_id)\n current_num_of_questions = questionnaire.questions.size\n max_seq = 0\n Questionnaire.find(questionnaire_id).questions.each do |question|\n if !question.seq.nil? && question.seq > max_seq\n max_seq = question.seq\n end\n end\n ((current_num_of_questions + 1)..(current_num_of_questions + params[:question][:total_num].to_i)).each do\n max_seq += 1\n # Create question object based on type using question_factory\n question = question_factory(params[:question][:type], questionnaire_id, max_seq)\n if question.is_a? ScoredQuestion\n question.weight = params[:question][:weight]\n question.max_label = Question::MAX_LABEL\n question.min_label = Question::MIN_LABEL\n end\n\n if Question::SIZES.key?(question.class.name)\n question.size = Question::SIZES[question.class.name]\n end\n if Question::ALTERNATIVES.key?(question.class.name)\n question.alternatives = Question::ALTERNATIVES[question.class.name]\n end\n\n begin\n question.save\n rescue StandardError => e\n flash[:error] = e.message\n end\n end\n redirect_to edit_questionnaire_path(questionnaire_id.to_sym)\n end",
"def create\n @question = Question.create!(question_params.merge({user_id: 1}))\n if question_params[:answers]\n question_params[:answers].with_indifferent_access.each do |answer|\n Answer.create!(name: answer[:name], question_id: @question.id)\n end\n end\n @question.prepare\n @question.broadcast\n render json: @question, status: :created\n end",
"def question_params\n # params.require(:tst).permit(:name, :description, :status, :contributors)\n params.require(:question).permit(:name, :description, :status, :hint, :image_url, :explanation, :kind, :correct_response, :pause_at)\n end",
"def create\n @api_v1_question = Api::V1::Question.new(api_v1_question_params)\n\n respond_to do |format|\n if @api_v1_question.save\n format.html { redirect_to @api_v1_question, notice: 'Question was successfully created.' }\n format.json { render :show, status: :created, location: @api_v1_question }\n else\n format.html { render :new }\n format.json { render json: @api_v1_question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def question_params\n params.require(:question).permit(:title, :body, :answer)\n end",
"def question_params\n params.require(:question).permit(:course_name, :description, :question, :answer)\n end",
"def create\n @question = Question.new(params[:question])\n @question.survey_id = params[:survey_id]\n respond_to do |format|\n if @question.save\n \n if (@question.question_type.short_text? || @question.question_type.open_ended_text?)\n path = survey_path(params[:survey_id])\n else\n path = survey_question_path(params[:survey_id],@question.id)\n end\n format.html { redirect_to path, notice: 'Question was successfully created.' }\n format.json { render json: @question, status: :created, location: @question }\n else\n format.html { render action: \"new\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cards_question = Cards::Question.new(params[:cards_question])\n\n respond_to do |format|\n if @cards_question.save\n format.html { redirect_to @cards_question, notice: 'Question was successfully created.' }\n format.json { render json: @cards_question, status: :created, location: @cards_question }\n else\n format.html { render action: \"new\" }\n format.json { render json: @cards_question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def question_params\n params.require(:question).permit(:title, :content)\n end",
"def question_params\n params.require(:question).permit(:exam_id, :question, :correct_answer, :answer_1, :answer_2, :answer_3, :description)\n end",
"def create \t\n\t \t# TODO: make sure that there are no duplicates for questions\n\t \t\n\t \tif params[:question].nil?\n\t \t\t@error_message = 'ERROR: no question parameter provided'\n \t\telsif params[:question][:short_name].nil? or params[:question][:short_name].empty?\n \t\t\t@error_message = 'ERROR: no short name provided'\n \t\telsif params[:question][:text].nil? or params[:question][:text].empty?\n \t\t\t@error_message = 'ERROR: no question text provided'\n \t\telsif params[:question][:question_type].nil? or params[:question][:question_type].empty?\n \t\t\t@error_message = 'ERROR: no question type provided'\n\t\telsif params[:question][:domain].nil? or params[:question][:domain].empty?\n\t\t\t@error_message = 'ERROR: no question domain provided'\n\t\telsif not [Question::UNFILED_DOMAIN,Question::PROFILE_DOMAIN,Question::FEEDBACK_DOMAIN].include?(params[:question][:domain].downcase)\n\t\t\t@error_message = 'ERROR: invalid question domain provided'\n \t\telsif not ['Text','Multiple Choice','Multiple Selection'].include?(params[:question][:question_type])\n \t\t\t@error_message = 'ERROR: invalid question type'\n \t\telsif params[:question][:question_type] != 'Text' and (params[:choices].nil? or params[:choices].empty?)\n \t\t\t@error_message = 'ERROR: did not specify choices for a choice question' \t\t\t\n \t\telse\n\t\t \tquestion_type = _condense_question_type(params[:question][:question_type])\n \t\t\t# TODO: make sure that there are no duplicates\n\t\t \t \t\t\t\n\t\t \tif question_type.nil?\n \t\t\t\t@error_message = 'ERROR: could not condense question type properly!'\n \t\t\telse\n\t\t\t \t_create_new_question params[:question][:short_name], params[:question][:text], question_type, params[:question][:domain].downcase, current_user.id, params[:choices]\n\t \t\tend\n \t\tend\n \t\tif @error_message.nil? or @error_message.index('ERROR').nil? # if there is an error, stay on this page; else, allow user to continue\n \t\t\tredirect_to :action => :index\n \t\tend\n\tend",
"def create\n @room = Room.new(room_params)\n \n respond_to do |format|\n if @room.save\n trivia_category = (@room.category.eql? \"any\") ? '' : \"category=\" + @room.category\n \n questions_response = RestClient::Request.execute(\n method: :get,\n url: 'https://opentdb.com/api.php?amount=7&type=multiple&' + trivia_category\n )\n questions = JSON.parse(questions_response)['results']\n\n questions.each do |question|\n Question.create(\n :problem => question['question'],\n :category => question['category'],\n :correct_answer => question[\"correct_answer\"],\n :incorrect_answer_one => question[\"incorrect_answers\"][0],\n :incorrect_answer_two => question[\"incorrect_answers\"][1],\n :incorrect_answer_three => question[\"incorrect_answers\"][2],\n :room_id => @room.id\n )\n end\n format.html { redirect_to @room, notice: 'Room was successfully created.' }\n format.json { render :show, status: :created, location: @room }\n else\n format.html { render :new }\n format.json { render json: @room.errors, status: :unprocessable_entity }\n end\n end\n end",
"def question_params\n params.require(:question).permit(:question_title, :quiz_id, choices_attributes: [])\n end",
"def question_params\n params.require(:question).permit(:title, :content)\n end",
"def question_params\n params.require(:question).permit(:title, :content)\n end",
"def question_params\n params.require(:question).permit(:title, :content)\n end",
"def question_params\n params.require(:question).permit(:title, :content)\n end",
"def create_question\n question_hash = Adapter.quiz_api(difficulty) #use adapter method, with difficulty passes into the url as a variable, to gnerate a new list of questions.\n new_question = Question.new #make a new question instance\n new_question.save #save now so we can store the question's id in the answer by calling self.id\n new_question.content = question_hash['question'] #adding all necessary column data to this question object/row\n new_question.create_answers(question_hash)\n new_question.quiz_id = self.id\n new_question.save #send the newly created question to the database\n end",
"def question_params\n params[:question]\n #params.require(:project).permit(:title, :description, :user_id)\n params.require(:question).permit(:text,:kind,:survey_id)\n end",
"def question_params\n params.require(:question).permit()\n end",
"def question_params\n params.require(:question).permit(:title, :answer)\n end",
"def create\r\n @intern_question = InternQuestion.new(params[:intern_question])\r\n\r\n respond_to do |format|\r\n if @intern_question.save\r\n format.html { redirect_to @intern_question, notice: 'Intern question was successfully created.' }\r\n format.json { render json: @intern_question, status: :created, location: @intern_question }\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @intern_question.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def question_params\n params.require(:question).permit(:title, :description, :category_id, :user_id)\n end",
"def create\n #@question = Question.new(params[:question])\n #@question.node = current_node\n @question.user_id = current_user.id\n respond_to do |format|\n if @question.save\n format.html { redirect_to @question, notice: t('alert.question.create_success', default: 'Question was successfully created.') }\n format.json { render json: @question, status: :created, location: @question }\n else\n format.html { render action: \"new\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @question = Question.new(question_params)\n\n respond_to do |format|\n if @question.save\n format.html { redirect_to questions_path, notice: 'Question was successfully created.' }\n format.json { render :show, status: :created, location: @question }\n else\n format.html { render :new }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\t\n\tquestion_param = question_params.merge(:words => in_words(question_params[\"answer\"].to_i))\n @question = Question.new(question_param)\n respond_to do |format|\n if @question.save\n format.html { redirect_to @question, notice: 'Question was successfully created.' }\n format.json { render :show, status: :created, location: @question }\n else\n format.html { render :new }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n\t#=end\n end",
"def question_params\n params.require(:question).permit(:title, :content, :q)\n end",
"def answer_a_question\n user = current_user\n render_401 and return unless user\n question = ShortQuestion.find_by_id(params[:id])\n render_404 and return unless question\n\n obj = {\n :qid => params[:id],\n :answer => params[:choice]\n }\n \n answers = {}\n $r.multi do\n $r.lpush(\"user:#{user.id}:questions\", obj)\n $r.hincrby(\"question:#{question.id}:answers\", \"choice#{params[:choice]}\", 1)\n choices = $r.hget(\"question:#{question.id}:answers\", :num_choices)\n for i in 1..choices\n answers[i] = $r.hget(\"question:#{question.id}:answers\", \"choice#{i}\")\n end\n end\n render :json => {\n :success => true,\n :answers => answers\n }\n end",
"def create\n @question = Question.new(params[:question])\n params[:knowledge_point_ids].each do |knowledge_point_id|\n @knowledge_point = KnowledgePoint.find_by_id(knowledge_point_id)\n @question.knowledge_points << @knowledge_point\n end\n\n respond_to do |format|\n if @question.save\n format.html { redirect_to @question, :notice => 'Question was successfully created.' }\n format.json { render :json => @question, :status => :created, :location => @question }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @question.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def api_question_params\n params.require(:api_question).permit(:header, :body, :rating)\n end",
"def get_question_list\n json= RestClient.get(\"http://localhost:3000/questions\")\n JSON.parse(json)\n end",
"def question_params\n params.require(:question).permit(:title, :answer1, :answer2, :answer3, :answer4, :answer5, :right_answer, :proof_id)\n end",
"def create\n @question = Question.new(question_params)\n\n respond_to do |format|\n if @question.save\n format.html { redirect_to @question }\n format.json { render :show, status: :created, location: @question }\n else\n format.html { render :new }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def question_params\n params.require(:question).permit(:title, :body, :user_id, :tag_list, :question_id)\n end",
"def create\n @question = Question.new(question_params)\n link_response_sets(params)\n\n if @question.all_versions.count >= 1\n if @question.not_owned_or_in_group?(current_user) || @question.prev_not_owned_or_in_group?(current_user)\n render(json: @question.errors, status: :unauthorized) && return\n elsif @question.all_versions.last.status == 'draft'\n render(json: @question.errors, status: :unprocessable_entity) && return\n end\n @question.version = @question.most_recent + 1\n end\n assign_author\n if @question.save\n render :show, status: :created, location: @question\n else\n # @categories = Category.all\n render json: @question.errors, status: :unprocessable_entity\n end\n end",
"def question_params\n params.require(:question).permit(:user_id, :question, :yeah_count, :course_id, :answered)\n end",
"def community_question_params\n params.require(:community_question).permit(:userId, :communityId, :question)\n end",
"def question_params\n params.require(:question).permit(:title, topic_ids: [], answers_attributes: [:id, :content, :is_correct])\n end",
"def create\n @question = Question.new(params[:question])\n\n respond_to do |format|\n if @question.save\n format.html { redirect_to @question, notice: 'Question was successfully created.' }\n format.json { render json: @question, status: :created, location: @question }\n else\n format.html { render action: \"new\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @my_question = MyQuestion.new(params[:my_question])\n\n respond_to do |format|\n if @my_question.save\n format.html { redirect_to @my_question, notice: 'My question was successfully created.' }\n format.json { render json: @my_question, status: :created, location: @my_question }\n else\n format.html { render action: \"new\" }\n format.json { render json: @my_question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @question = Question.new(question_params)\n\n respond_to do |format|\n if @question.save\n format.html { redirect_to @question, notice: 'Question was successfully created.' }\n format.json { render :show, status: :created, location: @question }\n else\n format.html { render :new }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @question = Question.new(question_params)\n\n respond_to do |format|\n if @question.save\n format.html { redirect_to @question, notice: 'Question was successfully created.' }\n format.json { render :show, status: :created, location: @question }\n else\n format.html { render :new }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @question = Question.new(question_params)\n\n respond_to do |format|\n if @question.save\n format.html { redirect_to @question, notice: 'Question was successfully created.' }\n format.json { render :show, status: :created, location: @question }\n else\n format.html { render :new }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @question = Question.new(question_params)\n\n respond_to do |format|\n if @question.save\n format.html { redirect_to @question, notice: 'Question was successfully created.' }\n format.json { render :show, status: :created, location: @question }\n else\n format.html { render :new }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @question = Question.new(question_params)\n\n respond_to do |format|\n if @question.save\n format.html { redirect_to @question, notice: 'Question was successfully created.' }\n format.json { render :show, status: :created, location: @question }\n else\n format.html { render :new }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @question = Question.new(question_params)\n\n respond_to do |format|\n if @question.save\n format.html { redirect_to @question, notice: 'Question was successfully created.' }\n format.json { render :show, status: :created, location: @question }\n else\n format.html { render :new }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @question = Question.new(question_params)\n\n respond_to do |format|\n if @question.save\n format.html { redirect_to @question, notice: 'Question was successfully created.' }\n format.json { render :show, status: :created, location: @question }\n else\n format.html { render :new }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @question = Question.new(question_params)\n\n respond_to do |format|\n if @question.save\n format.html { redirect_to @question, notice: 'Question was successfully created.' }\n format.json { render :show, status: :created, location: @question }\n else\n format.html { render :new }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @question = Question.new(question_params)\n\n respond_to do |format|\n if @question.save\n format.html { redirect_to @question, notice: 'Question was successfully created.' }\n format.json { render :show, status: :created, location: @question }\n else\n format.html { render :new }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @question = Question.new(question_params)\n\n respond_to do |format|\n if @question.save\n format.html { redirect_to @question, notice: 'Question was successfully created.' }\n format.json { render :show, status: :created, location: @question }\n else\n format.html { render :new }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @question = Question.new(question_params)\n\n respond_to do |format|\n if @question.save\n format.html { redirect_to @question, notice: 'Question was successfully created.' }\n format.json { render :show, status: :created, location: @question }\n else\n format.html { render :new }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def question_params\n params.require(:question).permit(questions_attributes: [:survey_id, :id, :content, answers_attributes: [:id, :question_id, :correct_answer, :content], correct_answers_attributes: [:guess, :question_id]])\n end",
"def create\n @community_question = CommunityQuestion.new(community_question_params)\n\n respond_to do |format|\n if @community_question.save\n format.html { redirect_to @community_question, notice: 'Community question was successfully created.' }\n format.json { render :show, status: :created, location: @community_question }\n else\n format.html { render :new }\n format.json { render json: @community_question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def interview_question_params\n params.require(:interview_question).permit(:interview_id, :question_id)\n end",
"def create\n @question = Question.new(question_params)\n\n respond_to do |format|\n if @question.save\n format.html { redirect_to @question, notice: \"Question was successfully created.\" }\n format.json { render :show, status: :created, location: @question }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def save_questions(questionnaire_id)\n delete_questions questionnaire_id\n save_new_questions questionnaire_id\n \n if params[:question]\n for question_key in params[:question].keys\n begin\n if params[:question][question_key][:txt].strip.empty?\n # question text is empty, delete the question\n Question.delete(question_key)\n else\n if (@questionnaire.type == \"QuizQuestionnaire\")\n Question.update(question_key,:weight => 1, :txt => params[:question][question_key][:txt] )\n else\n Question.update(question_key, params[:question][question_key])\n end\n Question.update(question_key, params[:question][question_key])\n end\n rescue ActiveRecord::RecordNotFound \n end\n end\n end\n end",
"def create\n @course = Course.find(params[:course_id])\n @question = @course.questions.build(params[:question])\n @question.save\n\n respond_to do |format|\n if @question.save\n format.html { redirect_to @course, notice: 'Question was successfully created.' }\n format.json { render json: @course, status: :created, location: @question }\n else\n format.html { render action: \"new\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @question = Question.new(question_params)\n respond_to do |format|\n if @question.save\n # format.html { redirect_to @question, notice: 'Question was successfully created.' }\n format.json { render json: @question, status: :created, location: @question }\n else\n # format.html { render :new }\n format.json { render json: @question.errors, status: :bad_request }\n end\n end\n end",
"def mongo_question_params\n params.require(:mongo_question).permit(:difficulty, :points, :text, :topics, right_answer_attributes: [:text], wrong_answers_attributes: [:text, :plausibility])\n end",
"def new\n @other_study.build_questions\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @other_study }\n end\n end",
"def create_single_quiz_question(course_id,quiz_id,question__question_name__,question__question_text__,question__question_type__,opts={})\n query_param_keys = [\n \n ]\n\n form_param_keys = [\n :question__question_name__,\n :question__question_text__,\n :question__quiz_group_id__,\n :question__question_type__,\n :question__position__,\n :question__points_possible__,\n :question__correct_comments__,\n :question__incorrect_comments__,\n :question__neutral_comments__,\n :question__text_after_answers__,\n :question__answers__,\n \n ]\n\n # verify existence of params\n raise \"course_id is required\" if course_id.nil?\n raise \"quiz_id is required\" if quiz_id.nil?\n raise \"question__question_name__ is required\" if question__question_name__.nil?\n raise \"question__question_text__ is required\" if question__question_text__.nil?\n raise \"question__question_type__ is required\" if question__question_type__.nil?\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n :course_id => course_id,\n :quiz_id => quiz_id,\n :question__question_name__ => question__question_name__,\n :question__question_text__ => question__question_text__,\n :question__question_type__ => question__question_type__\n )\n\n # resource path\n path = path_replace(\"/v1/courses/{course_id}/quizzes/{quiz_id}/questions\",\n :course_id => course_id,\n :quiz_id => quiz_id)\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_params(options, query_param_keys)\n if opts[:next_page]\n pagination_params = page_params_load(:post, path)\n query_params.merge! pagination_params if pagination_params\n end\n response = mixed_request(:post, path, query_params, form_params, headers)\n page_params_store(:post, path)\n QuizQuestion.new(response)\n end",
"def question_params\n params.require(:question).permit(:question, :answer, :status_id)\n end",
"def create\n @multiple_choice_question = MultipleChoiceQuestion.new(params[:multiple_choice_question])\n\n respond_to do |format|\n if @multiple_choice_question.save\n format.html { redirect_to @multiple_choice_question, notice: 'Multiple choice question was successfully created.' }\n format.json { render json: @multiple_choice_question, status: :created, location: @multiple_choice_question }\n else\n format.html { render action: \"new\" }\n format.json { render json: @multiple_choice_question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def question_params\n params.require(:question).permit(:text, :option_a, :option_b, :option_c, :option_d, :started, :finished, :answer, :poll_centre_id)\n end"
] | [
"0.6820088",
"0.6492851",
"0.6483083",
"0.64829385",
"0.63913435",
"0.6379721",
"0.62458825",
"0.6204053",
"0.6191769",
"0.61807805",
"0.61792463",
"0.61736166",
"0.6161171",
"0.61556166",
"0.6154535",
"0.6146767",
"0.6118",
"0.607924",
"0.6077475",
"0.6076541",
"0.60720456",
"0.6054644",
"0.60541874",
"0.605373",
"0.6053137",
"0.60503197",
"0.60442644",
"0.6032884",
"0.6019589",
"0.6014047",
"0.6012974",
"0.6004874",
"0.6004874",
"0.59932894",
"0.59932894",
"0.5985285",
"0.59550714",
"0.5953874",
"0.594261",
"0.5939755",
"0.5936235",
"0.5936063",
"0.59224385",
"0.59155935",
"0.5890663",
"0.58900857",
"0.5889724",
"0.58871984",
"0.58845365",
"0.5883386",
"0.5883386",
"0.5883386",
"0.5883386",
"0.58820593",
"0.58793056",
"0.58667284",
"0.5865363",
"0.58643705",
"0.58626413",
"0.58614767",
"0.5851381",
"0.5847808",
"0.5846576",
"0.58462346",
"0.58458257",
"0.5845017",
"0.58399963",
"0.5835468",
"0.58351064",
"0.58322614",
"0.58282465",
"0.5827815",
"0.5823077",
"0.58199745",
"0.5816849",
"0.5814574",
"0.58110803",
"0.58110803",
"0.58110803",
"0.58110803",
"0.58110803",
"0.58110803",
"0.58110803",
"0.58110803",
"0.58110803",
"0.58110803",
"0.5810744",
"0.58044344",
"0.58025986",
"0.5797819",
"0.5796213",
"0.57925093",
"0.57914037",
"0.5788258",
"0.57862896",
"0.5784639",
"0.5784426",
"0.57834524",
"0.5779592",
"0.577775"
] | 0.70868933 | 0 |
PATCH/PUT /commonquestions/1 PATCH/PUT /commonquestions/1.json | def update
@commonquestion.question_id = params[:question_id]
@commonquestion.parttype_id = params[:parttype_id]
@commonquestion.questiontype_id = params[:questiontype_id]
respond_to do |format|
if @commonquestion.update(commonquestion_params)
format.html { redirect_to @commonquestion, notice: 'Commonquestion was successfully updated.' }
format.json { render :show, status: :ok, location: @commonquestion }
else
format.html { render :edit }
format.json { render json: @commonquestion.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to api_v1_question_path(@question), notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @v1_question.update(v1_question_params)\n render json: @v1_question, status: :ok\n else\n render json: get_errors, status: :unprocessable_entity\n end\n end",
"def update\n question = Question.find(params[:id_question])\n if question.update(params_question)\n render json: question, status: 200\n else\n render json: question.errors, status: 422\n end\n\n end",
"def update\n if @question.status == 'published' || @question.version_independent_id != question_params[:version_independent_id]\n render json: @question.errors, status: :unprocessable_entity\n else\n update_response_sets(params)\n @question.update_concepts('Question')\n @question.updated_by = current_user\n if @question.update(question_params)\n @question.groups.each do |group|\n @question.add_to_group(group.id)\n end\n render :show, status: :ok, location: @question\n else\n @categories = Category.all\n render json: @question.errors, status: :unprocessable_entity\n end\n end\n end",
"def update_mod\n if params[:title] != nil && params[:content] != nil\n @question.title = params[:title]\n @question.content = params[:content]\n\n question_json = @question.to_h.to_json\n\n url = @httpIp+'/pet.com/api/question/updateQuestion'\n uri = URI(url)\n res = Net::HTTP.post(uri, question_json, \"Content-Type\" => \"application/json\")\n puts res.body\n flash[:notice] = \"successfully updated\"\n redirect_to questions_path\n end\n end",
"def update\n @survey = Survey.find(params[:id])\n json = params[:survey]\n json[:questions] = JSON.parse(json[:questions])\n json[:questions].each_with_index do |question, idx|\n json[:questions][idx]['id'] = idx + 1\n end\n\n respond_to do |format|\n if @survey.update_attributes(json)\n format.html { redirect_to @survey, notice: 'Survey was successfully updated.' }\n format.json { render json: @survey }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @survey.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @api_v1_question.update(api_v1_question_params)\n format.html { redirect_to @api_v1_question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_question }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.json { render :json => 'Question updated OK' }\n format.xml { head :ok }\n else\n format.json { render :json => @question.errors }\n format.xml { render :xml => @question.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @test_question = TestQuestion.find(params[:id])\n\n respond_to do |format|\n if @test_question.update_attributes(params[:test_question])\n format.html { redirect_to @test_question, :notice => 'Test question was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @test_question.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to new_question_path, notice: 'questions was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n question = Question.find_by!(id: params[:id])\n if question\n question.name = params[:name]\n question.description = params[:description]\n question.user_id = params[:user_id]\n question.category_id = params[:category_id]\n question.zavrseno = params[:zavrseno]\n question.uposlenik_id = params[:uposlenik_id]\n question.save\n render json: question, status: 200 \n else\n render json: { errors: \"This link is invalid.\"}, status: 404\n end\n end",
"def update_correct_answer\n question_params = params.permit(:question_id, :question_type_id, :option_id)\n \n render json: Question.update_correct_option(question_params)\n end",
"def update\n @question = Question.update(params[:id], { \n :body => params[:body], \n :answer_type => params[:answer_type] }, \n params[:answers].values\n )\n\n respond_to do |format|\n format.json { render :json => @question.as_json({:include => :answers}) }\n\n # if @question.update_attributes(params[:question])\n # format.html { redirect_to @question, :notice => 'Question was successfully updated.' }\n # format.json { head :no_content }\n # else\n # format.html { render :action => \"edit\" }\n # format.json { render :json => @question.errors, :status => :unprocessable_entity }\n # end\n end\n end",
"def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n if (@question.question_type.short_text? || @question.question_type.open_ended_text?)\n path = survey_path(params[:survey_id])\n else\n path = survey_question_path(params[:survey_id],@question.id)\n end\n format.html { redirect_to path, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to @question, :notice => 'Question was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @question.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_question\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to :planner, notice: 'Question was successfully updated.' }\n format.json { respond_with_bip(@question) }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n #@question = Question.find(params[:id])\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to @question, notice: t('alert.question.update_success', default: 'Question was successfully updated.') }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to @question.course, notice: 'Question was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @question = Question.find(params[:id])\n @question.update_attributes(params[:question])\n render :json => @question.id if @question.save\n # respond_to do |format|\n # if @question.update_attributes(params[:question])\n # format.html { redirect_to(@question, :notice => 'Question was successfully updated.') }\n # format.xml { head :ok }\n # else\n # format.html { render :action => \"edit\" }\n # format.xml { render :xml => @question.errors, :status => :unprocessable_entity }\n # end\n # end\n end",
"def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @critical_question = CriticalQuestion.find(params[:id])\n\n respond_to do |format|\n if @critical_question.update_attributes(params[:critical_question])\n format.html { redirect_to @critical_question, notice: 'Critical question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @critical_question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit_question\n\t\t\tquizzes = current_instructor.quizzes\n\t\t\t@found = 0\n\t\t\tquizzes.each do |quiz|\n\t\t\t\tif(quiz.questions.exists?(:id => params[:question_id]))\n\t\t\t\t\t@found = @found + 1\n\t\t\t\tend \n\t\t\tend\n\t\t\tif (@found > 0)\n\t\t\t\tquestion = Question.find(params[:question_id])\n\t\t\t\tif (question.update(question_params))\n\t\t\t\t\trender json: { success: true, data: { :question => question }, info:{} }, status: 200\n\t\t\t\telse\n\t\t\t\t\trender json: { error: question.errors }, status: 422 \n\t\t\t\tend\t\n\t\t\telse\n\t\t\t\trender json: { error:\"Question is not found\" }, status: 422\n\t\t\tend\n\t\tend",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @my_question = MyQuestion.find(params[:id])\n\n respond_to do |format|\n if @my_question.update_attributes(params[:my_question])\n format.html { redirect_to @my_question, notice: 'My question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @my_question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_question_content\n question_params = params.require(:question).permit(:id, :content)\n\n render json: Question.update_question_content(question_params)\n end",
"def update\n respond_to do |format|\n if @mongo_question.update(mongo_question_params)\n format.html { redirect_to @mongo_question, notice: 'Mongo question was successfully updated.' }\n format.json { render :show, status: :ok, location: @mongo_question }\n else\n format.html { render :edit }\n format.json { render json: @mongo_question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to [@category, @question], notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, :notice =>'Question was successfully updated.' }\n format.json { render :show, :status => :ok, :location => @question }\n else\n format.html { render :edit }\n format.json { render :json => @question.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to quiz_path(@question.subsection_id), notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to(@question, :notice => 'Question was successfully updated.') }\n format.xml { head :ok }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @question.errors, :status => :unprocessable_entity }\n\t\t\t\tformat.json { render :json => @question.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @test_question.update(test_question_params)\n format.html { redirect_to @test_question, notice: 'Test question was successfully updated.' }\n format.json { render :show, status: :ok, location: @test_question }\n else\n format.html { render :edit }\n format.json { render json: @test_question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to edit_question_path(@question), notice: 'Question was successfully updated.' }\n format.json\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n # before_action :set_question\n #before_action :set_tag\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: \"更新しました\" }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @cards_question = Cards::Question.find(params[:id])\n\n respond_to do |format|\n if @cards_question.update_attributes(params[:cards_question])\n format.html { redirect_to @cards_question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cards_question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize @question\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n qp = question_params\n if qp[:question_type] == \"vignette\" or qp[:question_type] == \"nonchoice\"\n qp[:answer] = \"\"\n end\n\n respond_to do |format|\n if @question.update(qp)\n format.html { redirect_to paper_questions_path(question_params[:paper_id],question_params[:id]), notice: '題目已被成功編輯' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { redirect_to edit_paper_question_path, notice: '上傳檔案大小不可超過500KB' }\n format.json { render json: paper_questions_path.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: \"Question was successfully updated.\" }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n question = Question.find(params[:id])\n authorize question\n\n new_version = question.template.generate_version?\n\n old_question_ids = {}\n if new_version\n # get a map from option number to id\n old_number_to_id = {}\n question.question_options.each do |opt|\n old_number_to_id[opt.number] = opt.id\n end\n\n # get a map from question versionable id to old id\n question.template.questions.each do |q|\n old_question_ids[q.versionable_id] = q.id\n end\n end\n\n question = get_modifiable(question)\n\n question_id_map = {}\n if new_version\n # params now out of sync (after versioning) with the question_options\n # so when we do the question.update it'll mess up\n # need to remap params to keep them consistent\n old_to_new_opts = {}\n question.question_options.each do |opt|\n old_id = old_number_to_id[opt.number]\n old_to_new_opts[old_id.to_s] = opt.id.to_s\n end\n\n question.template.questions.each do |q|\n question_id_map[old_question_ids[q.versionable_id].to_s] = q.id.to_s\n end\n end\n\n # rewrite the question_option ids so they match the new\n # version of the question\n # and also rewrite the remove_data question ids\n attrs = question_params\n attrs = update_option_ids(attrs, old_to_new_opts) if new_version && !attrs['question_options_attributes'].nil?\n\n # Need to reattach the incoming annotation's and question_options to the\n # modifiable (versioned) question\n attrs = transfer_associations(attrs, question) if new_version\n\n # If the user unchecked all of the themes set the association to an empty array\n # add check for number present to ensure this is not just an annotation\n attrs[:theme_ids] = [] if attrs[:theme_ids].blank? && attrs[:number].present?\n if question.update(attrs)\n if question.update_conditions(sanitize_hash(params['conditions']),\n old_to_new_opts, question_id_map)\n flash.now[:notice] = success_message(question, _('updated'))\n end\n else\n flash.now[:alert] = flash.now[:alert] = failure_message(question, _('update'))\n end\n if question.section.phase.template.customization_of.present?\n redirect_to org_admin_template_phase_path(\n template_id: question.section.phase.template.id,\n id: question.section.phase.id,\n section: question.section.id\n )\n else\n redirect_to edit_org_admin_template_phase_path(\n template_id: question.section.phase.template.id,\n id: question.section.phase.id,\n section: question.section.id\n )\n end\n end",
"def update\n @base_question = BaseQuestion.find(params[:id])\n\n respond_to do |format|\n if @base_question.update_attributes(params[:base_question])\n format.html { redirect_to @base_question, notice: 'Base question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @base_question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_existing_quiz_question(course_id,quiz_id,id,question__question_name__,question__question_text__,question__question_type__,opts={})\n query_param_keys = [\n \n ]\n\n form_param_keys = [\n :question__question_name__,\n :question__question_text__,\n :question__quiz_group_id__,\n :question__question_type__,\n :question__position__,\n :question__points_possible__,\n :question__correct_comments__,\n :question__incorrect_comments__,\n :question__neutral_comments__,\n :question__text_after_answers__,\n :question__answers__,\n \n ]\n\n # verify existence of params\n raise \"course_id is required\" if course_id.nil?\n raise \"quiz_id is required\" if quiz_id.nil?\n raise \"id is required\" if id.nil?\n raise \"question__question_name__ is required\" if question__question_name__.nil?\n raise \"question__question_text__ is required\" if question__question_text__.nil?\n raise \"question__question_type__ is required\" if question__question_type__.nil?\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n :course_id => course_id,\n :quiz_id => quiz_id,\n :id => id,\n :question__question_name__ => question__question_name__,\n :question__question_text__ => question__question_text__,\n :question__question_type__ => question__question_type__\n )\n\n # resource path\n path = path_replace(\"/v1/courses/{course_id}/quizzes/{quiz_id}/questions/{id}\",\n :course_id => course_id,\n :quiz_id => quiz_id,\n :id => id)\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_params(options, query_param_keys)\n if opts[:next_page]\n pagination_params = page_params_load(:put, path)\n query_params.merge! pagination_params if pagination_params\n end\n response = mixed_request(:put, path, query_params, form_params, headers)\n page_params_store(:put, path)\n QuizQuestion.new(response)\n end",
"def update_question_type\n form_params = params.require(:form).permit(:question_id, :question_type)\n\n render json: Question.update_question_type(form_params)\n end",
"def update\n @questions_option = QuestionsOption.find(params[:id])\n\n respond_to do |format|\n if @questions_option.update_attributes(params[:questions_option])\n format.html { redirect_to @questions_option, notice: 'Questions option was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @questions_option.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @b_question.update(b_question_params)\n format.html { redirect_to @b_question }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @b_question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @multiple_choice_question = MultipleChoiceQuestion.find(params[:id])\n\n respond_to do |format|\n if @multiple_choice_question.update_attributes(params[:multiple_choice_question])\n format.html { redirect_to @multiple_choice_question, notice: 'Multiple choice question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @multiple_choice_question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @time_series_question = @time_series.questions.find(params[:id])\n\n respond_to do |format|\n if @time_series_question.update_attributes(params[:time_series_question])\n format.html { redirect_to time_series_question_path(@owner, @time_series, @time_series_question), flash: {success: t('app.msgs.success_updated', :obj => t('mongoid.models.time_series_question.one'))} }\n format.json { head :no_content }\n else\n @datasets = @time_series.datasets.sorted\n\n # get the list of questions for each dataset in the time series that are not already in the time series\n @questions = {}\n\n @datasets.each do |dataset|\n # get the dataset question\n # - if it does not exist, build it\n dataset_question = @time_series_question.dataset_questions.by_dataset_id(dataset.dataset_id)\n dataset_question = @time_series_question.dataset_questions.build(dataset_id: dataset.dataset_id) if dataset_question.nil?\n\n @questions[dataset_question.dataset_id.to_s] = []\n # get all other questions not being used for this dataset\n not_in_use = dataset_question.dataset.questions.for_analysis_not_in_codes(@time_series.questions.codes_for_dataset(dataset_question.dataset_id)).to_a\n if not_in_use.present?\n @questions[dataset_question.dataset_id.to_s] << not_in_use\n end\n # get question for this dataset\n in_use = dataset_question.dataset.questions.with_code(dataset_question.code)\n if in_use.present?\n @questions[dataset_question.dataset_id.to_s] << in_use\n end\n @questions[dataset_question.dataset_id.to_s].flatten!.sort_by!{|x| x.original_code} if @questions[dataset_question.dataset_id.to_s].present?\n\n end\n\n\n add_common_options\n\n format.html { render action: \"edit\" }\n format.json { render json: @time_series_question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize! :update, @admin_question\n\n respond_to do |format|\n if @admin_question.update(admin_question_params)\n format.html { redirect_to @admin_question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @admin_question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @parent_question.update(parent_question_params)\n format.html { redirect_to @parent_question, notice: 'Parent question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @parent_question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @poll_question = PollQuestion.find(params[:id])\n\n respond_to do |format|\n if @poll_question.update_attributes(params[:poll_question])\n format.html { redirect_to @poll_question, notice: 'Poll question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @poll_question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n @intern_question = InternQuestion.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @intern_question.update_attributes(params[:intern_question])\r\n format.html { redirect_to @intern_question, notice: 'Intern question was successfully updated.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @intern_question.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n authorize_action_for @question\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n format.js { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n format.js { head :unprocessable_entity }\n end\n end\n end",
"def manage_question(body)\n upload_questions(JSON.parse(body)['questions'])\n get_questions\nend",
"def update \t\n\t \t# TODO: make sure that there are no duplicates for questions\n\t \t\n\t \t@param_list = params # for debugging in case of errors (see update.html.erb)\n\t \t\n\t \t#return\n\t \tif params[:id].nil?\n\t \t\t@error_message = 'ERROR: invalid question id'\n\t \telsif params[:question].nil?\n\t \t\t@error_message = 'ERROR: no question parameter provided'\n \t\telsif params[:question][:short_name].nil? or params[:question][:short_name].empty?\n \t\t\t@error_message = 'ERROR: no short name provided'\n \t\telsif params[:question][:text].nil? or params[:question][:text].empty?\n \t\t\t@error_message = 'ERROR: no question text provided'\n \t\telsif params[:question][:question_type].nil? or params[:question][:question_type].empty?\n \t\t\t@error_message = 'ERROR: no question type provided'\n\t\telsif params[:question][:domain].nil? or params[:question][:domain].empty?\n\t\t\t@error_message = 'ERROR: no question domain provided'\n\t\telsif not [Question::UNFILED_DOMAIN,Question::PROFILE_DOMAIN,Question::FEEDBACK_DOMAIN].include?(params[:question][:domain].downcase)\n\t\t\t@error_message = 'ERROR: invalid question domain provided'\n \t\telsif not ['Text','Multiple Choice','Multiple Selection'].include?(params[:question][:question_type])\n \t\t\t@error_message = 'ERROR: invalid question type'\n \t\telsif params[:question][:question_type] != 'Text' and (params[:choices].nil? or params[:choices].empty?)\n \t\t\t@error_message = 'ERROR: did not specify choices for a choice question' \t\t\t\n \t\telse\n\t\t \tquestion_type = _condense_question_type(params[:question][:question_type]) # represents the desired new question type\n \t\t\t# TODO: make sure that there are no duplicates\n\t\t \t\n\t\t \tif question_type.nil?\n \t\t\t\t@error_message = 'ERROR: could not condense question type properly!'\n \t\t\telse\n \t\t\t\t# now can save the question, but first must check if it already exists - won't the question always exist?\n \t\t\t\tcurrent_question = Question.where('id = ?',params[:id]).first \t\t\t\t\n\t\t\t \tif current_question.nil? # not found, so will make and store a new one - rare occasion, but enforces idempotency\t\t \t\t\n\t\t\t \t\t# this will create a new question, create any choices that don't already exist, and replace all Inclusions\n\t\t\t \t \t_create_new_question params[:question][:short_name], params[:question][:text], question_type, params[:question][:domain].downcase, current_user.id, params[:choices]\t\t \t\t\n\t\t \t\telse # this question already exists - just update its information and update the choices database with any new choices; also replace all Inclusion links\n\t\t\t \t\t@previous_question_type = current_question.question_type\n\t\t \t\t\t@question = Question.update(current_question.id.to_i, :short_name => params[:question][:short_name], :text => params[:question][:text], :question_type => question_type, :updated_by => current_user.id, :domain => params[:question][:domain].downcase) # updated_at will be done automatically by Rails\n\t\t\t \t\t@error_message = '[INFO] Question updated in database!'\n\t\t\t \t\t\n\t\t \t\t\t# update possbilities:\n\t\t \t\t\t# text -> text: do nothing (just modify the question above)\n\t\t \t\t\t# text -> mc/ms (non-text): add all non-existing choices from params, add Inclusion records between choices and all params (no need to replace here; can't be any choices for a former text question)\n\t\t\t\t\t# mc/ms (non-text) -> text: delete all existing Inclusion records between choices and question\n\t\t\t\t\t# mc/ms (non-text) -> mc/ms (non-text): \n\t\t \t\t\t\n\t\t\t \t\tif @previous_question_type == 'TEXT' and question_type != 'TEXT'\n\t\t\t \t\t\t_update_current_choices_and_inclusions(@question.id,params[:choices])\n\t\t \t\t\telsif @previous_question_type != 'TEXT' and question_type == 'TEXT'\n\t\t \t\t\t\t# only delete the old inclusion ties (questions are, after all, decoupled from choices)\n\t\t \t\t\t\t#old_ties = Inclusion.where('question_id = ?',).all.collect { |i| i.choice_id.to_i }\n\t\t \t\t\t\t#Inclusion.destroy_all(\"question_id = #{current_question.id.to_i}\")\n\t\t \t\t\t\tActiveRecord::Base.connection.execute(\"DELETE FROM inclusions WHERE question_id = #{current_question.id.to_i}\") # is there a better way?\t\n\t\t \t\t\t\t\n\t\t \t\t\telsif @previous_question_type != 'TEXT' and question_type != 'TEXT'\n\t\t \t\t\t\t# here, must delete old Inclusion ties before adding the new ones (which, in effect, replaces all ties)\n\t\t \t\t\t\t#Inclusion.destroy_all(\"question_id = #{current_question.id.to_i}\")\n\t\t \t\t\t\tActiveRecord::Base.connection.execute(\"DELETE FROM inclusions WHERE question_id = #{current_question.id.to_i}\")\n\t\t \t\t\t\t_update_current_choices_and_inclusions(@question.id,params[:choices])\n\t \t\t\t\tend\t\t \t\t\n\t\t \t\tend\n\t \t\tend\n \t\tend\n \t\t\n \t\tif @error_message.index('ERROR').nil? # if there is an error, stay on this page; else, allow user to continue\n \t\t\tredirect_to :action => :index\n \t\tend\n\tend",
"def update\n respond_to do |format|\n if @examquestion.update(examquestion_params)\n format.html { redirect_to @examquestion, notice: 'Examquestion was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @examquestion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'La pregunta fue modificada correctamente.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @survey_question = SurveyQuestion.find(params[:id])\n\n respond_to do |format|\n if @survey_question.update_attributes(params[:survey_question])\n format.html { redirect_to survey_questions_path(@survey_question.survey_id),\n notice: 'Survey question was successfully updated.' }\n #format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n #format.json { render json: @survey_question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @add_question.update(add_question_params)\n format.html { redirect_to @add_question, notice: 'Add question was successfully updated.' }\n format.json { render :show, status: :ok, location: @add_question }\n else\n format.html { render :edit }\n format.json { render json: @add_question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if params[:cros]=='y'\n #update from cros post. @xieyinghua\n new_faq_params=faq_params\n new_faq_params[:question]=params[:question]\n new_faq_params[:answer]=params[:answer]\n\n faq_params=new_faq_params\n end\n\n respond_to do |format|\n if @faq.update(faq_params)\n format.html { redirect_to @faq, notice: 'Faq was successfully updated.' }\n format.json { render :show, status: :ok, location: @faq }\n else\n format.html { render :edit }\n format.json { render json: @faq.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\t@question = Question.find(params[:id])\n\t@questionnaire_question=QuestionnaireQuestion.find_by_question_id(@question.id)\n\t@questionnaire=Questionnaire.find(@questionnaire_question.questionnaire_id)\n\n\trespond_to do |format|\n\t if @question.update_attributes(params[:question])\n\t#\tformat.html { redirect_to(@question, :notice => 'Question was successfully updated.') }\n\t\tformat.html { redirect_to new_question_path(:questionnaire_id=>@questionnaire.id), :notice => 'Answer was successfully Saved.' }\n\t\tformat.xml { head :ok }\n\t else\n\t\tformat.html { render :action => \"edit\" }\n\t\tformat.xml { render :xml => @question.errors, :status => :unprocessable_entity }\n\t end\n\tend\n end",
"def update\n @questions = Question.all\n @categories = [\"Learning from Labs\", \"Lab Instructor\", \"Lab Space and Equipment\", \"Time Required to Complete Labs\", \"Lecture Section Instructor\"]\n respond_to do |format|\n if @survey.update(survey_params)\n format.html { redirect_to @survey, notice: 'Survey was successfully submitted.' }\n format.json { render :show, status: :ok, location: @survey }\n\n # Update 'completed' attribute to true\n submission = Survey.find_by(survey_ID: @survey.survey_ID)\n submission.update(status: true)\n\n # Increment 'completed' attribute for section\n @section = Section.find_by(class_num: @survey.class_num)\n @section.update(completed: @section.completed + 1)\n\n\n else\n format.html { render :edit }\n format.json { render json: @survey.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @question = Question.find(params[:id])\n\n # @question.question_type_id = params[:question][:question_type_id]\n # @question.question_category_id = @question.question_type.question_category_id\n\n # authorize! :update, @question\n # @question.question_type_id = params[:question][:question_type_id]\n # @question.question_category_id = @question.question_type.question_category_id\n\n \n # # get fields from the form to update the question's section\n # @question.book = params[:question][:book]\n # @question.chapter = params[:question][:chapter]\n # @question.verse = params[:question][:verse]\n # @question.section_id = @question.set_section\n #---------------------------------------------------------\n \n # # if the the question has been approved, set the approver and the date approved\n # unless params[:question][:approval_level] == nil\n # @question.approved_by = current_user.id\n # @question.approved_on = DateTime.now\n # end\n\t\n @question.update_attributes(params[:question])\n unless @question.approval_level == -1\n respond_with @question\n\tend\n\t\n\t# set the section for this question\n\t#@question.section_id = @question.set_section\n \n # the quesiton is marked as refused, drop from database\n if @question.approval_level == -1\n \[email protected]\n destroyed = 1\n redirect_to approve_path, :notice => \"Successfully deleted question\"\n return\n end\n # if @question.update_attributes(params[:question])\n # # determine user and send them to appropriate page\n # if current_user.is_writer?\n # redirect_to write_path, :notice => \"Successfully updated question.\"\n # elsif current_user.is_approver?\n # redirect_to approve_path, :notice => \"Successfully updated question.\"\n # else\n # redirect_to @question, :notice => \"Successfully updated question.\"\n # end\n # else\n # render :action => 'edit'\n # end\n end",
"def update\n @survey_question.update(survey_question_params)\n @survey_question = SurveyQuestion.new\n @survey_questions = SurveyQuestion.all \n # respond_to do |format|\n # if @survey_question.update(survey_question_params)\n # format.html { redirect_to @survey_question, notice: 'Survey question was successfully updated.' }\n # format.json { render :show, status: :ok, location: @survey_question }\n # else\n # format.html { render :edit }\n # format.json { render json: @survey_question.errors, status: :unprocessable_entity }\n # end\n # end\n end",
"def update_rest\n @question_localized = QuestionLocalized.find(params[:id])\n\n respond_to do |format|\n if @question_localized.update_attributes(params[:question_localized])\n flash[:notice] = 'QuestionLocalized was successfully updated.'\n format.html { redirect_to(@question_localized) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @question_localized.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n check_delete_flg\n respond_to do |format|\n if @question.update_attributes(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @admin_academy_question.update(admin_academy_question_params)\n format.html { redirect_to @admin_academy_question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @admin_academy_question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @research_question.update(research_question_params)\n format.html { redirect_to @research_question, notice: 'Research question was successfully updated.' }\n format.json { render :show, status: :ok, location: @research_question }\n else\n format.html { render :edit }\n format.json { render json: @research_question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize! :edit, @questionnaire\n\n @questionnaire.load_JSON(params[:questionnaire], current_user)\n\n respond_to do |format|\n# if @questionnaire.update_attributes(params[:questionnaire])\n format.html { redirect_to @questionnaire, notice: 'Kysymyslomakkeen muokkaaminen onnistui.' }\n format.json { head :no_content }\n# else\n# format.html { render action: \"edit\" }\n# format.json { render json: @questionnaire.errors, status: :unprocessable_entity }\n# end\n\n end\n end",
"def update\n @questionset = Questionset.find(params[:id])\n\n respond_to do |format|\n if @questionset.update_attributes(params[:questionset])\n format.html { redirect_to @questionset, notice: 'Questionset was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @questionset.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @question_set = QuestionSet.find(params[:id])\n\n respond_to do |format|\n if @question_set.update_attributes(params[:question_set])\n format.html { redirect_to @question_set, notice: 'Question set was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question_set.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @quizzes_question.update(quizzes_question_params)\n if params[:commit] =~ /add/i\n format.html { redirect_to edit_quiz_question_path(@question.quiz, @question) }\n else\n format.html { redirect_to quiz_questions_path(@question.quiz), notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @quizzes_question }\n end\n else\n format.html { render :edit }\n format.json { render json: @quizzes_question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @question = Question.find(params[:id])\n \n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to(@question, :notice => 'Question was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @question.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n redirect_to \"/\"\n\n # respond_to do |format|\n # if @question.update(question_params)\n # format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n # format.json { render :show, status: :ok, location: @question }\n # else\n # format.html { render :edit }\n # format.json { render json: @question.errors, status: :bad_request }\n # end\n # end\n end",
"def update\n @survey = Survey.find(params[:id])\n success = @survey.update_attributes(params[:survey])\n \n puts \"UPDATE: Survey:#{@survey.id} - #{@survey.name}\"\n # Load the JSON Survey form data.\n survey_questions = ActiveSupport::JSON.decode(@survey.survey_data)\n #y survey_questions\n \n update_questions(@survey, survey_questions)\n \n # Render a response.\n respond_to do |format|\n if success\n format.html { redirect_to(@survey, :notice => 'Survey was successfully updated.') }\n format.xml { head :ok }\n format.js { head :ok}\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @survey.errors, :status => :unprocessable_entity }\n format.js { render :json => @survey.errors, :status => :error }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n @question_link = QuizQuestion.find_by_id(@question.questionid)\n @question_link.update(:points => params[:points])\n @quiz = Quiz.find_by_id(@question_link.quizid)\n format.html { redirect_to admin_quiz_path(@quiz), notice: 'Quiz multiple choice question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.67997867",
"0.6793198",
"0.6777838",
"0.67436785",
"0.6689164",
"0.6678309",
"0.6670506",
"0.6572901",
"0.65071225",
"0.648953",
"0.6486658",
"0.64773506",
"0.64766",
"0.6467119",
"0.64647025",
"0.6438719",
"0.6433398",
"0.64145887",
"0.6413029",
"0.6413029",
"0.6413029",
"0.6413029",
"0.6413029",
"0.6398653",
"0.63933384",
"0.63689774",
"0.6361429",
"0.6355441",
"0.63431776",
"0.63431776",
"0.63431776",
"0.6339449",
"0.6332492",
"0.6322808",
"0.63048154",
"0.63000077",
"0.629857",
"0.6261739",
"0.6242242",
"0.624121",
"0.62346673",
"0.6231444",
"0.6231444",
"0.6231444",
"0.6231444",
"0.6231444",
"0.6231444",
"0.6231444",
"0.6231444",
"0.6231444",
"0.6231444",
"0.6231444",
"0.6231444",
"0.6231444",
"0.6231444",
"0.6231444",
"0.6231444",
"0.6231444",
"0.6231444",
"0.62292385",
"0.6224699",
"0.6219823",
"0.62133086",
"0.62057924",
"0.6189775",
"0.61742276",
"0.6162961",
"0.61628604",
"0.61496526",
"0.61409706",
"0.61370945",
"0.6136053",
"0.6135411",
"0.6130702",
"0.61246234",
"0.61086154",
"0.61077887",
"0.61060196",
"0.61016077",
"0.6088778",
"0.6085628",
"0.6085062",
"0.6077688",
"0.607406",
"0.60733974",
"0.6069379",
"0.6065943",
"0.60658723",
"0.6059403",
"0.60504323",
"0.60331374",
"0.6023843",
"0.6019487",
"0.60162324",
"0.601308",
"0.6004171",
"0.5991383",
"0.5990959",
"0.5978496",
"0.5973496"
] | 0.6797166 | 1 |
DELETE /commonquestions/1 DELETE /commonquestions/1.json | def destroy
@commonquestion.destroy
respond_to do |format|
format.html { redirect_to commonquestions_url, notice: 'Commonquestion was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n if @v1_question.destroy\n render json: {'message': 'Deleted question successfully'}, status: :ok\n else\n render json: get_errors, status: :unprocessable_entity\n end\n\n end",
"def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to api_v1_questions_url }\n format.json { head :no_content }\n end\n end",
"def delete_question\n question_params = params.permit(:id, :form_id, :question_type_id)\n\n render json: Question.delete_question(question_params)\n end",
"def destroy\n @test_question = TestQuestion.find(params[:id])\n @test_question.destroy\n\n respond_to do |format|\n format.html { redirect_to test_questions_url }\n format.json { head :ok }\n end\n end",
"def delete\n question = QuestionTest.where(test_id: params[:test_id], question_id: params[:id])\n if question.delete_all\n return render json: {message: 'Question was removed succesfully.', error: false}\n else\n return render json: {message: 'Error: Something went wrong. Question was not removed.', error: true}\n end\n end",
"def destroy\n @examquestion.destroy\n respond_to do |format|\n format.html { redirect_to examquestions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @base_question = BaseQuestion.find(params[:id])\n @base_question.destroy\n\n respond_to do |format|\n format.html { redirect_to base_questions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_v1_question.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_questions_url, notice: 'Question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to admin_questions_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n #@question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n\tend",
"def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to survey_url(params[:survey_id]) }\n format.json { head :no_content }\n end\n end",
"def delete_questions\n items = get_items\n\n\n keys = []\n items.map do |item|\n keys << {\n 'Question' => item['Question'],\n 'Answer' => item['Answer'].to_i\n }\n end\n\n keys.each do |key|\n DYNAMODB.delete_item({\n table_name: TABLE_NAME,\n key: key\n })\n end\n\n make_response(HttpStatus::OK, {meesage: 'questions deleted'})\nend",
"def destroy\n @questionable = @question.questionable\n @question.destroy\n respond_to do |format|\n format.html\n format.json { head :no_content }\n end\n end",
"def destroy\n @questionnaire.destroy\n respond_to do |format|\n format.html { redirect_to questionnaires_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @b_question.destroy\n respond_to do |format|\n format.html { redirect_to questions_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @my_question = MyQuestion.find(params[:id])\n @my_question.destroy\n\n respond_to do |format|\n format.html { redirect_to my_questions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n @mongo_question.destroy\n respond_to do |format|\n format.html { redirect_to mongo_questions_url, notice: 'Mongo question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @intern_question = InternQuestion.find(params[:id])\r\n @intern_question.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to intern_questions_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @question.destroy\n head :no_content\n end",
"def destroy\n @critical_question = CriticalQuestion.find(params[:id])\n @critical_question.destroy\n\n respond_to do |format|\n format.html { redirect_to critical_questions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n\n @question.destroy\n \n respond_to do |format|\n format.html { redirect_to questions_url, notice: 'DNS was successfully removed.' }\n format.json { head :no_content }\n \nend\n end",
"def delete_questions\n response = Request.delete_request(URL_QUESTION)\n if response.success?\n redirect '/upload-csv'\n end\nend",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to category_questions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @parent_question.destroy\n respond_to do |format|\n format.html { redirect_to parent_questions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.active = [email protected]\n\n questions_json = @question.to_h.to_json\n\n url = @httpIp+'/pet.com/api/question/updateQuestion'\n uri = URI(url)\n res = Net::HTTP.post(uri, questions_json, \"Content-Type\" => \"application/json\")\n puts res.body\n flash[:notice] = \"successfully deleted\"\n redirect_to questions_path\n end",
"def destroy\n @test_question.destroy\n respond_to do |format|\n format.html { redirect_to test_questions_url, notice: 'Test question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @test_question.destroy\n respond_to do |format|\n format.html { redirect_to test_questions_url, notice: 'Test question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @questionnaire = Questionnaire.find(params[:id])\n @questionnaire.destroy\n\n respond_to do |format|\n format.html { redirect_to questionnaires_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @questionnaire = Questionnaire.find(params[:id])\n @questionnaire.destroy\n\n respond_to do |format|\n format.html { redirect_to questionnaires_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to quiz_path(@question.subsection_id) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to paper_questions_path, notice: '題目已被成功刪除' }\n format.json { head :no_content }\n end\n end",
"def delete\n supprimer = QuestionOuverteService.instance.supprimerQuestion(params[:id])\n (supprimer) ? (render json: true, status: :ok) : (render json: false, status: :not_found)\n end",
"def destroy\n @survey_question = SurveyQuestion.find(params[:id])\n @survey_question.destroy\n\n respond_to do |format|\n format.html { redirect_to survey_questions_url }\n # format.json { head :no_content }\n end\n end",
"def destroy\n @question_link = QuizQuestion.find_by_id(@question.questionid)\n @quiz = Quiz.find_by_id(@question_link.quizid)\n @question_link.destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to admin_quiz_path(@quiz), notice: 'Quiz multiple choice question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @multiple_choice_question = MultipleChoiceQuestion.find(params[:id])\n @multiple_choice_question.destroy\n\n respond_to do |format|\n format.html { redirect_to multiple_choice_questions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n #@admin_academy_question.destroy\n a = Academy::Question.find(params[:id].split('-')[0])\n a.update(:is_deleted => true)\n dest = a.id\n type = 4 #answer_question_code\n Notification.clear_notifications(type,dest)\n a.save\n\n respond_to do |format|\n format.html { redirect_to admin_academy_questions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cards_question = Cards::Question.find(params[:id])\n @cards_question.destroy\n\n respond_to do |format|\n format.html { redirect_to cards_questions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to root_path, notice: 'La pregunta ha sido eliminada!' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @survey_question_item = SurveyQuestionItem.find(params[:id])\n @survey_question_item.destroy\n\n respond_to do |format|\n format.html { redirect_to survey_question_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n #na real, cada question pertence a um quiz, basta achar a question de mesma id\n @qq = QuizQuestion.where(question: @question)\n @qq.destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: 'Question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n authorize! :destroy, @admin_question\n\n @admin_question.destroy\n respond_to do |format|\n format.html { redirect_to admin_questions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @questionset = Questionset.find(params[:id])\n @questionset.destroy\n\n respond_to do |format|\n format.html { redirect_to questionsets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @survey_question.destroy\n @survey_questions = SurveyQuestion.all\n # @survey_question.destroy\n # respond_to do |format|\n # format.html { redirect_to survey_questions_url, notice: 'Survey question was successfully destroyed.' }\n # format.json { head :no_content }\n # end\n end",
"def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end\n end",
"def destroy\n # before_action :set_question\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: \"質問を削除しました\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: '質問を削除しました' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to :back, notice: '質問を削除しました' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @questionpri.destroy\n respond_to do |format|\n format.html { redirect_to questionpris_path, notice: 'Mytest was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @questionstatu.destroy\n respond_to do |format|\n format.html { redirect_to questionstatus_index_path, notice: 'Mytest was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to admin_form_questions_path, notice: 'Вопрос успешно удалена' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question_response = QuestionResponse.find(params[:id])\n @question_response.destroy\n\n respond_to do |format|\n format.html { redirect_to question_responses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question_learned.destroy\n respond_to do |format|\n format.html { redirect_to question_question_learneds_path(@question) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @quick_answer = QuickAnswer.find(params[:id])\n @quick_answer.destroy\n\n respond_to do |format|\n format.html { redirect_to quick_answers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question_set = QuestionSet.find(params[:id])\n @question_set.destroy\n\n respond_to do |format|\n format.html { redirect_to question_sets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @add_question.destroy\n respond_to do |format|\n format.html { redirect_to add_questions_url, notice: 'Add question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: \"Question was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: 'Question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: 'Question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: 'Question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: 'Question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: 'Question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: 'Question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: 'Question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: 'Question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: 'Question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: 'Question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: 'Question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: 'Question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: 'Question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: 'Question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: 'Question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: 'Question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: 'Question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: 'Question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: 'Question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: 'Question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: 'Question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: 'Question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @comments = Comment.where(question_id: @question.id)\n @comments.each do |comment|\n comment.destroy\n end\n @question.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @survey_question = Survey::Question.find(params[:id])\n @survey_question.destroy\n\n respond_to do |format|\n format.html { redirect_to survey_questions_url }\n\n end\n end",
"def destroy\n @question_field = QuestionField.find(params[:id])\n @question_field.destroy\n\n respond_to do |format|\n format.html { redirect_to question_fields_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question = Question.find(params[:id])\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: '削除しました。' }\n format.json { head :no_content }\n end\n end",
"def destroy_rest\n @question_localized = QuestionLocalized.find(params[:id])\n @question_localized.destroy\n\n respond_to do |format|\n format.html { redirect_to(question_localizeds_url) }\n format.xml { head :ok }\n end\n end"
] | [
"0.7381674",
"0.72378504",
"0.7228066",
"0.7203905",
"0.7185327",
"0.7160035",
"0.7145627",
"0.71429074",
"0.71427125",
"0.7140694",
"0.7135828",
"0.7135828",
"0.7135828",
"0.7135828",
"0.7135828",
"0.7135828",
"0.7121184",
"0.7119238",
"0.71085715",
"0.7104204",
"0.7101424",
"0.7094055",
"0.70717514",
"0.70717514",
"0.7060099",
"0.70586765",
"0.7058324",
"0.7058324",
"0.7058324",
"0.7058324",
"0.7058324",
"0.7058324",
"0.70575994",
"0.70546997",
"0.7045442",
"0.704532",
"0.70403236",
"0.702788",
"0.70185953",
"0.6996163",
"0.6972096",
"0.69670993",
"0.6963179",
"0.6963179",
"0.6958618",
"0.6958618",
"0.6956662",
"0.69486815",
"0.6948523",
"0.69441664",
"0.69335073",
"0.6932015",
"0.6894009",
"0.6892419",
"0.6890327",
"0.68862516",
"0.6875278",
"0.6867149",
"0.6859203",
"0.6855833",
"0.6854385",
"0.6851315",
"0.68393785",
"0.6829792",
"0.68261206",
"0.6818387",
"0.68134373",
"0.6798588",
"0.67945105",
"0.67944974",
"0.67890793",
"0.6785762",
"0.67725754",
"0.67691",
"0.67691",
"0.67691",
"0.67691",
"0.67691",
"0.67691",
"0.67691",
"0.67691",
"0.67691",
"0.67691",
"0.67691",
"0.67691",
"0.67691",
"0.67691",
"0.67691",
"0.67691",
"0.67691",
"0.67691",
"0.67691",
"0.67691",
"0.67691",
"0.67691",
"0.6766971",
"0.67662895",
"0.6763949",
"0.6758778",
"0.675265"
] | 0.76137227 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_commonquestion
@commonquestion = Commonquestion.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 commonquestion_params
params.require(:commonquestion).permit(:commonquestion_id, :question_text, :options, :answer_option_number, :question_id, :parttype_id, :questiontype_id)
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 |
First Init , return error string or nil | def init_var
@all_glossaries_configs = []
@dict_id = params[:dict_id]
DictConfig.all().each {|d|
if d.protocol=='glossary'
@all_glossaries_configs << d
@dict_id = d['dict_sys_name'] if @dict_id == nil
end
}
params[:dict_id] = @dict_id
puts("ALL ")
puts(DictConfig.where(protocol: 'glossary').inspect())
@key_lang = "?"
@prim_lang = "?"
@sec_lang = "?"
@dict_name = "?"
@dict_id = nil
@dict_config=nil
if params[:dict_id]==nil
return
end
@dict_config=DictConfig.find_by( dict_sys_name: params[:dict_id])
puts("dict_config"+@dict_config.inspect())
if @dict_config==nil
return
end
puts("OK")
begin
@dict_ext_cfg = JSON.parse(@dict_config.cfg)
rescue Exception => e
return
end
puts(@dict_config.inspect)
@dict_name = @dict_config.dict_name
@key_lang = @dict_ext_cfg['config']['key_words_lang']
@prim_lang = @dict_ext_cfg['config']['primary_xlate_lang']
@sec_lang = @dict_ext_cfg['config']['secondary_xlate_lang']
@dict_id= params[:dict_id]
return
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize()\n @mes = \"Error: Not enough arguments\"\n end",
"def init\n @init.call if @init\n end",
"def load_error=(_arg0); end",
"def init\n end",
"def init\n end",
"def init\n end",
"def init\n raise NotImplementedError\n end",
"def init; end",
"def init; end",
"def init; end",
"def init; end",
"def initError(msg)\n raise ArgumentError, msg\nend",
"def initialize() end",
"def initialize(id)\n\t\t@error_code = id\n\tend",
"def initialized?; end",
"def initialized?; end",
"def initialized?; end",
"def initialized?; end",
"def initialize\n puts MESSAGE_MAIN\n @str = stty\n call\n end",
"def error\n nil\n end",
"def initialize\n puts INITIALIZER_MESSAGE\n end",
"def initialize\n super('succeed')\n end",
"def initialize(p0=\"\") end",
"def initialize\n init\n end",
"def initialize\n @errors = nil\n end",
"def init(string)\n return string[0]\nend",
"def Init()\n end",
"def error\n nil\n end",
"def initialize(error, json_props, server_bundle)\n @error = error\n @json_props = json_props\n @server_bundle = server_bundle\n @text = error.to_s\n end",
"def initial?; end",
"def init\n\n end",
"def init\n\t\tself.name ||= \"Please give me a name and a home!\"\n\t\tself.description ||= \"No description given\"\n\t\tself.age ||= \"No age listed\"\n\t\tself.size ||= \"No size listed\"\n\t\tself.gender ||= \"No gender listed\"\n\t\tself.breed ||= \"No breed listed\"\n\t\tself.special_needs ||= \"No records of any special needs\"\n\t\tself.contact_city ||= \"No contact city on record\"\n\t\tself.contact_state ||= \"No contact state on record\"\n\t\tself.contact_zip ||= \"No contact zip code on record\"\n\t\tself.contact_address ||= \"No contact address on record\"\n\t\tself.contact_email ||= (find_email(self.description) || \"No contact email address on record\")\n\t\tself.contact_phone ||= (find_phone_number(self.description) || \"No contact phone number on record\")\n\tend",
"def initialize\n\t \t# loading or not loading should be the key here.\n end",
"def error=(_arg0); end",
"def error=(_arg0); end",
"def error=(_arg0); end",
"def initialize(string=\"\", mode=0) end",
"def initialize(string)\t\n\t\tself.string = string\n\tend",
"def initialize(error_type, error_code, error_message, display_message, request_id)\n @error_type = error_type\n @error_code = error_code\n @error_message = error_message\n @display_message = display_message\n @request_id = request_id\n\n super \"\\n\"\\\n \"Error Type : #{@error_type}\\n\"\\\n \"Error Code : #{@error_code}\\n\"\\\n \"Error Message : #{@error_message}\\n\"\\\n \"Display Message : #{@display_message}\\n\"\\\n \"Request ID : #{@request_id}\\n\"\n end",
"def initialize()\n raise \"#{self.class.to_s} should not be instantiated directly.\"\n end",
"def init_r(str=nil)\n return true unless str\n begin\n r.eval_R(str)\n rescue Exception => e\n @error = e\n return false\n end\n end",
"def initialize\r\n @opts = Opts.new\r\n @state = State::UNKNOWN # undefined (unknown) state - needs to run first\r\n @error_msg = '' # last error message\r\n end",
"def test_initialization\n exc_handler = HumanParseExceptionHandler.new\n new_str = exc_handler.get_human_result_for_string(\"foobar\",\"ParseException\")\n assert_equal(false, new_str)\n end",
"def initialize(details)\n @details = details\n @error = nil\n end",
"def initialize\n\n\tend",
"def initialize\n\n\tend",
"def error?; end",
"def error?; end",
"def error?; end",
"def initialize\n initialize!\n end",
"def initialize\n initialize!\n end",
"def initialize_default_instance_vars\n @success = true\n @code = STATUS_CODE[:ok]\n end",
"def initialize(string=\"\", mode=MaglevUndefined)\n self._initialize(string, mode, false)\n end",
"def initialize\n @errores = nil\n end",
"def initialize()\n end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def at_init\n\n\t\tend",
"def initialize_from_string(string)\n raise NotImplementedError\n end",
"def initialize()\n\t\tend",
"def initialize()\n @template = \"call load_file() or load_url() to load a template\"\n @loadOK = false \n end",
"def initialize(hash = {})\n @name = (@@next_name += 1)\n \n if hash[:error] == :self\n super self\n elsif hash[:error].nil?\n super :error\n else\n hash[:error] = hash[:error].to_sym if hash[:error].respond_to? :to_sym\n super hash[:error]\n end\n \n @final = hash[:final] || false\n \n self\n end",
"def init; end",
"def initialize(message)\n\t\t$stderr.puts \"#{@name}: initialize not overridden!\"\n\tend",
"def init_could(username,key)\n \n begin\n cf = CloudFiles::Connection.new(:username => username, :api_key => key)\n rescue CloudFiles::Exception::Authentication\n\tSTDERR.puts \"Not authenticated\"\n exit\n rescue CloudFiles::Exception::ExpiredAuthToken\n\tSTDERR.puts \"Token Expired\"\n exit\n rescue CloudFiles::Exception::Connection\n\tSTDERR.puts \"Connection Error, Aborted\"\n exit\n rescue CloudFiles::Exception::InvalidResponse\n\tSTDERR.puts \"Invalid response\"\n exit\n end\n\n return cf\nend",
"def error\n valid? ? nil : @error_message\n end",
"def initialize(resources, error='')\n @resources = resources\n @error = error\n end",
"def initialize\n\t\t\n\tend",
"def user_init; end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def init?\n @init\n end",
"def fullInit\n\t\tp 'JabberClient.fullInit'\n\tend",
"def initialize(init_via = nil)\n super(init_via)\n\n # Validate that required fields are present, at least - if we've downloaded it from a url\n parse_error! unless location\n end",
"def pre_initialize\n end",
"def initialize(source_hash = nil, default = nil, &blk)\n super\n @errors = Restish::Errors.new(self)\n end",
"def initial\n end",
"def initialize()\r\n @root = nil\r\n @empty_string_exist = false\r\n end",
"def init(data)\n\t\t\traise InvalidDataError, 'No id found' unless data.has_key?('id')\n\t\t\t@id = data['id']\n\n\t\t\traise InvalidDataError, 'No name found' unless data.has_key?('name')\n\t\t\t@name = data['name']\n\n\t\t\traise InvalidDataError, 'No created_at found' unless data.has_key?('created_at')\n\t\t\t@created_at = DateTime.strptime(String(data['created_at']), '%s') unless data['created_at'].nil?\n\n\t\t\traise InvalidDataError, 'No status found' unless data.has_key?('status')\n\t\t\t@status = data['status']\n\n\t\t\traise InvalidDataError, 'No hash_type found' unless data.has_key?('hash_type')\n\t\t\t@hash_type = data['hash_type']\n\n\t\t\traise InvalidDataError, 'No hash found' unless data.has_key?('hash')\n\t\t\t@hash = data['hash']\n\n\t\t\traise InvalidDataError, 'No last_request found' unless data.has_key?('last_request')\n\t\t\t@last_request = DateTime.strptime(String(data['last_request']), '%s') unless data['last_request'].nil?\n\n\t\t\traise InvalidDataError, 'No last_success found' unless data.has_key?('last_success')\n\t\t\t@last_success = DateTime.strptime(String(data['last_success']), '%s') unless data['last_success'].nil?\n\n\t\t\traise InvalidDataError, 'No output_type found' unless data.has_key?('output_type')\n\t\t\t@output_type = data['output_type']\n\n\t\t\traise InvalidDataError, 'No output_params found' unless data.has_key?('output_params')\n\t\t\t@output_params = parseOutputParams(data['output_params'])\n\n\t\t\t@is_deleted = true if @status == STATUS_DELETED\n\t\tend",
"def initialize\n puts \"constructor is automatically called when we create object\"\n end",
"def initialize(env)\n @reference = generate_error_reference\n extract_information_from(env)\n end",
"def initialize(options_or_uri = T.unsafe(nil)); end",
"def error\n return {error: \"\"}\n end",
"def error; end",
"def error; end",
"def error; end",
"def error; end"
] | [
"0.6321575",
"0.6040971",
"0.60351413",
"0.5995689",
"0.5995689",
"0.5995689",
"0.59926957",
"0.5960617",
"0.5960617",
"0.5960617",
"0.5960617",
"0.59112006",
"0.58675545",
"0.58289504",
"0.58198303",
"0.58198303",
"0.58198303",
"0.58198303",
"0.5812501",
"0.58097774",
"0.57853884",
"0.57713056",
"0.5755909",
"0.5743512",
"0.5739428",
"0.57393724",
"0.5737386",
"0.57141846",
"0.5680076",
"0.56529045",
"0.5633894",
"0.56338257",
"0.5631177",
"0.5628747",
"0.5628747",
"0.5628747",
"0.5614839",
"0.56091726",
"0.5608224",
"0.5598529",
"0.55875766",
"0.5571985",
"0.5555668",
"0.5541542",
"0.55337626",
"0.55337626",
"0.55241495",
"0.55241495",
"0.55241495",
"0.5517373",
"0.5517373",
"0.54907745",
"0.54887706",
"0.5488116",
"0.5470499",
"0.546917",
"0.546917",
"0.546917",
"0.546917",
"0.546917",
"0.546917",
"0.546917",
"0.546917",
"0.546917",
"0.546917",
"0.546917",
"0.5467671",
"0.5467258",
"0.5462746",
"0.54625505",
"0.54524",
"0.54509705",
"0.54505074",
"0.5432925",
"0.5428684",
"0.54278696",
"0.542705",
"0.54221916",
"0.5412979",
"0.5409093",
"0.5409093",
"0.5409093",
"0.5409093",
"0.5409093",
"0.5409093",
"0.54046726",
"0.537929",
"0.5375714",
"0.5352284",
"0.5351308",
"0.53439724",
"0.533409",
"0.5323918",
"0.5323161",
"0.53069943",
"0.52864754",
"0.5282061",
"0.5281627",
"0.5281627",
"0.5281627",
"0.5281627"
] | 0.0 | -1 |
GET /glossaries GET /glossaries.json | def index
@glossaries = []
err = init_var()
if(@dict_id!=nil)
if params[:to_search] == nil or
params[:to_search] == ''
@glossaries = Glossary.where(
[ "dict_id = :dict_id ",
{ dict_id: @dict_id } ] ).limit(100)
else
@glossaries = Glossary.where(
[ "dict_id = :dict_id and key_words = :key_words ",
{ dict_id: @dict_id , key_words: params[:to_search] } ] )
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n if logged_in?\n @glossaries = current_user.glossaries.find(:all)\n end\n end",
"def new\n @glossary = Glossary.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @glossary }\n end\n end",
"def show\n set_glossary_locale(params[:locale]) if params[:locale]\n\n respond_to do |format|\n format.html {\n redirect_to glossary_terms_path(params[:id])\n }\n format.json {\n @glossary = Glossary.find(params[:id]).prepare_for_display\n render json: @glossary\n }\n end\n end",
"def index\n @glossaries = Glossary.order('title')\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @glossaries.to_xml }\n end\n end",
"def create\n @glossary = Glossary.create_glossary(params[:glossary])\n\n respond_to do |format|\n if @glossary.save\n format.html { redirect_to @glossary, notice: 'Glossary was successfully created.' }\n format.json { render json: @glossary, status: :created, location: @glossary }\n else\n format.html { render action: \"new\" }\n format.json { render json: @glossary.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @glossary = Glossary.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @glossary.to_xml }\n end\n end",
"def create\n authorize_action_for Glossary\n @glossary = Glossary.new(glossary_params)\n @glossary.user = current_user\n\n respond_to do |format|\n if @glossary.save\n format.html { redirect_to @glossary, notice: 'Glossary was successfully created.' }\n format.json { render :show, status: :created, location: @glossary }\n else\n format.html { render :new }\n format.json { render json: @glossary.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_glossary\n @glossary = Glossary.find(params[:id])\n end",
"def create\n @glossary = Glossary.new(glossary_params)\n @glossary.setup_record()\n\n respond_to do |format|\n if @glossary.save\n format.html { redirect_to @glossary, notice: 'Glossary was successfully created.' }\n format.json { render :show, status: :created, location: @glossary }\n else\n format.html { render :new }\n format.json { render json: @glossary.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @glossary = Glossary.find(params[:id])\n saved = @glossary.update_glossary(params[:glossary])\n\n respond_to do |format|\n if saved\n format.html { redirect_to @glossary, notice: 'Glossary was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @glossary.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_glossary\n @glossary = Glossary.friendly.find(params[:id])\n end",
"def index\n @glossary_labels = GlossaryLabel.all\n end",
"def create\n @glossary = Glossary.new(glossary_params)\n\n respond_to do |format|\n if @glossary.save\n flash[:notice] = ts('new.successful', :what => Glossary.model_name.human.capitalize)\n format.html { redirect_to glossaries_url }\n format.xml { head :created, :location => glossary_url(@glossary) }\n else\n format.html do\n @organizations = Organization.order('title')\n render :action => 'new'\n end\n format.xml { render :xml => @glossary.errors.to_xml }\n end\n end\n end",
"def destroy\n @glossary = Glossary.find(params[:id])\n @glossary.destroy\n\n respond_to do |format|\n format.html { redirect_to glossaries_url }\n format.json { head :no_content }\n end\n end",
"def init_glossaries\n\t@dict_id = params[:dict_id]\n\t@lang_cfg= nil \n\t@fields = nil\n \tget_all_glossaries_configs() \n\t@lang_codes=Dictionaries.new([]).lang_codes\n\tparams[:dict_id] = @dict_id \n\t@dict_id = nil\n\t@dict_config=nil\n\tif params[:dict_id]==nil\n\t\treturn\n\tend\n\t@dict_config=DictConfig.find_by( dict_sys_name: params[:dict_id])\n\t\tif @dict_config==nil\n\t\t\treturn\n\t\tend\n\t\tbegin\n\t\t\text= JSON.parse(@dict_config.cfg)\n\t\t\tif ext != nil and ext[\"config\"] != nil and ext[\"config\"][\"languages\"]!= nil\n\t\t\t\t@lang_cfg= ext[\"config\"][\"languages\"]\n\t\t\tend\n\t\t\trescue Exception => e\n\t\treturn \n\tend\n\t@dict_name = @dict_config.dict_name\n\t@dict_id= params[:dict_id]\n\treturn \n end",
"def glossary_params\n params.require(:glossary).permit(:dict_id, :key_words, :word_type, :category, :primary_xlate, :secondary_xlate,:digest)\n end",
"def update\n authorize_action_for @glossary\n respond_to do |format|\n if @glossary.update(glossary_params)\n format.html { redirect_to @glossary, notice: 'Glossary was successfully updated.' }\n format.json { render :show, status: :ok, location: @glossary }\n else\n format.html { render :edit }\n format.json { render json: @glossary.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @glossary.destroy\n respond_to do |format|\n format.html { redirect_to glossaries_url, notice: 'Glossary was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def glossary_terms_list_with_http_info(account_id, glossary_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: GlossaryTermsApi.glossary_terms_list ...'\n end\n # verify the required parameter 'account_id' is set\n if @api_client.config.client_side_validation && account_id.nil?\n fail ArgumentError, \"Missing the required parameter 'account_id' when calling GlossaryTermsApi.glossary_terms_list\"\n end\n # verify the required parameter 'glossary_id' is set\n if @api_client.config.client_side_validation && glossary_id.nil?\n fail ArgumentError, \"Missing the required parameter 'glossary_id' when calling GlossaryTermsApi.glossary_terms_list\"\n end\n # resource path\n local_var_path = '/accounts/{account_id}/glossaries/{glossary_id}/terms'.sub('{' + 'account_id' + '}', CGI.escape(account_id.to_s)).sub('{' + 'glossary_id' + '}', CGI.escape(glossary_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil?\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 header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'Array<GlossaryTerm>' \n\n # auth_names\n auth_names = opts[:auth_names] || ['Basic', 'Token']\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(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: GlossaryTermsApi#glossary_terms_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n response = ::Phrase::Response.new(data, headers)\n return response, status_code, headers\n end",
"def recipebook\n @levels = Level.all\n\n respond_to do |format|\n format.html # recipebook.html.erb\n format.json { render json: @levels }\n end\n end",
"def destroy\n @glossary = Glossary.find(params[:id])\n @glossary.destroy\n\n respond_to do |format|\n format.html { redirect_to glossaries_url }\n format.xml { head :ok }\n end\n end",
"def index\n @glossaries_total = Glossary.search(params[:search])\n @glossaries_total = @glossaries_total.tagged_with(params[:tag]) if params[:tag]\n @glossaries = @glossaries_total.paginate( page: params[:page], per_page: 10 )\n\n set_meta_tags og: {\n title: \"Ruby & Rails Glossary #{Glossary.count}\",\n description: \"루비와 레일스 용어집. 함께 만들어가면 어렵지 않습니다. \",\n image: root_url[0..-2] + ActionController::Base.helpers.asset_url('glossary.png'),\n url: glossaries_url\n }, title: \"Ruby and Rails Glossary #{Glossary.count}\"\n end",
"def update\n @glossary = Glossary.find(params[:id])\n\n respond_to do |format|\n if @glossary.update_attributes(glossary_params)\n flash[:notice] = ts('edit.successful', :what => Glossary.model_name.human.capitalize)\n format.html { redirect_to glossaries_url }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @glossary.errors.to_xml }\n end\n end\n end",
"def destroy\n authorize_action_for @glossary\n @glossary.destroy\n respond_to do |format|\n format.html { redirect_to glossaries_url, notice: 'Glossary was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def create\n @glossary_label = GlossaryLabel.new(glossary_label_params)\n\n respond_to do |format|\n if @glossary_label.save\n format.html { redirect_to @glossary_label, notice: 'Glossary label was successfully created.' }\n format.json { render :show, status: :created, location: @glossary_label }\n else\n format.html { render :new }\n format.json { render json: @glossary_label.errors, status: :unprocessable_entity }\n end\n end\n end",
"def glossary_params\n params.require(:glossary).permit(:user_id, :term, :word_class, :idiomatic, :memo, :tag_tokens, glossary_definitions_attributes: [:id, :user_id, :definition, :sentence, :_destroy])\n end",
"def glossary_label_params\n params.fetch(:glossary_label, {})\n end",
"def index\n @garplies = Garply.all\n end",
"def update\n respond_to do |format|\n puts(glossary_params)\n tmp = Glossary.new(glossary_params)\n tmp.setup_record()\n if @glossary.update(tmp.params())\n ##if @glossary.update(glossary_params)\n format.html { redirect_to @glossary, notice: 'Glossary was successfully updated.' }\n format.json { render :show, status: :ok, location: @glossary }\n else\n format.html { render :edit }\n format.json { render json: @glossary.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @glasses = Glass.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @glasses }\n end\n end",
"def index\n @lophs = Loph.all\n respond_to do |format|\n format.html\n format.json { render json: @lophs}\n end\n end",
"def update\n respond_to do |format|\n if @glossary_label.update(glossary_label_params)\n format.html { redirect_to @glossary_label, notice: 'Glossary label was successfully updated.' }\n format.json { render :show, status: :ok, location: @glossary_label }\n else\n format.html { render :edit }\n format.json { render json: @glossary_label.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @reward_and_levels = RewardAndLevel.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reward_and_levels }\n end\n end",
"def index\n @laws = Law.ordered_roots\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @laws }\n end\n end",
"def index\n @graduations = Graduation.all\n end",
"def index\n @german_go_leagues = GermanGoLeague.all\n\t\t@title = \"Bundesliga Spiele\"\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @german_go_leagues }\n end\n end",
"def show\n @gl = Gl.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gl }\n end\n end",
"def index\n @level_progrations = LevelProgration.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @level_progrations }\n end\n end",
"def show\n @lifestyle_subgenre = LifestyleSubgenre.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lifestyle_subgenre }\n end\n end",
"def find_glossary_term!\n @glossary_term = find_or_goto_index(GlossaryTerm,\n params[:id].to_s)\n end",
"def index\n @bounties = Bounty.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @bounties }\n end\n end",
"def index\n @guys = Guy.all\n respond_to do |format|\n format.json { render json: @guys }\n end\n end",
"def glossary_terms_list(account_id, glossary_id, opts = {})\n data, _status_code, _headers = glossary_terms_list_with_http_info(account_id, glossary_id, opts)\n data\n end",
"def index\n @fiction = Fiction.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @fiction }\n end\n end",
"def index\n @gls = Gl.all\n end",
"def index\n @lounges = Lounge.all\n end",
"def index\n @lugars = Lugar.all\n\n render json: @lugars\n end",
"def index\n @losts = Lost.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @losts }\n end\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 index\n @laws = Law.sorted\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @laws }\n end\n end",
"def index\n @conflict_illnesses = ConflictIllness.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @conflict_illnesses }\n end\n end",
"def new\n @galaxies_lenticular_galaxy = Galaxies::LenticularGalaxy.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @galaxies_lenticular_galaxy }\n end\n end",
"def glossary_term_show_with_http_info(account_id, glossary_id, id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: GlossaryTermsApi.glossary_term_show ...'\n end\n # verify the required parameter 'account_id' is set\n if @api_client.config.client_side_validation && account_id.nil?\n fail ArgumentError, \"Missing the required parameter 'account_id' when calling GlossaryTermsApi.glossary_term_show\"\n end\n # verify the required parameter 'glossary_id' is set\n if @api_client.config.client_side_validation && glossary_id.nil?\n fail ArgumentError, \"Missing the required parameter 'glossary_id' when calling GlossaryTermsApi.glossary_term_show\"\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling GlossaryTermsApi.glossary_term_show\"\n end\n # resource path\n local_var_path = '/accounts/{account_id}/glossaries/{glossary_id}/terms/{id}'.sub('{' + 'account_id' + '}', CGI.escape(account_id.to_s)).sub('{' + 'glossary_id' + '}', CGI.escape(glossary_id.to_s)).sub('{' + 'id' + '}', CGI.escape(id.to_s))\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 header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'GlossaryTerm' \n\n # auth_names\n auth_names = opts[:auth_names] || ['Basic', 'Token']\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(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: GlossaryTermsApi#glossary_term_show\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n response = ::Phrase::Response.new(data, headers)\n return response, status_code, headers\n end",
"def available_grade_levels_json\n params.require(:workspace_id)\n\n # schools\n school_ids = queries.supported_schools.map(&:id).select do |school_id|\n queries.is_authorized_for_school_id?(school_id)\n end\n schools_json = School.find(school_ids).as_json(only: [:id, :name])\n\n # grade levels (include if any of their schools would allow it)\n grade_levels_next_year = queries.supported_grade_levels_next_year.select do |grade_level_next_year|\n grade_level_now = GradeLevels.new.previous(grade_level_next_year)\n school_ids.any? {|school_id| queries.is_authorized_for_grade_level_now?(school_id, grade_level_now) }\n end\n\n render json: {\n schools: schools_json,\n grade_levels_next_year: grade_levels_next_year\n }\n end",
"def show\n @galaxies_lenticular_galaxy = Galaxies::LenticularGalaxy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @galaxies_lenticular_galaxy }\n end\n end",
"def index\n @garnishes = Garnish.where(\"LOWER(name) like ?\", \"%#{params[:q] ? params[:q].downcase : ''}%\").paginate(:page => params[:page], :per_page => 198).order(:name)\n respond_to do |format|\n format.html\n format.json {render :json => @garnishes.map(&:attributes)}\n end\n end",
"def new\n @gl = Gl.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gl }\n end\n end",
"def badges\n get(\"user/#{user_id}/badges.json\")\n end",
"def show\n @gopy = Gopy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gopy }\n end\n end",
"def index\n @gonullus = Gonullu.all\n end",
"def show\n @citation = Citation.find(params[:id])\n @galaxies = @citation.galaxies\n @citation.galaxy_ids_array\n\n respond_to do |format|\n format.html { render :show }\n format.json { render :json => @citation.to_json(\n :only => [:title, :author, :bibtex, :journal, :year,\n :volume, :pages, :month, :note, :key],\n :methods => [:galaxy_ids_array]\n )\n }\n end\n end",
"def new\n @api_noun = Api::Noun.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @api_noun }\n end\n end",
"def index\n @clues = Clue.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clues }\n end\n end",
"def index\n @lodgings = Lodging.all\n end",
"def index\n @lodgings = Lodging.all\n end",
"def new\n @dictionary = Dictionary.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @dictionary }\n end\n end",
"def show\n @dictionary = Dictionary.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dictionary }\n end\n end",
"def index\n base_url = 'https://www.googleapis.com/books/v1/volumes?q=fiction&maxResults=20'\n and_key = '&key='\n key = ENV['GOOGLE_BOOKS_API_KEY'] \n googleurl = base_url + and_key + key\n\n response = RestClient.get(googleurl)\n @books = JSON.parse(response)\n\n respond_to do |format|\n format.html\n format.json { render json: @books }\n end\n\nend",
"def index\n @references = Reference.all\n\n render json: @references\n end",
"def index\n @book_genres = BookGenre.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @book_genres }\n end\n end",
"def new\n @lifestyle_subgenre = LifestyleSubgenre.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lifestyle_subgenre }\n end\n end",
"def index\n @nouns = Noun.all\n end",
"def getRandomWord\n @word = Wordnik.words.get_random_word(\n includePartOfSpeech: \"noun\",\n minLength: 5,\n maxLength: 10\n )\n if request.xhr?\n render :json => @word\n end\n end",
"def index\n @pledges = Pledge.where('user_id = ?', current_user.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pledges }\n end\n end",
"def new\n @constitution = Constitution.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @constitution }\n end\n end",
"def index\n @genotypes = Genotype.paginate(:page => params[:page], :per_page => 10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @genotypes }\n end\n end",
"def new\n @genotype = Genotype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @genotype }\n end\n end",
"def show\n @genotype = Genotype.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @genotype }\n end\n end",
"def new\n @lyric = Lyric.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lyric }\n end\n end",
"def index\n @gravities = Gravity.all\n end",
"def glossary_term_show(account_id, glossary_id, id, opts = {})\n data, _status_code, _headers = glossary_term_show_with_http_info(account_id, glossary_id, id, opts)\n data\n end",
"def new\n @gopy = Gopy.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gopy }\n end\n end",
"def index\n @lessons = Lesson.all\n\n render 'index.json'\n end",
"def index\n @greats = Great.all\n end",
"def index\n @undergraduate_majors = UndergraduateMajor.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @undergraduate_majors }\n end\n end",
"def new\n @fiction = Fiction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fiction }\n end\n end",
"def index\n @health_levels = HealthLevel.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @health_levels }\n end\n end",
"def index\n @education_levels = EducationLevel.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @education_levels }\n end\n end",
"def gist(id)\n get \"/gists/#{id}\"\n end",
"def new\n @glass = Glass.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @glass }\n end\n end",
"def index\n @words = Word.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @words }\n end\n end",
"def index\n @o_rganizations = ORganization.all\n end",
"def show\n @sundry_grn = SundryGrn.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @sundry_grn }\n end\n end",
"def glossarize_string(text, *args, &block)\n\t\t\tdoc = Hpricot(text)\n\t\t\tdoc.traverse_element(*args[0].dup) do |e|\n\t\t\t\tif !glossary.nil? and [Hpricot::Doc, Hpricot::Elem,Hpricot::Text].include?(e.class)\n #glossary.sort{|a, b| a[0].length <=> b[0].length}.each do |k,v|\n\t\t\t\t\tglossary.each do |k, v|\n\t\t\t\t\t\te.text_sub!(Regexp.new(\"([^-<>])(\\\\b#{k.to_s}\\\\b)([^-<>])(?![^<]*>|[^<]*<\\/(span|a|b|em|strong)>|[^<]*<br\\/>|[^<]*<(sup|em|strong)>)\"), '\\1<a class=\"info\" href=\"javascript:void(0);\">\\2<span>' + word_wrap(v) + '</span></a>\\3')\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\t\tdoc.to_s\n\t\tend",
"def index\n @grades = Grade.all\n render json: {data: @grades, status: \"SUCCESS\"}, :status => 200\n end",
"def get_notary_jurisdictions_with_http_info()\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: NotaryApi.get_notary_jurisdictions ...\"\n end\n # resource path\n local_var_path = \"/v2.1/current_user/notary/jurisdictions\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_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 :return_type => 'NotaryJurisdictionList')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: NotaryApi#get_notary_jurisdictions\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def gist_url\n \"#{api_url}/gists/%s\"\n end",
"def new\n @livingexpense = Livingexpense.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @livingexpense }\n end\n end",
"def show\n @api_noun = Api::Noun.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @api_noun }\n end\n end",
"def index\n @lounges = Lounge.new \n @all_lounges = Lounge.all\n end"
] | [
"0.7041864",
"0.700592",
"0.6751456",
"0.6749251",
"0.66519606",
"0.6384426",
"0.62804675",
"0.6259578",
"0.6253161",
"0.6244677",
"0.61971176",
"0.61315054",
"0.6062072",
"0.6058682",
"0.60491383",
"0.59864384",
"0.5920943",
"0.59018576",
"0.58186656",
"0.57629323",
"0.576259",
"0.56949353",
"0.567226",
"0.5657426",
"0.564008",
"0.55829495",
"0.557606",
"0.5478015",
"0.5467472",
"0.5454644",
"0.54224133",
"0.5407015",
"0.53812855",
"0.5329278",
"0.52940357",
"0.5269933",
"0.5267168",
"0.5263693",
"0.5261851",
"0.524577",
"0.5243366",
"0.523306",
"0.5228848",
"0.5216753",
"0.5211411",
"0.52086073",
"0.52006125",
"0.51899195",
"0.51827395",
"0.51614416",
"0.51520455",
"0.5145405",
"0.51397973",
"0.51188195",
"0.511653",
"0.5115148",
"0.5114158",
"0.51051235",
"0.5102032",
"0.51018584",
"0.5096244",
"0.50958246",
"0.5076384",
"0.50747615",
"0.50747615",
"0.50722593",
"0.50656855",
"0.50632405",
"0.5061736",
"0.50609666",
"0.5058399",
"0.50579166",
"0.5056329",
"0.50504386",
"0.50490123",
"0.5031293",
"0.5031053",
"0.5028287",
"0.5027177",
"0.5019292",
"0.501287",
"0.50105107",
"0.5009956",
"0.50071126",
"0.50008124",
"0.49972013",
"0.49949348",
"0.49934795",
"0.4990973",
"0.49846154",
"0.4981017",
"0.49788317",
"0.49775243",
"0.49705434",
"0.49661994",
"0.4963382",
"0.49546993",
"0.49514365",
"0.4946526",
"0.49459422"
] | 0.64131814 | 5 |
GET /glossaries/1 GET /glossaries/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @glossary = Glossary.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @glossary }\n end\n end",
"def show\n set_glossary_locale(params[:locale]) if params[:locale]\n\n respond_to do |format|\n format.html {\n redirect_to glossary_terms_path(params[:id])\n }\n format.json {\n @glossary = Glossary.find(params[:id]).prepare_for_display\n render json: @glossary\n }\n end\n end",
"def index\n if logged_in?\n @glossaries = current_user.glossaries.find(:all)\n end\n end",
"def create\n @glossary = Glossary.create_glossary(params[:glossary])\n\n respond_to do |format|\n if @glossary.save\n format.html { redirect_to @glossary, notice: 'Glossary was successfully created.' }\n format.json { render json: @glossary, status: :created, location: @glossary }\n else\n format.html { render action: \"new\" }\n format.json { render json: @glossary.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @glossaries = Glossary.order('title')\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @glossaries.to_xml }\n end\n end",
"def show\n @glossary = Glossary.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @glossary.to_xml }\n end\n end",
"def update\n @glossary = Glossary.find(params[:id])\n saved = @glossary.update_glossary(params[:glossary])\n\n respond_to do |format|\n if saved\n format.html { redirect_to @glossary, notice: 'Glossary was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @glossary.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_glossary\n @glossary = Glossary.find(params[:id])\n end",
"def set_glossary\n @glossary = Glossary.friendly.find(params[:id])\n end",
"def create\n @glossary = Glossary.new(glossary_params)\n @glossary.setup_record()\n\n respond_to do |format|\n if @glossary.save\n format.html { redirect_to @glossary, notice: 'Glossary was successfully created.' }\n format.json { render :show, status: :created, location: @glossary }\n else\n format.html { render :new }\n format.json { render json: @glossary.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n authorize_action_for Glossary\n @glossary = Glossary.new(glossary_params)\n @glossary.user = current_user\n\n respond_to do |format|\n if @glossary.save\n format.html { redirect_to @glossary, notice: 'Glossary was successfully created.' }\n format.json { render :show, status: :created, location: @glossary }\n else\n format.html { render :new }\n format.json { render json: @glossary.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @glossaries = []\n err = init_var()\n if(@dict_id!=nil)\n\n\t\tif params[:to_search] == nil or \n\t\t params[:to_search] == '' \n\t\t @glossaries = Glossary.where(\n\t\t \t\t\t [ \"dict_id = :dict_id \",\n\t\t\t\t{ dict_id: @dict_id } ] ).limit(100)\n\t\telse\n\t\t @glossaries = Glossary.where(\n\t\t\t [ \"dict_id = :dict_id and key_words = :key_words \",\n\t\t\t\t{ dict_id: @dict_id , key_words: params[:to_search] } ] )\n\t\tend\n\tend\n end",
"def destroy\n @glossary = Glossary.find(params[:id])\n @glossary.destroy\n\n respond_to do |format|\n format.html { redirect_to glossaries_url }\n format.json { head :no_content }\n end\n end",
"def create\n @glossary = Glossary.new(glossary_params)\n\n respond_to do |format|\n if @glossary.save\n flash[:notice] = ts('new.successful', :what => Glossary.model_name.human.capitalize)\n format.html { redirect_to glossaries_url }\n format.xml { head :created, :location => glossary_url(@glossary) }\n else\n format.html do\n @organizations = Organization.order('title')\n render :action => 'new'\n end\n format.xml { render :xml => @glossary.errors.to_xml }\n end\n end\n end",
"def init_glossaries\n\t@dict_id = params[:dict_id]\n\t@lang_cfg= nil \n\t@fields = nil\n \tget_all_glossaries_configs() \n\t@lang_codes=Dictionaries.new([]).lang_codes\n\tparams[:dict_id] = @dict_id \n\t@dict_id = nil\n\t@dict_config=nil\n\tif params[:dict_id]==nil\n\t\treturn\n\tend\n\t@dict_config=DictConfig.find_by( dict_sys_name: params[:dict_id])\n\t\tif @dict_config==nil\n\t\t\treturn\n\t\tend\n\t\tbegin\n\t\t\text= JSON.parse(@dict_config.cfg)\n\t\t\tif ext != nil and ext[\"config\"] != nil and ext[\"config\"][\"languages\"]!= nil\n\t\t\t\t@lang_cfg= ext[\"config\"][\"languages\"]\n\t\t\tend\n\t\t\trescue Exception => e\n\t\treturn \n\tend\n\t@dict_name = @dict_config.dict_name\n\t@dict_id= params[:dict_id]\n\treturn \n end",
"def update\n authorize_action_for @glossary\n respond_to do |format|\n if @glossary.update(glossary_params)\n format.html { redirect_to @glossary, notice: 'Glossary was successfully updated.' }\n format.json { render :show, status: :ok, location: @glossary }\n else\n format.html { render :edit }\n format.json { render json: @glossary.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @glossary_labels = GlossaryLabel.all\n end",
"def destroy\n @glossary = Glossary.find(params[:id])\n @glossary.destroy\n\n respond_to do |format|\n format.html { redirect_to glossaries_url }\n format.xml { head :ok }\n end\n end",
"def destroy\n @glossary.destroy\n respond_to do |format|\n format.html { redirect_to glossaries_url, notice: 'Glossary was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def update\n @glossary = Glossary.find(params[:id])\n\n respond_to do |format|\n if @glossary.update_attributes(glossary_params)\n flash[:notice] = ts('edit.successful', :what => Glossary.model_name.human.capitalize)\n format.html { redirect_to glossaries_url }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @glossary.errors.to_xml }\n end\n end\n end",
"def create\n @glossary_label = GlossaryLabel.new(glossary_label_params)\n\n respond_to do |format|\n if @glossary_label.save\n format.html { redirect_to @glossary_label, notice: 'Glossary label was successfully created.' }\n format.json { render :show, status: :created, location: @glossary_label }\n else\n format.html { render :new }\n format.json { render json: @glossary_label.errors, status: :unprocessable_entity }\n end\n end\n end",
"def glossary_params\n params.require(:glossary).permit(:dict_id, :key_words, :word_type, :category, :primary_xlate, :secondary_xlate,:digest)\n end",
"def update\n respond_to do |format|\n puts(glossary_params)\n tmp = Glossary.new(glossary_params)\n tmp.setup_record()\n if @glossary.update(tmp.params())\n ##if @glossary.update(glossary_params)\n format.html { redirect_to @glossary, notice: 'Glossary was successfully updated.' }\n format.json { render :show, status: :ok, location: @glossary }\n else\n format.html { render :edit }\n format.json { render json: @glossary.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @glossary_label.update(glossary_label_params)\n format.html { redirect_to @glossary_label, notice: 'Glossary label was successfully updated.' }\n format.json { render :show, status: :ok, location: @glossary_label }\n else\n format.html { render :edit }\n format.json { render json: @glossary_label.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n authorize_action_for @glossary\n @glossary.destroy\n respond_to do |format|\n format.html { redirect_to glossaries_url, notice: 'Glossary was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def find_glossary_term!\n @glossary_term = find_or_goto_index(GlossaryTerm,\n params[:id].to_s)\n end",
"def show\n @gl = Gl.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gl }\n end\n end",
"def glossary_label_params\n params.fetch(:glossary_label, {})\n end",
"def recipebook\n @levels = Level.all\n\n respond_to do |format|\n format.html # recipebook.html.erb\n format.json { render json: @levels }\n end\n end",
"def show\n @lifestyle_subgenre = LifestyleSubgenre.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lifestyle_subgenre }\n end\n end",
"def index\n @glossaries_total = Glossary.search(params[:search])\n @glossaries_total = @glossaries_total.tagged_with(params[:tag]) if params[:tag]\n @glossaries = @glossaries_total.paginate( page: params[:page], per_page: 10 )\n\n set_meta_tags og: {\n title: \"Ruby & Rails Glossary #{Glossary.count}\",\n description: \"루비와 레일스 용어집. 함께 만들어가면 어렵지 않습니다. \",\n image: root_url[0..-2] + ActionController::Base.helpers.asset_url('glossary.png'),\n url: glossaries_url\n }, title: \"Ruby and Rails Glossary #{Glossary.count}\"\n end",
"def show\n @genotype = Genotype.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @genotype }\n end\n end",
"def glossary_terms_list_with_http_info(account_id, glossary_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: GlossaryTermsApi.glossary_terms_list ...'\n end\n # verify the required parameter 'account_id' is set\n if @api_client.config.client_side_validation && account_id.nil?\n fail ArgumentError, \"Missing the required parameter 'account_id' when calling GlossaryTermsApi.glossary_terms_list\"\n end\n # verify the required parameter 'glossary_id' is set\n if @api_client.config.client_side_validation && glossary_id.nil?\n fail ArgumentError, \"Missing the required parameter 'glossary_id' when calling GlossaryTermsApi.glossary_terms_list\"\n end\n # resource path\n local_var_path = '/accounts/{account_id}/glossaries/{glossary_id}/terms'.sub('{' + 'account_id' + '}', CGI.escape(account_id.to_s)).sub('{' + 'glossary_id' + '}', CGI.escape(glossary_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil?\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 header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'Array<GlossaryTerm>' \n\n # auth_names\n auth_names = opts[:auth_names] || ['Basic', 'Token']\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(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: GlossaryTermsApi#glossary_terms_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n response = ::Phrase::Response.new(data, headers)\n return response, status_code, headers\n end",
"def new\n @genotype = Genotype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @genotype }\n end\n end",
"def show\n @gopy = Gopy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gopy }\n end\n end",
"def new\n @api_noun = Api::Noun.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @api_noun }\n end\n end",
"def new\n @gl = Gl.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gl }\n end\n end",
"def index\n @glasses = Glass.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @glasses }\n end\n end",
"def gist(id)\n get \"/gists/#{id}\"\n end",
"def new\n @constitution = Constitution.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @constitution }\n end\n end",
"def set_glossary_label\n @glossary_label = GlossaryLabel.find(params[:id])\n end",
"def glossary_params\n params.require(:glossary).permit(:user_id, :term, :word_class, :idiomatic, :memo, :tag_tokens, glossary_definitions_attributes: [:id, :user_id, :definition, :sentence, :_destroy])\n end",
"def new\n @fiction = Fiction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fiction }\n end\n end",
"def show\n @galaxies_lenticular_galaxy = Galaxies::LenticularGalaxy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @galaxies_lenticular_galaxy }\n end\n end",
"def new\n @galaxies_lenticular_galaxy = Galaxies::LenticularGalaxy.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @galaxies_lenticular_galaxy }\n end\n end",
"def new\n @lifestyle_subgenre = LifestyleSubgenre.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lifestyle_subgenre }\n end\n end",
"def new\n @gopy = Gopy.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gopy }\n end\n end",
"def show\n @api_noun = Api::Noun.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @api_noun }\n end\n end",
"def gist_url\n \"#{api_url}/gists/%s\"\n end",
"def index\n @garplies = Garply.all\n end",
"def new\n @dictionary = Dictionary.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @dictionary }\n end\n end",
"def new\n @glass = Glass.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @glass }\n end\n end",
"def show\n @dictionary = Dictionary.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dictionary }\n end\n end",
"def index\n @fiction = Fiction.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @fiction }\n end\n end",
"def show\n @sundry_grn = SundryGrn.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @sundry_grn }\n end\n end",
"def show\n @grumble = Grumble.find(params[:id])\n render status: 200, json: @grumble.to_json\n end",
"def index\n @lophs = Loph.all\n respond_to do |format|\n format.html\n format.json { render json: @lophs}\n end\n end",
"def new\n @grm_grappt = GrmGrappt.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @grm_grappt }\n end\n end",
"def new\n @gist = Gist.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gist }\n end\n end",
"def glossary_term_show_with_http_info(account_id, glossary_id, id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: GlossaryTermsApi.glossary_term_show ...'\n end\n # verify the required parameter 'account_id' is set\n if @api_client.config.client_side_validation && account_id.nil?\n fail ArgumentError, \"Missing the required parameter 'account_id' when calling GlossaryTermsApi.glossary_term_show\"\n end\n # verify the required parameter 'glossary_id' is set\n if @api_client.config.client_side_validation && glossary_id.nil?\n fail ArgumentError, \"Missing the required parameter 'glossary_id' when calling GlossaryTermsApi.glossary_term_show\"\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling GlossaryTermsApi.glossary_term_show\"\n end\n # resource path\n local_var_path = '/accounts/{account_id}/glossaries/{glossary_id}/terms/{id}'.sub('{' + 'account_id' + '}', CGI.escape(account_id.to_s)).sub('{' + 'glossary_id' + '}', CGI.escape(glossary_id.to_s)).sub('{' + 'id' + '}', CGI.escape(id.to_s))\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 header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'GlossaryTerm' \n\n # auth_names\n auth_names = opts[:auth_names] || ['Basic', 'Token']\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(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: GlossaryTermsApi#glossary_term_show\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n response = ::Phrase::Response.new(data, headers)\n return response, status_code, headers\n end",
"def new\n @title = t 'view.grades.new_title'\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @grade }\n end\n end",
"def index\n @reward_and_levels = RewardAndLevel.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reward_and_levels }\n end\n end",
"def show\n @gist = Gist.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gist }\n end\n end",
"def show\n @gethotel = Gethotel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gethotel }\n end\n end",
"def show\n @glass = Glass.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @glass }\n end\n end",
"def show\n @citation = Citation.find(params[:id])\n @galaxies = @citation.galaxies\n @citation.galaxy_ids_array\n\n respond_to do |format|\n format.html { render :show }\n format.json { render :json => @citation.to_json(\n :only => [:title, :author, :bibtex, :journal, :year,\n :volume, :pages, :month, :note, :key],\n :methods => [:galaxy_ids_array]\n )\n }\n end\n end",
"def index\n @bounties = Bounty.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @bounties }\n end\n end",
"def show\n @gl_type = GlType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gl_type }\n end\n end",
"def new\n @meaning = Meaning.new\n\t @word = Word.find(params[:word_id])\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @meaning }\n end\n end",
"def index\n @german_go_leagues = GermanGoLeague.all\n\t\t@title = \"Bundesliga Spiele\"\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @german_go_leagues }\n end\n end",
"def new\n @livingexpense = Livingexpense.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @livingexpense }\n end\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 new\n @lyric = Lyric.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lyric }\n end\n end",
"def index\n @graduations = Graduation.all\n end",
"def new\n @gpath = Gpath.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gpath }\n end\n end",
"def index\n @gls = Gl.all\n end",
"def show\n @gpath = Gpath.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gpath }\n end\n end",
"def show\n @grm_grappt = GrmGrappt.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @grm_grappt }\n end\n end",
"def show\n @fiction = Fiction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fiction }\n end\n end",
"def show\n @constitution = Constitution.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @constitution }\n end\n end",
"def create\n @glossary_term = GlossaryTerm.new(\n user: @user,\n name: params[:glossary_term][:name],\n description: params[:glossary_term][:description]\n )\n return reload_form(\"new\") unless image_and_term_saves_smooth?\n\n redirect_to(glossary_term_path(@glossary_term.id))\n end",
"def new\n @gid2name = Gid2name.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gid2name }\n end\n end",
"def new\n @labelling = Labelling.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @labelling }\n end\n end",
"def new\n @criterion = Criterion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @criterion }\n end\n end",
"def new\n @golfer = Golfer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @golfer }\n end\n end",
"def index\n base_url = 'https://www.googleapis.com/books/v1/volumes?q=fiction&maxResults=20'\n and_key = '&key='\n key = ENV['GOOGLE_BOOKS_API_KEY'] \n googleurl = base_url + and_key + key\n\n response = RestClient.get(googleurl)\n @books = JSON.parse(response)\n\n respond_to do |format|\n format.html\n format.json { render json: @books }\n end\n\nend",
"def index\n @lugars = Lugar.all\n\n render json: @lugars\n end",
"def show\n @gram = Gram.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gram }\n end\n end",
"def show\n @song_genre = SongGenre.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @song_genre }\n end\n end",
"def show\n @program_genre = ProgramGenre.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @program_genre }\n end\n end",
"def show\n @gig = Gig.find(params[:id])\n\n respond_to do |format|\n format.html {render json: @gig, status: :ok}\n format.json { render json: @gig, status: :ok }\n end\n end",
"def show\n\t\t\t@legend = Legend.find(params[:id])\n\t\t\trespond_to do |format|\n\t\t\t\tformat.html # show.html.erb\n\t\t\t\tformat.json { render json: @legend }\n\t\t\tend\n\t\tend",
"def index\n @gonullus = Gonullu.all\n end",
"def index\n @level_progrations = LevelProgration.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @level_progrations }\n end\n end",
"def new\n @song_genre = SongGenre.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @song_genre }\n end\n end",
"def new\n @rainbow = Rainbow.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @rainbow }\n end\n end",
"def index\n @genotypes = Genotype.paginate(:page => params[:page], :per_page => 10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @genotypes }\n end\n end",
"def index\n @garnishes = Garnish.where(\"LOWER(name) like ?\", \"%#{params[:q] ? params[:q].downcase : ''}%\").paginate(:page => params[:page], :per_page => 198).order(:name)\n respond_to do |format|\n format.html\n format.json {render :json => @garnishes.map(&:attributes)}\n end\n end",
"def getRandomWord\n @word = Wordnik.words.get_random_word(\n includePartOfSpeech: \"noun\",\n minLength: 5,\n maxLength: 10\n )\n if request.xhr?\n render :json => @word\n end\n end",
"def new\n @gl_type = GlType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gl_type }\n end\n end",
"def index\n @guys = Guy.all\n respond_to do |format|\n format.json { render json: @guys }\n end\n end"
] | [
"0.72177964",
"0.68546724",
"0.67641246",
"0.6727119",
"0.6675556",
"0.65795195",
"0.6497935",
"0.64530826",
"0.6395647",
"0.63722885",
"0.6309516",
"0.62783295",
"0.6224003",
"0.6196973",
"0.60680306",
"0.6042106",
"0.5939551",
"0.5922832",
"0.5922549",
"0.5921715",
"0.5823439",
"0.58061445",
"0.5731755",
"0.56976813",
"0.56621",
"0.5593875",
"0.5582459",
"0.55784345",
"0.5567386",
"0.5562454",
"0.5541964",
"0.5532441",
"0.55007297",
"0.54597837",
"0.5431821",
"0.5428201",
"0.54218733",
"0.54106313",
"0.5394219",
"0.53847563",
"0.5382711",
"0.5370268",
"0.5368843",
"0.5362569",
"0.53588593",
"0.53270626",
"0.5319449",
"0.5307961",
"0.52973586",
"0.52770084",
"0.5272462",
"0.525607",
"0.5255389",
"0.5254819",
"0.52541685",
"0.52314293",
"0.52227813",
"0.5219919",
"0.52183986",
"0.5214218",
"0.5194493",
"0.51793927",
"0.5161828",
"0.5158783",
"0.515661",
"0.51511794",
"0.51423025",
"0.5140426",
"0.51371306",
"0.5132308",
"0.5131463",
"0.5128923",
"0.5127216",
"0.5123275",
"0.51224154",
"0.5121913",
"0.51161546",
"0.5112178",
"0.5111147",
"0.51068926",
"0.50952286",
"0.5094716",
"0.50855005",
"0.50850725",
"0.5080107",
"0.50798446",
"0.50762063",
"0.50734353",
"0.50723946",
"0.50658524",
"0.5063364",
"0.5060245",
"0.5060009",
"0.50587773",
"0.50505114",
"0.5048538",
"0.504839",
"0.5044369",
"0.50421983",
"0.5037152",
"0.503468"
] | 0.0 | -1 |
POST /glossaries POST /glossaries.json | def create
@glossary = Glossary.new(glossary_params)
@glossary.setup_record()
respond_to do |format|
if @glossary.save
format.html { redirect_to @glossary, notice: 'Glossary was successfully created.' }
format.json { render :show, status: :created, location: @glossary }
else
format.html { render :new }
format.json { render json: @glossary.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @glossary = Glossary.create_glossary(params[:glossary])\n\n respond_to do |format|\n if @glossary.save\n format.html { redirect_to @glossary, notice: 'Glossary was successfully created.' }\n format.json { render json: @glossary, status: :created, location: @glossary }\n else\n format.html { render action: \"new\" }\n format.json { render json: @glossary.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n authorize_action_for Glossary\n @glossary = Glossary.new(glossary_params)\n @glossary.user = current_user\n\n respond_to do |format|\n if @glossary.save\n format.html { redirect_to @glossary, notice: 'Glossary was successfully created.' }\n format.json { render :show, status: :created, location: @glossary }\n else\n format.html { render :new }\n format.json { render json: @glossary.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @glossary = Glossary.new(glossary_params)\n\n respond_to do |format|\n if @glossary.save\n flash[:notice] = ts('new.successful', :what => Glossary.model_name.human.capitalize)\n format.html { redirect_to glossaries_url }\n format.xml { head :created, :location => glossary_url(@glossary) }\n else\n format.html do\n @organizations = Organization.order('title')\n render :action => 'new'\n end\n format.xml { render :xml => @glossary.errors.to_xml }\n end\n end\n end",
"def create\n @glossary_label = GlossaryLabel.new(glossary_label_params)\n\n respond_to do |format|\n if @glossary_label.save\n format.html { redirect_to @glossary_label, notice: 'Glossary label was successfully created.' }\n format.json { render :show, status: :created, location: @glossary_label }\n else\n format.html { render :new }\n format.json { render json: @glossary_label.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @glossary = Glossary.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @glossary }\n end\n end",
"def glossary_params\n params.require(:glossary).permit(:dict_id, :key_words, :word_type, :category, :primary_xlate, :secondary_xlate,:digest)\n end",
"def glossary_params\n params.require(:glossary).permit(:user_id, :term, :word_class, :idiomatic, :memo, :tag_tokens, glossary_definitions_attributes: [:id, :user_id, :definition, :sentence, :_destroy])\n end",
"def create\n @glossary_term = GlossaryTerm.new(\n user: @user,\n name: params[:glossary_term][:name],\n description: params[:glossary_term][:description]\n )\n return reload_form(\"new\") unless image_and_term_saves_smooth?\n\n redirect_to(glossary_term_path(@glossary_term.id))\n end",
"def create\n @graduation = Graduation.new(graduation_params)\n\n respond_to do |format|\n if @graduation.save\n format.html { redirect_to @graduation, notice: 'Graduation was successfully created.' }\n format.json { render :show, status: :created, location: @graduations }\n else\n format.html { render :new }\n format.json { render json: @graduation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @glossary = Glossary.find(params[:id])\n saved = @glossary.update_glossary(params[:glossary])\n\n respond_to do |format|\n if saved\n format.html { redirect_to @glossary, notice: 'Glossary was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @glossary.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sundry_grn = SundryGrn.new(params[:sundry_grn])\n\n respond_to do |format|\n if @sundry_grn.save\n format.html { redirect_to @sundry_grn, :notice => 'Sundry grn was successfully created.' }\n format.json { render :json => @sundry_grn, :status => :created, :location => @sundry_grn }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @sundry_grn.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n puts(glossary_params)\n tmp = Glossary.new(glossary_params)\n tmp.setup_record()\n if @glossary.update(tmp.params())\n ##if @glossary.update(glossary_params)\n format.html { redirect_to @glossary, notice: 'Glossary was successfully updated.' }\n format.json { render :show, status: :ok, location: @glossary }\n else\n format.html { render :edit }\n format.json { render json: @glossary.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @noun = Noun.new(noun_params)\n\n respond_to do |format|\n if @noun.save\n format.html { redirect_to @noun, notice: 'Noun was successfully created.' }\n format.json { render :show, status: :created, location: @noun }\n else\n format.html { render :new }\n format.json { render json: @noun.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @glossary.destroy\n respond_to do |format|\n format.html { redirect_to glossaries_url, notice: 'Glossary was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def create\n @graduation = Graduation.new(params[:graduation])\n\n respond_to do |format|\n if @graduation.save\n format.html { redirect_to(@graduation, :notice => 'Graduation was successfully created.') }\n format.xml { render :xml => @graduation, :status => :created, :location => @graduation }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @graduation.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def destroy\n @glossary = Glossary.find(params[:id])\n @glossary.destroy\n\n respond_to do |format|\n format.html { redirect_to glossaries_url }\n format.json { head :no_content }\n end\n end",
"def create\n @gl = Gl.new(params[:gl])\n\n respond_to do |format|\n if @gl.save\n format.html { redirect_to @gl, notice: 'Gl was successfully created.' }\n format.json { render json: @gl, status: :created, location: @gl }\n else\n format.html { render action: \"new\" }\n format.json { render json: @gl.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_glossary\n @glossary = Glossary.find(params[:id])\n end",
"def glossary_label_params\n params.fetch(:glossary_label, {})\n end",
"def create\n @gonullu = Gonullu.new(gonullu_params)\n\n respond_to do |format|\n if @gonullu.save\n format.html { redirect_to @gonullu, notice: 'Gonullu was successfully created.' }\n format.json { render :show, status: :created, location: @gonullu }\n else\n format.html { render :new }\n format.json { render json: @gonullu.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @api_noun = Api::Noun.new(params[:api_noun])\n\n respond_to do |format|\n if @api_noun.save\n format.html { redirect_to @api_noun, notice: 'Noun was successfully created.' }\n format.json { render json: @api_noun, status: :created, location: @api_noun }\n else\n format.html { render action: \"new\" }\n format.json { render json: @api_noun.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @dog_poly = DogPoly.new(dog_poly_params)\n\n respond_to do |format|\n if @dog_poly.save\n format.html { redirect_to @dog_poly, notice: 'Dog poly was successfully created.' }\n format.json { render :show, status: :created, location: @dog_poly }\n else\n format.html { render :new }\n format.json { render json: @dog_poly.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize_action_for @glossary\n respond_to do |format|\n if @glossary.update(glossary_params)\n format.html { redirect_to @glossary, notice: 'Glossary was successfully updated.' }\n format.json { render :show, status: :ok, location: @glossary }\n else\n format.html { render :edit }\n format.json { render json: @glossary.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @garply = Garply.new(garply_params)\n\n respond_to do |format|\n if @garply.save\n format.html { redirect_to @garply, notice: 'Garply was successfully created.' }\n format.json { render :show, status: :created, location: @garply }\n else\n format.html { render :new }\n format.json { render json: @garply.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @reg_word = RegWord.new(reg_word_params)\n\n respond_to do |format|\n if @reg_word.save\n format.html { redirect_to @reg_word, notice: 'Reg word was successfully created.' }\n format.json { render :show, status: :created, location: @reg_word }\n else\n format.html { render :new }\n format.json { render json: @reg_word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @gl = Gl.new(gl_params)\n\n respond_to do |format|\n if @gl.save\n format.html { redirect_to @gl, notice: 'Gl was successfully created.' }\n format.json { render action: 'show', status: :created, location: @gl }\n else\n format.html { render action: 'new' }\n format.json { render json: @gl.errors, status: :unprocessable_entity }\n end\n end\n end",
"def glossary_term_create_with_http_info(account_id, glossary_id, glossary_term_create_parameters, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: GlossaryTermsApi.glossary_term_create ...'\n end\n # verify the required parameter 'account_id' is set\n if @api_client.config.client_side_validation && account_id.nil?\n fail ArgumentError, \"Missing the required parameter 'account_id' when calling GlossaryTermsApi.glossary_term_create\"\n end\n # verify the required parameter 'glossary_id' is set\n if @api_client.config.client_side_validation && glossary_id.nil?\n fail ArgumentError, \"Missing the required parameter 'glossary_id' when calling GlossaryTermsApi.glossary_term_create\"\n end\n # verify the required parameter 'glossary_term_create_parameters' is set\n if @api_client.config.client_side_validation && glossary_term_create_parameters.nil?\n fail ArgumentError, \"Missing the required parameter 'glossary_term_create_parameters' when calling GlossaryTermsApi.glossary_term_create\"\n end\n # resource path\n local_var_path = '/accounts/{account_id}/glossaries/{glossary_id}/terms'.sub('{' + 'account_id' + '}', CGI.escape(account_id.to_s)).sub('{' + 'glossary_id' + '}', CGI.escape(glossary_id.to_s))\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 header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil?\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(glossary_term_create_parameters) \n\n # return_type\n return_type = opts[:return_type] || 'GlossaryTerm' \n\n # auth_names\n auth_names = opts[:auth_names] || ['Basic', 'Token']\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: GlossaryTermsApi#glossary_term_create\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n response = ::Phrase::Response.new(data, headers)\n return response, status_code, headers\n end",
"def create\n @dictionary = @language.dictionaries.new(dictionary_params)\n\n respond_to do |format|\n if @dictionary.save\n #binding.pry\n #@dictionary.word_tag_relation_ships.create(params[:dictionaris][:tag_id])\n format.html { redirect_to user_language_dictionary_path(@user, @language, @dictionary), notice: 'Dictionary was successfully created.' }\n format.json { render :show, status: :created, location: @dictionary }\n else\n format.html { render :new }\n format.json { render json: @dictionary.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @glossary_label.update(glossary_label_params)\n format.html { redirect_to @glossary_label, notice: 'Glossary label was successfully updated.' }\n format.json { render :show, status: :ok, location: @glossary_label }\n else\n format.html { render :edit }\n format.json { render json: @glossary_label.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @dictionary = Dictionary.new(params[:dictionary])\n\n respond_to do |format|\n if @dictionary.save\n format.html { redirect_to @dictionary, notice: 'Competency was successfully created.' }\n format.json { render json: @dictionary, status: :created, location: @dictionary }\n else\n format.html { render action: \"new\" }\n format.json { render json: @dictionary.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @genotype = Genotype.new(params[:genotype])\n\n respond_to do |format|\n if @genotype.save\n format.html { redirect_to @genotype, notice: 'Genotype was successfully created.' }\n format.json { render json: @genotype, status: :created, location: @genotype }\n else\n format.html { render action: \"new\" }\n format.json { render json: @genotype.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @lifestyle_subgenre = LifestyleSubgenre.new(params[:lifestyle_subgenre])\n\n respond_to do |format|\n if @lifestyle_subgenre.save\n format.html { redirect_to @lifestyle_subgenre, notice: 'Lifestyle subgenre was successfully created.' }\n format.json { render json: @lifestyle_subgenre, status: :created, location: @lifestyle_subgenre }\n else\n format.html { render action: \"new\" }\n format.json { render json: @lifestyle_subgenre.errors, status: :unprocessable_entity }\n end\n end\n end",
"def init_glossaries\n\t@dict_id = params[:dict_id]\n\t@lang_cfg= nil \n\t@fields = nil\n \tget_all_glossaries_configs() \n\t@lang_codes=Dictionaries.new([]).lang_codes\n\tparams[:dict_id] = @dict_id \n\t@dict_id = nil\n\t@dict_config=nil\n\tif params[:dict_id]==nil\n\t\treturn\n\tend\n\t@dict_config=DictConfig.find_by( dict_sys_name: params[:dict_id])\n\t\tif @dict_config==nil\n\t\t\treturn\n\t\tend\n\t\tbegin\n\t\t\text= JSON.parse(@dict_config.cfg)\n\t\t\tif ext != nil and ext[\"config\"] != nil and ext[\"config\"][\"languages\"]!= nil\n\t\t\t\t@lang_cfg= ext[\"config\"][\"languages\"]\n\t\t\tend\n\t\t\trescue Exception => e\n\t\treturn \n\tend\n\t@dict_name = @dict_config.dict_name\n\t@dict_id= params[:dict_id]\n\treturn \n end",
"def update\n @glossary = Glossary.find(params[:id])\n\n respond_to do |format|\n if @glossary.update_attributes(glossary_params)\n flash[:notice] = ts('edit.successful', :what => Glossary.model_name.human.capitalize)\n format.html { redirect_to glossaries_url }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @glossary.errors.to_xml }\n end\n end\n end",
"def set_glossary\n @glossary = Glossary.friendly.find(params[:id])\n end",
"def destroy\n @glossary = Glossary.find(params[:id])\n @glossary.destroy\n\n respond_to do |format|\n format.html { redirect_to glossaries_url }\n format.xml { head :ok }\n end\n end",
"def create\n @labelling = Labelling.new(params[:labelling])\n\n respond_to do |format|\n if @labelling.save\n format.html { redirect_to @labelling, notice: 'Labelling was successfully created.' }\n format.json { render json: @labelling, status: :created, location: @labelling }\n else\n format.html { render action: \"new\" }\n format.json { render json: @labelling.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n \t\t\t@penalty = Penalty.new penalty_params\n\n \t\t\tif @penalty.save\n\n \t\t\t\trender json: @penalty,status: :created\n\n \t\t\telse\n\n \t\t\t\trender json: {error: true,errors: @penalty.errors},status: :unprocessable_entity\n\n \t\t\tend\n\n \t\tend",
"def glossary_term_create(account_id, glossary_id, glossary_term_create_parameters, opts = {})\n data, _status_code, _headers = glossary_term_create_with_http_info(account_id, glossary_id, glossary_term_create_parameters, opts)\n data\n end",
"def test_create\n user = login\n params = create_term_params\n\n assert_no_difference(\"Image.count\") do\n post(:create, params: params)\n end\n\n term = GlossaryTerm.last\n assert_equal(params[:glossary_term][:name], term.name)\n assert_equal(params[:glossary_term][:description], term.description)\n assert_not_nil(term.rss_log)\n assert_equal(user.id, term.user_id)\n assert_response(:redirect)\n end",
"def create\n @lounge = Lounge.new(lounge_params)\n\n respond_to do |format|\n if @lounge.save\n format.html { redirect_to @lounge, notice: 'Lounge was successfully created.' }\n format.json { render :show, status: :created, location: @lounge }\n else\n format.html { render :new }\n format.json { render json: @lounge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bowling = Bowling.new(bowling_params)\n\n respond_to do |format|\n if @bowling.save\n format.html { redirect_to @bowling, notice: 'Bowling was successfully created.' }\n format.json { render :show, status: :created, location: @bowling }\n else\n format.html { render :new }\n format.json { render json: @bowling.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @rigging = Rigging.new(rigging_params)\n\n respond_to do |format|\n if @rigging.save\n format.html { redirect_to @rigging, notice: 'Rigging was successfully created.' }\n format.json { render :show, status: :created, location: @rigging }\n else\n format.html { render :new }\n format.json { render json: @rigging.errors, status: :unprocessable_entity }\n end\n end\n end",
"def glosarry_params\n params.require(:glosarry).permit(:title, :description)\n end",
"def create\n @noun = Noun.new(params[:noun])\n\n respond_to do |format|\n if @noun.save\n format.html { redirect_to(@noun, :notice => 'Noun was successfully created.') }\n format.xml { render :xml => @noun, :status => :created, :location => @noun }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @noun.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n\n @word = Word.new(word_params)\n word_params[:meanings_attributes][:word_id] = @word.id\n\n if word_params[:synonymous_attributes]!=nil\n word_params[:synonymous_attributes][:word_id] = @word.id\n end\n\n respond_to do |format|\n if @word.save\n format.html { redirect_to @word, notice: 'Word was successfully created.' }\n format.json { render :show, status: :created, location: @word }\n else\n format.html { render :new }\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n authorize_action_for @glossary\n @glossary.destroy\n respond_to do |format|\n format.html { redirect_to glossaries_url, notice: 'Glossary was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def create\n @graduate = Graduate.new(graduate_params)\n\n respond_to do |format|\n if @graduate.save\n format.html { redirect_to ['admin', @graduate], notice: 'Egresado Creado' }\n format.json { render :show, status: :created, location: @graduate }\n else\n format.html { render :new }\n format.json { render json: @graduate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @dictionary = Dictionary.new(title: params[:dictionary][:title], user: current_user)\n\n respond_to do |format|\n if @dictionary.save\n format.html {redirect_to @dictionary, notice: 'Dictionary was successfully created.'}\n format.json {render :show, status: :created, location: @dictionary}\n else\n format.html {render :new}\n format.json {render json: @dictionary.errors, status: :unprocessable_entity}\n end\n end\n end",
"def create\n @lodging = Lodging.new(lodging_params)\n\n respond_to do |format|\n if @lodging.save\n format.html { redirect_to @lodging, notice: 'Lodging was successfully created.' }\n format.json { render :show, status: :created, location: @lodging }\n else\n format.html { render :new }\n format.json { render json: @lodging.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @nlp = Nlp.new(params[:nlp])\n\n respond_to do |format|\n if @nlp.save\n format.html { redirect_to @nlp, notice: 'Nlp was successfully created.' }\n format.json { render json: @nlp, status: :created, location: @nlp }\n else\n format.html { render action: \"new\" }\n format.json { render json: @nlp.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @title = t 'view.grades.new_title'\n\n respond_to do |format|\n if @grade.save\n format.html { redirect_to [@institution, @grade], notice: t('view.grades.correctly_created') }\n format.json { render json: @grade, status: :created, location: @grade }\n else\n format.html { render action: 'new' }\n format.json { render json: @grade.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @learning = Learning.new(learning_params)\n\n respond_to do |format|\n if @learning.save\n format.html { redirect_to @learning, notice: 'Learning was successfully created.' }\n format.json { render :show, status: :created, location: @learning }\n else\n format.html { render :new }\n format.json { render json: @learning.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @glossaries = Glossary.order('title')\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @glossaries.to_xml }\n end\n end",
"def create\n @word = Word.new(word_params)\n\n respond_to do |format|\n if @word.save\n format.html { redirect_to @word, notice: 'Word was successfully created.' }\n format.json { render :show, status: :created }\n else\n format.html { render :new }\n format.json do\n render json: @word.errors.full_messages, status: :unprocessable_entity\n end\n end\n end\n end",
"def create\n @gl_type = GlType.new(gl_type_params)\n\n respond_to do |format|\n if @gl_type.save\n format.html { redirect_to gl_types_path, notice: 'Gl type was successfully created.' }\n format.json { render json: @gl_type, status: :created, location: @gl_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @gl_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @badge = Badge.new(params[:badge])\n \n\n respond_to do |format|\n if @badge.save\n format.html { redirect_to @badge, notice: 'Badge was successfully created.' }\n format.json { render json: @badge, status: :created, location: @badge }\n else\n format.html { render action: \"new\" }\n format.json { render json: @badge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pregnancy = Pregnancy.new(pregnancy_params)\n\n respond_to do |format|\n if @pregnancy.save\n format.html { redirect_to @pregnancy, notice: 'Pregnancy was successfully created.' }\n format.json { render action: 'show', status: :created, location: @pregnancy }\n else\n format.html { render action: 'new' }\n format.json { render json: @pregnancy.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @occurrence_bulletin = OccurrenceBulletin.new(occurrence_bulletin_params)\n\n respond_to do |format|\n if @occurrence_bulletin.save\n format.html { redirect_to @occurrence_bulletin, notice: 'Occurrence bulletin was successfully created.' }\n format.json { render :show, status: :created, location: @occurrence_bulletin }\n else\n format.html { render :new }\n format.json { render json: @occurrence_bulletin.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @gua = Gua.new(gua_params)\n\n respond_to do |format|\n if @gua.save\n format.html { redirect_to @gua, notice: 'Gua was successfully created.' }\n format.json { render :show, status: :created, location: @gua }\n else\n format.html { render :new }\n format.json { render json: @gua.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @go_term = GoTerm.new(params[:go_term])\n\n respond_to do |format|\n if @go_term.save\n format.html { redirect_to @go_term, notice: 'Go term was successfully created.' }\n format.json { render json: @go_term, status: :created, location: @go_term }\n else\n format.html { render action: \"new\" }\n format.json { render json: @go_term.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @elder_gallary = ElderGallary.new(elder_gallary_params)\n\n respond_to do |format|\n if @elder_gallary.save\n format.html { redirect_to @elder_gallary, notice: 'Elder gallary was successfully created.' }\n format.json { render :show, status: :created, location: @elder_gallary }\n else\n format.html { render :new }\n format.json { render json: @elder_gallary.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @fiction = Fiction.new(params[:fiction])\n\n respond_to do |format|\n if @fiction.save\n format.html { redirect_to @fiction, notice: 'Fiction was successfully created.' }\n format.json { render json: @fiction, status: :created, location: @fiction }\n else\n format.html { render action: \"new\" }\n format.json { render json: @fiction.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @orthodb_level = OrthodbLevel.new(params[:orthodb_level])\n\n respond_to do |format|\n if @orthodb_level.save\n format.html { redirect_to @orthodb_level, notice: 'Orthodb level was successfully created.' }\n format.json { render json: @orthodb_level, status: :created, location: @orthodb_level }\n else\n format.html { render action: \"new\" }\n format.json { render json: @orthodb_level.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @grumble = Grumble.new(grumble_params)\n\n respond_to do |format|\n if @grumble.save\n format.html { redirect_to @grumble, notice: 'Grumble was successfully created.' }\n format.json { render :show, status: :created, location: @grumble }\n else\n format.html { render :new }\n format.json { render json: @grumble.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @word = Word.new(word_params)\n\n respond_to do |format|\n if @word.save\n format.html { redirect_to @word }\n format.json { render :show, status: :created, location: @word }\n else\n format.html { render :new }\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @badge = Badge.new(params[:badge])\n\n respond_to do |format|\n if @badge.save\n format.html { redirect_to @badge, :notice => 'Badge was successfully created.' }\n format.json { render :json => @badge, :status => :created, :location => @badge }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @badge.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @ontology = Ontology.new(ontology_params)\n\n respond_to do |format|\n if @ontology.save\n format.html { redirect_to @ontology, notice: 'Ontology was successfully created.' }\n format.json { render :show, status: :created, location: @ontology }\n else\n format.html { render :new }\n format.json { render json: @ontology.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @lsa_test_word = LsaTestWord.new(params[:lsa_test_word])\n\n respond_to do |format|\n if @lsa_test_word.save\n format.html { redirect_to @lsa_test_word, notice: 'Lsa test word was successfully created.' }\n format.json { render json: @lsa_test_word, status: :created, location: @lsa_test_word }\n else\n format.html { render action: \"new\" }\n format.json { render json: @lsa_test_word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @gakunenn = Gakunenn.new(gakunenn_params)\n\n respond_to do |format|\n if @gakunenn.save\n format.html { redirect_to @gakunenn, notice: \"学年を追加しました\" }\n format.json { render :show, status: :created, location: @gakunenn }\n else\n format.html { render :new }\n format.json { render json: @gakunenn.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @gopy = Gopy.new(params[:gopy])\n\n respond_to do |format|\n if @gopy.save\n format.html { redirect_to @gopy, notice: 'Gopy was successfully created.' }\n format.json { render json: @gopy, status: :created, location: @gopy }\n else\n format.html { render action: \"new\" }\n format.json { render json: @gopy.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @gdoc = Gdoc.new(gdoc_params)\n\n respond_to do |format|\n if @gdoc.save\n format.html { redirect_to @gdoc, notice: 'Gdoc was successfully created.' }\n format.json { render action: 'show', status: :created, location: @gdoc }\n else\n format.html { render action: 'new' }\n format.json { render json: @gdoc.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @lyric = Lyric.new(lyric_params)\n\n respond_to do |format|\n if @lyric.save\n format.html { redirect_to @lyric, notice: 'Lyric was successfully created.' }\n format.json { render json: @lyric, status: :created, location: @lyric }\n else\n format.html { render action: \"new\" }\n format.json { render json: @lyric.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @lyric = Lyric.new(params[:lyric])\n\n respond_to do |format|\n if @lyric.save\n format.html { redirect_to @lyric, notice: 'Lyric was successfully created.' }\n format.json { render json: @lyric, status: :created, location: @lyric }\n else\n format.html { render action: \"new\" }\n format.json { render json: @lyric.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @o_rganization = ORganization.new(o_rganization_params)\n\n respond_to do |format|\n if @o_rganization.save\n format.html { redirect_to @o_rganization, notice: 'O rganization was successfully created.' }\n format.json { render :show, status: :created, location: @o_rganization }\n else\n format.html { render :new }\n format.json { render json: @o_rganization.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @gudang = Gudang.new(gudang_params)\n\n respond_to do |format|\n if @gudang.save\n format.html { redirect_to @gudang, notice: 'Gudang was successfully created.' }\n format.json { render :show, status: :created, location: @gudang }\n else\n format.html { render :new }\n format.json { render json: @gudang.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @glossaries = []\n err = init_var()\n if(@dict_id!=nil)\n\n\t\tif params[:to_search] == nil or \n\t\t params[:to_search] == '' \n\t\t @glossaries = Glossary.where(\n\t\t \t\t\t [ \"dict_id = :dict_id \",\n\t\t\t\t{ dict_id: @dict_id } ] ).limit(100)\n\t\telse\n\t\t @glossaries = Glossary.where(\n\t\t\t [ \"dict_id = :dict_id and key_words = :key_words \",\n\t\t\t\t{ dict_id: @dict_id , key_words: params[:to_search] } ] )\n\t\tend\n\tend\n end",
"def create\n @word = Word.new(params[:word])\n\n respond_to do |format|\n if @word.save\n format.html { redirect_to @word, notice: 'Word was successfully created.' }\n format.json { render json: @word, status: :created, location: @word }\n else\n format.html { render action: \"new\" }\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @word = Word.new(params[:word])\n\n respond_to do |format|\n if @word.save\n format.html { redirect_to @word, notice: 'Word was successfully created.' }\n format.json { render json: @word, status: :created, location: @word }\n else\n format.html { render action: \"new\" }\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @word = Word.new(params[:word])\n\n respond_to do |format|\n if @word.save\n format.html { redirect_to @word, notice: 'Word was successfully created.' }\n format.json { render json: @word, status: :created, location: @word }\n else\n format.html { render action: \"new\" }\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @lsa_training_unique_word = LsaTrainingUniqueWord.new(params[:lsa_training_unique_word])\n\n respond_to do |format|\n if @lsa_training_unique_word.save\n format.html { redirect_to @lsa_training_unique_word, notice: 'Lsa training unique word was successfully created.' }\n format.json { render json: @lsa_training_unique_word, status: :created, location: @lsa_training_unique_word }\n else\n format.html { render action: \"new\" }\n format.json { render json: @lsa_training_unique_word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @nsgrule = Nsgrule.new(nsgrule_params)\n\n respond_to do |format|\n if @nsgrule.save\n format.html { redirect_to @nsgrule, notice: 'Nsgrule was successfully created.' }\n format.json { render :show, status: :created, location: @nsgrule }\n else\n format.html { render :new }\n format.json { render json: @nsgrule.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n if logged_in?\n @glossaries = current_user.glossaries.find(:all)\n end\n end",
"def create\n @word = Word.new(word_params)\n\n respond_to do |format|\n if @word.save\n format.html { redirect_to @word, notice: 'Word was successfully created.' }\n format.json { render :show, status: :created, location: @word }\n else\n format.html { render :new }\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @word = Word.new(word_params)\n\n respond_to do |format|\n if @word.save\n format.html { redirect_to @word, notice: 'Word was successfully created.' }\n format.json { render :show, status: :created, location: @word }\n else\n format.html { render :new }\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @word = Word.new(word_params)\n\n respond_to do |format|\n if @word.save\n format.html { redirect_to @word, notice: 'Word was successfully created.' }\n format.json { render :show, status: :created, location: @word }\n else\n format.html { render :new }\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @stilage = Stilage.new(stilage_params)\n respond_to do |format|\n if @stilage.save\n format.html { redirect_to @stilage, notice: 'Stilage was successfully created.' }\n format.json { render :show, status: :created, location: @stilage }\n else\n format.html { render :new }\n format.json { render json: @stilage.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @grade = Grade.new(grade_params)\n\n if @grade.save\n render json: @grade, status: :created, location: @grade\n else\n render json: @grade.errors, status: :unprocessable_entity\n end\n end",
"def create\n @hood = Hood.new(hood_params)\n\n respond_to do |format|\n if @hood.save\n format.html { redirect_to @hood, notice: 'Hood was successfully created.' }\n format.json { render action: 'show', status: :created, location: @hood }\n else\n format.html { render action: 'new' }\n format.json { render json: @hood.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @gnvl = Gnvl.new(gnvl_params)\n\n respond_to do |format|\n if @gnvl.save\n format.html { redirect_to @gnvl, notice: 'Gnvl was successfully created.' }\n format.json { render :show, status: :created, location: @gnvl }\n else\n format.html { render :new }\n format.json { render json: @gnvl.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @level_goal = LevelGoal.new(params[:level_goal])\n\n respond_to do |format|\n if @level_goal.save\n format.html { redirect_to @level_goal, notice: 'Level goal was successfully created.' }\n format.json { render json: @level_goal, status: :created, location: @level_goal }\n else\n format.html { render action: \"new\" }\n format.json { render json: @level_goal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @legend = Legend.new(legend_params)\n\n respond_to do |format|\n if @legend.save\n format.html { redirect_to @legend, notice: 'Legend was successfully created.' }\n format.json { render :show, status: :created, location: @legend }\n else\n format.html { render :new }\n format.json { render json: @legend.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @grad_year = GradYear.new(grad_year_params)\n\n respond_to do |format|\n if @grad_year.save\n format.html { redirect_to @grad_year, notice: 'Grad year was successfully created.' }\n format.json { render :show, status: :created, location: @grad_year }\n else\n format.html { render :new }\n format.json { render json: @grad_year.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @gondola = Gondola.new(gondola_params)\n\n respond_to do |format|\n if @gondola.save\n format.html { redirect_to @gondola, notice: 'Gondola was successfully created.' }\n format.json { render :show, status: :created, location: @gondola }\n else\n format.html { render :new }\n format.json { render json: @gondola.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @word = Word.new(word_params)\n\n respond_to do |format|\n if @word.save\n format.html { redirect_to @word, notice: 'Word was successfully created.' }\n format.json { render action: 'show', status: :created, location: @word }\n else\n format.html { render action: 'new' }\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @language_strength = LanguageStrength.new(language_strength_params)\n\n respond_to do |format|\n if @language_strength.save\n format.html { redirect_to @language_strength, notice: 'Language strength was successfully created.' }\n format.json { render :show, status: :created, location: @language_strength }\n else\n format.html { render :new }\n format.json { render json: @language_strength.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @herald = Herald.new(herald_params)\n\n respond_to do |format|\n if @herald.save\n format.html { redirect_to @herald, notice: 'Herald was successfully created.' }\n format.json { render action: 'show', status: :created, location: @herald }\n else\n format.html { render action: 'new' }\n format.json { render json: @herald.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @orthodb_best_orthologue = OrthodbBestOrthologue.new(params[:orthodb_best_orthologue])\n\n respond_to do |format|\n if @orthodb_best_orthologue.save\n format.html { redirect_to @orthodb_best_orthologue, notice: 'Orthodb best orthologue was successfully created.' }\n format.json { render json: @orthodb_best_orthologue, status: :created, location: @orthodb_best_orthologue }\n else\n format.html { render action: \"new\" }\n format.json { render json: @orthodb_best_orthologue.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @learning_style = LearningStyle.new(learning_style_params)\n\n respond_to do |format|\n if @learning_style.save\n format.html { redirect_to @learning_style, notice: 'Learning style was successfully created.' }\n format.json { render :show, status: :created, location: @learning_style }\n else\n format.html { render :new }\n format.json { render json: @learning_style.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @learning_resource = @language.learning_resources.new(learning_resource_params)\n\n respond_to do |format|\n if @learning_resource.save\n format.html { redirect_to [@language,@learning_resource], notice: 'Learning resource was successfully created.' }\n format.json { render :show, status: :created, location: @learning_resource }\n else\n format.html { render :new }\n format.json { render json: @learning_resource.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.77519214",
"0.72174704",
"0.7038011",
"0.69908476",
"0.6808631",
"0.67988425",
"0.65565467",
"0.62849045",
"0.6272299",
"0.61735386",
"0.6006929",
"0.5943295",
"0.591612",
"0.5875173",
"0.5840558",
"0.5835021",
"0.5794603",
"0.5789745",
"0.57872903",
"0.5783994",
"0.5772635",
"0.5763178",
"0.5756554",
"0.5722209",
"0.57085603",
"0.5696241",
"0.5677057",
"0.56705713",
"0.56592256",
"0.5656546",
"0.56373733",
"0.56351066",
"0.56208104",
"0.5617305",
"0.5612719",
"0.55830795",
"0.55799633",
"0.55755556",
"0.5568725",
"0.5556126",
"0.5517303",
"0.551557",
"0.5510179",
"0.54970074",
"0.5491433",
"0.54844236",
"0.5476074",
"0.5474973",
"0.5474652",
"0.54727334",
"0.5460774",
"0.54520774",
"0.5450786",
"0.5449702",
"0.54328656",
"0.5432418",
"0.5429076",
"0.5420302",
"0.54202545",
"0.5400851",
"0.5399423",
"0.5398105",
"0.53954977",
"0.53943026",
"0.5393925",
"0.53917927",
"0.5391102",
"0.5383039",
"0.5380643",
"0.53800005",
"0.53776675",
"0.5373813",
"0.5373527",
"0.5366013",
"0.5365182",
"0.5359261",
"0.535656",
"0.5356058",
"0.5356058",
"0.5355649",
"0.53531045",
"0.5352127",
"0.53441155",
"0.5331831",
"0.5331831",
"0.5331831",
"0.5330285",
"0.5327855",
"0.53256315",
"0.53255117",
"0.5323588",
"0.53203386",
"0.5319378",
"0.5317679",
"0.5315116",
"0.53142893",
"0.53118",
"0.5306551",
"0.5305894",
"0.5304905"
] | 0.7399516 | 1 |
PATCH/PUT /glossaries/1 PATCH/PUT /glossaries/1.json | def update
respond_to do |format|
puts(glossary_params)
tmp = Glossary.new(glossary_params)
tmp.setup_record()
if @glossary.update(tmp.params())
##if @glossary.update(glossary_params)
format.html { redirect_to @glossary, notice: 'Glossary was successfully updated.' }
format.json { render :show, status: :ok, location: @glossary }
else
format.html { render :edit }
format.json { render json: @glossary.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @glossary = Glossary.find(params[:id])\n saved = @glossary.update_glossary(params[:glossary])\n\n respond_to do |format|\n if saved\n format.html { redirect_to @glossary, notice: 'Glossary was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @glossary.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize_action_for @glossary\n respond_to do |format|\n if @glossary.update(glossary_params)\n format.html { redirect_to @glossary, notice: 'Glossary was successfully updated.' }\n format.json { render :show, status: :ok, location: @glossary }\n else\n format.html { render :edit }\n format.json { render json: @glossary.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @glossary = Glossary.find(params[:id])\n\n respond_to do |format|\n if @glossary.update_attributes(glossary_params)\n flash[:notice] = ts('edit.successful', :what => Glossary.model_name.human.capitalize)\n format.html { redirect_to glossaries_url }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @glossary.errors.to_xml }\n end\n end\n end",
"def update\n respond_to do |format|\n if @glossary_label.update(glossary_label_params)\n format.html { redirect_to @glossary_label, notice: 'Glossary label was successfully updated.' }\n format.json { render :show, status: :ok, location: @glossary_label }\n else\n format.html { render :edit }\n format.json { render json: @glossary_label.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @gl = Gl.find(params[:id])\n\n respond_to do |format|\n if @gl.update_attributes(params[:gl])\n format.html { redirect_to @gl, notice: 'Gl was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @gl.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @glass = Glass.find(params[:id])\n\n respond_to do |format|\n if @glass.update_attributes(params[:glass])\n format.html { redirect_to @glass, notice: 'Glass was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @glass.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @genotype = Genotype.find(params[:id])\n\n respond_to do |format|\n if @genotype.update_attributes(params[:genotype])\n format.html { redirect_to @genotype, notice: 'Genotype was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @genotype.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @api_noun = Api::Noun.find(params[:id])\n\n respond_to do |format|\n if @api_noun.update_attributes(params[:api_noun])\n format.html { redirect_to @api_noun, notice: 'Noun was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @api_noun.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @gl.update(gl_params)\n format.html { redirect_to @gl, notice: 'Gl was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @gl.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n @gln = Gln.find(params[:id])\n respond_to do |format|\n if @gln.update_attributes(params[:gln])\n format.html { redirect_to empresa_glns_path, notice: \"EL GLN fue modificado correctamente.\" }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @gln.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @noun.update(noun_params)\n format.html { redirect_to @noun, notice: 'Noun was successfully updated.' }\n format.json { render :show, status: :ok, location: @noun }\n else\n format.html { render :edit }\n format.json { render json: @noun.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @glossaries = args[:glossaries] if args.key?(:glossaries)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n end",
"def update\n respond_to do |format|\n save_relations\n if @ingredient.update(ingredient_params)\n format.html { redirect_to @ingredient.recipe, notice: 'Ingredient was successfully updated.' }\n format.json { render :show, status: :ok, location: @ingredient }\n else\n format.html { render :edit }\n format.json { render json: @ingredient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @dog_poly.update(dog_poly_params)\n format.html { redirect_to @dog_poly, notice: 'Dog poly was successfully updated.' }\n format.json { render :show, status: :ok, location: @dog_poly }\n else\n format.html { render :edit }\n format.json { render json: @dog_poly.errors, status: :unprocessable_entity }\n end\n end\n end",
"def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end",
"def set_glossary\n @glossary = Glossary.find(params[:id])\n end",
"def update\n ingredient.update(ingredient_params)\n render json: ingredient\n end",
"def update\n respond_to do |format|\n if @legend.update(legend_params)\n format.html { redirect_to @legend, notice: 'Legend was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @legend.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @gopy = Gopy.find(params[:id])\n\n respond_to do |format|\n if @gopy.update_attributes(params[:gopy])\n format.html { redirect_to @gopy, notice: 'Gopy was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @gopy.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @galaxies_lenticular_galaxy = Galaxies::LenticularGalaxy.find(params[:id])\n\n respond_to do |format|\n if @galaxies_lenticular_galaxy.update_attributes(params[:galaxies_lenticular_galaxy])\n format.html { redirect_to @galaxies_lenticular_galaxy, :notice => 'Lenticular galaxy was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @galaxies_lenticular_galaxy.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @gist = Gist.find(params[:id])\n\n respond_to do |format|\n if @gist.update_attributes(params[:gist])\n format.html { redirect_to @gist, notice: 'Gist was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @gist.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\t\trespond_to do |format|\n\t\t\tif @ontology.update(ontology_params)\n\t\t\t\tformat.html { redirect_to @ontology, notice: 'Ontology was successfully updated.' }\n\t\t\t\tformat.json { head :no_content }\n\t\t\telse\n\t\t\t\tformat.html { render action: 'edit' }\n\t\t\t\tformat.json { render json: @ontology.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def update\n respond_to do |format|\n if @ontology.update(ontology_params)\n format.html { redirect_to @ontology, notice: 'Ontology was successfully updated.' }\n format.json { render :show, status: :ok, location: @ontology }\n else\n format.html { render :edit }\n format.json { render json: @ontology.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @glossary = Glossary.create_glossary(params[:glossary])\n\n respond_to do |format|\n if @glossary.save\n format.html { redirect_to @glossary, notice: 'Glossary was successfully created.' }\n format.json { render json: @glossary, status: :created, location: @glossary }\n else\n format.html { render action: \"new\" }\n format.json { render json: @glossary.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @badge = Badge.find(params[:id])\n\n respond_to do |format|\n if @badge.update_attributes(params[:badge])\n format.html { redirect_to @badge, notice: 'Badge was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @badge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @labelling = Labelling.find(params[:id])\n\n respond_to do |format|\n if @labelling.update_attributes(params[:labelling])\n format.html { redirect_to @labelling, notice: 'Labelling was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @labelling.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @garply.update(garply_params)\n format.html { redirect_to @garply, notice: 'Garply was successfully updated.' }\n format.json { render :show, status: :ok, location: @garply }\n else\n format.html { render :edit }\n format.json { render json: @garply.errors, status: :unprocessable_entity }\n end\n end\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\n respond_to do |format|\n if @gonullu.update(gonullu_params)\n format.html { redirect_to @gonullu, notice: 'Gonullu was successfully updated.' }\n format.json { render :show, status: :ok, location: @gonullu }\n else\n format.html { render :edit }\n format.json { render json: @gonullu.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch!\n request! :patch\n end",
"def update\n @gl_type = GlType.find(params[:id])\n\n respond_to do |format|\n if @gl_type.update_attributes(gl_type_params)\n format.html { redirect_to gl_types_path, notice: 'Gl type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @gl_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @noun = Noun.find(params[:id])\n\n respond_to do |format|\n if @noun.update_attributes(params[:noun])\n format.html { redirect_to(@noun, :notice => 'Noun was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @noun.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @glo_collection.update(glo_collection_params)\n format.html { redirect_to @glo_collection, notice: 'Glo collection was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @glo_collection.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @fiction = Fiction.find(params[:id])\n\n respond_to do |format|\n if @fiction.update_attributes(params[:fiction])\n format.html { redirect_to @fiction, notice: 'Fiction was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fiction.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @golfer = Golfer.find(params[:id])\n\n respond_to do |format|\n if @golfer.update_attributes(params[:golfer])\n format.html { redirect_to @golfer, notice: 'Golfer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @golfer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @gist.update(gist_params)\n format.html { redirect_to @gist, notice: 'Gist was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @gist.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @bundle = Bundle.find(params[:id])\n\n\n respond_to do |format|\n params[:bundle][:category] = params[:bundle][:category].strip.downcase\n params[:bundle][:style] = params[:bundle][:style].strip.downcase\n params[:bundle][:color] = params[:bundle][:color].strip.downcase\n params[:bundle][:brand] = params[:bundle][:brand].strip.downcase\n params[:bundle][:make] = params[:bundle][:make].strip.downcase\n params[:bundle][:location] = params[:bundle][:location].strip.downcase\n\n if @bundle.update_attributes(params[:bundle])\n format.html { redirect_to @bundle, notice: 'Bundle was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bundle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @glossary = Glossary.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @glossary }\n end\n end",
"def update\n respond_to do |format|\n if @legend.update(legend_params)\n format.html { redirect_to @legend, notice: 'Legend was successfully updated.' }\n format.json { render :show, status: :ok, location: @legend }\n else\n format.html { render :edit }\n format.json { render json: @legend.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @ingredient = Ingredient.find(params[:id])\n\n respond_to do |format|\n if @ingredient.update_attributes(params[:ingredient])\n format.html { redirect_to @ingredient, notice: 'Ingredient was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ingredient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n recipe.update(recipe_params)\n render json: recipe\n end",
"def update\n @lifestyle_subgenre = LifestyleSubgenre.find(params[:id])\n\n respond_to do |format|\n if @lifestyle_subgenre.update_attributes(params[:lifestyle_subgenre])\n format.html { redirect_to @lifestyle_subgenre, notice: 'Lifestyle subgenre was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @lifestyle_subgenre.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @sundry_grn = SundryGrn.find(params[:id])\n\n respond_to do |format|\n if @sundry_grn.update_attributes(params[:sundry_grn])\n format.html { redirect_to @sundry_grn, :notice => 'Sundry grn was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @sundry_grn.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @pregnancy.update(pregnancy_params)\n format.html { redirect_to @pregnancy, notice: 'Pregnancy was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @pregnancy.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @o_rganization.update(o_rganization_params)\n format.html { redirect_to @o_rganization, notice: 'O rganization was successfully updated.' }\n format.json { render :show, status: :ok, location: @o_rganization }\n else\n format.html { render :edit }\n format.json { render json: @o_rganization.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @gethotel = Gethotel.find(params[:id])\n\n respond_to do |format|\n if @gethotel.update_attributes(params[:gethotel])\n format.html { redirect_to @gethotel, notice: 'Gethotel was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @gethotel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @glossary = Glossary.find(params[:id])\n @glossary.destroy\n\n respond_to do |format|\n format.html { redirect_to glossaries_url }\n format.json { head :no_content }\n end\n end",
"def update\n respond_to do |format|\n if @bowling.update(bowling_params)\n format.html { redirect_to @bowling, notice: 'Bowling was successfully updated.' }\n format.json { render :show, status: :ok, location: @bowling }\n else\n format.html { render :edit }\n format.json { render json: @bowling.errors, status: :unprocessable_entity }\n end\n end\n end",
"def glossary_params\n params.require(:glossary).permit(:dict_id, :key_words, :word_type, :category, :primary_xlate, :secondary_xlate,:digest)\n end",
"def patch(path, data)\n request 'PATCH', path, body: data.to_json\n end",
"def update\n respond_to do |format|\n if @golf.update(golf_params)\n format.html { redirect_to @golf, notice: 'Golf was successfully updated.' }\n format.json { render :show, status: :ok, location: @golf }\n else\n format.html { render :edit }\n format.json { render json: @golf.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @ontology = SYMPH::Ontology.find(params[:id])\n\n respond_to do |format|\n if @ontology.update_attributes(params[:ontology])\n flash[:notice] = 'Ontology was successfully updated.'\n format.html { redirect_to(ontologies_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ontology.errors, :status => :unprocessable_entity }\n end\n end\n\t\n end",
"def update\n respond_to do |format|\n if @goofball.update(goofball_params)\n format.html { redirect_to @goofball, notice: 'Goofball was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @goofball.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @bracket_golfer.update(bracket_golfer_params)\n format.html { redirect_to @bracket_golfer, notice: 'Bracket golfer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @bracket_golfer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @liga_blaz_blue_general = LigaBlazBlueGeneral.find(params[:id])\n\n respond_to do |format|\n if @liga_blaz_blue_general.update_attributes(params[:liga_blaz_blue_general])\n format.html { redirect_to(@liga_blaz_blue_general, :notice => 'Liga blaz blue general was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @liga_blaz_blue_general.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def patch(path, params = {})\n request(:patch, path, params)\n end",
"def patch(path, params = {})\n request(:patch, path, params)\n end",
"def update\n @gene_ontology = GeneOntology.find(params[:id])\n\n respond_to do |format|\n if @gene_ontology.update_attributes(params[:gene_ontology])\n format.html { redirect_to(@gene_ontology, :notice => 'Gene ontology was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @gene_ontology.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @grade = Grade.find(params[:id])\n\n if @grade.update(grade_params)\n head :no_content\n else\n render json: @grade.errors, status: :unprocessable_entity\n end\n end",
"def set_glossary\n @glossary = Glossary.friendly.find(params[:id])\n end",
"def update\n @bowler.update(bowler_params)\n respond_with(@bowler)\n end",
"def update\n respond_to do |format|\n if @allergens_ingredient.update(allergens_ingredient_params)\n format.html { redirect_to @allergens_ingredient, notice: 'Allergens ingredient was successfully updated.' }\n format.json { render :show, status: :ok, location: @allergens_ingredient }\n else\n format.html { render :edit }\n format.json { render json: @allergens_ingredient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @galaxy = Galaxy.find(params[:id])\n\n respond_to do |format|\n if @galaxy.update_attributes(params[:galaxy])\n format.html { redirect_to @galaxy, :notice => 'Galaxy was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @galaxy.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n puts \"pregnancy_params => #{pregnancy_params}\"\n if @pregnancy.update(pregnancy_params)\n format.html { redirect_to rabbit_pregnancies_path(@rabbit), notice: 'Gravidanza aggiornata con successo.' }\n format.json { render :show, status: :ok, location: @pregnancy }\n else\n format.html { render :edit }\n format.json { render json: @pregnancy.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @gauge = Gauge.find(params[:id])\n\n respond_to do |format|\n if @gauge.update_attributes(params[:gauge])\n format.html { redirect_to @gauge, notice: 'Gauge was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @gauge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @gdoc.update(gdoc_params)\n format.html { redirect_to @gdoc, notice: 'Gdoc was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @gdoc.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @criterion = Criterion.find(params[:id])\n\n if @criterion.update_attributes(params[:criterion])\n head :no_content\n else\n render json: @criterion.errors, status: :unprocessable_entity\n end\n end",
"def update!(**args)\n @gconcept = args[:gconcept] if args.key?(:gconcept)\n @is_required = args[:is_required] if args.key?(:is_required)\n end",
"def update\n @good = Good.find(params[:id])\n\n respond_to do |format|\n if @good.update_attributes(params[:good])\n format.html { redirect_to :action => \"index\" }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @good.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @bottle.update(bottle_params)\n format.html { redirect_to user_path(current_user.id), notice: 'Bottle was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @bottle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end",
"def update\n @green = Green.find(params[:id])\n\n respond_to do |format|\n if @green.update_attributes(params[:green])\n format.html { redirect_to scaffold_green_url(@green), notice: 'Green was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @green.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @goody = Goody.find(params[:id])\n\n respond_to do |format|\n if @goody.update_attributes(params[:goody])\n format.html { redirect_to @goody, notice: 'Goody was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @goody.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @boost.update(boost_params)\n format.html { redirect_to @boost, notice: 'Boost was successfully updated.' }\n format.json { render :show, status: :ok, location: @boost }\n else\n format.html { render :edit }\n format.json { render json: @boost.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @liga_blaz_blue = LigaBlazBlue.find(params[:id])\n\n respond_to do |format|\n if @liga_blaz_blue.update_attributes(params[:liga_blaz_blue])\n format.html { redirect_to(@liga_blaz_blue, :notice => 'Liga blaz blue was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @liga_blaz_blue.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @gig_request = GigRequest.find(params[:id])\n\n respond_to do |format|\n if @gig_request.update_attributes(params[:gig_request])\n format.html { redirect_to @gig_request, notice: 'Gig request was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @gig_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @specialty = Specialty.find(params[:id])\n\n if @specialty.update(specialty_params)\n head :no_content\n else\n render json: @specialty.errors, status: :unprocessable_entity\n end\n end",
"def update\n @bundle = Bundle.find(params[:id])\n\n respond_to do |format|\n if @bundle.update_attributes(params[:bundle])\n format.html { redirect_to @bundle, notice: 'Bundle was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bundle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @grape.update(grape_params)\n format.html { redirect_to @grape, notice: \"Grape was successfully updated.\" }\n format.json { render :show, status: :ok, location: @grape }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @grape.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @lyric.update(lyric_params)\n format.html { redirect_to @lyric, notice: 'Lyric was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @lyric.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n save_relations\n if @recipe.update(recipe_params)\n format.html { redirect_to @recipe, notice: 'Recipe was successfully updated.' }\n format.json { render :show, status: :ok, location: @recipe }\n else\n format.html { render :edit }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @lodging.update(lodging_params)\n format.html { redirect_to @lodging, notice: 'Lodging was successfully updated.' }\n format.json { render :show, status: :ok, location: @lodging }\n else\n format.html { render :edit }\n format.json { render json: @lodging.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @texture = Texture.find(params[:id])\n\n respond_to do |format|\n if @texture.update_attributes(params[:texture])\n format.html { redirect_to @texture, :notice => 'Texture was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @texture.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @word = Word.find(params[:id])\n\n respond_to do |format|\n\n if @word.update_attributes(params[:word])\n format.json { head :no_content }\n else\n format.json { render :json => @word.errors,\n :status => :unprocessable_entity }\n end\n\n end\n end",
"def update\n @bl = Bl.find(params[:id])\n\n respond_to do |format|\n if @bl.update_attributes(params[:bl])\n format.html { redirect_to @bl, notice: 'Bl was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bl.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @featuring.update(featuring_params)\n format.html { redirect_to @featuring, notice: 'Featuring was successfully updated.' }\n format.json { render :show, status: :ok, location: @featuring }\n else\n format.html { render :edit }\n format.json { render json: @featuring.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @gatha.update(gatha_params)\n format.html { redirect_to @gatha, notice: 'Gatha was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @gatha.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n update_gc(grad_params)\n respond_to do |format|\n # if @grad.update(grad_params)\n format.html { redirect_to @grad }#, notice: flatten_hash(grad_params) }\n # else\n # format.html { render :edit }\n # end\n end\n end",
"def update\n @orthodb_best_orthologue = OrthodbBestOrthologue.find(params[:id])\n\n respond_to do |format|\n if @orthodb_best_orthologue.update_attributes(params[:orthodb_best_orthologue])\n format.html { redirect_to @orthodb_best_orthologue, notice: 'Orthodb best orthologue was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @orthodb_best_orthologue.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @rigging.update(rigging_params)\n format.html { redirect_to @rigging, notice: 'Rigging was successfully updated.' }\n format.json { render :show, status: :ok, location: @rigging }\n else\n format.html { render :edit }\n format.json { render json: @rigging.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @galaxies_elliptical_galaxy.update(galaxies_elliptical_galaxy_params)\n format.html { redirect_to @galaxies_elliptical_galaxy, notice: 'Elliptical galaxy was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @galaxies_elliptical_galaxy.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ingredient.update(ingredient_params)\n format.html { redirect_to @ingredient, notice: 'Ingredient was successfully updated.' }\n format.json { render :show, status: :ok, location: @ingredient }\n else\n format.html { render :edit }\n format.json { render json: @ingredient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n # { clinic: {id: references, \"license_id\"=>nil, \"name\"=>string } }\n \n if @clinic.update_attributes(params[:clinic].except(:api_license_id))\n head :no_content\n else\n render json: clinic.errors.full_messages, status: :unprocessable_entity\n end\n end",
"def update\n @lyric = Lyric.find(params[:id])\n\n respond_to do |format|\n if @lyric.update_attributes(params[:lyric])\n format.html { redirect_to @lyric, notice: 'Lyric was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @lyric.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @clothing.update(clothing_params)\n format.html { redirect_to @clothing, notice: 'Clothing was successfully updated.' }\n format.json { render :show, status: :ok, location: @clothing }\n else\n format.html { render :edit }\n format.json { render json: @clothing.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @lot = Lot.find(params[:id])\n\n respond_to do |format|\n if @lot.update_attributes(params[:lot])\n format.html { redirect_to myadmin_lots_path, :notice => 'Lot was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @lot.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @dictionary = Dictionary.find(params[:id])\n\n respond_to do |format|\n if @dictionary.update_attributes(params[:dictionary])\n format.html { redirect_to @dictionary, notice: 'Competency was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @dictionary.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @cat_poly.update(cat_poly_params)\n format.html { redirect_to @cat_poly, notice: 'Cat poly was successfully updated.' }\n format.json { render :show, status: :ok, location: @cat_poly }\n else\n format.html { render :edit }\n format.json { render json: @cat_poly.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @socio_rg.update(socio_rg_params)\n format.html { redirect_to @socio_rg, notice: 'Socio rg was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @socio_rg.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @document.update_attributes(name: document_params[:name], lab_id: document_params[:lab_id])\n format.html { redirect_to documents_url, notice: 'Document was successfully updated.' }\n format.json { render :show, status: :ok, location: documents_url }\n else\n format.html { render :edit }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.74667126",
"0.70632654",
"0.70062625",
"0.6846839",
"0.6222206",
"0.614626",
"0.61316836",
"0.61160177",
"0.61103004",
"0.5976634",
"0.5932507",
"0.59037656",
"0.5900743",
"0.5894954",
"0.5874841",
"0.58570397",
"0.582475",
"0.58245444",
"0.5819762",
"0.5819664",
"0.581166",
"0.5780636",
"0.5769321",
"0.5769149",
"0.57652164",
"0.5758635",
"0.5743554",
"0.5733385",
"0.5728187",
"0.5704563",
"0.5703708",
"0.57025605",
"0.5692055",
"0.56799924",
"0.56659853",
"0.5662505",
"0.5662402",
"0.5659875",
"0.5656452",
"0.5655785",
"0.5653206",
"0.5652054",
"0.5646262",
"0.5639756",
"0.56145453",
"0.56134033",
"0.5613333",
"0.56129634",
"0.56086296",
"0.56074256",
"0.56039006",
"0.5599427",
"0.5593689",
"0.55931395",
"0.5592419",
"0.5589079",
"0.5589079",
"0.5578914",
"0.55770046",
"0.5570306",
"0.5564152",
"0.5551802",
"0.55493593",
"0.5546863",
"0.5542634",
"0.55373466",
"0.553439",
"0.55280364",
"0.55221313",
"0.5521834",
"0.5514297",
"0.5512117",
"0.5508909",
"0.5504365",
"0.55033165",
"0.5500872",
"0.54988974",
"0.5498229",
"0.54973525",
"0.5495768",
"0.54872775",
"0.5480667",
"0.5479478",
"0.5478979",
"0.54772335",
"0.54754555",
"0.54753506",
"0.5474891",
"0.5472915",
"0.547126",
"0.546883",
"0.5468322",
"0.54655105",
"0.5464042",
"0.54635966",
"0.5460657",
"0.5457058",
"0.5456262",
"0.54552615",
"0.5452983"
] | 0.6999421 | 3 |
DELETE /glossaries/1 DELETE /glossaries/1.json | def destroy
@glossary.destroy
respond_to do |format|
format.html { redirect_to glossaries_url, notice: 'Glossary was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @glossary = Glossary.find(params[:id])\n @glossary.destroy\n\n respond_to do |format|\n format.html { redirect_to glossaries_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @glossary = Glossary.find(params[:id])\n @glossary.destroy\n\n respond_to do |format|\n format.html { redirect_to glossaries_url }\n format.xml { head :ok }\n end\n end",
"def destroy\n authorize_action_for @glossary\n @glossary.destroy\n respond_to do |format|\n format.html { redirect_to glossaries_url, notice: 'Glossary was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @glossary_label.destroy\n respond_to do |format|\n format.html { redirect_to glossary_labels_url, notice: 'Glossary label was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gl.destroy\n respond_to do |format|\n format.html { redirect_to gls_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gl = Gl.find(params[:id])\n @gl.destroy\n\n respond_to do |format|\n format.html { redirect_to gls_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @genotype = Genotype.find(params[:id])\n @genotype.destroy\n\n respond_to do |format|\n format.html { redirect_to genotypes_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @api_noun = Api::Noun.find(params[:id])\n @api_noun.destroy\n\n respond_to do |format|\n format.html { redirect_to api_nouns_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @noun.destroy\n\n respond_to do |format|\n format.html { redirect_to nouns_url }\n # format.json { head :no_content }\n end\n end",
"def destroy\n @green = Green.find(params[:id])\n @green.destroy\n\n respond_to do |format|\n format.html { redirect_to scaffold_greens_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @lifestyle_subgenre = LifestyleSubgenre.find(params[:id])\n @lifestyle_subgenre.destroy\n\n respond_to do |format|\n format.html { redirect_to lifestyle_subgenres_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gen = Gen.find(params[:id])\n @gen.destroy\n\n respond_to do |format|\n format.html { redirect_to gens_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @noun.destroy\n respond_to do |format|\n format.html { redirect_to nouns_url, notice: 'Noun was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dictionary = Dictionary.find(params[:id])\n @dictionary.destroy\n\n respond_to do |format|\n format.html { redirect_to dictionaries_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ontology.destroy\n respond_to do |format|\n format.html { redirect_to ontologies_url, notice: 'Ontology was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @garply.destroy\n respond_to do |format|\n format.html { redirect_to garplies_url, notice: 'Garply was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @noun = Noun.find(params[:id])\n @noun.destroy\n\n respond_to do |format|\n format.html { redirect_to(nouns_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @criterion_grade.destroy\n respond_to do |format|\n format.html { redirect_to criterion_grades_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gl_type = GlType.find(params[:id])\n @gl_type.destroy\n\n respond_to do |format|\n format.html { redirect_to gl_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sundry_grn = SundryGrn.find(params[:id])\n @sundry_grn.destroy\n\n respond_to do |format|\n format.html { redirect_to sundry_grns_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @gopy = Gopy.find(params[:id])\n @gopy.destroy\n\n respond_to do |format|\n #format.html { redirect_to gopies_url }\n format.html { redirect_to hienthi_gopies_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gpath = Gpath.find(params[:id])\n @gpath.destroy\n\n respond_to do |format|\n format.html { redirect_to gpaths_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @galaxies_lenticular_galaxy = Galaxies::LenticularGalaxy.find(params[:id])\n @galaxies_lenticular_galaxy.destroy\n\n respond_to do |format|\n format.html { redirect_to galaxies_lenticular_galaxies_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @liga_blaz_blue_general = LigaBlazBlueGeneral.find(params[:id])\n @liga_blaz_blue_general.destroy\n\n respond_to do |format|\n format.html { redirect_to(liga_blaz_blue_generals_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @gravity = Gravity.find(params[:id])\n @gravity.destroy\n\n respond_to do |format|\n format.html { redirect_to gravities_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lodging.destroy\n respond_to do |format|\n format.html { redirect_to lodgings_url, notice: \"Lodging was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lodging.destroy\n respond_to do |format|\n format.html { redirect_to lodgings_url, notice: 'Lodging was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Alien.delete(params[\"id\"])\n end",
"def destroy\n @glo_collection.destroy\n respond_to do |format|\n format.html { redirect_to glo_collections_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n word = @meaning.word\n @meaning.destroy\n\n respond_to do |format|\n format.html { redirect_to word }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fiction = Fiction.find(params[:id])\n @fiction.destroy\n\n respond_to do |format|\n format.html { redirect_to fiction_index_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gene_ontology = GeneOntology.find(params[:id])\n @gene_ontology.destroy\n\n respond_to do |format|\n format.html { redirect_to(gene_ontologies_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @vocabulaire.destroy\n respond_to do |format|\n format.html { redirect_to vocabulaires_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @legend.destroy\n respond_to do |format|\n format.html { redirect_to legends_url, notice: 'Legend was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @glass = Glass.find(params[:id])\n @glass.destroy\n\n respond_to do |format|\n format.html { redirect_to glasses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @hood.destroy\n respond_to do |format|\n format.html { redirect_to hoods_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @orthodb_best_orthologue = OrthodbBestOrthologue.find(params[:id])\n @orthodb_best_orthologue.destroy\n\n respond_to do |format|\n format.html { redirect_to orthodb_best_orthologues_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @labelling = Labelling.find(params[:id])\n @labelling.destroy\n\n respond_to do |format|\n format.html { redirect_to labellings_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @glucose.destroy\n\n head :no_content\n end",
"def destroy\n @orthodb_level = OrthodbLevel.find(params[:id])\n @orthodb_level.destroy\n\n respond_to do |format|\n format.html { redirect_to orthodb_levels_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bracket_golfer.destroy\n respond_to do |format|\n format.html { redirect_to bracket_golfers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dog_poly.destroy\n respond_to do |format|\n format.html { redirect_to dog_polies_url, notice: 'Dog poly was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gauge = Gauge.find(params[:id])\n @gauge.destroy\n\n respond_to do |format|\n format.html { redirect_to gauges_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @badge = Badge.find(params[:id])\n @badge.destroy\n\n respond_to do |format|\n format.html { redirect_to badges_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @health_level.destroy\n\n respond_to do |format|\n format.html { redirect_to health_levels_url }\n format.json { head :no_content }\n end\n end",
"def delete(id:)\n id_check(:id, id)\n\n cf_delete(path: \"/organizations/#{org_id}/railguns/#{id}\")\n end",
"def destroy\n @gist.destroy\n respond_to do |format|\n format.html { redirect_to gists_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @grumble.destroy\n respond_to do |format|\n format.html { redirect_to grumbles_url, notice: 'Grumble was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gatha.destroy\n respond_to do |format|\n format.html { redirect_to gathas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gravity.destroy\n respond_to do |format|\n format.html { redirect_to gravities_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @o_rganization.destroy\n respond_to do |format|\n format.html { redirect_to o_rganizations_url, notice: 'O rganization was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n dictionary = @definition.dictionary\n @definition.destroy\n respond_to do |format|\n format.html { redirect_to dictionary_url(dictionary.id), notice: 'Definition was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n \n @ontology = SYMPH::Ontology.find(params[:id])\n @ontology.disable\n @ontology.destroy\n \n respond_to do |format|\n format.html { redirect_to :action => :index }\n format.xml { head :ok }\n end\n end",
"def destroy\n @historial = Historial.find(params[:id])\n @historial.destroy\n\n respond_to do |format|\n format.html { redirect_to historials_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @gethotelstaticdatagd = Gethotelstaticdatagd.find(params[:id])\n @gethotelstaticdatagd.destroy\n\n respond_to do |format|\n format.html { redirect_to gethotelstaticdatagds_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @manage_glow.destroy\n respond_to do |format|\n format.html { redirect_to manage_glows_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @spanish_vocab = SpanishVocab.find(params[:id])\n @spanish_vocab.destroy\n\n respond_to do |format|\n format.html { redirect_to spanish_vocabs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n\t\tFile.delete(@ontology.url)\n\t\[email protected]\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to ontologies_url }\n\t\t\tformat.json { head :no_content }\n\t\tend\n\tend",
"def destroy\n @criterion = Criterion.find(params[:id])\n @criterion.destroy\n\n respond_to do |format|\n format.html { redirect_to criteria_url }\n format.json { head :no_content }\n end\n end",
"def delete(id)\n request(:delete, \"/recipes/#{id}.json\")\n end",
"def destroy\n @texture = Texture.find(params[:id])\n @texture.destroy\n\n respond_to do |format|\n format.html { redirect_to textures_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @graduation = Graduation.find(params[:id])\n @graduation.destroy\n\n respond_to do |format|\n format.html { redirect_to(graduations_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @reward_and_level.destroy\n respond_to do |format|\n format.html { redirect_to reward_and_levels_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @orthologue = Orthologue.find(params[:id])\n @orthologue.destroy\n\n respond_to do |format|\n format.html { redirect_to orthologues_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gig = Gig.find(params[:id])\n @gig.destroy\n\n respond_to do |format|\n format.html { redirect_to gigs_url }\n format.json { render json: nil, status: :ok }\n end\n end",
"def destroy\n @hairstyle = Hairstyle.find(params[:id])\n @hairstyle.destroy\n\n respond_to do |format|\n format.html { redirect_to hairstyles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @percentual_gordura.destroy\n respond_to do |format|\n format.html { redirect_to percentual_gorduras_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @genre_dependency.destroy\n respond_to do |format|\n format.html { redirect_to genre_dependencies_url, notice: 'Genre dependency was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @featuring.destroy\n respond_to do |format|\n format.html { redirect_to featuring_index_url, notice: 'Featuring was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gethotel = Gethotel.find(params[:id])\n @gethotel.destroy\n\n respond_to do |format|\n format.html { redirect_to gethotels_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @general = General.find(params[:id])\n @general.destroy\n\n respond_to do |format|\n format.html { redirect_to generals_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @golf_cource = GolfCource.find(params[:id])\n @golf_cource.destroy\n\n respond_to do |format|\n format.html { redirect_to scaffold_golf_cources_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @galaxies_elliptical_galaxy.destroy\n respond_to do |format|\n format.html { redirect_to galaxies_elliptical_galaxies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @crossbowtype.destroy\n respond_to do |format|\n format.html { redirect_to crossbowtypes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @allergens_ingredient.destroy\n respond_to do |format|\n format.html { redirect_to allergens_ingredients_url, notice: 'Allergens ingredient was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dictionary.destroy\n respond_to do |format|\n format.html {redirect_to dictionaries_url, notice: 'Dictionary was successfully destroyed.'}\n format.json {head :no_content}\n end\n end",
"def destroy\n @graduation.destroy\n respond_to do |format|\n format.html { redirect_to graduations_url, notice: 'Graduation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @level.destroy\n respond_to do |format|\n format.html { redirect_to levels_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @badge = Badge.find(params[:id])\n @badge.destroy\n\n respond_to do |format|\n format.html { redirect_to(badges_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @livingexpense = Livingexpense.find(params[:id])\n @livingexpense.destroy\n\n respond_to do |format|\n format.html { redirect_to livingexpenses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @graveyard.destroy\n respond_to do |format|\n format.html { redirect_to graveyards_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @graveyard.destroy\n respond_to do |format|\n format.html { redirect_to graveyards_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @house = House.find(params[:id])\n @house.destroy\n\n respond_to do |format|\n format.html { redirect_to gigs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @legs2.destroy\n respond_to do |format|\n format.html { redirect_to legs2s_url, notice: 'Legs2 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bla = Bla.find(params[:id])\n @bla.destroy\n\n respond_to do |format|\n format.html { redirect_to blas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lob.destroy\n respond_to do |format|\n format.html { redirect_to root_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @boost.destroy\n respond_to do |format|\n format.html { redirect_to boosts_url, notice: 'Boost was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @galaxy = Galaxy.find(params[:id])\n @galaxy.destroy\n\n respond_to do |format|\n format.html { redirect_to galaxies_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @garrison.destroy\n respond_to do |format|\n format.html { redirect_to garrisons_path_for(@garrison) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pregnancy.destroy\n respond_to do |format|\n format.html { redirect_to pregnancies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @glad.destroy\n respond_to do |format|\n format.html { redirect_to glads_url, notice: 'Glad was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @alumno.destroy\n respond_to do |format|\n format.html { redirect_to grupos_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @straddle = Straddle.find(params[:id])\n @straddle.destroy\n\n respond_to do |format|\n format.html { redirect_to straddles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ingredient = Ingredient.find(params[:id])\n @ingredient.destroy\n\n respond_to do |format|\n format.html { redirect_to ingredients_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @constitution = Constitution.find(params[:id])\n @constitution.destroy\n\n respond_to do |format|\n format.html { redirect_to constitutions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lbl_colour = LblColour.find(params[:id])\n @lbl_colour.destroy\n\n respond_to do |format|\n format.html { redirect_to lbl_colours_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bow.destroy\n respond_to do |format|\n format.html { redirect_to bows_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @recipe_ingredient = RecipeIngredient.find(params[:id])\n @recipe_ingredient.destroy\n\n respond_to do |format|\n format.html { redirect_to recipe_ingredients_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @level_progration.destroy\n respond_to do |format|\n format.html { redirect_to level_progrations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gasto = Gasto.find(params[:id])\n @gasto.destroy\n\n respond_to do |format|\n format.html { redirect_to gastos_url }\n format.json { head :no_content }\n end\n end"
] | [
"0.79644775",
"0.7778502",
"0.7603625",
"0.7154395",
"0.6801182",
"0.6768405",
"0.6612433",
"0.6592294",
"0.65574133",
"0.6537899",
"0.64016116",
"0.6386985",
"0.63759434",
"0.6337245",
"0.6326301",
"0.6323726",
"0.6308397",
"0.63069576",
"0.629387",
"0.62894285",
"0.6273795",
"0.62678117",
"0.62618613",
"0.62572885",
"0.62497264",
"0.6244522",
"0.6242094",
"0.62394905",
"0.622238",
"0.62180793",
"0.6217268",
"0.62120867",
"0.6198352",
"0.6198259",
"0.619773",
"0.6189172",
"0.61847943",
"0.61799824",
"0.61721456",
"0.61711264",
"0.6168563",
"0.616434",
"0.61623394",
"0.6159512",
"0.6157996",
"0.61552733",
"0.61520183",
"0.61420107",
"0.6141593",
"0.61334985",
"0.6131768",
"0.6129259",
"0.61266303",
"0.6126542",
"0.6121821",
"0.61202425",
"0.6119928",
"0.611649",
"0.61062264",
"0.6099432",
"0.60987824",
"0.6096086",
"0.6093173",
"0.6091151",
"0.60900205",
"0.6089885",
"0.6085823",
"0.60803694",
"0.60789376",
"0.60772645",
"0.6076801",
"0.60670525",
"0.6064566",
"0.6064537",
"0.60630053",
"0.6060442",
"0.6057858",
"0.60570514",
"0.6054236",
"0.6049486",
"0.60483205",
"0.60483205",
"0.60471576",
"0.6045433",
"0.6041742",
"0.6039844",
"0.6039708",
"0.6037628",
"0.60373086",
"0.6036917",
"0.60344905",
"0.60341805",
"0.6032612",
"0.6030695",
"0.60291606",
"0.6028766",
"0.60269475",
"0.6026539",
"0.60210794",
"0.6020904"
] | 0.78103 | 1 |
Use callbacks to share common setup or constraints between actions. | def set_glossary
@glossary = Glossary.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 glossary_params
params.require(:glossary).permit(:dict_id, :key_words, :word_type, :category, :primary_xlate, :secondary_xlate,:digest)
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 |
Provide a user friendly representation | def to_s
'#<Twilio.Video.V1.AnonymizeList>'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_display\n raise NotImplementedError\n end",
"def to_s; description end",
"def toString\n #Not sure if we want this or just use the getters for more\n #selective formatting\n end",
"def to_s\n super\n end",
"def to_s\n super\n end",
"def to_s\n \"#{@name}, \" \\\n \"#{model.upcase}: \" \\\n \"#{data.values.join(\"/\")}, \" \\\n \":#{@type}\"\n end",
"def to_s\n\t\tsuper\n\tend",
"def to_s\r\n \"<#{self.class.name} id: #{self[:id]}, description: #{self[:description]}, definition: #{self[:definition]}, has_inverse: #{self[:has_inverse]} accuracy: #{self[:accuracy]}\"\r\n end",
"def render\n inspect\n end",
"def to_s\n pieces = []\n pieces << self.class.name\n pieces << \"id:##{id.inspect}\"\n pieces << \"standardized:\" + (is_standard? ? 'standard' : (standard_id.nil? ? 'no' : \"copy-of-#{standard_id}\"))\n pieces << \"mission:#{mission_id.inspect}\"\n pieces.join(', ')\n end",
"def format; end",
"def format; end",
"def format; end",
"def format; end",
"def format; end",
"def format; end",
"def format; end",
"def format; end",
"def rendered_format; end",
"def rendered_format; end",
"def to_s\n render\n end",
"def to_s\n return super\n end",
"def display_string\n display = [self.name]\n display << self.description if self.description && self.type == 'StorageType'\n display << self.software if self.software && self.type == 'DatabaseType'\n cpu = self.cpu_values_string\n display << \"CPU: #{cpu}\" unless cpu.blank? || self.type == 'StorageType'\n display << \"RAM: #{self.memory} GB\" if self.memory && self.type != 'StorageType'\n hdd = self.hdd_values_string\n display << \"HDD: #{hdd}\" unless hdd.blank?\n display << self.operating_system if self.operating_system && self.type != 'StorageType'\n display.join(', ')\n end",
"def to_s\n 'Id: ' + @id.to_s +\n ', Expires on: ' + display_expiry_date +\n ', Level: ' + map_number_to_word_level(@level) +\n ', Number of days left to expire: ' + display_num_of_days_left +\n ', Description: ' + @description % self\n end",
"def humanize\n # TODO\n # Inflector.humanize(self)\n end",
"def to_s\n\t\tdescription\n\tend",
"def to_s\n\t\tdescription\n\tend",
"def to_s\n %(<#{ @name }#{attributes}>)\n end",
"def to_s\n %w( name display_name uuid ).collect { |k| \"#{k}=#{ self.send(k) }\" }.join(' | ') + \" | types=#{ types.join(',') }\"\n end",
"def to_s\n long_display\n end",
"def to_s\n long_display\n end",
"def to_s\n long_display\n end",
"def to_s\n long_display\n end",
"def to_s\n self.name.to_s || super\n end",
"def to_s\n descr\n end",
"def to_s\n self.name.humanize\n end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s ; format ; end",
"def formatted_name\n \"#{self.id} - #{self.name}\"\n #This is used to bring value on each page.\n end",
"def to_s\n\t\t\"#{self.name}\"\n\tend",
"def to_s\n \n end",
"def to_s\n self.name || super\n end",
"def to_s\n self.name || super\n end",
"def to_s\n return \"#{@name} - #{@description} : #{@rating}\"\n end",
"def inspect; to_s; end",
"def inspect; to_s; end",
"def inspect; to_s; end",
"def inspect; to_s; end",
"def inspect; to_s; end",
"def to_s\n raise NotImplementedError\n end",
"def short_inspect\n attrs = []\n attrs << [\"id\", id || \"new_record\"]\n\n string_attr = proc { |value| '\"' + TextHelpers.truncate(value, :length => 10) + '\"' }\n\n if respond_to?(:name) && name.present?\n attrs << [\"name\", string_attr[name]]\n elsif respond_to?(:title) && title.present?\n attrs << [\"title\", string_attr[title]]\n end\n\n \"#<#{ self.class } #{ attrs.map { |name, value| \"#{ name }: #{ value }\" }.join(\", \") }>\"\n end"
] | [
"0.70430577",
"0.7025487",
"0.7008232",
"0.7007793",
"0.69441473",
"0.6917163",
"0.68431",
"0.6797009",
"0.6655106",
"0.66227216",
"0.6618043",
"0.6618043",
"0.6618043",
"0.6618043",
"0.6618043",
"0.6618043",
"0.6618043",
"0.6618043",
"0.660979",
"0.660979",
"0.6585346",
"0.65730983",
"0.65662885",
"0.65404147",
"0.65379703",
"0.651875",
"0.651875",
"0.6516385",
"0.6501134",
"0.65010244",
"0.65010244",
"0.65010244",
"0.65010244",
"0.64861107",
"0.6478101",
"0.64581114",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6442197",
"0.64329034",
"0.64289695",
"0.64203346",
"0.6419349",
"0.6419349",
"0.6418417",
"0.64115626",
"0.64115626",
"0.64115626",
"0.64115626",
"0.64115626",
"0.64071685",
"0.63947713"
] | 0.0 | -1 |
Provide a user friendly representation | def to_s
context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
"#<Twilio.Video.V1.AnonymizeContext #{context}>"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_display\n raise NotImplementedError\n end",
"def to_s; description end",
"def to_s\n super\n end",
"def toString\n #Not sure if we want this or just use the getters for more\n #selective formatting\n end",
"def to_s\n super\n end",
"def to_s\n \"#{@name}, \" \\\n \"#{model.upcase}: \" \\\n \"#{data.values.join(\"/\")}, \" \\\n \":#{@type}\"\n end",
"def to_s\n\t\tsuper\n\tend",
"def to_s\r\n \"<#{self.class.name} id: #{self[:id]}, description: #{self[:description]}, definition: #{self[:definition]}, has_inverse: #{self[:has_inverse]} accuracy: #{self[:accuracy]}\"\r\n end",
"def render\n inspect\n end",
"def to_s\n pieces = []\n pieces << self.class.name\n pieces << \"id:##{id.inspect}\"\n pieces << \"standardized:\" + (is_standard? ? 'standard' : (standard_id.nil? ? 'no' : \"copy-of-#{standard_id}\"))\n pieces << \"mission:#{mission_id.inspect}\"\n pieces.join(', ')\n end",
"def format; end",
"def format; end",
"def format; end",
"def format; end",
"def format; end",
"def format; end",
"def format; end",
"def format; end",
"def rendered_format; end",
"def rendered_format; end",
"def to_s\n render\n end",
"def to_s\n return super\n end",
"def display_string\n display = [self.name]\n display << self.description if self.description && self.type == 'StorageType'\n display << self.software if self.software && self.type == 'DatabaseType'\n cpu = self.cpu_values_string\n display << \"CPU: #{cpu}\" unless cpu.blank? || self.type == 'StorageType'\n display << \"RAM: #{self.memory} GB\" if self.memory && self.type != 'StorageType'\n hdd = self.hdd_values_string\n display << \"HDD: #{hdd}\" unless hdd.blank?\n display << self.operating_system if self.operating_system && self.type != 'StorageType'\n display.join(', ')\n end",
"def to_s\n 'Id: ' + @id.to_s +\n ', Expires on: ' + display_expiry_date +\n ', Level: ' + map_number_to_word_level(@level) +\n ', Number of days left to expire: ' + display_num_of_days_left +\n ', Description: ' + @description % self\n end",
"def humanize\n # TODO\n # Inflector.humanize(self)\n end",
"def to_s\n\t\tdescription\n\tend",
"def to_s\n\t\tdescription\n\tend",
"def to_s\n %(<#{ @name }#{attributes}>)\n end",
"def to_s\n %w( name display_name uuid ).collect { |k| \"#{k}=#{ self.send(k) }\" }.join(' | ') + \" | types=#{ types.join(',') }\"\n end",
"def to_s\n long_display\n end",
"def to_s\n long_display\n end",
"def to_s\n long_display\n end",
"def to_s\n long_display\n end",
"def to_s\n self.name.to_s || super\n end",
"def to_s\n descr\n end",
"def to_s\n self.name.humanize\n end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s ; format ; end",
"def formatted_name\n \"#{self.id} - #{self.name}\"\n #This is used to bring value on each page.\n end",
"def to_s\n\t\t\"#{self.name}\"\n\tend",
"def to_s\n \n end",
"def to_s\n self.name || super\n end",
"def to_s\n self.name || super\n end",
"def to_s\n return \"#{@name} - #{@description} : #{@rating}\"\n end",
"def inspect; to_s; end",
"def inspect; to_s; end",
"def inspect; to_s; end",
"def inspect; to_s; end",
"def inspect; to_s; end",
"def to_s\n raise NotImplementedError\n end",
"def short_inspect\n attrs = []\n attrs << [\"id\", id || \"new_record\"]\n\n string_attr = proc { |value| '\"' + TextHelpers.truncate(value, :length => 10) + '\"' }\n\n if respond_to?(:name) && name.present?\n attrs << [\"name\", string_attr[name]]\n elsif respond_to?(:title) && title.present?\n attrs << [\"title\", string_attr[title]]\n end\n\n \"#<#{ self.class } #{ attrs.map { |name, value| \"#{ name }: #{ value }\" }.join(\", \") }>\"\n end"
] | [
"0.70447654",
"0.7025946",
"0.70086724",
"0.7008141",
"0.69449997",
"0.691802",
"0.6843895",
"0.6797355",
"0.6655898",
"0.6622141",
"0.66182053",
"0.66182053",
"0.66182053",
"0.66182053",
"0.66182053",
"0.66182053",
"0.66182053",
"0.66182053",
"0.6610882",
"0.6610882",
"0.6586841",
"0.657413",
"0.6566269",
"0.6539553",
"0.6538853",
"0.651945",
"0.651945",
"0.651676",
"0.6501867",
"0.6501771",
"0.6501771",
"0.6501771",
"0.6501771",
"0.6486658",
"0.6478414",
"0.6459342",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6443162",
"0.643225",
"0.6429404",
"0.64213824",
"0.6419917",
"0.6419917",
"0.64185613",
"0.64119405",
"0.64119405",
"0.64119405",
"0.64119405",
"0.64119405",
"0.64080113",
"0.63943845"
] | 0.0 | -1 |
Provide a detailed, user friendly representation | def inspect
context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
"#<Twilio.Video.V1.AnonymizeContext #{context}>"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def details; end",
"def to_s; description end",
"def get_detail\n return self.inspect\n end",
"def to_display\n raise NotImplementedError\n end",
"def formatted_info\n \"#{self.name} - #{self.description}\"\n end",
"def toString\n #Not sure if we want this or just use the getters for more\n #selective formatting\n end",
"def inspect\n 'Id: ' + @id.to_s +\n ', Expires on: ' + display_expiry_date +\n ', Level: ' + map_number_to_word_level(@level) +\n ', Number of days left to expire: ' + display_num_of_days_left +\n ', Description: ' + @description % self\n end",
"def short_inspect\n attrs = []\n attrs << [\"id\", id || \"new_record\"]\n\n string_attr = proc { |value| '\"' + TextHelpers.truncate(value, :length => 10) + '\"' }\n\n if respond_to?(:name) && name.present?\n attrs << [\"name\", string_attr[name]]\n elsif respond_to?(:title) && title.present?\n attrs << [\"title\", string_attr[title]]\n end\n\n \"#<#{ self.class } #{ attrs.map { |name, value| \"#{ name }: #{ value }\" }.join(\", \") }>\"\n end",
"def render\n inspect\n end",
"def overview\n\n end",
"def record_display\n string = \"#{id}. Title: #{title}\\n Author: #{author}\\n ISBN: #{isbn}\\n\"\n if library.nil?\n string += \" Library: None\\n\"\n else\n string += \" Library: #{library.branch_name}\\n\"\n end\n if patron.nil?\n string += \" Checked Out: Available\"\n else\n string += \" Checked Out: #{patron.name}\"\n end\n string\n end",
"def render_plain\n short_category(object.action) << \"\\n\" << instance_attributes\n end",
"def details\n\n return @description + \": \" + \"#{@infection}\" + \". \" + @patient.details\n\n end",
"def to_s\n 'Id: ' + @id.to_s +\n ', Expires on: ' + display_expiry_date +\n ', Level: ' + map_number_to_word_level(@level) +\n ', Number of days left to expire: ' + display_num_of_days_left +\n ', Description: ' + @description % self\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 display_string\n display = [self.name]\n display << self.description if self.description && self.type == 'StorageType'\n display << self.software if self.software && self.type == 'DatabaseType'\n cpu = self.cpu_values_string\n display << \"CPU: #{cpu}\" unless cpu.blank? || self.type == 'StorageType'\n display << \"RAM: #{self.memory} GB\" if self.memory && self.type != 'StorageType'\n hdd = self.hdd_values_string\n display << \"HDD: #{hdd}\" unless hdd.blank?\n display << self.operating_system if self.operating_system && self.type != 'StorageType'\n display.join(', ')\n end",
"def to_s\r\n \"<#{self.class.name} id: #{self[:id]}, description: #{self[:description]}, definition: #{self[:definition]}, has_inverse: #{self[:has_inverse]} accuracy: #{self[:accuracy]}\"\r\n end",
"def full_description\n \"#{self.class.description} #{self.description}\"\n end",
"def to_s\n descr\n end",
"def details\r\n return @description + \"; \" + @vPatients + \"; \" + @vProfiles + \": \" + @vAppointments\r\n end",
"def display\n to_h.fetch(:display)\n end",
"def display\n to_h.fetch(:display)\n end",
"def inspect_details\n\t\treturn \"ID=%s (%s)\" % [\n\t\t\tself.id,\n\t\t\tself.components.keys.map( &:name ).sort.join( '+' )\n\t\t]\n\tend",
"def to_s\n\t\tres = \"\\nname: \" + name.to_s + \"\\nid: \" + id.to_s + \"\\nservice: \" + service.to_s + \"\\ntitle: \" + title.to_s + \"\\nthumbnail: \" + thumbnail.to_s + \"\\nhref: \" + href.to_s\n\t\tres\n\tend",
"def details\n\t\t\"#{name}---#{status}-----#{start_date}----#{description}---- #{Client.find(client_id).name}---#{Client.find(client_id).email}\"\n\tend",
"def show\n @title = @user.complete_name\n @description = \"Informations relatives à #{@user.complete_name}\"\n @jsonld = @user.to_jsonld\n end",
"def details\n end",
"def to_s\n \"#{represent_status} : #{description}\"\n end",
"def details\n format_description(@description) + \"site name: \" + format_name\n end",
"def to_s\n\t\tdescription\n\tend",
"def to_s\n\t\tdescription\n\tend",
"def to_s_details\n ''\n end",
"def details\n\n end",
"def descriptions\n return @detail + \"; \" + @firm + \"; \" + @age + \": \" + \"#{@cost}\"\n end",
"def show\n\t\t@attrib_keys = [\"desc\", \"higher_level\", \"range\", \"components\", \"material\", \"ritual\", \"duration\", \"concentration\", \"casting_time\", \"level\", \"school\", \"class_names\", \"archetype\", \"domains\", \"oaths\", \"circles\", \"patrons\"]\n\tend",
"def to_s\n \"#{@name}, \" \\\n \"#{model.upcase}: \" \\\n \"#{data.values.join(\"/\")}, \" \\\n \":#{@type}\"\n end",
"def inspect_details\n ''\n end",
"def inspect\n \"#<#{self.class} ##{id} #{name} (#{slug})>\"\n end",
"def display_quick\r\n s = ''\r\n for i in @me.keys\r\n s << \" <b>#{i}.</b><br/>\" # country\r\n for j in @me[i].keys\r\n s << \" <b>#{j}:</b><br/>\" if not j == 'unknown' # state\r\n for k in @me[i][j].keys\r\n s << \" #{k}<br/>\" if not k == 'unknown' # county\r\n for l in @me[i][j][k].keys\r\n s << (\" \" + (l == 'unknown' ? \"<i>repository not given</i>\" : \" #{l}\") + \"<br/>\") if not l == nil # repository\r\n s << \" \" + @me[i][j][k][l].keys.collect{|m| \r\n (\"#{@me[i][j][k][l][m]} \" +\r\n case m # the count\r\n when 'female'\r\n \"♀\"\r\n when 'male'\r\n \"♂\"\r\n when 'gynadropmorph'\r\n \"[♀♂]\"\r\n else\r\n \"unknown sex\"\r\n end)}.join(\",\") \r\n s << \"<br/>\" \r\n end\r\n end\r\n end\r\n end\r\n s.html_safe\r\n end",
"def details\n return @description + \"; \" + @firm + \"; \" + @age + \": \" + \"#{@cost}\"\n end",
"def to_s\n super\n end",
"def to_s\n pieces = []\n pieces << self.class.name\n pieces << \"id:##{id.inspect}\"\n pieces << \"standardized:\" + (is_standard? ? 'standard' : (standard_id.nil? ? 'no' : \"copy-of-#{standard_id}\"))\n pieces << \"mission:#{mission_id.inspect}\"\n pieces.join(', ')\n end",
"def rendered_format; end",
"def rendered_format; end",
"def to_s\n\t\t\tstr = super() + \"\\n\"\n\t\t\tstr += \"\\tAppaleable? #{appaleable}\\n\" if appaleable\n\t\t\tstr += \"\\tDisapproved text: #{disapproved_text}\\n\" if disapproved_text\n\t\t\tstr += \"\\tLocation: #{location}\\n\" if location\n\t\t\tstr += \"\\tDisapproved text: #{disapproved_text}\\n\" if disapproved_text\n\t\t\tstr += \"\\tReason code: #{reason_code} (see: http://msdn.microsoft.com/en-US/library/bing-ads-editorialfailurereasoncodes.aspx)\\n\" if reason_code\n\n\t\tend",
"def display_data\n\t\t\t\"#{@model} #{@color} #{@horsepower} #{@year} #{@brand} #{@mpg}\"\n\t\tend",
"def to_s\n \"\\n\\tTitle: #{@title}\\n\n \\tAuthor: #{@author}\\n\n \\tUrl: #{@url}\\n\\n\"\n end",
"def inspect\n to_s.inspect\n end",
"def details\n data()\n end",
"def details\n\n return @description + \"; \" + @firstname + \"; \" + @lastname + \": \" + @dob + \": \"+ @address + \": \"+ @phone + \": \" + \"#{@infection}\"\n\n end",
"def inspect\n to_s\n end",
"def inspect\n to_s\n end",
"def show\n raise NotImplementedError\n end",
"def to_s\n long_display\n end",
"def to_s\n long_display\n end",
"def to_s\n long_display\n end",
"def to_s\n long_display\n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def inspect\n\t\tparts = []\n\t\tparts << self.one_of_description\n\t\tparts << self.all_of_description\n\t\tparts << self.none_of_description\n\t\tparts.compact!\n\n\t\tstr = \"#<%p:%#0x matching entities\" % [ self.class, self.object_id * 2 ]\n\t\tif parts.empty?\n\t\t\tstr << \" with any components\"\n\t\telse\n\t\t\tstr << parts.join( ', ' )\n\t\tend\n\t\tstr << \">\"\n\n\t\treturn str\n\tend",
"def inspect\n to_s\n end",
"def description\n return summary\n end",
"def details\n return @description + \"; \" + @doctorname + \"; \" + @medicine + \": \" + \"#{@cost}\"\n end",
"def details\n return \"ID = #{@id}\\n\" + \n \"Name = #{@name}\\n\" + \n \"Topic = #{@topic}\\n\" + \n \"Member Count = #{@member_count}\"\n end",
"def description\n name + ': ' + resource_type.to_s + ' | Sueldo: ' + salary.to_s +\n ' | Experiencia: ' + experience.to_s + ' años'\n end",
"def show\n\t\traise NotImplementedError, \"FIXME: Implement showing comments.\"\n\tend",
"def to_s\n return \"#{@name} - #{@description} : #{@rating}\"\n end",
"def inspect\n \"#{self.class}<#{@description.inspect}>\"\n end",
"def description\n end",
"def description\n end",
"def details\n return \" #{@description}, #{@lastname}, #{@date}. #{@start}, #{@hours}, #{@players}, #{@zone}. #{@cost}\"\n end",
"def display\n\t\tname\n\tend",
"def display\n\t\tname\n\tend",
"def display\n\t\tname\n\tend",
"def display\n\t\tname\n\tend",
"def details\n return @description + \"; \" + @manufacturer + \"; \" + @color + \": \" + \"#{@cost}\"\n end",
"def to_s\n \"#{self.title} - #{self.author} - #{self.date}\"\n end",
"def details\r\n return @description + \": \" + \". \" + @basic_profile.details\r\n end",
"def show\n #not needed for our implementation\n end",
"def to_s\n super\n end",
"def modeler_description\n return 'Gather orientation and story specific construction, fenestration (including overhang) specific information'\n end",
"def details_partial_for(o)\n \"#{o.class.name.underscore}s/details\"\n end",
"def display\n puts \"Personal Details\"\n puts \" Name : #{self.name}\"\n puts \" Date of Birth : #{self.dob}\"\n puts \" Marital Status : #{self.marital_status}\"\n puts \" Mobile Number : #{self.mobile_number}\"\n puts \" Email : #{self.email}\"\n end",
"def detail\n attributes.fetch(:detail)\n end",
"def detail\n attributes.fetch(:detail)\n end"
] | [
"0.68170065",
"0.68142146",
"0.6758589",
"0.6718451",
"0.66697186",
"0.6655344",
"0.6632312",
"0.66273594",
"0.6550127",
"0.65188134",
"0.6497969",
"0.6480078",
"0.6477721",
"0.6472211",
"0.64502096",
"0.64502096",
"0.64502096",
"0.64502096",
"0.64502096",
"0.64502096",
"0.64502096",
"0.64502096",
"0.64502096",
"0.64502096",
"0.64367676",
"0.6434794",
"0.63974625",
"0.6391661",
"0.6385164",
"0.63826483",
"0.63826483",
"0.63621265",
"0.63584715",
"0.6352767",
"0.6347243",
"0.6345342",
"0.63338625",
"0.6325844",
"0.6320725",
"0.6320725",
"0.6316434",
"0.6311974",
"0.6311425",
"0.63111603",
"0.6307294",
"0.63050634",
"0.6301272",
"0.62848294",
"0.627871",
"0.6277492",
"0.62770176",
"0.6274702",
"0.6274702",
"0.62604547",
"0.62543267",
"0.6251651",
"0.625114",
"0.62487584",
"0.62225854",
"0.6214293",
"0.6214293",
"0.6212906",
"0.62095803",
"0.62095803",
"0.62095803",
"0.62095803",
"0.6205272",
"0.6205272",
"0.6205272",
"0.6205272",
"0.6205272",
"0.6205272",
"0.6205272",
"0.6205272",
"0.6205272",
"0.6200787",
"0.6198166",
"0.61830676",
"0.6179759",
"0.617746",
"0.61753553",
"0.61619484",
"0.6157944",
"0.61527485",
"0.615132",
"0.615132",
"0.61505795",
"0.6144682",
"0.6144682",
"0.6144682",
"0.6144682",
"0.61351794",
"0.6133033",
"0.61300874",
"0.61294436",
"0.61242044",
"0.6121309",
"0.61148214",
"0.61109483",
"0.6108956",
"0.6108956"
] | 0.0 | -1 |
Build an instance of AnonymizeInstance | def get_instance(payload)
AnonymizeInstance.new(@version, payload, room_sid: @solution[:room_sid], sid: @solution[:sid])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @annonce = Annonce.new\n end",
"def alias_create(al)\n obj_create al, Alias\n end",
"def initialize_dup(orig) # :nodoc:\n %w(plurals singulars uncountables humans acronyms).each do |scope|\n instance_variable_set(\"@#{scope}\", orig.public_send(scope).dup)\n end\n define_acronym_regex_patterns\n end",
"def build()\n\t\t\treturn Alimento.new(@@nombre,@@proteinas,@@carbohidratos,@@lipidos,@@gei,@@terreno)\n\t\tend",
"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 new\n AwesomeObject.new(self)\n end",
"def new\n AwesomeObject.new(self)\n end",
"def build(attrs = {})\n choose_right_class(attrs).new(attrs)\n end",
"def object\n Animal.new(self.upcase)\n end",
"def produce_instance\n @instance ||= super\n end",
"def new()\n #This is a stub, used for indexing\n end",
"def build_ami(instance)\n provision(instance)\n logger.info { \"Finalizing changes for #{self.region} AMI...\" }\n self.agent_ami = register_hailstorm_ami(instance)\n logger.info { \"New AMI##{self.agent_ami} on #{self.region} created successfully, cleaning up...\" }\n end",
"def newInstance( params={} )\n model.new( params ).extend( InstanceMethods )\n end",
"def instantiate!; end",
"def build\n Automaton.new(@name, @dimensions, @type, @width, @rule)\n end",
"def build\n klass = create_class(@class_name, @options)\n klass.new\n end",
"def dup\n Ably::Models::IdiomaticRubyWrapper.new(attributes.dup, stop_at: stop_at.keys)\n end",
"def anonymize(anonymizer = nil, recursive: true)\n setup_file\n anonymizer ||= DICOM::Anonymizer.new(recursive: recursive)\n\n tx_syntax_uid = dicom_object['0002,0010'].value\n dicom_object.anonymize(anonymizer)\n dicom_object.add(DICOM::Element.new('0002,0010', tx_syntax_uid)) if tx_syntax_uid\n\n dicom_object.write(output_path)\n output_path\n end",
"def remap(aliases)\n new(relation, attributes.remap(aliases))\n end",
"def novel_dup_as_maker\n novel_dup('maker',:maker)\n end",
"def build( domain = nil )\n record_class = self.record_type.constantize\n\n # make a clean copy of ourself\n attrs = self.attributes.dup\n attrs.delete_if { |k,_| !record_class.columns.map(&:name).include?( k ) }\n attrs.delete('id')\n\n # parse each attribute for %ZONE%\n unless domain.nil?\n attrs.keys.each do |k|\n attrs[k] = attrs[k].gsub( '%ZONE%', domain.name ) if attrs[k].is_a?( String )\n end\n end\n\n record_class.new( attrs )\n end",
"def initialize(attrs={})\n self.update(attrs)\n @@identity_map[self.class] ||= {}\n @@identity_map[self.class][Marshal.dump(attrs)] = self\n end",
"def create_ai\n return Battle::AI.new(self)\n end",
"def replicant\n\n\t\tobj = self.class.new\n\t\tself.instance_values.each_pair do |k,v|\n\t\t\tv = v.dup rescue v\n\t\t\tobj.instance_variable_set(\"@#{k}\", v)\n\t\tend\n\n\t\tobj.datastore = self.datastore.copy\n\t\tobj.user_input = self.user_input\n\t\tobj.user_output = self.user_output\n\t\tobj.module_store = self.module_store.clone\n\t\tobj\n\tend",
"def initialize_dup(orig)\n %w(plurals singulars uncountables humans acronyms acronym_regex).each do |scope|\n instance_variable_set(\"@#{scope}\", orig.send(scope).dup)\n end\n end",
"def make_corpse\n if @@corpse_proto == nil\n @@corpse_proto = Tag.find_any_obj(\"do.not.change::corpse.prototype\")[0] # corpse prototype\n end\n # generate a new item based off of the corpse prototype.\n\n o = @@corpse_proto.instance # new corpse\n if ('A'..'Z') === short_desc[0]\n o.name = o.name % self.short_desc\n else\n o.name = o.name % self.short_desc.en.a\n end\n\n in_room.accept(o) # put the object in the same room.\n end",
"def initialize_dup(orig) # :nodoc:\n %w(plurals singulars uncountables humans acronyms acronym_regex).each do |scope|\n instance_variable_set(\"@#{scope}\", orig.send(scope).dup)\n end\n end",
"def model(as: :strava_athlete, via: :access_token, id: nil)\n Module.new.tap do |mod|\n str = <<~EOF\n def self.included(base)\n base.send(:define_method, :#{as}) { ::Strava::Athlete.new(#{id ? \"{'id' => #{id}}\" : '{}' }, token: #{via}, current: true) }\n end\n EOF\n mod.class_eval str\n end\n end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def incorporate\r\n Builder.new(self)\r\n end",
"def really_new\n return self.new\n end",
"def to_s\n values = @params.map{|k, v| \"#{k}: #{v}\"}.join(\" \")\n \"<Twilio.Video.V1.AnonymizeInstance #{values}>\"\n end",
"def new\n BaseObject.new(self)\n end",
"def instantiate(params)\n instance = Instance.new( *interpolate(params), @parent )\n # instance.apply_resource_type # TODO: do we need apply_security_scheme?\n instance\n end",
"def create\n name_to_const.new\n end",
"def create_instance(opts)\n opts = check_params(opts,[:class_instance_keys])\n super(opts)\n end",
"def build_singleton0(type_name); end",
"def build_new(*args)\n self.class.new(*args)\n end",
"def build(attributes = {})\n attrs = self.schema\n self.new(attrs)\n end",
"def compile\n @instance ||= new\n end",
"def inspect\n values = @properties.map{|k, v| \"#{k}: #{v}\"}.join(\" \")\n \"<Twilio.Video.V1.AnonymizeInstance #{values}>\"\n end",
"def new()\n trace(\"Instance #{index} created\")\n index += 1\n end",
"def get_anon_user\n Anon.new\n end",
"def initialize(species, weight, nickname, zoo)\n @species = species\n @weight = weight\n @nickname = nickname\n @zoo = zoo\n @@all << self\n\n #everytime a new animal object is created, its shoveled into the Animal class\n\nend",
"def build(extra_parameters = {})\n klass.new(params_without_modifiers(extra_parameters))\n end",
"def create(attrs)\n new(decorated_class.create(decorated_attributes(attrs)))\n end",
"def generate_identity\n handle_name ||= username if respond_to?(:username)\n handle_name ||= short_name if respond_to?(:short_name)\n handle_name ||= name.parameterize(\"_\").gsub(\"-\",\"_\") if respond_to?(:name)\n\n self.handle = Handle.build_unique(self, handle_name)\n self.handle.identifiable = self\n\n self[identity_field] = handle.name\n instance_variable_set(:\"@#{identity_field}\", handle.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 new\n @witness = Witness.new\n end",
"def build_class\n return klass if klass\n\n included_attrs = attributes.reject do |_name, opts|\n opts && opts[:exclude]\n end\n builder&.call(included_attrs.map(&:first))\n end",
"def new\n @access = Access.new\n end",
"def create_class(name) \n AsmProxyClass.new(name)\n end",
"def for_instance(instance)\n self.clone.tap{|q| q.instance = instance }\n end",
"def build(attrs = {})\n attrs[:type] ? attrs[:type].constantize.new(attrs) : new(attrs)\n end",
"def build (name, attrs = {})\n factory_by_name(name).build(attrs)\n end",
"def build (name, attrs = {})\n factory_by_name(name).build(attrs)\n end",
"def create\n return super unless mti_class?\n shard_wrangler.cascade_save\n ActiveRecord::IdentityMap.add(self) if ActiveRecord::IdentityMap.enabled?\n @new_record = false\n self.id\n end",
"def make_public!\n reinitialize_rules!\n allow_if do\n true\n end\n return self\n end",
"def to_instance\n @attributes = [:__placeholder__] if @attributes.empty?\n\n instance = Ward::Spec::Struct.new(*@attributes).new(\n *@attributes.map { |attribute| @values[attribute] })\n\n unless @behaviours.empty?\n metaclass = (class << instance; self; end)\n @behaviours.each { |behaviour| metaclass.class_eval(behaviour) }\n end\n\n instance\n end",
"def construct\n end",
"def build_identity(attributes = {}, options = {})\n @provider_identity.build_record(attributes, options)\n end",
"def new\n BikeObject.new(self, 'Object', @type, @name)\n end",
"def new\n CanadianObject.new(self)\n end",
"def dup\n self.class.new.tap{|obj| obj.initialize_copi self }\n end",
"def new(attrs = {})\n instance = super()\n instance.load_attributes!\n instance.update(attrs)\n instance\n end",
"def initialize(name)\n self.name = name.to_s\n self.attributes = []\n self.single_associations = []\n self.array_associations = []\n self.hash_associations = []\n CLASSES << self\n end",
"def new\n @avoir = Avoir.new\n end",
"def new\n @new_clone = Organism.new\n end",
"def builder opts = { }\n opts[:_mapping_set] = self\n Mapping::Builder.new(opts)\n end",
"def dup\n duplicate = Intelligence::Ec::Individual.new({\n algorithm: @algorithm,\n dimensions: @dimensions\n })\n duplicate.chromosome = @chromosome.dup\n duplicate.fitness = @fitness\n duplicate\n end",
"def new_interlink(sax, author_id)\n Interlink.new.tap do |interlink|\n interlink.author_id = author_id\n interlink.synset_id = sax.synset_id\n interlink.pwn = sax.pwn\n end\nend",
"def build_version(new_attrs = {})\n new_version = self.class.new(new_version_attrs(new_attrs)).tap do |built|\n built.deprecate_old_versions_after_create!\n preserve_has_one_associations_to(built) \n end\n end",
"def new(*args) dup.initialize(*args) end",
"def make(thing) end",
"def rollbar_anonymized_person_method\n anonymized_identifier = LogAnonymizer.new.educator_identifier(request)\n AnonymizedPersonForRollbar.new(anonymized_identifier)\n end",
"def dup\n DocumentMapper::Base.new(self)\n end",
"def mentorize\n @mentorize ||= proc { |attrs| Mentor::Application.new(attrs) }\n end",
"def initialize\n @aliases = aliases\n @@all << self\n end",
"def create_alias(real_name)\n\n vowels = [\"a\", \"e\", \"i\", \"o\", \"u\"]\n consonants = [\"b\", \"c\", \"d\", \"f\", \"g\", \"h\", \"j\",\n \"k\", \"l\", \"m\", \"n\", \"p\", \"q\", \"r\", \"s\", \"t\",\n \"v\", \"w\", \"x\", \"y\", \"z\"]\n\n # takes the real name, splits into words, reverses the order, joins into string again, and lowercases\n reversed_lowcase_str = real_name.split(\" \").reverse.join(\" \").downcase\n name_char_array = reversed_lowcase_str.chars\n fake_name_char_arr = name_char_array.map! do |letter|\n if letter == \" \"\n letter\n elsif letter == \"u\"\n letter = \"a\"\n elsif letter == \"z\"\n letter = \"b\"\n elsif vowels.include?(letter)\n letter = vowels[vowels.index(letter) + 1] # assigns the letter to be the next vowel\n elsif consonants.include?(letter)\n letter = consonants[consonants.index(letter) + 1]\n end\n end\n\n# rejoins the character array into one string, splits it into word array,\n# capitalizes each word, rejoins into string\n fake_name = fake_name_char_arr.join(\"\").split(\" \").map!{|name| name.capitalize}.join(\" \")\nend",
"def initialize(maker, sirens)\n super(maker)\n @sirens = sirens\n end",
"def identity\n return self\n end",
"def with_autoid(autoid)\n clone(:autoid=>autoid)\n end",
"def build_arel(*)\n arel = super\n arel.only if self.itself_only_value === true\n build_inheritances(arel)\n arel\n end",
"def as(aliased_name)\n @aliased_name = aliased_name\n\n self\n end",
"def new\n @midia = Midia.new\n end",
"def new\n @anime = Anime.new\n end",
"def dup\n a = self.class.new\n a.args = args.map { |arg| arg.dup }\n a.proc = self.proc.dup\n a.id = Utils.random_str\n a\n end",
"def new(*args, &block)\n\t\tif $Auto_wrapper then\n\t\treturn $Auto_wrapper.wrap(auto_wrapper_old_new(*args, &block))\n\t\telse\n\t\treturn auto_wrapper_old_new(*args, &block)\n\t\tend\n\tend"
] | [
"0.58793515",
"0.58409786",
"0.56092286",
"0.5321486",
"0.5295065",
"0.52703553",
"0.52703553",
"0.5267412",
"0.5260969",
"0.52586925",
"0.52577084",
"0.51828414",
"0.5177507",
"0.51624614",
"0.5162172",
"0.5156192",
"0.5141632",
"0.51175404",
"0.50931525",
"0.5058805",
"0.505148",
"0.5044386",
"0.50397",
"0.503786",
"0.50246364",
"0.5000832",
"0.49887076",
"0.49734098",
"0.49727252",
"0.49727252",
"0.49727252",
"0.49727252",
"0.49727252",
"0.49727252",
"0.49727252",
"0.49727252",
"0.49727252",
"0.4956995",
"0.4940795",
"0.492338",
"0.49167544",
"0.49163097",
"0.4903447",
"0.48986477",
"0.48802495",
"0.4877861",
"0.48772585",
"0.4871245",
"0.48693028",
"0.4868037",
"0.48645142",
"0.48606005",
"0.4859838",
"0.4855007",
"0.4840798",
"0.48375633",
"0.48375633",
"0.48375633",
"0.48375633",
"0.48375633",
"0.48312375",
"0.48303777",
"0.48244822",
"0.4819297",
"0.4818893",
"0.48170272",
"0.4805164",
"0.4805164",
"0.4802664",
"0.47987184",
"0.4795703",
"0.479",
"0.47872347",
"0.47867018",
"0.47852883",
"0.47799835",
"0.47781596",
"0.47649896",
"0.47633466",
"0.47563443",
"0.47551653",
"0.47532",
"0.47510177",
"0.4746984",
"0.4738197",
"0.47370583",
"0.47274238",
"0.47210112",
"0.47205067",
"0.47162315",
"0.4710442",
"0.4709362",
"0.47079423",
"0.47048426",
"0.47048286",
"0.4696818",
"0.46897045",
"0.46887928",
"0.46855345",
"0.46823812"
] | 0.60092294 | 0 |
Provide a user friendly representation | def to_s
'<Twilio.Video.V1.AnonymizePage>'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_display\n raise NotImplementedError\n end",
"def to_s; description end",
"def toString\n #Not sure if we want this or just use the getters for more\n #selective formatting\n end",
"def to_s\n super\n end",
"def to_s\n super\n end",
"def to_s\n \"#{@name}, \" \\\n \"#{model.upcase}: \" \\\n \"#{data.values.join(\"/\")}, \" \\\n \":#{@type}\"\n end",
"def to_s\n\t\tsuper\n\tend",
"def to_s\r\n \"<#{self.class.name} id: #{self[:id]}, description: #{self[:description]}, definition: #{self[:definition]}, has_inverse: #{self[:has_inverse]} accuracy: #{self[:accuracy]}\"\r\n end",
"def render\n inspect\n end",
"def to_s\n pieces = []\n pieces << self.class.name\n pieces << \"id:##{id.inspect}\"\n pieces << \"standardized:\" + (is_standard? ? 'standard' : (standard_id.nil? ? 'no' : \"copy-of-#{standard_id}\"))\n pieces << \"mission:#{mission_id.inspect}\"\n pieces.join(', ')\n end",
"def format; end",
"def format; end",
"def format; end",
"def format; end",
"def format; end",
"def format; end",
"def format; end",
"def format; end",
"def rendered_format; end",
"def rendered_format; end",
"def to_s\n render\n end",
"def to_s\n return super\n end",
"def display_string\n display = [self.name]\n display << self.description if self.description && self.type == 'StorageType'\n display << self.software if self.software && self.type == 'DatabaseType'\n cpu = self.cpu_values_string\n display << \"CPU: #{cpu}\" unless cpu.blank? || self.type == 'StorageType'\n display << \"RAM: #{self.memory} GB\" if self.memory && self.type != 'StorageType'\n hdd = self.hdd_values_string\n display << \"HDD: #{hdd}\" unless hdd.blank?\n display << self.operating_system if self.operating_system && self.type != 'StorageType'\n display.join(', ')\n end",
"def to_s\n 'Id: ' + @id.to_s +\n ', Expires on: ' + display_expiry_date +\n ', Level: ' + map_number_to_word_level(@level) +\n ', Number of days left to expire: ' + display_num_of_days_left +\n ', Description: ' + @description % self\n end",
"def humanize\n # TODO\n # Inflector.humanize(self)\n end",
"def to_s\n\t\tdescription\n\tend",
"def to_s\n\t\tdescription\n\tend",
"def to_s\n %(<#{ @name }#{attributes}>)\n end",
"def to_s\n %w( name display_name uuid ).collect { |k| \"#{k}=#{ self.send(k) }\" }.join(' | ') + \" | types=#{ types.join(',') }\"\n end",
"def to_s\n long_display\n end",
"def to_s\n long_display\n end",
"def to_s\n long_display\n end",
"def to_s\n long_display\n end",
"def to_s\n self.name.to_s || super\n end",
"def to_s\n descr\n end",
"def to_s\n self.name.humanize\n end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s ; format ; end",
"def formatted_name\n \"#{self.id} - #{self.name}\"\n #This is used to bring value on each page.\n end",
"def to_s\n\t\t\"#{self.name}\"\n\tend",
"def to_s\n \n end",
"def to_s\n self.name || super\n end",
"def to_s\n self.name || super\n end",
"def to_s\n return \"#{@name} - #{@description} : #{@rating}\"\n end",
"def inspect; to_s; end",
"def inspect; to_s; end",
"def inspect; to_s; end",
"def inspect; to_s; end",
"def inspect; to_s; end",
"def to_s\n raise NotImplementedError\n end",
"def short_inspect\n attrs = []\n attrs << [\"id\", id || \"new_record\"]\n\n string_attr = proc { |value| '\"' + TextHelpers.truncate(value, :length => 10) + '\"' }\n\n if respond_to?(:name) && name.present?\n attrs << [\"name\", string_attr[name]]\n elsif respond_to?(:title) && title.present?\n attrs << [\"title\", string_attr[title]]\n end\n\n \"#<#{ self.class } #{ attrs.map { |name, value| \"#{ name }: #{ value }\" }.join(\", \") }>\"\n end"
] | [
"0.70430577",
"0.7025487",
"0.7008232",
"0.7007793",
"0.69441473",
"0.6917163",
"0.68431",
"0.6797009",
"0.6655106",
"0.66227216",
"0.6618043",
"0.6618043",
"0.6618043",
"0.6618043",
"0.6618043",
"0.6618043",
"0.6618043",
"0.6618043",
"0.660979",
"0.660979",
"0.6585346",
"0.65730983",
"0.65662885",
"0.65404147",
"0.65379703",
"0.651875",
"0.651875",
"0.6516385",
"0.6501134",
"0.65010244",
"0.65010244",
"0.65010244",
"0.65010244",
"0.64861107",
"0.6478101",
"0.64581114",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6442197",
"0.64329034",
"0.64289695",
"0.64203346",
"0.6419349",
"0.6419349",
"0.6418417",
"0.64115626",
"0.64115626",
"0.64115626",
"0.64115626",
"0.64115626",
"0.64071685",
"0.63947713"
] | 0.0 | -1 |
Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context | def context
unless @instance_context
@instance_context = AnonymizeContext.new(@version , @params['room_sid'], @params['sid'])
end
@instance_context
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def context\n unless @instance_context\n @instance_context = ApplicationContext.new(@version , @params['account_sid'], @params['sid'])\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = SimContext.new(@version , @params['sid'])\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = InteractionContext.new(@version , @params['sid'])\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = TriggerContext.new(@version, @params['account_sid'], @params['sid'],)\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = ServiceContext.new(@version , @params['sid'])\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = ServiceContext.new(@version , @params['sid'])\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = CallContext.new(@version , @params['account_sid'], @params['sid'])\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = CpsContext.new(@version, )\n end\n @instance_context\n end",
"def proxy_context\n @context\n end",
"def context\n unless @instance_context\n @instance_context = CallContext.new(@version , @params['sid'])\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = CallContext.new(@version, @params['account_sid'], @params['sid'],)\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = CurrentCallContext.new(@version, )\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = DomainContext.new(@version , @params['account_sid'], @params['sid'])\n end\n @instance_context\n end",
"def contextify\n self.class.monadic_context.new self\n end",
"def context\n unless @instance_context\n @instance_context = SandboxContext.new(\n @version,\n @params['account_sid'],\n )\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = TrunkContext.new(@version , @params['sip_trunk_domain'])\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = CompositionHookContext.new(@version, @params['sid'], )\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = ConfigurationContext.new(@version )\n end\n @instance_context\n end",
"def context\n init\n @context\n end",
"def context\n unless @instance_context\n @instance_context = InteractionChannelContext.new(\n @version,\n @params['interaction_sid'],\n @params['sid'],\n )\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = UserInfoContext.new(@version )\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = EngagementContextContext.new(@version , @params['flow_sid'], @params['engagement_sid'])\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = CampaignContext.new(@version, @params['sid'], )\n end\n @instance_context\n end",
"def initialize(*args, &block)\n super(*args)\n instance_exec(_context, &block)\n end",
"def context\n unless @instance_context\n @instance_context = EsimProfileContext.new(@version , @params['sid'])\n end\n @instance_context\n end",
"def execution_context\n initialize_context!(Object.new)\n end",
"def context\n unless @instance_context\n @instance_context = BulkEligibilityContext.new(@version , @params['request_id'])\n end\n @instance_context\n end",
"def setup_context\n context_methods.each do |m|\n @context.add_method m, self\n end\n\n @context.define_klass\n end",
"def context\n unless @instance_context\n @instance_context = RecordingContext.new(@version , @params['trunk_sid'])\n end\n @instance_context\n end",
"def context\n Context.instance\n end",
"def context\n unless @instance_context\n @instance_context = ReservationContext.new(@version , @params['workspace_sid'], @params['worker_sid'], @params['sid'])\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = CountryContext.new(@version , @params['iso_code'])\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = CompositionContext.new(@version, @params['sid'], )\n end\n @instance_context\n end",
"def context_methods\n super + [:context]\n end",
"def context\n unless @instance_context\n @instance_context = TaskContext.new(@version , @params['workspace_sid'], @params['sid'])\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = TranscriptContext.new(@version , @params['sid'])\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = AppManifestContext.new(@version , @params['app_sid'])\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = ChannelContext.new(@version , @params['service_sid'], @params['sid'])\n end\n @instance_context\n end",
"def context\n @context ||= Context.new(self)\n end",
"def context\n unless @instance_context\n @instance_context = TaskContext.new(@version, @params['workspace_sid'], @params['sid'], )\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = CallSummaryContext.new(@version , @params['call_sid'])\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = NumberContext.new(@version, @params['destination_number'], )\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = SummaryContext.new(\n @version,\n @params['call_sid'],\n )\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = RatePlanContext.new(@version, @params['sid'], )\n end\n @instance_context\n end",
"def context\n @context ||= new_context_mock(context_options, &finalize_proc)\n end",
"def context\n unless @instance_context\n @instance_context = OauthContext.new(@version )\n end\n @instance_context\n end",
"def context\n @context ||= Context.new(self)\n end",
"def context\n unless @instance_context\n @instance_context = DeactivationsContext.new(@version )\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = SipDomainContext.new(@version , @params['sip_domain'])\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = PhoneNumberContext.new(@version , @params['phone_number'])\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = PhoneNumberContext.new(@version , @params['phone_number'])\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = MediaProcessorContext.new(@version , @params['sid'])\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = ChannelContext.new(@version , @params['sid'])\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = IntentStatisticsContext.new(\n @version,\n @params['assistant_sid'],\n @params['intent_sid'],\n )\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = DomainConfigContext.new(@version, @params['domain_sid'], )\n end\n @instance_context\n end",
"def context_methods; end",
"def call(*args)\n @ctx.instance_exec(args, &action)\n end",
"def context\n unless @instance_context\n @instance_context = ConfigurationContext.new(@version , @params['chat_service_sid'])\n end\n @instance_context\n end",
"def initialize\n self.context = Context.new\n end",
"def context\n unless @instance_context\n @instance_context = InteractionChannelParticipantContext.new(@version , @params['interaction_sid'], @params['channel_sid'], @params['sid'])\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = WorkflowRealTimeStatisticsContext.new(@version , @params['workspace_sid'], @params['workflow_sid'])\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = LinkshorteningMessagingServiceDomainAssociationContext.new(@version , @params['messaging_service_sid'])\n end\n @instance_context\n end",
"def context(klass, options={}, &blk)\n assoc = options.delete(:as) || self.name.demodulize.underscore\n assoc = assoc.to_sym\n\n nk = options[:name_key] ||= get_name_key\n\n self.hook_instance(\"change_#{nk}\") do |inst, old, new|\n inst.context.indices[assoc].update_membership(inst)\n end\n\n klass.index(assoc, options) do |name, target|\n inst = new(target, name)\n yield(inst, target) if block_given?\n inst\n end\n end",
"def context\n unless @instance_context\n @instance_context = ExportAssistantContext.new(@version, @params['assistant_sid'], )\n end\n @instance_context\n end",
"def method_missing(method_name, *args, &blk)\n @context.__send__(method_name, *args, &blk)\n end",
"def context\n unless @instance_context\n @instance_context = DialogueContext.new(@version , @params['assistant_sid'], @params['sid'])\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = RoomContext.new(@version , @params['sid'])\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = TaskStatisticsContext.new(@version , @params['assistant_sid'], @params['task_sid'])\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = WorkspaceContext.new(@version , @params['sid'])\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = WorkflowStatisticsContext.new(\n @version,\n @params['workspace_sid'],\n @params['workflow_sid'],\n )\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = WorkflowRealTimeStatisticsContext.new(\n @version,\n @params['workspace_sid'],\n @params['workflow_sid'],\n )\n end\n @instance_context\n end",
"def method_missing(method, *args, &block)\n context.send(method, *args, &block)\n end",
"def method_missing(method, *args, &block)\n context.send(method, *args, &block)\n end",
"def initialize(context)\n super()\n self.context = context\n end",
"def context\n unless @instance_context\n @instance_context = DomainCertsContext.new(@version , @params['domain_sid'])\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = SettingsContext.new(@version, )\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = DomainCertsContext.new(@version, @params['domain_sid'], )\n end\n @instance_context\n end",
"def context\n @context ||= {}\n end",
"def context\n @context ||= {}\n end",
"def context\n unless @instance_context\n @instance_context = SecondaryAuthTokenContext.new(@version )\n end\n @instance_context\n end",
"def context\n return @target if @target.is_a?(Module) && !@options[:class_methods]\n\n @target.singleton_class\n end",
"def _prepare_context; end",
"def context\n unless @instance_context\n @instance_context = InsightsQuestionnairesContext.new(@version , @params['questionnaire_sid'])\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = NotificationContext.new(@version, @params['chat_service_sid'], )\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = FeedbackSummaryContext.new(@version , @params['account_sid'], @params['sid'])\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = FeedbackSummaryContext.new(@version, @params['account_sid'], @params['sid'],)\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = ParticipantContext.new(@version , @params['account_sid'], @params['conference_sid'], @params['call_sid'])\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = UserDefinedMessageSubscriptionContext.new(@version , @params['account_sid'], @params['call_sid'], @params['sid'])\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = NotificationContext.new(@version , @params['chat_service_sid'])\n end\n @instance_context\n 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"
] | [
"0.68377435",
"0.68029237",
"0.6796913",
"0.6771432",
"0.676858",
"0.676858",
"0.67318654",
"0.668226",
"0.66789144",
"0.6678431",
"0.667694",
"0.66405225",
"0.66096514",
"0.659968",
"0.6591387",
"0.6571754",
"0.6567936",
"0.65607464",
"0.65562326",
"0.65496546",
"0.65470076",
"0.65042835",
"0.6495342",
"0.6490264",
"0.6463875",
"0.64478505",
"0.64096844",
"0.64044285",
"0.63672453",
"0.63503826",
"0.6331808",
"0.6319723",
"0.6312908",
"0.6299112",
"0.62753695",
"0.6268465",
"0.62591887",
"0.6258246",
"0.6257571",
"0.6235056",
"0.62163574",
"0.6214905",
"0.62123173",
"0.61961186",
"0.6193354",
"0.6191514",
"0.61865294",
"0.61691326",
"0.6166836",
"0.6160137",
"0.6160046",
"0.61581975",
"0.61463344",
"0.61385393",
"0.61323404",
"0.61273205",
"0.61263067",
"0.6122422",
"0.6111485",
"0.6082777",
"0.6077888",
"0.60541815",
"0.604008",
"0.60391533",
"0.6033463",
"0.6016833",
"0.60113704",
"0.6011306",
"0.6010885",
"0.60103625",
"0.5978432",
"0.59756374",
"0.59756374",
"0.596566",
"0.5952928",
"0.5947777",
"0.59398293",
"0.59306836",
"0.59306836",
"0.5900241",
"0.5899784",
"0.5890108",
"0.5882716",
"0.58800215",
"0.5867612",
"0.5849314",
"0.5830538",
"0.58265394",
"0.58196986",
"0.58169484",
"0.58169484",
"0.58169484",
"0.58169484",
"0.58169484",
"0.58169484",
"0.58169484",
"0.58169484",
"0.58169484",
"0.58169484",
"0.58169484"
] | 0.6627461 | 12 |
Provide a user friendly representation | def to_s
values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
"<Twilio.Video.V1.AnonymizeInstance #{values}>"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_display\n raise NotImplementedError\n end",
"def to_s; description end",
"def toString\n #Not sure if we want this or just use the getters for more\n #selective formatting\n end",
"def to_s\n super\n end",
"def to_s\n super\n end",
"def to_s\n \"#{@name}, \" \\\n \"#{model.upcase}: \" \\\n \"#{data.values.join(\"/\")}, \" \\\n \":#{@type}\"\n end",
"def to_s\n\t\tsuper\n\tend",
"def to_s\r\n \"<#{self.class.name} id: #{self[:id]}, description: #{self[:description]}, definition: #{self[:definition]}, has_inverse: #{self[:has_inverse]} accuracy: #{self[:accuracy]}\"\r\n end",
"def render\n inspect\n end",
"def to_s\n pieces = []\n pieces << self.class.name\n pieces << \"id:##{id.inspect}\"\n pieces << \"standardized:\" + (is_standard? ? 'standard' : (standard_id.nil? ? 'no' : \"copy-of-#{standard_id}\"))\n pieces << \"mission:#{mission_id.inspect}\"\n pieces.join(', ')\n end",
"def format; end",
"def format; end",
"def format; end",
"def format; end",
"def format; end",
"def format; end",
"def format; end",
"def format; end",
"def rendered_format; end",
"def rendered_format; end",
"def to_s\n render\n end",
"def to_s\n return super\n end",
"def display_string\n display = [self.name]\n display << self.description if self.description && self.type == 'StorageType'\n display << self.software if self.software && self.type == 'DatabaseType'\n cpu = self.cpu_values_string\n display << \"CPU: #{cpu}\" unless cpu.blank? || self.type == 'StorageType'\n display << \"RAM: #{self.memory} GB\" if self.memory && self.type != 'StorageType'\n hdd = self.hdd_values_string\n display << \"HDD: #{hdd}\" unless hdd.blank?\n display << self.operating_system if self.operating_system && self.type != 'StorageType'\n display.join(', ')\n end",
"def to_s\n 'Id: ' + @id.to_s +\n ', Expires on: ' + display_expiry_date +\n ', Level: ' + map_number_to_word_level(@level) +\n ', Number of days left to expire: ' + display_num_of_days_left +\n ', Description: ' + @description % self\n end",
"def humanize\n # TODO\n # Inflector.humanize(self)\n end",
"def to_s\n\t\tdescription\n\tend",
"def to_s\n\t\tdescription\n\tend",
"def to_s\n %(<#{ @name }#{attributes}>)\n end",
"def to_s\n %w( name display_name uuid ).collect { |k| \"#{k}=#{ self.send(k) }\" }.join(' | ') + \" | types=#{ types.join(',') }\"\n end",
"def to_s\n long_display\n end",
"def to_s\n long_display\n end",
"def to_s\n long_display\n end",
"def to_s\n long_display\n end",
"def to_s\n self.name.to_s || super\n end",
"def to_s\n descr\n end",
"def to_s\n self.name.humanize\n end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s ; format ; end",
"def formatted_name\n \"#{self.id} - #{self.name}\"\n #This is used to bring value on each page.\n end",
"def to_s\n\t\t\"#{self.name}\"\n\tend",
"def to_s\n \n end",
"def to_s\n self.name || super\n end",
"def to_s\n self.name || super\n end",
"def to_s\n return \"#{@name} - #{@description} : #{@rating}\"\n end",
"def inspect; to_s; end",
"def inspect; to_s; end",
"def inspect; to_s; end",
"def inspect; to_s; end",
"def inspect; to_s; end",
"def to_s\n raise NotImplementedError\n end",
"def short_inspect\n attrs = []\n attrs << [\"id\", id || \"new_record\"]\n\n string_attr = proc { |value| '\"' + TextHelpers.truncate(value, :length => 10) + '\"' }\n\n if respond_to?(:name) && name.present?\n attrs << [\"name\", string_attr[name]]\n elsif respond_to?(:title) && title.present?\n attrs << [\"title\", string_attr[title]]\n end\n\n \"#<#{ self.class } #{ attrs.map { |name, value| \"#{ name }: #{ value }\" }.join(\", \") }>\"\n end"
] | [
"0.70430577",
"0.7025487",
"0.7008232",
"0.7007793",
"0.69441473",
"0.6917163",
"0.68431",
"0.6797009",
"0.6655106",
"0.66227216",
"0.6618043",
"0.6618043",
"0.6618043",
"0.6618043",
"0.6618043",
"0.6618043",
"0.6618043",
"0.6618043",
"0.660979",
"0.660979",
"0.6585346",
"0.65730983",
"0.65662885",
"0.65404147",
"0.65379703",
"0.651875",
"0.651875",
"0.6516385",
"0.6501134",
"0.65010244",
"0.65010244",
"0.65010244",
"0.65010244",
"0.64861107",
"0.6478101",
"0.64581114",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6442197",
"0.64329034",
"0.64289695",
"0.64203346",
"0.6419349",
"0.6419349",
"0.6418417",
"0.64115626",
"0.64115626",
"0.64115626",
"0.64115626",
"0.64115626",
"0.64071685",
"0.63947713"
] | 0.0 | -1 |
Provide a detailed, user friendly representation | def inspect
values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
"<Twilio.Video.V1.AnonymizeInstance #{values}>"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def details; end",
"def to_s; description end",
"def get_detail\n return self.inspect\n end",
"def to_display\n raise NotImplementedError\n end",
"def formatted_info\n \"#{self.name} - #{self.description}\"\n end",
"def toString\n #Not sure if we want this or just use the getters for more\n #selective formatting\n end",
"def inspect\n 'Id: ' + @id.to_s +\n ', Expires on: ' + display_expiry_date +\n ', Level: ' + map_number_to_word_level(@level) +\n ', Number of days left to expire: ' + display_num_of_days_left +\n ', Description: ' + @description % self\n end",
"def short_inspect\n attrs = []\n attrs << [\"id\", id || \"new_record\"]\n\n string_attr = proc { |value| '\"' + TextHelpers.truncate(value, :length => 10) + '\"' }\n\n if respond_to?(:name) && name.present?\n attrs << [\"name\", string_attr[name]]\n elsif respond_to?(:title) && title.present?\n attrs << [\"title\", string_attr[title]]\n end\n\n \"#<#{ self.class } #{ attrs.map { |name, value| \"#{ name }: #{ value }\" }.join(\", \") }>\"\n end",
"def render\n inspect\n end",
"def overview\n\n end",
"def record_display\n string = \"#{id}. Title: #{title}\\n Author: #{author}\\n ISBN: #{isbn}\\n\"\n if library.nil?\n string += \" Library: None\\n\"\n else\n string += \" Library: #{library.branch_name}\\n\"\n end\n if patron.nil?\n string += \" Checked Out: Available\"\n else\n string += \" Checked Out: #{patron.name}\"\n end\n string\n end",
"def render_plain\n short_category(object.action) << \"\\n\" << instance_attributes\n end",
"def details\n\n return @description + \": \" + \"#{@infection}\" + \". \" + @patient.details\n\n end",
"def to_s\n 'Id: ' + @id.to_s +\n ', Expires on: ' + display_expiry_date +\n ', Level: ' + map_number_to_word_level(@level) +\n ', Number of days left to expire: ' + display_num_of_days_left +\n ', Description: ' + @description % self\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 display_string\n display = [self.name]\n display << self.description if self.description && self.type == 'StorageType'\n display << self.software if self.software && self.type == 'DatabaseType'\n cpu = self.cpu_values_string\n display << \"CPU: #{cpu}\" unless cpu.blank? || self.type == 'StorageType'\n display << \"RAM: #{self.memory} GB\" if self.memory && self.type != 'StorageType'\n hdd = self.hdd_values_string\n display << \"HDD: #{hdd}\" unless hdd.blank?\n display << self.operating_system if self.operating_system && self.type != 'StorageType'\n display.join(', ')\n end",
"def to_s\r\n \"<#{self.class.name} id: #{self[:id]}, description: #{self[:description]}, definition: #{self[:definition]}, has_inverse: #{self[:has_inverse]} accuracy: #{self[:accuracy]}\"\r\n end",
"def full_description\n \"#{self.class.description} #{self.description}\"\n end",
"def to_s\n descr\n end",
"def details\r\n return @description + \"; \" + @vPatients + \"; \" + @vProfiles + \": \" + @vAppointments\r\n end",
"def display\n to_h.fetch(:display)\n end",
"def display\n to_h.fetch(:display)\n end",
"def inspect_details\n\t\treturn \"ID=%s (%s)\" % [\n\t\t\tself.id,\n\t\t\tself.components.keys.map( &:name ).sort.join( '+' )\n\t\t]\n\tend",
"def to_s\n\t\tres = \"\\nname: \" + name.to_s + \"\\nid: \" + id.to_s + \"\\nservice: \" + service.to_s + \"\\ntitle: \" + title.to_s + \"\\nthumbnail: \" + thumbnail.to_s + \"\\nhref: \" + href.to_s\n\t\tres\n\tend",
"def details\n\t\t\"#{name}---#{status}-----#{start_date}----#{description}---- #{Client.find(client_id).name}---#{Client.find(client_id).email}\"\n\tend",
"def show\n @title = @user.complete_name\n @description = \"Informations relatives à #{@user.complete_name}\"\n @jsonld = @user.to_jsonld\n end",
"def details\n end",
"def to_s\n \"#{represent_status} : #{description}\"\n end",
"def details\n format_description(@description) + \"site name: \" + format_name\n end",
"def to_s\n\t\tdescription\n\tend",
"def to_s\n\t\tdescription\n\tend",
"def to_s_details\n ''\n end",
"def details\n\n end",
"def descriptions\n return @detail + \"; \" + @firm + \"; \" + @age + \": \" + \"#{@cost}\"\n end",
"def show\n\t\t@attrib_keys = [\"desc\", \"higher_level\", \"range\", \"components\", \"material\", \"ritual\", \"duration\", \"concentration\", \"casting_time\", \"level\", \"school\", \"class_names\", \"archetype\", \"domains\", \"oaths\", \"circles\", \"patrons\"]\n\tend",
"def to_s\n \"#{@name}, \" \\\n \"#{model.upcase}: \" \\\n \"#{data.values.join(\"/\")}, \" \\\n \":#{@type}\"\n end",
"def inspect_details\n ''\n end",
"def inspect\n \"#<#{self.class} ##{id} #{name} (#{slug})>\"\n end",
"def display_quick\r\n s = ''\r\n for i in @me.keys\r\n s << \" <b>#{i}.</b><br/>\" # country\r\n for j in @me[i].keys\r\n s << \" <b>#{j}:</b><br/>\" if not j == 'unknown' # state\r\n for k in @me[i][j].keys\r\n s << \" #{k}<br/>\" if not k == 'unknown' # county\r\n for l in @me[i][j][k].keys\r\n s << (\" \" + (l == 'unknown' ? \"<i>repository not given</i>\" : \" #{l}\") + \"<br/>\") if not l == nil # repository\r\n s << \" \" + @me[i][j][k][l].keys.collect{|m| \r\n (\"#{@me[i][j][k][l][m]} \" +\r\n case m # the count\r\n when 'female'\r\n \"♀\"\r\n when 'male'\r\n \"♂\"\r\n when 'gynadropmorph'\r\n \"[♀♂]\"\r\n else\r\n \"unknown sex\"\r\n end)}.join(\",\") \r\n s << \"<br/>\" \r\n end\r\n end\r\n end\r\n end\r\n s.html_safe\r\n end",
"def details\n return @description + \"; \" + @firm + \"; \" + @age + \": \" + \"#{@cost}\"\n end",
"def to_s\n super\n end",
"def to_s\n pieces = []\n pieces << self.class.name\n pieces << \"id:##{id.inspect}\"\n pieces << \"standardized:\" + (is_standard? ? 'standard' : (standard_id.nil? ? 'no' : \"copy-of-#{standard_id}\"))\n pieces << \"mission:#{mission_id.inspect}\"\n pieces.join(', ')\n end",
"def rendered_format; end",
"def rendered_format; end",
"def to_s\n\t\t\tstr = super() + \"\\n\"\n\t\t\tstr += \"\\tAppaleable? #{appaleable}\\n\" if appaleable\n\t\t\tstr += \"\\tDisapproved text: #{disapproved_text}\\n\" if disapproved_text\n\t\t\tstr += \"\\tLocation: #{location}\\n\" if location\n\t\t\tstr += \"\\tDisapproved text: #{disapproved_text}\\n\" if disapproved_text\n\t\t\tstr += \"\\tReason code: #{reason_code} (see: http://msdn.microsoft.com/en-US/library/bing-ads-editorialfailurereasoncodes.aspx)\\n\" if reason_code\n\n\t\tend",
"def display_data\n\t\t\t\"#{@model} #{@color} #{@horsepower} #{@year} #{@brand} #{@mpg}\"\n\t\tend",
"def to_s\n \"\\n\\tTitle: #{@title}\\n\n \\tAuthor: #{@author}\\n\n \\tUrl: #{@url}\\n\\n\"\n end",
"def inspect\n to_s.inspect\n end",
"def details\n data()\n end",
"def details\n\n return @description + \"; \" + @firstname + \"; \" + @lastname + \": \" + @dob + \": \"+ @address + \": \"+ @phone + \": \" + \"#{@infection}\"\n\n end",
"def inspect\n to_s\n end",
"def inspect\n to_s\n end",
"def show\n raise NotImplementedError\n end",
"def to_s\n long_display\n end",
"def to_s\n long_display\n end",
"def to_s\n long_display\n end",
"def to_s\n long_display\n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def inspect\n\t\tparts = []\n\t\tparts << self.one_of_description\n\t\tparts << self.all_of_description\n\t\tparts << self.none_of_description\n\t\tparts.compact!\n\n\t\tstr = \"#<%p:%#0x matching entities\" % [ self.class, self.object_id * 2 ]\n\t\tif parts.empty?\n\t\t\tstr << \" with any components\"\n\t\telse\n\t\t\tstr << parts.join( ', ' )\n\t\tend\n\t\tstr << \">\"\n\n\t\treturn str\n\tend",
"def inspect\n to_s\n end",
"def description\n return summary\n end",
"def details\n return @description + \"; \" + @doctorname + \"; \" + @medicine + \": \" + \"#{@cost}\"\n end",
"def details\n return \"ID = #{@id}\\n\" + \n \"Name = #{@name}\\n\" + \n \"Topic = #{@topic}\\n\" + \n \"Member Count = #{@member_count}\"\n end",
"def description\n name + ': ' + resource_type.to_s + ' | Sueldo: ' + salary.to_s +\n ' | Experiencia: ' + experience.to_s + ' años'\n end",
"def show\n\t\traise NotImplementedError, \"FIXME: Implement showing comments.\"\n\tend",
"def to_s\n return \"#{@name} - #{@description} : #{@rating}\"\n end",
"def inspect\n \"#{self.class}<#{@description.inspect}>\"\n end",
"def description\n end",
"def description\n end",
"def details\n return \" #{@description}, #{@lastname}, #{@date}. #{@start}, #{@hours}, #{@players}, #{@zone}. #{@cost}\"\n end",
"def display\n\t\tname\n\tend",
"def display\n\t\tname\n\tend",
"def display\n\t\tname\n\tend",
"def display\n\t\tname\n\tend",
"def details\n return @description + \"; \" + @manufacturer + \"; \" + @color + \": \" + \"#{@cost}\"\n end",
"def to_s\n \"#{self.title} - #{self.author} - #{self.date}\"\n end",
"def details\r\n return @description + \": \" + \". \" + @basic_profile.details\r\n end",
"def show\n #not needed for our implementation\n end",
"def to_s\n super\n end",
"def modeler_description\n return 'Gather orientation and story specific construction, fenestration (including overhang) specific information'\n end",
"def details_partial_for(o)\n \"#{o.class.name.underscore}s/details\"\n end",
"def display\n puts \"Personal Details\"\n puts \" Name : #{self.name}\"\n puts \" Date of Birth : #{self.dob}\"\n puts \" Marital Status : #{self.marital_status}\"\n puts \" Mobile Number : #{self.mobile_number}\"\n puts \" Email : #{self.email}\"\n end",
"def detail\n attributes.fetch(:detail)\n end",
"def detail\n attributes.fetch(:detail)\n end"
] | [
"0.68170065",
"0.68142146",
"0.6758589",
"0.6718451",
"0.66697186",
"0.6655344",
"0.6632312",
"0.66273594",
"0.6550127",
"0.65188134",
"0.6497969",
"0.6480078",
"0.6477721",
"0.6472211",
"0.64502096",
"0.64502096",
"0.64502096",
"0.64502096",
"0.64502096",
"0.64502096",
"0.64502096",
"0.64502096",
"0.64502096",
"0.64502096",
"0.64367676",
"0.6434794",
"0.63974625",
"0.6391661",
"0.6385164",
"0.63826483",
"0.63826483",
"0.63621265",
"0.63584715",
"0.6352767",
"0.6347243",
"0.6345342",
"0.63338625",
"0.6325844",
"0.6320725",
"0.6320725",
"0.6316434",
"0.6311974",
"0.6311425",
"0.63111603",
"0.6307294",
"0.63050634",
"0.6301272",
"0.62848294",
"0.627871",
"0.6277492",
"0.62770176",
"0.6274702",
"0.6274702",
"0.62604547",
"0.62543267",
"0.6251651",
"0.625114",
"0.62487584",
"0.62225854",
"0.6214293",
"0.6214293",
"0.6212906",
"0.62095803",
"0.62095803",
"0.62095803",
"0.62095803",
"0.6205272",
"0.6205272",
"0.6205272",
"0.6205272",
"0.6205272",
"0.6205272",
"0.6205272",
"0.6205272",
"0.6205272",
"0.6200787",
"0.6198166",
"0.61830676",
"0.6179759",
"0.617746",
"0.61753553",
"0.61619484",
"0.6157944",
"0.61527485",
"0.615132",
"0.615132",
"0.61505795",
"0.6144682",
"0.6144682",
"0.6144682",
"0.6144682",
"0.61351794",
"0.6133033",
"0.61300874",
"0.61294436",
"0.61242044",
"0.6121309",
"0.61148214",
"0.61109483",
"0.6108956",
"0.6108956"
] | 0.0 | -1 |
Takes the 2 users the potential buyer and the seller, and creates a conversation between them. The 'between' scope that is used below is set out in the Conversation model | def create
# If there is an existing conversation between the 2 parties, then the database is queried for the previous conversation and it is displayed.
if Conversation.between(params[:sender_id], params[:recipient_id]).present?
@conversation = Conversation.between(params[:sender_id], params[:recipient_id]).first
else
#if there is no conversation between the two parties, then the beloew line will create a new conversation
@conversation = Conversation.create!(conversation_params)
end
redirect_to conversation_messages_path(@conversation)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_or_create\n other_user = User.find(params[:user_id])\n @conversation = Conversation.exactly_between( current_user, other_user ).first || Conversation.create( users: [ current_user, other_user ] )\n\n respond_to do |format|\n if @conversation\n format.json { redirect_to conversation_messages_url(@conversation) }\n end\n end\n end",
"def new_conversation(receiver_uid)\n Conversation.create(u1_id: @uid, u2_id: receiver_uid)\n end",
"def create\n #binding.pry\n if @conversation = Conversation.between(current_profile.id, params[:receiver_id]).first\n #@conversation = Conversation.between(params[:sender_id],params[:receiver_id]).first\n else\n @conversation = Conversation.create!(sender_id: current_profile.id, receiver_id: params[:receiver_id])\n end\n\n Message.create!(body: params[:body], profile_id: current_profile.id, conversation_id: @conversation.id )\n redirect_to :back\n end",
"def find_conversation!\n if params[:receiver_id]\n @receiver = User.find_by(id: params[:receiver_id])\n @conversation = Conversation.between(current_user.id, @receiver.id)[0]\n if @conversation\n redirect_to conversation_personal_messages_path(@conversation)\n else\n @conversation = Conversation.create(params.permit(:author_id, :receiver_id))\n redirect_to conversation_personal_messages_path(@conversation)\n end\n else\n @conversation = Conversation.find_by(id: params[:conversation_id])\n # redirect_to(root_path) unless @conversation && @conversation.participates?(current_user)\n end\nend",
"def create \n unless @conversation \n @conversation = Conversation.create(params.permit(:author_id, :receiver_id))\n end\n redirect_to conversation_personal_messages_path(@conversation)\n end",
"def set_users\n post = Post.find(@contract.post_id)\n if post.post_type == \"offer\"\n @contract.seller_id = post.user_id\n # If the person who starts this contract is not the person offering the book, then he is the buyer; otherwise, the receiver is the buyer %>\n if @sender_id != post.user_id\n @contract.buyer_id = @sender_id\n else\n @contract.buyer_id = @receiver_id\n end\n\n elsif post.post_type == \"request\"\n @contract.buyer_id = post.user_id\n # If the current user is not the person requesting the book, then he is the seller; otherwise, the receiver is the seller %>\n if @sender_id != post.user_id\n @contract.seller_id = @sender_id\n else\n @contract.seller_id = @receiver_id\n end\n end\n @contract.unsigned_user_id = @receiver_id\n end",
"def set_conversations\n if current_user == @listing.seller\n @conversations = @listing.conversations\n else\n @conversations = @listing.conversations.between(@listing.seller, current_user)\n if @conversations.empty? \n @conversations = create_conversation\n end\n end\n end",
"def create\n # Get the topic\n topic = params[:topic]\n # Get the title\n title = params[:title]\n # Get the receiver\n receiver = User.find(params.permit(:receiver)[:receiver])\n\n # Search for the topic in Conversation table\n @conversation = Conversation.where(topic: topic).first\n\n # If topic does not exists, create the topic\n if !@conversation\n @conversation = Conversation.new(topic: topic, title: title)\n @conversation.add_user(current_user)\n @conversation.add_user(receiver)\n\n # If topic exists, join the conversation\n else\n # @conversation = Conversation.find(conversation.id)\n\n # If user is not yet in conversation, add user to conversation\n @conversation.add_user(current_user) unless current_user.has_joined?(@conversation) \n end\n\n # Redirect to conversation show page\n redirect_to conversation_path(@conversation)\n end",
"def conversation_params\n params.require(:conversation).permit(:user_one_id, :user_two_id)\n end",
"def create\n\n=begin \n if Conversation.between(params[:sender_id], params[:recipient_id]).present?\n @conversation = Conversation.between(params[:sender_id], params[:recipient_id]).first\n else # If conversation is not present\n @conversation = Conversation.create!(conversation_params)\n end\n=end\n sender_id = params[:sender_id]\n recipient_id = params[:recipient_id]\n \n @conversation = MessagingService::Message.\n get_conversation(\n sender_id: sender_id, \n recipient_id: recipient_id, \n conversation_params: params\n ).conversation\n render json: { conversation_id: @conversation.id }\n end",
"def show\n if current_user.present?\n @active_conversation = Conversation.find_by(buyer_id: current_user.id, seller_id: @order.product)\n end\n\n seller = @order.product\n @conversation = Conversation.new(seller_id: seller)\n end",
"def create\n @message = Message.new(message_params)\n @message.user_id = current_user.id\n user1 = User.where(:email => params[:message][:email]).first\n # if user1\n # else\n # redirect_to root_url, :flash => {:error => \"No user with the email #{session[:email]} exists.\"}\n # return\n # end \n convo = Conversation.where(:sender_id => current_user.id)\n if convo\n convo = convo.where(:recipient_id => user1.id).first\n end \n if convo\n @message.conversation_id = convo.id\n else\n convo2 = Conversation.new\n convo2.sender_id = current_user.id\n convo2.recipient_id = user1.id\n convo2.save\n @message.conversation_id = convo2.id\n end\n @message.save\n redirect_to \"/conversations\" \n end",
"def create\n\t\tif Conversation.between(params[:sender_id], params[:recipient_id]).present?\n\t\t\t@conversation = Conversation.between(params[:sender_id], params[:recipient_id]).first\n\t\telse\n\t\t\t@conversation = Conversation.create(conversation_params)\n\t\tend\n\n\t\tredirect_to conversation_messages_path(@conversation)\n\tend",
"def add_partners_TEMP_DANGEROUS\n User.find(:all).each do |user|\n Partnership.create(:inviter => logged_in_user, :receiver => user) if logged_in_user.dealership != user.dealership\n end\n redirect_to :back\n end",
"def create\n if Conversation.between(params[:sender_id],params[:recipient_id]).present?\n @conversation = Conversation.between(params[:sender_id],params[:recipient_id]).first\n else\n @conversation = Conversation.create!(conversation_params)\n end\n\n render json: { conversation_id: @conversation.id }\n end",
"def conversation_params\n params.require(:conversation).permit(:user_a_id, :conversation_id, :user_b_id)\n end",
"def create\n c = Conversation.where(\"(sender_id = ? and receiver_id = ?) or (sender_id = ? and receiver_id = ?)\", current_user, params[:message][:receiver_id].to_i, params[:message][:receiver_id].to_i, current_user)\n \n if c.blank?\n #Initiate new conversation with this person\n \n c = Conversation.create(sender_id: params[:message][:sender_id], receiver_id: params[:message][:receiver_id])\n @message = c.messages.create!(params[:message])\n else\n @message = c.first.messages.create!(params[:message])\n end\n\n receiver = User.find(params[:message][:receiver_id])\n receiver.unread = 1\n receiver.save(validate: false)\n \n respond_to do |format|\n if @message.update_attributes(params[:message])\n format.html { redirect_to messages_path(receiver_id: params[:message][:receiver_id]), notice: 'Message was successfully sent.' }\n format.json { head :no_content }\n else\n format.html { render action: \"new\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def make_deal!\n if deal_with_other_offers \n if selling?\n Deal.create!(:buyer_id => self.reciever_id, :seller_id => self.sender_id, :price => self.price, :textbook_id => self.textbook_id, :description => self.listing.description)\n else\n Deal.create!(:buyer_id => self.sender_id, :seller_id => self.reciever_id, :price => self.price, :textbook_id => self.textbook_id, :description => self.listing.description)\n end\n\n sender_listing = sender.listing_from_textbook(textbook_id)\n sender_listing.destroy if sender_listing.nil? == false\n\n reciever_listing = reciever.listing_from_textbook(textbook_id)\n reciever_listing.destroy if reciever_listing.nil? == false\n else\n return false\n end\n end",
"def the_other_user(current_user)\n is_buyer_side?(current_user) ? self.seller : self.buyer\n end",
"def new\n c = Conversation.where(\"(sender_id = ? and receiver_id = ?) or (sender_id = ? and receiver_id = ?)\", current_user, params[:receiver_id], params[:receiver_id], current_user)\n if c == nil\n #Initiate new conversation with this person\n c = current_user.conversations.create(sender_id: current_user, receiver_id: params[:receiver_id])\n c.messages.new(sender_id: current_user, receiver_id: params[:receiver_id])\n else\n c.messages.new(sender_id:current_user, receiver_id: params[:receiver_id])\n end\n end",
"def donate_to(other_user)\n self.create_active_donorship(donated_to_id: other_user.id)\n end",
"def create\n puts \"########## messages create #############\"\n recipients = params[:user_ids].split(',')\n puts recipients\n recipient_ids = recipients.collect{|i| i.to_i}\n \n @message = current_user.messages.new\n @message.subject = params[:message][:subject]\n if [email protected]\n flash[:notice] = 'Can not sent message.'\n return render :action => \"new\"\n end\n\n @conversation = @message.conversations.new\n @conversation.sender = current_user\n @conversation.content = params[:message][:conversation][:content]\n\n respond_to do |format|\n if @conversation.save\n MessageStatus.associate_user(@message, current_user, recipient_ids)\n format.html { redirect_to(messages_path, :notice => 'Message was successfully sent.') }\n format.xml { render :xml => @message, :status => :created, :location => @message }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @message.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @debt = Debt.new(params[:debt])\n\n if params[:debit]\n @debt.user_from_id, @debt.user_to_id = @debt.user_to_id, @debt.user_from_id\n end\n\n if @debt.save\n redirect_to :back, :notice => t(:debt_added) \n # todo: send message to receiver if is_user?\n else\n redirect_to :back, :alert => \"#{t(:debt_not_added)}. #{error_format @debt.errors}\"\n end\n end",
"def create\n\n\n @message = Message.new(message_params)\n @message.user_id = current_user.id\n @message.body = params[:message][:body]\n @message.save\n\n Recipient.create!(:message_id=>@message.id, :user_id=>params[:to_user_id],:sender_id => current_user.id, :receiver_id => params[:to_user_id],:status=>false)\n\n redirect_to \"/profile/#{current_user.id}\"\n end",
"def create\n @trade = Trade.new(params[:trade])\n\n respond_to do |format|\n if @trade.save\n @recipient = Team.find(@trade.trader2_id).user\n @trade.create_activity :create, owner: current_user\n current_user.send_message(@recipient, \"Hey, I sent you a trade proposal\", \"Trade proposal awaiting your approval\")\n format.html { redirect_to @trade, notice: 'Trade was successfully created.' }\n format.json { render json: @trade, status: :created, location: @trade }\n else\n format.html { render action: \"new\" }\n format.json { render json: @trade.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n recipients = User.where(id: params['recipients']) || [User.find_by_id(params[:uid].keys.first)]\n conversation = current_user.send_message(recipients, params[:message][:body], params[:message][:subject]).conversation\n flash[:success] = (I18n.locale == :sw ? \"Ujumbe wako umetumwa\" : \"Your message has been sent\")\n redirect_to conversation_path(conversation)\n end",
"def create\n logger.debug \"In create!!\"\n @conversation = Conversation.new(params[:conversation])\n @conversation.update_attributes(:postedByUser => current_user.id)\n\n respond_to do |format|\n if @conversation.save\n format.html { redirect_to @conversation, notice: 'Conversation was successfully created.' }\n format.json { render json: @conversation, status: :created, location: @conversation }\n else\n format.html { render action: 'new' }\n format.json { render json: @conversation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @listing = Listing.find(params[:listing])\n if current_user == @listing.host\n # I am a lister so choose a conversation with user from list\n redirect_to(conversations_path(listing: @listing)) && return\n else\n # I am a customer looking to book\n @conv = Conversation.where(listing: @listing).where(user: current_user)\n end\n \n if @conv.first.present?\n # I have a conversation with host already\n redirect_to(messages_path(conversation_id: @conv.first.id)) && return\n end\n \n @conversation = Conversation.new(user: current_user, listing: @listing)\n\n respond_to do |format|\n if @conversation.save\n format.html { redirect_to messages_path(conversation_id: @conversation.id),\n notice: 'Conversation was successfully created.' }\n format.json { render :show, status: :created, location: @conversation }\n else\n format.html { render :new }\n format.json { render json: @conversation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def follow(other_user_id)\n \tuser_to_follow = User.find_by(id: other_user_id)\n followee_followerships.create(followee_id: user_to_follow.id)\n end",
"def user_connection_params\n params.require(:user_connection).permit(:recipient_user_id).\n merge!({\"sender_user_id\" => current_user.id, \"created_by\" => current_user.id, \"updated_by\" => current_user.id})\n end",
"def new_interlocutor(conversation)\n if current_user.id.eql?(conversation.sender_id)\n return User.find(conversation.recipient_id)\n else\n return User.find(conversation.sender_id)\n end\n end",
"def create\n filteredParams = params.require(:dmRoom).permit(:first_user_id, :second_user_id)\n first_user = User.find(filteredParams[\"first_user_id\"]) rescue nil\n second_user = User.find(filteredParams[\"second_user_id\"]) rescue nil\n if !first_user || !second_user\n res_with_error(\"Unknown User\", :bad_request)\n return (false)\n end \n @direct_chat = DirectChat.new(user1_id: filteredParams[\"first_user_id\"], user2_id: filteredParams[\"second_user_id\"])\n respond_to do |format|\n if @direct_chat.save\n ActionCable.server.broadcast \"chat_channel\", type: \"room\", description: \"create-room\", user: current_user\n format.html { redirect_to @direct_chat, notice: 'Direct chat was successfully created.' }\n format.json { render :show, status: :created, location: @direct_chat }\n else\n format.html { render :new }\n format.json { render json: @direct_chat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def other_user usr\n usr.id == user_id ? recipient : user\n end",
"def with(current_user)\n \tsender == current_user ? recipient : sender\n\tend",
"def create\n if params[:trade_id]\n trade = Trade.find params[:trade_id]\n item = trade.item\n offer = trade.offer\n if current_user and trade.item.user_id == current_user.id\n if trade.active?\n accepted_offer = AcceptedOffer.new\n accepted_offer.trade_id = params[:trade_id]\n accepted_offer.user_id = current_user.id\n accepted_offer.recent_tradeya = true\n if accepted_offer.save\n trade.update_attribute(:status, \"ACCEPTED\")\n item.reduce_quantity\n offer.reduce_quantity\n copy2me = (params[:copy2me] == 'true')\n # this is an immediate notification with Publisher's message\n #EventNotification.add_2_notification_q(NOTIFICATION_TYPE_IMIDIATE, NOTIFICATION_OFFER_ACCEPTED, offer.user_id, {:trade_id => trade.id, :msg => params[:msg], :copy2me => copy2me, :chk_user_setting => true})\n TradeMailer.offer_accepted_offerer(offer.id,offer.user.id,item.id,item.user.id).deliver\n TradeMailer.offer_accepted_owner(offer.id,offer.user.id,item.id,item.user.id).deliver\n TradeMailer.review_reminder_offerer(offer.user.id,item.user.id).deliver_in(3.days)\n TradeMailer.review_reminder_owner(offer.user.id,item.user.id).deliver_in(3.days)\n # to show count of offers accepted in daily or weekly notification mails\n EventNotification.add_2_notification_q(NOTIFICATION_TYPE_USER_SETTING, NOTIFICATION_OFFER_ACCEPTED, offer.user_id, {:trade_id => trade.id, :msg => params[:msg], :copy2me => copy2me}) unless (offer.user.notification_frequency == NOTIFICATION_FREQUENCY_IMMEDIATE or !offer.user.notify_offer_accepted)\n \n # Alert.add_2_alert_q(ALERT_TYPE_OFFER, OFFER_ACCEPTED, offer.user_id, nil, trade.id)\n end\n end\n end\n # if item.completed?\n # redirect_to accepted_offers_item_path(item)\n # else\n # redirect_to trade_offers_item_path(item)\n # end\n redirect_to past_trades_user_path(current_user,:trade => trade.id)\n end\n end",
"def other_user(user)\n message = self.messages.first\n message.sender == user ? message.recipient : message.sender\n # I FEEL THIS METHOD COULD BE REWRITTEN IN A MORE EFFICIENT AND SUGAR WAY\n end",
"def get_conversation(user)\n cnv = self.conversations.where(id: user.conversations.where(multiple_users_flag: false).select(:id), multiple_users_flag: false).first\n if cnv.nil?\n cnv = Conversation.create(cnv_users: [self.id, user.id], name: user.name, multiple_users_flag: false)\n end\n return cnv\n end",
"def other_user(user)\n user == sender ? recipient : sender\n end",
"def create\n @booking = Booking.new(booking_params)\n @booking.profile = @profile\n @booking.user = current_user\n\n # Amount in cents\n @amount = @booking.profile.price * 100 * @booking.lesson_length\n\n respond_to do |format|\n @booking.update_time_date\n if @booking.save\n customer = Stripe::Customer.create(\n :email => current_user.email,\n :source => params[:stripeToken]\n )\n\n charge = Stripe::Charge.create(\n :customer => customer.id,\n :amount => @amount.to_i,\n :description => \"Lesson with \" + @booking.profile.user.first_name,\n :currency => 'aud'\n )\n\n # New conversation between the 2 users so that they can be added to the contacts page\n if Conversation.where(user1_id: current_user.id, user2_id: @booking.profile.user.id).empty?\n Conversation.create(user1_id: current_user.id, user2_id: @booking.profile.user.id)\n end\n\n @booking.charge_identifier = charge.id\n format.html { redirect_to profile_bookings_url(@profile), notice: 'Booking was successfully created.' }\n format.json { render :index, status: :ok, location: @booking }\n else\n format.html { render :new }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n\n end\n end",
"def create_peer_ship\n\t\tif self.replied == true\n\t\t\tuser_id = self.user_id\n\t\t\tuser2_id = self.to\t\t\t\n\t\t\tPeership.create(:user_id => user_id, :user2_id => user2_id) unless Peership.exists?(user_id, user2_id) \t\t\t\n\t\tend\n\t\t#Delete request object unless user did not make a selection \n\t\tPeerRequest.destroy(self.id) unless self.replied == nil \t\t\n\tend",
"def private_conv_recipient(conversation)\n conversation.opposed_user(current_user)\n end",
"def create_conversation\n user = User.find_by_id(params[:user_id])\n if user\n resp = Conversation.create_from_staff(@ride_zone, user, params[:body], Rails.configuration.twilio_timeout)\n if resp.is_a?(Conversation)\n render json: {response: resp.api_json}\n else\n render json: {error: resp}, status: :request_timeout # just call twilio errors timeouts\n end\n else\n render json: {error: 'User not found'}, status: :not_found\n end\n end",
"def create\n @conversation = Room.find_conversation(current_user.id, @friend_id)\n unless @conversation.present?\n @conversation = current_user.rooms.build(friend_id: @friend_id)\n @conversation.save\n end\n redirect_to room_path(@conversation)\n end",
"def match_availability_message_to_convo\n if conversation_id.nil? && !availability_id.nil?\n conversation = Conversation.where(availability_id: availability_id).first\n if conversation.nil?\n conversation = Conversation.create(availability_id: availability_id, name: \"Teaching #{availability.start_time.strftime('%H:%M %d/%m/%Y')}\")\n availability.availability_users.each do |join|\n conversation.conversation_members.create!(user: join.user, admin: join.admin)\n end\n end\n self.conversation = conversation\n end\n end",
"def create\n if params[:user] && params[:opp] && params[:message]\n @user = User.find_by_id(params[:user])\n if @user\n @opp = User.find_by_id(params[:opp])\n if @opp\n @message = Message.new(origin: @user.id, opponent: @opp.id, message: params[:message])\n if @message.save\n @json = {:status => \"success\", :id => \"#{@message.id}\"}\n render json: @json\n else\n send_error(\"failed to send message\")\n end\n else\n send_error(\"recipient not found\")\n end\n else\n send_error(\"user not found\")\n end\n else\n send_error(\"bad parameters\")\n end\n end",
"def create_conversation_users!(recipient_ids)\n return if recipient_ids.blank?\n recipient_ids.each do |u|\n conversation_users.create!(user_id: u, conversation: self)\n end\n end",
"def create\n @chat = Chat.new(params[:chat])\n @user = current_user\n \n @other = User.find_by_email(params[:user2])\n\n respond_to do |format|\n if @other\n if @chat.save\n @message = Message.create(:msg => params[:message])\n @message.user = @user\n @chat.messages << @message\n @chat.users << @user \n if not @chat.users.include? @other\n @chat.users << @other\n end\n format.html { redirect_to(chat_path(@chat), :notice => 'Chat was successfully created.') }\n format.xml { render :xml => chat_path(@chat), :status => :created, :location => @chat }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @chat.errors, :status => :unprocessable_entity }\n end\n else\n @chat.errors.add(:user, \"cannot be empty\")\n if params[:message] == ''\n @chat.errors.add(:message, \"cannot be empty\")\n end\n format.html { render :action => \"new\" }\n format.xml { render :xml => @chat.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def send!(other_user, current_user, mex)\n mails.create!(receiver_id: other_user.id, sender_id:current_user.id, sender_name:current_user.name, message: mex)\n\n end",
"def create\n\t\tif Conversation.between(params[:user_id],params[:cause_id]).present?\n \t\tresponse = Conversation.between(params[:user_id],params[:cause_id]).first\n \telse\n\t\t\tresponse = ConversationCreateService.new(create_params).perform\n\t\tend\n\n\t\tif response.success?\n\t\t\t\t@conversation = response.result\n\t\t\t\trender_create_convo(@conversation)\n\t\telse\n\t\t\trender_error(:bad_request, \"response.errors\")\n\t\tend\n\tend",
"def create\n\t\tuserID = whoAreYou()\n\n\t\t#make sure message is valid\n\t\tif params[:message] != \"\" && params[:message].length >= 1\n\t\t\t\n\t\t\t\n\t\t\t#STEP 1: create a conversation record\n\t\t\tmyConvo = Conversation.create\n\t\t\t\n\t\t\t#STEP 2: create a linking record in UserConversation..MM Table\n\t\t\tmyHookup = UserConversationMmTable.create(:conversation_id => myConvo.id, :user_id => userID)\n\t\t\t\n\t\t\t#STEP 3: create the message and link it to the convo record and user record\n\t\t\tmyMessage = Message.create(:user_id => userID, :conversation_id => myConvo.id, :message_content => params[:message])\n\t\t\t\n\t\t\t#STEP 4: add any users in the message as part of the conversation\n\t\t\tmessageList = params[:message].split()\n\t\t\t\n\t\t\tmessageList.each do |word|\n\t\t\t\n\t\t\t\tif word[0] == \"@\"\n\t\t\t\t\twordLowered = word.downcase\n\t\t\t\t\tmyUser = User.where(:userName => wordLowered)\n\t\t\t\t\t#if its a real user then make the entry\n\t\t\t\t\tif myUser != nil && myUser.length != 0\n\t\t\t\t\t\tputs myUser[0].id\n\t\t\t\t\t\t#model validations and a postgresql index will make sure user cannot be in the same convo twice\n\t\t\t\t\t\tUserConversationMmTable.create(:user_id => myUser[0].id, :conversation_id => myConvo.id)\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\t\t\n\t\t\t#STEP 5: APPLE PUSH NOTIFICATION to everyone with @<username> in the content of the message\n\t\t\t\n\t\t\t#create body of push notification payload\n\t\t\taUser = User.find(userID)\n\t\t\tname = aUser.userName\n\t\t\tmessageContent = params[:message]\n\t\t\tmessagePush = name + \" : \" + messageContent + \"\"\n\t\t\t\n\t\t\t#set credentials \n\t\t\tpusher = Grocer.pusher(\n\t\t\t certificate: \"lib/assets/ckProduction.pem\", # required\n\t\t\t passphrase: \"\", # optional\n\t\t\t gateway: \"gateway.push.apple.com\", # optional; See note below.\n\t\t\t port: 2195, # optional\n\t\t\t retries: 3 # optional\n\t\t )\t\n\t\t\t\n\t\t\t#for each user create and send push notification\n\t\t\tmessageList.each do |word|\n\t\t\t\tif word[0] == \"@\"\n\t\t\t\t\twordLowered = word.downcase\n\t\t\t\t\tmyUser = User.where(:userName => wordLowered)\n\t\t\t\t\t\n\t\t\t\t\t#if its a real user and they have a token on file then push notification\n\t\t\t\t\tif myUser != nil && myUser.length != 0 && (myUser[0].deviceTokens != \"\")\n\t\t\t\t\t\tputs myUser[0].id\n\t\t\t\t\t\tdeviceID = myUser[0].deviceTokens\n\t\t\t\t\t\t\n\t\t\t\t\t\t#create push notification\n\t\t\t\t\t notification = Grocer::Notification.new(\n\t\t\t\t\t device_token: deviceID,\n\t\t\t\t\t alert: messagePush,\n\t\t\t\t\t badge: 0,\n\t\t\t\t\t sound: \"\", \t\t\t# optional\n\t\t\t\t\t expiry: Time.now + 60*60, # optional; 0 is default, meaning the message is not stored\n\t\t\t\t\t identifier: 1234 # optional\n\t\t\t\t\t )\t\t\t\n\t\t\t\t\t\tpusher.push(notification)\n\t\t\t\t\t\t\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\n\t\t\t@confirmation = [\"Message Sent\"] #i lost one hour on this stupid error, not putting message sent in brackets lol.\n\t\t\trender :json => @confirmation\n\t\t\t#redirect_to => (:action => \"index\")\n\t\tend\n\tend",
"def create\n requestor = User.where(email: @requestor)\n target = User.where(email: @target)\n\n if requestor.exists? && !target.exists?\n render json: { success: false, message: \"Target Email not found\" }\n\n elsif !requestor.exists? && target.exists?\n render json: { success: false, message: \"Requestor Email not found\" }\n\n elsif !requestor.exists? && !target.exists?\n render json: { success: false, message: \"Both Email not found\" }\n\n else\n if @requestor != @target || @target != @requestor\n user = User.find_by_email @requestor\n aim = User.find_by_email @target\n user.subscribes.create target_id: aim.id\n render json: { success: true }\n else\n render json: { success: false, message: \"You can't subscribe yourself\" }\n end\n\n end\n end",
"def create\n relationship = Relationship.between(current_user.id, params[:user_two_id]).first\n unless relationship\n current_user.add_friend(User.find(params[:user_two_id]))\n relationship = Relationship.between(current_user.id, params[:user_two_id]).first\n relationship.status = 1\n relationship.save\n end\n friend = User.find_friend(current_user, relationship)\n redirect_to friendlist_path\n end",
"def make_friendship!(other_user)\n relationship.create!(friend_id: other_user.id)\n other_user.relationship.create!(friend_id: self.id)\n return true\n end",
"def create\n recipient = User.find(conversation_params['recipient_id'])\n @conversation = current_user.send_message(recipient, conversation_params['body'], conversation_params['subject']).conversation\n\n respond_with(@conversation, location: conversation_path(@conversation))\n end",
"def originator_params\n merged_params = { updated_by: @user.id }\n merged_params = { created_by: @user.id } if params[:action] == 'create'\n\n params.require(:originator).permit(\n :product_category_consumer,\n :product_category_business,\n :apr,\n :contact_id,\n :customer_category\n ).merge(merged_params)\n end",
"def participates?(user)\n \tsender == user || recipient == user\n\tend",
"def create\n @chat = current_user.chat_with(params[:user_id].to_i)\n if not @chat.blank?\n redirect_to @chat.first\n else\n \n @chat = Chat.new(chat_params)\n @chat.chat_subscribers.new(user_id: current_user.id)\n @chat.chat_subscribers.new(user_id: params[:user_id])\n \n respond_to do |format|\n if @chat.save\n format.html { redirect_to @chat, notice: 'Chat was successfully created.' }\n format.json { render :show, status: :created, location: @chat }\n else\n format.html { render :new }\n format.json { render json: @chat.errors, status: :unprocessable_entity }\n end\n end\n \n end\n end",
"def request_friendship (user_2)\n #self will be current user (user_1)\n self.friendships.create(friend: user_2)\n end",
"def create\n @meeting_point = MeetingPoint.new\n profile = Profile.where(:user_id => current_user.id).first\n\n for val in params[:meeting_point]\n @recipients = User.first(\n :joins => { :profile => :meeting_points },\n :conditions => {\n :meeting_points => { :id => val }\n }\n\n )\n @meeting_points = MeetingPoint.find(val).first\n msg = \"Hallo #{@recipients.profile.firstname} #{@recipients.profile.lastname},\\n#{profile.firstname} #{profile.lastname} möchte sich mit dir am Treffpunkt #{@meeting_points.description} treffen.\"\n subject = \"Anfrage zu Treffpunkt #{@meeting_points.description}\"\n conversation = current_user.send_message(@recipients,msg, subject).conversation\n end\n\n #respond_to do |format|\n #if @meeting_point.save\n # format.html { redirect_to }\n redirect_to :action => \"new\"\n # format.json { render json: @meeting_point, status: :created, location: @meeting_point }\n #else\n # format.html { render action: \"new\" }\n # format.json { render json: @meeting_point.errors, status: :unprocessable_entity }\n #end\n #end\n end",
"def make_trade(params)\n char1 = Character.find(params[\"char1_id\"])\n char2 = Character.find(params[\"char2_id\"])\n char1.update_attributes(\"team_id\" => 0, \"user_id\" => params[\"user2_id\"])\n char2.update_attributes(\"team_id\" => 0, \"user_id\" => @current_user.id)\n if params[\"message_id\"] != nil\n message = Message.find(params[\"message_id\"])\n message.update_attributes(trade: \"finished\")\n end\n end",
"def buyer\n # the user posting the request\n offer.posting.user\n end",
"def create\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n\n invited_users = InvitedUser.where(email: @user.email)\n invited_users.each do |invited_user|\n Message.create(sender_id: 1, receiver_id: invited_user.inviter.id, title: \"Your friend has just joined\", content: \"I have just joined to TennisBuddy World! Thank you for inviting me. #{@user.full_name}\")\n end\n\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def conversation_params\n params.permit(:sender_id, :receiver_id)\n end",
"def create\n @booking = Booking.new(booking_params)\n \n unless params[:subject_id].empty?\n @subject = Subject.find(params[:subject_id])\n end\n # TODO date and time validation\n begin\n date = (params['date_part'] + \" \" + params['time_part']).to_datetime\n rescue ArgumentError\n @booking.errors.add(:date, \"is invalid\")\n date = Date.new\n end\n @booking.booking_date = date\n # TODO: Refactor for admin booking creation\n @booking.shared = params[\"shared\"]\n @booking.subject = @subject\n # Add this customer as owner. \n @booking.creator = current_user.customer\n @booking.customers << current_user.customer\n @booking.booked_customers.first.number_students = params[:booking][:booked_customers][:number_students]\n @booking.period = 2\n \n # Create closed booking if customer came from searching or enquiring.\n if params[:presenter_id].present?\n presenter = Presenter.find(params[:presenter_id])\n if presenter.available? @booking.booking_date, @booking.duration_minutes\n @booking.chosen_presenter = Presenter.find(params[:presenter_id])\n @booking.rate = presenter.rate\n @booking.creator = current_user.customer\n else\n @booking.errors.add(:presenter, \"is not available at this time\")\n end\n end \n \n if @booking.save\n # Only send messages to customers if booking is shared\n @message = \"A new #{@booking.subject.name} booking has been created that you may be interested in.\"\n if @booking.shared?\n Notification.notify_applicable_users(current_user, @booking, \"customer\", booking_path(@booking), @message, :interested_booking)\n end\n # Only send messages to presenters if booking is open\n if @booking.chosen_presenter.nil?\n Notification.notify_applicable_users(current_user, @booking, \"presenter\", booking_path(@booking), @message, :interested_booking)\n end\n Notification.notify_admin(\"A new booking has been created\", booking_path(@booking), :booking)\n\n # Add booking to booked customers\n current_user.customer.created_bookings << @booking\n\n #clear search session \n session[:search_params] = nil\n redirect_to @booking\n else\n @date_part = params['date_part']\n @time_part = params['time_part']\n render :new\n end\n\n end",
"def buyer\n user = User.last\n offer = Offer.all.order('RANDOM()').first\n Remembers.buyer(user, offer)\n end",
"def conversation_params\n params.require(:conversation).permit(:participant_id).merge(user_id: current_user.id)\n end",
"def create\n\n @room = Room.find(params[:room_id])\n @booking = Booking.find(params[:booking_id])\n @user = User.find(params[:user_id])\n puts @user.email\n count = @booking.participantCount\n if @booking.participantCount<@room.capacity\n if @booking.participants.exists?(user_id: @user.id)\n flash[:danger]= \"User is already Added\"\n redirect_back(fallback_location: root_path)\n else\n @booking.update_column(:participantCount, (count+1))\n @participant = @booking.participants.create(:user_id => @user.id, :email => @user.email)\n @pusers= @user.pusers.create(:booking_id => params[:booking_id])\n\n\n if @participant.save\n UserMailer.accept_invitation(@participant).deliver_now\n flash[:success]= \"User is been added\"\n redirect_back(fallback_location: root_path)\n else\n flash[:danger] = \"Something went wrong\"\n end\n end\n else\n flash[:danger]= \"Maximum Capacity is reached\"\n redirect_back(fallback_location: root_path)\n end\n\n end",
"def new_appeal(user, receiver)\n @you = receiver.name\n @friend = user.name\n mail to: receiver.email, subject: \"Someone want be your friend!\"\n end",
"def create\n receipt = current_user.reply_to_conversation(@conversation, params[:body])\n #so every receipt has a reference to the correct coversation. Wrapped in conversation path so that both reply here and form link to same path\n redirect_to conversation_path(receipt.conversation)\n end",
"def create\n auction_voucher = Auction::Event.find_by(id: auction_voucher_params[:event_id])\n if auction_voucher && auction_voucher.ended_at > Time.now && auction_voucher.published == true\n ActiveRecord::Base.transaction do\n if auction_voucher_params[:user_id].split(\",\").length > 1\n auction_voucher_params[:user_id].split(\",\").each do |id|\n @auction_voucher = Auction::Voucher.create(:user_id => id,:event_id => auction_voucher_params[:event_id] ,:obtained_at => Time.now)\n end\n else\n @auction_voucher = Auction::Voucher.create(:user_id => auction_voucher_params[:user_id],:event_id => auction_voucher_params[:event_id] ,:obtained_at => Time.now)\n end\n end\n if @auction_voucher\n flash_msg('success', \"发放优惠券成功\", 'index')\n else\n flash_msg('danger', \"发放优惠券失败\", 'new')\n end\n else\n flash_msg('danger', \"发放优惠券失败!id 为#{auction_voucher_params[:event_id]}的券种不存在,或已过期,或未发布\", 'new')\n end\n end",
"def create\n if Chat.between(params[:sender_id], params[:recipient_id]).present?\n @chat = Chat.between(params[:sender_id], params[:recipient_id]).first\n else\n @chat = Chat.create!(chat_params)\n end\n redirect_to chat_messages_path(@chat)\n end",
"def create\n\n @recipient = User.find(params[:recipient])\n @receipt = @user.send_message(@recipient, params[:body], params[:subject], nil, nil, nil)\n if (@receipt.errors.blank?)\n @receipt.save\n @conversation = @receipt.conversation\n redirect_to @conversation, :flash => { :success => \"Message sent.\" }\n else\n render :action => :new\n end \n end",
"def create\n\t\tmail = params[:mail]\n\t\tunless(getAllFriendsConversation.include? mail[:user_id])\n\t\t\treceiver_user = User.find(mail[:user_id])\n\t\t\tcurrent_user.send_message(receiver_user, mail[:body], mail[:subject])\n\t\t\trender json: { message: \"Sent message to \"+receiver_user.fullname }\n\t\telse\n\t\t\trender json: { message: \"You already have one conversation with this user\" }, status: :not_acceptable\n\t\tend\n\tend",
"def new_booking_created(user_id, booking_id)\n @company = Company.first\n\n @user = User.find(user_id)\n @booking = Booking.find booking_id\n\n mail(to: @company.email, subject: \"For admin: #{ @user.full_name} just created a booking\")\n end",
"def participates?(user)\n author == user || receiver == user\n end",
"def subscribe_author\n self.subscriptions.create user_id: self.user.id\n end",
"def create\n @dealer = Dealer.create(dealer_params)\n\n #this will break unless dealer has user_id\n # assigning the current_user's id to the dealer they're making\n @dealer.user_id = current_user.id\n # saving the dealer instance that has just been created\n @dealer.save\n\n # this corresponds to users that have just signed up\n # [:onboarding] tag is in the dealer_build.html.erb ONLY for new users\n # once user creates their first dealer, they're redirected to dealer_contact\n if params[:onboarding].present?\n redirect_to after_signup_path(:dealer_contact)\n else\n # if [:onboarding] hidden field tag isn't present\n # then the user gets redirected to summary page\n # (users signing in for the 2nd time + )\n redirect_to summary_page_path\n end\n end",
"def to user_id, message\n return yield false, USER_NOT_FOUND unless user = User.find(user_id)\n return yield false, INVALID_JOINABLE unless joinable_is_valid?\n\n owner_join_request = JoinRequest.where(joinable: @joinable, user_id: user_id, role: member_type).first_or_create\n\n ApplicationRecord.transaction do\n creator_join_requests.update_all(role: member_type)\n\n owner_join_request.update(status: :accepted, role: creator_type)\n\n @joinable.update_attribute(:user_id, user_id)\n end\n\n if message.present?\n ChatServices::ChatMessageBuilder.new(\n user: user,\n joinable: @joinable,\n join_request: owner_join_request,\n params: {\n message_type: :text,\n content: message,\n }\n ).create\n end\n\n yield true\n end",
"def create\n usr = User.where(fb_id: params[:user_id]).first\n @comment = Comment.new(\n bet_id: params[:bet_id],\n text: params[:text],\n user: usr\n )\n\n if @comment.save\n # make a list of all possible notification recipients\n list = get_bet_opponents(params[:bet_id])\n list.select! {|uid| uid != params[:user_id]} #filter out the guy who made the notification\n push_notify_users(list, \"#{usr.name} commented on #{User.where(fb_id: @comment.bet.owner).first.name}'s bet!\")\n push_notify_user(@comment.bet.owner, \"#{usr.name} commented on your bet!\") unless params[:user_id] == @comment.bet.owner\n render action: 'show', status: :created, location: @comment\n else\n render json: @comment.errors, status: :unprocessable_entity\n end\n end",
"def deal_with_other_offers\n if self.selling?\n if self.sender.nil? == false\n self.sender.active_offers_for_textbook(self.textbook_id).each do |offer|\n offer.update_status(3)\n\n if self.sender_id == offer.sender_id\n\t Offer.notify_buyer_book_sold(offer.reciever,offer.sender,textbook)\n\t else\n\t Offer.notify_buyer_book_sold(offer.sender,offer.reciever,textbook)\n\t end\n\t end\n end\n\tif self.reciever.nil? == false\n\t self.reciever.active_offers_for_textbook(self.textbook_id).each do |offer|\n\t offer.update_status(4)\n\n if self.sender_id == offer.sender_id\n\t Offer.notify_seller_book_bought(offer.reciever,offer.sender,textbook)\n\t else\n\t Offer.notify_seller_book_bought(offer.sender, offer.reciever, textbook)\n\t end\n\t end\n\tend\n else\n if self.sender.nil? == false\n self.sender.active_offers_for_textbook(self.textbook_id).each do |offer|\n offer.update_status(4)\n\n if self.sender_id == offer.sender_id\n\t Offer.notify_seller_book_bought(offer.reciever, offer.sender, textbook)\n\t else\n\t Offer.notify_seller_book_bought(offer.sender, offer.reciever, textbook)\n\t end\n\t end\n\tend\n\tif self.reciever.nil? == false\n\t self.reciever.active_offers_for_textbook(self.textbook_id).each do |offer|\n\t offer.update_status(3)\n\n if self.sender_id == offer.sender_id\n Offer.notify_buyer_book_sold(offer.reciever, offer.sender, textbook)\n\t else\n Offer.notify_buyer_book_sold(offer.sender, offer.reciever, textbook)\n\t end\n\t end\n\tend\n end\n end",
"def accept\n offer = Offer.find(params[:id])\n if offer \n if offer.product.user.id == @current_user.id\n if offer.offer_status == Offer.OFFER_OFFERED\n conversation = Conversation.new\n conversation.seller = @current_user\n conversation.buyer = offer.user\n conversation.offer = offer\n conversation.save()\n \n offer.offer_status = Offer.OFFER_ACCEPTED\n offer.conversation_id = conversation.id\n offer.save()\n \n offer.product.sold_status = Product.SOLD_IN_TRANSACTION\n offer.product.save()\n\n notify(\"NOTIF_NEW_CONVERSATION\", {\n conversation: {\n id: conversation.id,\n is_seller: false,\n prev_message: nil\n },\n user: {\n id: @current_user.id,\n username: @current_user.username,\n first_name: @current_user.first_name,\n last_name: @current_user.last_name\n },\n offer: {\n id: offer.id,\n price: offer.price\n },\n product: {\n id: offer.product.id,\n product_name: offer.product.product_name,\n price: offer.product.price\n }\n }, offer.user_id)\n\n OfferMailer.offer_accepted_email(offer.user, offer, offer.product, offer.product.user, conversation).deliver_later!(wait: 15.seconds)\n \n render status: 200, json: {conversation_id: conversation.id}\n else\n render status: 471, json: {error: true}\n end\n else\n render status: 472, json: {error: true}\n end\n else\n render status: 404, json: {error: true}\n end\n end",
"def make_friends_with(other_user)\n if (self != other_user) && !self.friends.include?(other_user)\n self.friendships.create!(friend: other_user)\n other_user.friendships.create!(friend: self)\n end\n end",
"def run_callbacks\n user = @user_repository.find_or_create(@to_user_id)\n user.add_follower(@from_user_id)\n end",
"def create\n @convo = Convo.new(params[:convo])\n @convo.user_id = current_user.id\n upmerituser(current_user, 10)\n respond_to do |format|\n if @convo.save\n format.html { redirect_to convo_posts_url(:convo_id => @convo.id), notice: 'New conversation created.' }\n format.json { render json: convo_posts_url(:convo_id => @convo.id), status: :created, location: @convo }\n else\n format.html { render action: \"new\" }\n format.json { render json: @convo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def conversation_params\n params.require(:conversation).permit(:user1_id, :user2_id, :user1read, :user2read, messages_attributes: [:id, :conversation_id, :sender_id, :receiver_id, :text])\n end",
"def create\n @partner = Partner.new(params[:partner])\n @partner.build_user(params[:user])\n\n is_ok = true\n begin\n Partner.transaction do\n @partner.save!\n @partner.user.save!\n end\n rescue ActiveRecord::RecordInvalid => e\n logger.error e\n is_ok = false\n end\n\n if is_ok\n flash[:notice] = 'Partner was successfully created.'\n redirect_to partner_url(@partner) \n else\n render :action => \"new\" \n end\n end",
"def create\n payer_email = params[:payer_email]\n txn_type = params[:txn_type] # subscr_failed, subscr_cancel, subscr_payment, subscr_signup, subscr_eot, subscr_modify\n \n if params[:reason_code] == 'refund'\n # TODO: just notify me that somebody refunded, keep their is_customer flag set to true\n else\n # add/flag customer\n u = User.find_or_create_by_email(payer_email)\n u.first_name = params[:first_name] # overwrite whatever we've got with Paypal's info\n u.last_name = params[:last_name]\n u.password = 'temporary'\n u.is_customer = true\n u.save\n CustomerMailer.deliver_purchase_complete(u) # send them a link\n AdminMailer.deliver_purchase_notification(u) # let me know they were added\n subject = 'Customer added'\n end\n \n render :text => 'OK'\n end",
"def create\n vendor = @review.vendor\n @review.user = current_user\n current_user.wedding_date ||= @review.date\n \n respond_to do |format|\n if @review.save\n vendor.save\n current_user.save\n # Em teste para admin\n # if current_user.admin?\n alert = \"Que legal, a sua avaliação com certeza ajudará outras noivas.\"\n current_user.add_merits_actions(alert,MeritsAction::ACTIONS.keys[0])\n # Concede pontos ao amigo que convidou\n if current_user.referrer_id\n user_referred = User.find(current_user.referrer_id)\n current_user.male? ? alert = \"O seu amigo #{current_user.name} avaliou o fornecedor #{vendor.name} e por isso você ganhou\" : alert = \"A sua amiga #{current_user.name} avaliou o fornecedor #{vendor.name} e por isso você ganhou\"\n user_referred.add_merits_actions(alert,MeritsAction::ACTIONS.keys[0])\n end\n # end\n\n UserMailer.review_submitted(@review).deliver\n format.html { redirect_to vendor_seo_path(vendor), notice: 'A sua avaliação foi registrada com sucesso' }\n format.json { render json: @review, status: :created, location: @review }\n else\n format.html { render action: \"new\" }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end",
"def demo_notification\n authorize @user, :message_angels?\n @user.angels.each do |angel|\n @client.messages.create(\n from: @twilio_phone,\n to: \"+#{angel.phone_number}\",\n body: \"#{angel.first_name}! #{@message}\"\n )\n end\n redirect_to ollivia_path, notice: 'Mensagens enviadas com sucesso.'\n end",
"def join!(user)\n # It loads up all the user because in the case where the chat is saved but the chat_participations have not been saved,\n # this is the only way to ensure we don't have duplicates.\n return if self.chat_participations.map(&:user_id).include?(user.id)\n self.chat_participations.create!(:user => user)\n end",
"def create\n if current_user && current_user.seller\n create_item\n else\n redirect_to root_path\n end\n end",
"def create\n @booking = Booking.new(booking_params)\n room = Room.find(@booking.room_id) \n \n @booking.buyer_id = current_user.id if user_signed_in?\n @booking.seller_id = room.user_id\n @booking.room_name = room.name\n @booking.room_title = room.title\n @booking.booking_code = Booking.generate_booking_code\n if params[:payment_method].present?\n @booking.payment_method = params[:payment_method]\n else\n @booking.payment_method = \"Block\"\n end\n\n respond_to do |format|\n if @booking.save\n if @booking.payment_method == \"Bank Transfer\"\n #send_message(\"+15005550006\", \"[HB][##{@booking.id}] Brace yourself for RM#{@booking.service_fee} bank transfer from #{@booking.first_name}(#{@booking.phone}). Visit HourBeds.com for more info\")\n format.html { redirect_to payment_instruction_url(transfer: @booking.total) }\n elsif @booking.payment_method == \"Block\"\n format.html { redirect_to calendar_url(room, start_date: @booking.start_date) }\n else\n #format.html { redirect_to booking_url(@booking), notice: 'Booking was successfully created.' }\n #send_message(\"+15005550006\", \"You got a #{@booking.duration} hour reservation for #{@booking.room_name.truncate(20)} (#{@booking.check_in.strftime(\"%b %d, %Y - %l:%M %p\")}). Visit HourBeds.com for more info\")\n end\n format.json { render :show, status: :created, location: @booking }\n else\n format.html { render :new }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n active_menu(2)\n @receiver = Receiver.new(params[:receiver])\n @receivers = Receiver.where(\"user_id = :user_id\",{:user_id => current_user.id.to_s}) \n respond_to do |format|\n if @receiver.save\n @receiver.update_attributes(:user_id => current_user.id.to_s)\n @user = User.find(current_user.id.to_s);\n @email = @receiver.email\n @last_name = @user.last_name\n @first_name = @user.first_name\n \n UserMailer.send_mail_receiver(@email,@last_name,@first_name).deliver\n format.html { redirect_to :controller => 'receivers', :action => 'index', notice: 'Receiver was successfully created.' }\n format.json { render json: @receiver, status: :created, location: @receiver }\n else\n format.html { render action: \"new\" }\n format.json { render json: @receiver.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @user = User.find(params[:id])\n\n $admin = User.where(\"admin = ? AND signed_in = ?\", true, true).first\n if $admin.nil?\n $admin = User.where(\"admin = ?\", true).first\n end\n $conversation = Conversation.between(current_user.id,$admin.id).first\n if $conversation.nil?\n $conversation = Conversation.create(sender_id: current_user.id, recipient_id: $admin.id)\n end\n gon.open = $conversation.open\n end",
"def user\n if scope.id == object.sender_user_id\n object.recipient_user\n else\n object.sender_user\n end\n end",
"def create\n # p \"MessagesController, create, here is message params\" + message_params.to_s\n message = Message.new message_params\n message.current_user = @user.id\n message.created_at = DateTime.now\n # only if have parent\n if message.save\n # even if user or owner had deleted the conversation (marked it deleted or deleted_by_user = true),\n # if one side responds to the message, the conversation accessible to user who deleted it (ie deleted and deleted_by_user = false)\n @conversation.deleted = false\n @conversation.deleted_by_user = false\n @conversation.trashed = false\n @conversation.trashed_by_user = false\n @conversation.archived = false\n @conversation.archived_by_user = false\n @conversation.save\n booking_serializer = nil\n if params[:booking_id]\n booking = Booking.find_by(id: params[:booking_id])\n # message_serializer = parse_json message\n booking_serializer = parse_json booking\n end\n conversation_serializer = parse_json @conversation\n json_response \"Created message succesfully\", true, {conversation: conversation_serializer, booking: booking_serializer}, :ok\n else\n # p \"MessagesController, create, in if else \" + message.to_s\n json_response \"Create message failed\", false, {}, :unprocessable_entity\n end\n end",
"def notify_parties\n buyer.add_transaction self\n seller.add_transaction self if seller\n end",
"def follow(other_user)\n active_relationships.create(following_id: other_user.id)\n end",
"def follow(other_user)\n follow_down.create(following_id: other_user.id)\n end",
"def user_conversation_params\n params.require(:user_conversation).permit(:user_id, :conversation_id)\n end"
] | [
"0.6531311",
"0.6382754",
"0.63439983",
"0.6300932",
"0.615566",
"0.60914356",
"0.6010778",
"0.5955784",
"0.5947428",
"0.5936066",
"0.5931391",
"0.5927772",
"0.59211767",
"0.59054005",
"0.58973795",
"0.5844476",
"0.5828471",
"0.58262336",
"0.58206093",
"0.5764075",
"0.5748435",
"0.5736655",
"0.5677846",
"0.56623244",
"0.5606726",
"0.5589089",
"0.55859333",
"0.5582197",
"0.55688405",
"0.55663216",
"0.5559106",
"0.55518603",
"0.5546152",
"0.5546032",
"0.5539108",
"0.5538665",
"0.5536006",
"0.55358946",
"0.5532964",
"0.5523924",
"0.5519122",
"0.5517148",
"0.5508707",
"0.5503496",
"0.5497886",
"0.5471048",
"0.54695153",
"0.5463958",
"0.5455445",
"0.5451077",
"0.5445466",
"0.54446584",
"0.54203916",
"0.541579",
"0.54087377",
"0.53843045",
"0.5384084",
"0.53713316",
"0.5365216",
"0.5362545",
"0.5350644",
"0.53487563",
"0.5346222",
"0.53448945",
"0.53392863",
"0.53389543",
"0.53374314",
"0.53318614",
"0.53313804",
"0.5327327",
"0.53197926",
"0.53169185",
"0.52942157",
"0.5288353",
"0.52881604",
"0.52690005",
"0.5267763",
"0.52639437",
"0.5261176",
"0.5256804",
"0.5254345",
"0.52541226",
"0.5247111",
"0.5238427",
"0.5228799",
"0.52279526",
"0.52215326",
"0.52120036",
"0.5207261",
"0.5203808",
"0.5200681",
"0.51993",
"0.51971465",
"0.51959175",
"0.51942885",
"0.5187254",
"0.5181496",
"0.5179298",
"0.5179281",
"0.5178572"
] | 0.6831759 | 0 |
checks value equivalence to another Injury object | def ==(other)
return false if other.class != self.class
if @duration != other.duration
return false
end
return true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def eql?(other_money); end",
"def ==(object)\n ret = false\n \n if object.is_a?(self.class)\n # Check all of the ids for a match\n ret = @issn == object.issn if [email protected]? and !object.issn.nil?\n ret = @eissn == object.eissn if ([email protected]? and !object.eissn.nil?) and !ret\n ret = @isbn == object.isbn if ([email protected]? and !object.isbn.nil?) and !ret\n ret = @eisbn == object.eisbn if ([email protected]? and !object.eisbn.nil?) and !ret\n ret = @oclc == object.oclc if ([email protected]? and !object.oclc.nil?) and !ret\n ret = @lccn == object.lccn if ([email protected]? and !object.lccn.nil?) and !ret\n ret = @doi == object.doi if ([email protected]? and !object.doi.nil?) and !ret\n ret = @pmid == object.pmid if ([email protected]? and !object.pmid.nil?) and !ret\n ret = @coden == object.coden if ([email protected]? and !object.coden.nil?) and !ret\n ret = @sici == object.sici if ([email protected]? and !object.sici.nil?) and !ret\n ret = @bici == object.bici if ([email protected]? and !object.bici.nil?) and !ret\n ret = @document_id == object.document_id if (!@document_id.nil? and !object.document_id.nil?) and !ret\n ret = @dissertation_number == object.dissertation_number if (!@dissertation_number.nil? and !object.dissertation_number.nil?) and !ret\n ret = @bibcode == object.bibcode if ([email protected]? and !object.bibcode.nil?) and !ret\n ret = @eric == object.eric if ([email protected]? and !object.eric.nil?) and !ret\n ret = @oai == object.oai if ([email protected]? and !object.oai.nil?) and !ret\n ret = @nbn == object.nbn if ([email protected]? and !object.nbn.nil?) and !ret\n ret = @hdl == object.hdl if ([email protected]? and !object.hdl.nil?) and !ret\n ret = @naxos == object.naxos if ([email protected]? and !object.naxos.nil?) and !ret\n \n # If no ids matched and either this Citation or the one passed in has no ids then match by titles!\n if (@issn.nil? and @eissn.nil? and @isbn.nil? and @eisbn.nil? and @oclc.nil? and @lccn.nil? and @doi.nil? and @pmid.nil? and\n @coden.nil? and @sici.nil? and @bici.nil? and @document_id.nil? and @dissertation_number.nil? and\n @bibcode.nil? and @eric.nil? and @oai.nil? and @nbn.nil? and @hdl.nil? and @naxos.nil?) or\n (object.issn.nil? and object.eissn.nil? and object.isbn.nil? and object.eisbn.nil? and object.oclc.nil? and \n object.lccn.nil? and object.doi.nil? and object.pmid.nil? and object.coden.nil? and object.sici.nil? and \n object.bici.nil? and object.document_id.nil? and object.dissertation_number.nil? and\n object.bibcode.nil? and object.eric.nil? and object.oai.nil? and object.nbn.nil? and object.hdl.nil? and\n object.naxos.nil?)\n \n ret = @article_title == object.article_title if (!@article_title.nil? and !object.article_title.nil?) and !ret\n ret = @book_title == object.book_title if (!@book_title.nil? and !object.book_title.nil?) and !ret\n ret = @title == object.title if ([email protected]? and !object.title.nil?) and !ret\n ret = @journal_title == object.journal_title if (!@journal_title.nil? and !object.journal_title.nil?) and !ret\n end\n end\n \n ret\n end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n ticker == o.ticker &&\n company_name == o.company_name &&\n industry_group_number == o.industry_group_number &&\n industry_group_name == o.industry_group_name &&\n fiscal_year_0 == o.fiscal_year_0 &&\n fiscal_year_1 == o.fiscal_year_1 &&\n fiscal_year_2 == o.fiscal_year_2 &&\n company_last_5_year_actual == o.company_last_5_year_actual &&\n company_fiscal_year_1_vs_fiscal_year_0 == o.company_fiscal_year_1_vs_fiscal_year_0 &&\n company_fiscal_year_2_vs_fiscal_year_1 == o.company_fiscal_year_2_vs_fiscal_year_1 &&\n company_long_term_growth_mean == o.company_long_term_growth_mean &&\n company_fiscal_year_1_forward_price_to_earnings == o.company_fiscal_year_1_forward_price_to_earnings &&\n industry_last_5_year_actual == o.industry_last_5_year_actual &&\n industry_fiscal_year_1_vs_fiscal_year_0 == o.industry_fiscal_year_1_vs_fiscal_year_0 &&\n industry_fiscal_year_2_vs_fiscal_year_1 == o.industry_fiscal_year_2_vs_fiscal_year_1 &&\n industry_long_term_growth_mean == o.industry_long_term_growth_mean &&\n industry_fiscal_year_1_forward_price_to_earnings == o.industry_fiscal_year_1_forward_price_to_earnings &&\n sp500_last_5_year_actual == o.sp500_last_5_year_actual &&\n sp500_fiscal_year_1_vs_fiscal_year_0 == o.sp500_fiscal_year_1_vs_fiscal_year_0 &&\n sp500_fiscal_year_2_vs_fiscal_year_1 == o.sp500_fiscal_year_2_vs_fiscal_year_1 &&\n sp500_long_term_growth == o.sp500_long_term_growth &&\n sp500_fiscal_year_1_price_to_earnings == o.sp500_fiscal_year_1_price_to_earnings &&\n company == o.company\n end",
"def ==(other_currency); end",
"def es (other)\n if other.is_a? Individuo\n @nombre == other.nombre\n elsif\n false\n end\n end",
"def eql?(other_money)\n self == other_money\n end",
"def eql?(obj)\n build\n obj.build\n obj.all_info_matches?(@info)\n rescue StandardError\n false\n end",
"def eql?(outro_livro)\n\t \t@isbn == outro_livro.isbn\n\t end",
"def ==(other)\n self.class == other.class && value == other.value\n end",
"def ==(other)\n return false unless other\n return false unless other.respond_to?(:target_org)\n return @target_org == other.target_org && @feeling == other.feeling \n end",
"def equal?(another_game_object); end",
"def ==(other)\n (@jiak.object == other.jiak.object) rescue false\n end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n date == o.date &&\n net_asset_value == o.net_asset_value &&\n beta_vs_spy == o.beta_vs_spy &&\n trailing_one_month_return_split_and_dividend == o.trailing_one_month_return_split_and_dividend &&\n trailing_one_month_return_split_only == o.trailing_one_month_return_split_only &&\n trailing_one_year_return_split_and_dividend == o.trailing_one_year_return_split_and_dividend &&\n trailing_one_year_return_split_only == o.trailing_one_year_return_split_only &&\n trailing_one_year_volatility_annualized == o.trailing_one_year_volatility_annualized &&\n trailing_three_year_annualized_return_split_and_dividend == o.trailing_three_year_annualized_return_split_and_dividend &&\n trailing_three_year_annualized_return_split_only == o.trailing_three_year_annualized_return_split_only &&\n trailing_three_year_volatility_annualized == o.trailing_three_year_volatility_annualized &&\n trailing_five_year_annualized_return_split_and_dividend == o.trailing_five_year_annualized_return_split_and_dividend &&\n trailing_five_year_annualized_return_split_only == o.trailing_five_year_annualized_return_split_only &&\n trailing_five_year_volatility_annualized == o.trailing_five_year_volatility_annualized &&\n trailing_ten_year_annualized_return_split_and_dividend == o.trailing_ten_year_annualized_return_split_and_dividend &&\n trailing_ten_year_annualized_return_split_only == o.trailing_ten_year_annualized_return_split_only &&\n inception_annualized_return_split_and_dividend == o.inception_annualized_return_split_and_dividend &&\n inception_annualized_return_split_only == o.inception_annualized_return_split_only &&\n calendar_year_5_return_split_and_dividend == o.calendar_year_5_return_split_and_dividend &&\n calendar_year_5_return_split_only == o.calendar_year_5_return_split_only &&\n calendar_year_4_return_split_and_dividend == o.calendar_year_4_return_split_and_dividend &&\n calendar_year_4_return_split_only == o.calendar_year_4_return_split_only &&\n calendar_year_3_return_split_and_dividend == o.calendar_year_3_return_split_and_dividend &&\n calendar_year_3_return_split_only == o.calendar_year_3_return_split_only &&\n calendar_year_2_return_split_and_dividend == o.calendar_year_2_return_split_and_dividend &&\n calendar_year_2_return_split_only == o.calendar_year_2_return_split_only &&\n calendar_year_1_return_split_and_dividend == o.calendar_year_1_return_split_and_dividend &&\n calendar_year_1_return_split_only == o.calendar_year_1_return_split_only &&\n calendar_year_to_date_return_split_and_dividend == o.calendar_year_to_date_return_split_and_dividend &&\n calendar_year_to_date_return_split_only == o.calendar_year_to_date_return_split_only &&\n etf == o.etf\n end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n id == o.id &&\n id_account == o.id_account &&\n webid == o.webid &&\n application_date == o.application_date &&\n date == o.date &&\n value == o.value &&\n gross_value == o.gross_value &&\n nature == o.nature &&\n original_wording == o.original_wording &&\n simplified_wording == o.simplified_wording &&\n stemmed_wording == o.stemmed_wording &&\n wording == o.wording &&\n id_category == o.id_category &&\n state == o.state &&\n date_scraped == o.date_scraped &&\n rdate == o.rdate &&\n vdate == o.vdate &&\n bdate == o.bdate &&\n coming == o.coming &&\n active == o.active &&\n id_cluster == o.id_cluster &&\n comment == o.comment &&\n last_update == o.last_update &&\n deleted == o.deleted &&\n original_value == o.original_value &&\n original_gross_value == o.original_gross_value &&\n original_currency == o.original_currency &&\n commission == o.commission &&\n commission_currency == o.commission_currency &&\n country == o.country &&\n counterparty == o.counterparty &&\n card == o.card\n end",
"def equal?(other)\n raise \"Incident is not complete\" unless complete? && other.complete?\n\n screener.target.equal?(other.screener) &&\n general_info.target.equal?(other.general_info) &&\n involved_civilians.zip(other.involved_civilians).all? { |c1, c2| c1.equal? c2 } &&\n involved_officers.zip(other.involved_officers).all? { |o1, o2| o1.equal? o2 }\n end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n date == o.date &&\n intraperiod == o.intraperiod &&\n frequency == o.frequency &&\n open == o.open &&\n high == o.high &&\n low == o.low &&\n close == o.close &&\n volume == o.volume &&\n adj_open == o.adj_open &&\n adj_high == o.adj_high &&\n adj_low == o.adj_low &&\n adj_close == o.adj_close &&\n adj_volume == o.adj_volume &&\n factor == o.factor &&\n split_ratio == o.split_ratio &&\n dividend == o.dividend &&\n change == o.change &&\n percent_change == o.percent_change &&\n fifty_two_week_high == o.fifty_two_week_high &&\n fifty_two_week_low == o.fifty_two_week_low &&\n security == o.security\n end",
"def ==(other)\n @value = other\n end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n sequence_number == o.sequence_number &&\n corporate_number == o.corporate_number &&\n process == o.process &&\n correct == o.correct &&\n update_date == o.update_date &&\n change_date == o.change_date &&\n name == o.name &&\n name_image_id == o.name_image_id &&\n kind == o.kind &&\n prefecture_name == o.prefecture_name &&\n city_name == o.city_name &&\n street_number == o.street_number &&\n address_image_id == o.address_image_id &&\n prefecture_code == o.prefecture_code &&\n city_code == o.city_code &&\n post_code == o.post_code &&\n address_outside == o.address_outside &&\n address_outside_image_id == o.address_outside_image_id &&\n close_date == o.close_date &&\n close_cause == o.close_cause &&\n successor_corporate_number == o.successor_corporate_number &&\n change_cause == o.change_cause &&\n assignment_date == o.assignment_date &&\n latest == o.latest &&\n en_name == o.en_name &&\n en_prefecture_name == o.en_prefecture_name &&\n en_city_name == o.en_city_name &&\n en_address_outside == o.en_address_outside &&\n furigana == o.furigana &&\n hihyoji == o.hihyoji\n end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n income_type == o.income_type &&\n description == o.description &&\n tax_rate == o.tax_rate &&\n tax_amount == o.tax_amount &&\n tax_amount_no_vat == o.tax_amount_no_vat &&\n withheld == o.withheld &&\n total == o.total &&\n vat_type == o.vat_type\n end",
"def ==(other)\n super || other.class == self.class && other.value == value\n end",
"def ==(another_wine)\n if self.supplier.eql?(another_wine['supplier'])\n if self.name.eql?(another_wine['name'])\n if self.country_of_origin.eql?(another_wine['country_of_origin'])\n if self.price == another_wine['price'].to_d\n if self.grape_type.eql?(another_wine['grape_type'])\n if self.suitable_for_vegetarians == another_wine['suitable_for_vegetarians']\n if self.bottle_size.eql?(another_wine['bottle_size'])\n if self.description.eql?(another_wine['description'])\n if self.image_url.eql?(another_wine['image_url'])\n return true\n end\n end\n end\n end\n end\n end\n end\n end\n end\n\n return false\n end",
"def eql?(obj)\n (obj.class == model) && (obj.values == @values)\n end",
"def eql?(obj)\n (obj.class == model) && (obj.values == @values)\n end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n alliance_id == o.alliance_id &&\n ancestry_id == o.ancestry_id &&\n birthday == o.birthday &&\n bloodline_id == o.bloodline_id &&\n corporation_id == o.corporation_id &&\n description == o.description &&\n gender == o.gender &&\n name == o.name &&\n race_id == o.race_id &&\n security_status == o.security_status\n end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n agreement_date == o.agreement_date &&\n autopay_status == o.autopay_status &&\n contract_name == o.contract_name &&\n end_date == o.end_date &&\n id == o.id &&\n origination_location_id == o.origination_location_id &&\n start_date == o.start_date &&\n site_id == o.site_id &&\n upcoming_autopay_events == o.upcoming_autopay_events\n end",
"def eq\n @ole.EQ\n end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n account == o.account &&\n adjusted_equity_previous_close == o.adjusted_equity_previous_close &&\n equity == o.equity &&\n equity_previous_close == o.equity_previous_close &&\n excess_maintenance == o.excess_maintenance &&\n excess_maintenance_with_uncleared_deposits == o.excess_maintenance_with_uncleared_deposits &&\n excess_margin == o.excess_margin &&\n excess_margin_with_uncleared_deposits == o.excess_margin_with_uncleared_deposits &&\n extended_hours_equity == o.extended_hours_equity &&\n extended_hours_market_value == o.extended_hours_market_value &&\n last_core_equity == o.last_core_equity &&\n last_core_market_value == o.last_core_market_value &&\n market_value == o.market_value &&\n start_date == o.start_date &&\n unwithdrawable_deposits == o.unwithdrawable_deposits &&\n unwithdrawable_grants == o.unwithdrawable_grants &&\n url == o.url &&\n withdrawable_amount == o.withdrawable_amount\n end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n input_currency == o.input_currency &&\n payin_methods == o.payin_methods &&\n metadata == o.metadata &&\n sender == o.sender &&\n recipients == o.recipients &&\n traits == o.traits &&\n state == o.state &&\n input_amount == o.input_amount &&\n payin_reference == o.payin_reference &&\n paid_amount == o.paid_amount &&\n due_amount == o.due_amount &&\n created_at == o.created_at &&\n expires_at == o.expires_at &&\n external_id == o.external_id &&\n id == o.id &&\n errors == o.errors\n end",
"def equivalentValues(other) # JS == operator\n other.is_a?(Object) && unwrap.eql?(other.unwrap)\n end",
"def ==(grade)\n self.number_value == grade.number_value\n end",
"def eql?(other)\n return false unless other.class == Egyptian\n return (@year.eql? other.year) &&\n (@month.eql? other.month) &&\n (@day.eql? other.day)\n end",
"def ==(obj)\n return false unless obj.kind_of? self.class\n\n value == obj.value\n end",
"def ==(other); false; end",
"def eql!(val)\n tap do\n # only cares when A is fetched from data\n next unless a.data?\n next known_data[a.val] = val if val.is_a?(Integer)\n # A == X, we can handle these cases:\n # * X is an immi\n # * X is a known data\n next unless x.data? || x.imm?\n next known_data[a.val] = x.val if x.imm?\n\n known_data[a.val] = known_data[x.val]\n end\n end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n id == o.id &&\n name == o.name &&\n ticker == o.ticker &&\n figi_ticker == o.figi_ticker &&\n ric == o.ric &&\n isin == o.isin &&\n sedol == o.sedol &&\n exchange_mic == o.exchange_mic &&\n sponsor == o.sponsor &&\n type == o.type &&\n description == o.description &&\n inception_date == o.inception_date &&\n data_change_date == o.data_change_date &&\n close_date == o.close_date &&\n is_live_listed == o.is_live_listed &&\n legal_structure == o.legal_structure &&\n intraday_nav_ticker == o.intraday_nav_ticker &&\n primary_ticker == o.primary_ticker &&\n primary_ticker_country_code == o.primary_ticker_country_code &&\n primary_listing_region == o.primary_listing_region &&\n net_expense_ratio == o.net_expense_ratio &&\n asset_class == o.asset_class &&\n other_asset_types == o.other_asset_types &&\n market_cap_range == o.market_cap_range &&\n holds_only_nyse_stocks == o.holds_only_nyse_stocks &&\n holds_only_nasdaq_stocks == o.holds_only_nasdaq_stocks &&\n growth_value_tilt == o.growth_value_tilt &&\n growth_type == o.growth_type &&\n value_type == o.value_type &&\n sector == o.sector &&\n industry == o.industry &&\n sub_industry == o.sub_industry &&\n cross_sector_theme == o.cross_sector_theme &&\n natural_resources_type == o.natural_resources_type &&\n excludes_financials == o.excludes_financials &&\n excludes_technology == o.excludes_technology &&\n us_or_excludes_us == o.us_or_excludes_us &&\n developed_emerging == o.developed_emerging &&\n specialized_region == o.specialized_region &&\n continent == o.continent &&\n latin_america_sub_group == o.latin_america_sub_group &&\n europe_sub_group == o.europe_sub_group &&\n asia_sub_group == o.asia_sub_group &&\n specific_country == o.specific_country &&\n china_listing_location == o.china_listing_location &&\n us_state == o.us_state &&\n real_estate == o.real_estate &&\n index_weighting_scheme == o.index_weighting_scheme &&\n market_cap_weighting_type == o.market_cap_weighting_type &&\n fundamental_weighting_type == o.fundamental_weighting_type &&\n dividend_weighting_type == o.dividend_weighting_type &&\n bond_type == o.bond_type &&\n government_bond_types == o.government_bond_types &&\n municipal_bond_region == o.municipal_bond_region &&\n municipal_vrdo == o.municipal_vrdo &&\n mortgage_bond_types == o.mortgage_bond_types &&\n bond_tax_status == o.bond_tax_status &&\n credit_quality == o.credit_quality &&\n average_maturity == o.average_maturity &&\n specific_maturity_year == o.specific_maturity_year &&\n bond_currency_denomination == o.bond_currency_denomination &&\n laddered == o.laddered &&\n zero_coupon == o.zero_coupon &&\n floating_rate == o.floating_rate &&\n build_america_bonds == o.build_america_bonds &&\n commodity_types == o.commodity_types &&\n energy_type == o.energy_type &&\n agricultural_type == o.agricultural_type &&\n metal_type == o.metal_type &&\n inverse_leveraged == o.inverse_leveraged &&\n target_date_multi_asset_type == o.target_date_multi_asset_type &&\n currency_hedged == o.currency_hedged &&\n currency_pair == o.currency_pair &&\n social_environmental_type == o.social_environmental_type &&\n clean_energy_type == o.clean_energy_type &&\n dividend_type == o.dividend_type &&\n regular_dividend_payor_type == o.regular_dividend_payor_type &&\n holds_ml_ps == o.holds_ml_ps &&\n holds_preferred_stock == o.holds_preferred_stock &&\n holds_closed_end_funds == o.holds_closed_end_funds &&\n quant_strategies_type == o.quant_strategies_type &&\n other_quant_models == o.other_quant_models &&\n hedge_fund_type == o.hedge_fund_type &&\n derivatives_based == o.derivatives_based &&\n holds_ad_rs == o.holds_ad_rs &&\n index_linked == o.index_linked &&\n includes_short_exposure == o.includes_short_exposure &&\n index_name == o.index_name &&\n parent_index == o.parent_index &&\n index_family == o.index_family &&\n broader_index_family == o.broader_index_family &&\n index_provider == o.index_provider &&\n fund_family == o.fund_family &&\n index_ticker == o.index_ticker &&\n etn_issuing_bank == o.etn_issuing_bank &&\n etn_maturity_date == o.etn_maturity_date &&\n livestock == o.livestock &&\n dynamic_futures_roll == o.dynamic_futures_roll &&\n index_provider_code == o.index_provider_code &&\n single_category_designation == o.single_category_designation &&\n registered_countries == o.registered_countries &&\n issuing_entity_country_code == o.issuing_entity_country_code &&\n ucits == o.ucits &&\n replication_structure == o.replication_structure &&\n domicile == o.domicile &&\n base_currency == o.base_currency &&\n listing_currency == o.listing_currency &&\n fund_listing_date == o.fund_listing_date &&\n listing_country_code == o.listing_country_code &&\n listing_region == o.listing_region &&\n smartvs_traditional_beta == o.smartvs_traditional_beta &&\n smartvs_traditional_beta_level2 == o.smartvs_traditional_beta_level2 &&\n income_category == o.income_category &&\n etp_structure_type == o.etp_structure_type &&\n month_end_assets == o.month_end_assets &&\n etf_portfolio_turnover == o.etf_portfolio_turnover &&\n firstbridge_id == o.firstbridge_id &&\n firstbridge_parent_id == o.firstbridge_parent_id &&\n number_of_holdings == o.number_of_holdings\n end",
"def ==(other)\n other.is_a?(SysproObject) &&\n @values == other.instance_variable_get(:@values)\n end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n affiliate_rate == o.affiliate_rate &&\n campaign_id == o.campaign_id &&\n category == o.category &&\n client_review == o.client_review &&\n create_date == o.create_date &&\n currency_code == o.currency_code &&\n description == o.description &&\n document_id == o.document_id &&\n fee_amount == o.fee_amount &&\n fee_type == o.fee_type &&\n financial_rate == o.financial_rate &&\n financial_rate_term == o.financial_rate_term &&\n financial_rate_term_unit == o.financial_rate_term_unit &&\n financial_rate_type == o.financial_rate_type &&\n id == o.id &&\n image == o.image &&\n institution_name == o.institution_name &&\n is_active == o.is_active &&\n metadata == o.metadata &&\n minimum_contribution == o.minimum_contribution &&\n minimum_contribution_term == o.minimum_contribution_term &&\n minimum_contribution_term_unit == o.minimum_contribution_term_unit &&\n name == o.name &&\n node_map == o.node_map &&\n offer_link == o.offer_link &&\n offer_term == o.offer_term &&\n offer_term_unit == o.offer_term_unit &&\n prerequisite == o.prerequisite &&\n prerequisite_type == o.prerequisite_type &&\n rating == o.rating &&\n secondary_id == o.secondary_id &&\n subcategory == o.subcategory &&\n update_date == o.update_date\n end",
"def eql?(*) end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n mean == o.mean &&\n median == o.median &&\n count == o.count &&\n high == o.high &&\n low == o.low &&\n std_dev == o.std_dev &&\n revisions_upward == o.revisions_upward &&\n revisions_downward == o.revisions_downward &&\n mean_7_days_ago == o.mean_7_days_ago &&\n mean_30_days_ago == o.mean_30_days_ago &&\n mean_60_days_ago == o.mean_60_days_ago &&\n mean_90_days_ago == o.mean_90_days_ago &&\n revisions_upward_last_7_days == o.revisions_upward_last_7_days &&\n revisions_downward_last_7_days == o.revisions_downward_last_7_days &&\n revisions_upward_last_30_days == o.revisions_upward_last_30_days &&\n revisions_downward_last_30_days == o.revisions_downward_last_30_days &&\n revisions_upward_last_60_days == o.revisions_upward_last_60_days &&\n revisions_downward_last_60_days == o.revisions_downward_last_60_days &&\n revisions_upward_last_90_days == o.revisions_upward_last_90_days &&\n revisions_downward_last_90_days == o.revisions_downward_last_90_days &&\n revisions_upward_last_120_days == o.revisions_upward_last_120_days &&\n revisions_downward_last_120_days == o.revisions_downward_last_120_days &&\n revisions_upward_last_150_days == o.revisions_upward_last_150_days &&\n revisions_downward_last_150_days == o.revisions_downward_last_150_days &&\n security == o.security\n end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n actual_value == o.actual_value &&\n additional_contact_client_first_name == o.additional_contact_client_first_name &&\n additional_contact_client_id == o.additional_contact_client_id &&\n additional_contact_client_is_primary == o.additional_contact_client_is_primary &&\n additional_contact_client_last_name == o.additional_contact_client_last_name &&\n address_business_city == o.address_business_city &&\n address_business_country == o.address_business_country &&\n address_business_is_primary == o.address_business_is_primary &&\n address_business_line1 == o.address_business_line1 &&\n address_business_state == o.address_business_state &&\n address_business_zip_code == o.address_business_zip_code &&\n address_other_city == o.address_other_city &&\n address_other_country == o.address_other_country &&\n address_other_is_primary == o.address_other_is_primary &&\n address_other_line1 == o.address_other_line1 &&\n address_other_state == o.address_other_state &&\n address_other_zip_code == o.address_other_zip_code &&\n bill_rate == o.bill_rate &&\n bonus == o.bonus &&\n commission == o.commission &&\n company_id == o.company_id &&\n company_name == o.company_name &&\n compensation == o.compensation &&\n compensation_details == o.compensation_details &&\n custom_field1 == o.custom_field1 &&\n custom_field10 == o.custom_field10 &&\n custom_field11 == o.custom_field11 &&\n custom_field12 == o.custom_field12 &&\n custom_field13 == o.custom_field13 &&\n custom_field14 == o.custom_field14 &&\n custom_field15 == o.custom_field15 &&\n custom_field16 == o.custom_field16 &&\n custom_field17 == o.custom_field17 &&\n custom_field18 == o.custom_field18 &&\n custom_field19 == o.custom_field19 &&\n custom_field2 == o.custom_field2 &&\n custom_field20 == o.custom_field20 &&\n custom_field21 == o.custom_field21 &&\n custom_field22 == o.custom_field22 &&\n custom_field23 == o.custom_field23 &&\n custom_field24 == o.custom_field24 &&\n custom_field25 == o.custom_field25 &&\n custom_field26 == o.custom_field26 &&\n custom_field27 == o.custom_field27 &&\n custom_field28 == o.custom_field28 &&\n custom_field29 == o.custom_field29 &&\n custom_field3 == o.custom_field3 &&\n custom_field30 == o.custom_field30 &&\n custom_field4 == o.custom_field4 &&\n custom_field5 == o.custom_field5 &&\n custom_field6 == o.custom_field6 &&\n custom_field7 == o.custom_field7 &&\n custom_field8 == o.custom_field8 &&\n custom_field9 == o.custom_field9 &&\n description == o.description &&\n discount == o.discount &&\n estimated_close_date == o.estimated_close_date &&\n external_primary_key == o.external_primary_key &&\n fee == o.fee &&\n fee_percent == o.fee_percent &&\n hourly_rate == o.hourly_rate &&\n is_lead == o.is_lead &&\n is_on_hold == o.is_on_hold &&\n job_title_id == o.job_title_id &&\n job_title_name == o.job_title_name &&\n job_types == o.job_types &&\n lead_source_id == o.lead_source_id &&\n lead_source_name == o.lead_source_name &&\n margin == o.margin &&\n name == o.name &&\n number_of_openings == o.number_of_openings &&\n opportunity_type_id == o.opportunity_type_id &&\n opportunity_type_name == o.opportunity_type_name &&\n parent_job_id == o.parent_job_id &&\n parent_job_name == o.parent_job_name &&\n pay_rate == o.pay_rate &&\n potential_value == o.potential_value &&\n priority_id == o.priority_id &&\n priority_name == o.priority_name &&\n probability == o.probability &&\n salary == o.salary &&\n start_date == o.start_date &&\n tags == o.tags &&\n total_hours == o.total_hours &&\n website_description == o.website_description &&\n website_description_is_primary == o.website_description_is_primary &&\n website_other == o.website_other &&\n website_other_is_primary == o.website_other_is_primary\n end",
"def ==(y)\n @tutoria == y.tutoria && @estudiante == y.estudiante\n end",
"def == (object)\n if(@numerador == object.numerador && @denominador == object.denominador)\n true\n end\n end",
"def equal?(other); end",
"def eql?(other)\n return false unless other.class == Armenian \n return (@year.eql? other.year) &&\n (@month.eql? other.month) &&\n (@day.eql? other.day)\n end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n accounts_date == o.accounts_date &&\n reporting_period == o.reporting_period &&\n currency == o.currency &&\n consolidated_accounts == o.consolidated_accounts &&\n audit_qualification == o.audit_qualification &&\n number_of_employees == o.number_of_employees &&\n turnover == o.turnover &&\n cost_of_sales == o.cost_of_sales &&\n sga_plus_other_net_costs == o.sga_plus_other_net_costs &&\n operating_profit == o.operating_profit &&\n interest_receivable == o.interest_receivable &&\n interest_payable == o.interest_payable &&\n pre_tax_profit == o.pre_tax_profit &&\n taxation == o.taxation &&\n post_tax_profit == o.post_tax_profit &&\n dividends_payable == o.dividends_payable &&\n retained_profits == o.retained_profits &&\n intangible_assets == o.intangible_assets &&\n tangible_assets == o.tangible_assets &&\n investments_and_other_assets == o.investments_and_other_assets &&\n fixed_assets == o.fixed_assets &&\n stock == o.stock &&\n trade_debtors == o.trade_debtors &&\n other_debtors == o.other_debtors &&\n miscellaneous_current_assets == o.miscellaneous_current_assets &&\n cash == o.cash &&\n current_assets == o.current_assets &&\n total_assets == o.total_assets &&\n bank_loans_and_overdrafts == o.bank_loans_and_overdrafts &&\n trade_creditors == o.trade_creditors &&\n miscellaneous_current_liabilities == o.miscellaneous_current_liabilities &&\n other_short_term_finances == o.other_short_term_finances &&\n current_liabilities == o.current_liabilities &&\n contingent_liabilities == o.contingent_liabilities &&\n other_long_term_finances == o.other_long_term_finances &&\n total_long_term_liabilities == o.total_long_term_liabilities &&\n total_liabilities == o.total_liabilities &&\n net_assets == o.net_assets &&\n equity_paid_up == o.equity_paid_up &&\n revaluation_reserve == o.revaluation_reserve &&\n sundry_reserves == o.sundry_reserves &&\n profit_and_loss_account_reserve == o.profit_and_loss_account_reserve &&\n shareholder_funds == o.shareholder_funds &&\n depreciation == o.depreciation &&\n amortisation_of_intangibles == o.amortisation_of_intangibles &&\n ebitda == o.ebitda &&\n working_capital == o.working_capital &&\n capital_employed == o.capital_employed &&\n wages_and_salaries == o.wages_and_salaries &&\n directors_emoluments == o.directors_emoluments &&\n audit_fees == o.audit_fees &&\n bank_overdraft_and_long_term_loans == o.bank_overdraft_and_long_term_loans &&\n net_cash_flow_from_operations == o.net_cash_flow_from_operations &&\n net_cash_flow_before_financing == o.net_cash_flow_before_financing &&\n net_cash_flow_from_financing == o.net_cash_flow_from_financing &&\n increase_in_cash == o.increase_in_cash &&\n debtor_days == o.debtor_days &&\n exports == o.exports &&\n gross_margin_percentage == o.gross_margin_percentage &&\n operating_profit_margin_percentage == o.operating_profit_margin_percentage &&\n ebitda_margin_percentage == o.ebitda_margin_percentage &&\n pre_tax_profit_margin_percentage == o.pre_tax_profit_margin_percentage &&\n net_margin_percentage == o.net_margin_percentage &&\n return_on_assets_percentage == o.return_on_assets_percentage &&\n return_on_capital_employed_percentage == o.return_on_capital_employed_percentage &&\n return_on_equity == o.return_on_equity &&\n current_ratio == o.current_ratio &&\n cash_to_current_liabilities_ratio == o.cash_to_current_liabilities_ratio &&\n cash_to_total_assets_percentage == o.cash_to_total_assets_percentage &&\n liquidity_ratio == o.liquidity_ratio &&\n gearing_percentage_on_liability_basis == o.gearing_percentage_on_liability_basis &&\n gearing_percentage_on_gross_debt_basis == o.gearing_percentage_on_gross_debt_basis &&\n gearing_percentage_on_net_debt_basis == o.gearing_percentage_on_net_debt_basis &&\n debt_to_capital_percentage == o.debt_to_capital_percentage &&\n inventory_turnover_ratio == o.inventory_turnover_ratio &&\n cash_to_turnover_ratio == o.cash_to_turnover_ratio &&\n cash_to_turnover_percentage == o.cash_to_turnover_percentage &&\n days_inventory_outstanding == o.days_inventory_outstanding &&\n days_sales_outstanding == o.days_sales_outstanding &&\n days_payable_outstanding == o.days_payable_outstanding &&\n cash_conversion_cycle == o.cash_conversion_cycle &&\n revenue_per_employee == o.revenue_per_employee &&\n human_capital_value_added == o.human_capital_value_added &&\n interest_coverage_ratio == o.interest_coverage_ratio &&\n net_debt_to_ebitda_ratio == o.net_debt_to_ebitda_ratio &&\n cfo_to_sales_ratio == o.cfo_to_sales_ratio &&\n auditor == o.auditor &&\n joint_auditor == o.joint_auditor &&\n solicitor == o.solicitor &&\n accountant == o.accountant\n end",
"def ==(outro_dinheiro)\n begin \n outro_dinheiro = Dinheiro.new(outro_dinheiro) unless outro_dinheiro.kind_of?(Dinheiro)\n rescue\n return false\n end\n @quantia == outro_dinheiro.quantia\n end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n ir == o.ir &&\n loi == o.loi &&\n approval_id == o.approval_id &&\n calculated_max_price == o.calculated_max_price &&\n completes == o.completes &&\n event_id == o.event_id &&\n id == o.id &&\n new_estimated_cost == o.new_estimated_cost &&\n original_cpi == o.original_cpi &&\n original_estimated_cost == o.original_estimated_cost &&\n project_id == o.project_id &&\n quota_group_id == o.quota_group_id &&\n reason == o.reason &&\n request_new_price == o.request_new_price &&\n required_completes == o.required_completes\n end",
"def eql?(other) self.class == other.class and target==other.target and source==other.source; end",
"def eql?(other) self.class == other.class and target==other.target and source==other.source; end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class && value == o.value\n end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class && value == o.value\n end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n cusip == o.cusip &&\n ticker == o.ticker &&\n security_name == o.security_name &&\n security_type == o.security_type &&\n title_of_class == o.title_of_class &&\n stock_exchange == o.stock_exchange &&\n filing_date == o.filing_date &&\n value == o.value &&\n amount == o.amount &&\n type == o.type &&\n investment_discretion == o.investment_discretion &&\n other_manager == o.other_manager &&\n sole_voting_authority == o.sole_voting_authority &&\n shared_voting_authority == o.shared_voting_authority &&\n no_voting_authority == o.no_voting_authority\n end",
"def ==(other)\n info == other.info rescue false\n end",
"def ==(another_expense)\n self.name == another_expense.name && self.category == another_expense.category #likely not required for present purposes but included for illustration\n end",
"def ==(object)\n return true if object.equal?(self)\n if object.instance_of?(self.class)\n %w{antecedent num_antecedent_transactions \n support consequent confidence}.each do |key|\n return false unless object.send(key) == self.send(key)\n end\n return true\n else\n return false\n end\n end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n new_businessunitid == o.new_businessunitid &&\n campaign_id == o.campaign_id &&\n description == o.description &&\n objective == o.objective &&\n new_url_script == o.new_url_script &&\n new_url_menu == o.new_url_menu &&\n new_url_pricelist == o.new_url_pricelist &&\n new_min_interval == o.new_min_interval &&\n new_logic_number_1 == o.new_logic_number_1 &&\n new_logic_number_2 == o.new_logic_number_2 &&\n new_logic_number_3 == o.new_logic_number_3 &&\n new_logic_number_4 == o.new_logic_number_4 &&\n new_next_data == o.new_next_data &&\n new_next_newcustomer == o.new_next_newcustomer &&\n new_next_timezones == o.new_next_timezones &&\n new_types_campaing == o.new_types_campaing &&\n new_next_oldcustomer == o.new_next_oldcustomer &&\n new_redial_max == o.new_redial_max &&\n new_system_auto_avaya == o.new_system_auto_avaya &&\n new_apc_job == o.new_apc_job &&\n new_personal_phonecall == o.new_personal_phonecall &&\n new_nedozvon_max == o.new_nedozvon_max &&\n new_count_phonecall_log == o.new_count_phonecall_log &&\n new_maxday_callback == o.new_maxday_callback &&\n new_customertimefrom == o.new_customertimefrom &&\n new_customertimeto == o.new_customertimeto &&\n new_interactive_script == o.new_interactive_script &&\n new_isdemo_access == o.new_isdemo_access &&\n call_count == o.call_count &&\n sub_type == o.sub_type &&\n sub_type_name == o.sub_type_name &&\n name == o.name &&\n summary_call_count == o.summary_call_count &&\n my_call_count == o.my_call_count\n end",
"def eql?(other)\n self.class == other.class && value == other.value\n end",
"def eql?(other)\n self.class == other.class && value == other.value\n end",
"def ===(other)\n case other\n when Date\n @days.include? Date.jd(other.jd) #in case it's a DateTime\n when Time\n @days.include? Date.civil(other.year, other.month, other.day)\n else\n super\n end\n end",
"def ==(other)\n `return self.valueOf() === other.valueOf() ? Qtrue : Qfalse;`\n end",
"def ==(other)\n `return self.valueOf() === other.valueOf() ? Qtrue : Qfalse;`\n end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n admin_flag == o.admin_flag &&\n allow_expenses_entered_against_companies_flag == o.allow_expenses_entered_against_companies_flag &&\n allow_in_cell_entry_on_time_sheet == o.allow_in_cell_entry_on_time_sheet &&\n billable_forecast == o.billable_forecast &&\n calendar == o.calendar &&\n calendar_sync_integration_flag == o.calendar_sync_integration_flag &&\n country == o.country &&\n daily_capacity == o.daily_capacity &&\n days_tolerance == o.days_tolerance &&\n default_department_id == o.default_department_id &&\n default_email == o.default_email &&\n default_location_id == o.default_location_id &&\n default_phone == o.default_phone &&\n disable_online_flag == o.disable_online_flag &&\n enable_ldap_authentication_flag == o.enable_ldap_authentication_flag &&\n enable_mobile_flag == o.enable_mobile_flag &&\n enable_mobile_gps_flag == o.enable_mobile_gps_flag &&\n enter_time_against_company_flag == o.enter_time_against_company_flag &&\n expense_approver == o.expense_approver &&\n first_name == o.first_name &&\n hide_member_in_dispatch_portal_flag == o.hide_member_in_dispatch_portal_flag &&\n hire_date == o.hire_date &&\n home_email == o.home_email &&\n home_extension == o.home_extension &&\n home_phone == o.home_phone &&\n hourly_cost == o.hourly_cost &&\n hourly_rate == o.hourly_rate &&\n id == o.id &&\n identifier == o.identifier &&\n inactive_date == o.inactive_date &&\n inactive_flag == o.inactive_flag &&\n include_in_utilization_reporting_flag == o.include_in_utilization_reporting_flag &&\n last_login == o.last_login &&\n last_name == o.last_name &&\n license_class == o.license_class &&\n mapi_name == o.mapi_name &&\n middle_initial == o.middle_initial &&\n minimum_hours == o.minimum_hours &&\n mobile_email == o.mobile_email &&\n mobile_extension == o.mobile_extension &&\n mobile_phone == o.mobile_phone &&\n notes == o.notes &&\n office_email == o.office_email &&\n office_extension == o.office_extension &&\n office_phone == o.office_phone &&\n project_default_board == o.project_default_board &&\n project_default_department_id == o.project_default_department_id &&\n project_default_location_id == o.project_default_location_id &&\n reports_to == o.reports_to &&\n require_expense_entry_flag == o.require_expense_entry_flag &&\n require_start_and_end_time_on_time_entry_flag == o.require_start_and_end_time_on_time_entry_flag &&\n require_time_sheet_entry_flag == o.require_time_sheet_entry_flag &&\n restrict_default_sales_territory_flag == o.restrict_default_sales_territory_flag &&\n restrict_default_warehouse_bin_flag == o.restrict_default_warehouse_bin_flag &&\n restrict_default_warehouse_flag == o.restrict_default_warehouse_flag &&\n restrict_department_flag == o.restrict_department_flag &&\n restrict_location_flag == o.restrict_location_flag &&\n restrict_project_default_department_flag == o.restrict_project_default_department_flag &&\n restrict_project_default_location_flag == o.restrict_project_default_location_flag &&\n restrict_schedule_flag == o.restrict_schedule_flag &&\n restrict_service_default_department_flag == o.restrict_service_default_department_flag &&\n restrict_service_default_location_flag == o.restrict_service_default_location_flag &&\n sales_default_location_id == o.sales_default_location_id &&\n schedule_capacity == o.schedule_capacity &&\n schedule_default_department_id == o.schedule_default_department_id &&\n schedule_default_location_id == o.schedule_default_location_id &&\n security_level == o.security_level &&\n security_location_id == o.security_location_id &&\n security_role == o.security_role &&\n service_default_board == o.service_default_board &&\n service_default_department_id == o.service_default_department_id &&\n service_default_location_id == o.service_default_location_id &&\n service_location == o.service_location &&\n service_teams == o.service_teams &&\n time_approver == o.time_approver &&\n time_reminder_email_flag == o.time_reminder_email_flag &&\n time_sheet_start_date == o.time_sheet_start_date &&\n time_zone == o.time_zone &&\n title == o.title &&\n type == o.type &&\n vendor_number == o.vendor_number &&\n warehouse == o.warehouse &&\n warehouse_bin == o.warehouse_bin &&\n work_role == o.work_role &&\n work_type == o.work_type &&\n _info == o._info &&\n system_flag == o.system_flag\n end",
"def eql?(ct); end",
"def eql?(ct); end",
"def == other\n @avi == other.avi\n end",
"def eql?(other)\n return false unless other.class == Gregorian\n return (@year.eql? other.year) &&\n (@month.eql? other.month) &&\n (@day.eql? other.day)\n end",
"def eql?(p0) end",
"def eql?(p0) end",
"def eql?(p0) end",
"def eql?(p0) end",
"def eql?(p0) end",
"def eql?(p0) end",
"def eql?(p0) end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n account_esign_id == o.account_esign_id &&\n allow_cd_withdraw == o.allow_cd_withdraw &&\n allow_cd_withdraw_metadata == o.allow_cd_withdraw_metadata &&\n change_email == o.change_email &&\n change_email_other == o.change_email_other &&\n company_name == o.company_name &&\n company_phone == o.company_phone &&\n copy_cost_per_page == o.copy_cost_per_page &&\n copy_fee_collection_method == o.copy_fee_collection_method &&\n copy_request_email == o.copy_request_email &&\n custom == o.custom &&\n enable_esign == o.enable_esign &&\n esign_agreement == o.esign_agreement &&\n esign_text == o.esign_text &&\n language_code == o.language_code &&\n must_agree_to_esign == o.must_agree_to_esign &&\n pdf_id == o.pdf_id &&\n use_brand == o.use_brand &&\n use_consumer_disclosure_within_account == o.use_consumer_disclosure_within_account &&\n use_consumer_disclosure_within_account_metadata == o.use_consumer_disclosure_within_account_metadata &&\n withdraw_address_line1 == o.withdraw_address_line1 &&\n withdraw_address_line2 == o.withdraw_address_line2 &&\n withdraw_by_email == o.withdraw_by_email &&\n withdraw_by_mail == o.withdraw_by_mail &&\n withdraw_by_phone == o.withdraw_by_phone &&\n withdraw_city == o.withdraw_city &&\n withdraw_consequences == o.withdraw_consequences &&\n withdraw_email == o.withdraw_email &&\n withdraw_other == o.withdraw_other &&\n withdraw_phone == o.withdraw_phone &&\n withdraw_postal_code == o.withdraw_postal_code &&\n withdraw_state == o.withdraw_state\n end",
"def eql?(other)\n self.suit == other.suit && self.value == other.value\n end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n registration_number == o.registration_number &&\n tax_status == o.tax_status &&\n tax_due_date == o.tax_due_date &&\n art_end_date == o.art_end_date &&\n mot_status == o.mot_status &&\n mot_expiry_date == o.mot_expiry_date &&\n make == o.make &&\n month_of_first_dvla_registration == o.month_of_first_dvla_registration &&\n month_of_first_registration == o.month_of_first_registration &&\n year_of_manufacture == o.year_of_manufacture &&\n engine_capacity == o.engine_capacity &&\n co2_emissions == o.co2_emissions &&\n fuel_type == o.fuel_type &&\n marked_for_export == o.marked_for_export &&\n colour == o.colour &&\n type_approval == o.type_approval &&\n wheelplan == o.wheelplan &&\n revenue_weight == o.revenue_weight &&\n real_driving_emissions == o.real_driving_emissions &&\n date_of_last_v5_c_issued == o.date_of_last_v5_c_issued &&\n euro_status == o.euro_status\n end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n id == o.id &&\n rfc == o.rfc &&\n legal_name == o.legal_name &&\n commercial_name == o.commercial_name &&\n credit_days == o.credit_days &&\n credit_amount == o.credit_amount &&\n payment_method == o.payment_method &&\n creation_date == o.creation_date &&\n status == o.status &&\n sales_contact == o.sales_contact &&\n credit_contact == o.credit_contact &&\n loctaion == o.loctaion &&\n comments == o.comments &&\n price_list == o.price_list &&\n payment_term_type == o.payment_term_type &&\n email == o.email &&\n telephones == o.telephones &&\n number == o.number &&\n account_number == o.account_number &&\n default_discount == o.default_discount &&\n client_source == o.client_source &&\n account == o.account &&\n addresses == o.addresses\n end",
"def ===(other)\n if other.is_a?(right_class)\n value === other.value\n else\n super\n end\n end",
"def ==(other)\n return false if other.class != self.class\n if @type != other.type ||\n @name != other.name ||\n @container != other.container ||\n !(@injury == other.injury)\n return false\n end\n return true\n end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n mandate_id == o.mandate_id &&\n title == o.title &&\n legal_informations == o.legal_informations &&\n unique_mandate_reference == o.unique_mandate_reference &&\n mandate_status == o.mandate_status &&\n user_id == o.user_id &&\n debtor_name == o.debtor_name &&\n debtor_address == o.debtor_address &&\n debtor_city == o.debtor_city &&\n debtor_zip_code == o.debtor_zip_code &&\n debtor_country == o.debtor_country &&\n debtor_iban == o.debtor_iban &&\n debtor_bic == o.debtor_bic &&\n sequence_type == o.sequence_type &&\n creditor_name == o.creditor_name &&\n sepa_creditor_identifier == o.sepa_creditor_identifier &&\n creditor_address == o.creditor_address &&\n creditor_city == o.creditor_city &&\n creditor_zip_code == o.creditor_zip_code &&\n creditor_country == o.creditor_country &&\n signature_date == o.signature_date &&\n debtor_signature_ip == o.debtor_signature_ip &&\n signed == o.signed &&\n debtor_identification_code == o.debtor_identification_code &&\n debtor_reference_party_name == o.debtor_reference_party_name &&\n debtor_reference_identification_code == o.debtor_reference_identification_code &&\n creditor_reference_party_name == o.creditor_reference_party_name &&\n creditor_reference_identification_code == o.creditor_reference_identification_code &&\n contract_identification_number == o.contract_identification_number &&\n contract_description == o.contract_description &&\n is_paper == o.is_paper &&\n sdd_type == o.sdd_type &&\n revocation_signature_date == o.revocation_signature_date &&\n created_ip == o.created_ip &&\n created_date == o.created_date &&\n modified_date == o.modified_date &&\n user_id_ultimate_creditor == o.user_id_ultimate_creditor\n end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n tire_pressure == o.tire_pressure &&\n rim == o.rim &&\n rim_diameter == o.rim_diameter &&\n rim_width == o.rim_width &&\n rim_offset == o.rim_offset &&\n tire == o.tire &&\n tire_sizing_system == o.tire_sizing_system &&\n tire_construction == o.tire_construction &&\n tire_width == o.tire_width &&\n tire_aspect_ratio == o.tire_aspect_ratio &&\n tire_diameter == o.tire_diameter &&\n tire_section_width == o.tire_section_width &&\n tire_is_82series == o.tire_is_82series &&\n load_index == o.load_index &&\n speed_index == o.speed_index\n end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n ref == o.ref &&\n from == o.from &&\n to == o.to &&\n chg == o.chg &&\n line == o.line &&\n loc == o.loc &&\n min == o.min &&\n sale == o.sale &&\n plsp == o.plsp &&\n incl == o.incl &&\n pror == o.pror &&\n proadj == o.proadj &&\n tran == o.tran &&\n serv == o.serv &&\n dbt == o.dbt &&\n adj == o.adj &&\n adjm == o.adjm &&\n disc == o.disc &&\n opt == o.opt &&\n prop == o.prop &&\n bill == o.bill &&\n cust == o.cust &&\n lfln == o.lfln &&\n date == o.date &&\n qty == o.qty &&\n glref == o.glref\n end",
"def === obj\n #This is a stub, used for indexing\n end",
"def eql?(other)\n super\n end",
"def eql?(other)\n super\n end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n objective == o.objective &&\n property_types == o.property_types &&\n status == o.status &&\n sale_mode == o.sale_mode &&\n channel == o.channel &&\n address_parts == o.address_parts &&\n advertiser_identifiers == o.advertiser_identifiers &&\n apm_identifiers == o.apm_identifiers &&\n bathrooms == o.bathrooms &&\n bedrooms == o.bedrooms &&\n building_area == o.building_area &&\n building_area_sqm == o.building_area_sqm &&\n carspaces == o.carspaces &&\n date_available == o.date_available &&\n date_created == o.date_created &&\n date_updated == o.date_updated &&\n date_minor_updated == o.date_minor_updated &&\n date_listed == o.date_listed &&\n date_purged == o.date_purged &&\n description == o.description &&\n dev_project_id == o.dev_project_id &&\n energy_efficiency_rating == o.energy_efficiency_rating &&\n features == o.features &&\n geo_location == o.geo_location &&\n headline == o.headline &&\n id == o.id &&\n inspection_details == o.inspection_details &&\n is_new_development == o.is_new_development &&\n land_area == o.land_area &&\n land_area_sqm == o.land_area_sqm &&\n media == o.media &&\n price_details == o.price_details &&\n property_id == o.property_id &&\n provider_details == o.provider_details &&\n rental_details == o.rental_details &&\n sale_details == o.sale_details &&\n is_withdrawn == o.is_withdrawn &&\n seo_url == o.seo_url &&\n error_message == o.error_message &&\n virtual_tour_url == o.virtual_tour_url &&\n homepass_enabled == o.homepass_enabled &&\n statement_of_information == o.statement_of_information &&\n number_of_dwellings == o.number_of_dwellings &&\n highlights == o.highlights\n end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n id == o.id &&\n type == o.type &&\n state == o.state &&\n country == o.country &&\n street == o.street &&\n postal_code == o.postal_code &&\n city == o.city &&\n phone_country == o.phone_country &&\n phone_number == o.phone_number &&\n email == o.email &&\n ip == o.ip &&\n address_description == o.address_description &&\n identification_number == o.identification_number &&\n identification_type == o.identification_type &&\n lang == o.lang &&\n name == o.name &&\n first_name == o.first_name &&\n middle_name == o.middle_name &&\n last_name == o.last_name &&\n birth_date == o.birth_date &&\n occupation == o.occupation &&\n nationality == o.nationality &&\n legal_entity_type == o.legal_entity_type &&\n registration_date == o.registration_date &&\n registration_number == o.registration_number &&\n nature_of_business == o.nature_of_business &&\n source_of_funds == o.source_of_funds &&\n custom_source_of_funds == o.custom_source_of_funds &&\n core_business_activity == o.core_business_activity &&\n purpose_of_opening_account == o.purpose_of_opening_account &&\n office_phone == o.office_phone &&\n vat_registration_number == o.vat_registration_number &&\n financial_regulator == o.financial_regulator &&\n regulatory_licence_number == o.regulatory_licence_number &&\n contact_person_email == o.contact_person_email &&\n trading_country == o.trading_country &&\n trading_address == o.trading_address &&\n trading_name == o.trading_name &&\n number_monthly_transactions == o.number_monthly_transactions &&\n amount_monthly_transactions == o.amount_monthly_transactions &&\n documents == o.documents &&\n metadata == o.metadata &&\n errors == o.errors &&\n onboarding_status == o.onboarding_status &&\n politically_exposed_people == o.politically_exposed_people &&\n external_id == o.external_id &&\n city_of_birth == o.city_of_birth &&\n country_of_birth == o.country_of_birth &&\n gender == o.gender &&\n sales_lead_id == o.sales_lead_id &&\n created_at == o.created_at &&\n company_office_number == o.company_office_number &&\n company_office_number_country == o.company_office_number_country &&\n aml_officer_email == o.aml_officer_email &&\n aml_officer_phone == o.aml_officer_phone &&\n aml_officer_phone_country == o.aml_officer_phone_country &&\n company_website_url == o.company_website_url &&\n number_of_employees_in_company == o.number_of_employees_in_company &&\n list_of_countries_of_operation == o.list_of_countries_of_operation &&\n estimated_annual_revenue_turnover == o.estimated_annual_revenue_turnover &&\n declaration == o.declaration\n end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n id == o.id &&\n alternate_id == o.alternate_id &&\n type == o.type &&\n first_name == o.first_name &&\n surname == o.surname &&\n date_of_brith == o.date_of_brith &&\n date_of_birth == o.date_of_birth &&\n shipping_address == o.shipping_address &&\n mailing_address == o.mailing_address &&\n home_phone == o.home_phone &&\n mobile_phone == o.mobile_phone &&\n email_address == o.email_address &&\n mailing_address_active == o.mailing_address_active &&\n accounts == o.accounts &&\n classifications == o.classifications &&\n member_photo == o.member_photo &&\n gender == o.gender &&\n receive_email == o.receive_email &&\n receive_sms == o.receive_sms &&\n password == o.password\n end",
"def ==(o)\n return true if equal?(0)\n\n begin\n return o.value == @value && o.suit == @suit\n rescue Exception => ex\n return false\n end\n end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n bin_commercial == o.bin_commercial &&\n bin_corporate == o.bin_corporate &&\n bin_country_issued == o.bin_country_issued &&\n bin_credit == o.bin_credit &&\n bin_currency == o.bin_currency &&\n bin_debit == o.bin_debit &&\n bin_description == o.bin_description &&\n bin_eu == o.bin_eu &&\n card_id == o.card_id &&\n card_status == o.card_status &&\n default == o.default &&\n expmonth == o.expmonth &&\n expyear == o.expyear &&\n label == o.label &&\n label2 == o.label2 &&\n last4digits == o.last4digits &&\n scheme == o.scheme &&\n token == o.token\n end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n occurred_at == o.occurred_at &&\n carrier_occurred_at == o.carrier_occurred_at &&\n description == o.description &&\n city_locality == o.city_locality &&\n state_province == o.state_province &&\n postal_code == o.postal_code &&\n country_code == o.country_code &&\n company_name == o.company_name &&\n signer == o.signer &&\n event_code == o.event_code &&\n latitude == o.latitude &&\n longitude == o.longitude\n end",
"def bt_same_value?(other)\n bt_value_attributes == other.bt_value_attributes\n end",
"def ==(other)\n\t\t# verifica que el segundo argumento sea de la clase racional\n\t\tif other.instance_of? Racional\n\t\t\t@num == other.num && @denom == other.denom\n\t\telse\n\t\t\tfalse\n\t\tend\n\tend",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n subject_property == o.subject_property &&\n proprietorship == o.proprietorship &&\n surname == o.surname &&\n forename == o.forename &&\n middle_name == o.middle_name &&\n all_names == o.all_names &&\n historical_match == o.historical_match\n end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n address_format == o.address_format &&\n address_format_metadata == o.address_format_metadata &&\n allow_region == o.allow_region &&\n calendar_type == o.calendar_type &&\n calendar_type_metadata == o.calendar_type_metadata &&\n culture_name == o.culture_name &&\n culture_name_metadata == o.culture_name_metadata &&\n currency_code == o.currency_code &&\n currency_code_metadata == o.currency_code_metadata &&\n currency_negative_format == o.currency_negative_format &&\n currency_negative_format_metadata == o.currency_negative_format_metadata &&\n currency_positive_format == o.currency_positive_format &&\n currency_positive_format_metadata == o.currency_positive_format_metadata &&\n custom_date_format == o.custom_date_format &&\n custom_sign_date_format == o.custom_sign_date_format &&\n custom_sign_time_format == o.custom_sign_time_format &&\n custom_time_format == o.custom_time_format &&\n date_format == o.date_format &&\n date_format_metadata == o.date_format_metadata &&\n effective_address_format == o.effective_address_format &&\n effective_calendar_type == o.effective_calendar_type &&\n effective_currency_code == o.effective_currency_code &&\n effective_currency_negative_format == o.effective_currency_negative_format &&\n effective_currency_positive_format == o.effective_currency_positive_format &&\n effective_custom_date_format == o.effective_custom_date_format &&\n effective_custom_time_format == o.effective_custom_time_format &&\n effective_date_format == o.effective_date_format &&\n effective_initial_format == o.effective_initial_format &&\n effective_name_format == o.effective_name_format &&\n effective_time_format == o.effective_time_format &&\n effective_time_zone == o.effective_time_zone &&\n initial_format == o.initial_format &&\n initial_format_metadata == o.initial_format_metadata &&\n name_format == o.name_format &&\n name_format_metadata == o.name_format_metadata &&\n sign_date_format == o.sign_date_format &&\n sign_date_format_metadata == o.sign_date_format_metadata &&\n sign_time_format == o.sign_time_format &&\n sign_time_format_metadata == o.sign_time_format_metadata &&\n time_format == o.time_format &&\n time_format_metadata == o.time_format_metadata &&\n time_zone == o.time_zone &&\n time_zone_metadata == o.time_zone_metadata\n end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n airline_data == o.airline_data &&\n amount == o.amount &&\n avs_postcode_policy == o.avs_postcode_policy &&\n bill_to == o.bill_to &&\n card_holder_name == o.card_holder_name &&\n cardnumber == o.cardnumber &&\n csc == o.csc &&\n csc_policy == o.csc_policy &&\n currency == o.currency &&\n duplicate_policy == o.duplicate_policy &&\n expmonth == o.expmonth &&\n expyear == o.expyear &&\n external_mpi == o.external_mpi &&\n identifier == o.identifier &&\n match_avsa == o.match_avsa &&\n mcc6012 == o.mcc6012 &&\n merchantid == o.merchantid &&\n sdk == o.sdk &&\n ship_to == o.ship_to &&\n threedsecure == o.threedsecure &&\n trans_info == o.trans_info &&\n trans_type == o.trans_type\n end",
"def eql?(other)\n\t if other.zero?\n\t\[email protected]?\n\t elsif other.respond_to?(:units)\n\t\tif other.respond_to? :value\n\t\t @units.eql?(other.units) and @value.eql?(other.value)\n\t\telse\n\t\t other == self\n\t\tend\n\t else\n\t\[email protected]? and @value.eql?(other)\n\t end\n\tend",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n id == o.id &&\n name == o.name &&\n based_on == o.based_on &&\n custom_calendar == o.custom_calendar &&\n default_flag == o.default_flag &&\n application_order == o.application_order &&\n hi_impact_hi_urgency == o.hi_impact_hi_urgency &&\n hi_impact_med_urgency == o.hi_impact_med_urgency &&\n hi_impact_low_urgency == o.hi_impact_low_urgency &&\n med_impact_hi_urgency == o.med_impact_hi_urgency &&\n med_impact_med_urgency == o.med_impact_med_urgency &&\n med_impact_low_urgency == o.med_impact_low_urgency &&\n low_impact_hi_urgency == o.low_impact_hi_urgency &&\n low_impact_med_urgency == o.low_impact_med_urgency &&\n low_impact_low_urgency == o.low_impact_low_urgency &&\n respond_hours == o.respond_hours &&\n respond_percent == o.respond_percent &&\n plan_within == o.plan_within &&\n plan_within_percent == o.plan_within_percent &&\n resolution_hours == o.resolution_hours &&\n resolution_percent == o.resolution_percent &&\n _info == o._info\n end",
"def ==(other); end",
"def ==(other); end",
"def ==(other); end"
] | [
"0.62252355",
"0.6120797",
"0.5972296",
"0.5939234",
"0.5834948",
"0.57861185",
"0.5761977",
"0.57472473",
"0.573988",
"0.571628",
"0.5713358",
"0.57033587",
"0.56807",
"0.56793153",
"0.5670396",
"0.5669838",
"0.56670463",
"0.5642039",
"0.563208",
"0.56291735",
"0.56270826",
"0.5593709",
"0.5593709",
"0.55890256",
"0.55878997",
"0.5580878",
"0.5574628",
"0.55716354",
"0.5569375",
"0.5565233",
"0.55479175",
"0.554089",
"0.55399895",
"0.55251324",
"0.55154127",
"0.5504464",
"0.55005246",
"0.54977256",
"0.54956216",
"0.54869115",
"0.548138",
"0.5479161",
"0.54726857",
"0.5472296",
"0.54711187",
"0.54679203",
"0.54674155",
"0.5464161",
"0.5464161",
"0.5460682",
"0.5460682",
"0.5454562",
"0.54368675",
"0.54319113",
"0.54309064",
"0.5429287",
"0.54271686",
"0.54271686",
"0.54237205",
"0.5423013",
"0.5423013",
"0.5419816",
"0.5417128",
"0.5417128",
"0.5415006",
"0.5413136",
"0.5412419",
"0.5412419",
"0.5412419",
"0.5412419",
"0.5412051",
"0.5412051",
"0.5412051",
"0.5410801",
"0.54050124",
"0.5402581",
"0.5402171",
"0.5396226",
"0.5388894",
"0.53822523",
"0.537949",
"0.53736866",
"0.5373671",
"0.536883",
"0.536883",
"0.5367071",
"0.5366324",
"0.536524",
"0.5363989",
"0.5362911",
"0.5362566",
"0.53608763",
"0.5359305",
"0.5354506",
"0.5352771",
"0.53520316",
"0.5348576",
"0.53454053",
"0.5345243",
"0.5345243",
"0.5345243"
] | 0.0 | -1 |
Create an association between the trackgroup and an existing account | def create
@account = Account.find(params[:account][:id])
@trackgroup.accounts << @account
redirect_to account_path(:region => @account.region, :idLoL => @account.idLoL)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def createAPI\n \n idLoL = LOL_WRAPPER.get_summoner_id(params[:accname], params[:region])\n #Find the summoner with the corresponding id and region\n @summoner = LOL_WRAPPER.get_summoner_by_id(idLoL, params[:region])\n \n #Create or update the corresponding account in our database\n if Account.exists?(:idLoL => idLoL)\n @account = Account.find_by_idLoL(idLoL)\n @account.pseudoLoL = @summoner.name\n @account.save\n else\n @account = Account.new(idLoL: idLoL, region: params[:region], pseudoLoL: @summoner.name)\n @account.save\n end\n\n @trackgroup.accounts << @account\n redirect_to(:back)\n \n end",
"def add_to_group(group)\n self.memberships.create(group_id: group.id)\n end",
"def create\n \t@group = Group.new(group_params)\n @group.associations.build(user_id: session[:user_id] ) \n if @group.save\n \t redirect_to groups_path\n else \n render groups_path\n end\n end",
"def setup_accounts\n self.accounts.create({:name => \"Checking\"})\n self.accounts.create({:name => \"Savings\"})\n end",
"def add_account(account)\n @accounts[account.id] = account\n end",
"def create_account\n account = Account.create(name: \"#{full_name}'s Portfolio\")\n account.collaborators << self\n end",
"def create\n @user.create_group!(new_group_params[:group_user_ids], {name: new_group_params[:name]})\n end",
"def group_join!(group)\n affiliations.create!( :group_id => group.id )\n end",
"def create_account\n\n end",
"def create_account\n set_user\n set_payer\n set_user_sport\n save_account\n end",
"def add_account\n # make sure a second confirmation email is not sent\n skip_reconfirmation!\n\n # update before setting the account_id\n update_profile_email\n\n update_attribute(:account_id, Account.current.id)\n ensure_site_profile_exists\n end",
"def create_accounts\n end",
"def new_playgroup(db, name, kids, address)\r\n\t\tdb.execute(\"INSERT INTO playgroups (name, kids, address) VALUES (?,?,?)\", [name, kids, address])\r\n\tend",
"def create_account\n if new_record? && !self.account_id\n account = Account.new\n account.name = \"Preecha o nome da sua empresa\"\n account.save\n self.account_id = account.id\n self.admin = true\n end\n end",
"def create_associations\n self.associates.each do |associate|\n self.add_associated(associate)\n end\n end",
"def group_add(client, options)\n if options[:group].nil? or options[:email].nil?\n puts \"Missing arguments\"\n return\n end\n\n group = client.groups.get options[:group]\n account = get_account(client, options)\n\n if account.nil? or group.nil?\n puts \"Account or group not found\"\n return\n end\n\n account.add_group group\n puts \"Account added to group.\"\nend",
"def create_account(lead)\n Account.create({\n company_id: lead.company_id,\n user_id: lead.user_id\n })\n end",
"def create_association(obj, type)\n @logger.info(\"Creating association for #{type} #{obj.name}\")\n case type\n when \"agent\"\n iso = find_sugarcrm_object('iso', 'sf_id', obj.sf_iso)\n obj.associate! iso if iso\n when \"merchant\"\n \n payment_method_id = find_payment_method_id(obj.sf_id)\n if payment_method_id\n payment_method = find_sugarcrm_object('payment_method', 'sf_id', payment_method_id)\n obj.associate! payment_method\n end\n \n email_id = find_email_id(obj.sf_id)\n if email_id\n email = find_sugarcrm_object('email', 'sf_id', email_id)\n obj.associate! email\n end\n \n agent = find_sugarcrm_object('agent', 'sf_id', obj.sf_agent)\n if agent\n obj.associate! agent\n obj.assigned_user_id = agent.assigned_user_id\n end\n \n when \"settlement_bank_account\"\n merchant = find_sugarcrm_object('merchant', 'sf_id', obj.sf_merchant)\n obj.associate! merchant if merchant\n end\n obj\n end",
"def create_account\n account = Account.new(:email => email, :subdomain => subdomain)\n account.save!\n end",
"def createGroup\n call :createGroup\n end",
"def create\n megam_rest.post_accounts(to_hash)\n end",
"def add_group_member\n @group_member = RockGroupMember.find_or_initialize_by({\n GroupId: @group_id,\n PersonId: person.mapped_record.person_alias.PersonId\n })\n @group_member.IsSystem = false\n @group_member.GroupRoleId = 266 # member for worship services\n @group_member.GroupMemberStatus = 1 #\n @group_member.Guid = SecureRandom.uuid\n @group_member.CreatedDateTime = Time.new\n @group_member.Note = 'Imported From Arena'\n\n @group_member.save!\n end",
"def add_account\n update_attribute(:account_id, Account.current.id)\n end",
"def group_create(group_name:, trace: false)\n group_query = \"{\\\"group_name\\\":\\\"#{group_name}\\\",\\\"group_external_id\\\":\\\"#{group_name}\\\",\\\"group_management_type\\\":{\\\".tag\\\":\\\"company_managed\\\"}}\"\n dropbox_query(query: '2/team/groups/create', query_data: group_query, trace: trace)\n end",
"def create_initial_account_and_profile!\n account = accounts.create!(name: I18n.t('.default.account.name'))\n profiles.create!(name: I18n.t('.default.profile.name'), account_id: account.id)\n end",
"def after_create\n super\n create_account\n end",
"def after_create entity_group\n ueg=entity_group.user_entity_groups.build\n ueg.user=entity_group.creator\n ueg.save\n end",
"def create\n #TODO validate that the params[:id] is a legal value for user\n @group = Group.find(params[:group_id])\n authorize! :edit, @group\n Hydra::LDAP.add_users_to_group(@group.code, [params[:id]])\n redirect_to edit_group_path(@group), :notice=>\"Added member #{params[:id]}\"\n end",
"def generate_account\n self.account = Account.create(:name => self.email) unless account\n end",
"def create_admin_account\n account = Account.create!\n self.account = account\n self.account_owner = true\n end",
"def assign_account(account_id)\n self.account_id = account_id\n end",
"def create(body = {})\n @client.account.create(body)\n end",
"def create\n @account = @project.accounts.build(account_params)\n\n respond_to do |format|\n if @account.save\n format.html { redirect_to @account, notice: 'Account was successfully created.' }\n format.json { render :show, status: :created, location: @account }\n else\n @record = [@project, @account]\n format.html { render :new }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @group = Group.new(group_params)\n @group.group_users.build user_type: 'Group Owner', user_id: @current_user.id\n @group.share_id = Array.new(8){rand(36).to_s(36)}.join\n\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render :show, status: :created, location: @group }\n else\n format.html { render :new }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_group(attributes)\n BrickFTP::API::Group.create(attributes)\n end",
"def create_group(attributes)\n BrickFTP::API::Group.create(attributes)\n end",
"def create\n @user_accounts_group = UserAccountsGroup.new(user_accounts_group_params)\n\n respond_to do |format|\n if @user_accounts_group.save\n format.html { redirect_to @user_accounts_group, notice: 'User accounts group was successfully created.' }\n format.json { render :show, status: :created, location: @user_accounts_group }\n else\n format.html { render :new }\n format.json { render json: @user_accounts_group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new_account(name)\n account(name)\n end",
"def add_group!( group )\n save if add_group( group )\n end",
"def channel_account_for(channel)\n ca = ChannelAccount.new(:user_id => id, :channel_id => channel.id)\n ca.save\n self.channel_accounts << ca\n end",
"def create_entity_group\n @entity_group = EntityGroup.create!(client_id: @client_id,\n uuid: Util::Encryption::Admin.get_uuid,\n creator_admin_id: @admin_id,\n status: GlobalConstant::EntityGroup.active_status,\n activated_at: Time.now.to_i)\n end",
"def create\n cu = User.find params[:user_id]\n\n @group = Group.new(params[:group])\n cu.groups << @group\n\n case params[:group_type].to_i\n when 1\n @group.groupable = ArtistGroup.create\n\n if defined?(params[:instr_id]) && (not params[:instr_id].nil?)\n m = Membership.where \"group_id = #{@group.id}\n AND userable_id = #{cu.id}\n AND userable_type = 'User'\"\n params[:instr_id].each do |i|\n m.first.instruments << Instrument.find(i)\n end\n end\n when 2\n @group.groupable = FanGroup.create :artist_group => ArtistGroup.find(params[:art_group_id].to_i)\n when 3\n @group.groupable = HostGroup.create\n end\n\n\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Die Gruppe wurde erfolgreich angelegt.' }\n format.json { render json: @group, status: :created, location: @group }\n else\n format.html { render action: \"new\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_account\n Finance::Account.create.save\n @account = Finance::Account.first\n end",
"def create\n @group = Group.new(params[:group])\n\n #here we add the current user to the membership collection of the group\n @membership = @group.memberships.build(params[:membership])\n @membership.group = @group\n @membership.user = current_user\n @membership.initiator = false\n @membership.membership_status_id = 2\n \n #and here we set the current_user as the owner of the group\n @group_permission = @group.group_permissions.build(params[:group_permission])\n @group_permission.membership = @membership\n @group_permission.group_role = GroupRole.find_by_name('Owner')\n \n @group.metro_area = MetroArea.find(params[:metro_area_id])\n @group.state = (@group.metro_area && @group.metro_area.state) ? @group.metro_area.state : nil\n @group.country = @group.metro_area.country if (@group.metro_area && @group.metro_area.country)\n\n \n #current_user.track_activity(:created_a_group)\n \n# unless @user.is_in_group?(@group)\n# @user.memberships << @group\n# end\n\n respond_to do |format|\n if @group.save\n flash[:notice] = 'Group was successfully created.'\n format.html { redirect_to(@group) }\n format.xml { render :xml => @group, :status => :created, :location => @group }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n \n end",
"def add_association(current_user)\n self.associate(current_user)\n 'New Oauth provider added'\n end",
"def new_account=(account)\n @new_account = self.account_ids.include?(account.id) ? nil : account\n end",
"def create\n @contact_group = ContactGroup.new(params[:contact_group])\n @contact_group.user_id = current_user.id\n @contact_group.save\n end",
"def create\n @account = GmailAccount.new(params[:gmail_account])\n current_user.person.gmail_accounts << @account\n\n respond_to do |format|\n if @account.save\n format.html { redirect_to( accounts_path, :notice => 'Account was successfully created.') }\n format.json { render :json => @account, :status => :created, :location => @account }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @account.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create_organization_and_subscription_plan\n organization = Organization.create(\n name: \"My Organization\",\n subscription_plan_id: self.subscription_plan_id,\n time_zone: self.time_zone\n )\n\n organization_membership = organization.add_user(self)\n organization_membership.role = :owner\n organization_membership.save\n end",
"def create_account(name=nil)\n if(owned_accounts.empty?)\n if(default_identity)\n source = Source.find_or_create(:name => default_identity.provider)\n elsif(run_state.identity_provider)\n source = Source.find_or_create(:name => run_state.identity_provider)\n else\n source = Source.find_or_create(:name => 'internal')\n end\n add_owned_account(\n :name => name || username,\n :source_id => source.id\n )\n end\n end",
"def new\n UserGroup.new\n @cta = Cta.create({workflow_status: 0, pi_id: current_user.id})\n ci_relation = CtaRelation.new(name: 'ci', group_type: 2, cta_id: @cta.id)\n cci_relation = CtaRelation.new(name: 'cci', group_type: 2, cta_id: @cta.id)\n ci_relation.save\n cci_relation.save\n ci_relation.users << current_user\n ci_relation.save\n cci_relation.save\n redirect_to (@cta.add_form 'A'), action: :edit\n end",
"def link_account(provider, uid)\n self[provider.column.to_sym] = uid\n self.save\n end",
"def init_personal_group\n group = Group.new(_id: id, is_personal:true, name: email)\n group.save\n\n self.current_group = group\n groups << group\n end",
"def addUserToGroup(uid, groupId)\r\n uri = sprintf(\"/api/v1/groups/%d/memberships\", groupId)\r\n\t $canvas.post(uri, {'user_id' => uid})\r\nend",
"def addUserToGroup(uid, groupId)\r\n uri = sprintf(\"/api/v1/groups/%d/memberships\", groupId)\r\n\t $canvas.post(uri, {'user_id' => uid})\r\nend",
"def create( params )\n params.delete( :id ) # Prevent overwriting ID\n Account.new( params ).save\n end",
"def create\n @group = Group.find(params[:group][:id])\n if @group.valid?\n surveys = params[:group][:surveys] || []\n subscriptions = Subscription.for_center(@group)\n subscriptions.each do |sub|\n if surveys.include? sub.survey_id.to_s # in survey and in db\n sub.activate! unless sub.active?\n else # not in surveys, but in db, so deactivate\n sub.deactivate! unless sub.inactive?\n end\n surveys.delete sub.survey_id.to_s # remove already done subs\n end\n # elsif not exists in db, create new subscription\n surveys.each { |survey| @group.subscriptions.create(:center => @group, :survey_id => survey.to_i, :state => 1) }\n if @group.save\n flash[:notice] = \"Abonnementer for center #{@group.title} blev ændret.\"\n redirect_to center_path(@group)\n else\n flash[:error] = \"Kunne ikke oprette abonnement: #{@group.errors.map &:inspect}\"\n redirect_to new_subscription_path(@group)\n end\n else\n flash[:error] = \"Der er en fejl i centerets oplysninger. Check centerets kode (skal være 4 cifre).\"\n redirect_to edit_center_path(@group)\n end\n end",
"def create_account_options\n AccountOption.create!(:user => self)\n end",
"def link(contact)\n contact.accounts << self\n contact.owner = self if contact.owner.nil?\n contact.save\n end",
"def create\n\n group = Group.create(group_parm.merge(account_id: current_user.id)) #group creater current user will be the admin of group\n if group.save!\n render :json => Base64.encode64(group.id.to_s) and return\n else\t\t \n render :json => group.errors.full_messages.first and return\n end \n end",
"def set_user_accounts_group\n @user_accounts_group = UserAccountsGroup.find(params[:id])\n end",
"def set_agroup\r\n @agroup = Agroup.find(params[:id])\r\n end",
"def create\n @subscription = Subscription.create(params[:subscription])\n groups = params[:subscription][:group_name].split(\",\").collect(&:strip)\n email = params[:subscription][:email]\n begin\n gb = Gibbon::API.new(\"f24fdd53217fab0b0698fdaba15c0c6f-us7\")\n subscribe = gb.lists.subscribe({\n :id => \"caa152eac4\",\n :email => {:email => email},\n :merge_vars => {\n :FNAME => \"\",\n :LNAME => \"\",\n :groupings => {\n 0 => {\n :id => 4457,\n :groups => groups\n }\n }\n },\n :update_existing => true,\n :double_optin => false\n })\n #logger.debug subscribe\n rescue Gibbon::MailChimpError\n \n end\n redirect_to \"/contact\"\n end",
"def add_bank_account(name:, account_number:, routing_number:, category:, type:, **args)\n data = {\n type: 'ACH-US',\n info: {\n nickname: args[:nickname] || name,\n name_on_account: name,\n account_num: account_number,\n routing_num: routing_number,\n type: category,\n class: type\n },\n extra: {\n supp_id: args[:supp_id]\n }\n }\n nodes.create(data)\n end",
"def open_user_account\n Account.create(user_id: self.id) \t\n end",
"def add_omniauth(auth)\n self.authentications.find_or_create_by(\n provider: auth['provider'],\n uid: auth['uid'].to_s\n )\n end",
"def record_signup identifier,session_id,options={ },parent_user_id=nil\n options.merge! :signup => { :parent_user_id => parent_user_id} if parent_user_id\n options.merge! :user_profile => { :session_id => session_id , :user_id => identifier}\n record :signup,@iteration_number,identifier,options\n end",
"def create\n #authorize! :create, Account\n #@account = Account.new(params[:account])\n @account.email = current_user.email\n @account.description = current_user.email\n \n respond_to do |format|\n if @account.save\n m = @account.account_members.create( :email => current_user.email)\n m.user = current_user\n current_user.add_role :owner, @account\n if current_user.save && m.save\n flash[:new_account] = true \n format.html { redirect_to @account, notice: 'Account was successfully created.' }\n format.json { render json: @account, status: :created, location: @account }\n else \n format.html { render action: \"new\" }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n else\n format.html { render action: \"new\" }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def setup_google_group\n result = Gandalf::GoogleApiClient.insert_google_group({\n \"email\" => self.apps_email || self.set_apps_email,\n \"name\" => self.name,\n \"description\" => self.description\n })\n \n # Checks if a conflict exists in the database.\n if result.status == 409\n result = Gandalf::GoogleApiClient.get_google_group(self.apps_email)\n elsif result.status >= 400\n # Do some error handling...\n return false\n end\n # Set the apps_id and apps_email from the returned object.\n self.apps_id = result.data.id\n self.apps_email = result.data.email\n \n end",
"def create_membership\n member = Member.new(squad: @squad, user: current_user, membership: 'owner')\n member.save(validate: false)\n end",
"def after_create_account(user, auth)\n # not required\n end",
"def create\n @assign_group_place = AssignGroupPlace.new(assign_group_place_params)\n @assign_group_place.save\n end",
"def add_user(user)\n UserGroup.create(user_id: user.id, group_id: id)\n end",
"def create_group\n params[:new_members] = params[:participants]\n params[:new_admins] = params[:admin_ids]\n conversation = current_user.conversations.new(group_params)\n if conversation.save\n render_conversation(conversation)\n else\n render_error_model(conversation)\n end\n end",
"def create\n params[:cta][:workflow_status] = 0\n UserGroup.new\n @cta = Cta.new(params[:cta])\n ci_relation = CtaRelation.new(name: 'ci', group_type: 2, cta_id: @cta.id)\n cci_relation = CtaRelation.new(name: 'cci', group_type: 2, cta_id: @cta.id)\n ci_relation.save\n cci_relation.save\n params[:ci_users].each do |p|\n ci_relation.users << User.find(p)\n end\n params[:cci_users].each do |p|\n cci_relation.users << User.find(p)\n end\n ci_relation.save\n cci_relation.save\n\n respond_to do |format|\n if @cta.save\n format.html { redirect_to @cta, notice: 'Cta was successfully created.' }\n format.json { render json: @cta, status: :created, location: @cta }\n else\n format.html { render action: \"new\" }\n format.json { render json: @cta.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_owner_to_participants\n EventParticipant.create(user_id: self.user_id, event_id: self.id)\n end",
"def own!(owned)\r\n master_song_relationships.create!(:owned_id => owned.id)\r\n end",
"def create\n entity = Entity.find_by(id: group_params[:entity_id]) || not_found\n group = Group.new(\n group_name: \"#{entity.entity_name} Group\",\n entity_id: group_params[:entity_id],\n creator_id: current_user.id\n )\n if group.save\n group.entity.seatgeek_import if group.events.future.empty?\n group.join_group current_user, 'admin'\n flash.keep\n flash[:notice] = 'Group created!'\n redirect_to action: 'show', id: group.id\n else\n flash.keep\n flash[:error] = 'Group could not be created.'\n redirect_to action: 'new', entity_id: params[:entity_id]\n end\n end",
"def create\n @group = Group.new(group_params)\n if @group.save\n flash[:success] = \"Group created!\"\n current_user.join(@group)\n @group.promote_to_admin(current_user)\n redirect_to group_url(@group)\n else\n render 'new'\n end\n end",
"def create\n @user = User.find(current_user.id)\n @group = Group.new(group_params)\n\n @group.title = params[:title]\n @group.description = params[:description]\n @group.groupProfile = params[:groupProfile]\n @group.groupCover = params[:groupCover]\n\n respond_to do |format|\n if @group.save\n @user.groups << @group\n\n GroupCategory.new(group_id: @group.id , category_id: params[:category]).save\n\n format.html { redirect_to user_group_path(current_user.id, @group.id) }\n format.json { render :show, status: :created, location: @group }\n else\n format.html { render :new }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n omniauth = request.env['omniauth.auth']\n authentication = Authentication.find_by_provider_and_uid(omniauth['provider'], omniauth['uid'])\n if authentication\n flash[:notice] = \"Signed in successfully\"\n sign_in_and_redirect(:account, authentication.account)\n else\n user = Account.new(password: Devise.friendly_token) # If you create an account with twitter/fb, we don't need a passwod\n user.apply_omniauth(omniauth)\n user.email = get_email_from_omniauth omniauth\n if user.save\n flash[:notice] = \"Successfully registered\"\n sign_in_and_redirect(:account, user)\n else\n session[:omniauth] = omniauth.except('extra')\n session[:omniauth_email] = omniauth['extra'] && omniauth['extra']['user_hash'] && omniauth['extra']['user_hash']['email']\n\n # Check if email already taken. If so, ask user to link_accounts\n if user.errors[:email][0] =~ /has already been taken/ # omniauth? TBD\n # fetch the user with this email id!\n user = Account.find_by_email(user.email)\n return redirect_to link_accounts_url(user.id)\n end\n redirect_to new_account_registration_url\n end\n end\n end",
"def add_new_account(account)\n new_personal_account_modal.close_icon_element.click if new_personal_account_modal?\n clear_all_toasts\n add_account_button\n select_new_account(account)\n end",
"def create\n @event = Event.new(params[:event])\n @event.account_ids = (params[:non_members] ||{}).keys\n @event.accounts << account\n respond_to do |format|\n if @event.save\n format.html { redirect_to(events_url, :notice => \"Event #{@event.title} was successfully created.\") }\n format.xml { render :xml => @event, :status => :created, :location => @event }\n else\n setup_accounts\n format.html { render :action => \"new\" }\n format.xml { render :xml => @event.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @group = Group.new(params[:group])\n @group.users.push @current_user\n \n respond_to do |format|\n if @group.save\n @group.invite params[:invite_emails].split(',')\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render json: @group, status: :created, location: @group }\n else\n format.html { render action: \"new\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_wepay_account\n # if we don't have an access_token for this user, then we cannot make this call\n if self.has_wepay_account? then return false end\n # make the /account/create call\n response = WEPAY.call(\"/account/create\", self.wepay_access_token, {\n name: self.campaign.name,\n description: self.campaign.description,\n type: self.campaign.account_type,\n country: self.country,\n currencies: [ self.currency ],\n })\n if response['error'].present?\n raise response['error_description']\n end\n self.wepay_account_id = response['account_id']\n self.save\n end",
"def create\n params[:transfer][:occurred_on] = Time.strptime(params[:transfer][:occurred_on], \"%m/%d/%Y\") if params[:transfer][:occurred_on]\n @transfer = Transfer.new(params[:transfer])\n @transfer.user_id = current_user.id\n @transfer.group_id = @group.id\n\n @from_accounts = @group.accounts.includes(:owner).sort { |a,b| a.owner.display_name.downcase <=> b.owner.display_name.downcase }\n @to_accounts = @group.accounts.includes(:owner).sort { |a,b| a.owner.display_name.downcase <=> b.owner.display_name.downcase }\n\n if params[:from_account_id].present?\n @from_account = Account.find_by_id(params[:from_account_id])\n @transfer.from_account_id = params[:from_account_id]\n end\n if params[:to_account_id].present?\n @to_account = Account.find_by_id(params[:to_account_id])\n @transfer.to_account_id = params[:to_account_id]\n end\n\n respond_to do |format|\n if @transfer.save\n flash[:notice] = \"Transfer was created.\"\n format.html { redirect_to group_path(@group) }\n format.json { @transfer.errors }\n else\n format.html { render action: \"new\" }\n format.json { @transfer.errors }\n end\n end\n end",
"def create_follow\n user.follow_questions.create(question: self.question)\n end",
"def create(id, user_id, name)\n user = get_user(user_id)\n group = Group.new(id, user.id, name)\n @@group[id] = group\n group.add(user.id)\n return \"Group Created\"\n end",
"def create\n @group = Group.new(group_params)\n member = Member.create\n @group.members << member\n current_user.members << member\n\n @group.owner = member\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render action: 'show', status: :created, location: @group }\n else\n format.html { render action: 'new' }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @users = User.where(\"owner_id = ?\", current_user).order('lastname ASC')\n @group = current_user.groups.create(group_params)\n @owner = current_user\n if @group.persisted?\n flash[:green] = \"Group created!\"\n redirect_to groups_path\n else\n render root_path\n end\n end",
"def create_group_portfolio\n GroupPortfolio.create(:portfolio_id => self.portfolio_id, :group_id => self.group_id)\n return true\n end",
"def create\n @group = Group.new(group_params)\n @group.owner = current_user\n @group.users << current_user\n\n respond_to do |format|\n if @group.save\n membership = Membership.find_by_group_id_and_user_id(@group.id, current_user)\n membership.update_attributes :acceptance_status => true\n\n format.html { redirect_to group_path(@group), alert: 'Group was successfully created.' }\n format.json { render action: 'show', status: :created, location: @group }\n else\n format.html { render action: 'new' }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n super\n acc = Account.create!(:company_name => params[:account][:company_name]) unless flash.blank?\n # Set admin and account_id for User \n resource.update_attributes!({:account_id => acc.id, :is_admin => true, :status => SettingsConfig::ENABLED}) unless flash.blank?\n end",
"def create_recs(i, group_ids, group_count)\n user = User.new(:organization_id => 1,\n :number => \"#{i+1}\",\n :name => \"test#{i+1}\")\n user.user_groups.build(:organization_id => 1,\n :group_id => group_ids[rand(group_count)])\n puts \"No.#{i+1}user belong #{user.user_groups.last.group.full_name}\" if user && user.valid?\n user.save!\n account = Account.new(:status => 4,\n :login => \"testaddress+#{i+1}@example.com\",\n :login_confirmation => \"testaddress+#{i+1}@example.com\",\n :password => \"123456\",\n :password_confirmation => \"123456\",\n :state => 'active',\n :activated_at => Time.now)\n account.build_recipient(:organization_id => 1,\n :user_id => user.id,\n :name => \"test#{i+1}\",\n :relation => \"本人\")\n if account && account.valid?\n ActiveRecord::Base.transaction do\n account.save!\n puts \"No.#{i+1} addount and recipient save!\"\n end\n else\n pp \"Sorry, account valid is failure. login: #{account.login}\\n\"\n end\nrescue => ex\n\tputs \"#{ex.class}:#{ex.message}\"\nend",
"def create_object_key\n $feed.record(\"group:#{id}\", { id: self.permalink, name: self.display_name } )\n end",
"def create\n params.permit!\n para = params[:account]\n @account = Account.new(email: para[:email], password: para[:password])\n return unless @account.save\n\n associated = if params[:role] == 'student'\n Student.new(account_id: Account.order('created_at').last.id, f_name: para[:f_name],\n l_name: para[:l_name], dot_name: para[:dot_name].downcase, rating: 'A')\n else\n Professor.new(account_id: Account.order('created_at').last.id, f_name: para[:f_name],\n l_name: para[:l_name])\n end\n if associated.valid?\n associated.save\n redirect_to :authenticated_root\n else\n @account.delete\n end\n end",
"def after_create_group\n controller = PublicActivity.get_controller\n\n # Return if seeding or nothing changes\n return if !controller || self.changed.blank?\n\n current_user = PublicActivity.get_controller.current_user\n\n self.create_activity :create, owner: current_user,organization_id: self.organization_id, params: {:detail => I18n.t('logs.create_group', group_name: self.name)}\n end",
"def create\n # @group.parent_id is in the form if we need it\n @group.hub = @hub\n \n respond_to do |format|\n if @group.save\n format.html { redirect_to [@hub, @group], :notice => 'Group was successfully created.' }\n format.json { render :json => @group, :status => :created, :location => @group }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def add_new(authority_name, label)\n DogBiscuits::Importers::Authority.new(authority_name).create_record(label) if Qa::Authorities::Local.subauthority_for(authority_name).search(label).empty?\n rescue Qa::InvalidSubAuthority\n Rails.logger.error(\"Invalid sub-authority: #{auth}\")\n end",
"def create_group(attributes)\n post(\"/v1/groups\", attributes)\n end"
] | [
"0.65680975",
"0.6179515",
"0.6166096",
"0.60909253",
"0.60040194",
"0.59851146",
"0.5977151",
"0.59438497",
"0.58988976",
"0.58710617",
"0.58513016",
"0.58250993",
"0.5823167",
"0.58156466",
"0.5795477",
"0.57815784",
"0.5741664",
"0.57300997",
"0.5724349",
"0.5713293",
"0.5706277",
"0.5700874",
"0.5684705",
"0.5682795",
"0.5671185",
"0.5658482",
"0.5657949",
"0.5653201",
"0.56496",
"0.5622696",
"0.56194544",
"0.5615447",
"0.5606388",
"0.5604702",
"0.5599734",
"0.55981565",
"0.55962837",
"0.55809736",
"0.5565406",
"0.5557755",
"0.5535074",
"0.55197054",
"0.5515738",
"0.55016553",
"0.5484364",
"0.54625285",
"0.54605144",
"0.54520047",
"0.5443927",
"0.5433753",
"0.54254925",
"0.54148823",
"0.54052424",
"0.5397053",
"0.5397053",
"0.5394822",
"0.5393462",
"0.53886944",
"0.53844374",
"0.5382736",
"0.53783596",
"0.5359559",
"0.53574514",
"0.53563535",
"0.5340645",
"0.532344",
"0.53214616",
"0.53109646",
"0.5310774",
"0.5297949",
"0.5296588",
"0.5291702",
"0.52859175",
"0.52793074",
"0.5278274",
"0.52778286",
"0.52747697",
"0.52708036",
"0.526584",
"0.5265232",
"0.526272",
"0.52618104",
"0.52616423",
"0.5259902",
"0.525963",
"0.5249692",
"0.523649",
"0.5233625",
"0.5228057",
"0.52271503",
"0.5225645",
"0.5219763",
"0.52182984",
"0.5215959",
"0.52149796",
"0.5214931",
"0.5214903",
"0.52113795",
"0.5210423",
"0.5210098"
] | 0.7417314 | 0 |
Create an association between the trackgroup and the account using the API for find the account | def createAPI
idLoL = LOL_WRAPPER.get_summoner_id(params[:accname], params[:region])
#Find the summoner with the corresponding id and region
@summoner = LOL_WRAPPER.get_summoner_by_id(idLoL, params[:region])
#Create or update the corresponding account in our database
if Account.exists?(:idLoL => idLoL)
@account = Account.find_by_idLoL(idLoL)
@account.pseudoLoL = @summoner.name
@account.save
else
@account = Account.new(idLoL: idLoL, region: params[:region], pseudoLoL: @summoner.name)
@account.save
end
@trackgroup.accounts << @account
redirect_to(:back)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n \n @account = Account.find(params[:account][:id])\n @trackgroup.accounts << @account\n redirect_to account_path(:region => @account.region, :idLoL => @account.idLoL)\n \n end",
"def create\n megam_rest.post_accounts(to_hash)\n end",
"def add_account(account)\n @accounts[account.id] = account\n end",
"def setup_accounts\n self.accounts.create({:name => \"Checking\"})\n self.accounts.create({:name => \"Savings\"})\n end",
"def create\n @account = @project.accounts.build(account_params)\n\n respond_to do |format|\n if @account.save\n format.html { redirect_to @account, notice: 'Account was successfully created.' }\n format.json { render :show, status: :created, location: @account }\n else\n @record = [@project, @account]\n format.html { render :new }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create(body = {})\n @client.account.create(body)\n end",
"def create\n @account = current_user.accounts.build params[:account]\n \n account_array = accounts_from_credentials @account.api_email, @account.api_password\n \n accounts = account_array.map do |account_info|\n account = current_user.accounts.build params[:account]\n \n account.api_id = account_info.accountID\n account.api_name = account_info.accountName\n account.api_user_id = account_info.userID\n \n account\n end\n\n respond_to do |format|\n if !accounts.blank? && accounts.map(&:valid?).all? && accounts.map(&:save).all?\n flash[:notice] = \"#{accounts.size == 1 ? 'Account was' : \"#{accounts.size} accounts were\"} successfully created.\"\n format.html { redirect_to(@account) }\n format.xml { render :xml => @account, :status => :created, :location => @account }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @account.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create_account\n\n end",
"def create_account\n set_user\n set_payer\n set_user_sport\n save_account\n end",
"def set_account\n response = @account_api.find(params[:id])\n @account = response[:account]\n end",
"def set_account\n Finance::Account.create.save\n @account = Finance::Account.first\n end",
"def create_accounts\n end",
"def group_add(client, options)\n if options[:group].nil? or options[:email].nil?\n puts \"Missing arguments\"\n return\n end\n\n group = client.groups.get options[:group]\n account = get_account(client, options)\n\n if account.nil? or group.nil?\n puts \"Account or group not found\"\n return\n end\n\n account.add_group group\n puts \"Account added to group.\"\nend",
"def create_association(obj, type)\n @logger.info(\"Creating association for #{type} #{obj.name}\")\n case type\n when \"agent\"\n iso = find_sugarcrm_object('iso', 'sf_id', obj.sf_iso)\n obj.associate! iso if iso\n when \"merchant\"\n \n payment_method_id = find_payment_method_id(obj.sf_id)\n if payment_method_id\n payment_method = find_sugarcrm_object('payment_method', 'sf_id', payment_method_id)\n obj.associate! payment_method\n end\n \n email_id = find_email_id(obj.sf_id)\n if email_id\n email = find_sugarcrm_object('email', 'sf_id', email_id)\n obj.associate! email\n end\n \n agent = find_sugarcrm_object('agent', 'sf_id', obj.sf_agent)\n if agent\n obj.associate! agent\n obj.assigned_user_id = agent.assigned_user_id\n end\n \n when \"settlement_bank_account\"\n merchant = find_sugarcrm_object('merchant', 'sf_id', obj.sf_merchant)\n obj.associate! merchant if merchant\n end\n obj\n end",
"def create_account(lead)\n Account.create({\n company_id: lead.company_id,\n user_id: lead.user_id\n })\n end",
"def assign_account(account_id)\n self.account_id = account_id\n end",
"def create(params)\n put('v1/account', params)\n end",
"def set_user_accounts_group\n @user_accounts_group = UserAccountsGroup.find(params[:id])\n end",
"def create\n @user_accounts_group = UserAccountsGroup.new(user_accounts_group_params)\n\n respond_to do |format|\n if @user_accounts_group.save\n format.html { redirect_to @user_accounts_group, notice: 'User accounts group was successfully created.' }\n format.json { render :show, status: :created, location: @user_accounts_group }\n else\n format.html { render :new }\n format.json { render json: @user_accounts_group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create( params )\n params.delete( :id ) # Prevent overwriting ID\n Account.new( params ).save\n end",
"def create\n \t@group = Group.new(group_params)\n @group.associations.build(user_id: session[:user_id] ) \n if @group.save\n \t redirect_to groups_path\n else \n render groups_path\n end\n end",
"def create_account\n account = Account.create(name: \"#{full_name}'s Portfolio\")\n account.collaborators << self\n end",
"def create_account(options)\n form_data = options.merge({ 'action' => 'createaccount' })\n res, dummy = make_api_request(form_data)\n res\n end",
"def channel_account_for(channel)\n ca = ChannelAccount.new(:user_id => id, :channel_id => channel.id)\n ca.save\n self.channel_accounts << ca\n end",
"def create\n params[:transfer][:occurred_on] = Time.strptime(params[:transfer][:occurred_on], \"%m/%d/%Y\") if params[:transfer][:occurred_on]\n @transfer = Transfer.new(params[:transfer])\n @transfer.user_id = current_user.id\n @transfer.group_id = @group.id\n\n @from_accounts = @group.accounts.includes(:owner).sort { |a,b| a.owner.display_name.downcase <=> b.owner.display_name.downcase }\n @to_accounts = @group.accounts.includes(:owner).sort { |a,b| a.owner.display_name.downcase <=> b.owner.display_name.downcase }\n\n if params[:from_account_id].present?\n @from_account = Account.find_by_id(params[:from_account_id])\n @transfer.from_account_id = params[:from_account_id]\n end\n if params[:to_account_id].present?\n @to_account = Account.find_by_id(params[:to_account_id])\n @transfer.to_account_id = params[:to_account_id]\n end\n\n respond_to do |format|\n if @transfer.save\n flash[:notice] = \"Transfer was created.\"\n format.html { redirect_to group_path(@group) }\n format.json { @transfer.errors }\n else\n format.html { render action: \"new\" }\n format.json { @transfer.errors }\n end\n end\n end",
"def create_account\n account = Account.new(:email => email, :subdomain => subdomain)\n account.save!\n end",
"def create\n @account = GmailAccount.new(params[:gmail_account])\n current_user.person.gmail_accounts << @account\n\n respond_to do |format|\n if @account.save\n format.html { redirect_to( accounts_path, :notice => 'Account was successfully created.') }\n format.json { render :json => @account, :status => :created, :location => @account }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @account.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def add_account\n update_attribute(:account_id, Account.current.id)\n end",
"def set_account\n @account = Account.joins(:branch, :ownerships).group(:id).select('accounts.*', 'branches.name AS branch_name', 'COUNT(ownerships.client_id) AS owners_count').find(params[:id])\n end",
"def create\n @account = Account.new(account_params)\n \n if @account.type_account != 0\n\n dae = DataAccountEvent.new\n \n client = Twitter::REST::Client.new do |config|\n config.consumer_key = 'xYEFttTg61yWfZO20byljihWF'\n config.consumer_secret = 'DLdNpRAgcxsqdODqJP1yTSE7p02T3hSUDF1qMbz14QrVp5jKLO'\n config.oauth_token = '93945943-Pd4V1IuroSUUU4GsdzUvprQ0or0ZRAajUt8DMPgIb'\n config.oauth_token_secret = 'GZWtSu5QEXmUJUb0ZTEjfdg262DxxX03IljeeCl5PtvhZ'\n end\n\n p = @account.user_twitter.delete \"@\"\n c = client.user(p)\n\n @account.key_user_id = c.id\n @account.user_name = c.name\n @account.save\n\n dae.id = nil\n dae.url_official = c.website.to_s\n dae.location = c.location\n dae.url_twitter_event = \"https://twitter.com/\"+p\n dae.num_tweets = c.statuses_count \n dae.num_photo_and_video = 0\n dae.num_following = c.friends_count\n dae.num_followers = c.followers_count \n \n if @account.type_account == 1\n dae.account_official = true\n end\n\n dae.date_creation_account = c.created_at\n dae.account_id = @account.id\n dae.save\n @account.data_account_event_id = dae.id\n \n respond_to do |format|\n if @account.save\n format.html { redirect_to @account, notice: 'Account was successfully created.' }\n format.json { render :show, status: :created, location: @account }\n else\n format.html { render :new }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end \n\n end\n\n end",
"def user_accounts_group_params\n params.require(:user_accounts_group).permit(:account_id, :group_id)\n end",
"def set_api_v2_account\n # @account = MasterData::Account.find(params[:id])\n @account = MasterData::Account.find_by(uuid: params[:uuid])\n not_found unless @account\n end",
"def add_account\n # make sure a second confirmation email is not sent\n skip_reconfirmation!\n\n # update before setting the account_id\n update_profile_email\n\n update_attribute(:account_id, Account.current.id)\n ensure_site_profile_exists\n end",
"def add_to_group(group)\n self.memberships.create(group_id: group.id)\n end",
"def create_account(account_form)\r\n # the base uri for api requests\r\n query_builder = Configuration.base_uri.dup\r\n\r\n # prepare query string for API call\r\n query_builder << '/accounts'\r\n\r\n # validate and preprocess url\r\n query_url = APIHelper.clean_url query_builder\r\n\r\n # prepare headers\r\n headers = {\r\n 'user-agent' => 'APIMATIC 2.0',\r\n 'accept' => 'application/json',\r\n 'content-type' => 'application/json; charset=utf-8',\r\n 'X-Auth-Token' => Configuration.x_auth_token\r\n }\r\n\r\n # invoke the API call request to fetch the response\r\n response = Unirest.post query_url, headers: headers, parameters: account_form.to_json\r\n\r\n # Error handling using HTTP status codes\r\n if response.code == 401\r\n raise APIException.new 'You are not authenticated', 401, response.raw_body\r\n elsif response.code == 403\r\n raise APIException.new 'This action needs a valid WSSE header', 403, response.raw_body\r\n elsif response.code == 404\r\n raise APIException.new 'Resource not found', 404, response.raw_body\r\n elsif response.code == 400\r\n raise APIException.new 'Http bad request', 400, response.raw_body\r\n elsif !response.code.between?(200, 206) # [200,206] = HTTP OK\r\n raise APIException.new 'HTTP Response Not OK', response.code, response.raw_body\r\n end\r\n\r\n response.body\r\n end",
"def save\n response = if @id.nil?\n @cloud.auth_for_accounts [@parent]\n @cloud.post ['cloud-service-auth', 'accounts'], self\n else\n @cloud.post path, self\n end\n apply_data(response.body)\n self\n end",
"def create_account(account_create_model, fields = '')\n if account_create_model.blank?\n raise LoginRadius::Error.new, getValidationMessage('account_create_model')\n end\n\n query_parameters = {}\n query_parameters['apiKey'] = @api_key\n query_parameters['apiSecret'] = @api_secret\n unless isNullOrWhiteSpace(fields)\n query_parameters['fields'] = fields\n end\n\n resource_path = 'identity/v2/manage/account'\n post_request(resource_path, query_parameters, account_create_model)\n end",
"def group_join!(group)\n affiliations.create!( :group_id => group.id )\n end",
"def create_new_sub_account(account_id,account__name__,opts={})\n query_param_keys = [\n \n ]\n\n form_param_keys = [\n :account__name__,\n :account__default_storage_quota_mb__,\n :account__default_user_storage_quota_mb__,\n :account__default_group_storage_quota_mb__,\n \n ]\n\n # verify existence of params\n raise \"account_id is required\" if account_id.nil?\n raise \"account__name__ is required\" if account__name__.nil?\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n :account_id => account_id,\n :account__name__ => account__name__\n )\n\n # resource path\n path = path_replace(\"/v1/accounts/{account_id}/sub_accounts\",\n :account_id => account_id)\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_params(options, query_param_keys)\n if opts[:next_page]\n pagination_params = page_params_load(:post, path)\n query_params.merge! pagination_params if pagination_params\n end\n response = mixed_request(:post, path, query_params, form_params, headers)\n page_params_store(:post, path)\n response.map {|response|Account.new(response)}\n end",
"def create\n @subscription = Subscription.create(params[:subscription])\n groups = params[:subscription][:group_name].split(\",\").collect(&:strip)\n email = params[:subscription][:email]\n begin\n gb = Gibbon::API.new(\"f24fdd53217fab0b0698fdaba15c0c6f-us7\")\n subscribe = gb.lists.subscribe({\n :id => \"caa152eac4\",\n :email => {:email => email},\n :merge_vars => {\n :FNAME => \"\",\n :LNAME => \"\",\n :groupings => {\n 0 => {\n :id => 4457,\n :groups => groups\n }\n }\n },\n :update_existing => true,\n :double_optin => false\n })\n #logger.debug subscribe\n rescue Gibbon::MailChimpError\n \n end\n redirect_to \"/contact\"\n end",
"def create_account_link\n render json: Stripe::AccountLink.create(account_params.to_h), status: :created\n end",
"def group_create(group_name:, trace: false)\n group_query = \"{\\\"group_name\\\":\\\"#{group_name}\\\",\\\"group_external_id\\\":\\\"#{group_name}\\\",\\\"group_management_type\\\":{\\\".tag\\\":\\\"company_managed\\\"}}\"\n dropbox_query(query: '2/team/groups/create', query_data: group_query, trace: trace)\n end",
"def set_agroup\r\n @agroup = Agroup.find(params[:id])\r\n end",
"def new\n @user = User.find_by_id(current_user.id)\n @group = Group.find_by_id(@user.currentgroupid)\n @account = Account.new\n \n \n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @account }\n end\n end",
"def account_create(uid,display_name)\n user_hash = @client.user_create(\"#{uid}\",\"#{display_name}\")\n Rails.logger.debug '> Radosgw: Account create'\n user_json = user_hash.to_json\n storage = Storage.new(STORAGES_BUCKET)\n storage.upload(uid, user_json, 'application/json')\n user_hash\n end",
"def new_account(name)\n account(name)\n end",
"def create\n @api_v1_account = Api::V1::Account.new(api_v1_account_params)\n\n respond_to do |format|\n if @api_v1_account.save\n format.html { redirect_to @api_v1_account, notice: 'Account was successfully created.' }\n format.json { render :show, status: :created, location: @api_v1_account }\n else\n format.html { render :new }\n format.json { render json: @api_v1_account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n \n @account = Account.find(params[:account][:idAccount])\n @account.trackgroups.delete(@trackgroup)\n redirect_to(:back)\n \n end",
"def create_wepay_account\n # if we don't have an access_token for this user, then we cannot make this call\n if self.has_wepay_account? then return false end\n # make the /account/create call\n response = WEPAY.call(\"/account/create\", self.wepay_access_token, {\n name: self.campaign.name,\n description: self.campaign.description,\n type: self.campaign.account_type,\n country: self.country,\n currencies: [ self.currency ],\n })\n if response['error'].present?\n raise response['error_description']\n end\n self.wepay_account_id = response['account_id']\n self.save\n end",
"def create\n\n group = Group.create(group_parm.merge(account_id: current_user.id)) #group creater current user will be the admin of group\n if group.save!\n render :json => Base64.encode64(group.id.to_s) and return\n else\t\t \n render :json => group.errors.full_messages.first and return\n end \n end",
"def after_create\n super\n create_account\n end",
"def generate_account\n self.account = Account.create(:name => self.email) unless account\n end",
"def create_gen1_account(name) \n\n account_create = {\n \"location\"=> \"centralus\",\n \"tags\"=> {\n \"test_key\"=> \"test_value\"\n },\n \"identity\"=> {\n \"type\"=> \"SystemAssigned\"\n },\n \"properties\"=> {\n \"encryptionState\"=> \"Enabled\",\n \"encryptionConfig\"=> {\n \"type\"=> \"ServiceManaged\",\n },\n \"firewallState\"=> \"Disabled\",\n \"firewallRules\"=> [\n \n ],\n \"trustedIdProviderState\"=> \"Disabled\",\n \"trustedIdProviders\"=> [\n \n ],\n \n \"newTier\"=> \"Consumption\",\n \"firewallAllowAzureIps\"=> \"Enabled\"\n }\n }\n\n response = HTTParty.put(\"https://management.azure.com/subscriptions/#{subscriptionId}/resourceGroups/#{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/#{name}?api-version=2016-11-01\", {\n\n body: account_create.to_json,\n\n headers: {\n \"Authorization\" => \"Bearer #{bearerToken}\",\n \"Content-Type\" => 'application/json', \n \"Accept\" => '*/*',\n \"Cache-Control\" => 'no-cache',\n \"Connection\" => 'keep-alive',\n \"cache-control\" => 'no-cache'\n },\n \n verify: true,\n })\n\n return JSON.parse response.read_body\n end",
"def create_account_options\n AccountOption.create!(:user => self)\n end",
"def add_bank_account(name:, account_number:, routing_number:, category:, type:, **args)\n data = {\n type: 'ACH-US',\n info: {\n nickname: args[:nickname] || name,\n name_on_account: name,\n account_num: account_number,\n routing_num: routing_number,\n type: category,\n class: type\n },\n extra: {\n supp_id: args[:supp_id]\n }\n }\n nodes.create(data)\n end",
"def create_account\n if new_record? && !self.account_id\n account = Account.new\n account.name = \"Preecha o nome da sua empresa\"\n account.save\n self.account_id = account.id\n self.admin = true\n end\n end",
"def create(\n account,\n deadline: nil\n )\n req = V1::AccountCreateRequest.new()\n\n req.account = Plumbing::convert_account_to_plumbing(account)\n tries = 0\n plumbing_response = nil\n loop do\n begin\n plumbing_response = @stub.create(req, metadata: @parent.get_metadata(\"Accounts.Create\", req), deadline: deadline)\n rescue => exception\n if (@parent.shouldRetry(tries, exception))\n tries + [email protected](tries)\n next\n end\n raise Plumbing::convert_error_to_porcelain(exception)\n end\n break\n end\n\n resp = AccountCreateResponse.new()\n resp.account = Plumbing::convert_account_to_porcelain(plumbing_response.account)\n resp.meta = Plumbing::convert_create_response_metadata_to_porcelain(plumbing_response.meta)\n resp.rate_limit = Plumbing::convert_rate_limit_metadata_to_porcelain(plumbing_response.rate_limit)\n resp.token = (plumbing_response.token)\n resp\n end",
"def create\n # params[:account][:project_id]=session[:project]\n @account=Account.new params[:account]\n respond_to do |format|\n if @account.save\n format.html { redirect_to @account, notice: 'Account was successfully created.' }\n format.json { render json: @account, status: :created, location: @account }\n else\n format.html { render action: \"new\" }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n\n end",
"def add_group_member\n @group_member = RockGroupMember.find_or_initialize_by({\n GroupId: @group_id,\n PersonId: person.mapped_record.person_alias.PersonId\n })\n @group_member.IsSystem = false\n @group_member.GroupRoleId = 266 # member for worship services\n @group_member.GroupMemberStatus = 1 #\n @group_member.Guid = SecureRandom.uuid\n @group_member.CreatedDateTime = Time.new\n @group_member.Note = 'Imported From Arena'\n\n @group_member.save!\n end",
"def create\n @album = current_account.albums.new(params[:album])\n\n respond_to do |format|\n if @album.save\n flash[:notice] = 'album was successfully created.'\n format.html { redirect_to( :action => 'edit', :id => @album.id) }\n format.xml { render :xml => @album, :status => :created, :location => @album }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @album.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create_admin_account\n account = Account.create!\n self.account = account\n self.account_owner = true\n end",
"def create\n @account = Account.new(params[:account])\n @account.user = User.find_by_id(current_user.id)\n user = User.find_by_id(current_user.id)\n @account.groupid = user.currentgroupid\n\n respond_to do |format|\n if @account.save\n if @account.tmp.present?\n comment = Comment.new\n comment.accounts_id = @account.id\n comment.comment = @account.tmp\n comment.name = user.username\n comment.save\n end\n \n #current_user.twitter.update(@account.content) if params[:twitter] == 'yes'\n #if params[:facebook] == 'yes'\n # current_user.facebook.feed!(:message => \"test\",\n # :link => \"http://moonkey.jp\",\n # :name => \"TEST\",\n # :description => \"test\")\n #end\n format.html { redirect_to accounts_url }\n format.json { render json: @account, status: :created, location: @account }\n else\n format.html { render action: \"new\" }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def setup_new_bank_account(bank_code, credentials, country = 'de', options = {})\n data = { \"bank_code\" => bank_code,\n \"country\" => country,\n \"credentials\" => credentials\n }\n data = data.merge(options)\n query_api \"/rest/accounts\", data, \"POST\"\n end",
"def create_trackers\n @trackers = Hash.new\n @accounts.each do |name, account|\n @log.debug \"Setting up tracker for account #{name}\"\n @trackers[name] = AccountTracker.new(name, account, {\n :delay => @delay, :error_callback => @error_proc, :logger => @log,\n :callback => Proc.new do |resources|\n # attach a QueryProcessor to all returned resources\n qp = FogTracker::Query::QueryProcessor.new(@trackers, :logger => @log)\n resources.each {|resource| resource._query_processor = qp}\n # now relay the resources back to the client software\n @callback.call(resources) if @callback\n end\n }\n )\n end\n end",
"def link_account(provider, uid)\n self[provider.column.to_sym] = uid\n self.save\n end",
"def create_object_key\n $feed.record(\"group:#{id}\", { id: self.permalink, name: self.display_name } )\n end",
"def create\n omniauth = request.env['omniauth.auth']\n authentication = Authentication.find_by_provider_and_uid(omniauth['provider'], omniauth['uid'])\n if authentication\n flash[:notice] = \"Signed in successfully\"\n sign_in_and_redirect(:account, authentication.account)\n else\n user = Account.new(password: Devise.friendly_token) # If you create an account with twitter/fb, we don't need a passwod\n user.apply_omniauth(omniauth)\n user.email = get_email_from_omniauth omniauth\n if user.save\n flash[:notice] = \"Successfully registered\"\n sign_in_and_redirect(:account, user)\n else\n session[:omniauth] = omniauth.except('extra')\n session[:omniauth_email] = omniauth['extra'] && omniauth['extra']['user_hash'] && omniauth['extra']['user_hash']['email']\n\n # Check if email already taken. If so, ask user to link_accounts\n if user.errors[:email][0] =~ /has already been taken/ # omniauth? TBD\n # fetch the user with this email id!\n user = Account.find_by_email(user.email)\n return redirect_to link_accounts_url(user.id)\n end\n redirect_to new_account_registration_url\n end\n end\n end",
"def set_account\n @account = current_user.accounts.find(params[:account_id])\n end",
"def create\n cu = User.find params[:user_id]\n\n @group = Group.new(params[:group])\n cu.groups << @group\n\n case params[:group_type].to_i\n when 1\n @group.groupable = ArtistGroup.create\n\n if defined?(params[:instr_id]) && (not params[:instr_id].nil?)\n m = Membership.where \"group_id = #{@group.id}\n AND userable_id = #{cu.id}\n AND userable_type = 'User'\"\n params[:instr_id].each do |i|\n m.first.instruments << Instrument.find(i)\n end\n end\n when 2\n @group.groupable = FanGroup.create :artist_group => ArtistGroup.find(params[:art_group_id].to_i)\n when 3\n @group.groupable = HostGroup.create\n end\n\n\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Die Gruppe wurde erfolgreich angelegt.' }\n format.json { render json: @group, status: :created, location: @group }\n else\n format.html { render action: \"new\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_account\n @account = Directory::Account.find(params[:id])\n end",
"def create_group(attributes)\n BrickFTP::API::Group.create(attributes)\n end",
"def create_group(attributes)\n BrickFTP::API::Group.create(attributes)\n end",
"def after_create_account(result)\n\n end",
"def add(organisation_id, account_number, name, classification, type, tax, currency, options = {})\n body = options.has_key?(:body) ? options[:body] : {}\n body[:organisation_id] = organisation_id\n body[:account_number] = account_number\n body[:name] = name\n body[:classification] = classification\n body[:type] = type\n body[:tax] = tax\n body[:currency] = currency\n\n response = @client.post \"/core.account/add\", body, options\n\n return response\n end",
"def new_account(res)\n account = Account.new\n account.new(res)\n end",
"def open_user_account\n Account.create(user_id: self.id) \t\n end",
"def set_account\n @account = Account.find(params[:account_id])\n end",
"def create\n @user.create_group!(new_group_params[:group_user_ids], {name: new_group_params[:name]})\n end",
"def create_participant(account_id,\r\n body: nil)\r\n # Prepare query url.\r\n _query_builder = config.get_base_uri(Server::WEBRTCDEFAULT)\r\n _query_builder << '/accounts/{accountId}/participants'\r\n _query_builder = APIHelper.append_url_with_template_parameters(\r\n _query_builder,\r\n 'accountId' => { 'value' => account_id, 'encode' => false }\r\n )\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json',\r\n 'content-type' => 'application/json; charset=utf-8'\r\n }\r\n\r\n # Prepare and execute HttpRequest.\r\n _request = config.http_client.post(\r\n _query_url,\r\n headers: _headers,\r\n parameters: body.to_json\r\n )\r\n WebRtcBasicAuth.apply(config, _request)\r\n _response = execute_request(_request)\r\n\r\n # Validate response against endpoint and global error codes.\r\n case _response.status_code\r\n when 400\r\n raise APIException.new(\r\n 'Bad Request',\r\n _response\r\n )\r\n when 401\r\n raise APIException.new(\r\n 'Unauthorized',\r\n _response\r\n )\r\n when 403\r\n raise APIException.new(\r\n 'Access Denied',\r\n _response\r\n )\r\n end\r\n unless _response.status_code.between?(200, 208)\r\n raise ErrorException.new(\r\n 'Unexpected Error',\r\n _response\r\n )\r\n end\r\n validate_response(_response)\r\n\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_response.raw_body)\r\n ApiResponse.new(\r\n _response,\r\n data: AccountsParticipantsResponse.from_hash(decoded)\r\n )\r\n end",
"def create\n @group = Group.new(group_params)\n @group.group_users.build user_type: 'Group Owner', user_id: @current_user.id\n @group.share_id = Array.new(8){rand(36).to_s(36)}.join\n\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render :show, status: :created, location: @group }\n else\n format.html { render :new }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n #TODO validate that the params[:id] is a legal value for user\n @group = Group.find(params[:group_id])\n authorize! :edit, @group\n Hydra::LDAP.add_users_to_group(@group.code, [params[:id]])\n redirect_to edit_group_path(@group), :notice=>\"Added member #{params[:id]}\"\n end",
"def create_crm_account_from_lead\n doc = Hpricot::XML(request.raw_post)\n doc = doc.to_s.gsub(\"&\",\"&\") \n doc = Hpricot::XML(doc) \n id = parse_xml(doc/:params/'id')\n account_doc = Crm::CrmLeadCrud.generate_xml_for_account(doc) \n @accounts=Crm::CrmLeadCrud.create_account_from_lead(account_doc,id)\n account = @accounts.first if [email protected]?\n if account.errors.empty?\n render:text=>'success'\n else\n respond_to_errors(account.errors)\n end\n end",
"def createGroup\n call :createGroup\n end",
"def subledger_ar_account\n if self.subledger_ar_acct_id.nil?\n subledger_ar_account = create_subledger_account :ar\n\n self.subledger_ar_acct_id = subledger_ar_account.id\n self.save\n subledger_ar_account\n else\n subledger.account :id => self.subledger_ar_acct_id\n end\n end",
"def add_omniauth(auth)\n self.authentications.find_or_create_by(\n provider: auth['provider'],\n uid: auth['uid'].to_s\n )\n end",
"def create_group_category_accounts(account_id,name,opts={})\n query_param_keys = [\n \n ]\n\n form_param_keys = [\n :name,\n :self_signup,\n :auto_leader,\n :group_limit,\n :create_group_count,\n :split_group_count,\n \n ]\n\n # verify existence of params\n raise \"account_id is required\" if account_id.nil?\n raise \"name is required\" if name.nil?\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n :account_id => account_id,\n :name => name\n )\n\n # resource path\n path = path_replace(\"/v1/accounts/{account_id}/group_categories\",\n :account_id => account_id)\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_params(options, query_param_keys)\n if opts[:next_page]\n pagination_params = page_params_load(:post, path)\n query_params.merge! pagination_params if pagination_params\n end\n response = mixed_request(:post, path, query_params, form_params, headers)\n page_params_store(:post, path)\n GroupCategory.new(response)\n end",
"def create_entity_group\n @entity_group = EntityGroup.create!(client_id: @client_id,\n uuid: Util::Encryption::Admin.get_uuid,\n creator_admin_id: @admin_id,\n status: GlobalConstant::EntityGroup.active_status,\n activated_at: Time.now.to_i)\n end",
"def create\n @system_platform_account = System::PlatformAccount.new(system_platform_account_params)\n if @system_platform_account.save\n record_activities('创建接入账号', @system_platform_account.account_name)\n flash[:success] = '创建接入账号成功'\n redirect_to system_platform_accounts_path\n else\n flash[:error] = \"创建失败: #{@system_platform_account.errors.full_message}\"\n render :new\n end\n end",
"def create\n @account = MasterData::Account.new(account_params_with_author)\n authorize @account, :create?\n\n respond_to do |format|\n if @account.update_aliases(@aliases) && @account.save\n # keep @account.save at the end of the condition bellow to ensure the right object is returned during rendering\n\n format.html do\n render :show, notice: \"Account was successfully created.\"\n end\n format.json do\n render json: @account, status: :created, location: :api_v2_accounts\n end\n else\n format.html { render :new }\n format.json do\n render json: @account.errors, status: :unprocessable_entity\n end\n end\n end\n end",
"def create_associations\n self.associates.each do |associate|\n self.add_associated(associate)\n end\n end",
"def create\n @account_group_type = user_default_branch.account_group_types.build(params[:account_group_type])\n\n respond_to do |format|\n if @account_group_type.save\n flash[:notice] = 'AccountGroupType was successfully created.'\n format.html { redirect_to(@account_group_type) }\n format.xml { render :xml => @account_group_type, :status => :created, :location => @account_group_type }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @account_group_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create_account_and_subscribe_single_call account_name\n contact = {\n address1: '1051 E Hillsdale Blvd',\n city: 'Foster City',\n country: 'United States',\n firstName: 'John',\n lastName: 'Smith',\n zipCode: '94404',\n state: 'CA'\n }\n #get the rate plans for the product\n product_rate_plan = get_product_rate_plans_for_product 'Medium Monthly Plan'\n myDate = DateTime.now + 10.days;\n #create an account and subscribe to a rate plan at the same time\n subscribe(\n account_name,\n contact,\n DateTime.now.strftime(\"%Y-%m-%d\"),\n myDate.strftime(\"%Y-%m-%d\"),\n product_rate_plan['id']\n )\nend",
"def create\n @account = Account.new(name: account_params[:name])\n \n respond_to do |format|\n if @account.save\n user = @account.users.build(account_params[:users_attributes])\n if user.save\n session[:user_id] = user.id\n format.html { redirect_to samples_path, notice: 'account was successfully created.' }\n format.json { render samples_path, status: :created, location: @account }\n else\n format.html { redirect_to register_path, notice: 'Error, in user save' }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n else\n format.html { render :new, notice: 'Error, in account save' }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @core_account = Core::Account.new(core_account_params)\n\n respond_to do |format|\n if @core_account.save\n format.html { redirect_to @core_account, notice: 'Account was successfully created.' }\n format.json { render :show, status: :created, location: @core_account }\n else\n format.html { render :new }\n format.json { render json: @core_account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create(attributes)\n response = JSON.parse(@client.post('card_accounts', attributes).body)\n Promisepay::CardAccount.new(@client, response['card_accounts'])\n end",
"def new_account=(account)\n @new_account = self.account_ids.include?(account.id) ? nil : account\n end",
"def set_account\n @account = Account.by_id(params[:id])\n end",
"def create\n # Get the credit card details submitted by the form\n @account = Account.new\n authorize @account\n @account.user_id = account_params[:user_id]\n @account.package_id = account_params[:package_id];\n @user = User.find(account_params[:user_id])\n @account.users << @user\n @account.active = FALSE\n\n if @account.save\n render json: {status: :created, account: @account}\n else\n render json: { error: @account.errors, status: :unprocessable_entity }\n end\n end",
"def create\n @account = Account.new(account_params)\n @account.user_created_id = current_user.id\n respond_to do |format|\n if @account.save\n format.html { redirect_to accounts_path, notice: I18n.t('account.controller.create') }\n format.json { render :show, status: :created, location: @account }\n else\n format.html { render :new }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @transfer = Transfer.new\n @transfer.group_id = @group.id\n\n @from_accounts = @group.accounts.includes(:owner).sort { |a,b| a.owner.display_name.downcase <=> b.owner.display_name.downcase }\n @to_accounts = @group.accounts.includes(:owner).sort { |a,b| a.owner.display_name.downcase <=> b.owner.display_name.downcase }\n @transfer.occurred_on = Date.today\n\n if params[:from_account_id].present?\n @from_account = Account.find_by_id(params[:from_account_id])\n @transfer.from_account_id = params[:from_account_id]\n end\n if params[:to_account_id].present?\n @to_account = Account.find_by_id(params[:to_account_id])\n @transfer.to_account_id = params[:to_account_id]\n end\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end"
] | [
"0.73351175",
"0.58987296",
"0.585691",
"0.5788956",
"0.5788372",
"0.5784265",
"0.57608414",
"0.5709021",
"0.57020164",
"0.5623236",
"0.56110454",
"0.560429",
"0.5595556",
"0.5553995",
"0.55522555",
"0.553447",
"0.5508299",
"0.5483048",
"0.5443529",
"0.5440238",
"0.54368854",
"0.5421679",
"0.54171956",
"0.5416498",
"0.5412745",
"0.54120743",
"0.5398415",
"0.5393066",
"0.5389011",
"0.5384175",
"0.5369488",
"0.532804",
"0.531227",
"0.5305368",
"0.5296901",
"0.5296473",
"0.5264916",
"0.5256468",
"0.5255733",
"0.52490234",
"0.52452976",
"0.5241321",
"0.52392954",
"0.52391106",
"0.5235566",
"0.5230036",
"0.52265096",
"0.5216961",
"0.52140814",
"0.5207834",
"0.5204391",
"0.51908034",
"0.51879",
"0.5173716",
"0.51687",
"0.51510316",
"0.51459706",
"0.5140862",
"0.51346534",
"0.5133914",
"0.5124012",
"0.511811",
"0.51133806",
"0.51058584",
"0.5103183",
"0.5099886",
"0.5096242",
"0.5094685",
"0.5090046",
"0.508591",
"0.50856304",
"0.5084038",
"0.50753623",
"0.50727797",
"0.50686127",
"0.50682676",
"0.5059549",
"0.5057251",
"0.5056034",
"0.50545",
"0.5053765",
"0.5051461",
"0.5046516",
"0.50432146",
"0.5031803",
"0.5027666",
"0.50272244",
"0.5023751",
"0.5023401",
"0.5022198",
"0.5019709",
"0.50188905",
"0.5018687",
"0.5015206",
"0.5014623",
"0.50080645",
"0.5003284",
"0.4996747",
"0.4993352",
"0.49876344"
] | 0.6879409 | 1 |
Remove the association between the trackgroup and the account | def destroy
@account = Account.find(params[:account][:idAccount])
@account.trackgroups.delete(@trackgroup)
redirect_to(:back)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_group(group)\n self.groups.destroy group \n end",
"def remove_from_group(group)\n self.memberships.find_by(group_id: group.id).destroy!\n end",
"def delete_related_groups\n \n end",
"def destroy\n Group.delete_groups_and_acls([id])\n end",
"def unlink_project\n self.project.remove_groupID(self.id.to_s)\n end",
"def remove_group!( group )\n save if remove_group( group )\n end",
"def destroy\n if !self.insurance_sessions.blank?\n #check insurance session. If there is an insurance billng, then there must be a session.\n errors.add :base, \"The Group is associated to a session and/or claim. Group cannot be deleted\"\n else\n run_callbacks :destroy do\n self.update_column(:deleted, true)\n end\n end\n end",
"def unlink_group\n if self.parentID != nil\n Group.find(self.parentID).remove_members([self.id.to_s])\n end\n end",
"def destroy\n @assign_group_place.destroy\n end",
"def remove_group(group)\r\n\t\tsend('RMG', group.info[:guid])\r\n\t\t## XXX save changes locally?\r\n\t\treturn 1\r\n\tend",
"def delete_group(group)\n\t\t\tend",
"def delete_group(group)\n\t\t\tend",
"def refuse_group group\n group_invitations.where(group: group).first.destroy\n end",
"def unlink_notes \n if self.notes\n self.notes.each do | note | \n note.objects[:Group].delete(self.id.to_s)\n note.save\n end\n end\n end",
"def destroy\n AlbumOwnership.find_by({album_id: @album.id, user_id: current_user.id}).destroy\n end",
"def remove_references(options)\n \t# just got to remove the assigned_pics Tree hash\n \tPictureandmeta.delete_event(self)\n end",
"def unlink\n if current_user.picasa_identity\n current_user.picasa_identity.destroy\n flash[:notice] = \"We've dissassociated your Picasa account from your #{CONFIG.site_name} account.\"\n redirect_to :action => 'options'\n else\n flash[:notice] = \"Your Picasa account has not been linked before!\"\n redirect_to :action => 'options'\n end\n end",
"def remove_tracks(tracks)\n\n tracks.each do |track|\n self.tracks.destroy(track) # remove association\n end\n\n tracks\n end",
"def remove_group\n group = current_account.groups.of_devices.find(params[:group_id])\n\n group.devices.delete(current_account.devices.find(params[:apply_ids].split(\",\")))\n\n redirect_to devices_path\n end",
"def unlink\n if current_user.picasa_identity\n current_user.picasa_identity.destroy\n flash[:notice] = \"We've dissassociated your Picasa account from your NatureWatch NZ account.\"\n redirect_to :action => 'options'\n else\n flash[:notice] = \"Your Picasa account has not been linked before!\"\n redirect_to :action => 'options'\n end\n end",
"def remove_membership(entity)\n\t\tremove_association(entity, \"membership\", \"joinable\", \"joined\")\n\tend",
"def destroy\n @patients_groups = PatientsGroup.find(params[:id])\n @group = @patients_groups.group_id\n @patients_groups.destroy\n\n respond_to do |format|\n format.html { redirect_back_or_default request.referer, notice: \"Association was removed\" }\n format.json { head :no_content }\n end\n end",
"def remove_group\n create_group.tap do |r|\n r.action(:remove)\n end\n end",
"def unjoin(group)\n\t\t\treturn false unless group.is_a?(Group)\n\t\t\tgroup.remove(self)\n\t\tend",
"def perform_destroy\n api.group_destroy(self)\n end",
"def destroy_group(name)\n response = Curl.delete(azure_face_uri << name) do |http|\n http.headers[\"Ocp-Apim-Subscription-Key\"] = key\n end\n response.body_str\n end",
"def delete_group(uuid)\n Uploadcare::Group.delete(uuid)\n end",
"def destroy\n @profile ||= @qualification.profile\n @qualification.destroy\n end",
"def destroy_associations\n end",
"def destroy\n @album = @track.album\n @track.destroy\n redirect_to album_tracks_url(@album)\n end",
"def leave(group)\n group_membership_ids.include? group.id\n groups.destroy(group)\n end",
"def remove\n @group_user.remove!\n respond_to do |format|\n flash[:notice] = 'Membership was cancelled.'\n format.html { redirect_to @group_user.group }\n format.xml { head :ok }\n end\n end",
"def destroy_google_group\n result = Gandalf::GoogleApiClient.delete_google_group(self.apps_id)\n result.data\n end",
"def remove_tag_from_contact\n\t\t\t\t# unlike the remove method in account, this only removes the tag from one contact\n\t\t\t\t\n\t\t\tend",
"def destroy\n @group = Group.find(params[:group_id])\n authorize! :edit, @group\n Hydra::LDAP.remove_users_from_group(@group.code, [params[:id]])\n redirect_to edit_group_path(@group), :notice=>\"Removed member #{params[:id]}\"\n end",
"def destroy\n @group = Group.find_by_param(params[:id])\n @group.tuners.clear\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to(groups_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @account.destroy\n end",
"def unparticipate!(given_event)\n participations.find_by_participated_id(given_event.id).destroy\n end",
"def revoke_role_and_cleanup\n role = Role.find_by(name: 'track_organizer', resource: self)\n\n role&.users&.each do |user|\n user.remove_role 'track_organizer', self\n end\n\n self.selected_schedule_id = nil\n save!\n\n schedules.each(&:destroy!)\n\n events.each do |event|\n event.track = nil\n event.state = 'new'\n event.save!\n end\n end",
"def delete(key)\n key = to_key key\n @group.delete key if @group.key? key\n end",
"def remove_group( group )\n raise TypeError.new('not a group') unless group.is_a?(Ecore::Group)\n tmp_group_ids = self.group_ids.split(',')\n tmp_group_ids.delete(group.id)\n self.group_ids = tmp_group_ids.join(',')\n true\n end",
"def remove_segment_association(segment)\r\n group_messages_segment = self.group_messages_segments.where(:segment_id => segment.id).first\r\n group_messages_segment.news_feed_link_segment.destroy\r\n end",
"def unconnect\n relationship = ContactVenueRelationship.find_by(contact_id: id,\n venue_id: venue.id)\n relationship.destroy\n end",
"def destroy\n @issue_tracker_group.destroy\n @issue_tracker_groups = IssueTrackerGroup.all \n end",
"def destroy\n contact_group = ContactGroup.find(@share_invite.contact_group_id)\n #logger.debug \"Grabbed the contact group #{contact_group} with a list of users of #{contact_group.users}\"\n contact_group.users.delete(current_user)\n @share_invite.destroy\n respond_to do |format|\n format.html { redirect_to homes_url, notice: \"#{contact_group.group_name} has been removed from your Groups list\" }\n format.json { head :no_content }\n end\n end",
"def unlink(contact)\n contact.accounts.delete(self)\n contact.lists = contact.lists.reject{|l|l.account == self}\n if contact.owner == self\n contact.owner = nil\n contact.cached_owner = nil\n end\n contact.save\n end",
"def delete_member\n @group = Group.find(params[:id])\n @user = User.find_by_id(params[:user_id])\n\n if @group.users.include?(@user)\n @group.users.delete(@user)\n @group.save\n flash[:notice] = \"Miembro borrado exitosamente.\"\n end\n\n redirect_to group_path(@group)\n end",
"def disown!(group)\n return if group.class != Group\n e = Entity.find_by(id: self.id)\n return if e.nil?\n relationship = EntityGroupRelationship.find_by(entity_id: self.id, group_id: group.id)\n return if relationship.nil?\n if relationship.position.nil?\n return relationship.destroy\n end\n index = relationship.position\n relationship.destroy\n # self.update_position(index)\n end",
"def destroy\n @reachmailgroup = Reachmailgroup.find(params[:id])\n @reachmailgroup.destroy\n\n respond_to do |format|\n format.html { redirect_to reachmailgroups_url }\n format.json { head :no_content }\n end\n end",
"def remove(album)\r\n found = find_by_name(album.name)\r\n @internal_list.delete(found) unless found.nil?\r\n \r\n self\r\n end",
"def remove_association(server_url, handle)\n raise NotImplementedError\n end",
"def destroy\n\t\traise \"Cannot delete group owners\" if Group.where(created_by: id).count > 0\n\t\tuser_approvals = Approval.where(to_user: id, status: 'pending_approval')\n\t\tuser_approvals.destroy_all if user_approvals.length > 0\n\t\tsuper\n\tend",
"def delete()\n\n MailAccount.destroy(self.id)\n end",
"def leave_team_before_delete\n team&.users&.delete(self)\n team&.cleanup\n end",
"def delete_group_memberships_for_end_users\n self.group_memberships.delete_all if self.end_user?\n end",
"def destroy\n # Elimina un evento\n @event.destroy\n\n redirect_to group_path(uuid: @group.uuid)\n end",
"def deleteEntityAssociation_membership( entity_id, gen_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['gen_id'] = gen_id\n return doCurl(\"delete\",\"/entity/association_membership\",params)\n end",
"def destroy_assignment( assignment_symbol, user ) \n if self.is_started == true \n return nil\n end\n \n GroupLoanAssignment.find(:all, :conditions => {\n :group_loan_id => self.id,\n :assignment_type => GROUP_LOAN_ASSIGNMENT[assignment_symbol],\n :user_id => user.id\n }).each do |gla|\n gla.destroy \n end\n \n return true # success in destroying \n end",
"def remove_association request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n uri, _body, query_string_params = transcode_remove_association_request request_pb\n response = @client_stub.make_post_request(\n uri: uri,\n params: query_string_params,\n options: options\n )\n result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n result\n end",
"def action_remove\n notifying_block do\n remove_user\n remove_group if new_resource.group\n end\n end",
"def synced_destroy(association)\n set_callback(\n :destroy,\n :after\n ) do |doc|\n doc.remove_inverse_keys(association)\n end\n self\n end",
"def delete_accounts\n end",
"def remove_from(associated_model)\n self.send(associated_model.class.to_s.foreign_key + '=', nil)\n save(false)\n end",
"def destroy\n @group = Group.find(params[:id])\n\n mbs = Membership.where \"group_id = ?\", @group.id\n\n mbs.each do |m|\n m.destroy\n end\n\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @bowling_association.record :destroy, current_user, selected_tournament\n @bowling_association.destroy\n\n respond_to do |format|\n format.html { redirect_to bowling_associations_url }\n format.json { head :no_content }\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 destroy\n @add_to_group = AddToGroup.find(params[:id])\n @add_to_group.destroy\n\n respond_to do |format|\n format.html { redirect_to(add_to_groups_url) }\n format.xml { head :ok }\n end\n end",
"def remove_old_sessions_in_group\n candidates = find_old_sessions\n candidates.where(group: @group).destroy_all\nend",
"def remove_from_group(group)\n gm = Fl::Framework::Actor::GroupMember.query_for_actor_in_group(self, group).first\n return false if gm.nil?\n\n self.actor_containers.delete(gm)\n true\n end",
"def destroy\n @personal_group = current_user.personal_groups.find(params[:id])\n @personal_group.destroy\n redirect_to(personal_groups_url)\n end",
"def remove_followingcontest\n current_user.sk.followed_contests.destroy(@contest)\n \n flash[:success] = \"Vous ne recevrez maintenant plus d'e-mail concernant ce concours.\"\n redirect_to @contest\n end",
"def follower_following_delete\n @follower_following = FollowerFollowing.find(params[:id])\n \n @group_user = GroupUser.find_by_sql([\"SELECT gu.* FROM (group_users gu LEFT JOIN groups g ON g.id=gu.group_id) WHERE (g.user_id=#{@login_user.id} AND gu.user_id=#{@follower_following.following.id}) OR (g.user_id=#{@follower_following.following.id} AND gu.user_id=#{@login_user.id})\"])#:user_id=>@login_user.id,:group_id=>group.id)\n @group_user = GroupUser.find_by_sql([\"SELECT gu.* FROM (group_users gu LEFT JOIN groups g ON g.id=gu.group_id) WHERE (g.user_id=#{@follower_following.follower.id} AND gu.user_id=#{@login_user.id}) OR (g.user_id=#{@login_user.id} AND gu.user_id=#{@follower_following.follower.id})\"]) if @group_user.blank?\n @group_user.each do |g_u|\n g_u.destroy\n end\n @follower_following.destroy\n render :text=>\"Success\"\n end",
"def destroy\n @google_analytic.destroy\n end",
"def remove_user_from_group(user, group)\n\t\t\tend",
"def remove_relation(rel)\n relations.delete(rel)\n Roby.remove_relation(rel)\n end",
"def remove2(curation_concern, id)\n member = ActiveFedora::Base.find(id)\n curation_concern.ordered_members.delete(member)\n curation_concern.members.delete(member)\n end",
"def remove_agent_group_id(opts)\n opts = check_params(opts,[:group_id])\n super(opts)\n end",
"def destroy\n\n bp_pic_group = BpPicGroup.find(params[:id])\n bp_pic_group.deleted = 9\n bp_pic_group.deleted_at = Time.now\n set_user_column(bp_pic_group)\n bp_pic_group.save!\n\n respond_to do |format|\n format.html { redirect_to bp_pic_groups_path }\n end\n end",
"def destroy\n\n bp_pic_group = BpPicGroup.find(params[:id])\n bp_pic_group.deleted = 9\n bp_pic_group.deleted_at = Time.now\n set_user_column(bp_pic_group)\n bp_pic_group.save!\n\n respond_to do |format|\n format.html { redirect_to bp_pic_groups_path }\n end\n end",
"def remove_from_all_groups\n self.group_memberships.each {|m| m.destroy}\n end",
"def destroy\n @user_accounts_group.destroy\n respond_to do |format|\n format.html { redirect_to user_accounts_groups_url, notice: 'User accounts group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def hcRemoveGroup _obj, _args\n \"_obj hcRemoveGroup _args;\" \n end",
"def remove_tracking_id(a)\n value = a[self::TRACKING_FIELD]\n a[self::TRACKING_FIELD] =\n value.dup.sub!(/\\n?-- Managed by kennel .*/, \"\") ||\n raise(\"did not find tracking id in #{value}\")\n end",
"def destroy\n @group = Group.find(params[:group_id])\n @purchase.destroy\n redirect_to group_purchases_path(@group)\n end",
"def destroy\n @admitting.destroy\n end",
"def destroy_similar\n group.memberships.where(:user_id => user.id).destroy_all\n end",
"def destroy\n @student_group_association.destroy\n respond_to do |format|\n format.html { redirect_to student_group_associations_url, notice: 'Student group association was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def remove_user!( user )\n user.remove_group!( self )\n end",
"def destroy\n\t\t@ad = Ad.includes({:ad_group => :campaign}, :ad_type).where(\"campaigns.account_id = ?\", @auth_user.account_id).find(params[:id])\n\t\[email protected]_account_id = @auth_user.account_id\n\t\[email protected]_attributes({:enabled => false, :deleted_at => Time.now})\n\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to(ads_url) }\n\t\t\tformat.xml { head :ok }\n\t\tend\n\tend",
"def destroy\n @ail_group = AilGroup.find(params[:id])\n @ail_group.destroy\n\n respond_to do |format|\n format.html { redirect_to(ail_groups_url) }\n format.xml { head :ok }\n end\n end",
"def disassociate!(target)\n associate!(target,{:delete => 1})\n end",
"def api_remove\n data_hash = make_hash\n delete_hash = { division: data_hash[:division][:value] }\n handler.remove(delete_hash, path, subscriber_id)\n end",
"def destroy\r\n @agroup.destroy\r\n respond_to do |format|\r\n format.html { redirect_to agroups_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def remove_read_group\n if media_object && media_object.read_groups.include?(self.token)\n media_object.read_groups -= [self.token]\n media_object.save!\n end\n end",
"def admin_conversations_restrictAccess_removeGroup(options = {})\n raise ArgumentError, 'Required arguments :channel_id missing' if options[:channel_id].nil?\n raise ArgumentError, 'Required arguments :group_id missing' if options[:group_id].nil?\n raise ArgumentError, 'Required arguments :team_id missing' if options[:team_id].nil?\n post('admin.conversations.restrictAccess.removeGroup', options)\n end",
"def destroy\n @flr = @group.flr\n @group.destroy\n redirect_to flr_groups_url(@flr), notice: 'Group was successfully destroyed.'\n end",
"def test_delete\n g = [22058]\n Group.delete(g)\n end",
"def destroy\n @account_group_type = user_default_branch.account_group_types.find(params[:id])\n @account_group_type.destroy\n\n respond_to do |format|\n format.html { redirect_to(account_group_types_url) }\n format.xml { head :ok }\n end\n end",
"def empty_group\n self.group_memberships.each {|m| m.destroy}\n end",
"def delete_account\n @connection.request({\n :method => 'DELETE'\n })\n end"
] | [
"0.6703053",
"0.6574433",
"0.64497894",
"0.64078015",
"0.63958126",
"0.63798153",
"0.63430995",
"0.62892795",
"0.6200289",
"0.6170799",
"0.61654437",
"0.61654437",
"0.611664",
"0.6091575",
"0.60842526",
"0.6076279",
"0.60597086",
"0.60321134",
"0.60212195",
"0.6016487",
"0.5985441",
"0.5976694",
"0.59442574",
"0.59347165",
"0.59197766",
"0.5908345",
"0.59000885",
"0.5873934",
"0.585758",
"0.5845866",
"0.58258325",
"0.5800993",
"0.57861054",
"0.5785035",
"0.57845306",
"0.57738304",
"0.57581186",
"0.5757726",
"0.5749422",
"0.57358205",
"0.5735491",
"0.5732594",
"0.57314503",
"0.5720288",
"0.5713008",
"0.57062906",
"0.56863195",
"0.566372",
"0.5659811",
"0.5658396",
"0.5656068",
"0.5649638",
"0.5645369",
"0.5634228",
"0.5629462",
"0.56257117",
"0.56246924",
"0.562201",
"0.56128776",
"0.5611033",
"0.5607948",
"0.5602757",
"0.5601619",
"0.55989623",
"0.5597053",
"0.55858064",
"0.55727965",
"0.5570658",
"0.556898",
"0.55677617",
"0.5563342",
"0.55614215",
"0.55525",
"0.5548118",
"0.553978",
"0.55387294",
"0.55292743",
"0.55241597",
"0.55241597",
"0.55239624",
"0.5504469",
"0.55041516",
"0.5503617",
"0.5500172",
"0.54988337",
"0.5494855",
"0.54932517",
"0.5492632",
"0.5491271",
"0.54909843",
"0.5490055",
"0.54893136",
"0.54874235",
"0.5486735",
"0.5482266",
"0.54801506",
"0.54799366",
"0.547551",
"0.54748714",
"0.54741"
] | 0.76505816 | 0 |
When an invalid search key is provided | def test_invalid_search_key
key = 'asbhjfkds'
val = 'jahfjg'
results = User.new(key, val).search
assert_equal results, [], 'It must return an empty array if no valid search field is provided'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_no_query_search\n assert_raises(RuntimeError) { DuckDuckGo::search({:bad => :hash}) }\n end",
"def validate_keyword!\n raise ResponseError::ArgumentError.new(\"Search keyword is missing\") if self.keywords.nil?\n raise ResponseError::ArgumentError.new(\"Search keyword is blank\") if self.keywords.empty?\n end",
"def test_missing_search_value\n key = '_id'\n val = '8098765432'\n results = User.new(key, val).search\n assert_equal results, [], 'It must return an empty array if no search result is found'\n end",
"def ensure_filter_match!(key, passed_values, valid_values, message)\n if request.get?\n # For GET, it's not necessary to validate the values. Objects which don't exist\n # simply don't match the search.\n # For POST, we want to validate since the user's request to create push jobs\n # relating to nonexistent objects can't be satisfied.\n return\n end\n\n # It's valid to pass some non-string types (like integers) as a string\n valid_values = valid_values + valid_values.map(&:to_s)\n\n invalid_values = passed_values - valid_values\n return if invalid_values.empty?\n\n message += invalid_values.sort.join(', ').truncate(80)\n raise DetailedArgumentError.new(key => message)\n end",
"def key_not_found?\n ->(body) { body =~ /#{INVALID[:key_not_found]}/ }\n end",
"def advanced_search\n raise ActionController::RoutingError.new('Not Found')\n end",
"def verify_param_existence(key)\n raise SmsConnect::ApiError, \"#{key} parameter not found\" unless @current_user.phone_numbers_search(instance_variable(key)).present?\n end",
"def validate_search_args!(args)\n unless args.is_a?(Hash)\n if args.respond_to?(:to_hash)\n args = args.to_hash\n else\n raise \"Invalid parameter: #{args}. Search args must respond to :to_hash.\"\n end\n end\n\n args\n end",
"def validate!(token)\n raise ArgumentError, \"Invalid search token\" if !token || token.strip.empty?\n end",
"def invalid_key(system_key)\n fail InvalidSyntax, \"`#{system_key}` must be a String or a Symbol.\"\n end",
"def validate_query_param_keys_clause(errors)\n return errors unless query_params.keys\n\n query_params.keys.each_with_object(errors) do |key, errors|\n next errors if allowed_query_params.include?(key)\n\n errors.push(\n source: { parameter: key },\n title: 'Invalid Query Parameter',\n detail: \"#{key} is unknown query parameter.\"\n )\n end\n end",
"def test_nil_search\n assert_raises(RuntimeError) { DuckDuckGo::search(:query => nil) }\n end",
"def search\n @error = params[:error]\n end",
"def check!\n super()\n \n if not @keyword_params.nil? and not @keyword_params.kind_of? Hash\n raise Exception::new(\"Keyword params must be Hash.\")\n end\n end",
"def search_error\n system(\"clear\")\n puts Spacer\n puts \"Sorry! \".colorize(:red) + @search_menu_input + \" is not a valid input.\".colorize(:red)\n end",
"def search_not_found\n puts \"Please enter \\'menu\\' to return to the menu or enter another search term.\"\n new_entry = gets.strip.downcase\n if new_entry == \"menu\"\n DCPSCLIcontroller.call\n else \n self.return_name_search_results(find_by_name(new_entry))\n end \n end",
"def not_found; end",
"def check_key(key, array)\n return true if ![nil, '', '-'].include?(array[key])\n raise RuntimeError, \"#{key} is empty\"\n end",
"def incorrect_keys(the_input, invalid_hash = Array.new, the_array)\n the_input.each_key do |key|\n unless the_array.include?(key.to_s)\n invalid_hash << key\n end\n end\n raise K2IncorrectParams.new(invalid_hash) if invalid_hash.present?\n end",
"def handle_key(key); end",
"def may_not_exist!(key, without: nil, **options)\n return may_not_exist_without! key, without if without\n before_validation do\n JSONAPIonify::Continuation.new(**options).check(self) do\n invalid_keys = self.keys.map(&:to_sym) & keys.map(&:to_sym)\n if invalid_keys.present?\n invalid_keys.each do |k|\n errors.add(k, 'is not permitted')\n end\n end\n end\n end\n end",
"def test_wrongKey\n a = Job_mail.new(\"testing/input_tests/inputFakeKey\")\n assert_nil(a.keyword, \"keyword worked!\")\n end",
"def forbidden_keyword_validation\n errors.add :value, I18n.t('errors.messages.exclusion') if value =~ /(#{blocked_keywords.split(',').map(&:strip).join('|')})/\n end",
"def safe_search\n begin\n get_books\n rescue\n puts \"It looks like there was an issue with your search. Let's try again!\"\n puts \"Press enter to try again\"\n puts \"(select r to return home or q to quit the program)\"\n response = gets.chomp.downcase\n case response\n when \"r\"\n command_list\n when \"q\"\n quit_program\n else\n safe_search\n end\n end\n end",
"def validate_key_exists(*args)\n args.each do |key|\n validators << lambda do |message|\n raise Refinery::InvalidMessageError, \"Key does not exist in message: #{key}\" unless message[key]\n end\n end\n end",
"def validate_keyword(keyword)\n if RESERVED_KEYWORDS.include?(keyword)\n reserved = RESERVED_KEYWORDS.collect { |key| \"'#{key}'\" }\n raise ReservedGearKeyword, \"'#{keyword}' is a reserved keyword. Reserved Keywords: #{reserved.join(', ')}.\"\n end\n\n culprit = find_by_keyword(keyword)\n\n unless culprit.nil?\n raise DuplicateGearKeyword, \"Keyword '#{keyword}' already used by #{culprit}\"\n end\n\n true\n end",
"def unmatched_keys; end",
"def sanitized_search\n return '' if params[:search].nil?\n params[:search][:query].nil? ? '' : params[:search][:query]\n end",
"def validate_key!(key)\n unless key.is_a?(String) or key.is_a?(Symbol)\n raise SketchUpJSON::JSONEncodeError, \"This hash can not generate valid JSON\"\n end\n end",
"def missing_hash_key(key:, source_row:, node_id:)\n # nothing\n end",
"def check_parameter\n \t# response to the JSON if searchterm or sort_type is not present.\n \trender json: {success: false, message: 'Something wrong with the parameters'}, status: 400 if (params[:searchterm].nil? || params[:sort_type].nil?)\n end",
"def is_error?(key, value)\n case key\n when 'api_token_secret_key' then true if value.empty? ||\n value !~ /\\Askey_[a-zA-Z0-9]+\\z/\n\n when 'account_alias' then true if value.empty? ||\n value.length > 15 ||\n value !~ /\\A[a-z0-9]+\\z/\n\n when 'recipe' then true if value.empty? ||\n value.length > 25 ||\n value !~ /\\A[a-zA-Z0-9_]+\\z/\n\n when 'server' then true if !value.empty? &&\n value !~ /\\A[a-zA-Z0-9_]+\\z/\n\n when 'groups' then true if !value.empty? &&\n value !~ /\\A[a-zA-Z0-9_\\s\\,]+\\z/\n else\n false\n end\n end",
"def check_search_criteria(search_criteria)\n if search_criteria[:country_code].nil?\n raise ArgumentError, \"country_code is a required search criteria\"\n end\n\n\n unless only_registration_number_or_company_name_provided?(search_criteria)\n raise ArgumentError, \"registration_number or company_name (not both) are \" \\\n \"required search criteria\"\n end\n\n end",
"def no_search_requested?\n @params.length < 4\n end",
"def search_filter(name)\n raise Puppet::DevError, \"No search string set for LDAP terminus for #{self.name}\"\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 validate(exemplar, hash, message)\n hash.each_key do |k|\n fail NebulousError, \"#{message} key '#{k}'\" unless exemplar.include?(k)\n end\n end",
"def validate_option_key(opts, key)\n raise \"opts[:#{key}] or opts['#{key}'] must be given\" unless opts.has_key?(key)\n end",
"def set_SafeSearch(value)\n set_input(\"SafeSearch\", value)\n end",
"def set_SafeSearch(value)\n set_input(\"SafeSearch\", value)\n end",
"def verify_search_arguments(options)\n if options.nil? || options.empty?\n return ARGUMENT_ERROR\n end\n if options[:org].nil?\n return ARGUMENT_NOT_VALID\n end\n\n if options[:obj_name].nil? || options[:obj_id].nil?\n return ARGUMENT_NOT_VALID\n end\n if !options[:obj_id].nil? && (@obj = MetaData.active.find(options[:obj_id])).nil?\n return OBJ_NOT_FOUND\n elsif !options[:obj_name].nil? && (@obj = MetaData.active.by_name(options[:org], options[:obj_name])).nil?\n return OBJ_NOT_FOUND\n end\n if (@fields = MetaDataField.all_fields.by_id(@obj.obj_id)).nil?\n return FIELD_NOT_FOUND\n end\n return OK\n end",
"def search_params\n params.require(:search_string)\n end",
"def invalid_query?\n ->(body) { body =~ /#{INVALID[:query]}/ }\n end",
"def any_unrecognized_keys?(expected, given)\n unrecognized_keys(expected, given).any?\n end",
"def recipe_name_search\n key_word = User.prompt.ask(\"Please piece of recipe name\")\n key_word == nil ? (key_word = 'bdncjkascndxasklxnasmndxb') : (key_word)\n recipe_query = Recipe.all.filter{|recipe| recipe.name.include?(key_word.capitalize())}\n\n if recipe_query != []\n recipe_viewer(recipe_query)\n else\n puts 'Invalid Search!'.colorize(:red);\n end\n end",
"def search(find_val)\n false\n end",
"def handle_search(query)\n @results = search query unless query.empty?\n\n prompt_for_selection(query)\nend",
"def issueKey_test(key, no_throw = false)\n if key.nil? || !(/^[A-Z]+-[0-9]+$/i =~ key)\n raise Jiralicious::JiraError.new(\"The key #{key} is invalid\") unless no_throw\n return false\n end\n return true\n end",
"def search(query); end",
"def handle_search(search_term)\n if @@items.include?(search_term) #?\n return \"#{search_term} is one of our items\" #we can do different things depending on the search path\n else\n return \"Couldn't find #{search_term}\"\n end\n end",
"def parse_not_found\n if @input.match?(/% Object \"(.*)\" not found in database\\n/)\n while @input.scan(/%(.*)\\n/) # strip junk\n end\n @ast[\"NotFound\"] = true\n end\n end",
"def catch_bad_format_param\n if ['json', 'rss'].include? params[:format]\n render plain: \"Invalid parameter: we do not provide search results in #{params[:format]} format.\", status: 406\n end\n end",
"def search_value\n params[:search] || nil\n end",
"def search_value\n params[:search] || nil\n end",
"def set_search_query\n if (params[:search] === nil)\n @search_query = nil\n elsif (params[:search].match(/^[-+]?([1-8]?\\d(\\.\\d+)?|90(\\.0+)?),\\s*[-+]?(180(\\.0+)?|((1[0-7]\\d)|([1-9]?\\d))(\\.\\d+)?)$/))\n @search_query = params[:search].delete(' ').split(',')\n else (params[:search])\n @search_query = params[:search]\n end\n end",
"def search_key\n \"#{location}_search\".to_sym\n end",
"def handle_not_found(exception)\n raise exception\n end",
"def validate_query_params!\n return if [:from, :to].all? { |param| query_params.include?(param) }\n\n raise_error 'Grafana query parameters must include from and to.'\n end",
"def enter_search_value\n puts \"Please enter a search value.\"\n entry = gets.strip.downcase\n entry\n end",
"def invalid_attributes search='', replace=''\n @valid_attributes ||= {}\n @valid_attributes[search]=replace unless search.blank?\n @valid_attributes\n end",
"def handle_not_found_error!\n raise Common::Exceptions::UnprocessableEntity.new(detail: 'Person Not Found')\n end",
"def search(term)\n raise \"Must be overridden\"\n end",
"def inventory_search_params\n params[:q].assert_valid_keys('s', 'item_name_cont', 'quantity_cont', 'inventory_type_cont') unless params[:q].blank?\n params[:q]\n end",
"def search_with_id\n\n _search_id = params[:search_id]\n _search_entry = params[:ticker]\n\n if !_search_id.blank? || !_search_entry.blank?\n search\n else\n redirect_to root_path\n end\n end",
"def test_search_user_unsuccessful\n keyword = \"\"\n expected = 1001\n response = Net::HTTP.get(URI.parse('http://localhost:3000/v1/users/search/'+keyword))\n actual = JSON.parse(response.body)\n result = assert_equal(expected,actual['meta']['code'])\n puts this_method_name + \" - \" + result.to_s\n end",
"def search; end",
"def sanitize_search_params source_params\n\n my_params = source_params.reject { |k,v| v.nil? }\n\n my_params.except(:action, :controller, :id, :commit, :utf8)\n end",
"def search_by_name\n puts 'Enter a name to search for'\n lookup_name = gets.chomp\n result = @search.name(lookup_name)\n puts \"\\n#{formatted_search_result(result)}\"\n rescue EntryNotFoundError => e\n puts e.message\n end",
"def search_domain\n @search_domain || raise(MissingSearchDomainException.new)\n end",
"def raise_not_found\n\t\traise ActionController::RoutingError.new(\"No route matches #{params[:unmatched_route]}\")\n\tend",
"def search_param\n params[:loans][:search] if params[:accounting_entries] || nil\n end",
"def rl_noninc_forward_search(count, key)\r\n noninc_search(1, (key == '?') ? '?' : nil)\r\n end",
"def set_search_condition\n @search_condition = SearchConditionService.detail(current_user.id, params[:view_number])\n routing_error if @search_condition.blank?\n end",
"def validate_params\n if lat.blank? || lng.blank? || property_type.blank? || offer_type.blank?\n @properties = []\n @message = \"Looks like some search parameters are missing!\"\n fail!(:validation_failed) && abort!\n end\n end",
"def check_enter key\r\n\t\t\t\t\t\t\tkey == \"\" || key.match(/\\A[[:blank:]]+\\z/)\r\n\t\t\t\t\t\tend",
"def check_encoding(query)\n # make sure all params have valid encoding\n all_values_for_hash(query).each do |param|\n if param.respond_to?(:valid_encoding?) && !param.valid_encoding?\n halt_with_404\n end\n end\n end",
"def validate_api_key\n unless self.api_key #&& (api_key[\"-\"] || self.api_endpoint)\n raise KeyyoError, \"You must set an api_key prior to making a call\"\n end\n end",
"def search_from_fresh_index( query, page )\n begin\n @search_data = @index.search( query, page )\n return true\n rescue IndexSearchError => error\n @errors.push({\n :highlight => \"The search term you used has caused an error on the search engine, please try another search term without any special characters in it.\",\n :full_text => error\n })\n return false\n end\n end",
"def address_search?\n # do any of the parameters start with pick_address\n pick_address = params.each_key.find { |key| key.start_with? 'pick_address_' }.present?\n params[:search] || params[:select] || params[:manual_address] || params[:change_postcode] || pick_address\n end",
"def find_variable(key, raise_on_not_found: T.unsafe(nil)); end",
"def parse_search; end",
"def query_param\n return unless search_query\n \"search=#{search_query}&phrase=true\"\n end",
"def label_for_search_field(key)\n field_config = blacklight_config.search_fields[key]\n return if key.nil? && field_config.nil?\n\n field_config ||= Blacklight::Configuration::NullField.new(key: key)\n\n field_config.display_label('search')\n end",
"def safe_obj_by_key!(obj_key)\n safe_obj_by_key(obj_key) or raise ActiveRecord::RecordNotFound\n end",
"def find_by!(params = {})\n find_by(params) || begin\n message = params.map do |key, value|\n \"#{key}=#{value}\"\n end\n raise RecordNotFound, message.to_sentence\n end\n end",
"def raise_not_found!\n\n raise ActionController::RoutingError.new(\"No route matches #{params[:unmatched_route]}\")\n\n end",
"def search_params\n return {} unless params[:q]\n params.require(:q).permit!\n end",
"def raise_provider_key_error(params)\n token, id = params[:service_token], params[:service_id]\n raise ProviderKeyOrServiceTokenRequired if blank?(token)\n raise ServiceIdMissing if blank?(id)\n raise ServiceTokenInvalid.new(token, id)\n end",
"def search(args)\n raise NotImplementedError, \"Not implemented\"\n end",
"def what_are_you_looking_for?\n raise Exceptions::NotFound.new(404, 'Not Found; You did not find what you were expecting because it is not here. What are you looking for?')\n end",
"def searching?\n return true unless params[:search].nil?\n end",
"def filter_search_keys(search_keys)\n search_keys.delete_if { |_key, value| value.empty? }\n end",
"def bad_record! key, *args\n warn \"Bad record #{args.inspect[0..400]}\"\n puts [\"bad_record-\"+key, *args].join(\"\\t\")\n end",
"def search(value)\n # YOUR WORK HERE\n end",
"def call_search(search, input, list)\n Rc.send(\"#{search}_search\", input || '', list)\n rescue\n message = $!.is_a?(NoMethodError) && !Rc.respond_to?(\"#{search}_search\") ?\n \"Completion search '#{search}' doesn't exist.\" :\n \"Failed during completion search with '#{$!.message}'.\"\n raise FailedMissionError.new(self), message\n end",
"def test_lookup_given_nil_as_a_key_returns_nil\r\n assert_nil @backend.send(:lookup, 'en', nil)\r\n end",
"def query\n sanitize search_params['query']\n end",
"def search_params\n params.require(:address_summary).permit(:postcode) unless params[:address_summary].nil?\n end",
"def has_search_parameters?\n result = super || !params[:t].blank? || !params[:l].blank? || !params[:resolve].blank?\n end",
"def unrecognized_input\n puts \"Input not recognized or is invalid.\"\n exit_screen\n end"
] | [
"0.6851448",
"0.6571141",
"0.6411196",
"0.63957906",
"0.6312697",
"0.625414",
"0.6059312",
"0.6052371",
"0.6050583",
"0.6030073",
"0.5966123",
"0.596612",
"0.59601176",
"0.59398204",
"0.58007246",
"0.57896674",
"0.575152",
"0.57205075",
"0.5708595",
"0.5698149",
"0.5688029",
"0.56440145",
"0.5628308",
"0.558797",
"0.5569765",
"0.5566818",
"0.5564156",
"0.5548793",
"0.55430007",
"0.5529403",
"0.551425",
"0.55078644",
"0.550734",
"0.5501447",
"0.54972965",
"0.54735184",
"0.544883",
"0.54430544",
"0.5438313",
"0.5438313",
"0.5429937",
"0.54281145",
"0.5428056",
"0.54201996",
"0.5416926",
"0.5416576",
"0.54161054",
"0.539485",
"0.53828496",
"0.5373431",
"0.5364972",
"0.5360185",
"0.53591204",
"0.53591204",
"0.53470874",
"0.5340226",
"0.53304434",
"0.5322212",
"0.53189635",
"0.53183675",
"0.53168637",
"0.5308307",
"0.53083014",
"0.53073615",
"0.53065854",
"0.53021413",
"0.5292325",
"0.5281054",
"0.5274131",
"0.5272782",
"0.5268455",
"0.5260141",
"0.52579457",
"0.52556753",
"0.5253081",
"0.5252028",
"0.52519006",
"0.5242161",
"0.5240745",
"0.5237577",
"0.52326596",
"0.52244574",
"0.52195626",
"0.52193815",
"0.5218734",
"0.52184355",
"0.5218383",
"0.52091837",
"0.5206937",
"0.5197438",
"0.519713",
"0.51948875",
"0.5184607",
"0.51835215",
"0.51808923",
"0.51765513",
"0.51650184",
"0.51648635",
"0.5164671",
"0.51631546"
] | 0.7263118 | 0 |
When the search value is not found | def test_missing_search_value
key = '_id'
val = '8098765432'
results = User.new(key, val).search
assert_equal results, [], 'It must return an empty array if no search result is found'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def not_found; end",
"def search(find_val)\n false\n end",
"def not_found\n @not_found = yield\n end",
"def parse_not_found\n if @input.match?(/% Object \"(.*)\" not found in database\\n/)\n while @input.scan(/%(.*)\\n/) # strip junk\n end\n @ast[\"NotFound\"] = true\n end\n end",
"def search(value)\n # YOUR WORK HERE\n end",
"def handle_search(search_term)\n if @@items.include?(search_term) #?\n return \"#{search_term} is one of our items\" #we can do different things depending on the search path\n else\n return \"Couldn't find #{search_term}\"\n end\n end",
"def handle_not_found(exception)\n raise exception\n end",
"def search_for_no_results\n visit('/locations?keyword=asdfdsggfdg')\n end",
"def record_not_found\n raise ActiveRecord::RecordNotFound\n end",
"def find_by!(values)\n find_by(values) || fail(RecordNotFound.new(\"#{self.query_as(:n).where(n: values).limit(1).to_cypher} returned no results\", name))\n end",
"def nothingToSearch? \n\t\treturn $toSearch.empty? \n\tend",
"def search_index(games, search_term)\n search_index = games.find_index(search_term)\n search_index || \"Not Found\"\nend",
"def search_not_found\n puts \"Please enter \\'menu\\' to return to the menu or enter another search term.\"\n new_entry = gets.strip.downcase\n if new_entry == \"menu\"\n DCPSCLIcontroller.call\n else \n self.return_name_search_results(find_by_name(new_entry))\n end \n end",
"def complete_search\n if is_boolean? && !!@search_value != @search_value\n puts 'No result found'\n return\n end\n if NUMBER_TO_OBJECT_MAP[@object].column_names.include?(@search_term)\n results = NUMBER_TO_OBJECT_MAP[@object].where(\"#{@search_term}\" => @search_value)\n else\n results = NUMBER_TO_OBJECT_MAP[@object].joins(@search_term.to_sym).where(\"#{@search_term}\" => { value: @search_value })\n end\n \n if !results.empty?\n puts 'Result'\n puts '-------------'\n results.each do |result|\n result.render_object\n end\n else\n puts 'No result found'\n end\n results\n end",
"def not_found\n\n render_error( :not_found )\n\n end",
"def not_found\n super(t('messages.list_item.errors.find'))\n end",
"def results?() ! find(locator(:no_results_message)) end",
"def parse_not_found\n if @input.match?(/Nincs (.*?) \\/ No match\\n/)\n p(\"whois.nic.hu: parse_not_found\") if 1 == 2 || $DEBUG\n @input.scan(/Nincs (.*?) \\/ No match\\n/)\n return @ast['NotFound'] = true\n end\n @ast['NotFound'] = false\n end",
"def not_found\n render status: :not_found\n end",
"def test_invalid_search_key\n key = 'asbhjfkds'\n val = 'jahfjg'\n results = User.new(key, val).search\n assert_equal results, [], 'It must return an empty array if no valid search field is provided'\n end",
"def find(value)\n end",
"def test_no_query_search\n assert_raises(RuntimeError) { DuckDuckGo::search({:bad => :hash}) }\n end",
"def search\n @error = params[:error]\n end",
"def search_unknown\n BFS.search(UnknownFinder.new(@droid, @map))\n end",
"def search_value\n params[:search] || nil\n end",
"def search_value\n params[:search] || nil\n end",
"def not_found\n super(t('messages.employee.errors.find'))\n end",
"def found?\n @found ||= !(self.result[\"Ares_odpovedi\"][\"Odpoved\"][\"Pocet_zaznamu\"] == '0' ||\n self.result[\"Ares_odpovedi\"][\"Odpoved\"][\"error\"])\n end",
"def search; end",
"def advanced_search\n raise ActionController::RoutingError.new('Not Found')\n end",
"def search_type\n 0\n end",
"def record_not_found\n ActiveRecord::RecordNotFound\n end",
"def handle_search(query)\n @results = search query unless query.empty?\n\n prompt_for_selection(query)\nend",
"def what_are_you_looking_for?\n raise Exceptions::NotFound.new(404, 'Not Found; You did not find what you were expecting because it is not here. What are you looking for?')\n end",
"def validate_values\n @days_format = OpenOrder.get_select_values\n @search_by_values = OpenOrder.get_search_values\n #checking whether search for(textbox) value is empty string and search by(select box) value is other than \"all\"\n if params[:search_for].blank? && params[:search_by] != \"all\"\n flash.now[:alert] = I18n.translate(\"error\",:scope => \"open_orders.validate_values\")\n render :index\n end\n #End of checking whether search for(textbox) value is empty string and search by(select box) value is other than \"all\"\n end",
"def look_up(term='')\n\n NSLog(\"Something just tried to look up the term #{term}\")\n false\n\n end",
"def find(_index_value)\n raise \"Implement in subclass\"\n end",
"def test_nil_search\n assert_raises(RuntimeError) { DuckDuckGo::search(:query => nil) }\n end",
"def search(word)\n \n end",
"def get_results\n # 1. if the search is blank do NOT run the search (handled in subclasses)\n !self.search_text.blank? && !self.search_query.blank? && !self.search_type.blank? && !self.search_locale.blank?\n end",
"def render_not_found(exception)\n if params[:id] and ((s = Structure.only_deleted.where(id: params[:id]).first) or\n (s = Structure.only_deleted.where(slug: params[:id]).first))\n redirect_to root_search_page_path(s.dominant_root_subject, s.city, subdomain: 'www'),\n status: 301, notice: \"Cette page n'existe plus.\"\n else\n Bugsnag.notify(exception)\n redirect_to root_path, status: 301, notice: \"Cette page n'existe plus.\"\n end\n end",
"def doesnt_exist\n\t\tputs \"That item doesn't exist.\"\n\t\tget_item\n\tend",
"def return_not_found\n return_error(error_code: 404, message: 'Not Found')\n end",
"def found?\n return false if no_search\n\n id.present? || records.present?\n end",
"def set_search_condition\n @search_condition = SearchConditionService.detail(current_user.id, params[:view_number])\n routing_error if @search_condition.blank?\n end",
"def record_not_found_error\n if Rails.env == 'development'\n render # will give us the stack trace\n else\n flash[:notice] = I18n.t('blacklight.search.errors.invalid_solr_id')\n params.delete(:id)\n index\n render 'index', :status => 404\n end\n end",
"def show_not_found\n render_json_error(code: :show_not_found, status: :not_found)\n end",
"def search_results\n @results = Landmark.search(params[:search])\n if @results.length == 0\n flash[:alert] = 'No match found! Please try again.'\n redirect_to '/'\n end\n end",
"def search(term)\n raise \"Must be overridden\"\n end",
"def record_not_found!\n render partial: 'errors/404', status: 404 && return\n end",
"def request_not_found(response)\n response.code == 404 ||\n response['status'] == 'Bad Request' ||\n response.parsed_response['Results']['state'].size == 0\n end",
"def search(games, search_term)\n search_index = games.find_index(search_term)\n search_result = if search_index\n \"Game #{search_term} found: #{games[search_index]} at index #{search_index}.\"\n else\n \"Game #{search_term} not found.\"\n end\n return search_result\nend",
"def fail_not_found_if_nil(promise)\n promise.then do |val|\n if val\n val\n else\n raise RecordNotFoundException.new\n end\n end\n end",
"def find_variable(key, raise_on_not_found: T.unsafe(nil)); end",
"def handle_not_found_error!\n raise Common::Exceptions::UnprocessableEntity.new(detail: 'Person Not Found')\n end",
"def not_found(h)\n return unless h[:message].command?\n\n dest = h[:message].source\n msg = t('not_found', body: h[:message].body)\n\n robot.send_message(dest, msg)\n end",
"def fire_entity_not_found(entity); end",
"def sorry_message_displayed\n expect(no_items_found).to include(\"we're sorry we couldn't find anything to match your search\")\n end",
"def not_found\n render json: nil, status: :not_found\n end",
"def search\n\n end",
"def not_found\n render plain: \"not found\"\n end",
"def record_not_found\n render json: {error: I18n.t('errors.not_found')}.to_json, status: 404\n end",
"def not_found(u, a)\n f = true\n\t\ta.each do |ss|\n\t\t\tif ss[\"user_id\"] == u\n\t\t\t\tf = false\n\t\t\t\tbreak\n\t\t\tend\n\t\tend\n\t\treturn f\n end",
"def record_not_found_message\n resource_name&.present? ? I18n.t(:x_not_found, name: resource_name&.singularize&.titleize) : I18n.t(:not_found)\n end",
"def search \n\n end",
"def search_by_name\n puts 'Enter a name to search for'\n lookup_name = gets.chomp\n result = @search.name(lookup_name)\n puts \"\\n#{formatted_search_result(result)}\"\n rescue EntryNotFoundError => e\n puts e.message\n end",
"def not_found(message = t('messages.generics.errors.find'))\n error(message, 404)\n end",
"def search\n end",
"def search_non_note(string)\n logger.info \"Searching for '#{string}'\"\n search string\n end",
"def nothing_found?\n @matching_documents.nil? or @matching_documents.entries.empty?\n end",
"def not_found(options={}, &b)\n error NotFound, options, &b\n end",
"def search(array, value)\n raise NotImplementedError, \"Method not implemented\"\nend",
"def search(array, value)\n raise NotImplementedError, \"Method not implemented\"\nend",
"def search\n end",
"def search\n end",
"def search\n end",
"def search\n end",
"def search\n end",
"def search\n end",
"def search\n end",
"def search\n end",
"def search\n end",
"def search\n end",
"def index\n @articles = Article.search(params[:search])\n if params[:search].present?\n if @articles.empty?\n @search = \"No records found for '#{params[:search]}'\"\n else \n @search = \"Your query- '#{params[:search]}' yielded #{@articles.count} results.\"\n end \n end \n end",
"def search(array, value)\n raise NotImplementedError, \"Method not implemented\"\nend",
"def catch_not_found\n yield\n rescue ActiveRecord::RecordNotFound\n flash[:notice] = \"Hittades inte\"\n redirect_to root_url\n end",
"def record_not_found\n render json: { error: { message: 'Record not found.' }}, status: :not_found\n end",
"def search_for_result(array, value)\n puts \"In search for result which happens when size of 2\"\n result = array.select {|number| number == value}\n if result.empty?\n puts \"value not found\"\n else\n puts \"#{value} found\"\n @found = true\n end\nend",
"def search=(value)\n @search = value\n end",
"def test_search_user_unsuccessful\n keyword = \"\"\n expected = 1001\n response = Net::HTTP.get(URI.parse('http://localhost:3000/v1/users/search/'+keyword))\n actual = JSON.parse(response.body)\n result = assert_equal(expected,actual['meta']['code'])\n puts this_method_name + \" - \" + result.to_s\n end",
"def search_filter(name)\n raise Puppet::DevError, \"No search string set for LDAP terminus for #{self.name}\"\n end",
"def tolerate_not_found\n begin\n yield\n rescue Capybara::ElementNotFound\n nil\n end\n end",
"def finds(value)\n eles_by_json_visible_contains '*', value\n end",
"def no_found(message)\n render json: {\n errors: message,\n status: :no_found\n }, status: 404\n end",
"def record_not_found(error)\n render json: {\n success: false,\n message: error.message\n }, status: :record_not_found\n end",
"def search_for_result(array, value)\n result = array.select {|number| number == value}\n if result.empty?\n puts \"value not found in final array\"\n else\n puts \"#{value} found in final array\"\n end\n @found = true\nend",
"def search\n\n end",
"def record_not_found\n render json: {\n error: 'Record not found.'\n }, status: :not_found\n end",
"def result_contains_element(index, field)\n eles = get_entries\n\n if eles.nil? || eles.length == 0\n fail(ArgumentError.new('no results were found'))\n else\n # elements exist, get the correct locator\n case field.downcase\n when 'lead'\n @loc = input_elements[:result_lead]\n when 'negative'\n @loc = input_elements[:result_negative]\n when 'neutral'\n @loc = input_elements[:result_neutral]\n when 'positive'\n @loc = input_elements[:result_positive]\n else fail(ArgumentError.new(field + ' is not a valid field'))\n end\n results = get_entries\n result = results[index]\n unless result.has_css? @loc\n fail(ArgumentError.new('record does not contain the field ' + field))\n end\n end\n end",
"def make_search_data(cond_wheather)\n @search_query = \"\"\n\n\n end"
] | [
"0.71171206",
"0.6929736",
"0.65412277",
"0.6439798",
"0.63442653",
"0.6289069",
"0.6286666",
"0.6256247",
"0.62430304",
"0.6236858",
"0.6144926",
"0.6132984",
"0.6064994",
"0.6013763",
"0.600359",
"0.59803987",
"0.59547776",
"0.5950873",
"0.5944596",
"0.59420496",
"0.5926359",
"0.59208494",
"0.5870278",
"0.5861112",
"0.5854699",
"0.5854699",
"0.58455116",
"0.5830619",
"0.5821299",
"0.58193207",
"0.5818695",
"0.58117193",
"0.58101803",
"0.5810093",
"0.57930607",
"0.5741417",
"0.5737546",
"0.5723241",
"0.5693545",
"0.56929326",
"0.56850314",
"0.5679745",
"0.5675284",
"0.5672979",
"0.56711257",
"0.56711024",
"0.565855",
"0.56482595",
"0.56429297",
"0.5640963",
"0.56322914",
"0.5631504",
"0.5594093",
"0.559248",
"0.55922854",
"0.55905974",
"0.5586743",
"0.55861086",
"0.5574671",
"0.55729085",
"0.5572619",
"0.55705565",
"0.5567403",
"0.55583805",
"0.5558109",
"0.5552859",
"0.5545869",
"0.5537144",
"0.5537047",
"0.55319965",
"0.5530618",
"0.55292207",
"0.55292207",
"0.55241394",
"0.55241394",
"0.55241394",
"0.55241394",
"0.55241394",
"0.55241394",
"0.55241394",
"0.55241394",
"0.55241394",
"0.55241394",
"0.5516439",
"0.551542",
"0.55141723",
"0.54925156",
"0.5489619",
"0.54875636",
"0.5484848",
"0.5474541",
"0.5473736",
"0.54717416",
"0.54491866",
"0.54437387",
"0.5442547",
"0.5436019",
"0.5435271",
"0.5432729",
"0.5428715"
] | 0.6616584 | 2 |
Test for string case insensitive search | def test_case_insensitivity
data = JSON.parse(File.read(User::JSON_FILENAME))
key = 'name'
val = data[0]['name'].downcase
results = User.new(key, val).search
assert_block('The search must ignore string case while matching') { results.include?(data[0]) }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def case_insensitive_match; end",
"def case_insensitive_match=(_arg0); end",
"def case_insensitive(input)\n return 1 unless input\n\n input.split(\"\").each do |i|\n return 0 if /[[:upper:]]/ =~ i\n end\n\n return 1\n end",
"def case_sensitive?\n true\n end",
"def case_sensitive?\n [email protected]?\n end",
"def checkCase str\n if str.upcase == str || str.downcase == str\n return false\n else\n return true\n end\n end",
"def case_sensitive?\n [email protected]?\n end",
"def ignore_case(search, case_type)\n (case_type == :smart && search !~ /[A-Z]/) || case_type == :ignore\n end",
"def case_insensitivity\n if url_params['case_insensitive'] == \"true\"\n \"&case_insensitive=on\"\n else\n \"\"\n end\n end",
"def case_sensitive_matching\n @case_sensitive_matching = false if @case_sensitive_matching.nil?\n @case_sensitive_matching\n end",
"def detect_capital_use(word)\n var1 = word.upcase\n var2 = word.downcase\n var3 = word.capitalize\n return true if word == var1\n return true if word == var2\n return true if word == var3\n false\nend",
"def case_sensitive_matching=(value)\n @case_sensitive_matching = value\n end",
"def is_lower?(c)\n return c != c.capitalize\n end",
"def get_case(str)\n return 'upper' if str.upcase == str\n return 'lower' if str.downcase == str\n 'mixed'\nend",
"def is_capitalized?(word)\n return true if word == word.upcase\n return false\n end",
"def ilike(*args)\n SQL::StringExpression.like(*(args << {:case_insensitive=>true}))\n end",
"def finder?(word, letter)\n word.upcase.include?(letter.upcase)\nend",
"def upcase?(string)\n string == string.upcase\nend",
"def strict_matching(ingredient_name,item)\n return item.downcase.include?(ingredient_name)\nend",
"def test_match_case_sensitive_no_match\r\n\t\t#content with case insensitive, but not case sensitive match\r\n\t\tcontent = \"first line.\\nthis string doesn not contain a case insensitive match on: mymatch123\"\r\n\t\tsnort_rule_content = SnortRuleContent.new\r\n\t\tsnort_rule_content.unescaped_string = \"MyMatch123\"\r\n\t\tsnort_rule_content.nocase = false\r\n\t\tassert(!snort_rule_content.match(content,0),\"incorrect case sensitive match on content.\")\r\n\tend",
"def test_match_case_sensitive\r\n\t\t#content with exact match\r\n\t\tcontent = \"first line.\\nthis string contains a case sensitive match on: MyMatch123\"\r\n\t\tsnort_rule_content = SnortRuleContent.new\r\n\t\tsnort_rule_content.unescaped_string = \"MyMatch123\"\r\n\t\tsnort_rule_content.nocase = false\r\n\t\tmatch = snort_rule_content.match(content,0)\r\n\t\tassert_equal(60, match,\"no case sensitive match on content.\")\r\n\tend",
"def uppercase_alt?(str)\n str == str.upcase\nend",
"def search_string string\n string.downcase.gsub(/\\s/, '')\n end",
"def lower_case?()\n LuckyCase.lower_case? self\n end",
"def is_upper? str; str == str.upcase; end",
"def case_sensitive?\n indexes.any?{|i| i.case_sensitive?}\n end",
"def set_case_insensitive\n @case_insensitive = CaseInsensitive.find(params[:id])\n end",
"def str_includes(str1, str2)\n if str2.downcase.include?(str1.downcase)\n true\n else\n false\n end\nend",
"def alpha_search(str)\r\n\r\nend",
"def check_in(word)\n if /lab/i =~ word # regex with \"i\" for case insensitive.\n puts word\n else\n puts \"Not present.\" \n end\nend",
"def test_match_nocase\r\n\t\t#content with exact match\r\n\t\tcontent = \"first line.\\nthis string contains a case insensitive match on: MyMatch123\"\r\n\t\tsnort_rule_content = SnortRuleContent.new\r\n\t\tsnort_rule_content.unescaped_string = \"mymatch123\"\r\n\t\tsnort_rule_content.nocase = true\r\n\t\tmatch = snort_rule_content.match(content,0)\r\n\t\tassert_equal(62, match,\"no case insensitive match on content.\")\r\n\tend",
"def proper(word)\n /[[:upper:]]/.match(word) != nil\n end",
"def case_insensitive_searchable_encrypt(data)\n _encrypt(data, _search_prefix(data.downcase, LOWERCASE_SEARCHABLE, @key_id, @key))\n end",
"def is_upper?(string)\n string == string.upcase\nend",
"def same_case( your_string , options = Hash.new )\n return your_string.upcase if options[:upcase] == true\n return your_string.upcase if options[:downcase] == false\n your_string.downcase\nend",
"def check(word)\n if word.downcase =~ /lab/\n puts word\n end\nend",
"def is_uppercase?(word)\nend",
"def is_lowercase(string)\n lowercase = ('a'..'z').to_a\n lowercase.include? string\nend",
"def alphabetical?(str)\r\n ('A'..'Z').to_a.include? str.upcase\r\nend",
"def search(word)\n \n end",
"def uppercase?(str)\n str == str.upcase\nend",
"def uppercase?(str)\n str == str.upcase\nend",
"def uppercase?(str)\n str == str.upcase\nend",
"def uppercase?(str)\n str == str.upcase\nend",
"def reduce_case_insensitive(_production, _range, _tokens, _children)\n Regexp::IGNORECASE\n end",
"def snakecase(string); end",
"def wildcard_search_param(parameter)\n parameter.downcase\n end",
"def search(field, value)\n @rows.select {|row| get_variable(row, field).downcase == value.downcase}\n end",
"def correct?(string)\n \"#{string}\".downcase == self.string.downcase\n end",
"def silent?(sentencia)\n # sentencia =~ /[A-Z]/ && sentencia.upcase == sentencia\n /[A-Z]/.match(sentencia) && sentencia.upcase == sentencia\n end",
"def valid_case_string?()\n LuckyCase.case(self) != nil\n end",
"def has_lab(string)\n new_string = string.downcase\n if new_string =~ /lab/\n puts \"Match! #{string}\"\n else\n puts \"No Match\"\n end\nend",
"def screaming?\n upcase == self && self =~ /[A-Z]/\n end",
"def is_lowecase letter\n if letter == letter.downcase\n return true\n else\n return false\n end\n\nend",
"def test_match_case_sensitive_binary_no_match\r\n\t\t#content with exact match\r\n\t\tcontent = \"first line.\\nthis string doesnt contains a match on: My\"\r\n\t\tsnort_rule_content = SnortRuleContent.new\r\n\t\tsnort_rule_content.unescaped_string = \"M|79|Mat|63 68|123\" #equals MyMatch123\r\n\t\tsnort_rule_content.nocase = false\r\n\t\tassert(!snort_rule_content.match(content,0),\"case sensitive match on no match content.\")\r\n\tend",
"def lower_case!(words)\n raise NotImplementedError # TODO\nend",
"def same_case( str , options = Hash.new )\n return str.upcase if options[:upcase] || options[:downcase] == false\n str.downcase\nend",
"def same_case( str , options = Hash.new )\n return str.upcase if options[:upcase]\n return str.upcase if options[:downcase] == false\n str.downcase\nend",
"def test_downcase\n value = \"XYZ\"\n assert_equal \"xyz\", value.downcase\n end",
"def search\n\tuser_search = gets.strip.downcase\n\tsearch_input(user_search)\nend",
"def is_lower?\n r = 'a'..'z'\n self.split('').keep_if{ |c| r.include?(c) }.count == self.length\n end",
"def mixed_case?()\n LuckyCase.mixed_case? self\n end",
"def lowercase_search_prefixes(data)\n _search_prefixes(data.downcase, LOWERCASE_SEARCHABLE)\n end",
"def uppercase?(string)\n string == string.upcase\nend",
"def uppercase?(string)\n string == string.upcase\nend",
"def uppercase?(string)\n string == string.upcase\nend",
"def uppercase?(string)\n string == string.upcase\nend",
"def uppercase?(string)\n string == string.upcase\nend",
"def uppercase?(string)\n string == string.upcase\nend",
"def snake_case(str); end",
"def test_downcase\n value = 'XyZ'\n assert_equal('xyz', value.downcase)\n end",
"def test_downcase\n value = 'XyZ'\n assert_equal('xyz', value.downcase)\n end",
"def test_downcase\n value = 'XyZ'\n assert_equal('xyz', value.downcase)\n end",
"def name_search(search)\n words = search.split(' ')\n results = where(\"UPPER(name) LIKE ?\", \"%#{words[0]}%\")\n for i in 1...words.size\n results = results.where(\"UPPER(name) LIKE ?\", \"%#{words[i]}%\")\n end\n return results\n end",
"def test_downcase_string\n test = 'MiXeD'\n down = test.downcase\n assert_equal down, 'mixed'\n end",
"def matches_title?(q)\n search_regexp = /(\\b|[\\/\\._-])#{Regexp.escape(q)}/\n\n @result[:title].downcase =~ search_regexp ||\n # Break CamelCase words into their individual components and search\n @result[:title].gsub(/([a-z\\d])([A-Z])/,'\\1 \\2').downcase =~ search_regexp\n end",
"def name_case(options = {})\n options = { :lazy => true, :irish => true }.merge options\n\n # Skip if string is mixed case\n if options[:lazy]\n first_letter_lower = self[0] == self.downcase[0]\n all_lower_or_upper = (self.downcase == self || self.upcase == self)\n\n return self unless first_letter_lower || all_lower_or_upper\n end\n\n localstring = downcase\n localstring.gsub!(/\\b\\w/) { |first| first.upcase }\n localstring.gsub!(/\\'\\w\\b/) { |c| c.downcase } # Lowercase 's\n\n if options[:irish]\n if localstring =~ /\\bMac[A-Za-z]{2,}[^aciozj]\\b/ or localstring =~ /\\bMc/\n match = localstring.match(/\\b(Ma?c)([A-Za-z]+)/)\n localstring.gsub!(/\\bMa?c[A-Za-z]+/) { match[1] + match[2].capitalize }\n\n # Now fix \"Mac\" exceptions\n localstring.gsub!(/\\bMacEdo/, 'Macedo')\n localstring.gsub!(/\\bMacEvicius/, 'Macevicius')\n localstring.gsub!(/\\bMacHado/, 'Machado')\n localstring.gsub!(/\\bMacHar/, 'Machar')\n localstring.gsub!(/\\bMacHin/, 'Machin')\n localstring.gsub!(/\\bMacHlin/, 'Machlin')\n localstring.gsub!(/\\bMacIas/, 'Macias')\n localstring.gsub!(/\\bMacIulis/, 'Maciulis')\n localstring.gsub!(/\\bMacKie/, 'Mackie')\n localstring.gsub!(/\\bMacKle/, 'Mackle')\n localstring.gsub!(/\\bMacKlin/, 'Macklin')\n localstring.gsub!(/\\bMacKmin/, 'Mackmin')\n localstring.gsub!(/\\bMacQuarie/, 'Macquarie')\n end\n localstring.gsub!('Macmurdo','MacMurdo')\n end\n\n # Fixes for \"son (daughter) of\" etc\n localstring.gsub!(/\\bAl(?=\\s+\\w)/, 'al') # al Arabic or forename Al.\n localstring.gsub!(/\\bAp\\b/, 'ap') # ap Welsh.\n localstring.gsub!(/\\bBen(?=\\s+\\w)/,'ben') # ben Hebrew or forename Ben.\n localstring.gsub!(/\\bDell([ae])\\b/,'dell\\1') # della and delle Italian.\n localstring.gsub!(/\\bD([aeiou])\\b/,'d\\1') # da, de, di Italian; du French; do Brasil\n localstring.gsub!(/\\bD([ao]s)\\b/,'d\\1') # das, dos Brasileiros\n localstring.gsub!(/\\bDe([lr])\\b/,'de\\1') # del Italian; der Dutch/Flemish.\n localstring.gsub!(/\\bEl\\b/,'el') # el Greek or El Spanish.\n localstring.gsub!(/\\bLa\\b/,'la') # la French or La Spanish.\n localstring.gsub!(/\\bL([eo])\\b/,'l\\1') # lo Italian; le French.\n localstring.gsub!(/\\bVan(?=\\s+\\w)/,'van') # van German or forename Van.\n localstring.gsub!(/\\bVon\\b/,'von') # von Dutch/Flemish\n\n # Fix roman numeral names\n localstring.gsub!(\n / \\b ( (?: [Xx]{1,3} | [Xx][Ll] | [Ll][Xx]{0,3} )?\n (?: [Ii]{1,3} | [Ii][VvXx] | [Vv][Ii]{0,3} )? ) \\b /x\n ) { |match| match.upcase }\n\n localstring\n end",
"def matches? (search)\n if (search.nil? || search == \"\")\n return true\n end\n search = search.gsub(/[^0-9a-z ]/i, '').downcase\n searches = search.split(' ')\n \n searches.each do |word|\n word += ' '\n title = self.title.nil? ? ' ' : self.title.gsub(/[^0-9a-z ]/i, '').downcase + ' '\n description = self.description.nil? ? ' ' : self.description.gsub(/[^0-9a-z ]/i, '').downcase + ' '\n venue_name = self.venue.name.nil? ? ' ' : self.venue.name.gsub(/[^0-9a-z ]/i, '').downcase + ' '\n if !(title.include?(word) || description.include?(word) || venue_name.include?(word))\n return false\n end\n end\n\n return true\n end",
"def spell_out str\n str.downcase\nend",
"def test_exclusion_match_nocase\r\n\t\tcontent = \"first line.\\nthis string does not contain a case sensitive match on: MyMatch123\"\r\n\t\tsnort_rule_content = SnortRuleContent.new\r\n\t\tsnort_rule_content.not_modifier = true\r\n\t\tsnort_rule_content.unescaped_string = \"mymatch123\"\r\n\t\tsnort_rule_content.nocase = false\r\n\t\tmatch = snort_rule_content.match(content,0)\r\n\t\tassert_equal(0, match,\"case sensitive exclusion match on content didnt fire.\")\t\r\n\tend",
"def check_string(string)\n\tzombie_apocalypse_supplies = [\"hatchet\", \"rations\", \"water jug\", \"binoculars\",\n \"shotgun\", \"compass\", \"CB radio\", \"batteries\"]\n\tzombie_apocalypse_supplies.each do |item|\n\t\tif string.downcase == item.downcase\n\t\t\treturn true\n\t\tend\n\tend\n false\nend",
"def same_case(str, upcase = true)\n return str.upcase if upcase\n str.downcase\nend",
"def uppercase?(string)\n string.upcase == string\nend",
"def uppercase?(string)\n string.upcase == string\nend",
"def upcase(s)\n s.upcase!\n true\nend",
"def test_match_case_sensitive_special_char\r\n\t\t#content with exact match\r\n\t\tcontent = \"first line.\\nthis string contains a case sensitive match on: My(Match123\"\r\n\t\tsnort_rule_content = SnortRuleContent.new\r\n\t\tsnort_rule_content.unescaped_string = \"My(Match123\" \r\n\t\tsnort_rule_content.nocase = false\r\n\t\t\r\n\t\tmatch = snort_rule_content.match(content,0)\r\n\t\tassert_equal(60, match,\"no case sensitive match on content with special char.\")\r\n\tend",
"def lower_case(words)\n raise NotImplementedError # TODO\nend",
"def myfind (str)\n if str.match(/^[[:graph:]]+$/) # name of the vaccine\n Vaccine.where(\"lower(name) like ?\", \"%#{str.downcase}%\")\n end\n end",
"def is_upcase?(char)\n downcased_char = char.downcase\n downcased_char != char\nend",
"def all_words_capitalized?(arr)\n arr.all? {|word| word[0].upcase == word[0] && word[1..-1].downcase == word[1..-1]}\nend",
"def match_name?(gotten_name, requested_name)\n gotten_name.text.strip.downcase == requested_name.downcase\n end",
"def not_sensitive(myString)\n if [\"Admin\",\"admin\",\"Administrator\",\"ADMIN\",\"ADMINISTRATOR\"].include? myString\n false\n else\n true\n end\n end",
"def case_sensitive!\n @flags &= ~File::FNM_CASEFOLD\n end",
"def is_all_low?\n return self.downcase == self\n end",
"def string_in_all_caps(the_string)\n puts 'your string in all caps is ' + the_string.upcase\nend",
"def sort_case(value)\n @case_sensitive = value\n end",
"def lab_in_string(word)\n\tword = word.downcase\n\tif /lab/ =~ word\n\t\tputs 'lab is in the string '+word+'.'\n\telse\n\tputs 'Lab is not in the string '+word+'.'\t\n\tend\nend",
"def test_match_case_sensitive_within\r\n\t\t#content with exact match\r\n\t\tcontent = \"123MyMatch123MyMatch\"\r\n\t\tsnort_rule_content = SnortRuleContent.new\r\n\t\tsnort_rule_content.unescaped_string = \"MyMatch\"\r\n\t\tsnort_rule_content.within = 10\r\n\t\tsnort_rule_content.nocase = false\r\n\t\tmatch = snort_rule_content.match(content,10)\r\n\t\tassert_equal(13, match,\"no match on content with within.\") #13 pos of second MyMatch\r\n\tend",
"def find_by_case_insensitive_token(token)\n return if token.nil?\n where(\"lower(#{token_with_table_name}) = ?\", token.downcase).first\n end",
"def test_other_than_first_character\n %w( iTunes TitleCase ).each do |word|\n assert_equal word, word.titlecase\n end\n end"
] | [
"0.8204122",
"0.7702296",
"0.7471744",
"0.7460243",
"0.74514866",
"0.7351669",
"0.731728",
"0.7147571",
"0.7125956",
"0.7116514",
"0.69175905",
"0.6901857",
"0.6888603",
"0.68343616",
"0.6830883",
"0.6830476",
"0.6806664",
"0.6806233",
"0.66675276",
"0.66439974",
"0.663596",
"0.6635835",
"0.662169",
"0.6583386",
"0.65800023",
"0.6513652",
"0.6500483",
"0.6485886",
"0.64725924",
"0.6470204",
"0.6457691",
"0.64390796",
"0.6417944",
"0.63955843",
"0.63936555",
"0.6365766",
"0.6364029",
"0.63571995",
"0.6351154",
"0.6329089",
"0.63273394",
"0.63273394",
"0.63273394",
"0.63273394",
"0.63211006",
"0.6315233",
"0.63092756",
"0.6307501",
"0.63032866",
"0.6301573",
"0.629199",
"0.6289662",
"0.62847763",
"0.6284109",
"0.6259584",
"0.6256129",
"0.62550306",
"0.6251278",
"0.62245893",
"0.6221734",
"0.6219136",
"0.62132275",
"0.6192432",
"0.61705583",
"0.61705583",
"0.61705583",
"0.61705583",
"0.61705583",
"0.61705583",
"0.6165834",
"0.6165416",
"0.6165416",
"0.6165416",
"0.61640775",
"0.6141813",
"0.6132309",
"0.61111546",
"0.610135",
"0.6097204",
"0.60880566",
"0.6083974",
"0.6076783",
"0.6072003",
"0.6072003",
"0.60601634",
"0.60587543",
"0.6057923",
"0.6056363",
"0.60547227",
"0.60487115",
"0.6040615",
"0.6024715",
"0.601968",
"0.6019425",
"0.6009094",
"0.6007776",
"0.60039425",
"0.5996615",
"0.5996106",
"0.59947246"
] | 0.74331015 | 5 |
sms superfunction for receiving texts | def receive_sms
uninitialize_sms
body = params[:Body]
phone_number = normalize_phone params[:From].strip
@problem_text = body.split
action = sms_parsing(body).downcase
if action == "join"
sms_create_account
return
elsif Account.find_by_phone_number(phone_number) == nil
sms_send(params[:From], "Please first create an account by texting the word 'join'.")
return
end
if !@sms_error
case action
when /^add$/,/^insert$/
sms_create
when /^accept$/
sms_accept_problem
when /^get$/
@offset = false
sms_get(0)
when /^edit$/
sms_edit
when /^delete$/, /^destroy$/
sms_delete
when /^next$/
offset = session["offset"]
if offset == nil
sms_error("Sorry, there is no saved session right now. Please first text \"GET\" with @location !skill %number of texts you want to allow.")
else
@offset = true
sms_get(offset)
end
when /^detail$/, /^details$/, /^describe$/
sms_detail
when /^account$/
forgot_acc
when /^change$/
sms_change_password
when /^password$/
forgot_password
# when /^skill$/, /^skills$/
# sms_skill
when /^keywords$/, /^key$/, /^keys$/, /^help$/
sms_keywords
when /^explain$/
sms_explain
else
if is_num?(action)
session[:received_confirmation] = action
sms_confirm_acc
else
sms_wrong_keyword
end
end
end
render :nothing => true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def receive_sms\n @view = \"sms\"\n @body = params[\"Body\"]\n @phone_number = params[\"From\"]\n set_user_create_message_parse_and_point\n end",
"def new; send_sms; end",
"def send_text\n Rails.logger.info \"Sending \\\"#{text}\\\" to #{number}...\"\n Twilio::Sms.message(TWILIO_CONFIG['caller_id'], number, text)\n end",
"def sms\n \t\n \t#flash[:notice] = params\n \t#redirect_to root_path\n\n TwilioTextMessenger.new( params[:phone], params[:message]).call\n \t\n end",
"def send_text_message(text_message)\n number_to_send_to = text_message.receiver\n message = text_message.content\n twilio_sid = \"AC50070372767bdf26a090b08007bba07f\"\n twilio_token = \"8ae1cdbb08d55b99cab34174c3cd8bbb\"\n twilio_phone_number = \"2245209581\"\n @twilio_client = Twilio::REST::Client.new twilio_sid, twilio_token\n @twilio_client.account.sms.messages.create(\n :from => \"+1#{twilio_phone_number}\",\n :to => number_to_send_to,\n :body => message\n )\n \n end",
"def send_sms_message(text, to, from)\n deliver_message_via_carrier(text, to, from)\nend",
"def twilio_send_text_message!(client,phone_num,msg)\n begin\n sms = client.account.sms.messages.create(\n :from => TWILIO_PHONE,\n :to => phone_num,\n :body => msg)\n rescue Exception => e\n puts \"Problems with twilio:\\n#{e}\"\n end\n end",
"def sms\n # Give Twilio the TwiML payload instructions\n twiml_payload\n end",
"def send_message(text)\n end",
"def message_type\n 'sms'\n end",
"def sms\n @response, @documents = get_solr_response_for_field_values(SolrDocument.unique_key,params[:id])\n if request.post?\n url_gen_params = {:host => request.host_with_port, :protocol => request.protocol}\n tinyPass = request.protocol + request.host_with_port + catalog_path(params['id'])\n tiny = tiny_url(tinyPass)\n if params[:to]\n phone_num = params[:to].gsub(/[^\\d]/, '')\n unless params[:carrier].blank?\n if phone_num.length != 10\n flash[:error] = I18n.t('blacklight.sms.errors.to.invalid', :to => params[:to])\n else\n email = RecordMailer.sms_record(@documents, {:to => phone_num, :carrier => params[:carrier], :callnumber => params[:callnumber], :location => params[:location], :tiny => tiny}, url_gen_params)\n end\n\n else\n flash[:error] = I18n.t('blacklight.sms.errors.carrier.blank')\n end\n else\n flash[:error] = I18n.t('blacklight.sms.errors.to.blank')\n end\n\n unless flash[:error]\n email.deliver\n flash[:success] = \"Text sent\"\n redirect_to catalog_path(params['id']) unless request.xhr?\n end\n end\n unless !request.xhr? && flash[:success]\n respond_to do |format|\n format.js { render :layout => false }\n format.html\n end\n end\n end",
"def consume_sms(message, text_message_options)\n object_name = text_message_options[message.body.strip] ? text_message_options[message.body.strip][0] : nil\n format = !object_name.nil? ? text_message_options[message.body.strip][1] : \"\"\n if message.body.strip == \"#0\" || object_name.nil?\n keys = text_message_options.keys\n info_message = \"\"\n keys.each do |x|\n info_message << \"#{x} for #{text_message_options[x][0]}\\n\"\n end\n \n return info_message\n end\n\n @account.object_instances_as_sms(object_name, format)\n end",
"def send_text\n\nend",
"def process_sms(body)\n return I18n.t('sms.nothing_in_msg') if body.blank?\n command, text = extract_commands(body)[0] # parse to first word=command, rest = text\n return case command.downcase\n when 'd' then group_deliver(text)\n when 'group', 'groups' then do_list_groups\n when 'info' then do_info(text) \n# when 'location' then do_location(text) \n when 'update', 'updates' then send_updates(text)\n when 'report', 'rep' then report_update(text)\n when '?', 'help' then do_help(text)\n when /\\A!/ then process_response(command, text)\n # More commands go here ...\n else\n unsolicited_response(body) || I18n.t('sms.unknown_command', :command => command)\n end\n end",
"def text(options, params, object_name, format=\"\")\n body = \"\"\n if format.empty?\n outgoing_text_option = @account.outgoing_text_options.where(:name => object_name).first\n # Find the format string from fields that were passed.\n body = outgoing_text_option.build_text(object_name, params)\n else\n body = format\n end\n\n from_phone_number = options[:from_phone_number]\n phone_number = options[:phone_number]\n\n begin\n twilio_account.sms.messages.create(:from => from_phone_number, :to => phone_number, :body => body)\n rescue\n Rails.logger.error \"Unable to send SMS...: #{$!.message}\"\n Rails.logger.error $!.backtrace.join(\"\\n\")\n raise\n end\n ::SmsExtension::Message.create(:from => from_phone_number, :to => phone_number, :body => body)\n end",
"def receive(sms)\n sms = connection.parse(sms)\n new.receive(sms)\n end",
"def send_sms\n puts \"Send a message.\"\nend",
"def send_sms\n status = self.status\n if status.upcase == 'INTERVENTION'\n self.message\n end\n end",
"def send_sms (text, receiver, logger) \r\n sms = Skuby::Gateway.send_sms text, receiver\r\n\r\n if sms.success? \r\n response = { status: sms.status, \r\n text: text, \r\n receiver: receiver, \r\n remaining_sms: sms.remaining_sms\r\n }\r\n response.merge! sms_id: sms.sms_id if sms.sms_id?\r\n\r\n logger.debug \"SMS SENT: #{response.to_s}\"\r\n\r\n else\r\n response = { status: sms.status, \r\n error_code: sms.error_code, \r\n error_message: sms.error_message, \r\n text: text, \r\n receiver: receiver\r\n }\r\n response.merge! sms_id: sms.sms_id if sms.sms_id?\r\n\r\n logger.error \"SMS SENT: #{response.to_s}\" \r\n end\r\n\r\n sms.success?\r\nend",
"def sms\n reply = TwilioService.new.process_inbound_sms(params)\n render_twiml_message(reply) if reply\n end",
"def sms\n account_sid = params[:AccountSid]\n body = params[:Body]\n from = params[:From]\n from_zip = params[:FromZip]\n if from && body && # account_sid == TWILIO_ACCOUNT_SID \n sms = TwilioNet.new()\n sms.send_sms('2146680255', truncate(\"FROM:#{from} BODY:#{body}\", :length => 159) )\n render :layout => 'empty', :template => 'public/sms' \n else\n raise error \n end \n rescue\n render :text => \"Invalid Params #{params.inspect}\"\n end",
"def sends_sms?\n false\n end",
"def sms number, message\n response = @connection.cmd \"String\" =>\"sms send #{number} #{message}\", \"Match\" => /OK|KO:(.*)/, \"Timeout\" => 5\n if response.chomp == \"OK\"\n true\n else\n raise response.chomp.sub \"KO:\",''\n end\n end",
"def sms(number, message, sec=SMS_SEND_TIMEOUT)\n @logger.log(\"Sending message.\")\n\n msg = ATPhone::SMS::Message.new(message, number)\n \n # Turn on text mode\n send(\"AT+CMGF=1\")\n # Specify number\n raw_send(\"AT+CMGS=\\\"#{msg.number}\\\"\\r\")\n # send message\n raw_send(msg.text + EOM, sec)\n end",
"def send(txt, to, options = {})\n options.default = nil\n api_request(\"sendSms.php\", {\n txt: txt,\n to: to,\n idGroup: options[:idGroup],\n source: options[:source],\n flash: options[:flash],\n dateTimeSend: options[:dateTimeSend],\n onlydelivery: options[:onlydelivery],\n use_alfasource: options[:use_alfasource],\n discountID: options[:discountID],\n channel: options[:channel]\n })\n end",
"def process_response(command, text)\n message_id = command[1..99]\n message = Message.find_by_id(message_id)\n#puts \"**** command=#{command}, text=#{text}, @sender.id=#{@sender.id}, message=#{message.id}\"\n if message\n @possible_senders.each do |a_member|\n message.process_response(:member => a_member, :response => text, :mode => 'SMS')\n end\n return I18n.t(\"sms.thanks_for_response\") \n else\n return I18n.t(\"sms.thanks_but_not_found\", :id => message_id) \n end\n return ''\n end",
"def twilio_sms\n sms = {\n :sid => params[:SmsSid], \n :from => params[:From],\n :to => params[:To],\n :body => params[:Body],\n #:status => params[:SmsStatus], # this will be used later for confirmation with Twilio \n }\n @txt = Txt.new(sms) \n \n @status_report = TWILIO_CONFIG[\"base_url\"].to_s + '/home/twilio_status'\n\n #@txt.twilio_reply_sms\n\n respond_to do |format|\n if @txt.save and @txt.match_coupon?(sms)\n flash[:notice] = 'Message was successfully received.' \n format.xml { @txt }\n else\n flash[:notice] = 'Delivery failed.' \n format.xml { @txt }\n end\n end\n\n end",
"def send_sms(message)\n api_response = \"\"\n if !self.mobile.blank?\n txtlocal = Txtlocal.find_by_sms_type(Txtlocal::GROUP_CHAT)\n if !txtlocal.nil?\n txtlocal.message_contents = message\n api_response = txtlocal.send_sms(self.mobile)\n end\n else\n api_response = \"You have not provided any mobile number. Please go to your 'Account' to set up a mobile number\"\n end\n return api_response\n end",
"def send_sms(content, tonumber)\n tonumber = format(tonumber);\n \tbegin\n @client.messages.create({\n \t :from => @from_number,\n \t :to => tonumber,\n \t :body => content,\n })\n rescue Twilio::REST::RequestError => e\n message = I18n.t(\"errors.sms_not_sent\")\n rescue NoMethodError => e\n message = I18n.t(\"errors.sms_not_sent\")\n else\n message = I18n.t(\"notice.success\")\n end\n\n return message\n\n end",
"def to_sms_text\n semantics = self.to_semantic_values\n body = []\n body << I18n.t('blacklight.sms.text.title', value: semantics[:title].first) unless semantics[:title].blank?\n body << I18n.t('blacklight.sms.text.author', value: semantics[:author].first) unless semantics[:author].blank?\n\n if self.holdings.present?\n item = preferred_item\n library = Holdings::Library.new(item.library).name\n folio_code = Folio::LocationsMap.for(library_code: item.library, location_code: item.home_location)\n location = Folio::Locations.label(code: folio_code) || Constants::LOCS.fetch(item.home_location, item.home_location)\n\n body << I18n.t('blacklight.sms.text.library_location', library:, location:)\n body << I18n.t('blacklight.sms.text.callnumber', value: item.callnumber)\n end\n\n body.join(\"\\n\") unless body.empty?\n end",
"def send_text(sms, phones)\n phones.each do |phone|\n post_response = Faraday.post do |request|\n request.url \"https://api.twilio.com/2010-04-01/Accounts/#{ACCOUNT_SID}/SMS/Messages.json\"\n request.headers['Authorization'] = \"Basic \" + Base64.strict_encode64(\"#{ACCOUNT_SID}:#{AUTH_TOKEN}\")\n request.body = URI.encode_www_form({'From' => PHONE_NUMBER, 'To' => phone.phone_number, 'Body' => sms.message})\n end\n end\n end",
"def send_text(text, phone)\n account_sid = ENV[\"ACCOUNT_SID\"]\n auth_token = ENV[\"AUTH_TOKEN\"]\n client = Twilio::REST::Client.new account_sid, auth_token\n\n account = client.account\n message = account.sms.messages.create({\n :from => ENV[\"PHONE\"],\n :to => phone,\n :body => text})\n puts message\n end",
"def send_sms(params)\n self.current_params = params\n response = send_request(params)\n smart_response(response.parsed_response)\n end",
"def send_text_message(client:, user:, body:, tax_return: nil, locale: nil, to: nil)\n intake = Hub::ClientsController::HubClientPresenter.new(client).intake\n return unless intake.sms_notification_opt_in_yes?\n\n if intake.sms_notification_opt_in_yes? && !intake.sms_phone_number.present?\n DatadogApi.increment('clients.missing_sms_phone_number_for_sms_opt_in')\n return\n end\n\n replacement_args = { body: body, client: client, preparer: user, tax_return: tax_return, locale: locale }\n replaced_body = ReplacementParametersService.new(**replacement_args).process\n client.outgoing_text_messages.create!(\n to_phone_number: to || intake.sms_phone_number,\n sent_at: DateTime.now,\n user: user,\n body: replaced_body,\n )\n end",
"def sms\n @sms ||= TermuxRubyApi::SubSystems::Sms.new(self)\n end",
"def send_text_message(body)\n if self.mobile.present?\n begin\n TWILIO_CLIENT.messages.create(from: ENV['TWILIO_PHONE_NUMBER'], to: self.mobile, body: body)\n rescue Twilio::REST::RequestError => e\n puts \"Twilio Error: #{e.message}\"\n end\n end\n end",
"def send_sms phone, message\n message = URI.escape message\n response = RestClient.get \"#{sender_base_url}/?from=#{@from}&to=#{phone}&text=#{message}&pass=#{@application_pass}\"\n @response = Response.new response\n end",
"def message\n process_mess\n end",
"def process_outgoing_message(id, text) \n return if self.process_command(id, text.split.first, text.split[1..-1]) or not self.online? # try to execute commands\n @logger.warn 'Sending message to chat %s' % id\n reply = text.lines[0].scan(/\\d+/).first.to_i if text.lines[0] =~ /^> ?[0-9]{10}/ \n text = TD::Types::FormattedText.new(text: !reply ? text : text.lines[1..-1].join, entities: [])\n message = TD::Types::InputMessageContent::Text.new(text: text, disable_web_page_preview: false, clear_draft: false)\n return (id) ? @telegram.send_message(id, reply.to_i, nil, nil, message).rescue{|e| @xmpp.send_message(@jid, id, \"Not sent: %s\" % e)} : message\n end",
"def sms_perform(object_instance, options={})\n account = ::SmsExtension::Account.first\n consumer = AP::SmsExtension::Sms::Consumer.new(account)\n options = HashWithIndifferentAccess.new(options)\n options[:phone_number] ||= account.phone_number\n options[:outgoing_message_format] ||= account.outgoing_message_format\n options[:from_phone_number] ||= (!account.from_phone_number.blank? ? account.from_phone_number : ENV['SMS_EXTENSION_TWILIO_FROM_SMS_NUMBER'])\n\n consumer.text(options, object_instance.attributes, object_instance.class.name, options[:outgoing_message_format])\n end",
"def incoming_text\n # Looks up the incoming phone number in our database and\n # retrieves the lead if found:\n begin\n standard_phone = Phoner::Phone.parse(params['From'], country_code: '1').to_s\n @lead = Lead.find_by(standard_phone: standard_phone) if standard_phone\n rescue\n # An exception may happen if the texter's phone number has a very unusual\n # format. We can just move on, as finding the texter's number in our\n # database is not critical.\n end\n\n # If we do find the texter in our database, we provide extra info about\n # this lead to our call converter:\n extra_info = @lead.email if @lead\n\n # We text the texter's message to the call converter's phone:\n @client = Twilio::REST::Client.new\n @client.messages.create(\n from: ENV['TWILIO_PHONE_NUMBER'],\n to: ENV['EMPLOYEE_PHONE_NUMBER'],\n body: \"Message from #{params['From']}: #{params['Body']}. Extra Info: #{extra_info}\"\n )\n end",
"def text\n lead = Lead.find(params[:lead_id])\n client = Twilio::REST::Client.new\n if params[:auto_text] || !params[:body].blank?\n client.messages.create(\n from: ENV['TWILIO_PHONE_NUMBER'],\n to: lead.phone,\n body: params[:auto_text] ? custom_message(lead.first_name) : params[:body]\n )\n flash[:success] = \"Text Sent!\"\n else\n flash[:alert] = \"NO TEXT SENT\"\n end\n redirect_to \"/leads/#{lead.id}/edit\"\n rescue Twilio::REST::RequestError => error\n redirect_to \"/leads/#{lead.id}/edit\"\n flash[:alert] = \"NO TEXT SENT - #{error}\"\n end",
"def sms(body, to: nil, from: nil, method: nil, action: nil, status_callback: nil, **keyword_args)\n append(Sms.new(\n body,\n to: to,\n from: from,\n method: method,\n action: action,\n status_callback: status_callback,\n **keyword_args\n ))\n end",
"def deliver_message_via_carrier(text, to, from)\n SMS_CARRIER.deliver_message(text, to, from)\nend",
"def messages\n @logger.log(\"Getting messages from phone.\")\n \n # Get a list of messages\n msg = nil\n msgs = ATPhone::SMS.new(self)\n\n # Turn on text mode\n send(\"AT+CMGF=1\")\n \n resp = send(\"AT+CMGL\")\n resp.each_line do |line|\n # If it is a message header\n if line[0..5] == '+CMGL:'\n # Add formed message to list\n msgs[msg.index] = msg unless msg.nil?\n \n # Create new message from phone data\n index, status, number = line[7..-1].split(',')\n msg = ATPhone::SMS::Message.new(\n \"\",\n number.strip.gsub('\"', ''),\n index.to_i,\n status.strip.gsub('\"', '')\n )\n # If it's not a command, then it's text\n elsif not msg.nil?\n msg.message += line\n end\n end\n\n # Add last message\n msgs[msg.index] = msg unless msg.nil?\n\n msgs\n end",
"def send_message(msg); end",
"def text_to_mobile txt\n if @socket\n @socket.text_to_buffer txt\n @socket.bust_prompt = true\n end\n end",
"def notifyViaSMS(number, message, api, user, password)\n result = nil\n message = CGI.escape message\n request = \"/http/sendmsg?api_id=#{api}&user=#{user}&password=#{password}&to=#{number}&text=#{message}&from=RIVR\" \n Net::HTTP.start( 'api.clickatell.com', 80 ) { |http| result = http.get(request).body } \n return result \n end",
"def text_test\n params.inspect\n # Parameters: \n # {\"ToCountry\"=>\"US\", \n # \"ToState\"=>\"UT\", \n # \"SmsMessageSid\"=>\"SM5d11339688438ea6840b1ff5cf6b3e33\", \n # \"NumMedia\"=>\"0\", \n # \"ToCity\"=>\"PARK CITY\", \n # \"FromZip\"=>\"84770\", \n # \"SmsSid\"=>\"SM5d11339688438ea6840b1ff5cf6b3e33\", \n # \"FromState\"=>\"UT\", \n # \"SmsStatus\"=>\"received\", \n # \"FromCity\"=>\"ST GEORGE\", \n # \"Body\"=>\"testing 5678\", \n # \"FromCountry\"=>\"US\", \n # \"To\"=>\"+14352141844\", \n # \"ToZip\"=>\"84098\", \n # \"NumSegments\"=>\"1\", \n # \"MessageSid\"=>\"SM5d11339688438ea6840b1ff5cf6b3e33\", \n # \"AccountSid\"=>\"ACfb03eaaab63e59c4a90d5bf07b5f6f70\", \n # \"From\"=>\"+14356691878\", \n # \"ApiVersion\"=>\"2010-04-01\"}\n from = params[:From]\n\n end",
"def send_sms(to_phone_number, message)\n # message = {to:, from:, body: \"Hello\\n\\nWorld\"}\n # binding.pry\n @@client.messages.create(\n from: @@from,\n to: to_phone_number,\n body: message\n )\n end",
"def send_sms(sender, numbers, text, **params)\n # Create the send XMLmarkup\n estimate_cost = estimate_cost(numbers, text)\n return -1 if estimate_cost == -1\n\n if estimate_cost < get_balance\n identity = \"#{Time.now.to_i}#{rand(1000000000..9999999999)}\"\n batchID = @company + \"+\" + identity\n is_persian_text = is_persian(text)\n msgClass = params[\"flash\"] ? \"0\" : \"1\"\n dcs = is_persian_text ? \"8\" : \"0\"\n binary = is_persian_text ? \"true\" : \"false\"\n text = text.to_h if is_persian_text\n\n builder = Builder::XmlMarkup.new()\n builder.instruct! :xml, version: \"1.0\", encoding: \"UTF-8\"\n builder.declare! :DOCTYPE, :smsBatch, :PUBLIC, \"-//PERVASIVE//DTD CPAS 1.0//EN\", \"http://www.ubicomp.ir/dtd/Cpas.dtd\"\n builder.smsBatch(company: @company, batchID: batchID) do |b|\n b.sms(msgClass: msgClass, binary: binary, dcs: dcs) do |t|\n numbers.each do |number|\n t.destAddr() do |f|\n f.declare! \"[CDATA[%s]]\" % number\n end\n end\n t.origAddr() do |f|\n f.declare! \"[CDATA[%s]]\" % sender\n end\n t.message() do |f|\n f.declare! \"[CDATA[#{text}]]\"\n end\n end\n end\n\n out_xml = builder.target!\n\n result = send_xml(out_xml)\n\n source = XML::Parser.string(result)\n content = source.parse\n\n if content.find_first('ok')\n if content.find_first('ok').content.include? 'CHECK_OK'\n @errors = nil\n batchID\n else\n @errors = \"Something going wrong\"\n nil\n end\n else\n @errors = content.find_first('message').content.strip\n nil\n end\n else\n @errors = 'Not enough balance'\n nil\n end\n end",
"def reply\n @options[:method] = 'getsmsreply'\n @options[:clientmessagereference] = clientmessagereference\n response = ta_response(status_params)\n return response\n end",
"def create_sms(sms) \n s = SMS.new\n s.subscriber_id = @subscriber_id\n s.subscriber_password = @subscriber_password\n s.remote_host = @remote_host if @remote_host\n s.msg_pin = sms.recipients\n s.setSourceAddr(SMS::ADDR_TYPE_NETWORK, sms.from)\n s.msg_text = sms.body\n raise StandardError.new(\"SMS Body over 140 characters, body = \\n#{sms.body}\") if sms.body.size > 140\n s\n end",
"def send_text(call_job)\n from = '+18015131966'\n\n req_params = {\n from: from,\n to: call_job.phone,\n status_callback: \"#{ENV['CALL_SERVICE_URL']}twilio/provider_text_status_callback.xml\",\n body: call_job.body\n }\n\n if Rails.env == \"development\"\n url = \"http://127.0.0.1:4567/send_text\"\n RestClient.post url, req_params\n else\n client = Twilio::REST::Client.new(ENV[\"TWILIO_SID\"], ENV[\"TWILIO_TOKEN\"])\n\n account = client.account\n message = account.sms.messages.create(req_params)\n end\n end",
"def new_sms_updates(content, tonumber)\n\[email protected] do |message|\n\tRails.logger.debug(message.body)\n\tend\n end",
"def send_sms\n Sms.send_sms(session[:zeepusername], params[:sendmsg][:messagebody])\n \n @zeep_response = \"Message sent to #{session[:zeepusername]}!\"\n \n render :action => \"testloop\"\n \n end",
"def smssend\n http = get_http_connection() \n post_args = { 'number' => params[:number], 'text' => params[:text],'replyto' => params[:replyto], 'name' => @pysmsd_config.app_name, 'password' => @pysmsd_config.app_password }\n \n request = Net::HTTP::Post.new('/messages/out.json')\n request.set_form_data(post_args)\n resp = http.request(request)\n json = JSON.parse(resp.body)\n render_json :entry => json\n end",
"def sms\n twiml do |r|\n r.Message \"Welcome to #{@session.current_state.titleize}, this area is currently under construction. \\nPlease check back soon\"\n r.Pause length: 2\n end\n end",
"def send_sms!(msg, allow_multiple = false)\n if msg.to_s.size > 160 && !allow_multiple\n raise ArgumentError, \"SMS Message is too long. Either specify that you want multiple messages or shorten the string.\"\n end\n return false if msg.to_s.strip.blank? || txter_sms_blocked?\n return false unless sms_confirmed?\n\n # split into pieces that fit as individual messages.\n msg.to_s.scan(/.{1,160}/m).map do |text|\n if Txter.deliver(text, txter_sms_phone_number).success?\n text.size\n else\n false\n end\n end\n end",
"def twilio_text\n \n @twilio_number = ENV['TWILIO_NUMBER']\n @client = Twilio::REST::Client.new ENV['TWILIO_ACCOUNT_SID'], ENV['TWILIO_AUTH_TOKEN']\n time_str = self.time\n content = \"#{self.content} Sent from the Twilio App. Please do not reply\"\n message = @client.account.messages.create(\n :from => @twilio_number,\n :to => self.phone_number,\n :body => content\n )\n puts message\n end",
"def send_by_sms\n\t\t# ActionMailer deliverya\n\t\trecipeintNumberRaw = params[:mobile_number].gsub!(/[^0-9]/,'')\n\t\trecipeintNumberFormatted = params[:mobile_number]\n\t\t@listing = Listing.find(params[:listing_id])\n\n\t\tsms_message = 'Click to view the listing on ' + @listing.address_1 + ' ' + @listing.address_2 + ' ' + @listing.city + ' ' + @listing.state + ' ' + listing_url(@listing)\n\n\t\tsms_fu = SMSFu::Client.configure(:delivery => :action_mailer)\n\t\tsms_fu.deliver(recipeintNumberRaw, params[:carrier][0] , sms_message, :from => '[email protected]')\n\t\treturn_response = { \"status\" => \"ok\", \"number\" => recipeintNumberFormatted }\n\t\trender :json => return_response.to_json, :callback => params[:callback]\n\n\tend",
"def send_sms(sms, options={})\n send_to_phone(sms.phone_number, sms.actual_message, options)\n end",
"def send_text_message(subscriber, message)\n handle_manychat_response(send_content(subscriber, [create_message_text_hash(message)]))\n end",
"def sms(options = {})\r\n return @_message if @_sms_was_called && options.blank?\r\n\r\n m = @_message\r\n\r\n # Call all the procs (if any)\r\n default_values = {}\r\n self.class.default.each do |k,v|\r\n default_values[k] = v.is_a?(Proc) ? instance_eval(&v) : v\r\n end\r\n\r\n # Handle defaults\r\n options = options.reverse_merge(default_values)\r\n\r\n # Set configure delivery behavior\r\n wrap_delivery_behavior!(options.delete(:delivery_method), options.delete(:delivery_method_options))\r\n\r\n # Assign all options except body, template_name, and template_path\r\n assignable = options.except(:body, :template_name, :template_path)\r\n assignable.each { |k, v| m[k] = v }\r\n\r\n # Render the templates and blocks\r\n m.body = response(options)\r\n @_sms_was_called = true\r\n\r\n m\r\n end",
"def reply # acts as endpoint\n \tmessage_body = params[\"Body\"] # grab params from Twilio's request\n \tfrom_number = params[\"From\"]\n \tboot_twilio\n \tsms = @client.messages.create( # send to inbound number made by end user\n from: Rails.application.secrets.twilio_from_number,\n to: from_number,\n body: \"Hello there, thanks for texting me. Your number is #{from_number}.\"\n \t)\n end",
"def sms=(arg)\n raise ArgumentError, \"sms expects a string, not a #{arg.class}\" unless arg.is_a?(String)\n @sms = arg\n end",
"def sms\n account_sid = params[:AccountSid]\n body = params[:Body]\n from = params[:From]\n from_zip = params[:FromZip]\n if from && body && # account_sid == TWILIO_ACCOUNT_SID\n # sms = TwilioNet.new()\n # sms.send_sms('2146680255', truncate(\"FROM:#{from} BODY:#{body}\", :length => 159) )\n # render :layout => 'empty', :template => 'public/sms' \n creator = User.find_or_create_by_sms_number(from)\n creator.create_task(body)\n unless creator.valid?\n Rails.logger.error creator.message\n sms = TwilioNet.new()\n sms.send_sms(from, truncate(creator.message, :length => 159) )\n end\n render :text => \"Task created.\" \n else\n raise error \n end \n rescue\n render :text => \"Invalid Params #{params.inspect}\"\n end",
"def write text=\"\"\n\t\[email protected] = @msg = text.to_s\n\tend",
"def send(user, number, message, phone=nil)\n phone = Behaviour.select_phone(number, user['behaviour']) if phone.nil?\n if phone #se fizer match com os existentes\n `gammu-smsd-inject -c ~/.sms/gammu-smsdrc-#{phone} TEXT #{number} -text \"#{message}\"` # send to daemon\n #LOGIT que foi para a fila\n else \n #LOGIT que alguem tentou mas nao foi para a fila\n end\n end",
"def send_text(text,echo=true)\n puts \"<- #{text.inspect}\" if DisplayReceiverDialog\n begin\n case\n when text.nil?\n # do nothing\n when text.class==Array\n text.each do |line|\n @connection.write(line+CRLF)\n LOG.info(@mail[:mail_id]) {\"<- #{line}\"} if echo && LogReceiverConversation\n end\n return text.last[0]\n else\n @connection.write(text+CRLF)\n LOG.info(@mail[:mail_id]) {\"<- #{text}\"} if echo && LogReceiverConversation\n return text[0]\n end\n rescue Errno::EPIPE => e\n LOG.error(@mail[:mail_id]) {\"#{e}#{Unexpectedly}\"}\n raise Quit\n rescue Errno::EIO => e\n LOG.error(@mail[:mail_id]) {\"#{e}#{Unexpectedly}\"}\n raise Quit\n end\n end",
"def send_text_message(body)\n app = current_application\n if app.present?\n app.send_text_message body\n end\n end",
"def speak_text(texttospeak)\r\n fixedmessage = texttospeak\r\n fixedmessage = fixedmessage.gsub(\"\\r\", \" \")\r\n fixedmessage = fixedmessage.gsub(\"\\n\", \" \")\r\n fixedmessage = fixedmessage.strip\r\n exec(\"AGI\", \"speak_text.agi|\\\"\" + fixedmessage + \"\\\"\")\r\n\tend",
"def send_twilio_mms\n # Get your Account Sid and Auth Token from twilio.com/user/account\n\n account_sid = 'add your account sid'\n auth_token = 'add your auth token'\n\n # set up a client to talk to the Twilio REST API\n client = Twilio::REST::Client.new account_sid, auth_token\n\n\n mms_message_body = \"name:#{self.contact.name}\"\n mms_message_body += \"\" #quick way to create spacing inbetween txt lines\n mms_message_body += \"phone: #{self.contact.phone_number}\"\n mms_message_body += \"\" #quick way to create spacing inbetween txt lines\n mms_message_body += \"#{self.message}\"\n end",
"def message_text\n clear_default_fields\n result = self.message\n reset_default_fields\n result\n end",
"def send_text(message, site_id)\n s1 = Caboose::Setting.where(:site_id => site_id, :name => \"twilio_account_sid\").first\n account_sid = s1 ? s1.value : nil\n s2 = Caboose::Setting.where(:site_id => site_id, :name => \"twilio_auth_token\").first\n auth_token = s2 ? s2.value : nil\n s3 = Caboose::Setting.where(:site_id => site_id, :name => \"twilio_from_number\").first\n twilio_number = s3 ? s3.value : nil\n send_to = self.cell_phone.blank? ? (self.direct_work_phone.blank? ? self.other_phone : self.direct_work_phone) : self.cell_phone\n send_to = '205-657-0937' if Rails.env.development? # Billy's cell\n if account_sid && auth_token && twilio_number && !send_to.blank? && !message.blank?\n @client = Twilio::REST::Client.new account_sid, auth_token\n begin\n message = @client.messages.create(\n body: message,\n to: \"+1#{send_to.gsub(/[(\\- )]/, '')}\",\n from: \"#{twilio_number}\"\n )\n rescue\n Caboose.log(\"invalid phone number\")\n end\n end\n end",
"def send_sms(cmatch, tstamp, number, expiration)\n\n # Primary provider\n #\n nexmo_reponse = begin\n nexmo = Nexmo::Client.new('371f3e5d', 'e3218b70')\n token_url = create_token_url(cmatch, tstamp)\n record_token(cmatch, tstamp, expiration)\n sms_primary_response = nexmo.send_message({\n from: '13059298586',\n to: number,\n text: cmatch\n })\n json :sms_status => \"sent\",\n :token => cmatch,\n :token_url => token_url,\n :phone_number => number,\n :token_generated => tstamp,\n :token_expires => tstamp + expiration\n rescue\n send_sms_twilio(cmatch, tstamp, number, expiration)\n end\nend",
"def send_sms(*args)\n\t\tbegin\n\t\t\tsend_sms!(*args)\n\t\t\treturn true\n\t\t\n\t\t# something went wrong\n\t\trescue Gsm::Error\n\t\t\treturn false\n\t\tend\n\tend",
"def __getobj__ #:nodoc:\n @sms_message ||= processed_smser.message\n end",
"def message(options)\n @sent_messages << options[:text]\n end",
"def sms_to(phone_number, name = T.unsafe(nil), html_options = T.unsafe(nil), &block); end",
"def search_sms(query_string)\n Response.new self.class.get(\"/messages?#{query_string}\", :basic_auth => @auth, :headers => SMSIFIED_HTTP_HEADERS)\n end",
"def incoming \n response.headers[\"Content-Type\"] = \"text/plain; charset=utf-8\"\n #Read params from the text message\n \n if (params[:uid] && params[:body])\n @userid = params[:uid]\n @body = params[:body] \n \n sms = Sms.new(:raw => @body, :login => @userid)\n \n sms.parse\n \n user = User.find_by_login(sms.login)\n \n if user.nil?\n render :text => \"User #{sms.login} couldn't be found, have you signed up at #{AZIMUTH_DOMAIN}?\" \n else\n hunt = user.hunt\n if hunt.nil?\n render :text => \"User #{sms.login} doesn't appear to have signed up for a hunt. Please sign up for one at #{AZIMUTH_DOMAIN}.\"\n else\n if hunt.aasm_current_state == :hunting\n discovery = Discovery.new(:treasure => user.current_treasure, :key => sms.key, :lat => sms.lat, :lng => sms.lng, :hunt => hunt, :user => user)\n hunt.attempt_open_treasure_chest(discovery, user)\n user.save!\n hunt.save!\n discovery.save!\n \n if discovery.success?\n render :text => \"\" # don't send extra texts since the hunt will do it for us...\n else\n render :text => \"What you texted didn't open the treasure chest :-(. Coords: #{sms.lat} #{sms.lng}. Key: #{sms.key}\"\n end\n else\n render :text => \"The hunt #{hunt.name} is currently in #{hunt.state.humanize} state. Please wait for the hounds to be released to get your first clue.\"\n end\n end\n end\n else\n render :text => \"\"\n end\n \n end",
"def deliver(sms)\n create_sms(sms).submit()\n end",
"def deliver_sms(params)\n#puts \"**** Message#deliver_sms; params=#{params}\"\n sms_gateway = params[:sms_gateway]\n phone_number_array = @contact_info.map {|c| c[:phone]}.compact.uniq\n phone_numbers = phone_number_array.join(',')\n assemble_sms()\n#puts \"**** sms_gateway.deliver #{sms_gateway} w #{phone_numbers}: #{sms_only}\"\n #******* CONNECT TO GATEWAY AND DELIVER MESSAGES \n gateway_reply = \n sms_gateway.deliver(phone_numbers, sms_only)\n#puts \"**** gateway_reply=#{gateway_reply}\"\n #******* PROCESS GATEWAY REPLY (INITIAL STATUSES OF SENT MESSAGES) \n gtw_msg_id = nil\n if phone_number_array.size == 1\n # SINGLE PHONE NUMBER \n if gateway_reply =~ /ID: (\\w+)/\n gtw_msg_id = $1\n gtw_msg_id = gateway_reply[4..99] # Temporary workaround as $1 doesn't work on Heroku\n msg_status = MessagesHelper::MsgSentToGateway\n else\n gtw_msg_id = gateway_reply # Will include error message\n msg_status = MessagesHelper::MsgError\n end\n # Mark the message to this member as being sent\n self.sent_messages[0].update_attributes(:gateway_message_id => gtw_msg_id, \n :msg_status => msg_status)\n else\n # MULTIPLE PHONE NUMBERS\n # Get the Clickatell reply and parse into array of hash like {:id=>'asebi9xxke...', :phone => '2345552228372'}\n#puts \"**** gateway_reply=#{gateway_reply}\"\n msg_statuses = gateway_reply.split(\"\\n\").map do |s|\n if s =~ /ID:\\s+(\\w+)\\s+To:\\s+([0-9]+)/\n {:id => $1, :phone => $2} \n else\n {:id => nil, :phone => nil, :error => s}\n end\n end\n # Make array to associate members with their numbers\n @member_phones = self.members.map {|m| {:phone => m.primary_phone, :member => m} }\n # Update the sent_message records to indicate which have been accepted at Gateway \n msg_statuses.each do |s|\n#puts \"**** s[:id]=#{s[:id]}, s[:phone]=#{s[:phone]}\"\n if s[:id] && s[:phone]\n # Find the right member by matching phone numbers\n member = @member_phones.find{|m| m[:phone]==s[:phone]}[:member]\n # Find the right sent_message by matching member & message\n sent_message = SentMessage.where(:member_id=>member.id, :message_id=>self.id).first\n # Update the sent_message\n sent_message.update_attributes(\n :gateway_message_id => s[:id], \n :msg_status=> MessagesHelper::MsgSentToGateway\n )\n end\n end\n # Any sent_messages not now marked with gateway_message_id and msg_status must have errors\n sent_messages.each do |m| \n m.update_attributes(:msg_status=> MessagesHelper::MsgError) if m.msg_status.nil?\n end\n end\n end",
"def deliver\n xml = Clockwork::XML::SMS.build_multiple( self.messages )\n http_response = Clockwork::HTTP.post( Clockwork::API::SMS_URL, xml, @use_ssl )\n responses = Clockwork::XML::SMS.parse_multiple( self.messages, http_response )\n end",
"def received_text\n message = params['events'][0]['message']\n if message.nil?\n nil\n else\n message['text']\n end\n end",
"def t_sms_msg(key, options = {})\n # throw in the form_code if it's not there already and we have the form\n options[:form_code] ||= options[:form].current_version.code if options[:form]\n\n # get the reply language (if we have the user, use their pref_lang; if not, use default)\n lang = options[:user] && options[:user].pref_lang ? options[:user].pref_lang.to_sym : I18n.default_locale\n\n # do the translation, raising error on failure\n I18n.t(key, options.merge(locale: lang, raise: true))\n end",
"def send_message(message); end",
"def send_message(message); end",
"def create\n to = params[:to]\n\n unless to\n raise IOError, \"Incorrect params for sending text message\" \n end\n\n @client = Twilio::REST::Client.new(\n CONFIG[:twilio_account_sid],\n CONFIG[:twilio_auth_token])\n\n @account = @client.account\n @message = @account.sms.messages.create({\n :from => CONFIG[:twilio_phone_number],\n :to => to,\n :body => \"Happy Mining! #{CONFIG[:ios_app_link]}\"}) \n\n rescue => ex\n handle_exception(ex)\n ensure\n respond_to do |format|\n format.json\n end\n end",
"def t_sms_msg(key, options = {})\n # Get some options from Response (if available) unless they're explicitly given\n if elmo_response\n %i(user form mission).each { |a| options[a] = elmo_response.send(a) unless options.has_key?(a) }\n end\n\n # throw in the form_code if it's not there already and we have the form\n options[:form_code] ||= options[:form].current_version.code if options[:form]\n\n # get the reply language (if we have the user, use their pref_lang; if not, use default)\n lang = options[:user] && options[:user].pref_lang ? options[:user].pref_lang.to_sym : I18n.default_locale\n\n # do the translation, raising error on failure\n I18n.t(key, options.merge(locale: lang, raise: true))\n end",
"def receive_message\n params[:incoming_number] = $1 if params[:incoming_number]=~/^1(\\d{10})$/\n params[:origin_number] = $1 if params[:origin_number]=~/^1(\\d{10})$/\n @group=Group.find_by_phone_number(params[:incoming_number])\n \n if @group\n [email protected]_number==params[:origin_number]\n @sending_student = @group.students.find_by_phone_number(params[:origin_number])\n @sending_person = sent_by_admin ? @group.user : @sending_student\n \n #handle the #removeme command. it's a hard-coded single test for now. if we implement more commands, we should probably generalize this\n if params[:message].match(/^\\s*#remove[\\s_]*me/) && @sending_student.present?\n @group.send_message(\"You will no longer receive messages from #{@group.title}. Sorry to see you go!\",nil,[@sending_student])\n @sending_student.update_attribute(:phone_number,nil)\n elsif @sending_person\n message = (sent_by_admin ? @group.user.display_name : @sending_student.name)+\": \"+params[:message]\n @group.send_message(message,@sending_person, sent_by_admin ? @group.students : [@group.user]) #if a student sent it, just send it to teacher. if teacher sent it, push to group\n end\n end\n \n render :text=>\"sent\", :status=>202\n #needs to return something API-like, yo\n end",
"def sms?\n message_type&.to_sym == :sms\n end",
"def perform (msg, to_phone, from_phone=ENV['ST_MAIN_NO'], type=SMS, next_sequence={})\n if type == MMS\n # send MMS to user\n begin\n mms(msg, to_phone, from_phone, next_sequence)\n\n rescue Twilio::REST::RequestError => e\n puts \"we've encountered a Twilio error.\"\n # TODO: describe the ramifications\n email_admins(\"Twilio Error\", \"Status: #{Time.now.to_s}\\nFailed MMS send, #{e.inspect}, \\nphone_number: #{to_phone}.\")\n Sidekiq.logger.warn e\n end\n else # SMS\n begin\n sms(msg, to_phone, from_phone, next_sequence)\n\n rescue Twilio::REST::RequestError => e\n puts \"we've encountered a Twilio error.\"\n # TODO: describe the ramifications\n email_admins(\"Twilio Error\", \"Status: #{Time.now.to_s}\\nFailed SMS send, #{e.inspect}, \\nphone_number: #{to_phone}.\")\n Sidekiq.logger.warn e\n end\n end\n end",
"def text_notification(email)\n content = \"\"\n address = email\n phone = User.where(email: email).first.phone\n Membership.where(email: email).each do |membership|\n Task.where(group_id: membership.group_id).each do |task|\n if task.priority == 3\n content << \"#{task.title}\\n\"\n end\n end\n Subtask.where(group_id: membership.group_id).each do |subtask|\n if subtask.priority == 3\n content << \"#{subtask.task.title}: #{subtask.title}\\n\"\n end\n end\n end\n unless phone.nil?\n if content.empty? == false\n TWILIO_CLIENT.account.sms.messages.create(\n from: TWILIO_NUMBER,\n to: \"+#{phone}\",\n body: content\n )\n end\n end\n end",
"def sms_notify(username, source_system, message)\r\n sender = SmsGlobal::Sender.new :user => CONFIG[:sms_global_settings][:user_name].to_s, :password => CONFIG[:sms_global_settings][:password].to_s\r\n\r\n sender.send_text message, username, source_system\r\n Rails.logger.info \"#{Time.now.utc} - sms_notify - #{username} - #{source_system} - #{message}\"\r\n end",
"def twilio\n @number = params[:phone_number]\n \n #Text message info\n t = {\n \n 'From' => CALLER_ID,\n 'To' => @number,\n 'Body' => (\"Visit uhpartments.com when you walk through an apartment\")\n }\n\n begin\n account = Twilio::RestAccount.new(ACCOUNT_SID, ACCOUNT_TOKEN)\n resp = account.request(\"/#{API_VERSION}/Accounts/#{ACCOUNT_SID}/SMS/Messages\",\n 'POST',\n t)\n resp.error! unless resp.kind_of? Net::HTTPSuccess\n rescue StandardError => bang\n #This area will be called if an error happens with the Twilio API\n flash[:alert] = \"Bad number.\"\n redirect_to({ :action => :home })\n \n return\n end\n\n redirect_to({ :action => :home, :alert => \"SMS sent.\" })\n end",
"def send_sms_verification_code\n number_to_send_to = phone_number\n verification_code = phone_verification_code\n sms_message_body = I18n.t(\"devise.phone.message_body\", :verification_code => verification_code)\n\n sms = Sms.new\n sms.phone_number = number_to_send_to\n sms.message = sms_message_body\n return false unless sms.send!\n\n true\n end",
"def sms_action documents\n to = \"#{params[:to].gsub(/[^\\d]/, '')}@#{params[:carrier]}\"\n mail = RecordMailer.sms_record(documents, { to: to, config: blacklight_config }, url_options)\n if mail.respond_to? :deliver_now\n mail.deliver_now\n else\n mail.deliver\n end\n end",
"def sms_otp\n end"
] | [
"0.7524722",
"0.732517",
"0.71886545",
"0.7128708",
"0.7090069",
"0.7074432",
"0.70660824",
"0.70651174",
"0.6900381",
"0.68919986",
"0.6805689",
"0.67973167",
"0.67895824",
"0.6782423",
"0.6760083",
"0.67514706",
"0.6744342",
"0.67342937",
"0.6734272",
"0.67031276",
"0.66859305",
"0.66638243",
"0.65811527",
"0.6581122",
"0.6578481",
"0.6557177",
"0.65416527",
"0.6493272",
"0.6479413",
"0.64792526",
"0.6459768",
"0.64293313",
"0.642447",
"0.64241797",
"0.6421168",
"0.64102465",
"0.6401962",
"0.6392483",
"0.6379204",
"0.6379149",
"0.6379038",
"0.6369294",
"0.63614434",
"0.6340356",
"0.6334144",
"0.6334041",
"0.6329473",
"0.6323988",
"0.6323223",
"0.63158464",
"0.62840354",
"0.6230738",
"0.6224402",
"0.6218034",
"0.6207149",
"0.6155519",
"0.613645",
"0.6130699",
"0.61281",
"0.6124982",
"0.61107206",
"0.61078614",
"0.608353",
"0.60814685",
"0.6080029",
"0.60785586",
"0.60666525",
"0.6066344",
"0.6066159",
"0.6062797",
"0.60563445",
"0.605037",
"0.60404116",
"0.6037606",
"0.6031415",
"0.6028984",
"0.6020374",
"0.6014585",
"0.60061735",
"0.59989214",
"0.5986536",
"0.59848046",
"0.59805477",
"0.59792775",
"0.59790826",
"0.59773606",
"0.5965558",
"0.59640485",
"0.59640485",
"0.5942605",
"0.59275603",
"0.5924382",
"0.5917035",
"0.5893683",
"0.5893609",
"0.58920276",
"0.5891897",
"0.58812475",
"0.5867784",
"0.5867295"
] | 0.75437856 | 0 |
call this to do all the logic to parse the incomming text returns the action that the text wants | def sms_parsing(text_body)
words = text_body.split
action = words.slice!(0)
symbol_set = Set.new ["!", "@", "#", "$"] #all symbols to check for
word_set = Set.new ["limit"]
while !words.empty?
nextWord = words[0]
symbol = nextWord[0]
if symbol_set.member? symbol
nextWord.slice!(0)
case symbol #all symbols to check for here
when "!"
@sms_skills = nextWord + " "
words.slice!(0)
while !words.empty? and !symbol_set.member? words[0][0] and !word_set.member? words[0].downcase #checks if nextWord is a symboled word
@sms_skills = @sms_skills + words[0] + " "
words.slice!(0)
end
@sms_skills.chop!
when "@"
@sms_location = nextWord + " "
words.slice!(0)
while !words.empty? and !symbol_set.member? words[0][0] and !word_set.member? words[0].downcase #checks if nextWord is a symboled word
@sms_location = @sms_location + words[0] + " "
words.slice!(0)
end
@sms_location.chop!
when "#"
@sms_summary = nextWord + " "
words.slice!(0)
while !words.empty? and !symbol_set.member? words[0][0] and !word_set.member? words[0].downcase #checks if nextWord is a symboled word or key word
@sms_summary = @sms_summary + words[0] + " "
words.slice!(0)
end
@sms_summary.chop!
when "$"
@sms_wage = nextWord.to_f
words.slice!(0)
end
else
if word_set.member? nextWord.downcase
case nextWord.downcase
when "limit"
words.slice!(0)
nextWord = words[0]
if nextWord == nil or !is_num?(nextWord)
sms_error("LIMIT must be followed by a integer number")
@sms_error = true
break
end
@sms_limit = nextWord.to_i
words.slice!(0)
end
else
words.slice!(0)
end
end
end
if !@sms_location.nil?
@sms_location = @sms_location.downcase.strip
end
if !@sms_skills.nil?
@sms_skills = @sms_skills.downcase.strip
end
return action
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_action_txt(action_txt, index)\n begin\n reset_parse_action_txt\n set_action_txt(action_txt)\n set_action_txt_index(index)\n set_action_txt_player_name\n set_whole_action_txt\n set_stripped_action\n set_amount\n set_action_txt_player\n create_action\n reset_parse_action_txt\n rescue RuntimeError => error\n puts error\n reset_parse_action_txt\n end\n puts \"------------------------------\"\n end",
"def parse(text); end",
"def parse_text(text)\n\n end",
"def exec_action(text)\n\t\t\tdata = Context::parse_action_default(text, '<unknown>', 0)\n\t\t\texec_parsed_action(data[:action], data[:args], true, text)\n\t\tend",
"def parse\n begin\n #regex_rules_params = \"(^#.*)\\nif([\\s\\w\\:\\\"\\.\\;\\(\\)\\,\\-]+)\\{([\\@\\<>=a-zA-Z0-9\\s\\[\\]\\_\\:\\\"\\.\\;\\(\\)\\,\\-\\/]+)\\}$\"\n #regex_rules_params2 = \"(^#.*)\\n(\\S+)(.+)\\n\\{\\n([\\s\\S]*)\\}\"\n parts = @text.scan(/(^#.*)\\n(\\S+)\\s(.+)\\n\\{\\n([\\s\\S]*)\\n\\}/)[0]\n parse_name(parts[0])\n @type = parts[1]\n\n self.disable! if parts[2] =~ /.*false #/\n #if the join is true, dont have conditions...\n if parts[2] =~ /true/\n @conditions << Condition.new(type:\"true\")\n elsif parts[2] =~ /(anyof|allof)/\n @join = parts[2][/^\\S+/]\n @conditions.concat(Condition.parse_all( parts[2].scan(/\\(([\\S\\s]+)\\)/)[0][0] ))\n else\n @conditions << Condition.new(text:parts[2])\n end\n\n @actions.concat(Action.parse_all(parts[3]))\n rescue => e\n puts e.to_s + \" - text: #{@text}\"\n end\n end",
"def parseText _args\n \"parseText _args;\" \n end",
"def parse text\n raise \"No parser defined for #{self.class}\"\n end",
"def parse(string)\n @input_string = string\n if string.empty?\n self.puts \"Please enter an action.\"\n return\n end # if\n \n words = self.tokenize string\n tokens = Array.new\n \n until words.empty?\n action = words.join(\"_\")\n logger.debug \"#{self.class}: action = #{action}, rest = #{words.inspect}\"\n \n actions = self.leaf.list_all_actions + self.leaf.list_all_aliases\n \n if actions.include? action\n @input_action = @input_string.match(/^#{words.join(\" \")}/i).to_a.first\n @input_args = @input_string.gsub(/^#{@input_action} /i, \"\")\n \n self.leaf.execute_action(action, *tokens)\n return\n end # if\n \n tokens.unshift words.pop\n end # while\n \n self.missing_action(string, [])\n end",
"def translate\n @actions.each do |a|\n self.send(:\"parse_#{a['type'].gsub('-','_')}\", a)\n end\n @output = @output.split(\"\\n\").collect {|l| l.strip}.join(\"\\n\")\n end",
"def parse_command(text)\n words = wordify preprocess_input text\n \n key = nil\n args = []\n \n while 0 < words.count\n key = words.join('_').intern\n \n return key, args if @actions.has_action? key\n \n args.unshift words.pop\n end # while\n \n return nil, args\n end",
"def parse_and_process_text(text, parse_options={})\n postprocess(parse_xml(parse_text(text, parse_options)))\n end",
"def text\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 54 )\n return_value = TextReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n text_start_index = @input.index\n\n success = false # flag used for memoization\n\n begin\n # rule memoization\n if @state.backtracking > 0 and already_parsed_rule?( __method__ )\n success = true\n return return_value\n end\n # at line 344:23: (~ EOL )+\n # at file 344:23: (~ EOL )+\n match_count_38 = 0\n while true\n alt_38 = 2\n alt_38 = @dfa38.predict( @input )\n case alt_38\n when 1\n # at line 344:24: ~ EOL\n if @input.peek(1) == WS || @input.peek( 1 ).between?( DIGIT, T__59 )\n @input.consume\n @state.error_recovery = false\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n mse = MismatchedSet( nil )\n raise mse\n end\n\n\n\n else\n match_count_38 > 0 and break\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n eee = EarlyExit(38)\n\n\n raise eee\n end\n match_count_38 += 1\n end\n\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n return_value.value = @input.to_s( return_value.start, @input.look( -1 ) )\n # <-- action\n end\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n success = true\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 54 )\n memoize( __method__, text_start_index, success ) if @state.backtracking > 0\n\n end\n \n return return_value\n end",
"def visit_Text(text, *rest)\n end",
"def parse_text text\n\n if @debug\n puts \"=== parsing text to find Vacation ===\"\n puts text\n end\n\n text.split(/\\n/).each do |line|\n line.chomp!\n line.strip!\n if line =~ /^=vacation/i\n reset_parsed\n elsif line =~ /=end/i\n @closed = true\n break\n elsif line =~ /^(cancel|deactivate)/i\n cancel\n elsif line =~ /^activate:\\s*(now|jetzt)/i\n self.activated_at = Time.now - 1, freeze=true\n elsif line =~ /^(?:first|start|erster)\\s+(?:day|date|tag):(.+)/i\n self.starts_at = $1\n elsif line =~ /^(?:last|end|letzter)\\s+(?:day|date|tag):(.+)/i\n self.ends_at = $1\n elsif line =~ /^message:(.*)/i\n @message = $1.strip\n @parsing_message = true\n elsif parsing_message?\n @message << \"\\n\" << line\n end\n end\n\n validate\n end",
"def process_text(content)\n content\n end",
"def _perform(text)\n lines = text.split(\"\\n\")\n lines.map! {|line|\n line.gsub(/\\[\\[(.)+\\]\\]/i){|found|\n /\\[\\[([a-z_]*): ([a-z_]*)\\]\\]/i =~ found\n _perform(self.send($1.to_sym, $2))\n }\n }\n lines.join(\"\\n\")\n end",
"def tokenize\n \n end",
"def parse; end",
"def parse; end",
"def parse; end",
"def get_parse(s);end",
"def _lex_actions; end",
"def process\n # process url\n urls = self.text.scan(URL_REGEXP)\n urls.each { |url|\n tiny_url = open(\"http://tinyurl.com/api-create.php?url=#{url[0]}\") { |s| s.read }\n self.text.sub!(url[0], \"<a href='#{tiny_url}'>#{tiny_url}</a>\")\n }\n \n # process @\n ats = self.text.scan(AT_REGEXP)\n ats.each { |at| \n self.text.sub!(at, \"<a href='/#{at[2,at.length]}'>#{at}</a>\")\n }\n\n end",
"def process_token(tk); end",
"def parse(text)\n text = pre_proccess(text)\n text = pre_normalize(text)\n puts text.inspect if Chronic.debug\n\n tokens = Tokenizer::tokenize(' ' + text + ' ')\n tag(tokens, options)\n\n puts \"+#{'-' * 51}\\n| #{tokens}\\n+#{'-' * 51}\" if Chronic.debug\n\n token_group = TokenGroup.new(tokens, definitions(options), @now, options)\n span = token_group.to_span\n\n guess(span, options[:guess]) if span\n end",
"def preprocess_text data\n parse_formatted_text data\n end",
"def _lex_actions=(_arg0); end",
"def process\n # process url\n urls = self.text.scan(URL_REGEXP)\n urls.each { |url|\n tiny_url = open(\"http://tinyurl.com/api-create.php?url=#{url[0]}\") {|s| s.read} \n self.text.sub!(url[0], \"<a href='#{tiny_url}'>#{tiny_url}</a>\")\n } \n # process @\n ats = self.text.scan(AT_REGEXP)\n ats.each { |at| self.text.sub!(at, \"<a href='/#{at[2,at.length]}'>#{at}</a>\") } \n end",
"def Process(text)\n text.to_str.gsub(/:\\(?([a-z0-9\\+\\-_]+)\\)?:/) do |match|\n\t \n # checks, if user wanted an animated smiley or not\n animated = false\n if (match.include?('(') && match.include?(')'))\n animated = true\n end\n\n # proposed image path, if image is locally available\n\tif animated\n local_image = File.join(Dir.pwd, 'public', 'smileys', 'animated', $1 + '.gif')\n else\n local_image = File.join(Dir.pwd, 'public', 'smileys', 'general', $1 + '.png')\n end\n\n # returns image tag, if image locally exists\n if File.exist?(local_image)\n ImageTag($1, animated)\n\n # image doesn't exists locally\n else\n # stores the image and returns image tag, if smiley is valid\n if SmileyExist($1, animated)\n ImageStore($1, animated)\n ImageTag($1, animated)\n else\n if animated\n '('+$1+')'\n else\n ':'+$1+':'\n end\n end\n end\n\n end\n end",
"def parse\n end",
"def tokenize ; end",
"def tokenize ; end",
"def parse\n lines = @text.split(\"\\n\")\n head = lines.shift\n head = head.gsub(/[[:punct:]]/, '')\n #head = head.gsub(/[[:space:]]|\\t/, '')\n head_match = Tables::Header_regex.match(head.strip)\n if head_match then\n @die = head_match[2].to_i\n @header = head_match[3].strip\n end\n lines.each { |l|\n l = l.gsub(/[[:punct:]]/, '')\n ti = Tables::Line_regex.match(l.strip)\n if ti then\n @outcomes << TableItem.new(ti.to_s)\n end\n }\n end",
"def process_text text\n @filter.process(Blogitr.expand_macros(@filter, text))\n end",
"def parse_content(content); end",
"def parsed; end",
"def parsed; end",
"def handleTextElement someText\r\n @output << someText.value.strip if @output\r\n end",
"def process_input(line)\n case line\n when /^:((.+?)(?:!.+?)?) INVITE \\S+ :(\\S+)/i\n handle :incoming_invite, $1, $2, $3\n when /^:((.+?)(?:!.+?)?) PRIVMSG (\\S+) :?\\001ACTION (.+?)\\001$/i\n handle :incoming_act, $1, $2, $3, $4\n when /^:((.+?)(?:!.+?)?) PRIVMSG (\\S+?) :?\\001(.+?)\\001$/i\n handle :incoming_ctcp, $1, $2, $3, $4\n when /^:((.+?)(?:!.+?)?) PRIVMSG (\\S+?) :?(.+?)$/i\n handle :incoming_msg, $1, $2, $3, $4\n when /^:((.+?)(?:!.+?)?) NOTICE (\\S+?) :?\\001(.+?)\\001$/i\n handle :incoming_ctcpreply, $1, $2, $3, $4\n when /^:((.+?)(?:!.+?)?) NOTICE (\\S+?) :?(.+?)$/i\n handle :incoming_notice, $1, $2, $3, $4\n when /^:((.+?)(?:!.+?)?) MODE (\\S+?) :?(\\S+?)(?: (.+?))?$/i\n handle :incoming_mode, $1, $2, $3, $4, $5\n when /^:((.+?)(?:!.+?)?) JOIN :?(\\S+?)$/i\n handle :incoming_join, $1, $2, $3\n when /^:((.+?)(?:!.+?)?) PART (\\S+?)(?: :?(\\S+?)?)?$/i\n handle :incoming_part, $1, $2, $3, $4\n when /^:((.+?)(?:!.+?)?) KICK (\\S+?) (\\S+?) :?(.+?)$/i\n handle :incoming_kick, $1, $2, $3, $4, $5\n when /^:((.+?)(?:!.+?)?) QUIT :?(.+?)$/i\n handle :incoming_quit, $1, $2, $3\n when /^:((.+?)(?:!.+?)?) NICK :?(\\S+?)$/i\n handle :incoming_nick, $1, $2, $3\n when /^PING :?(.+?)$/i\n handle :incoming_ping, $1\n when /^:((.+?)(?:!.+?)?) (\\d{3})\\s+(\\S+?) (.+?)$/i\n handle_numeric($3.to_i, $1, $2, $4, $5)\n else\n handle :incoming_miscellany, line\n end\n end",
"def exec_parsed_action(action, args, log = true, text = nil)\n\t\t\taction = get_action(action, args, text)\n\t\t\tret = nil\n\t\t\tif log\n\t\t\t\[email protected]_cmd(action) do\n\t\t\t\t\tReadline::HISTORY << action.text\n\t\t\t\t\tret = exec_action_object(action)\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tret = exec_action_object(action)\n\t\t\tend\n\n\t\t\tif ret.respond_to? :call # delayed actions (after log_cmd)\n\t\t\t\tret.call\n\t\t\telse\n\t\t\t\tret\n\t\t\tend\n\t\trescue Selenium::WebDriver::Error::UnhandledAlertError\n\t\t\traise Bauxite::Errors::AssertionError, \"Unexpected modal present\"\n\t\tend",
"def process_line(text, index)\n @index = index + 1\n\n case text[0]\n when DIV_CLASS; render_div(text)\n when DIV_ID\n return push_plain(text) if text[1] == ?{\n render_div(text)\n when ELEMENT; render_tag(text)\n when COMMENT; render_comment(text[1..-1].strip)\n when SANITIZE\n return push_plain(text[3..-1].strip, :escape_html => true) if text[1..2] == \"==\"\n return push_script(text[2..-1].strip, :escape_html => true) if text[1] == SCRIPT\n return push_flat_script(text[2..-1].strip, :escape_html => true) if text[1] == FLAT_SCRIPT\n return push_plain(text[1..-1].strip, :escape_html => true) if text[1] == ?\\s\n push_plain text\n when SCRIPT\n return push_plain(text[2..-1].strip) if text[1] == SCRIPT\n push_script(text[1..-1])\n when FLAT_SCRIPT; push_flat_script(text[1..-1])\n when SILENT_SCRIPT\n return start_haml_comment if text[1] == SILENT_COMMENT\n\n raise SyntaxError.new(<<END.rstrip, index) if text[1..-1].strip == \"end\"\nYou don't need to use \"- end\" in Haml. Use indentation instead:\n- if foo?\n %strong Foo!\n- else\n Not foo.\nEND\n\n push_silent(text[1..-1], true)\n newline_now\n\n # Handle stuff like - end.join(\"|\")\n @to_close_stack.last << false if text =~ /^-\\s*end\\b/ && !block_opened?\n\n case_stmt = text =~ /^-\\s*case\\b/\n keyword = mid_block_keyword?(text)\n block = block_opened? && !keyword\n\n # It's important to preserve tabulation modification for keywords\n # that involve choosing between posible blocks of code.\n if %w[else elsif when].include?(keyword)\n # @to_close_stack may not have a :script on top\n # when the preceding \"- if\" has nothing nested\n if @to_close_stack.last && @to_close_stack.last.first == :script\n @dont_indent_next_line, @dont_tab_up_next_text = @to_close_stack.last[1..2]\n else\n push_and_tabulate([:script, @dont_indent_next_line, @dont_tab_up_next_text])\n end\n\n # when is unusual in that either it will be indented twice,\n # or the case won't have created its own indentation\n if keyword == \"when\"\n push_and_tabulate([:script, @dont_indent_next_line, @dont_tab_up_next_text, false])\n end\n elsif block || case_stmt\n push_and_tabulate([:script, @dont_indent_next_line, @dont_tab_up_next_text])\n elsif block && case_stmt\n push_and_tabulate([:script, @dont_indent_next_line, @dont_tab_up_next_text])\n end\n when FILTER; start_filtered(text[1..-1].downcase)\n when DOCTYPE\n return render_doctype(text) if text[0...3] == '!!!'\n return push_plain(text[3..-1].strip, :escape_html => false) if text[1..2] == \"==\"\n return push_script(text[2..-1].strip, :escape_html => false) if text[1] == SCRIPT\n return push_flat_script(text[2..-1].strip, :escape_html => false) if text[1] == FLAT_SCRIPT\n return push_plain(text[1..-1].strip, :escape_html => false) if text[1] == ?\\s\n push_plain text\n when ESCAPE; push_plain text[1..-1]\n else push_plain text\n end\n end",
"def read_instruction(usertext)\n instructions = usertext.split(\"\")\n instructions.each do |action|\n if action == \"L\" || action == \"R\"\n turn(action)\n elsif action == \"M\"\n move(action)\n else\n puts \"Invalid Input\"\n end\n end\n end",
"def parse_paragraph; end",
"def extract_message(input)\n sender = nil\n content = nil\n is_action = false\n \n stripped = input.strip\n if stripped[0...1] == '*' # action\n is_action = true\n stripped = stripped[1..-1].split(' ')\n sender = stripped[0]\n content = stripped[1..-1].join(' ')\n else\n scanned = /<([^>]*)> (.*)/.match(stripped)\n sender = scanned[1].strip\n content = scanned[2]\n end\n \n [{:ident => sender, :name => sender, :host => nil}, content, is_action]\n end",
"def parse(input, game)\n method = input.words.first.command_pp\n\n arguments = input.words[1..-1]\n\n output = __send__(\"_#{method}\", arguments.join(\" \"), game)\n end",
"def repair(text); end",
"def parse_text\r\n @text_nodes.map(&:content).join('')\r\n end",
"def parse_text\r\n @text_nodes.map(&:content).join('')\r\n end",
"def parse_args\r\n if(cmd.args =~ /\\=/)\r\n self.names = InputFormatter.titlecase_arg(cmd.args.before(\"=\"))\r\n self.action_args = cmd.args.after(\"=\")\r\n elseif (cmd.args && one_word_command)\r\n self.names = InputFormatter.titlecase_arg(cmd.args)\r\n self.action_args = \"\"\r\n else\r\n self.names = enactor.name\r\n self.action_args = cmd.args\r\n end\r\n\r\n self.names = self.names ? self.names.split(/[ ,]/) : nil\r\n\r\n self.combat_command = cmd.switch ? cmd.switch.downcase : nil\r\n end",
"def tokenize; end",
"def tokenize; end",
"def action(text)\n reply(\"\\001ACTION #{text}\\001\")\n end",
"def parse (file)\n File.open(file.path, \"r\") do |file|\n # read each char and use state\n tokens = Array.new\n state = TokenStates::TEXT_STATE\n input = \"\"\n last_newline = 0\n while file.eof? == false\n case state\n when TokenStates::TEXT_STATE\n #puts \"TEXT_STATE\"\n input = file.getc\n if input == \"<\"\n state = TokenStates::COMMAND_OPEN_STATE\n elsif input == \"\\n\"\n last_newline = file.pos\n else\n if tokens.length == 0 || tokens.last.class != Whip::TextToken\n tokens.push(Whip::TextToken.new(file.pos))\n end\n end\n when TokenStates::COMMAND_OPEN_STATE\n #puts \"COMMAND_OPEN_STATE\"\n pos = file.pos\n input += file.getc\n input += file.getc\n input += file.getc\n input += file.getc\n if input == \"<!--$\"\n state = TokenStates::COMMAND_NAME_STATE\n if tokens.last.class != Whip::CommandToken\n tokens.last.ends = pos\n end\n tokens.push(Whip::CommandToken.new(pos))\n tokens.last.indent = pos - last_newline - 1\n input = \"\"\n else\n state = TokenStates::TEXT_STATE\n if tokens.length == 0\n tokens.push(Whip::TextToken.new(pos))\n end\n end\n when TokenStates::COMMAND_NAME_STATE\n #puts \"COMMAND_NAME_STATE\"\n input += file.getc\n if input[-1] == \" \"\n state = TokenStates::COMMAND_ARGUMENT_START_STATE\n tokens.last.name = input[0...-1]\n input = \"\"\n end\n when TokenStates::COMMAND_ARGUMENT_START_STATE\n #puts \"COMMAND_ARGUMENT_START_STATE\"\n input = file.getc\n if input == '\"'\n state = TokenStates::COMMAND_ARGUMENT_STATE\n input = \"\"\n end\n when TokenStates::COMMAND_ARGUMENT_STATE\n #puts \"COMMAND_ARGUMENT_STATE\"\n input += file.getc\n if input[-1] == '\"'\n state = TokenStates::COMMAND_CLOSE_STATE\n tokens.last.argument = input[0...-1]\n input = \"\"\n end\n when TokenStates::COMMAND_CLOSE_STATE\n #puts \"COMMAND_CLOSE_STATE\"\n input += file.getc\n if input.strip == \"-->\"\n state = TokenStates::TEXT_STATE\n tokens.last.ends = file.pos\n input = \"\"\n end\n else\n end\n end\n tokens.last.ends = file.pos + 1\n return tokens\n end\n end",
"def text text\n \n text = text.strip\n GRES_CGMLDebugger.writedebugstring(\"GRES_CityGMLParser: text of CityGMLParser current tag ist \" + @currenttag + \"and text is _\" + text + \"_\\n\")\n if(text == \"\")\n return\n end\n if((@currenttag == \"gml:pos\" or @currenttag == \"gml:posList\") and @translX == 0)\n coords = text.split(\" \")\n @translX = coords[0].to_f\n @translY = coords[1].to_f\n @translZ = coords[2].to_f\n GRES_CGMLDebugger.writedebugstring(\"GRES_CityGMLParser: found Position, init Translation \" + @translX.to_s + \" \" + @translY.to_s + \" \" + @translZ.to_s + \"\\n\")\n\n end\n if(@isInSubhandler == true and @currentObjectParser != nil)\n @currentObjectParser.text(text)\n return\n end\n if(@isInAppSubHandler == true and @currentAppearanceParser != nil)\n @currentAppearanceParser.text(text)\n return\n end\n\n\n end",
"def apply(text)\n raw = process_text(text)\n rule_stack = []\n str = ''\n rule_names = @rules.keys\n raw.each do |r|\n if r.is_a?(Symbol)\n # Part is a rule\n dprint \"\\tRule Symbol #{r}\\n\"\n if r == :close && rule_stack.length >= 1\n # Rule close with 1+ opened rules\n opened = rule_stack.pop\n opened_after = @rules[opened].codes(Rule::Parts[:after])\n dprint \"\\t\\tClose, opened rule '#{opened}'\\n\"\n dprint \"\\t\\t\\tClosing rule '#{opened}' with After\\n\"\n dprint 4,\"After: #{opened_after.inspect}\\n\"\n str.concat(opened_after)\n unless rule_stack.length == 0\n rule_stack.each do |outer|\n outer_inside = @rules[outer].codes(Rule::Parts[:inside])\n # Closed rule was nested in another open rule\n dprint 3, \"Outer rule '#{outer}' still open. Restoring Inside\\n\"\n dprint 4, \"Inside: #{outer_inside.inspect}\\n}\"\n str.concat(outer_inside)\n end\n end\n # binding.pry\n # outer = rule_stack[-1]\n # outer_inside = @rules[outer].codes(Rule::Parts[:inside])\n # # Closed rule was nested in another open rule\n # dprint 3, \"Outer rule '#{outer}' still open. Restoring Inside\\n\"\n # dprint 4, \"Inside: #{outer_inside.inspect}\\n}\"\n # str.concat(outer_inside)\n # # binding.pry\n # end\n elsif r == :reset && rule_stack.length == 0\n # no opened outer rules, reset symbol given\n dprint \"\\t\\tReset, no opened rule\\n\"\n str.concat(@rules[r].codes(Rule::Parts[:after]))\n elsif rule_names.include?(r)\n # New rule to apply\n dprint \"\\t\\tApplying new rule '#{r}'\\n\"\n dprint 3, \"Previous active rule `#{rule_stack[-1]}`\\n\"\n rule_stack.push r\n str.concat(@rules[r].codes(Rule::Parts[:inside]))\n end\n else\n # Part is text\n str.concat(r)\n end\n end\n str\n end",
"def processing_instruction(name, content); end",
"def processing_instruction(name, content); end",
"def handle_line_action()\n if line_action_handler.class == Proc\n # Custom handler\n line_action_handler.call(lpos)\n else\n # Generic default action\n cur_nonwhitespace_word_action()\n end\n end",
"def action!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 10 )\n\n type = ACTION\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 141:10: 'action'\n match( \"action\" )\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__, 10 )\n\n end",
"def get_action(str)\n puts \"Received '#{str.strip}'\" unless @quiet\n ['f','c','r'].choice\n end",
"def parse_assessment_target(text)\n text.strip!\n assessment_target = nil\n #domain_regex = @domains.keys.join(\"|\")\n #space_or_dashes = \"[\\s|-|–|-]+\"\n # (ESS)\\s*([0-9]+)\\s*\\(([K|0-9|\\-|\\–|\\-|\\s])+\\)[\\s|\\-|\\–|\\-][\\s|\\-|\\–|\\-]*([A-Z|\\s|\\+]+)\\s*[\\s|\\-|\\–|\\-]*(\\d+)(.+)\n #regex = /(#{domain_regex})\\s*([0-9]+)\\s*\\(([K|0-9|\\-|\\–|\\s])+\\)[\\s|\\-|\\–]*([A-Z|\\s|\\+]+)\\s*[\\s|\\-|\\–|\\-]*(\\d+)(.+)/mx\n\n regex = @assessment_target_regex\n\n matches = text.match(regex)\n if (matches)\n (domain_key,ek_key,grade_span,unifying_theme_key) = matches.captures\n ## Getting number and target seperately because number of matches\n ## for unifying_theme_key is variable\n (number, target) = matches.captures[-2..-1] \n\n themes = unifying_theme_key.split(/[\\+\\s]+/);\n #unifying_theme_key = themes[0]\n\n domain = @domains[domain_key.strip]\n\n if (domain)\n knowledge_statement = RiGse::KnowledgeStatement.find(\n :first, \n :conditions => { :domain_id => domain.id, :number => ek_key })\n else\n logger.warn \"could not find domain for #{domain_key}\"\n end\n\n assessment_target = RiGse::AssessmentTarget.new(:knowledge_statement => knowledge_statement, :number => number)\n #unifying_theme = @themes[unifying_theme_key.strip]\n #if (unifying_theme)\n # assessment_target.unifying_theme = unifying_theme\n #else\n # logger.warn \"could not find unifying theme that matches: #{unifying_theme_key}\"\n #end\n assessment_target.description = target.strip\n assessment_target.grade_span = grade_span\n assessment_target.save\n themes.each do |theme|\n assessment_target.add_unifying_theme(@themes[theme])\n end\n return assessment_target\n elsif !text.match(/\\ANo further targets/i)\n logger.warn \"can't parse assessment target text is #{text}\"\n end\n nil\n end",
"def parse(text)\n parse_references(text) if @project\n parse_emoji(text)\n\n text\n end",
"def parse\n raise \"absctract method called\"\n end",
"def rule_action\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 11)\n return_value = RuleActionReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n char_literal55 = nil\n __ACTION57__ = nil\n id56 = nil\n\n tree_for_char_literal55 = nil\n tree_for_ACTION57 = nil\n stream_AT = ANTLR3::AST::RewriteRuleTokenStream.new(@adaptor, \"token AT\")\n stream_ACTION = ANTLR3::AST::RewriteRuleTokenStream.new(@adaptor, \"token ACTION\")\n stream_id = ANTLR3::AST::RewriteRuleSubtreeStream.new(@adaptor, \"rule id\")\n begin\n # at line 178:4: '@' id ACTION\n char_literal55 = match(AT, TOKENS_FOLLOWING_AT_IN_rule_action_979) \n if @state.backtracking == 0\n stream_AT.add(char_literal55)\n end\n @state.following.push(TOKENS_FOLLOWING_id_IN_rule_action_981)\n id56 = id\n @state.following.pop\n if @state.backtracking == 0\n stream_id.add(id56.tree)\n end\n __ACTION57__ = match(ACTION, TOKENS_FOLLOWING_ACTION_IN_rule_action_983) \n if @state.backtracking == 0\n stream_ACTION.add(__ACTION57__)\n end\n # AST Rewrite\n # elements: AT, id, ACTION\n # token labels: \n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_return_value = return_value ? subtree_stream(\"rule return_value\", return_value.tree) : subtree_stream(\"token return_value\")\n\n root_0 = @adaptor.create_flat_list!\n # 178:18: -> ^( '@' id ACTION )\n # at line 178:21: ^( '@' id ACTION )\n root_1 = @adaptor.create_flat_list!\n root_1 = @adaptor.become_root(stream_AT.next_node, root_1)\n\n @adaptor.add_child(root_1, stream_id.next_tree)\n @adaptor.add_child(root_1, stream_ACTION.next_node)\n\n @adaptor.add_child(root_0, root_1)\n\n\n\n return_value.tree = root_0\n\n end# - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look(-1)\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing(root_0)\n @adaptor.set_token_boundaries(return_value.tree, return_value.start, return_value.stop)\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node!(@input, return_value.start, @input.look(-1), re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out(__method__, 11)\n\n end\n \n return return_value\n end",
"def do_parse text, pattern\n data = pattern[:blk].call(text.scan(pattern[:exp]))\n\n puts data.inspect\n end",
"def text_input; end",
"def parse(source); end",
"def category_actions\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 10 )\n array = nil\n act = nil\n next_act = nil\n # - - - - @init action - - - -\n array = Array.new\n\n begin\n # at line 57:10: SEMICOLON ( WS )? ACTIONS EQUALS QUOTE act= uri ( WS next_act= uri )* QUOTE\n match( SEMICOLON, TOKENS_FOLLOWING_SEMICOLON_IN_category_actions_437 )\n # at line 57:20: ( WS )?\n alt_15 = 2\n look_15_0 = @input.peek( 1 )\n\n if ( look_15_0 == WS )\n alt_15 = 1\n end\n case alt_15\n when 1\n # at line 57:20: WS\n match( WS, TOKENS_FOLLOWING_WS_IN_category_actions_439 )\n\n end\n match( ACTIONS, TOKENS_FOLLOWING_ACTIONS_IN_category_actions_442 )\n match( EQUALS, TOKENS_FOLLOWING_EQUALS_IN_category_actions_444 )\n match( QUOTE, TOKENS_FOLLOWING_QUOTE_IN_category_actions_446 )\n @state.following.push( TOKENS_FOLLOWING_uri_IN_category_actions_450 )\n act = uri\n @state.following.pop\n # --> action\n array << ( act && @input.to_s( act.start, act.stop ) ) \n # <-- action\n # at line 58:10: ( WS next_act= uri )*\n while true # decision 16\n alt_16 = 2\n look_16_0 = @input.peek( 1 )\n\n if ( look_16_0 == WS )\n alt_16 = 1\n\n end\n case alt_16\n when 1\n # at line 58:12: WS next_act= uri\n match( WS, TOKENS_FOLLOWING_WS_IN_category_actions_466 )\n @state.following.push( TOKENS_FOLLOWING_uri_IN_category_actions_470 )\n next_act = uri\n @state.following.pop\n # --> action\n array << ( next_act && @input.to_s( next_act.start, next_act.stop ) ) \n # <-- action\n\n else\n break # out of loop for decision 16\n end\n end # loop for decision 16\n match( QUOTE, TOKENS_FOLLOWING_QUOTE_IN_category_actions_477 )\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 10 )\n\n end\n \n return array\n end",
"def action!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 51)\n\n type = ACTION\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 547:4: NESTED_ACTION ( '?' )?\n nested_action!\n # at line 547:18: ( '?' )?\n alt_12 = 2\n look_12_0 = @input.peek(1)\n\n if (look_12_0 == ??) \n alt_12 = 1\n end\n case alt_12\n when 1\n # at line 547:20: '?'\n match(??)\n # --> action\n type = SEMPRED \n # <-- action\n\n end\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__, 51)\n\n end",
"def parse\n tagify(decommentify(@input)).strip\n end",
"def step\n start_group :normal, matched if scan( /\\s+/ )\n if @in_tag\n case\n when scan( /([-\\w]+):([-\\w]+)/ )\n start_group :namespace, subgroup(1)\n start_group :punct, \":\"\n start_group :attribute, subgroup(2)\n when scan( /\\d+/ )\n start_group :number, matched\n when scan( /[-\\w]+/ )\n start_group :attribute, matched\n when scan( %r{[/?]?>} )\n @in_tag = false\n start_group :punct, matched\n when scan( /=/ )\n start_group :punct, matched\n when scan( /[\"']/ )\n scan_string matched\n else\n append getch\n end\n elsif ( text = scan_until( /(?=[<&])/ ) )\n start_group :normal, text unless text.empty?\n if scan(/<!--.*?(-->|\\Z)/m)\n start_group :comment, matched\n else\n case peek(1)\n when \"<\"\n start_group :punct, getch\n case peek(1)\n when \"?\"\n append getch\n when \"/\"\n append getch\n when \"!\"\n append getch\n end\n start_group :normal, matched if scan( /\\s+/ )\n if scan( /([-\\w]+):([-\\w]+)/ )\n start_group :namespace, subgroup(1)\n start_group :punct, \":\"\n start_group :tag, subgroup(2)\n elsif scan( /[-\\w]+/ )\n start_group :tag, matched\n end\n @in_tag = true\n when \"&\"\n if scan( /&\\S{1,10};/ )\n start_group :entity, matched\n else\n start_group :normal, scan( /&/ )\n end\n end\n end\n else\n append scan_until( /\\Z/ )\n end\n end",
"def filter_single(text,args)\n Ritex::Parser.new.parse(args)\n end",
"def apply(text)\n\t\t\tbody = text.dup\n\t\t\t# Parameters\n\t\t\tbody.gsub!(/\\{\\{(\\d+)\\}\\}/) do\n\t\t\t\traw_param($1.to_i).to_s.strip\n\t\t\tend\n\t\t\t# Attributes\n\t\t\tbody.gsub!(/\\{\\{([^\\[\\]\\|\\\\\\s]+)\\}\\}/) do\n\t\t\t\traw_attr($1.to_sym).to_s.strip\n\t\t\tend\n\t\t\tinterpret body\n\t\tend",
"def _test_text ; process_test_case(\"text\") ; end",
"def rule_action\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 11 )\n return_value = RuleActionReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n char_literal55 = nil\n __ACTION57__ = nil\n id56 = nil\n\n tree_for_char_literal55 = nil\n tree_for_ACTION57 = nil\n stream_AT = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token AT\" )\n stream_ACTION = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token ACTION\" )\n stream_id = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule id\" )\n begin\n # at line 169:4: '@' id ACTION\n char_literal55 = match( AT, TOKENS_FOLLOWING_AT_IN_rule_action_974 )\n if @state.backtracking == 0\n stream_AT.add( char_literal55 )\n end\n @state.following.push( TOKENS_FOLLOWING_id_IN_rule_action_976 )\n id56 = id\n @state.following.pop\n if @state.backtracking == 0\n stream_id.add( id56.tree )\n end\n __ACTION57__ = match( ACTION, TOKENS_FOLLOWING_ACTION_IN_rule_action_978 )\n if @state.backtracking == 0\n stream_ACTION.add( __ACTION57__ )\n end\n # AST Rewrite\n # elements: ACTION, id, AT\n # token labels: \n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_return_value = return_value ? subtree_stream( \"rule return_value\", return_value.tree ) : subtree_stream( \"token return_value\" )\n\n root_0 = @adaptor.create_flat_list\n # 169:18: -> ^( '@' id ACTION )\n # at line 169:21: ^( '@' id ACTION )\n root_1 = @adaptor.create_flat_list\n root_1 = @adaptor.become_root( stream_AT.next_node, root_1 )\n\n @adaptor.add_child( root_1, stream_id.next_tree )\n @adaptor.add_child( root_1, stream_ACTION.next_node )\n\n @adaptor.add_child( root_0, root_1 )\n\n\n\n return_value.tree = root_0\n\n end# - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 11 )\n\n end\n \n return return_value\n end",
"def parse_content\n parse_result = Postal::MessageParser.new(self)\n if parse_result.actioned?\n # Somethign was changed, update the raw message\n @database.update(self.raw_table, {:data => parse_result.new_body}, :where => {:id => self.raw_body_id})\n @raw = parse_result.new_body\n @raw_message = nil\n end\n update('parsed' => 1, 'tracked_links' => parse_result.tracked_links, 'tracked_images' => parse_result.tracked_images)\n end",
"def completed_text_extraction\n end",
"def _lex_trans_actions; end",
"def _lex_trans_actions; end",
"def _lex_trans_actions; end",
"def _lex_trans_actions; end",
"def search_text_main(clipped = false)\n text = ''\n if self.event_type == 'sent' \n text = text + self.outgoing_message.get_text_for_indexing + \"\\n\\n\"\n elsif self.event_type == 'followup_sent'\n text = text + self.outgoing_message.get_text_for_indexing + \"\\n\\n\"\n elsif self.event_type == 'response'\n if clipped\n text = text + self.incoming_message.get_text_for_indexing_clipped + \"\\n\\n\"\n else\n text = text + self.incoming_message.get_text_for_indexing_full + \"\\n\\n\"\n end\n elsif self.event_type == 'comment'\n text = text + self.comment.body + \"\\n\\n\"\n else\n # nothing\n end\n return text\n end",
"def process(parser)\n end",
"def parse(text)\n tokens = tokenize(text, options)\n span = tokens_to_span(tokens, options.merge(:text => text))\n\n puts \"+#{'-' * 51}\\n| #{tokens}\\n+#{'-' * 51}\" if Chronic.debug\n\n guess(span, options[:guess]) if span\n end",
"def action_line(line)\n nick, message = /^ \\* ([^ ]+) (.*)$/.match(line).captures\n<<-END\n <span class=\"line-nick\">#{nick}</span>\n <span class=\"line-message\">\n #{h message}\n </span>\nEND\nend",
"def event_to_action client, event, team\n \n ef = event.formatted_text\n puts \"Formatted Text: #{ef}\"\n \n return if ef.nil?\n \n is_admin = is_admin_or_owner client, event\n user_id = team[:user_id]\n\n user_events = Event.where(:user_id => user_id).to_json\n second_last_event = user_events[-4]\n \n puts \"Event is #{second_last_event} and user_id is #{user_id}\"\n\n # Hi Commands\n if [\"hi\",\"hello\",\"hey\",\"heyy\"].any? { |w| ef.starts_with? w }\n\n message = interactive_greeting\n client.chat_postMessage(channel: event.channel, text: \"Hello there. I'm Jude. Let's get something done for you today.\", attachments: message, as_user:true)\n add_outgoing_event event, team, \"interaction\", \"first greeting\"\n\n elsif ef.starts_with? \"about\"\n \n client.chat_postMessage(channel: event.channel, text: \"_#{about_jude}_\", attachments: message, as_user:true)\n add_outgoing_event event, team, \"message\", \"about command\"\n \n # Handle the Help commands\n elsif ef.include? \"help\"\n\n client.chat_postMessage(channel: event.channel, text: get_commands_message( is_admin ), as_user: true)\n add_outgoing_event event, team, \"message\", \"help command\"\n\n # Respond to thanks message\n elsif ef.starts_with? \"thank\"\n\n client.chat_postMessage(channel: event.channel, text: \"That's mighty nice of you. You're welcome and thank you for having me!\", as_user: true)\n add_outgoing_event event, team, \"message\", \"thanks command\"\n\n elsif ef.starts_with? \"details:\"\n\n ef.slice!(0..8)\n $assignment.description = ef\n puts $assignment_record\n client.chat_postMessage(channel: event.channel, text: \"So when is this assignment due?\", as_user: true)\n\n elsif ef.starts_with? \"due:\"\n\n ef.slice!(0..4)\n due_date = Kronic.parse(ef)\n\n $assignment.due_date = due_date\n message = \"Your assignment is for #{$assignment['course_name']}: #{assignment['description']} due #{assignment['due_date']}\"\n client.chat_postMessage(channel: event.channel, text: message, attachments: interactive_confirmation_assignment ,as_user: true)\n\n elsif ef.starts_with? \"course name: \"\n\n ef.slice!(0..12)\n $course_object[\"course_name\"]= ef\n client.chat_postMessage(channel: event.channel, text: \"Enter Course ID starting with *course id: *\", as_user: true)\n\n elsif ef.starts_with? \"course id: \"\n\n ef.slice!(0..10)\n $course_object[\"course_id\"]= ef \n client.chat_postMessage(channel: event.channel, text: \"Enter Instructor Name starting with *instructor: *\", as_user: true) \n\n elsif ef.starts_with? \"instructor: \"\n\n ef.slice!(0..11)\n $course_object[\"instructor\"]= ef\n\n client.chat_postMessage(channel: event.channel, text: \"You've entered the following: #{$course_object[\"course_name\"]}, #{$course_object[\"course_id\"]}, by #{$course_object[\"instructor\"]}\", attachments: interactive_confirmation_course, as_user: true)\n\n elsif event.formatted_text == \"show assignments\"\n\n client.chat_postMessage(channel: event.channel, text: get_upcoming_assignments, as_user: true)\n\n elsif event.formatted_text == \"show courses\"\n\n client.chat_postMessage(channel: event.channel, text: show_courses, as_user: true)\n\n elsif second_last_event[\"direction\"] == \"outgoing\" && second_last_event[\"text\"] == \"add assignment description\"\n\n $assignment.description = input\n client.chat_postMessage(channel: second_last_event.channel, text: \"So when is this assignment due?\", as_user: true)\n add_outgoing_event event, team, \"message\", \"add assignment due-date\"\n\n elsif second_last_event[\"direction\"] == \"outgoing\" && second_last_event[\"text\"] == \"add assignment due-date\"\n \n due_date = Kronic.parse(input)\n\n $assignment.due_date = due_date\n message = \"Your assignment is for #{$assignment['course_name']}: #{assignment['description']} due #{input}, #{assignment['due_date']}.\"\n client.chat_postMessage(channel: second_last_event.channel, text: message, attachments: interactive_confirmation_assignment, as_user: true)\n \n else\n\n manage_errors event, client\n\n end \n end",
"def actions!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 11 )\n\n type = ACTIONS\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 142:11: 'actions'\n match( \"actions\" )\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__, 11 )\n\n end",
"def action_for_payload\n case payload_type\n when 'message'\n cmd, args = self.class.command_from_text(payload['text'], bot_username)\n cmd &&= self.class.action_for_command(cmd)\n [true, cmd, args] if cmd\n end || [false, payload_type, [payload]]\n end",
"def get_action\n action = nil\n user_response = gets.chomp\n args = user_response.downcase.strip.split(' ')\n action = user_responsedowncase.sell_a_trip\n return action, args\nend",
"def text_token(text, kind); end",
"def text_token(text, kind); end",
"def pre_process(text_line)\n text_line\n end",
"def action\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 5)\n return_value = ActionReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n char_literal22 = nil\n string_literal24 = nil\n __ACTION26__ = nil\n action_scope_name23 = nil\n id25 = nil\n\n tree_for_char_literal22 = nil\n tree_for_string_literal24 = nil\n tree_for_ACTION26 = nil\n stream_AT = ANTLR3::AST::RewriteRuleTokenStream.new(@adaptor, \"token AT\")\n stream_T__73 = ANTLR3::AST::RewriteRuleTokenStream.new(@adaptor, \"token T__73\")\n stream_ACTION = ANTLR3::AST::RewriteRuleTokenStream.new(@adaptor, \"token ACTION\")\n stream_action_scope_name = ANTLR3::AST::RewriteRuleSubtreeStream.new(@adaptor, \"rule action_scope_name\")\n stream_id = ANTLR3::AST::RewriteRuleSubtreeStream.new(@adaptor, \"rule id\")\n begin\n # at line 127:4: '@' ( action_scope_name '::' )? id ACTION\n char_literal22 = match(AT, TOKENS_FOLLOWING_AT_IN_action_584) \n if @state.backtracking == 0\n stream_AT.add(char_literal22)\n end\n # at line 127:8: ( action_scope_name '::' )?\n alt_11 = 2\n case look_11 = @input.peek(1)\n when TOKEN_REF then look_11_1 = @input.peek(2)\n\n if (look_11_1 == T__73) \n alt_11 = 1\n end\n when RULE_REF then look_11_2 = @input.peek(2)\n\n if (look_11_2 == T__73) \n alt_11 = 1\n end\n when T__67, T__68 then alt_11 = 1\n end\n case alt_11\n when 1\n # at line 127:9: action_scope_name '::'\n @state.following.push(TOKENS_FOLLOWING_action_scope_name_IN_action_587)\n action_scope_name23 = action_scope_name\n @state.following.pop\n if @state.backtracking == 0\n stream_action_scope_name.add(action_scope_name23.tree)\n end\n string_literal24 = match(T__73, TOKENS_FOLLOWING_T__73_IN_action_589) \n if @state.backtracking == 0\n stream_T__73.add(string_literal24)\n end\n\n end\n @state.following.push(TOKENS_FOLLOWING_id_IN_action_593)\n id25 = id\n @state.following.pop\n if @state.backtracking == 0\n stream_id.add(id25.tree)\n end\n __ACTION26__ = match(ACTION, TOKENS_FOLLOWING_ACTION_IN_action_595) \n if @state.backtracking == 0\n stream_ACTION.add(__ACTION26__)\n end\n # AST Rewrite\n # elements: ACTION, id, action_scope_name, AT\n # token labels: \n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_return_value = return_value ? subtree_stream(\"rule return_value\", return_value.tree) : subtree_stream(\"token return_value\")\n\n root_0 = @adaptor.create_flat_list!\n # 127:44: -> ^( '@' ( action_scope_name )? id ACTION )\n # at line 127:47: ^( '@' ( action_scope_name )? id ACTION )\n root_1 = @adaptor.create_flat_list!\n root_1 = @adaptor.become_root(stream_AT.next_node, root_1)\n\n # at line 127:53: ( action_scope_name )?\n if stream_action_scope_name.has_next?\n @adaptor.add_child(root_1, stream_action_scope_name.next_tree)\n\n end\n\n stream_action_scope_name.reset();\n @adaptor.add_child(root_1, stream_id.next_tree)\n @adaptor.add_child(root_1, stream_ACTION.next_node)\n\n @adaptor.add_child(root_0, root_1)\n\n\n\n return_value.tree = root_0\n\n end# - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look(-1)\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing(root_0)\n @adaptor.set_token_boundaries(return_value.tree, return_value.start, return_value.stop)\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node!(@input, return_value.start, @input.look(-1), re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out(__method__, 5)\n\n end\n \n return return_value\n end",
"def process_input\n\n while movement = connection.gets.chomp\n begin\n parse movement\n end\n end\n end",
"def get_action(action, args, text = nil)\n\t\t\twhile (alias_action = @aliases[action])\n\t\t\t\taction = alias_action[:action]\n\t\t\t\targs = alias_action[:args].map do |a|\n\t\t\t\t\ta.gsub(/\\$\\{(\\d+)(\\*q?)?\\}/) do |match|\n\t\t\t\t\t\t# expand ${1} to args[0], ${2} to args[1], etc.\n\t\t\t\t\t\t# expand ${4*} to \"#{args[4]} #{args[5]} ...\"\n\t\t\t\t\t\t# expand ${4*q} to \"\\\"#{args[4]}\\\" \\\"#{args[5]}\\\" ...\"\n\t\t\t\t\t\tidx = $1.to_i-1\n\t\t\t\t\t\tif $2 == nil\n\t\t\t\t\t\t\targs[idx] || ''\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\trange = args[idx..-1]\n\t\t\t\t\t\t\trange = range.map { |arg| '\"'+arg.gsub('\"', '\"\"')+'\"' } if $2 == '*q'\n\t\t\t\t\t\t\trange.join(' ')\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\n\t\t\ttext = ([action] + args.map { |a| '\"'+a.gsub('\"', '\"\"')+'\"' }).join(' ') unless text\n\t\t\tfile = @variables['__FILE__']\n\t\t\tline = @variables['__LINE__']\n\n\t\t\tAction.new(self, action, args, text, file, line)\n\t\tend",
"def interpret str\n str.lstrip!\n args = str.split(\" \")\n case args[0]\n when \"random\"\n do_random();\n when \"test\"\n do_test();\n when \"look\"\n do_look();\n when \"north\"\n move(:north)\n when \"east\"\n move(:east)\n when \"south\"\n move(:south)\n when \"west\"\n move(:west)\n when \"who\"\n #packet \"dialog\", \"<div id=\\\"who\\\"></div>\"\n do_who\n when \"say\"\n communicate args[1..-1].join(\" \")\n self.prefix = \"say\"\n when \"quit\"\n self.prefix = \"\"\n do_quit\n else\n if self.prefix \n interpret(self.prefix + \" \"+ args.join(\" \"))\n else\n packet \"dialog\", \"command not found: #{args[0]}\"\n end\n end\n end",
"def parse_text(source, rs = nil)\n rs ||= RenderState.new\n \n # check\n case rs.header_id_type\n\t\t\twhen HeaderIDType::MD5, HeaderIDType::ESCAPE\n\t\t\telse\n rs.warnings << \"illegal header id type - #{rs.header_id_type}\"\n\t\t\tend\n \n # Create a StringScanner we can reuse for various lexing tasks\n @scanner = StringScanner::new( '' )\n \n # Make a copy of the string with normalized line endings, tabs turned to\n # spaces, and a couple of guaranteed newlines at the end\n \n text = detab(source.gsub( /\\r\\n?/, \"\\n\" ))\n text += \"\\n\\n\"\n @log.debug \"Normalized line-endings: %p\" % text\n \n #text = Utilities::prePaling(text) #Insert by set.minami 2013-04-27\n #Insert by set.minami 2013-04-03\n text = transform_block_quotes(text, rs)\n nrange = []\n departure = 1\n preproc = Marshal.load(Marshal.dump(text))\n text.clear\n stack = []\n html_text_number = 0\n# Utilities::initNumberStack\n\n preproc.lines { |line|\n html_text_number += 1\n begin\n line.gsub!(/^\\{nrange:(.*?)(;\\d+)??\\}/){ |match|\n #depNum = $2.delete(';').to_i\n #departure = if depNum > 0 then depNum else 1 end\n if /h(\\d)\\-h(\\d)/i =~ $1\n nrange.push($1)\n nrange.push($2)\n if nrange.size > 2 then\n nrange.pop\n nrange.pop\n raise \"Syntax Error!\" \n end\n end\n next\n }\n @log.debug line \n #calculate numbering\n range = nrange[1].to_i - nrange[0].to_i\n if range == 0 then range = 1 end\n if range < 0 then \n p \"AoBane Syntax Error:Header range is WRONG!\" +\n \"@ l.#{html_text_number}\";exit(-1)\n raise FatalError,\"AoBane Syntax Error:Header range is WRONG!\"\n end\n if line =~ /^(%{1,#{range}})(.*?)\\n/ then\n text << Utilities.\n calcSectionNo(nrange.min,range,$1.size,departure,$2,stack) +\n \"\\n\"\n else\n text << line\n end\n @log.debug nrange.minmax\n rescue => e\n @log.warn \"AoBane Syntax WARNING l.#{html_text_number}:#{line.chomp} haven't adopted\" \n @log.warn e \n end\n }\n\n text.gsub!(/\\*\\[(.*?)\\]\\((.*?)(\\|.*?)*(\\/.*?)*\\)/){|match|\n '<font color=\"' +\n if $2.nil? then '' else $2 end\t+'\" ' +\n 'face=\"' +\n if $3.nil? then '' else $3.delete('|') end + '\" ' +\n 'size=\"' +\n if $4.nil? then '' else $4.delete('/') end + '\">' +\n $1 + '</font>'\n }\n #Insert by set.minami 2013-04-21\n text = Utilities::abbrPreProcess(text)\n #Insert by set.minami 2013-04-01\n text.gsub!(/\\\\TeX\\{(.+?)\\\\TeX\\}/){\n begin\n $1.to_mathml\n rescue => e\n puts 'math_ml Error: ' + $1\n puts e\n end\n }\n\n text = Utilities::preProcFence(text,0).join(\"\\n\") #Insert by set.minami 2013-04-27\n #Insert by set.minami 2013-03-30 \n #Insert by set.minami\n\n\t\t\t# Filter HTML if we're asked to do so\n\t\t\tif self.filter_html\n\t\t\t\t#text.gsub!( \"<\", \"<\" )\n\t\t\t\t#text.gsub!( \">\", \">\" )\n\t\t\t\[email protected] \"Filtered HTML: %p\" % text\n\t\t\tend\n\n\t\t\t# Simplify blank lines\n\t\t\ttext.gsub!( /^ +$/, '' )\n\t\t\[email protected] \"Tabs -> spaces/blank lines stripped: %p\" % text\n\n\n\t\t\t# Replace HTML blocks with placeholders\n\t\t\ttext = hide_html_blocks( text, rs )\n\t\t\[email protected] \"Hid HTML blocks: %p\" % text\n\t\t\[email protected] \"Render state: %p\" % rs\n\n\n\t\t\t# Strip footnote definitions, store in render state\n\t\t\ttext = strip_footnote_definitions( text, rs )\n\t\t\[email protected] \"Stripped footnote definitions: %p\" % text\n\t\t\[email protected] \"Render state: %p\" % rs\n\n\n\t\t\t# Strip link definitions, store in render state\n\t\t\ttext = strip_link_definitions( text, rs )\n\t\t\[email protected] \"Stripped link definitions: %p\" % text\n\t\t\[email protected] \"Render state: %p\" % rs\n\n\t\t\t# Escape meta-characters\n\t\t\ttext = escape_special_chars( text )\n\t\t\[email protected] \"Escaped special characters: %p\" % text\n\n\t\t\t# Transform block-level constructs\n\t\t\ttext = apply_block_transforms( text, rs )\n\t\t\[email protected] \"After block-level transforms: %p\" % text\n\n\t\t\t# Now swap back in all the escaped characters\n\t\t\ttext = unescape_special_chars( text )\n\t\t\[email protected] \"After unescaping special characters: %p\" % text\n\n\t\t\t# Extend footnotes\n\t\t\tunless rs.footnotes.empty? then\n\t\t\t\ttext << %Q|<div class=\"footnotes\"><hr#{EmptyElementSuffix}\\n<ol>\\n|\n\t\t\t\trs.found_footnote_ids.each do |id|\n\t\t\t\t\tcontent = rs.footnotes[id]\n\t\t\t\t\thtml = apply_block_transforms(content.sub(/\\n+\\Z/, '') + %Q| <a href=\"#footnote-ref:#{id}\" rev=\"footnote\">↩</a>|, rs)\n\t\t\t\t\ttext << %Q|<li id=\"footnote:#{id}\">\\n#{html}\\n</li>|\n\t\t\t\tend\n\t\t\t\ttext << %Q|</ol>\\n</div>\\n|\n\t\t\tend\n\n\t\t\t# Display warnings\n\t\t\tif @display_warnings then\n\t\t\t\tunless rs.warnings.empty? then\n\t\t\t\t\thtml = %Q|<pre><strong>[WARNINGS]\\n|\n\t\t\t\t\thtml << rs.warnings.map{|x| Util.escape_html(x)}.join(\"\\n\")\n\t\t\t\t\thtml << %Q|</strong></pre>|\n\n\t\t\t\t\ttext = html + text\n\t\t\t\tend\n\t\t\tend\n\n #Insert by set.minami 2013-04-21\n text = Utilities::abbrPostProcess(text)\n #Insert by set.minami 2013-03-30\n text = Utilities::insertTimeStamp(text)\n text = Utilities::postProcFence(text) #Insert by set.minami 2013-04-27\n\n text = Utilities::transformSpecialChar(text) #Insert by set.minami 2013-04-27\n\n return text\n end",
"def parse(text)\n splited = text.split(@delimiter, 4)\n time = splited[0..2].join(\" \")\n data = splited[3]\n time = @time_parser.parse(time)\n record = {}\n k, v = data.split(@delimiter, 2)\n record[\"raw_query\"] = v.strip\n # take onion domain\n if v.match(/[a-z0-9]{32}\\|[a-z0-9]{16}/)\n record[\"address\"] = v.split(\"|\")[1].strip + \".onion\"\n end\n # take tor node IP address\n data = Socket.getifaddrs.select{|x| (x.name == \"eth0\" or x.name.include?(\"enp\")) and x.addr.ipv4?}\n if (data != []) && (data.first.respond_to? :addr) \n record[\"snooper\"] = data.first.addr.ip_address\n end\n yield time, record\n end",
"def parse()\n\n\n begin\n @ruleStack.push('parse')\n # dice.g:42:8: ( expr )\n # dice.g:42:8: expr\n\n #@following.push(FOLLOW_expr_in_parse50)\n expr()\n #@following.pop\n\n\n\n\n rescue ANTLR::RecognitionException => e\n report_error(e)\n #raise e\n ensure\n @ruleStack.pop\n end\n\n end",
"def parse_text\n text.split(\"\\n\").map { |r| r.scan(/.../) } \n end"
] | [
"0.697833",
"0.6947745",
"0.6892348",
"0.6626048",
"0.6538646",
"0.6400786",
"0.62936264",
"0.62421995",
"0.6163899",
"0.6122116",
"0.60879403",
"0.60529804",
"0.60362196",
"0.60099715",
"0.5996392",
"0.59463716",
"0.58708954",
"0.5858089",
"0.5858089",
"0.5858089",
"0.5835854",
"0.5822197",
"0.58110267",
"0.5798824",
"0.57410556",
"0.573943",
"0.57234716",
"0.5718257",
"0.5705536",
"0.5675314",
"0.5665628",
"0.5665628",
"0.5634436",
"0.56323725",
"0.5619856",
"0.5616904",
"0.5616904",
"0.56162053",
"0.5610752",
"0.5606391",
"0.56045717",
"0.559089",
"0.558974",
"0.55836934",
"0.5569301",
"0.55592",
"0.555738",
"0.555738",
"0.55529374",
"0.55511636",
"0.55511636",
"0.55466104",
"0.5541293",
"0.54961073",
"0.5494153",
"0.54848063",
"0.54848063",
"0.54809403",
"0.5478387",
"0.5477128",
"0.5466652",
"0.54581314",
"0.544789",
"0.5443964",
"0.5441435",
"0.54382664",
"0.5433335",
"0.54332477",
"0.542643",
"0.5423327",
"0.54071516",
"0.5403678",
"0.53932023",
"0.53878045",
"0.53777397",
"0.5370235",
"0.5367974",
"0.53668684",
"0.53668684",
"0.53668684",
"0.53668684",
"0.5364832",
"0.53623134",
"0.535382",
"0.53486884",
"0.5339662",
"0.53338295",
"0.53335583",
"0.5327695",
"0.5327515",
"0.5327515",
"0.5324402",
"0.5322451",
"0.5317192",
"0.531013",
"0.53096515",
"0.53095204",
"0.5305698",
"0.5305382",
"0.53037935"
] | 0.58417434 | 20 |
sms support for problem creation | def sms_create
summary = @sms_summary
location = @sms_location
skills = @sms_skills
wage = @sms_wage
@problem = Problem.new(:location => location, :summary => summary, :skills => skills, :wage => wage)
add_problem_to_user_sms
sms_authenticate
if sms_save_problem
sms_send("You have successfully posted your problem(id: #{@problem.id}). We will notify you of any updates as soon as possible. Thank you for using Emplify!")
else
@problem.errors.full_messages.each do |error|
sms_error(error)
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sms_accept_problem\n problem_id = @problem_text[1]\n password = @problem_text[2]\n provider = Account.find_by_phone_number(normalize_phone(params[:From]))\n problem = Problem.find_by_id(problem_id)\n if problem.nil?\n sms_error(\"Sorry, there is no problem that matches ID #{problem_id}. Please accept problems in the following format: 'Accept [problem ID]'\")\n elsif problem.archived\n sms_error(\"Sorry, problem ID #{problem_id} has already been accepted by another provider. Please choose another problem.\")\n# elsif !provider.verified_skills.include? problem.skills\n# sms_error(\"Sorry, you do not have the skills that this problem requires.\")\n else\n provider.problems << problem\n if provider.save\n problem.archived = true\n problem.save\n requester = problem.account\n sms_send(\"You have accepted problem ##{problem_id}. Please contact your requester at #{requester.phone_number} as soon as possible.\")\n #send a notification to the requester saying that a provider will be contacting shortly\n requester_msg = \"Your #{problem.summary} problem has been accepted. You can contact your provider at #{provider.phone_number}.\"\n sms_send(requester.phone_number, requester_msg)\n end\n end\n end",
"def create\n @interactor = ProblemPersistence::ProblemCreationInteractor.call(self.params.merge(user_id: current_user.id))\n\n if @interactor.success?\n redirect_to @interactor.problem, notice: 'Problem was successfully created.' \n else\n \n #flash[:error] = interactor.error\n #render :new\n end\n end",
"def build_message\n\n # Get user\n user = User.find(params[\"user_id\"])\n\n # User Info\n user_info = user[\"name\"]+\" \"+user[\"last_name\"]+\" (\"+user[\"email\"]+\"), \"+user[\"jobtitle\"]+\n \", perteneciente al centro de costos \"+user[\"deptname\"]+\", a cursado una solicitud para \"\n\n # Transfer line\n if params[\"request\"] == \"transfer line\"\n ms = user_info+params[\"transfer_line_type\"]+\" su linea de teléfono con número telefónico: +56 9 \"+\n params[\"phone_number\"]\n\n # Smartphone\n elsif params[\"item\"] == \"smartphone\"\n lost = \"\"\n motive = \"\"\n\n #if not technical service\n if params[\"request\"] != \"technical service\"\n # Get smartphone info\n if params[\"want_all\"] == '0'\n params[\"model\"] = get_smartphone(params[\"model_one\"])\n params[\"price\"] = params[\"model\"][\"price\"]\n motive = \"\"\n else\n params[\"model\"] = get_smartphone(params[\"model_all\"])\n motive = \" El modelo smartphone elegido no corresponde al cargo que tiene el trabajador.\n El motivo de la elección que ha dado el trabajador es: \"+params[\"comment\"]+\".\"\n end\n end\n\n # New\n if params[\"request\"] == \"new\"\n ms = user_info+\" un nuevo smartphone modelo \"+params[\"model\"][\"model\"]+\n \", con un valor de $\"+params[\"model\"]['price'].to_s.reverse.gsub(/.{3}(?=.)/, '\\0.').reverse+\". \"\n if params[\"want_sim\"] == \"true\"\n ms+= \"El smartphone debe traer tarjeta Sim y el número de teléfono asociado a él \"\n if params[\"want_new_number\"] == \"true\"\n ms+= \"debe ser nuevo.\"\n else\n ms+= \"será cedido por el usuario, correspondiente al número telefónico: +56 9 \"+\n params[\"phone_number\"]+\".\"\n end\n else\n ms+= \"El smartphone no debe traer tarjeta Sim.\"\n end\n\n # Renew, stolen/lost\n elsif params[\"request\"] == \"renew\" || params[\"request\"] == \"stolen/lost\"\n ms = user_info+\" renovar su smartphone, eligiendo el modelo \"+params[\"model\"][\"model\"]+\n \", con un valor referencial de $\"+params[\"model\"]['price'].to_s.reverse.gsub(/.{3}(?=.)/, '\\0.').reverse+\". \"\n\n if params[\"request\"] == \"stolen/lost\"\n ms = user_info+\" un nuevo smartphone modelo \"+params[\"model\"][\"model\"]+\n \", con un valor de $\"+params[\"model\"]['price'].to_s.reverse.gsub(/.{3}(?=.)/, '\\0.').reverse+\". \"\n lost = \" Esta solicitud fue cursada por la pérdido o robo del smartphone que el trabajador tenia asignado anteriormente.\"\n end\n\n if params[\"want_sim\"] == \"true\"\n ms+= \"El smartphone debe traer tarjeta Sim y el número de teléfono asociado a él \"\n if params[\"number_type\"] == \"new\"\n ms+= \"debe ser nuevo.\"\n params[\"want_new_number\"] = true\n elsif params[\"number_type\"] == \"same\"\n ms+= \"será el mismo que tiene asignado actualmente el usuario, correspondiente al número telefónico: +56 9 \"+\n params[\"same_number\"]+\".\"\n params[\"want_new_number\"] = false\n params[\"phone_number\"] = params[\"same_number\"]\n else\n ms+= \"será cedido por el usuario, correspondiente al número telefónico: +56 9 \"+\n params[\"phone_number\"]+\".\"\n params[\"want_new_number\"] = false\n end\n else\n ms+= \"El smartphone no debe traer tarjeta Sim\"\n end\n\n # technical service\n elsif params[\"request\"] == \"technical service\"\n\n #If user want replacement\n if params[\"want_replacement\"] == \"true\"\n replace= \"El trabajador va a necesitar un dispositivo de reemplazo durante el periodo en que el smartphone es enviado al servicio técnico\"\n else\n replace= \"El trabajador no necesita un dispositivo de reemplazo durante el periodo en que el smartphone es enviado al servicio técnico\"\n end\n\n #message\n ms = user_info+\" enviar al servicio técnico su smartphone modelo \"+\n params[\"model\"]+\", IMEI \"+params[\"imei\"]+\", con número telefónico +56 9 \"+\n params[\"phone_number\"]+\". El desperfecto que presenta el smartphone es \"+\n params[\"comment\"]+\". \"+replace\n\n ms+= motive+lost\n end\n\n # Bam\n elsif params[\"item\"] == \"bam\"\n\n if params[\"request\"] != \"technical service\"\n # Get bam model's info\n params[\"model\"] = get_bam(params[\"model\"])\n # Get bam plan's info\n params[\"plan\"] = get_plan(params[\"plan\"])\n end\n\n # New, stolen/lost\n if params[\"request\"] == \"new\" || params[\"request\"] == \"stolen/lost\"\n # Message\n ms = user_info+\" un nuevo dispositivo Bam modelo \"+params[\"model\"][\"model\"]+\n \", con un valor de $\"+params[\"model\"]['price'].to_s.reverse.gsub(/.{3}(?=.)/, '\\0.').reverse+\n \", asociado al plan \"+params[\"plan\"][\"name\"]+\", el cual tiene un valor de $\"+\n params[\"plan\"]['price'].to_s.reverse.gsub(/.{3}(?=.)/, '\\0.').reverse+\". \"\n\n if params[\"request\"] == \"stolen/lost\"\n ms+= \" Esta solicitud fue cursada por la pérdido o robo del dispositivo Bam que el trabajador tenia asignado anteriormente.\"\n end\n\n # Renew\n elsif params[\"request\"] == \"renew\"\n # Message\n ms = user_info+\" renovar su dispositivo Bam, eligiendo el modelo \"+params[\"model\"][\"model\"]+\n \", con un valor de $\"+params[\"model\"]['price'].to_s.reverse.gsub(/.{3}(?=.)/, '\\0.').reverse+\n \". El usuario mantendrá el mismo plan, el cual tiene un valor de $\"+\n params[\"plan\"]['price'].to_s.reverse.gsub(/.{3}(?=.)/, '\\0.').reverse+\". \"\n\n # Technical service\n elsif params[\"request\"] == \"technical service\"\n #If user want replacement\n if params[\"want_replacement\"] == \"true\"\n replace= \"El trabajador va a necesitar un dispositivo de reemplazo durante el periodo en que el dispositivo Bam es enviado al servicio técnico\"\n else\n replace= \"El trabajador no necesita un dispositivo de reemplazo durante el periodo en que el dispositivo Bam es enviado al servicio técnico\"\n end\n #message\n ms = user_info+\" enviar al servicio técnico su dispositivo Bam modelo \"+\n params[\"model\"]+\", IMEI \"+params[\"imei\"]+\". El desperfecto que presenta el Bam es \"+\n params[\"comment\"]+\". \"+replace\n end\n\n # Sim\n elsif params[\"item\"] == \"sim\"\n # Message\n ms = user_info+\" una nueva Sim y el número de teléfono asociado a él\"\n\n if params[\"request\"] == \"stolen/lost\"\n ms+= \" debe ser el número telefónico: +56 9 \"+params[\"phone_number\"]+\n \". Esta solicitud fue cursada por la pérdida o robo de la Sim que el trabajador tenia asignado anteriormente.\"\n elsif params[\"want_new_number\"] == \"true\"\n ms+= \" debe ser nuevo.\"\n else\n # Message\n ms+= \" será cedido por el usuario, correspondiente al número telefónico: +56 9 \"+\n params[\"phone_number\"]+\".\"\n end\n\n # Roaming\n elsif params[\"item\"] == \"roaming\"\n # Get Roaming plan's info\n params[\"plan\"] = get_plan(params[\"plan\"])\n # Modify date\n date_split = params[\"start_date\"].split(\"-\")\n params[\"start_date\"] = Date.parse(date_split[2]+\"/\"+date_split[1]+\"/\"+date_split[0])\n\n date_split = params[\"end_date\"].split(\"-\")\n params[\"end_date\"] = Date.parse(date_split[2]+\"/\"+date_split[1]+\"/\"+date_split[0])\n # Message\n ms = user_info+\" el servicio Roaming, con el plan: \"+params[\"plan\"][\"name\"]+\n \", el cual tiene un valor de $\"+params[\"plan\"]['price'].to_s.reverse.gsub(/.{3}(?=.)/, '\\0.').reverse+\". El servicio\n se solicita ya que el trabajador viaja al extranjero debido a: \"+params[\"comment\"]+\n \", entre las fechas: \"+params[\"start_date\"].strftime('%d/%m/%Y')+\" y \"+params[\"end_date\"].strftime('%d/%m/%Y')+\".\"\n end\n\n return ms\n end",
"def create\n # create an incoming sms object\n sms = Sms::Message.create(:from => params[:sms_test][:from], :body => params[:sms_test][:body], :mission => current_mission)\n\n # submit it to the handle method over in the SmsController and get the reply\n reply = SmsController.handle_sms(sms)\n\n # save the reply and let the sent_at default to now\n reply.save if reply\n\n # render the body of the reply\n render :text => reply ? reply.body : \"<em>#{t('sms_console.no_reply')}</em>\".html_safe\n end",
"def create\n response.headers.delete \"X-Frame-Options\"\n\n @problem = Problem.new(problem_params)\n\n @problem.tag_list = @problem.tag_list[0].to_s.scan(/\\w+/)\n @problem.status = \"Open\"\n @problem.user = current_user\n\n respond_to do |format|\n if @problem.save\n format.html { redirect_to @problem, notice: 'Question was successfully created.' }\n format.json { render :show, status: :created, location: @problem }\n else\n format.html { render :new }\n format.json { render json: @problem.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n #ClickATell posts this\n #Parameters:\n #\"api_id\"=>\"3306957\"\n #\"from\"=>\"886975395038\"\n #\"to\"=>\"41798070085\"\n #\"timestamp\"=>\"2011-09-19 13:02:52\"\n #\"text\"=>\"Test of SMS 2\"\n #\"charset\"=>\"ISO-8859-1\"\n #\"udh\"=>\"\"\n #\"moMsgId\"=>\"3e644dd7c1df98671fe41d26dfd73672\"\n\n @momsg = Momsg.new(:from => params[:from], :text => params[:text])\n \n @momsg.save\n\n respond_to do |format|\n format.html { redirect_to @momsg }\n end\n end",
"def field_register_pharmacy(pharm_number,pharm_contact_name,staff_phone_number)\n pharm_number = standardize_number(pharm_number[0])\n\n #check to make sure this number is not already registered\n phone_number_in_db = Number.where(:id => pharm_number)\n if phone_number_in_db.count > 0\n send_try_again_sms(staff_phone_number,\"This number is already registered to pharmacy #{phone_number_in_db.first.pharmacy_id}\")\n return nil\n end\n\n\n Pharmacy.insert(:preferred_number_id => pharm_number,\n :name => pharm_contact_name)\n pid = Pharmacy.where(:preferred_number_id => pharm_number).first.id\n\n Number.insert(\n :id => pharm_number,\n :pharmacy_id => pid,\n :call_this_number => 1,\n :created_at => Time.now\n )\n\n #settings so we dont call em\n PendingCall.insert(\n :number_id => pharm_number,\n :attempts => $max_ors_attempts,\n :error_message_sent => 1\n )\n\n # Default start and end time for pharmacies\n AvailableTime.insert(\n :pharmacy_id => pid,\n :start_time => \"09:00:00\",\n :end_time => \"21:00:00\"\n )\n\n sms_message_confirmation = \"Registration successful. Pharmacy ID number is #{pid}\"\n $stderr.puts \"sending reg confirmation to to #{staff_phone_number}\"\n\n $client.account.sms.messages.create(\n :from => $sms_out_number,\n :to => staff_phone_number,\n :body => sms_message_confirmation)\n #send message to user\n $stderr.puts \"sending reg confirmation to to #{pharm_number}\"\n $client.account.sms.messages.create(\n :from => $sms_out_number,\n :to => pharm_number,\n :body => \"Welcome to bangpharma. Your pharmacy ID is #{pid}.\")\n\n return nil\nend",
"def create \t\n\t \t# TODO: make sure that there are no duplicates for questions\n\t \t\n\t \tif params[:question].nil?\n\t \t\t@error_message = 'ERROR: no question parameter provided'\n \t\telsif params[:question][:short_name].nil? or params[:question][:short_name].empty?\n \t\t\t@error_message = 'ERROR: no short name provided'\n \t\telsif params[:question][:text].nil? or params[:question][:text].empty?\n \t\t\t@error_message = 'ERROR: no question text provided'\n \t\telsif params[:question][:question_type].nil? or params[:question][:question_type].empty?\n \t\t\t@error_message = 'ERROR: no question type provided'\n\t\telsif params[:question][:domain].nil? or params[:question][:domain].empty?\n\t\t\t@error_message = 'ERROR: no question domain provided'\n\t\telsif not [Question::UNFILED_DOMAIN,Question::PROFILE_DOMAIN,Question::FEEDBACK_DOMAIN].include?(params[:question][:domain].downcase)\n\t\t\t@error_message = 'ERROR: invalid question domain provided'\n \t\telsif not ['Text','Multiple Choice','Multiple Selection'].include?(params[:question][:question_type])\n \t\t\t@error_message = 'ERROR: invalid question type'\n \t\telsif params[:question][:question_type] != 'Text' and (params[:choices].nil? or params[:choices].empty?)\n \t\t\t@error_message = 'ERROR: did not specify choices for a choice question' \t\t\t\n \t\telse\n\t\t \tquestion_type = _condense_question_type(params[:question][:question_type])\n \t\t\t# TODO: make sure that there are no duplicates\n\t\t \t \t\t\t\n\t\t \tif question_type.nil?\n \t\t\t\t@error_message = 'ERROR: could not condense question type properly!'\n \t\t\telse\n\t\t\t \t_create_new_question params[:question][:short_name], params[:question][:text], question_type, params[:question][:domain].downcase, current_user.id, params[:choices]\n\t \t\tend\n \t\tend\n \t\tif @error_message.nil? or @error_message.index('ERROR').nil? # if there is an error, stay on this page; else, allow user to continue\n \t\t\tredirect_to :action => :index\n \t\tend\n\tend",
"def generate\n resno = @resno_gen.generate\n id = @id_gen.generate\n address = @addr_gen.generate\n date = @date_gen.generate\n contact = @contact_gen.generate\n additional_properties = @additional_properties\n msg = {\n actionType: 'Create',\n jobIdentity: id,\n surveyType: @survey_type,\n preallocatedJob: false,\n mandatoryResourceAuthNo: resno,\n dueDate: date,\n address: address\n }\n msg[:contact] = contact if not contact.nil?\n msg[:additionalProperties] = additional_properties if not additional_properties.nil?\n return msg\n end",
"def installProblems\n if ! @cud.instructor? then\n redirect_to :action=>\"index\" and return\n end\n\n if Problem.where(:assessment_id=>@assessment.id).count == 0 then\n for problem in @problems do\n p = Problem.new(:name=>problem['name'],\n :description=>problem['description'],\n :assessment_id=>@assessment.id,\n :max_score=>problem['max_score'],\n :optional=>problem['optional'])\n p.save()\n end\n end\n end",
"def create\n @problem = Problem.new(params[:problem])\n\n respond_to do |format|\n if @problem.save\n format.html { redirect_to @problem, notice: 'Problem was successfully created.' }\n format.json { render json: @problem, status: :created, location: @problem }\n else\n format.html { render action: \"new\" }\n format.json { render json: @problem.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @problem = Problem.new(params[:problem])\n\n respond_to do |format|\n if @problem.save\n format.html { redirect_to @problem, notice: 'Problem was successfully created.' }\n format.json { render json: @problem, status: :created, location: @problem }\n else\n format.html { render action: \"new\" }\n format.json { render json: @problem.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @problem = Problem.new(params[:problem])\n\n respond_to do |format|\n if @problem.save\n flash[:class] = \"alert alert-success\"\n format.html { redirect_to @problem, :notice => 'Problem was successfully created.' }\n format.json { render :json => @problem, :status => :created, :location => @problem }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @problem.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create_sms(sms) \n s = SMS.new\n s.subscriber_id = @subscriber_id\n s.subscriber_password = @subscriber_password\n s.remote_host = @remote_host if @remote_host\n s.msg_pin = sms.recipients\n s.setSourceAddr(SMS::ADDR_TYPE_NETWORK, sms.from)\n s.msg_text = sms.body\n raise StandardError.new(\"SMS Body over 140 characters, body = \\n#{sms.body}\") if sms.body.size > 140\n s\n end",
"def mt_tsk_create_request\n task = MtCompanyTask.find( params[:id] );\n req = MaintenanceRequest.new();\n \n req.title = task.title;\n req.remarks = task.description; \n unless ( task.building.nil? )\n req.building = task.building;\n end\n req.reporter = @worker;\n \n req.mt_company_task = task;\n req.mt_company = @mt_company\n task.maintenance_request = req;\n \n begin\n req.save!\n task.save!\n add_confirmation \"MT_REQ CREATED\"\n redirect_to :action=>:mt_req_show, :id=>req.id, :back=>:mt_tsk_list;\n rescue Exception=>e\n add_error e.message\n redirect_to :action=>:mt_tsk_show, :id=>params[:id];\n end\n end",
"def create\n # @produce_task = ProduceTask.new(produce_task_params)\n # @order = Order.find(params[:order_id])\n if params[:units].nil? || params[:units][:id].empty?\n return redirect_to new_produce_task_path(order_id: @order.id), notice: \"创建失败,请选择部件!\"\n end\n order_units = OrderUnit.where(id: params[:units][:id])\n material = Material.find_by(ply: params[:ply], texture: params[:texture], face: params[:face], color: params[:color])\n if material.blank?\n return redirect_to new_produce_task_path(), notice: '创建失败,没有该种物料'\n end\n produce_task = ProduceTask.new(item_id: material.id, item_type: material.class)\n produce_task.area = params[:area].to_f\n produce_task.number = params[:number].to_i\n produce_task.work_id = 6\n produce_task.save!\n\n order_units.each do |unit|\n unit.state = 1\n unit.produce_task_id = produce_task.id\n unit.save!\n end\n\n if OrderUnit.joins(:order).where(\"orders.work_id = ?\", Work.find_by(symbol_name: \"checked\").id).where(\"orders.is_delete = false\").where(state: 0).any?\n redirect_to new_produce_task_path(), notice: '生产任务创建成功!'\n else\n create_part_produce_tasks\n # 下单成功\n Order.checked.each do |ord|\n if ord.order_units.where(state: 0).empty? && ord.order_parts.where(state: 0).empty?\n ord.open!\n ord.order_union.open!\n end\n end\n redirect_to produce_tasks_path, notice: \"所有订单的生产任务单创建完成,采购单已经生成。\"\n end\n end",
"def create_question(question_text,question_bank_id,tenant_id,question_type,explanation,direction_id,passage_id)\n question = Question.new\n question.question_text = question_text\n question.question_bank_id = question_bank_id\n question.tenant_id = tenant_id\n question.explanation = explanation\n question.question_type = question_type\n question.save\n question_attribute = create_question_attribute(question.id,\"\",question_bank_id,\"\",\"\",\"\",direction_id,passage_id,\"\",\"\",tenant_id)\n question_attribute.update_attribute(\"difficulty_id\",get_difficulty(\"not defined\"))\n unless question_type.nil? or question_type.blank?\n question_type = QuestionType.find_by_value(question_type)\n question_attribute.update_attribute(\"question_type_id\",question_type.id)\n end\n return question\n end",
"def sms\n account_sid = params[:AccountSid]\n body = params[:Body]\n from = params[:From]\n from_zip = params[:FromZip]\n if from && body && # account_sid == TWILIO_ACCOUNT_SID\n # sms = TwilioNet.new()\n # sms.send_sms('2146680255', truncate(\"FROM:#{from} BODY:#{body}\", :length => 159) )\n # render :layout => 'empty', :template => 'public/sms' \n creator = User.find_or_create_by_sms_number(from)\n creator.create_task(body)\n unless creator.valid?\n Rails.logger.error creator.message\n sms = TwilioNet.new()\n sms.send_sms(from, truncate(creator.message, :length => 159) )\n end\n render :text => \"Task created.\" \n else\n raise error \n end \n rescue\n render :text => \"Invalid Params #{params.inspect}\"\n end",
"def create_message(data); end",
"def create_message(data); end",
"def create\n # rp - request parameters\n rp = req_params\n\n # сюда будем собирать ошибки при проверке заявки\n errors = {}\n\n model_name(rp, errors)\n aas_names(rp, errors)\n check_human(rp, errors)\n\n if errors.empty?\n export(rp) if PSOFT_DB\n mail(rp)\n render json: { message: format(I18n.t('request.status.ok'), id: rp.id || ' -') }\n else\n render status: :unprocessable_entity, json: errors\n end\n end",
"def create\n save_twilio_message # see receive_text_controller\n\n send_error_notification && return unless person\n PaperTrail.whodunnit = person # auditing\n Rails.logger.info \"#{person.full_name}: #{message}\"\n # should do sms verification here if unverified\n\n # FIXME: this if else bundle needs a refactor badly.\n if remove?\n # do the remove people thing.\n person.deactivate!('sms')\n person.save!\n ::RemoveSms.new(to: person).send\n elsif confirm? # confirmation for the days reservations\n if !person.v2_reservations.for_today_and_tomorrow.empty?\n person.v2_reservations.for_today_and_tomorrow.each(&:confirm!)\n else\n ::ReservationReminderSms.new(to: person, reservations: person.v2_reservations.for_today).send\n end\n elsif cancel?\n if !person.v2_reservations.for_today_and_tomorrow.empty?\n person.v2_reservations.for_today_and_tomorrow.each(&:cancel!)\n else\n ::ReservationReminderSms.new(to: person, reservations: person.v2_reservations.for_today).send\n end\n elsif change?\n if !person.v2_reservations.for_today_and_tomorrow.empty?\n person.v2_reservations.for_today_and_tomorrow.each(&:reschedule!)\n else\n ::ReservationReminderSms.new(to: person, reservations: person.v2_reservations.for_today).send\n end\n elsif calendar?\n ::ReservationReminderSms.new(to: person, reservations: person.v2_reservations.for_today_and_tomorrow).send\n else\n\n # should be refactored into the person model.\n str_context = Redis.current.get(\"wit_context:#{person.id}\")\n # we don't know what event_id we're talking about here\n send_error_notification && return if str_context.nil?\n context = JSON.parse(str_context)\n event_id = Redis.current.get(\"event_lock:#{person.id}\") || Time.zone.today.to_s\n ::WitClient.run_actions \"#{person.id}_#{event_id}_#{Rails.env}\", message, context\n end\n # twilio wants an xml response.\n render text: '<?xml version=\"1.0\" encoding=\"UTF-8\" ?><Response></Response>'\n end",
"def create\n @problem = Problem.new(params[:problem])\n\n respond_to do |format|\n if @problem.save\n format.html { redirect_to [:admin, @problem], notice: 'Problem was successfully created.' }\n format.json { render json: @problem, status: :created, location: @problem }\n else\n format.html { render action: \"new\" }\n format.json { render json: @problem.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n scan_procedure_array =current_user.edit_low_scan_procedure_array.split(' ') #[:edit_low_scan_procedure_array]\n @question = Question.new(question_params)#params[:question])\n @v_sp_id = params[:question_scan_procedure][:scan_procedure_id]\n v_message =\"\"\n if @v_sp_id.blank?\n v_message =\"The Questioon was not linked to a Scan Procedure - PLEASE get an ADMINISTRATOR to link the question\"\n end\n respond_to do |format|\n if @question.save\n @question.ref_table_a_1 = (@question.ref_table_a_1).strip\n @question.ref_table_b_1 = (@question.ref_table_b_1).strip\n @question.ref_table_a_2 = (@question.ref_table_a_2).strip\n @question.ref_table_b_2 = (@question.ref_table_b_2).strip\n @question.ref_table_a_3 = (@question.ref_table_a_3).strip\n @question.ref_table_b_3 = (@question.ref_table_b_3).strip\n @question.js_1 = (@question.js_1).strip\n @question.js_2 = (@question.js_2).strip\n @question.js_3 = (@question.js_3).strip\n @question.save\n if !@v_sp_id.blank?\n @question_scan_procedure = QuestionScanProcedure.new \n @question_scan_procedure.question_id = @question.id\n @question_scan_procedure.scan_procedure_id = @v_sp_id\n @question_scan_procedure.include_exclude = \"include\"\n @question_scan_procedure.save\n end\n format.html { redirect_to(@question, :notice => 'Question was successfully created.'+v_message) }\n format.xml { render :xml => @question, :status => :created, :location => @question }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @question.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create # need the name 'create' to conform with REST defaults, or change routes\n #puts \"**** IncomingController create: params=#{params}\"\n @from = params[:From] # The phone number of the sender\n#debugger\n body = params[:Body] # This is the body of the incoming message\n AppLog.create(:code => \"SMS.incoming\", :description=>\"from=#{@from}; body=#{body[0..50]}\")\n params.delete 'SmsSid'\n params.delete 'AccountSid'\n params.delete 'SmsMessageSid'\n @possible_senders = from_members # all members from this database with matching phone number\n @sender = @possible_senders.first # choose one of them\n if @sender # We only accept SMS from registered phone numbers of members\n begin\n AppLog.create(:code => \"SMS.received\", :description=>\"from #{@from} (#{@sender.shorter_name}): #{body}\")\n resp = (process_sms(body) || '')[0..159] # generate response\n AppLog.create(:code => \"SMS.reply\", :description=>\"to #{@from}: #{resp}\")\n# default_sms_gateway.deliver(@from, resp) #default_gateway in messages_helper creates an instance of gateway specified \n# # in SiteSettings default_outgoing_sms_gateway\n render :text => resp, :status => 200, :content_type => Mime::TEXT.to_s # Confirm w incoming gateway that msg received\n# rescue\n# AppLog.create(:code => \"SMS.system_error\", :description=>\"on SMS#create: #{$!}, #{$!.backtrace[0..2]}\")\n# render :text => \"Internal\", :status => 500, :content_type => Mime::TEXT.to_s\n# ClickatellGateway.new.deliver(@from, \"Sorry, there is a bug in my system and I crashed :-(\" )\n end\n else \n AppLog.create(:code => \"SMS.rejected\", :description=>\"from #{@from}: #{body}\")\n render :text => \"Refused: sender's phone number is not recognized\", \n :status => 403, :content_type => Mime::TEXT.to_s\n end\n end",
"def create\n to = params[:to]\n\n unless to\n raise IOError, \"Incorrect params for sending text message\" \n end\n\n @client = Twilio::REST::Client.new(\n CONFIG[:twilio_account_sid],\n CONFIG[:twilio_auth_token])\n\n @account = @client.account\n @message = @account.sms.messages.create({\n :from => CONFIG[:twilio_phone_number],\n :to => to,\n :body => \"Happy Mining! #{CONFIG[:ios_app_link]}\"}) \n\n rescue => ex\n handle_exception(ex)\n ensure\n respond_to do |format|\n format.json\n end\n end",
"def create\n @sms_tmp = SmsTmp.new(params[:sms_tmp])\n\n respond_to do |format|\n if @sms_tmp.save\n format.html { redirect_to \"/home/sms\", notice: '短信模版创建成功.' }\n format.json { render json: @sms_tmp, status: :created, location: @sms_tmp }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sms_tmp.errors, status: :unprocessable_entity }\n end\n end\n end",
"def request_help\n @problem = Problem.find params[:problem_id], :include => :hints, :order => \"hints.position\"\n @hints = @problem.hints\n if @problem.has_scaffolds?\n ActiveRecord::Base.transaction do\n changed_and_notify_observers(:answer => { :incorrect => nil, :problem => @problem})\n flash[:message] = \"Let's move on and figure out this problem\"\n flash[:message_type] = :neutral\n help_student_out\n end\n else\n logger.info \"hint_count = #{session[:hint_count]}; total hints count = #{@hints.size}\"\n if (session[:hint_count] + 1) < @hints.size\n session[:hint_count] += 1\n logger.info \"hint_count incremeneted: #{session[:hint_count]}\"\n @hint = @hints[session[:hint_count]]\n ActiveRecord::Base.transaction do\n changed_and_notify_observers(:hint => @hint)\n end\n render_tutor :file => \"add_hint\"\n else\n # TODO: make this message to be a hint_notice_message\n @message = \"Sorry, the number of requested hints has exceeded the number of actual hints! Please let us know about this by commenting.\"\n render_tutor :file => \"notice_message\"\n end\n end\n end",
"def create\n @problem = Problem.new(problem_params)\n\n respond_to do |format|\n if @problem.save\n format.html { redirect_to admin_problem_path(@problem), notice: 'Problem was successfully created.' }\n format.json { render action: 'show', status: :created, location: @problem }\n else\n format.html { render action: 'new' }\n format.json { render json: @problem.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @problem = Problem.new(problem_params)\n\n respond_to do |format|\n if @problem.save\n format.html { redirect_to @problem, notice: 'Problem was successfully created.' }\n format.json { render action: 'show', status: :created, location: @problem }\n else\n format.html { render action: 'new' }\n format.json { render json: @problem.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @action = 'create'\n params[:admin_journal_issue][:from] = current_admin.id\n @admin_journal_issue = Admin::JournalIssue.new(admin_journal_issue_params)\n respond_to do |format|\n if @admin_journal_issue.save\n #this method for sending message to admin about Journal issue who assign\n AdminMailer.delay(:queue => 'notification_create_journal_issue', :priority => 1).mail_journal_issue(@admin_journal_issue.id,@admin_journal_issue.asignee,\"main\")\n Admin::JournalIssue.save_attributes(@admin_journal_issue.id,params)\n format.html { redirect_to @admin_journal_issue, notice: 'Journal issue was successfully created.' }\n format.json { render action: 'show', status: :created, location: @admin_journal_issue }\n else\n format.html { render action: 'new' }\n format.json { render json: @admin_journal_issue.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new; send_sms; end",
"def create\n @problem = current_user.problems.build(problem_params)\n\n respond_to do |format|\n if @problem.save\n format.html { redirect_to root_path, notice: 'Problem was successfully created.' }\n format.json { render :show, status: :created, location: @problem }\n else\n format.html { render :new }\n format.json { render json: @problem.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @social_problem = SocialProblem.new(params[:social_problem])\n\n respond_to do |format|\n if @social_problem.save\n format.html { redirect_to(@social_problem, :notice => 'Social problem was successfully created.') }\n format.xml { render :xml => @social_problem, :status => :created, :location => @social_problem }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @social_problem.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @contestproblem = Contestproblem.new(params.require(:contestproblem).permit(:statement, :origin, :start_time, :end_time))\n if @date_problem\n render 'new' and return\n end\n @contestproblem.contest = @contest\n @contestproblem.number = 1\n if [email protected]\n render 'new'\n else\n flash[:success] = \"Problème ajouté.\"\n \n update_contest_details\n update_problem_numbers\n redirect_to @contestproblem\n end\n end",
"def create\n @admin_problem = Problem.new(admin_problem_params)\n\n respond_to do |format|\n if @admin_problem.save\n format.html { redirect_to admin_problem_path(@admin_problem), notice: 'Admin problem was successfully created.' }\n format.json { render :show, status: :created, location: @admin_problem }\n else\n set_genres\n format.html { render :new }\n format.json { render json: @admin_problem.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\t@question = Question.new(params[:question])\n\t if @question.type.name==\"Matrix Type Question\"\n\t @question.answer=100\n\t end\n\t@questionnaire = Questionnaire.find(params[:questionnaire_id])\n\n\trespond_to do |format|\n\t if @question.save\n\t\t@questionnaire_question = QuestionnaireQuestion.new\n\t\t@[email protected]\n\t\t@[email protected]\n\t\t@questionnaire_question.save\n\n\t\ts=\"True\"\n\t\tif @question.type.name==\"True-False Question\"\n\t\t 2.times do |i|\n\t\t\t@option=Option.new\n\t\t\[email protected]=s\n\t\t\ts=\"False\"\n\t\t\[email protected][email protected]\n\t\t\[email protected]_number=(i+1)\n\t\t\[email protected]\n\n\t\t end\n\t\tend\n\t\tif (@question.type.name==\"Open Ended Question\" || @question.type.name==\"True-False Question\") then\n\t\t format.html { redirect_to new_question_path(:questionnaire_id=>@questionnaire.id), :notice => 'Question was successfully created.' }\n\t\telse\n\t\t if (@question.type.name==\"Matrix Type Question\")\n\n\t\t\tformat.html { redirect_to :controller => :matrix, :action => 'index', :question_id=>@question.id, :notice => 'Question was successfully created.' }\n\t\t end\n\t\t format.html { redirect_to new_option_path(:question_id=>@question.id, :notice => 'Question was successfully created.') }\n\t\tend\n\t else\n\t\tformat.html { redirect_to :action => \"new\" ,:questionnaire_id=>@questionnaire.id}\n\t\tformat.xml { render :xml => @question.errors, :status => :unprocessable_entity }\n\t end\n\tend\n end",
"def prepare_message\n case self.option_types\n when \"quick replies\"\n self.to_message_with_quick_replies\n when \"buttons\"\n self.to_message_with_buttons\n when \"templates\"\n self.to_message_with_templates\n when \"none\"\n self.to_simple_message\n end\n end",
"def create_report_if_valid!\n messages = conversation.messages.valid.where.not(step: nil).group(:step)\n\n if messages.size.size == STEPS.size + 1\n messages = conversation.messages.valid.where.not(step: nil).group_by(&:step)\n\n params = {\n user_email: remove_short_code(messages[1].first.body),\n reportee_name: remove_short_code(messages[2].first.body),\n reportee_mother_name: remove_short_code(messages[3].first.body),\n address: remove_short_code(messages[4].first.body),\n district: remove_short_code(messages[5].first.body),\n probable_cause: CATEGORIES_MAPPING[remove_short_code(messages[6].first.body).to_i]\n }\n\n # Creates the report and notifies the user\n CreateReport.new(params.with_indifferent_access).create!\n conversation.finished!\n send_sms('Recebemos seu alerta com sucesso, obrigado.')\n end\n end",
"def notify(message, phone, date, errors)\n @message = message\n @phone = phone\n @date = date\n @errors = errors\n #@class_name = class_name\n #@method = method || nil\n\n mail(to: '[email protected]', subject: 'Erreur creation compte PAYQUICK')\n end",
"def new\n @problem = current_user.problems.build\n end",
"def send_sms(content, tonumber)\n tonumber = format(tonumber);\n \tbegin\n @client.messages.create({\n \t :from => @from_number,\n \t :to => tonumber,\n \t :body => content,\n })\n rescue Twilio::REST::RequestError => e\n message = I18n.t(\"errors.sms_not_sent\")\n rescue NoMethodError => e\n message = I18n.t(\"errors.sms_not_sent\")\n else\n message = I18n.t(\"notice.success\")\n end\n\n return message\n\n end",
"def signupFail(message, phone, date, errors)\n @message = message\n @phone = phone\n @date = date\n @errors = errors\n\n mail(to: '[email protected]', subject: 'Erreur creation compte PAYQUICK')\n end",
"def build_message(no_jira = [], invalid_jira= [])\n description = @options[\"intro\"] || \"\"\n description.concat <<DESCRIPTION\nThis notice is to remind you that you need to include valid Jira ticket\nnumbers in all of your Git commits!\n\nWe encountered the following problems in your recent commits.\n\nDESCRIPTION\n if no_jira.size > 0\n description.concat <<DESCRIPTION\nCommits with no reference to any jira tickets:\n\n #{no_jira.join(\"\\n--\\n \")}\n-----\nDESCRIPTION\n end\n\n if invalid_jira.size > 0\n description.concat <<DESCRIPTION\nCommits which reference invalid Jira ticket numbers\nthat don't exist or have already been closed:\n\n #{invalid_jira.join(\"\\n--\\n \")}\n-----\nDESCRIPTION\n end\n\n description.concat @options[\"conclusion\"] if @options[\"conclusion\"]\n\n description\n end",
"def create\n @problem = Problem.new(problem_params)\n\n if @problem.save\n render json: @problem, status: :created, location: @problem\n else\n render json: @problem.errors, status: :unprocessable_entity\n end\n end",
"def message_create_train\n @message = 'Enter the train number with format > xxx(-?)xx: '\n end",
"def create\n\n begin\n\n text = params[\"Content\"]\n\n if !text.downcase.start_with?(\"test\")\n mobile = params[\"MSISDN\"]\n if !mobile.start_with?(\"+\")\n mobile = \"+#{mobile}\"\n end\n\n service = SmsService.new\n\n @message = SmsService.handle_sms_sending(text, mobile)\n\n render text: 'success', status: 200\n else\n if Rails.env == \"production\"\n msg = text.split(\" \")[1]\n HTTParty.post(ENV['DEVELOPEMENT_SERVER_URL'], :query => { \"Content\" => msg, \"MSISDN\" => params[\"MSISDN\"] })\n end\n render text: 'success', status: 200\n end\n rescue => error\n respond_to do |format|\n format.all { render json: (@message.errors if [email protected]?), status: :unprocessable_entity }\n end\n end\n end",
"def build_hl7_message(patient_info) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize\n msg_input = upload_qbp_template('lib/assets/qbp.hl7')\n\n # Build MSH Segment\n uid = rand(10_000_000_000).to_s\n msh = msg_input[:MSH]\n msh.time = Time.zone.now\n msh.message_control_id = uid\n\n # Build QPD segnment\n qpd = msg_input[:QPD]\n qpd.query_tag = uid\n\n if patient_info[:patient_list]\n patient_id_list = HL7::MessageParser.split_by_delimiter(qpd.patient_id_list, msg_input.item_delim)\n patient_id_list[1] = patient_info[:patient_list][:id] # ID\n patient_id_list[4] = patient_info[:patient_list][:assigning_authority] # assigning authority\n patient_id_list[5] = patient_info[:patient_list][:identifier_type_code] # identifier type code\n qpd.patient_id_list = patient_id_list.join(msg_input.item_delim)\n end\n\n if patient_info[:patient_name]\n patient_name = HL7::MessageParser.split_by_delimiter(qpd.patient_name, msg_input.item_delim)\n patient_name[0] = patient_info[:patient_name][:family_name] # family name\n patient_name[1] = patient_info[:patient_name][:given_name] # given name\n patient_name[2] = patient_info[:patient_name][:second_or_further_names] # second name\n patient_name[3] = patient_info[:patient_name][:suffix] # suffix name\n qpd.patient_name = patient_name.join(msg_input.item_delim)\n end\n\n if patient_info[:mothers_maiden_name]\n mother_maiden_name = HL7::MessageParser.split_by_delimiter(qpd.mother_maiden_name, msg_input.item_delim)\n mother_maiden_name[0] = patient_info[:mothers_maiden_name][:family_name] # family name\n mother_maiden_name[1] = patient_info[:mothers_maiden_name][:given_name] # given name\n mother_maiden_name[6] = patient_info[:mothers_maiden_name][:name_type_code] # name type code, M = Maiden Name\n qpd.mother_maiden_name = mother_maiden_name.join(msg_input.item_delim)\n end\n\n qpd.patient_dob = patient_info[:patient_dob]\n\n qpd.admin_sex = patient_info[:admin_sex]\n\n if patient_info[:address]\n address = HL7::MessageParser.split_by_delimiter(qpd.address, msg_input.item_delim)\n address[0] = patient_info[:address][:street] # street address\n address[2] = patient_info[:address][:city] # city\n address[3] = patient_info[:address][:state] # state\n address[4] = patient_info[:address][:zip] # zip\n address[6] = patient_info[:address][:address_type] # address type\n qpd.address = address.join(msg_input.item_delim)\n end\n\n if patient_info[:phone]\n phone_home = HL7::MessageParser.split_by_delimiter(qpd.phone_home, msg_input.item_delim)\n phone_home[5] = patient_info[:phone][:area_code] # area code\n phone_home[6] = patient_info[:phone][:local_number] # local number\n qpd.phone_home = phone_home.join(msg_input.item_delim)\n end\n\n msg_input\n end",
"def create\n @group_problem = GroupProblem.new(params[:group_problem])\n\n respond_to do |format|\n if @group_problem.save\n format.html { redirect_to(@group_problem, :notice => 'Group problem was successfully created.') }\n format.xml { render :xml => @group_problem, :status => :created, :location => @group_problem }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @group_problem.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @minimessage = Minimessage.new(params[:minimessage])\n\n respond_to do |format|\n if @minimessage.save\n format.html { redirect_to @minimessage, notice: 'Minimessage was successfully created.' }\n format.json { render json: @minimessage, status: :created, location: @minimessage }\n else\n format.html { render action: \"new\" }\n format.json { render json: @minimessage.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @problem = Problem.new(problem_params)\n\n respond_to do |format|\n if @problem.save\n format.html { redirect_to [:admin, @problem], notice: 'Problem was successfully created.' }\n format.json { render :show, status: :created, location: [:admin, @problem] }\n else\n format.html { render :new }\n format.json { render json: @problem.errors, status: :unprocessable_entity }\n end\n end\n end",
"def failed_transcoding prms\n # check prms must have question_url and user_email\n Rails.logger.error \"question_url not found to send transcoding status email. Prms is #{prms.to_s}\" and return if !prms[:question_url] && !prms[:user_email]\n @name = prms[:user_name]\n @text = prms[:question_text]\n @url = prms[:question_url]\n @exceed_duration = prms[:duration_exceed] == 'yes'\n @extra_msg = @exceed_duration ? t(:failed_trancoding_duration, num: APP_CONFIG[:videos][:answer_upload_max_duration]) : t(:default_failed_video_text)\n mail to: prms[:user_email], subject: t(\"mailer.transcoding.failed_subject\")\n end",
"def preservation_problems\n ''\n end",
"def problems(current_user=nil)\n user = current_user || self.corresponding_author\n\n list = []\n \n page_valid?(:general) or list << 'Complete the General Info page.'\n page_valid?(:coauthors) or list << 'Complete the Co-Authors page.'\n page_valid?(:reviewers) or list << 'Complete the Reviewers page.'\n page_valid?(:fees) or list << 'Complete the Fees page.'\n page_valid?(:checklist) or list << 'Complete the Checklist page.'\n page_valid?(:review) or list << 'Complete the Review page.'\n completed_coi?(user) or list << 'Complete the Financial Disclosure form.'\n coauthors_valid? or list << 'You specified that you are not the sole author of this manuscript. Please add the coauthor(s)'\n ca_contribution = Contribution.find_by_article_submission_and_user(self.id, user.id)\n ca_contribution.responsibilities_sig_assent or list << 'Complete the Author Responsibilities Form.'\n ca_contribution.copyright_sig_assent or list << 'Complete the Copyright Assignment Form.'\n \n unless(self.isVideo?)\n self.manuscript or list << 'Upload your manuscript.'\n self.cover_letter or list << 'Upload your cover letter.'\n if self.provisionally_accepted\n self.has_had_status?(ArticleSubmission::MANUSCRIPT_RESUBMITTED) or list << \"Resubmit your manuscript\"\n self.has_had_status?(ArticleSubmission::COVER_LETTER_RESUBMITTED) or list << \"Resubmit your cover letter\"\n \n end\n else\n !self.manuscript_video_link.blank? or list << 'Upload Video Link'\n end\n list.compact!\n \n (list.length > 0) ? list : nil\n end",
"def create_request(res, user, res_notes)\n errors = res.validate\n notes = \"### Requested on #{Time.zone.now.to_s(:long)} by \"\\\n \"#{user.md_link}\\n\\n#### Notes:\\n#{res_notes}\"\n res.flag(:request)\n res.status = 'requested'\n res.notes = notes\n res.save!\n\n AdminMailer.request_filed(res).deliver_now # send request notification\n \"Request for #{res.equipment_model.md_link} filed successfully. \"\\\n \"#{errors.to_sentence}\\n\"\n end",
"def create\n # {\"ToState\"=>\"IL\", \"FromState\"=>\"AZ\", \"AccountSid\"=>\"AC1afaeecf73a8e05e32c695eac213226c\", \"SmsMessageSid\"=>\"SM8a1e2f65484fa1bd45b6a37d72a145fe\", \"Body\"=>\"youre an idiot sometimes\", \"From\"=>\"+16234556356\", \"FromCity\"=>\"PHOENIX\", \"SmsStatus\"=>\"received\", \"FromZip\"=>\"85065\", \"FromCountry\"=>\"US\", \"To\"=>\"+18152165378\", \"ToCity\"=>\"KANKAKEE\", \"ToZip\"=>\"60914\", \"ToCountry\"=>\"US\", \"ApiVersion\"=>\"2010-04-01\", \"SmsSid\"=>\"SM8a1e2f65484fa1bd45b6a37d72a145fe\"}\n @incoming_text = IncomingText.new(params[:incoming_text])\n\n respond_to do |format|\n if @incoming_text.save\n format.html { redirect_to(@incoming_text, :notice => 'Incoming text was successfully created.') }\n format.xml { render :xml => @incoming_text, :status => :created, :location => @incoming_text }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @incoming_text.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def get_message(patient_name: nil, doctor_name: nil)\n doctor_sms = nil\n doctor_push = nil\n patient_sms = nil\n patient_push = nil\n reason_code_static_name = reason_code.try(:static_name)\n case event.static_name\n when \"Cancelation - GPDQ Error\"\n case reason_code_static_name\n when \"GPDQ Platform Error\"\n doctor_sms = \"Dear Dr #{doctor_name}, We have cancelled your next appointment due to a technical error. Please email your GPDQ account manager for further information\"\n when \"Back office mistake\", \"Tech error\", \"Unspecified\"\n doctor_sms = \"Yes\"\n end\n when \"Patient Cancellation\"\n case reason_code_static_name\n when \"Patient Cancelled via app\"\n doctor_sms = \"Dear Dr #{doctor_name}, #{patient_name} has now cancelled booking ref #{appointment_id}. Cancellation credits may be applicable, please contact your account manager for further information\"\n patient_sms = \"Your cancellation was successful. A cancellation fee will be deducted from your account if the doctor has been despatched to your booking\"\n when \"Patient didn't answer door\"\n patient_sms = \"Dear #{patient_name}, your booking ref #{appointment_id} has been cancelled as the doctor was unable to locate you. As per our t&c's a cancellation fee is applicable\"\n when \"Due to delay\"\n doctor_sms = \"Dear Dr #{doctor_name}, we have now cancelled your next appt as the patient has informed us they are unable to wait any longer\"\n when \"Due to return\"\n doctor_sms = \"Dear Dr #{doctor_name}, your recent return resulted in cancellation by the patient. As per our terms and conditions a customer compensation credit is required.\"\n when \"Prior to doctor confirming on route\"\n doctor_sms = \"Dear Dr #{doctor_name}, we wanted to inform you that the booking in your dashboard has now been cancelled by the patient. Please do not proceed to the appointment\"\n when \"Serious medical issue with Patient\"\n doctor_sms = \"Dear Dr #{doctor_name}, your upcoming booking has been cancelled by the patient due to a serious medical emergency.\"\n end\n when \"Doctor Return\"\n case reason_code_static_name\n when \"60 mins before ETA\", \"30 mins before ETA\"\n patient_sms = \" dr #{doctor_name} has just informed us he/she will be unable to complete your appt due to an unexpected issue. GPDQ has found you a replacement doctor , track him/her here!\"\n when \"15 mins before ETA\"\n patient_sms = \" dr #{doctor_name} has just informed us he/she will be unable to complete your appt due to an unexpected issue. GPDQ has found you a replacement doctor who will arrive within 15 minutes , track him/her here!\"\n end\n when \"Doctor delayed\"\n case reason_code_static_name\n when \"Late >10 minutes\"\n patient_sms = \"Dr #{doctor_name} is running 10 minutes late, apologies for the inconvenience\"\n when \"Late >20 minutes\"\n patient_sms = \"Doctor #{doctor_name} is running late due to traffic and will be with you as soon as possible.\"\n when \"Late >40 minutes\"\n patient_sms = \"Unfotunately Dr #{doctor_name} has been delayed due to an extention with his previous patient & will be with you shortly. A member of our team will contact you to resolve this\"\n end\n when \"Other Customer Service Event\"\n patient_sms = \"Reactive\"\n patient_push = \"Reactive\"\n when \"Booking confirmed\"\n patient_sms = \"Yes\"\n when \"Dispached to doctor\"\n doctor_sms = \"Dear Dr #{doctor_name}, your next appointment is waiting for acceptance.\"\n doctor_push = \"You have a new appointment awaiting acceptance\"\n when \"Doctor not yet confirmed on way when due\"\n doctor_sms = \"Dear Dr #{doctor_name}, please accept your next booking or contact us if you are unable to fulfill this\"\n when \"Doctor confirmed on way\"\n patient_sms = \"Hi #{patient_name}, your booking ref #{appointment_id} is confirmed and doctor #{doctor_name} is on his way. Track him here <link>/track on link\"\n when \"Reminder to Doctor that appt ends in 5 minutes\"\n doctor_push = \"Dr #{doctor_name}, your appointment is coming to an end in 5 minutes. If you need an extension, please inform the patient\"\n when \"Appointment extension in 5 min increments (increment + 3 mins is regarded as the lower increment)\"\n case reason_code_static_name\n when \"5 minute extension\"\n patient_sms = \"Hi #{patient_name}, Your appointment has been extended and any applicable charges will be available to view on your receipt\"\n end\n when \"Additional Onsite Consultation\"\n case reason_code_static_name\n when \"New Patient\"\n patient_sms = \"You have requested an additional consultation with Dr #{doctor_name} which will be deducted from your chosen payment method\"\n end\n end\n message = { doctor_sms: doctor_sms, doctor_push: doctor_push, patient_sms: patient_sms, patient_push: patient_push }\n end",
"def create\n authorize! :create_survey, @course\n\n # Update email\n @org_course = @course.orgs_courses.by_org(@org).first\n CourseMail.update_email(@org_course, params[:email_subject], params[:email_message], :survey)\n\n question = Question.by_question_type('survey').find_by_id(params[:question_id])\n unless question\n raise 'Bad survey question'\n end\n\n # Surveys\n case params[:send_type]\n when 'selected_users'\n res = Survey.create_surveys(@org, @course, question, params[:user_ids].split(','), params[:invitation_ids].split(','))\n when 'all_users'\n # res = Survey.create_surveys_for_all_users(@org, @course, question, params)\n Survey.delay.create_surveys_for_all_users(@org, @course, question, params, current_user)\n flash[:notice] = \"Sending surveys in background\"\n return\n else\n raise \"Unknown send type\"\n end\n\n msg = []\n res.each do |type, emails|\n if emails.present?\n msg << \"#{emails.count} #{type}\"\n end\n end\n\n if msg.present?\n flash[:notice] = \"Result: \" + msg.join(' ')\n end\n\n rescue => ex\n log_error(ex)\n flash[:alert] = ex.message\n ensure\n redirect_to org_course_surveys_path(@org, @course)\n end",
"def create\n @problem = Problem.new(problem_params)\n create_tags\n respond_to do |format|\n if @problem.save\n format.html { redirect_to @problem, notice: 'Problem was successfully created.' }\n format.json { render json: @problem, status: :created, location: @problem }\n else\n format.html { render \"new\" }\n format.json { render json: @problem.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @diagnosis_pattern_symptom = Diagnosis::PatternSymptom.new(diagnosis_pattern_symptom_params)\n\n respond_to do |format|\n if @diagnosis_pattern_symptom.save\n format.html { redirect_to @diagnosis_pattern_symptom, notice: 'Pattern symptom was successfully created.' }\n format.json { render action: 'show', status: :created, location: @diagnosis_pattern_symptom }\n else\n format.html { render action: 'new' }\n format.json { render json: @diagnosis_pattern_symptom.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new_message\n end",
"def create\n respond_to do |format|\n if @problem.save\n format.html { redirect_to @problem, notice: 'Problem was successfully created.' }\n format.json { render json: @problem, status: :created, location: @problem }\n else\n format.html { render action: \"new\" }\n format.json { render json: @problem.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n purpose = params[:question].delete(:purpose)\n @question = Question.new(params[:question])\n @question.caption ||= \"\"\n @question.page = @page\n\n respond_to do |format|\n if @question.save and @question.update_attribute(:type, params[:question][:type])\n if purpose\n SpecialFieldAssociation.create :question => @question, :purpose => purpose, :questionnaire => @questionnaire\n end\n \n @question = Question.find(@question.id)\n if @question.kind_of? Questions::Field and @question.caption.blank?\n # get the default field caption in\n @question.caption = \"Pulse aqu’ para escribir una pregunta\"\n @question.save\n end\n \n format.html { redirect_to question_url(@question) }\n format.xml { head(:created, :location => question_url(@questionnaire, @page, @question, :format => 'xml')) }\n format.json { head(:created, :location => question_url(@questionnaire, @page, @question, :format => 'json')) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @question.errors.to_xml, :status => 500 }\n format.json { render :json => @question.errors.to_json, :status => 500 }\n end\n end\n end",
"def create\n if @send_solution == 2 # Can happen if we have two windows and we try to create twice a solution to a same problem\n update and return\n end\n \n params[:contestsolution][:content].strip! if !params[:contestsolution][:content].nil?\n \n # Attached files\n @error_message = \"\"\n attach = create_files\n if !@error_message.empty?\n flash[:danger] = @error_message\n session[:ancientexte] = params[:contestsolution][:content]\n redirect_to contestproblem_path(@contestproblem) and return\n end\n\n solution = @contestproblem.contestsolutions.build(content: params[:contestsolution][:content])\n solution.user = current_user.sk\n\n if solution.save\n attach_files(attach, solution)\n flash[:success] = \"Solution enregistrée.\"\n redirect_to contestproblem_path(@contestproblem, :sol => solution)\n else\n destroy_files(attach)\n session[:ancientexte] = params[:contestsolution][:content]\n flash[:danger] = error_list_for(solution)\n redirect_to contestproblem_path(@contestproblem)\n end\n end",
"def create\n @question = Question.new(params[:question])\n @question.dialogue = 0\n @question.participant = current_user.participant\n @question.status = Question.status_new\n respond_to do |format|\n if @question.save\n format.html { redirect_to(@question, :notice => 'Question was successfully created.') }\n format.xml { render :xml => @question, :status => :created, :location => @question }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @question.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_problem\n @problem = Problem.find(params[:id])\n end",
"def set_problem\n @problem = Problem.find(params[:id])\n end",
"def set_problem\n @problem = Problem.find(params[:id])\n end",
"def set_problem\n @problem = Problem.find(params[:id])\n end",
"def create\n @early_warning_report = EarlyWarningReport.new(early_warning_report_params)\n @early_warning_report.sms_status = 'Sending'\n recievers = early_warning_report_params['recieviers']\n level = early_warning_report_params['level']\n respond_to do |format|\n if @early_warning_report.save\n send_sms(recievers,level)\n\n format.html { redirect_to @early_warning_report, notice: 'Early warning report was successfully created and SMS sent' }\n format.json { render :show, status: :created, location: @early_warning_report }\n else\n format.html { render :new }\n format.json { render json: @early_warning_report.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @message = Message.new(params[:message])\n\n respond_to do |format|\n if @message.save\n recipient_phone = Phone.find_by_number(@message.number)\n \t recipient_phone ||= User.create!.phones.create!(:number => @message.number)\n @message.send_SMS(@message.raw_message, recipient_phone, \"\", @message.app.id)\n format.html { redirect_to messages_path, notice: 'Message was successfully sent.' }\n format.json { render json: @message, status: :created, location: @message }\n else\n format.html { render action: \"new\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def make_hl7_from_text(text)\n hl7 = HL7::Message.new\n msh = hl7.standard_msh\n msh.sending_facility = {:namespace_id=>Pref.namespace_id,:universal_id=>Pref.hostname,:universal_id_type=>\"DNS\"}\n if ENV['RAILS_ENV'] == 'development'\n pro_id = 'D'\n else\n pro_id = 'P'\n end\n msh.processing_id = {:processing_id=>pro_id}\n hl7 << msh\n p = User.find_by_wedgetail(wedgetail,:order=>\"created_at DESC\")\n hl7 << p.make_pid\n obr = HL7::Obr.new\n obr[0] = \"OBR\"\n obr.set_id = 1\n obr.filler_order_number= {:entity_identifier=>\"%X\" % self.id,:namespace_id=>Pref.namespace_id,:universal_id=>Pref.hostname,:universal_id_type=>\"DNS\"}\n author = User.find_by_wedgetail(created_by,:order=>\"created_at DESC\")\n obr.principal_result_interpreter = {:name=>{:family_name=>author.family_name.upcase,:given_name=>author.given_names.upcase,:id_number=>author.id}}\n obr.observation_time = created_at\n usi = {:name_of_coding_system=>\"LN\"} # LOINC\n message_type = {:message_code=>'REF',:trigger_event=>'I12'}\n case narrative_type_id\n when 1 # Health Summary\n usi[:identifier] = \"34133-9\"\n usi[:text] = \"Summarization of episode note\"\n when 2 # Medication Chart\n usi[:identifier] = \"19009-0\"\n usi[:text] = \"Medication.current\"\n when 3 # Discharge Summary\n usi[:identifier] = \"28574-2\"\n usi[:text] = \"Discharge note\"\n when 4 # Progress Note\n usi[:identifier] = \"11488-4\"\n usi[:text] = \"Consultation Note\"\n when 5 # Allergies\n usi[:identifier] = \"11488-4\" # no good loinc code\n usi[:text] = \"Consultation Note\"\n when 6 # Scrapbook\n usi[:identifier] = \"11488-4\"\n usi[:text] = \"Consultation Note\"\n when 7 # Result\n usi[:identifier] = \"11526-1\"\n usi[:text] = \"Study report\"\n message_type = {:message_code=>'ORU',:trigger_event=>'R01'}\n when 8 # Letter\n usi[:identifier] = \"34140-4\"\n usi[:text] = \"Transfer of care referral note\"\n when 9 # Immunisations\n usi[:identifier] = \"11369-6\"\n usi[:text] = \"History of immunization\"\n else\n usi[:identifier] = \"11488-4\"\n usi[:text] = \"Consultation Note\"\n end\n obr.universal_service_identifier = usi\n msh.message_type = message_type\n hl7 << obr\n obx = HL7::Obx.new\n obx[0] = \"OBX\"\n obx.set_id = 1\n obx.value_type = \"FT\"\n obx.identifier = usi\n obx.value = text\n obx.result_status = \"F\"\n hl7 << obx\n hl7\n end",
"def set_problem\n\t @problem = Problem.find(params[:id])\n\t end",
"def problem_submit(user, problem)\n @user = user\n @problem = problem\n mail to: @user.email, subject: \"Your problem has been created\"\n end",
"def create\n @message = Message.new(message_params)\n @message.message_type = 'Reqular Message `'\n respond_to do |format|\n if @message.save\n format.html { redirect_to @message, notice: 'Message was successfully created.' }\n format.json { render :show, status: :created, location: @message }\n else\n format.html { render :new }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @message = Message.new(params[:message])\n @message.sender = \"cmu3071\" #THIS NEEDS TO BE CHANGED WHEN OAF RECEIVES THEIR OWN SHORTCODE\n @message.time = Time.now\n \n body = @message.body\n phones = Message.split_numbers(@message.recipient)\n\n phones.each do |ph|\n phone = Message.reformat_phone(ph)\n puts \"PHONE: #{phone}\"\n url = Message.text_to(phone,body)\n puts \"URL: #{url}\"\n newUrl = URI.parse(URI.encode(url.strip))\n http = Net::HTTP.new(newUrl.host,443)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n @data = http.get(newUrl.request_uri)\n puts \"STATUS: #{@data.code}\"\n puts \"BODY: #{@data.body}\"\n puts \"RESPONSE: #{@data}\"\n end\n \n respond_to do |format|\n if @message.save\n format.html { redirect_to @message, notice: 'Message was successfully created.' }\n format.json { render json: @message, status: :created, location: @message }\n else\n format.html { render action: \"new\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new_issue(type)\n login\n title = ask(\"Title\")\n description = ask(\"Description\")\n create_ticket(type, title, description, $config[\"user\"], $config[\"project\"], $config[\"component\"])\n end",
"def create\n @experiment = Experiment.find_by_hashed_id(params[:experiment_id])\n page_group(@experiment.user.group)\n \n unless @experiment.open? or @experiment.can_modify?(current_user)\n access_denied\n return\n end\n if @experiment.filled?\n redirect_to :controller=>'experiments', :action=>'filled', :id=>@experiment.hashed_id\n return\n end\n existing_subject = Subject.find_by_email(params[:subject][:email])\n if existing_subject\n @subject = existing_subject\n else\n @subject = Subject.new(params[:subject])\n end\n @slots = Slot.find_by_available(@experiment)\n @slot_id = params[:slot_id]\n @slot = Slot.find_by_hashed_id(@slot_id)\n respond_to do |format|\n begin\n if @subject.valid? and [email protected]? and [email protected]?\n @subject.transaction do\n @appointment = Appointment.new(:slot => @slot, :subject => @subject)\n @appointment.transaction do\n @subject.save!\n @appointment.save!\n #flash[:notice] = 'Subject was successfully created.'\n format.html { redirect_to(:action => :confirmation, :id=>@subject.hashed_id, :slot_id => @slot.hashed_id) }\n end\n end\n else\n @subject = Subject.new(params[:subject]) #hack to hide existing subject's info\n if @slot == nil\n @subject.errors.add(:time_slot, \"Please select a time slot to participate in the experiment\")\n elsif @slot.filled?\n @subject.errors.add(:time_slot, \"The time you selected is now full, please select another\")\n end\n format.html { render :action => \"new\" }\n end\n rescue ActiveRecord::RecordInvalid\n if !@appointment != nil and [email protected]?\n @subject.errors.add(:appointment, \" could not be scheduled, did you already sign up for this?\")\n end\n format.html { render :action => \"new\" }\n end\n end\n end",
"def create!(method_name, *parameters) #:nodoc:\n initialize_defaults(method_name)\n send(method_name, *parameters)\n \n # Build the SMS object itself.\n @sms = create_sms\n end",
"def create\n @message = Message.new(message_params)\n\n respond_to do |format|\n if @message.save\n whatsapp = WhatsApp.new\n whatsapp.line = @message.sender\n whatsapp.url = @message.url\n whatsapp.appname = @message.appname\n whatsapp.token = @message.token\n whatsapp.messageSend(@message.id, @message.recipient, @message.text)\n #whatsapp.questionSend(@message.id, @message.recipient, @message.text, \"['Sim';'Não']\")\n\n format.html { redirect_to @message, notice: 'Message was successfully created.' }\n format.json { render :show, status: :created, location: @message }\n else\n format.html { render :new }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @question = Question.new(question_params)\n @question.sender = current_user\n if @question.save\n redirect_to overview_exam_path(@question.exam), notice: _('Question was successfully sent.')\n else\n @exam = question.exam\n render :new\n end\n end",
"def create\n @solution = @idea.solutions.new(feature: params[:toSent]) #@idea.solutions.new(params[:solution])\n\n if @solution.save\n render json: { text: \"success\", id: \"#{@solution.id}\" }\n else\n render json: { text: \"fail\"}\n end\n end",
"def get_message # 優惠訊息\n\t\tif self.range == 'all'\n msg1 = '全館'\n elsif self.range == 'price'\n msg1 = '全館滿' + self.range_price.to_s + '元'\n elsif self.range == 'product'\n if self.range_quantity == 1\n msg1 = '本商品每件'\n else\n msg1 = '本商品' + self.range_quantity.to_s + '件'\n end\n end\n\n if self.offer == 'freight'\n if self.offer_freight == 'all'\n msg2 = '免運費'\n elsif self.offer_freight == 'CVS'\n msg2 = '超商取貨免運費'\n elsif self.offer_freight == 'Home'\n msg2 = '宅配免運費'\n end\n elsif self.offer == 'price'\n msg2 = '折' + self.offer_price.to_s + '元'\n elsif self.offer == 'discount'\n msg2 = '打' + self.offer_discount.to_s + '折'\n end\n\n msg1 + msg2\n\tend",
"def create\n @message = Xmt::Faq::Consultation.new(params.require(:xmt_faq_consultation).permit!)\n respond_to do |format|\n if @message.save\n format.html { redirect_to check_consultations_url(id:\"5a6146baf6e9fa1940998bf3\"), notice: '提交成功' }\n format.json { render :show, status: :created, location: @message }\n else\n format.html { render :new }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create \n params[:subject][:title].strip! if !params[:subject][:title].nil?\n params[:subject][:content].strip! if !params[:subject][:content].nil?\n @subject = Subject.new(params.require(:subject).permit(:title, :content, :for_correctors, :important, :for_wepion))\n @subject.user = current_user.sk\n @subject.last_comment_time = DateTime.now\n @subject.last_comment_user = current_user.sk\n \n @subject.for_wepion = false if @subject.for_correctors # We don't allow Wépion if for correctors\n\n if @subject.title.size > 0\n @subject.title = @subject.title.slice(0,1).capitalize + @subject.title.slice(1..-1)\n end\n\n # Set associated object (category, section, chapter, exercise, problem)\n err = set_associated_object\n error_create([err]) and return if !err.empty?\n\n # Attached files\n @error_message = \"\"\n attach = create_files\n error_create([@error_message]) and return if !@error_message.empty?\n\n if @subject.save\n attach_files(attach, @subject)\n\n if current_user.sk.root?\n for g in [\"A\", \"B\"] do\n if params.has_key?(\"groupe\" + g)\n User.where(:group => g).each do |u|\n UserMailer.new_message_group(u.id, @subject.id, current_user.sk.id).deliver\n end\n end\n end\n end\n\n flash[:success] = \"Votre sujet a bien été posté.\"\n redirect_to subject_path(@subject, :q => @q)\n else\n destroy_files(attach)\n error_create(@subject.errors.full_messages) and return\n end\n end",
"def create\n @youth_problem = YouthProblem.new(params[:youth_problem])\n\n respond_to do |format|\n if @youth_problem.save\n format.html { redirect_to(@youth_problem, :notice => 'Youth problem was successfully created.') }\n format.xml { render :xml => @youth_problem, :status => :created, :location => @youth_problem }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @youth_problem.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @problem = Problem.new\n add_breadcrumb \"New Problem\"\n respond_with @problem\n end",
"def create\n @smsno = Smsno.new(smsno_params)\n\n respond_to do |format|\n if @smsno.save\n format.html { redirect_to @smsno, notice: 'Smsno was successfully created.' }\n format.json { render :show, status: :created, location: @smsno }\n else\n format.html { render :new }\n format.json { render json: @smsno.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @question = current_user.questions.new(question_params)\n [email protected]\n [email protected]\n [email protected]\n [email protected]\n testing = %x[ dig #{namedns} #{type} | grep \"SERVER:\" ]\n c,d=testing.split(\": \")\n e,f=d.split(\"#\")\n if e != \"127.0.0.1\"\n \n if server==\"\"\n value2 = %x[ dig #{namedns} #{type} | grep \"SERVER:\" ]\n c,d=value2.split(\": \") \n e,f=d.split(\"#\")\n query1=%x[dig #{namedns} #{type} | grep \"QUERY:\"]\n q1,q2,q3,q4=query1.split(\",\")\n q5,q6,q66=q1.split(\": \")\n q7,q8=q2.split(\": \")\n q9,q10=q3.split(\": \")\n q11,q12=q4.split(\": \")\n query2=query1=%x[dig #{namedns} #{type} | grep \"version:\"]\n q21,q22=query2.split(\",\")\n q23,q24,q25=q21.split(\": \")\n q26,q27,q28=q22.split(\": \")\n else\n value2 = %x[ dig @#{server} #{namedns} #{type} | grep \"SERVER:\" ]\n c,d=value2.split(\": \")\n e,f=d.split(\"#\")\n query1=%x[dig @#{server} #{namedns} #{type} | grep \"QUERY:\"]\n q1,q2,q3,q4=query1.split(\",\")\n q5,q6,q66=q1.split(\": \")\n q7,q8=q2.split(\": \")\n q9,q10=q3.split(\": \")\n q11,q12=q4.split(\": \")\n query2=query1=%x[dig @#{server} #{namedns} #{type} | grep \"version:\"]\n q21,q22=query2.split(\",\")\n q23,q24,q25=q21.split(\": \")\n q26,q27,q28=q22.split(\": \")\n end\n end\n server=e\n \n if server.blank?\n @question=current_user.questions.create(dnsname: namedns, recordtype: type, server: server, timeperiod: time, query: q66, answer: q8, authority: q10, additional: q12, version: q25, udp: q27)\n else\n @question=current_user.questions.create(dnsname: namedns, recordtype: type, server: server, timeperiod: time, query: q66, answer: q8, authority: q10, additional: q12, version: q25, udp: q27)\n end\n \n \n @average=Performance.where(question_id: @question.id).average(:responsetime)\n @highest=Performance.where(question_id: @question.id).maximum(:responsetime)\n @lowest=Performance.where(question_id: @question.id).minimum(:responsetime)\n @count=Performance.where(question_id: @question.id).count(:responsetime)\n @unavailable=Performance.where(responsetime: -1 )\n @[email protected](question_id: @question.id).count(:responsetime)\n @availability=0\n \n Search.create(server: @question.dnsname)\n \n \n total=%x[ dig @#{server} #{namedns} #{type} | wc -l ]\n total1,total2=total.split(\"\\n\") \n \n a = 1\n while a != total1.to_i\n \n value2 =%x[ dig @#{server} #{namedns} #{type} | sed -n '#{a}p' ]\n\n\n if value2==\";; ANSWER SECTION:\\n\"\n a=a+1\n value2 =%x[ dig @#{server} #{namedns} #{type} | sed -n '#{a}p' ]\n while value2 !=\"\\n\"\n# \n \n b,c,d,e,f,g=value2.split(\" \")\n dnsanswer=b \n ttl=c \n typeAnswer=e \n o=e \n if g != nil \n ip=f+\" \"+g\n else \n ip=f \n end \n answerType=\"answer\" \n #answerList=Answer.question.where(:typeAnswer \"answer\")\n #answerList.each do |f|\n #if f.ipadress != ip\n #Change.create() \n Answer.create(dnsname: dnsanswer,ttl: c,recordtype: e,ipaddress: ip,question_id: @question.id, typeAnswer: answerType)\n a=a+1 \n value2 =%x[ dig @#{server} #{namedns} #{type} | sed -n '#{a}p' ] \n end\n end\n\n if value2==\";; AUTHORITY SECTION:\\n\"\n \n a = a+1\n value2 =%x[ dig @#{server} #{namedns} #{type} | sed -n '#{a}p' ]\n while value2 != \"\\n\"\n\n \n b,c,d,e,f,g=value2.split(\" \")\n dnsanswer=b\n ttl=c\n typeAnswer=e\n o=e\n if g != nil\n ip=f+\" \"+g\n else\n ip=f\n end\n answerType=\"authority\"\n Answer.create(dnsname: dnsanswer,ttl: c,recordtype: typeAnswer,ipaddress: ip,question_id: @question.id, typeAnswer: answerType)\n a = a+1 \n value2 =%x[ dig @#{server} #{namedns} #{type} | sed -n '#{a}p' ] \n end\n end\n \n if value2==\";; ADDITIONAL SECTION:\\n\"\n a=a+1\n value2 =%x[ dig @#{server} #{namedns} #{type} | sed -n '#{a}p' ]\n while value2 !=\"\\n\" \n b,c,d,e,f,g=value2.split(\" \")\n dnsanswer=b\n ttl=c\n typeAnswer=e\n o=e\n if g != nil\n ip=f+\" \"+g\n else\n ip=f\n end\n answerType=\"additional\"\n Answer.create(dnsname: dnsanswer,ttl: c,recordtype: typeAnswer,ipaddress: ip,question_id: @question.id, typeAnswer: answerType)\n a=a+1 \n value2 =%x[ dig @#{server} #{namedns} #{type} | sed -n '#{a}p' ] \n end\n end\n\n \n \n \n a =a+1\n end\n\n\n\n\n\n \n\n\n\n \n\n\n respond_to do |format|\n if @question.save\n @question.create_detail(:average => @average ,:maximum => @highest,:minimum => @lowest,:total_query => @count,:total_fail => @a ,:status =>@availability )\n\n \n \n format.html { redirect_to @question, notice: 'DNS was successfully Add.' }\n format.json { render :show, status: :created, location: @question }\n else\n format.html { render :new }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def problems\n\t\t\treturn nil\n\t\tend",
"def receive_sms\n uninitialize_sms\n body = params[:Body]\n phone_number = normalize_phone params[:From].strip\n @problem_text = body.split\n action = sms_parsing(body).downcase\n if action == \"join\"\n sms_create_account\n return\n elsif Account.find_by_phone_number(phone_number) == nil\n sms_send(params[:From], \"Please first create an account by texting the word 'join'.\")\n return\n end\n if !@sms_error\n case action\n when /^add$/,/^insert$/\n sms_create\n when /^accept$/\n sms_accept_problem\n when /^get$/\n @offset = false\n sms_get(0)\n when /^edit$/\n sms_edit\n when /^delete$/, /^destroy$/\n sms_delete\n when /^next$/\n offset = session[\"offset\"]\n if offset == nil\n sms_error(\"Sorry, there is no saved session right now. Please first text \\\"GET\\\" with @location !skill %number of texts you want to allow.\")\n else\n @offset = true\n sms_get(offset)\n end\n when /^detail$/, /^details$/, /^describe$/\n sms_detail\n when /^account$/\n forgot_acc\n when /^change$/\n sms_change_password\n when /^password$/\n forgot_password\n# when /^skill$/, /^skills$/\n# sms_skill\n when /^keywords$/, /^key$/, /^keys$/, /^help$/\n sms_keywords\n when /^explain$/\n sms_explain\n else\n if is_num?(action)\n session[:received_confirmation] = action\n sms_confirm_acc\n else\n sms_wrong_keyword\n end\n end\n end\n render :nothing => true\n end",
"def notify_tech\n if self.status_id_changed?\n account_sid = ENV[\"TWILIO_ACCOUNT_SID\"]\n auth_token = ENV[\"TWILIO_AUTH_TOKEN\"]\n @client = Twilio::REST::Client.new(account_sid, auth_token)\n rocketElevAlert = ENV[\"TWILIO_FROM\"]\n tech_phone_number = ENV[\"TWILIO_TO\"]\n sms_body = \"The Elevator #{self.id} with Serial Number #{self.serialNumber} needs an intervention\"\n if self.status_id == Status.find_by(name: \"intervention\").id\n @client.messages.create(\n from: ENV[\"TWILIO_FROM\"],\n to: tech_phone_number, #self.column.battery.building.techPhone,\n body: sms_body)\n end\n end\n end",
"def send_sms(to_phone_number, message)\n # message = {to:, from:, body: \"Hello\\n\\nWorld\"}\n # binding.pry\n @@client.messages.create(\n from: @@from,\n to: to_phone_number,\n body: message\n )\n end",
"def miss_reason; end",
"def twilio_sms\n sms = {\n :sid => params[:SmsSid], \n :from => params[:From],\n :to => params[:To],\n :body => params[:Body],\n #:status => params[:SmsStatus], # this will be used later for confirmation with Twilio \n }\n @txt = Txt.new(sms) \n \n @status_report = TWILIO_CONFIG[\"base_url\"].to_s + '/home/twilio_status'\n\n #@txt.twilio_reply_sms\n\n respond_to do |format|\n if @txt.save and @txt.match_coupon?(sms)\n flash[:notice] = 'Message was successfully received.' \n format.xml { @txt }\n else\n flash[:notice] = 'Delivery failed.' \n format.xml { @txt }\n end\n end\n\n end",
"def _create_new_question(short_name, text, question_type, domain, current_user_id, choices)\n\t\t@new_question = Question.new(:short_name => short_name, :text => text, :question_type => question_type, :created_by => current_user.id, :updated_by => current_user.id, :domain => domain)\n\t \tif @new_question.save\n\t \t\t@error_message = '[INFO] Question saved to database!'\n \t\telse\n \t\t\t@error_message = 'ERROR: could not save new question'\n \t\tend\n \t\t\n \t\tif question_type != 'TEXT' # if this was a choice question, store the choices\n \t\t\t_update_current_choices_and_inclusions(@new_question.id,choices)\n\t\tend\n\tend",
"def create_msg(txt)\n if :locale == 'de'\n self.action = \"Nachricht: '#{txt}'\"\n else\n self.action = \"Message: '#{txt}'\"\n end\n end",
"def begin_problem(problem)\n @action = Action.find_by_class_assignment_id_and_user_id(\n @session[:assignment_id], @current_user.id)\n @action_problem = @action.action_problems.find_by_end_time(nil)\n\n fields = {\n :problem_id => problem.id,\n :start_time => Time.now\n #:is_first_user_visit => !action.action_problems.any?{|ap| ap.problem_id == problem.id && ap.end_time != nil},\n #:first_assignment_answer_id => nil, \n #:hint_percentage => 0, \n #:incorrect_answers => 0\n }\n \n if @action_problem.nil?\n @action_problem = @action.action_problems.create fields\n else\n @action_problem.update_attributes fields\n end\n\n # Question level table\n log = QuestionLevelLog.find_by_class_assignment_id_and_user_id_and_problem_id(\n @session[:assignment_id], @current_user.id, problem.id)\n if log.nil?\n log = QuestionLevelLog.new(\n :class_assignment_id => @session[:assignment_id],\n :user_id => @current_user.id,\n :problem_id => problem.id,\n :original => problem.main? ? 1:0,\n :correct => nil,\n :answer_id => nil,\n :answer => nil,\n :input_text => nil,\n :first_action => nil,\n :hint_count => 0,\n :attempt_count => 0,\n :start_time => @action_problem.start_time,\n :end_time => nil,\n :first_response_time => nil,\n :bottom_hint => nil\n )\n log.save\n end\n end",
"def create\n @sms = Sms.new(params[:sms])\n\n respond_to do |format|\n if @sms.save\n flash[:notice] = 'Sms was successfully created.'\n format.html { redirect_to(@sms) }\n format.xml { render :xml => @sms, :status => :created, :location => @sms }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @sms.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create_reason_codes_and_descriptions(code, desc)\n if @reason_code.blank?\n @reason_code = ReasonCode.new(:reason_code => code, :reason_code_description => desc, :reason_code_set_name_id => @payer.reason_code_set_name_id, :status => \"NEW\")\n @reason_code.save(:validate => false)\n end\n reason_code_id = @reason_code.id\n @reason_code_job = ReasonCodesJob.find(:first,:conditions => \"reason_code_id = #{reason_code_id} and parent_job_id = #{@job.id}\")\n if @reason_code_job.blank?\n @reason_code_job = ReasonCodesJob.new()\n @reason_code_job.reason_code_id = reason_code_id\n @reason_code_job.parent_job_id = @job.id\n @reason_code_job.save\n end\n end"
] | [
"0.66650575",
"0.5834069",
"0.57461464",
"0.5659182",
"0.5653695",
"0.5648836",
"0.5641613",
"0.56207407",
"0.56165147",
"0.5604864",
"0.5597876",
"0.55977505",
"0.5585042",
"0.55706966",
"0.5570108",
"0.5561837",
"0.5555722",
"0.55392915",
"0.5494721",
"0.5494721",
"0.5489763",
"0.5481475",
"0.54789186",
"0.547795",
"0.5475317",
"0.5475293",
"0.5464866",
"0.545894",
"0.545436",
"0.54406554",
"0.5429812",
"0.54200566",
"0.5399574",
"0.53966683",
"0.538349",
"0.5375356",
"0.53631616",
"0.5359273",
"0.53550375",
"0.5351807",
"0.53495926",
"0.5344774",
"0.5341697",
"0.53400475",
"0.53370607",
"0.5336472",
"0.533486",
"0.53248215",
"0.5318976",
"0.53098917",
"0.5296443",
"0.5285104",
"0.527712",
"0.52690077",
"0.52673966",
"0.5264021",
"0.52623653",
"0.5260285",
"0.52441454",
"0.5242807",
"0.5241356",
"0.52309793",
"0.5230713",
"0.52304566",
"0.5230224",
"0.5222331",
"0.5222331",
"0.5222331",
"0.5222331",
"0.52172285",
"0.5217043",
"0.5209727",
"0.52094907",
"0.5204331",
"0.51951665",
"0.51950324",
"0.5193074",
"0.51916784",
"0.51862234",
"0.5184272",
"0.51837456",
"0.51817846",
"0.517766",
"0.5177076",
"0.5170982",
"0.51702774",
"0.516915",
"0.51691014",
"0.5167462",
"0.5165016",
"0.51638603",
"0.51638556",
"0.5162297",
"0.5161404",
"0.5159792",
"0.5155193",
"0.5153154",
"0.5146114",
"0.51455873",
"0.51410145"
] | 0.7857824 | 0 |
Expecting the input to look like: "accept [problem id] [password]" | def sms_accept_problem
problem_id = @problem_text[1]
password = @problem_text[2]
provider = Account.find_by_phone_number(normalize_phone(params[:From]))
problem = Problem.find_by_id(problem_id)
if problem.nil?
sms_error("Sorry, there is no problem that matches ID #{problem_id}. Please accept problems in the following format: 'Accept [problem ID]'")
elsif problem.archived
sms_error("Sorry, problem ID #{problem_id} has already been accepted by another provider. Please choose another problem.")
# elsif !provider.verified_skills.include? problem.skills
# sms_error("Sorry, you do not have the skills that this problem requires.")
else
provider.problems << problem
if provider.save
problem.archived = true
problem.save
requester = problem.account
sms_send("You have accepted problem ##{problem_id}. Please contact your requester at #{requester.phone_number} as soon as possible.")
#send a notification to the requester saying that a provider will be contacting shortly
requester_msg = "Your #{problem.summary} problem has been accepted. You can contact your provider at #{provider.phone_number}."
sms_send(requester.phone_number, requester_msg)
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate\n 2.times { puts }\n puts <<-EOF\nYou have entered the following information\nApocalypse server : #{@address}\nApocalypse server port : #{@port}\nApocalypse username : #{@username}\nApocalypse password : #{'*' *@password.length}\nThis Server' hostname : #{@hostname}\nEOF\n\n print \"Is this correct? [no]: \"\n raise Exception.new(\"Aborted by user.\") unless gets =~ /^y(?:es|)$/\n puts\n end",
"def ask(message, valid_options)\n if valid_options\n answer = get_stdin(\"#{message} #{valid_options.to_s.gsub(/\"/, '').gsub(/, /,'/')} \") while !valid_options.include?(answer)\n else\n answer = get_stdin(message)\n end\n answer\nend",
"def input(prompt = '', *expected)\n prompt << \" [#{expected.join '/'}]\" unless expected.empty?\n ostream << \"#{prompt}: \" unless prompt.to_s.empty?\n input = @settings[:istream].gets[0..-2]\n unless expected.empty? || expected.include?(input)\n input = input 'Please provide valid input', *expected\n end\n input\n end",
"def parse_input(input_string)\n # \"16-20 j: vjkjjcjjrjjmtnbjjjnj\"\n unparsed_rule, password = input_string.split(': ')\n min_max, letter = unparsed_rule.split(' ')\n min, max = min_max.split('-').map(&:to_i)\n\n rule = Rule.new(letter, min, max)\n\n [password, rule]\nend",
"def prompt(message, valid_options)\n if valid_options\n answer = get_stdin(\"#{message} #{valid_options.to_s.gsub(/\"/, '').gsub(/, /,'/')} \") while !valid_options.include?(answer)\n else\n answer = get_stdin(message)\n end\n answer\nend",
"def input_string; end",
"def get_input\n begin\n inp = gets.chomp\n raise Error unless %w{s h d}.include?(inp)\n rescue\n retry\n end\n inp\n end",
"def sanitize_input(input)\n\t\tclean_input = input.to_s.scan(/(\"[^\"]+?\"|\\S+)/).flatten.join \" \"\n\n case clean_input[-1]\n when '+'\n [ clean_input[0...-1], :verbose ]\n when '!'\n [ clean_input[0...-1], :full ]\n else\n [ clean_input, :basic ]\n end\n end",
"def prepare_input(prompt); end",
"def get_input_until_valid\n buffer = \"\" # Buffer for input lines.\n indent = \"\" # The indent level.\n loop do\n line = gets\n buffer << line\n break if is_valid_syntax?(buffer)\n \n print Kal::Alex::CONFIG::INPUT_PROMPT\n if increases_indent_level?(line)\n indent.concat(\" \" * INDENT_SPACES)\n print indent\n elsif decreases_indent_level?(line)\n indent[-INDENT_SPACES..-1] = \"\"\n print indent\n else\n print indent\n end\n end\n buffer.chomp\n end",
"def authentication_prompt( )\n puts \"Username:\"\n username = $stdin.gets.chomp\n puts \"Password:\"\n password = $stdin.gets.chomp\n raise NotAuthorized unless username.match(/\\S/)\n raise NotAuthorized unless password.match(/\\S/)\n return {:u => username, :p => password}\n end",
"def accept_input(length)\n print \"Enter your 4 sequence color code. Select from R (Red), G (Green), B (Blue), Y (Yellow), O (Orange), P (Purple). \\n\\nYour input should be in the form: RGBY: \"\n input = gets.chomp\n input_check = input.gsub(/[RGBYOP]/, \"\")\n puts \"\\n\"\n\n # Account for Incorrect Inputs ### IMPORTANT ###\n if input.length != length || input_check.length != 0\n puts \"===============================================================================\\n\\n\"\n puts \"ERROR:\\nPlease follow the instructions and enter a 4 sequence color code!\\n\\n\"\n puts \"===============================================================================\\n\\n\"\n input = \"\"\n answer = accept_input(length)\n else\n answer = input.split(\"\") # Storing the input as an array\n end\n return answer\nend",
"def ask\n gets.strip\n end",
"def question_prompt(field, opts = {})\n trap(\"INT\") { exit 1 }\n begin\n print \"Please input #{field}: \"\n response = opts[:password] ? STDIN.noecho(&:gets).strip : STDIN.gets.strip\n end until not response.empty?\n response\nend",
"def parseLine(line)\n\tif line.include? \"Failed password\" and !line.include? \"invalid user\"\n\t\tlineArray = line.split(pattern=\" \")\n\t\t$attempts.push(Attempt.new(lineArray[0], lineArray[1], lineArray[2], lineArray[10]))\t\n\t#noticed someone was brute forcing my ssh while I left it on overnight, noticed having\n\t#an invalid user changed the wording in /var/log/secure and had to change to this logic\n\telsif line.include? \"Failed password\" and line.include? \"invalid user\"\n\t\tlineArray = line.split(pattern=\" \")\n\t\t$attempts.push(Attempt.new(lineArray[0], lineArray[1], lineArray[2], lineArray[12]))\n\tend\nend",
"def validate_answer(answer)\n (answer.match(/a|b/) && answer.length == 1) || answer.match(/--quit|-q/)\n end",
"def prompt_name\n puts \"Please input a name:\"\n # split name on spaces\n name_parts = gets.chomp.split\n\n if name_parts.count != 2\n raise \"Uh-oh, finnicky parsing!\"\n end\n\n name_parts\nend",
"def read_parameters\n params = read_stdin\n return_error(\"Parameter 'target' contains illegal characters\") unless safe_string?(params['target'])\n params\nend",
"def read_input(message, default = '')\n message.split(\"\\n\").each { |e| print \"#{e} \" }\n response = STDIN.gets.chomp\n response.blank? ? default : response\nend",
"def get_response_for question\nprint question + \": \"\ngets.chomp\nend",
"def ask(question, a, b)\n print \"#{question} (#{a}/#{b})> \"\n r = $stdin.gets.strip\n\n 4.times do\n unless r == a or r == b\n print \"\\nPlease type '#{a}' or '#{b}': \"\n r = $stdin.gets.strip\n end\n end\n\n unless r == a or r == b\n abort EXIT_MSG\n end\n\n r\nend",
"def test_name_generator_with_invalid_input\nresult = name_generator(\"89&6\\n 5.,?<\")\nassert_equal(\"Inavalid ID. Please enter new ID with only lower case letters.\", result)\nend",
"def validation\n\n\t\tputs \"Enter user name\"\n\t\tuser_name = gets.chomp\n\n\t\tputs \"Enter password\"\n\t\tanswer_password = gets.chomp\n\t\tif answer_password == @password\n\t\t\tget_text\n\t\telse\n\t\t\tcounter = 0\n\t\t\twhile counter !=3 || answer_password!=@password do\n\t\t\t puts \"invalid password\"\n\t\t\t $stdin.gets.chomp\n\t\t\t counter += 1\n\t\t\tend\n\t\tend\n\tend",
"def insert_next\n @text.scan(@regex) {|match|\n question = match.join(\" \");\n # check the mapping:\n if(@map.has_key?(question))\n insert_answer(@map[question])\n else\n if(question.include?(\":\"))\n question = question.split(\":\")[1]\n end\n # request an input and specify which method to use for processing the input\n return [\"Please enter #{question}.\", :insert_answer]\n end\n }\n # using the # will cause the bot to start a new line, the nil says we're done\n return [@text, nil]\nend",
"def pick_matcher_from_prompt\n pick_matcher do |headers|\n puts \"Which header do you want to match#{\" for #{name}\" if name}?\"\n headers.each_with_index { |h, i| puts \"#{i}) #{h}\" }\n\n print('Your choice?: '); Integer(STDIN.gets.chomp)\n end\n end",
"def initialize(input)\n @input = input\n fail 'Bad input. All characters must be ( or ).' unless valid_input?\n end",
"def prompt\n gets.strip\nend",
"def validate_selection(input)\n print \"#{input} is not a valid choice, re-enter the number or ID > \"\n return gets.strip\nend",
"def password_request\n password_input = @prompt.mask(\"Please enter your password, or type quit.\")\n if password_input == @user.password\n puts \"Successful login!\"\n @user\n user_menu_runner\n #user can quit this process\n elsif password_input == \"quit\" || password_input == \"exit\"\n exit\n else\n #try again\n puts \"Sorry, incorrect password. Try again.\" # add esscape option\n password_request\n end\n end",
"def parse_input attack_details\n attack_details_arr = attack_details.split(\":\")\n attack_details_arr.each do |attack_detail|\n tribal, direction, tribal_strength = attack_detail.split(\" - \")\n attacked?(tribal_strength.to_i, direction) ? @@attack_count += 1 : 0\n end\n rebuild_wall(attack_details_arr)\n print_outcome\n end",
"def display_login_options\n puts \"-\"*60\n puts \"Para reservar tu vuelo necesitas\"\n puts \"1) Registrarte \"\n puts \"2) Login\"\n puts \"Elige una opción:\" \n input = gets.chomp\n puts \"-\"*60\n input\n end",
"def validate_secret(opt) # parse the title for the secret\n unless @secret.nil?\n (key, @secret) = @secret.split(/:\\s?/)\n @secret.strip!\n end\n if (@secret.nil? || @secret != opt)\n puts \"#{@subject}: Secret incorrect, skipping\"\n raise StandardError, \"Secret incorrect or missing\"\n end\n end",
"def password_rule_test_sets\n {\n 'not set': 'pass',\n 'parameter with NoEcho': 'pass',\n 'parameter with NoEcho and Default value': 'fail',\n 'parameter as a literal in plaintext': 'fail',\n 'as a literal in plaintext': 'fail',\n 'from Secrets Manager': 'pass',\n 'from Secure Systems Manager': 'pass',\n 'from Systems Manager': 'fail'\n }\nend",
"def challenge; end",
"def ask(string)\r\n log '', string\r\n STDIN.gets.strip\r\n end",
"def read_input_line line_in, line_number\n\t\tinput_params = line_in.split(\" \")\n\t\tunless input_params.empty? \n\t\t\tbegin\t \n\t\t\t\tcase input_params[0]\n\t\t\t\twhen \"Driver\"\n\t\t\t\t\tself.handle_driver_command input_params\t\t\n\t\t\t\twhen \"Trip\"\n\t\t\t\t\tself.handle_trip_command input_params\t\t\n\t\t\t\telse\n\t\t\t\t\tputs \"#{input_params[0]} id not a supported command\"\n\t\t\t\tend\n\t\t\trescue => err\n\t\t\t puts \"line #{line_number} not parsed, Incorrect input format #{line_in} - #{err}\"\n\t\t\t err\n\t\t\tend\t\t\t\n\t\tend\n\tend",
"def request_placeholder\n \"JIRA Number: HIANDEV-XXXX\nSolution: HealtheAnalytics\nTest Date: 10-May-2017\nEnvironment: Staging\nOperating System: OS-X\nAssociate ID: AA00000\nPrerequisite Evidence: N/A\"\n end",
"def sanitize_choice(choice)\nif choice.include? ' '\nputs 'Please choose from the three option above....sans typos'\nexit\nelse\nuser_mashable = Mashable.new(choice)\nuser_mashable.get\nputs user_mashable.parsed_response\nend\nend",
"def get_input(*msg)\n print *msg\n return gets.strip\n end",
"def read_thing(thing)\n print input_prompt(thing[:text], thing[:default])\n validate_input(read_input, thing[:default], thing[:test])\n end",
"def test_prompt\n actual_input = prompt (\"please input the number 4 for testing \\n\")\n expected_input = \"4\"\n assert_equal expected_input, actual_input\n end",
"def test_seqence_valid19\n result = engine(\"TrumppasswORd12%\")\n refute(result, \"'Trump1%' should not be valid because it contains password.\")\n end",
"def process_input(line)\n case line\n when /^:((.+?)(?:!.+?)?) INVITE \\S+ :(\\S+)/i\n handle :incoming_invite, $1, $2, $3\n when /^:((.+?)(?:!.+?)?) PRIVMSG (\\S+) :?\\001ACTION (.+?)\\001$/i\n handle :incoming_act, $1, $2, $3, $4\n when /^:((.+?)(?:!.+?)?) PRIVMSG (\\S+?) :?\\001(.+?)\\001$/i\n handle :incoming_ctcp, $1, $2, $3, $4\n when /^:((.+?)(?:!.+?)?) PRIVMSG (\\S+?) :?(.+?)$/i\n handle :incoming_msg, $1, $2, $3, $4\n when /^:((.+?)(?:!.+?)?) NOTICE (\\S+?) :?\\001(.+?)\\001$/i\n handle :incoming_ctcpreply, $1, $2, $3, $4\n when /^:((.+?)(?:!.+?)?) NOTICE (\\S+?) :?(.+?)$/i\n handle :incoming_notice, $1, $2, $3, $4\n when /^:((.+?)(?:!.+?)?) MODE (\\S+?) :?(\\S+?)(?: (.+?))?$/i\n handle :incoming_mode, $1, $2, $3, $4, $5\n when /^:((.+?)(?:!.+?)?) JOIN :?(\\S+?)$/i\n handle :incoming_join, $1, $2, $3\n when /^:((.+?)(?:!.+?)?) PART (\\S+?)(?: :?(\\S+?)?)?$/i\n handle :incoming_part, $1, $2, $3, $4\n when /^:((.+?)(?:!.+?)?) KICK (\\S+?) (\\S+?) :?(.+?)$/i\n handle :incoming_kick, $1, $2, $3, $4, $5\n when /^:((.+?)(?:!.+?)?) QUIT :?(.+?)$/i\n handle :incoming_quit, $1, $2, $3\n when /^:((.+?)(?:!.+?)?) NICK :?(\\S+?)$/i\n handle :incoming_nick, $1, $2, $3\n when /^PING :?(.+?)$/i\n handle :incoming_ping, $1\n when /^:((.+?)(?:!.+?)?) (\\d{3})\\s+(\\S+?) (.+?)$/i\n handle_numeric($3.to_i, $1, $2, $4, $5)\n else\n handle :incoming_miscellany, line\n end\n end",
"def get_choice_from_bipolar question, allowed_answers = %w[ y n ENTER ] # {{{\n print \"#{question.to_s} [#{allowed_answers.join(\", \")}] : \"\n STDOUT.flush\n answer = STDIN.gets.to_s\n if( answer =~ %r{^\\n$}i )\n answer = \"enter\"\n else\n answer = answer.chomp.downcase\n end\n\n return true if( answer =~ %r{y|enter}i )\n return false if( answer =~ %r{n}i )\n end",
"def prompt(description, default_value, validate_regex)\n while true do\n print(\"#{description} [#{default_value}]: \")\n result = $stdin.gets.to_s.chomp\n if result.empty?\n return default_value\n elsif result.match(validate_regex)\n return result\n else\n puts \"WARNING: Invalid input, please try again\"\n end\n end\nend",
"def get_input(message, choices)\n print(message)\n response = gets.chomp.downcase\n while response.length < 1 || !choices.include?(response[0])\n print(\"Invalid selection. \" + message)\n response = gets.chomp.downcase\n end\n return response[0]\nend",
"def check_black_list(context,input,original = nil)\n original = input.dup if original.nil?\n @black_list.each do |p|\n if p.match(input)\n # format user msg\n user = \"#{context}: Invalid input. Dangerous input matching #{p.to_s}\"\n # format log message\n log = \"Dangerous input: context=#{context}, type=#{@name}, pattern=#{p.to_s}\"\n log << \", input=#{input}, original=#{original}\"\n # raise an error\n raise Owasp::Esapi::ValidationException.new(user,log,context)\n end\n end\n input\n end",
"def ask_for_guess\n @guess_count += 1\n @guess = get_code(\"Please enter your guess in the format 'color color color color'(to list available color options enter 'options'):\")\n end",
"def userlogin_prompt\n header\n puts \"\\n\\nPlease enter your username to login.\\n\"\n self.userlogin_input = STDIN.gets.strip\n self.userlogin_valid?\nend",
"def prompt(message)\n puts\"=> #{message}\"\nend",
"def prompt_with_hints\n self.prompt.gsub(/(\\(.+?\\))/, '<span title=\"Hint\" class=\"hint\">\\1</span>')\n end",
"def get_user_input\n print \">> \"\n input = gets.chomp\n begin\n parse_user_input(input)\n rescue StandardError\n invalid_command\n end\n end",
"def parse_input(input)\n\tinput.split(\" \")\nend",
"def confirm_input(loan_amt, annual_rate, loan_duration_in_years)\n puts prompt(:confirmation).sub('{loan_amt}', add_commas(loan_amt.to_s))\\\n .sub('{annual_rate}', annual_rate.to_s)\\\n .sub('{loan_duration}', loan_duration_in_years.to_s)\n gets.chomp\nend",
"def get_player_secret_code\n puts \"\\n\\nplease enter your four-digit secret code.\"\n puts \"Any combination of digits from 1-6. You can have duplicates\"\n player_secret_code = gets.chomp.split(\"\").map(&:to_i)\n\n if !validity(player_secret_code)\n puts \"please follow the format and try again\"\n get_player_secret_code\n end\n player_secret_code\n end",
"def prepare_input(prompt)\n line = readline(prompt)\n return unless line\n\n last_if_empty(line)\n end",
"def caseoftelephone(gossip)\n print gossip\n secondanswer = gets\nend",
"def test_10_accepts_doesnt_include_password\n result = doesnt_include_password?(\"Hat123!!\")\n assert(result, \"Hat123!! has non alphanumeric, should be valid\")\n end",
"def get_name\n ask(\"give me a name to submit to local arena\") { |q|\n q.validate = /\\w+/\n }\nend",
"def input_acceptable_password\n fill_in(PASSWORD_INPUT_ID, :with => 'qwerty12345')\n end",
"def pass(message=nil) [:pass, message.to_s]; end",
"def get_user_input(message)\n puts message\n gets.chomp\n end",
"def get_valid_creds\n puts \"Enter a username\"\n user = gets.chomp\n puts \"Enter a password\"\n pass = gets.chomp\n\n if same?(user,pass)\n p \"Invalid - User and password are the same length\"\n elsif not_long_enough?(user) || not_long_enough?(pass)\n p \"Invalid - Username or password is not long enough. Both must be at least 6 characters long.\"\n elsif contains_special?(user) || does_not_contain_special?(pass)\n p \"Invalid - Username cannot contain a #,!, or $. Password must contain a #,!, or $.\"\n else\n p \"Valid username and password!\"\n end\nend",
"def collect_and_validate_input(msg, type)\n input = prompt msg\n \n if valid?(input, type)\n return input.upcase\n else\n system(\"clear\")\n puts \"INVALID INPUT: Please try again\"\n input = collect_and_validate_input msg, type\n end\nend",
"def validate_params(wanted, got)\n arg_regex = {\n :integer => /\\A\\d+\\z/, # Integer (not range checked here)\n :character => /\\A[A-Z]\\z/, # Upper case letter\n }\n\n raise ArgumentError, \"Bad arguments for command\" if (wanted.length != got.length)\n\n actual_params = Array.new\n\n wanted.zip(got).each do |a,b|\n raise ArgumentError, \"Bad argument '#{b}'\" unless arg_regex[a] =~ b\n actual_params.push(a == :integer ? b.to_i : b.to_s)\n end\n\n return actual_params\n end",
"def credentials_from_stdin\n # get preset if exists\n @client_id ||= ''\n @client_secret ||= ''\n\n # Ask from user otherwise\n if @client_id == ''\n print 'Please enter your client id: '\n @client_id = $stdin.gets.chomp\n end\n\n if @client_secret == ''\n print 'Please enter your client secret: '\n @client_secret = $stdin.gets.chomp\n end\n end",
"def prompt(str=\"#{@name}> \")\n @client.prompt(str)\n end",
"def user_input_capture\n print \">>: \"\n response = gets.chomp\n response\n end",
"def begin_input\n\t\tinput = nil\n\t\tuntil input != nil\n\t\t\tinput = case gets.chomp.downcase\n\t\t\twhen \"hard\", \"h\" then :hard\n\t\t\twhen \"medium\", \"m\" then :medium\n\t\t\twhen \"mom\" then :mom\n\t\t\telse nil\n\t\t\tend\n\t\t\tputs \"That is not a valid input!\" if not input\n\t\tend\n\t\tinput\n\tend",
"def input_guess\n puts 'Input a code!'\n begin\n input = gets\n parse(input)\n rescue NoMethodError\n input_error\n end\n end",
"def expect_guess\n print \"Guess ##{turn}. What's your code? \"\n input = gets.chomp\n throw :quit if input == \"q\"\n \n if valid_input? input\n self.last_guess = Code.parse(input)\n puts \"Your guess was #{last_guess}.\"\n else\n puts \"Please enter 4 valid colors.\"\n expect_guess\n end\n end",
"def input_stdin!\n\t\tif input = STDIN.gets\n\t\t\tunless input.match(/^PRIVMSG(.*)$/)\n\t\t\t\tsay input\n\t\t\t\tprint(\"--> \")\n\t\t\tend\n\t\tend\n\tend",
"def test_exercise_1111\n verify_method :exercise_1111,\n :with => [{param: [[true]], expect: \" 1\\n1*\\n\"},\n {param: [[false]], expect: \" 1\\n1 \\n\"},\n {param: [[true, false]], expect: \" 12\\n1* \\n\"},\n {param: [[true, false], [true, false]], expect: \" 12\\n1* \\n2* \\n\"}]\n end",
"def test_11_rejects_doesnt_include_password\n result = doesnt_include_password?(\"Hapasswordt@HAT!\")\n refute(result, \"Hat@HAT! has no alphanumeric, should be valid\")\n end",
"def mad_lib\n user_inputs = []\n required_data = %w(noun verb adjective adverb)\n required_data.each do |question|\n puts \"Enter a #{question}:\"\n user_inputs << gets.chomp\n end\n puts \"Do you #{user_inputs[1]} your #{user_inputs[2]} #{user_inputs[0]} #{user_inputs[3]}? That's hilarious!\"\nend",
"def text_input; end",
"def check_white_list(context,input,original = nil)\n original = input.dup if original.nil?\n @white_list.each do |p|\n match = p.match(input)\n if match.nil? or not match[0].eql?(input)\n # format user msg\n user = \"#{context}: Invalid input. Conform to #{p.to_s}\"\n user << \" with a max length of #{@max}\" unless @max == 0\n # format log message\n log = \"Invalid input: context=#{context}, type=#{@name}, pattern=#{p.to_s}\"\n log << \", input=#{input}, original=#{original}\"\n # raise an error\n raise Owasp::Esapi::ValidationException.new(user,log,context)\n end\n end\n input\n end",
"def insert_question\n print \"Question text : \"\n question_str = $stdin.gets.strip\n print \"Answer text : \" \n answer_str = $stdin.gets.strip\n InsertQuestionCommand.new([question_str,answer_str]).execute\n end",
"def format_input\n\t\t# removing white spaces at the beginning and the end\n\t\t@input_params = @input_params.downcase.strip()\n \tend",
"def parse_input(input)\n begin\n\n parsed = input.scan(/\\A([fr])\\((\\d),(\\d)\\)\\z/)\n if parsed.empty? && input.downcase != \"save\"\n raise \"Invalid input\"\n end\n \n rescue\n puts \"Sorry, invalid format. Please try again with format: \\'r(2,3)\\'\"\n retry\n end\n \n parsed.flatten\n \n end",
"def execute(input)\n messages = Messages.new\n secret = \"BBGB\"\n if input == \"i\" || input == \"instructions\"\n Response.new(:message => messages.instructions, :status => :continue)\n elsif input == \"p\" || input == \"play\"\n Response.new(:message => messages.play, :status => :continue)\n # play\n elsif input == \"q\" || input == \"quit\"\n Response.new(:message => messages.quit, :status => :stop)\n elsif input == \"c\" || input == \"cheat\"\n Response.new(:message => \"The secret sequence is: #{secret}\", :status => :continue)\n elsif input.length < 4\n Response.new(:message => \"Are you paying attention?? You need to guess four colors. If you need instructions, enter 'i'.\", :status => :continue)\n elsif input.length > 4\n Response.new(:message => \"You are making this too complicated. Guess four colors only. If you need instructions, enter 'i'.\", :status => :continue)\n elsif input == secret.downcase\n Response.new(:message => \"Congratulations! You guessed the sequence '#{secret}' in #{@number_of_guesses} guess(es) in just #{Time.new}.\\nWould you like to (p)lay again or (q)uit?\", :status => :won)\n else\n @number_of_guesses += 1\n Response.new(:message => \"Guess again!\", :status => :continue)\n end\n end",
"def parse_input(params, resource); end",
"def get_user_input_and_check(acceptable_input)\n input = gets.chomp.downcase\n\n if acceptable_input.include? input\n return input\n\n else\n puts \"This is not an acceptable input ('#{acceptable_input.join(\"', '\")}'), please try again:\"\n get_user_input_and_check(acceptable_input)\n\n end\n\nend",
"def envirosupport\n\t\tputs \"[\".light_green + \"*\".white + \"] Please enter the number for the option you want to try and run\".light_green + \": \".white\n\t\tputs \"0)\".white + \" Return to Previous Menu\".light_green + \"!\".white\n\t\tputs \"1)\".white + \" User-Agent Based Injection\".light_green\n\t\tputs \"2)\".white + \" Accept Header Based Injection\".light_green\n\t\tcase gets.chomp\n\t\t\twhen \"0\"\n\t\t\t\tputs \"[\".light_red + \"X\".white + \"] OK, Returning to Previous Menu\".light_blue + \"....\".white\n\t\t\t\tputs\n\t\t\twhen \"1\"\n\t\t\t\tputs \"[\".light_green + \"*\".white + \"] Testing User-Agent Based Injection\".light_green + \"......\".white\n\t\t\t\t@rnd = randz(5)\n\t\t\t\t@uapayload = \"<?error_reporting(0);echo \\\":\\\".\\\"#{@rnd}:\\\".\\\"working...check,check,1,2,3\\\".\\\":#{@rnd}:\\\";?>\"\n\t\t\t\tbasicregex(@thegoods, 1)\n\n\t\t\t\tif not @envirores == 'fail'\n\t\t\t\t\tputs \"[\".light_green + \"*\".white + \"] Injection Test Successful\".light_green + \"!\".white\n\t\t\t\t\tputs \"[\".light_green + \"*\".white + \"] \".light_green + \"#{@envirores}\".white\n\t\t\t\telse\n\t\t\t\t\tputs \"[\".light_red + \"X\".white + \"] User-Agent Header Based Injection Test Doesn't appear to be working\".light_red + \"!\".white\n\t\t\t\t\tputs \"[\".light_red + \"X\".white + \"] Check manually to confirm 100%, sorry\".light_red + \".....\".white\n\t\t\t\t\tputs\n\t\t\t\t\tenvirosupport\n\t\t\t\tend\n\t\t\t\tputs\n\t\t\twhen \"2\"\n\t\t\t\tputs \"[\".light_green + \"*\".white + \"] Testing Accept Header Based Injection\".light_blue + \"......\".white\n\t\t\t\t@rnd = randz(5)\n\t\t\t\t@accpayload = \"<?error_reporting(0);echo \\\":\\\".\\\"#{@rnd}:\\\".\\\"working...check,check,1,2,3\\\".\\\":#{@rnd}:\\\";?>\"\n\t\t\t\tbody = basicregex(@thegoods, 2)\n\n\t\t\t\tif not @@envirores == 'fail'\n\t\t\t\t\tputs \"[\".light_green + \"*\".white + \"] Injection Test Successful\".light_green + \"!\".white\n\t\t\t\t\tputs \"[\".light_green + \"*\".white + \"] \".light_green + \"#{@envirores}\".white\n\t\t\t\telse\n\t\t\t\t\tputs \"[\".light_red + \"X\".white + \"] User-Agent Header Based Injection Test Doesn't appear to be working\".light_red + \"!\".white\n\t\t\t\t\tputs \"[\".light_red + \"X\".white + \"] Check manually to confirm 100%, sorry\".light_red + \".....\".white\n\t\t\t\t\tputs\n\t\t\t\t\tenvirosupport\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tcls\n\t\t\t\tputs\n\t\t\t\tputs \"Oops, Didn't quite understand that one\".light_red + \"!\".white\n\t\t\t\tputs \"Please Choose a Numbered Option From Below\".light_red + \":\".white\n\t\t\t\tputs\n\t\t\t\tenvirosupport\n\t\t\tend\n\tend",
"def get_freeform(question)\n puts \"#{question} (freeform):\"\n gets.strip()\nend",
"def user_name (name, password)\n if name == password\n 'name and password cannot be the same.'\n elseif name.length < 6 && password.length < 6\n \"names and passwords must be atleast 6 characters long\"\n elseif password.include? ('!''#''$') == false \n 'password must contain at least one of the following \"!, #, $\"'\n elseif name.include? ('!''#''$'' ') == true\n \"ID's connot contain '!, #, $, '\"\n elseif password == 'password'\n 'your password cannot be password'\n end\nend",
"def checker(input, prompt)\n input == 'no answer' ? (return input) : nil\n match = prompt.split.find { |x| x[0] == '[' }.delete('[]')\n input.casecmp(match).zero? ? (return 'true') : (return 'false')\n end",
"def parse_request(data)\n data.strip!\n space = data.index(\" \")\n if space\n cmd = data[0, space]\n param = data[space+1, data.length - space]\n param = nil if param.strip.size == 0\n else\n cmd = data\n param = nil\n end\n\n [cmd.downcase, param]\n end",
"def validate_user_input(input)\r\n if input =~ \"/(script)|(<)|(>)|(%3c)|(%3e)|(SELECT) |(UPDATE) |\"\\\r\n \"(INSERT) |(DELETE)|(GRANT) |(REVOKE)|(UNION)|(&lt;)|\"\\\r\n \"(&gt;)/\"\r\n return nil\r\n end \r\n return input \r\n end",
"def wrong_and_option(wrong, option) #function to take input of wrong word and number of options.\n $wrong_word = wrong\n $no_option = option\n end",
"def validate_answer(answer)\n end",
"def user_imput\n gets.chomp\n end",
"def prompt(msg)\n puts \"[] #{msg}\"\nend",
"def challenge_params\n params.require(:challenge).permit(:title, :text)\n end",
"def format_input(input)\n input\n end",
"def match(argv1)\n return nil unless argv1\n isnot = %r{(?:5[.]1[.]0[ ]Address\n |Recipient[ ]address\n |Sender[ ]IP[ ]address\n )[ ]rejected\n }xi\n regex = %r{(?>\n [<][>][ ]invalid[ ]sender\n |address[ ]rejected\n |Administrative[ ]prohibition\n |batv[ ](?:\n failed[ ]to[ ]verify # SoniWall\n |validation[ ]failure # SoniWall\n )\n |backscatter[ ]protection[ ]detected[ ]an[ ]invalid[ ]or[ ]expired[ ]email[ ]address # MDaemon\n |bogus[ ]mail[ ]from # IMail - block empty sender\n |Connections[ ]not[ ]accepted[ ]from[ ]servers[ ]without[ ]a[ ]valid[ ]sender[ ]domain\n |denied[ ]\\[bouncedeny\\] # McAfee\n |Delivery[ ]not[ ]authorized,[ ]message[ ]refused\n |does[ ]not[ ]exist[ ]E2110\n |domain[ ]of[ ]sender[ ]address[ ].+[ ]does[ ]not[ ]exist\n |Emetteur[ ]invalide.+[A-Z]{3}.+(?:403|405|415)\n |empty[ ]envelope[ ]senders[ ]not[ ]allowed\n |error:[ ]no[ ]third-party[ ]dsns # SpamWall - block empty sender\n |From:[ ]Domain[ ]is[ ]invalid[.][ ]Please[ ]provide[ ]a[ ]valid[ ]From:\n |fully[ ]qualified[ ]email[ ]address[ ]required # McAfee\n |invalid[ ]domain,[ ]see[ ][<]url:.+[>]\n |Mail[ ]from[ ]not[ ]owned[ ]by[ ]user.+[A-Z]{3}.+421\n |Message[ ]rejected:[ ]Email[ ]address[ ]is[ ]not[ ]verified\n |mx[ ]records[ ]for[ ].+[ ]violate[ ]section[ ].+\n |Null[ ]Sender[ ]is[ ]not[ ]allowed\n |recipient[ ]not[ ]accepted[.][ ][(]batv:[ ]no[ ]tag\n |returned[ ]mail[ ]not[ ]accepted[ ]here\n |rfc[ ]1035[ ]violation:[ ]recursive[ ]cname[ ]records[ ]for\n |rule[ ]imposed[ ]mailbox[ ]access[ ]for # MailMarshal\n |sender[ ](?:\n email[ ]address[ ]rejected\n |is[ ]Spammer\n |not[ ]pre[-]approved\n |rejected\n |domain[ ]is[ ]empty\n |verify[ ]failed # Exim callout\n )\n |syntax[ ]error:[ ]empty[ ]email[ ]address\n |the[ ]message[ ]has[ ]been[ ]rejected[ ]by[ ]batv[ ]defense\n |transaction[ ]failed[ ]unsigned[ ]dsn[ ]for\n |Unroutable[ ]sender[ ]address\n |you[ ]are[ ]sending[ ]to[/]from[ ]an[ ]address[ ]that[ ]has[ ]been[ ]blacklisted\n )\n }ix\n\n return false if argv1 =~ isnot\n return true if argv1 =~ regex\n return false\n end",
"def createnewuser_prompt\n header\n puts \"\\n\\nPlease enter a username.\\n\"\n self.createnewuser_input = STDIN.gets.strip\n self.createnewuser_valid?\nend",
"def invalid_response(response)\n puts(\"\\\"#{response}\\\" was not a valid input. Please input a number corresponding to your choice.\")\nend",
"def prompt_params\n params[:prompt]\n end",
"def test_12_accepts_doesnt_include_password\n result = not_including_username?(\"HatBox1992!\", \"gdavida\")\n assert(result, \"HatBox1992! does not include your username, should be valid\")\n end",
"def assert_comment(comment)\n if comment.is_a?(String) && !comment.empty? && !comment.include?(\"\\n\")\n return\n end\n raise Chef::Exceptions::ValidationFailed,\n 'ssh_authorize_key: comment parameter must be valid! You passed '\\\n \"#{comment.inspect}.\"\n end"
] | [
"0.642186",
"0.59057915",
"0.58491653",
"0.58430827",
"0.58391374",
"0.5716963",
"0.57013273",
"0.5699616",
"0.5613457",
"0.5598513",
"0.55845636",
"0.55471337",
"0.5510737",
"0.5498221",
"0.54887646",
"0.5419622",
"0.5404908",
"0.5360304",
"0.5357657",
"0.5351557",
"0.5350632",
"0.5340336",
"0.53154314",
"0.5313662",
"0.5290316",
"0.5286646",
"0.5282493",
"0.5278878",
"0.52743506",
"0.5269566",
"0.525923",
"0.5258953",
"0.52452505",
"0.5236617",
"0.5230217",
"0.5227102",
"0.5226993",
"0.5217857",
"0.5214791",
"0.5209997",
"0.5209409",
"0.5201693",
"0.5200544",
"0.51960194",
"0.51951575",
"0.5186066",
"0.51821876",
"0.5180848",
"0.5172238",
"0.5169336",
"0.5167569",
"0.5165628",
"0.51615405",
"0.51453966",
"0.5139711",
"0.5138043",
"0.51324177",
"0.5125431",
"0.5124816",
"0.5123705",
"0.51142925",
"0.5110289",
"0.5099533",
"0.5093531",
"0.5090178",
"0.5083896",
"0.5083227",
"0.5074814",
"0.5073764",
"0.5062087",
"0.5059388",
"0.5059257",
"0.5057531",
"0.5056308",
"0.5055657",
"0.5054841",
"0.5052417",
"0.5049751",
"0.5047575",
"0.504695",
"0.50455666",
"0.5045026",
"0.504258",
"0.50390023",
"0.5038662",
"0.503105",
"0.5027023",
"0.5025208",
"0.5024036",
"0.5023576",
"0.5022663",
"0.49985358",
"0.49938324",
"0.4989639",
"0.49873316",
"0.49864614",
"0.49837214",
"0.4975099",
"0.49708873",
"0.4970035",
"0.49696523"
] | 0.0 | -1 |
Return's true if the skill exists, else it returns false and sends an error SMS to the person who texted in. Use only in sms functions Doesn't do anything if input is nil. Returns true. | def skill_check? skill
if !skill.nil?
curr_skill = Skill.find_by_skill_name(skill)
if curr_skill.nil?
sms_error("Skills: #{skill} is not a current skill we have. Text 'Skills' to get a list of skills we currently have.")
return false
else
return true
end
end
return true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def skill_ok?\n check_ok?(:skill) || all_ok?\n end",
"def skill?\n fail NotImplementedError\n end",
"def skill_wtype_ok?(skill)\r\n return true\r\n end",
"def skill_learn?(skill_id)\n return @skills.include?(skill_id)\n end",
"def create\n if !skill_already_exists?(skill_params)\n ## Find Skill in db , if it already exists, just take that otherwise create new\n @skill = Skill.all.where(title: skill_params[:title]).where(level: skill_params[:level]).first\n if @skill == nil\n @skill = Skill.new(skill_params)\n respond_to do |format|\n if @skill.save\n current_user.skills << @skill\n\n format.html { redirect_to @skill, notice: 'Skill was successfully created.' }\n format.json { render :show, status: :created, location: @skill }\n else\n format.html { render :new }\n format.json { render json: @skill.errors, status: :unprocessable_entity }\n end\n end\n else\n current_user.skills << @skill\n respond_to do |format|\n format.html { redirect_to @skill, notice: 'Skill was successfully added to your Profile. ' }\n format.json { render :show, status: :created, location: @skill }\n end\n end\n else\n respond_to do |format|\n format.html { redirect_to skills_path, :flash => { :error => \"This Skill already Exists\" } }\n end\n end\n end",
"def update_skill\n # continue input update if skill should be used\n return false if !self.check_skill_condition?\n # if skill not usable or skill use process not executed and no selection\n if $game_player.battler.skill == 0 ||\n !$game_player.use_skill($data_skills[$game_player.battler.skill]) &&\n $game_temp.select_data == nil\n # play buzzer, can't use\n $game_system.se_play($data_system.buzzer_se)\n end\n # stop input update\n return true\n end",
"def check_on_skill_use(user,target,skill,fail = false, success = false)\n string = Lecode_Challenge_Maker::On_Skill_Use[name]\n error = \"Kernel.eval Error | \"+name+\" | on_skill_use\"\n Kernel.eval(string) rescue msgbox error\n if success\n checkSuccess(false)\n else\n checkCondition(!fail)\n end\n end",
"def valid_skill\n @windows[Win_Help].move_to(2)\n @active_battler.current_action.set_skill(@spell.id)\n @targets = get_targets\n if @ATB_Active and \n GTBS::USE_WAIT_SKILLS and GTBS::ALLOW_SKILL_TARGET and \n GTBS::skill_wait(@spell.id)[0] > 0\n occ = occupied_by?(@cursor.x, @cursor.y)\n if occ and !occ.dead? \n type = Command_Confirm::Wait_Skill_Targeting\n end\n Sound.play_decision\n @cursor.active = false\n #Do immediat skill if type == nil\n @windows[Win_Confirm].ask(Command_Confirm::Skill, type)\n @windows[Win_Status].dmg_preview(2, @active_battler, @spell, @targets)\n \n elsif @targets.size >0 #unless targets 0 or less for some reason\n #make summons miss when cell is occupied\n if (GTBS::is_summon?(@spell.id, @active_battler.is_a?(Game_Actor))> 0 && occupied_by?(@cursor.x, @cursor.y)!= nil) or \n (@spell.for_opponent? && (@selected == @active_battler && !GTBS::ATTACK_ALLIES) &&\n !@active_battler.skill_range(@spell.id)[3] )\n Sound.play_buzzer\n else\n Sound.play_decision\n @cursor.active = false \n @windows[Win_Confirm].ask(Command_Confirm::Skill)\n @windows[Win_Status].dmg_preview(2, @active_battler, @spell, @targets)\n end\n \n elsif GTBS::is_summon?(@spell.id, @active_battler.is_a?(Game_Actor))>0 and $game_map.passable?(@cursor.x, @cursor.y, 0)\n Sound.play_decision\n @cursor.active = false \n @windows[Win_Confirm].ask(Command_Confirm::Skill)\n @windows[Win_Status].dmg_preview(2, @active_battler, @spell, @targets)\n \n elsif (!$game_system.actors_bodies? || GTBS::REVIVE_ANY_DEAD) and \n @spell.for_dead_friend? and occupied_by?(@cursor.x, @cursor.y) == nil\n open_revive_window\n \n else\n #Unauthorized validation\n Sound.play_buzzer\n end\n end",
"def skill_can_use?(skill_id)\n if not skill_learn?(skill_id)\n return false\n end\n return super\n end",
"def using_skill?\n return false if @use_spell.empty? or @using_skill\n casting = @use_spell[0][1]\n pos = casting[1]\n target = casting[2]\n if target != nil\n pos = [target[0].x+target[1][0], target[0].y+target[1][1]]\n end\n @cursor.moveto( pos) \n return true if update_screen\n @using_skill = true\n @active_battler = @use_spell.shift[0]\n @spell = casting[0]\n \n @active_battler.current_action.set_skill(@spell.id)\n #@active_battler.current_action.item_id = 0\n draw_ranges(@active_battler, 5)\n update_target_cursor\n @targets = @active_battler.get_targets\n activate_immediat_skill\n return true\n end",
"def skill?\n return (@kind == ACTSkill)\n end",
"def no_choice_skill?\n return TargetNoAsk.include?(target)\n end",
"def enable?(skill)\n return @actor.skill_can_use?(skill)\n end",
"def check_skill_condition?\n # disallow usage if skill button disabled\n return false if !$game_system.skill_button\n # disallow usage\n skill_condition = false\n # if using direct hotkeys\n if BlizzABS::Config::DIRECT_HOTKEYS\n # check direct hotkeys\n skill_condition = self.skill_hotkeys?\n # if skill button pressed\n elsif Input.trigger?(Input::Skill)\n # allow usage\n skill_condition = true\n end\n # return result\n return skill_condition\n end",
"def can_speak?(meaning)\n !lookup(meaning, false).nil?\n end",
"def sends_sms?\n false\n end",
"def create\n # 検証。同一スキルカテゴリIDかつ同一スキル名を持っている場合はエラー\n @exist = Skill.where(skill_category_id: skill_params[:skill_category_id]).where(skill_name: skill_params[:skill_name])\n\n @skill = Skill.new(skill_params)\n @skill.has_learning_level=true\n \n logger.debug(\"skill\")\n logger.debug(@skill)\n\n if @exist.present? \n render json:{errors: 'already exists.', status: :unprocessable_entity }\n else\n if @skill.save\n render json:{skill: @skill}\n else\n render json:{errors: @skill.errors, status: :unprocessable_entity }\n end\n end\n\n end",
"def attack_usable?\r\n usable?($data_skills[attack_skill_id])\r\n end",
"def sent?\n id.present? && error.blank?\n end",
"def withSpeakerName(speech)\n return speech.speaker_name.to_s.length != 0\n end",
"def on_skill_ok\n @skill = @skill_window.item\n BattleManager.actor.input.set_skill(@skill.id)\n action = BattleManager.actor.input\n BattleManager.actor.last_skill.object = @skill\n if @skill.target_type[0] == :one then select_target_selection\n else\n case @skill.target_type[0]\n when :all\n BattleManager.actor.input.set = SES::TargetManager.make_targets(action)\n when :rand\n targets, set = [], SES::TargetManager.make_targets(action)\n (@skill.target_type[1][0] + rand(@skill.target_type[1][1])).times do\n targets << set[rand(set.size)]\n end\n BattleManager.actor.input.set = set\n end\n @skill_window.hide\n next_command\n end\n end",
"def guard_usable?\r\n usable?($data_skills[guard_skill_id])\r\n end",
"def isSkillUsable()\n if( @enemy != nil && @skill != nil )\n if(! @skill.isOverLimit ) \n if( @enemy.fire_magic >= @skill.fire_cost &&\n @enemy.water_magic >= @skill.water_cost &&\n @enemy.earth_magic >= @skill.earth_cost &&\n @enemy.wind_magic >= @skill.wind_cost )\n #@enemy.light_magic >= @skill.light_cost &&\n #@enemy.dark_magic >= @skill.dark_cost )\n \n self.tone.set(0, 30, 0)\n else\n self.tone.set(70, 0, 0)\n end\n else\n self.tone.set(0, 0, 70)\n end\n end\n end",
"def ensure_speech!\n fail \"Must have active connection\" unless @speech\n end",
"def send_sms(*args)\n\t\tbegin\n\t\t\tsend_sms!(*args)\n\t\t\treturn true\n\t\t\n\t\t# something went wrong\n\t\trescue Gsm::Error\n\t\t\treturn false\n\t\tend\n\tend",
"def chain_skill_restriction?(skill)\r\r\n #return false unless actor?\r\r\n return false unless $game_party.in_battle\r\r\n return false unless skill.chain_only\r\r\n return false if (self.state?(90) || self.state?(288)) && skill.is_spell?\r\r\n return !@active_chain_enabled\r\r\n end",
"def skill_hotkeys?\n # find all triggered keys\n triggered = BlizzABS::Cache::Keys.find_all {|i|\n Input.trigger?(Input::Key[i.to_s]) &&\n $game_player.skill_hotkeys[i] != 0}\n # no usage if usage invalid\n return false if triggered.size == 0\n # set as usable item\n $game_player.battler.skill = $game_player.skill_hotkeys[triggered[0]]\n # allow usage\n return true\n end",
"def check_special_skills(ch, targets, skill)\n # if Tons of Add-ons is being used\n if $tons_version != nil && $tons_version >= 6.4\n # if using absorbing skills\n if $game_system.ABSORB_HP_SP\n # set damage accumulation to 0\n damages = 0\n # if skill absorbs HP\n if SKILL_IDS_HP.include?(skill.id)\n # for each target\n targets.each {|target|\n # if damage was done\n if target.battler.damage.is_a?(Numeric)\n # accumulate damage\n damages += target.battler.damage\n end}\n # change battler HP\n ch.battler.hp += damages\n # request damage sprite\n $BlizzABS.util.request_damage_sprite(ch)\n # if skill absorbs SP\n elsif SKILL_IDS_SP.include?(skill.id)\n # for each target\n targets.each {|target|\n # if damage was done\n if target.battler.damage.is_a?(Numeric)\n # accumulate damage\n damages += target.battler.spdamage\n # remove damage\n target.battler.damage = nil\n # make SP damage text\n target.check_spdamage\n end}\n # change battler SP\n ch.battler.sp += damages\n # request damage sprite\n $BlizzABS.util.request_damage_sprite(ch)\n end\n end\n # if using Destructor Skill and battler should die\n if $game_system.DESTRUCTOR_SKILL && ch.battler.set_to_die\n # kill\n ch.battler.hp = 0\n end\n # if using Blus Magic Skills\n if $game_system.BLUE_MAGIC_SKILL && BLUE_MAGIC_IDS.include?(skill.id)\n # remove damage for all targets\n targets.each {|target| target.battler.damage = nil}\n # get a random target\n target = targets[rand(targets.size)]\n # try to learn\n if rand(100) < skill.hit\n # if enemy\n if target.battler.is_a?(Game_Enemy)\n # initialize array\n ids = []\n # get all skill IDs of the target\n target.battler.actions.each {|act|\n ids.push(act.skill_id) if act.kind == 1}\n # if actor\n elsif target.battler.is_a?(Game_Actor)\n # get all skill IDs of the target\n ids = target.battler.skills.clone\n end\n # if any ID exists\n if ids.size > 0\n # get skill\n newskill = $data_skills[ids[rand(ids.size)]]\n # if already knowing that skill\n if ch.battler.skills.include?(newskill.id)\n # make damage text\n target.battler.damage = \"#{newskill.name} known\"\n else\n # learn skill\n target.battler.learn_skill(newskill.id)\n # make damage text\n target.battler.damage = \"#{newskill.name} learned\"\n end\n else\n # no skills available\n target.battler.damage = 'None available'\n end\n else\n # not successful\n target.battler.damage = 'Miss'\n end\n end\n end\n end",
"def skill_learn_persist?(class_id, skill)\n skill.is_a?(RPG::Skill) && !$game_persistent_skills[class_id].nil? && $game_persistent_skills[class_id].include?(skill.id)\n end",
"def skill_sealed?(skill_id)\r\n features_set(FEATURE_SKILL_SEAL).include?(skill_id)\r\n end",
"def does_a_phone_to_this_sip_account_exist\n if !Phone.exists?(:id => self.phone_id)\n errors.add(:phone_id, \"(ID #{self.phone_id}) does not exist.\")\n end \n end",
"def has_name_been_collected?(question)\n ri = false\n if person.full_name_exists?\n ri = true\n elsif person.only_middle_name_missing?\n ri = true if middle_name_response_exists?\n else\n ri = true if first_name_response_exists? && middle_name_response_exists? && last_name_response_exists?\n end\n answer_for(question, ri)\n end",
"def make_skill_action_result\n # Gather the current Ammo Cost\n gather_ammo_cost = Ammo::Skill_ammo[@active_battler.current_action.skill_id]\n # Gather Ammo\n gather_ammo = Ammo::Range_ammo_id[@active_battler.weapon_id]\n # Check if the Actor is using a defiend skill\n if Ammo::Skill_ammo.has_key?(@active_battler.current_action.skill_id)\n # Check if Ammo is present\n if $game_party.item_number(gather_ammo) >= gather_ammo_cost\n # Sufficient Ammo, remove item\n $game_party.lose_item(gather_ammo,gather_ammo_cost)\n # Call Default Code\n syn_scene_battle_skill\n else\n # Set Window; Do Nothing\n @help_window.set_text(\"#{@active_battler.name} cannot attack due to insufficient Ammo\", 1)\n end\n # Otherwise SKip the check and call default code\n else\n syn_scene_battle_skill\n end\n end",
"def exists?\n system = Sonos::System.new\n speaker = system.speakers.select { |s| s.name.downcase == @resource[:name].downcase }\n present = false\n if speaker.size < 1\n fail(\"Speaker #{resource[:name]} not associated to network?\")\n else\n if speaker[0].get_player_state[:state] == 'PLAYING'\n present = true\n end\n end\n\n present\n end",
"def user_already_exists\n puts \"\"\n puts Rainbow(\"*\").blue * 70\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"Please type your name (first and last).\"\n puts \"\"\n user_name_response = gets.chomp.split.map(&:capitalize).join(' ')\n self.quit if user_name_response == \"quit\"\n User.name_search_and_greeting(user_name_response, self)\n self.where_are_you_at?\n end",
"def for_friend?\n return true if skill? and skill.for_friend?\n return true if item? and item.for_friend?\n return false\n end",
"def word_present?(word)\n @spellchecker.spellcheck(word)\n end",
"def skill_can_use?(skill_id)\n if Combination_Skill['Union'] != nil and Combination_Skill['Union'].is_a?(Hash) and\n Combination_Skill['Union'].keys.include?(['Enemy', skill_id])\n union = Combination_Skill['Union'][['Enemy', skill_id]].dup\n for id in union.keys\n battler = set_enemy_battler(id)\n return false unless battler != nil and battler.exist?\n return false unless battler.combination_can_use?(skill_id)\n return false unless battler.inputable?\n end\n end\n return super\n end",
"def unknown?\n text_name == \"Fungi\"\n end",
"def reply_to_sender_with_error(phone_number, msg)\n reply_to_sender(phone_number, msg)\n msg = \"\" if Rails.env=='production' # do not show error messages in UI in production\n return msg, true\n end",
"def ignore_skill_guard?\n !note[TSBS::IgnoreSkillGuard].nil?\n end",
"def ignore_skill_guard?\n !note[TSBS::IgnoreSkillGuard].nil?\n end",
"def grant_training_skill?\n GRANT_TRAINING_SKILL.include?(self.name)\n end",
"def self_intro_enquiry(*args)\n self.update_attribute(:bot_response, \"I'm Brian.\")\n return false\n end",
"def answered?\n !body.blank?\n end",
"def sa_phone_previously_collected?(question)\n answer_for(question, valid_response_exists?(\"PARTICIPANT_VERIF.SA_PHONE\"))\n end",
"def check_answering_question(msg)\n msg.length == 1\nend",
"def addable?(name)\n if name_li(name).exists?\n self.button(:title=>\"Request connection with #{name}\").present?\n else\n puts \"\\n#{name} isn't in the results list. Check your script.\\nThis may be a false negative.\\n\"\n return false\n end\n end",
"def valid_input? (input)\n #if statement verifies valid input to continue\n if input == \"amex\"\n @selected_program = AMEX\n return true\n\n elsif input == \"chase\"\n @selected_program = CHASE\n return true\n\n elsif input == \"citi\"\n @selected_program = CITI\n return true\n end #ends if/else statement\n\n end",
"def tell_a_joke(joke_to_tell, correct_response)\n puts joke_to_tell\n user_input = gets.chomp\n if user_input == correct_response\n return true\n else\n return false\n end\nend",
"def isok(input)\n # make sure that the input does not contain system ''\n ! input.downcase.include? 'system'\n end",
"def check_new_skills\n last_skills = skills\n self.class.learnings.each do |learning|\n learn_skill(learning.skill_id) if can_learn_skill?(learning)\n end\n display_learn_skills(skills - last_skills)\n end",
"def receive_sms\n uninitialize_sms\n body = params[:Body]\n phone_number = normalize_phone params[:From].strip\n @problem_text = body.split\n action = sms_parsing(body).downcase\n if action == \"join\"\n sms_create_account\n return\n elsif Account.find_by_phone_number(phone_number) == nil\n sms_send(params[:From], \"Please first create an account by texting the word 'join'.\")\n return\n end\n if !@sms_error\n case action\n when /^add$/,/^insert$/\n sms_create\n when /^accept$/\n sms_accept_problem\n when /^get$/\n @offset = false\n sms_get(0)\n when /^edit$/\n sms_edit\n when /^delete$/, /^destroy$/\n sms_delete\n when /^next$/\n offset = session[\"offset\"]\n if offset == nil\n sms_error(\"Sorry, there is no saved session right now. Please first text \\\"GET\\\" with @location !skill %number of texts you want to allow.\")\n else\n @offset = true\n sms_get(offset)\n end\n when /^detail$/, /^details$/, /^describe$/\n sms_detail\n when /^account$/\n forgot_acc\n when /^change$/\n sms_change_password\n when /^password$/\n forgot_password\n# when /^skill$/, /^skills$/\n# sms_skill\n when /^keywords$/, /^key$/, /^keys$/, /^help$/\n sms_keywords\n when /^explain$/\n sms_explain\n else\n if is_num?(action)\n session[:received_confirmation] = action\n sms_confirm_acc\n else\n sms_wrong_keyword\n end\n end\n end\n render :nothing => true\n end",
"def haiku?(poem)\n # code goes here\nend",
"def create\n @skill = @user.skills.new(params[:skill])\n\n respond_to do |format|\n if @skill.save\n flash[:notice] = 'Skill was successfully created.'\n format.html { redirect_to(user_skills_path(@user)) }\n else\n format.html { render :action => \"new\" }\n end\n end\n end",
"def smsable?\n properties.include?(\"smsable\")\n end",
"def skill_roll (msg, skill_name, num=nil)\n # Set some defaults\n num &&= num.to_i\n num ||= 20\n\n # Get the player\n player = verify_player msg\n return unless player\n\n # Check that the skill exists\n skill = player.skill_exists? skill_name\n unless skill\n msg.reply \"I'm sorry, #{skill_name} is not a valid skill.\"\n return\n end\n\n # Finally we make a role\n msg.reply \"#{msg.user.nick} rolled #{skill.roll num}\"\n end",
"def addable?(name)\n if name_link(name).exists?\n self.button(:title=>\"Request connection with #{name}\").present?\n else\n puts \"\\n#{name} isn't in the results list. Check your script.\\nThis may be a false negative.\\n\"\n return false\n end\n end",
"def create\n skill = Skill.new(skill_params)\n \n if skill.save\n render json: {status: 'SUCCESS', message:'Saved skill', data:skill},status: :ok\n else\n render json: {status: 'ERROR', message:'Skill not saved', data:skill.errors},status: :unprocessable_entity\n end\n end",
"def judge_scores?\n standard_skill_score_entries.any?\n end",
"def ask(_speech, _display_text = nil, _ssml = false)\n raise NotImpementedError, 'Conversations are not implemented now'\n end",
"def nlu_handle_input\n # Wit processing will take a while, so we want to show activity\n @message.mark_seen\n @message.typing_on\n return if acted_on_non_questions?\n # Non-questions ruled out, we can\n # save a question to correct later, if needed\n @user.session[:needs_correction] = @message.text\n # Act on a type of question\n act_on_question_types\n # We're done replying\n @message.typing_off\n end",
"def should_i_sip?\n #If we don't have our total scores, wait until character fills them in.\n if plugins[Character].total_mana && plugins[Character].total_health \n #Otherwise, begin checking health and mana to see if we need to do some drinking...\n if health_below_threshold? && sipper_enabled?\n send_kmuddy_command(\"drink health\")\n @sipper_enabled = false\n end\n if mana_below_threshold? && sipper_enabled?\n send_kmuddy_command(\"drink mana\")\n @sipper_enabled = false\n end\n end\n end",
"def delete_check\n if Skill.where(id:params[:id]).blank?\n render json: {result: 'couldnt process delete request'} #dont give extra failure info security-wise\n else\n @skill = Skill.find(params[:id])\n end\n end",
"def msg_exists(msg) \n not msg.nil? and not msg.empty?\n end",
"def voice!\n return true if voice?\n\n raise 'You must be voiced to use this command.'\n end",
"def create\n @skill = Skill.new(skill_params)\n respond_to do |format|\n if @skill.save\n if @skill.approved == true # approved value is true if it is created by the Admin user\n format.html { redirect_to skill_categories_path, notice: 'Skill was successfully created.' }\n format.json { render :show, status: :created, location: @skill }\n else # approved value is false if it's created by the Host or Candidate, and it requires Admin's approval\n @candidate_skill = CandidateSkill.create(user_id: current_user.id, skill_id: @skill.id)\n @candidate_skill.save!\n NewlyAddedSkillMailer.approve_new_skill(@skill.id, current_user.id).deliver_now\n # format.html { redirect_to @skill, notice: 'Skill was successfully created.' }\n if params[:oppo_id].present?\n format.html { redirect_to required_skills_path(oppo_id: params[:oppo_id]), notice: 'Skill was successfully created.' }\n format.json { render :show, status: :created, location: @skill }\n else\n format.html { redirect_to my_skills_path, notice: 'Skill was successfully created.' }\n format.json { render :show, status: :created, location: @skill }\n end\n end\n else\n format.html { render :new }\n format.json { render json: @skill.errors, status: :unprocessable_entity }\n end\n end\n end",
"def garbage_check(id)\n\t return @skills.include?(id)\n\tend",
"def error?\n return false if error_text.nil? or error_text.empty?\n return true\n end",
"def mts_hello\n puts \"Hello! Welcome to the Millennial Translation Service. Please enter your name.\".colorize(:light_green)\n\n name = gets.chomp.capitalize\n # take the name and search to see if they have an account\n if User.exists?(user_name: name) # if returning user, display options, User.find_user returns the object if found\n puts \"Welcome back, #{name.capitalize}!\".colorize(:light_green)\n mts_step_one(name)\n else # if the user is new, create a new user\n puts \"This is the first time we have seen you, #{name.capitalize.underline}. Let's show you around.\".colorize(:light_green)\n User.create(user_name: name)\n new_user_orientation(name)\n end\nend",
"def ty_execute_action_skill\n # Check to see if the current attacker is the actor and is using a weapon that needs ammo\n if @active_battler.is_a?(Game_Actor) && TysAmmoRequirements::Skill_ammo_cost[@active_battler.action.skill_id]\n if TysAmmoRequirements::Weapons_ammo_id[@active_battler.weapon_id].is_a?(Array)\n # Check passed, so now we store the array items\n array_items = TysAmmoRequirements::Weapons_ammo_id[@active_battler.weapon_id]\n # Now we check each ID in array_items and compare to see if we have enough ammo\n for index in array_items\n # Check to see if the actor has enough ammo\n if $game_party.item_number($data_items[index]) >= gather_ammo_cost\n # Check cleared, gather item ID and terminate check loop\n gather_ammo_item = $data_items[index]\n break\n end\n end\n else\n gather_ammo_item = $data_items[TysAmmoRequirements::Weapons_ammo_id[@active_battler.skill_id]]\n end\n # Both checks clear, so perform Ammo adjustments\n # First we collect some end-user options, like ammo cost and ammo ID.\n gather_ammo_cost = TysAmmoRequirements::Skill_ammo_cost[@active_battler.action.skill_id]\n id = @active_battler.action.skill_id\n gather_ammo_item = $data_items[TysAmmoRequirements::Skill_ammo_id[id]]\n if $game_party.item_number(gather_ammo_item) >= gather_ammo_cost\n # The check cleared, so perform ammo adjustments\n # Consume Ammunition\n $game_party.lose_item(gather_ammo_item, gather_ammo_cost)\n # Display text\n text = sprintf(Vocab::ConsumeAmmo, @active_battler.name, gather_ammo_cost, gather_ammo_item.name)\n @message_window.add_instant_text(text)\n else\n # Failed check, go into defense mode\n text = sprintf(Vocab::NoAmmo, @active_battler.name, gather_ammo_item.name)\n @message_window.add_instant_text(text)\n @active_battler.action.kind = 0\n execute_action_guard\n end\n # Perform a check to see if Active_Battler is a enemy and has ammo\n elsif @active_battler.is_a?(Game_Enemy) && $data_enemies[@active_battler.enemy_id].note.include?(TysAmmoRequirements::Enemy_ammo_activate_string) && TysAmmoRequirements::Enemy_skill_cost[@active_battler.action.skill_id]\n # Now we have to isolate the interger in the 'Note' string of the enemies\n # and then store the interger in a new local value for future use.\n enemy_ammo_cost = TysAmmoRequirements::Enemy_skill_cost[@active_battler.action.skill_id]\n enemy_ammo_name = TysAmmoRequirements::Enemy_ammo_name[@active_battler.enemy_id]\n # Check to see if the enemy has enough ammo to attack\n if @enemy_ammo[@enemy_attack] >= enemy_ammo_cost\n # Check cleared, remove enemy ammo.\n text = sprintf(Vocab::EnemyUsedAmmo, @active_battler.name, enemy_ammo_name)\n @message_window.add_instant_text(text)\n @enemy_ammo[@enemy_attack] -= enemy_ammo_cost\n else\n # Check failed, put enemy in guard mode \n text = sprintf(Vocab::EnemyNoAmmo, @active_battler.name, enemy_ammo_name)\n @message_window.add_instant_text(text)\n @active_battler.action.kind = 0\n execute_action_guard\n end\n end\n end",
"def has_actual_input?\n\t\t\tself.text != @help_text\n\t\tend",
"def skill_conditions_met?(skill)\r\n usable_item_conditions_met?(skill) &&\r\n skill_wtype_ok?(skill) && skill_cost_payable?(skill) &&\r\n !skill_sealed?(skill.id) && !skill_type_sealed?(skill.stype_id)\r\n end",
"def not_spam\n errors.add(:base, \"invalid reply\") if check_field.present?\n end",
"def user_wants_to_join?\n @data['event']['text'].downcase != 'no'\n end",
"def sms number, message\n response = @connection.cmd \"String\" =>\"sms send #{number} #{message}\", \"Match\" => /OK|KO:(.*)/, \"Timeout\" => 5\n if response.chomp == \"OK\"\n true\n else\n raise response.chomp.sub \"KO:\",''\n end\n end",
"def hi_enquiry(*args)\n self.update_attribute(:bot_response, hi_response)\n return false\n end",
"def create\n @skill_name = SkillName.new(skill_name_params)\n\n respond_to do |format|\n if @skill_name.save\n format.html { redirect_to :back, notice: 'Skill name was successfully created.' }\n format.json { render :show, status: :created, location: @skill_name }\n else\n format.html { render :new }\n format.json { render json: @skill_name.errors, status: :unprocessable_entity }\n end\n end\n end",
"def gets? question, pounce = false\n knows? question or (pounce and pounces? question and guesses?)\n end",
"def non_existing_script?\n return false if program\n\n print_error(\"The script doesn't exist\")\n true\n end",
"def detect_sms_feature()\n begin\n endpoint = \"/restapi/v1.0/account/~/extension/~/phone-number\"\n resp = $platform.get(endpoint)\n for record in resp.body['records'] do\n for feature in record['features'] do\n if feature == \"SmsSender\"\n puts (\"This phone number \" + record['phoneNumber'] + \" has SMS feature\")\n end\n end\n end\n if resp.body['records'].length == 0\n puts (\"This user does not own a phone number!\")\n end\n rescue StandardError => e\n puts (e)\n end\nend",
"def responded_to?(kase)\n !!self.responses.find(:first, :conditions => [\"responses.kase_id = ?\", kase.id])\n end",
"def action_not_recognize(input)\n response = WxTextResponse.new\n set_common_response response\n response.Content = WxReplyMsg.get_msg_by_key 'help'\n response\n end",
"def joke_ex2(joke, correct_response)\n puts joke\n user_input = gets.chomp\n if user_input == correct_response\n return true\n else\n return false\n end\nend",
"def is_question\n # @str_token is when this module is included in the analyzer\n # phrase.phrase is when this module is included in intent.rb to calculate scores\n # we could refactor cuz its kinda confusing but this method is the only time there is any variance\n # w/ in this ~module\n val = @str_token || phrase.phrase\n val.match(QUESTION_REGEX).present?\n end",
"def speak\n \"#{name} says Assalaam alaykum\"\n end",
"def attempted?\n 'Attempted' == result\n end",
"def empty_name?\n if @name.empty?\n print 'You need to pass a name: '\n @name = gets.chomp\n empty_name?\n end\n\n false\n end",
"def check_existing(input)\n user = User.find_by(email: input[:params][:email])\n user ? Failure(ErrorService.bad_request_fail(message: 'User exists')) : Success(input)\n end",
"def exists?\n @text_field.exists?\n end",
"def create\n @user_skill = UserSkill.new(params[:user_skill])\n\n respond_to do |format|\n if @user_skill.save\n format.html { redirect_to @user_skill, notice: 'User skill was successfully created.' }\n format.json { render json: @user_skill, status: :created, location: @user_skill }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user_skill.errors, status: :unprocessable_entity }\n end\n end\n end",
"def iphone_required(udid = params[:udid])\n udid = udid.to_s.strip\n \n raise \"IPhone UDID isn't given\" if udid.blank?\n raise \"IPhone UDID is invalid\" unless /^[0-9a-f]{40}$/i =~ udid\n \n @iphone = Iphone.find_or_create_by_udid(udid)\n\n raise \"IPhone is not allowed to send free messages\" unless @iphone.can_send_free_messages?\n end",
"def saq_activity?\n @activity_name.to_s =~ /SAQ$/\n end",
"def message_exists?(response)\n response.respond_to?(:name) && response.name == 'EXISTS'\n end",
"def job_exists? name\n\t\t\tjob = get_job name\n\t\t\treturn job[:success]\n\t\tend",
"def send_sms(message)\n api_response = \"\"\n if !self.mobile.blank?\n txtlocal = Txtlocal.find_by_sms_type(Txtlocal::GROUP_CHAT)\n if !txtlocal.nil?\n txtlocal.message_contents = message\n api_response = txtlocal.send_sms(self.mobile)\n end\n else\n api_response = \"You have not provided any mobile number. Please go to your 'Account' to set up a mobile number\"\n end\n return api_response\n end",
"def look(player, input=String.new)\n \t\tlook_at = input.split[1..-1]\n\t\t# If the player has specified a target / keyword, try to find it in the list\n \t\t# of keywords on characters in the room\n \t\t# TODO: Look at room keywords as well (i.e. 'look sign', etc.)\n\t\tunless look_at.nil? || look_at.first.nil?\n \t\t\tmatches = $world.get_room_characters(player.location).select { |c| c.keywords =~ /\\A#{Regexp.escape(look_at.first)}/i }\n \t\t\tunless matches.first.nil?\n \t\t\t\tprint_line matches.first.description + ?\\n\n \t\t\telse\n \t\t\t\tprint_line \"There is nothing to look at with that name.\\n\"\n \t\t\tend\n\t\t# No target specified - just show them the room name / description, any other\n\t\t# characters who might be present, and the available exits\n\t\t# TODO: Get the '...is standing here' description from the character.\n \t\telse\n\n \t\t\tprint_line $world.get_room_name(player.location), :cyan\n \t\t\tprint_line $world.get_room_description(player.location)\n \t\t\t$world.get_room_characters(player.location).each {|char| print_line \"#{char.name} is standing here.\", :white unless char.name == player.name}\n \t\tend\n \t\tlist_exits player\n \tend",
"def has_custom_attack?\n custom_attack_skill_features.any?\n end",
"def opinion_wizard_step_help_text?(step)\n translated_attribute(component_settings.try(\"opinion_wizard_#{step}_help_text\")).present?\n end",
"def error_message?\n true if message[:error]\n end"
] | [
"0.6540748",
"0.65278304",
"0.652087",
"0.59817135",
"0.59368896",
"0.5903813",
"0.58838",
"0.5880899",
"0.5856321",
"0.5759966",
"0.57254595",
"0.56602764",
"0.56366765",
"0.5601597",
"0.5594932",
"0.5572668",
"0.5525742",
"0.55110663",
"0.5504361",
"0.54783106",
"0.5401052",
"0.5362567",
"0.5350009",
"0.5336143",
"0.5319439",
"0.5306006",
"0.5291299",
"0.5281629",
"0.5262465",
"0.5253482",
"0.52403355",
"0.5226481",
"0.5225944",
"0.5225148",
"0.52240485",
"0.51909184",
"0.515922",
"0.5146183",
"0.51394296",
"0.51168215",
"0.5092921",
"0.5092921",
"0.5091275",
"0.5083421",
"0.5066305",
"0.50521797",
"0.50507015",
"0.5043128",
"0.5027051",
"0.5026449",
"0.5016918",
"0.49962947",
"0.49950907",
"0.49883422",
"0.49873585",
"0.49870178",
"0.4970825",
"0.49636355",
"0.4949169",
"0.4946875",
"0.49448738",
"0.49345782",
"0.49309313",
"0.49304727",
"0.49288186",
"0.49255204",
"0.49253663",
"0.4923867",
"0.49206883",
"0.49157465",
"0.49102184",
"0.49069524",
"0.490064",
"0.49004197",
"0.49001205",
"0.48962364",
"0.48959824",
"0.48955387",
"0.48947215",
"0.48901242",
"0.48889542",
"0.48812371",
"0.48795915",
"0.48763666",
"0.48674917",
"0.48667625",
"0.48659006",
"0.4864167",
"0.48630413",
"0.48615286",
"0.48589158",
"0.4855845",
"0.48520806",
"0.4842696",
"0.48355308",
"0.48303866",
"0.48275042",
"0.48264572",
"0.48262057",
"0.48232198"
] | 0.728954 | 0 |
belongs_to :showback_event belongs_to :showback_bucket validates :showback_bucket, :presence => true, :allow_nil => false validates :showback_event, :presence => true, :allow_nil => false | def clean_costs
self.cost = nil
save
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def before_validation_on_create\n existingEventParticipant = EventParticipant.find(:first,:conditions=>\"horse_id=#{self.horse.id} and event_id=#{self.event.id}\")\n if !existingEventParticipant.nil?\n raise \"You may not create a new event participant, this horse, #{existingEventParticipant.horse.name} is already part of this event with rider #{existingEventParticipant.rider.name}\"\n end\n end",
"def validate\r\n only_provides :json\r\n \r\n @event = Event.new(params[event])\r\n @event.user = current_user\r\n @event.title = nil if @event.title.blank?\r\n @event.finish = nil if @event.finish.blank?\r\n # ignore timeline_event since its fields are optional now\r\n \r\n display @event.valid? || @event.errors_as_params\r\n end",
"def validate_event; end",
"def create\n\n @event = Event.new(params[:event])\n \n band = Band.find(:first, :conditions => [ \"name = :u\", { :u => @event.artist_name}])\n if band.nil?\n new_band = Band.new\n new_band.name = @event.artist_name\n new_band.save\n band = new_band\n end\n \n @stage = Stage.find(params[:stage_id], :include => :festival)\n\n\n\n @event.band_id = band.id\n @event.stage_id = @stage.id\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to(stage_path(@stage), :notice => 'Event was successfully created.') }\n format.xml { render :xml => @event, :status => :created, :location => @event}\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @event.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def baggage_not_nil\n if(self.baggage == nil)\n errors.add(:field, 'Baggage ist Null')\n end\n end",
"def event_place_valid?\n return unless place_id_changed? || self.new_record?\n if place.nil? || campaign.nil?\n validate_place_presence\n else\n validate_place_valid_for_campaign\n validate_user_allowed_schedule_event_in_place\n end\n end",
"def create_sash_if_none\n if sash.nil?\n self.sash = Sash.new\n self.save(:validate => false)\n end\n end",
"def belongs_to_bucket?\n [email protected]?\n end",
"def no_nil_attributes\n GroupEvent.attribute_names.without(\"deleted\").each do |a|\n if self.send(a).blank?\n errors.add(:base, \"All fields are required to publish an event\")\n return false\n end\n end\n return true\n end",
"def remove_event(event)\n if event.kind_of?(ManageIQ::Consumption::ShowbackEvent)\n if showback_events.include?(event)\n showback_events.delete(event)\n else\n errors.add(:showback_events, \"not found\")\n end\n else\n errors.add(:showback_events, \"Error Type #{event.type} is not ManageIQ::Consumption::ShowbackEvent\")\n end\n end",
"def validate \n#\tfirst check whether combo fields have been selected\n\t is_valid = true\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:artist_name => self.artist_name}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_artist\n\t end\n\t#validates uniqueness for this record\n\t if self.new_record? && is_valid\n\t\t validate_uniqueness\n\t end\nend",
"def validate(record)\n if record._database_validations_fallback\n super\n else\n return unless record.public_send(foreign_key).blank? && record.public_send(association).blank?\n\n record.errors.add(association, :blank, message: :required)\n end\n end",
"def create\n @activity = CareerPlanOutcome.where(\"activity = 0 \").first\n\n @work_search_blog = WorkSearchBlog.new(work_search_blog_params)\n @work_search_blog.career_plan_outcome_id = @activity.id\n @work_search_blog.job_seeker_id = current_client.id\n @event = Event.new\n @event.title = @activity.activity\n @event.start = Date.today\n @event.end = Date.today\n @event.resource_id = 1\n @event.job_seeker_id = current_client.id\n @event.save\n respond_to do |format|\n if @work_search_blog.save\n format.html { redirect_to @work_search_blog, notice: 'Work search blog was successfully created.' }\n format.json { render :show, status: :created, location: @work_search_blog }\n else\n format.html { render :new }\n format.json { render json: @work_search_blog.errors, status: :unprocessable_entity }\n end\n end\n end",
"def validates_associated_post_records; end",
"def validates_associated_post_records; end",
"def create\n @event = Event.new(event_params)\n \n if Venue.find_by(name: params[:venue]) == nil\n @venue = Venue.create(name: params[:venue])\n else\n @venue = Venue.find_by(name: params[:venue])\n end\n \n @bands = []\n \n respond_to do |format|\n if @event.save\n event_date_time = event_params[:start] + ' CST'\n @event.update(start: DateTime.strptime(event_date_time, '%m/%d/%Y %l:%M %p %Z'))\n @venue.events << @event\n \n if params[\"supporting_acts\"] != nil\n supporting_acts = params[\"supporting_acts\"]\n supporting_acts.each do |index, name|\n name = name.strip\n unless name == \"\"\n if Band.find_by(name: name) == nil\n @event.bands << Band.create(name: name)\n supporting_acts = @event.supporting_acts.push(Band.find_by(name: name).id)\n @event.update(supporting_acts: supporting_acts)\n else\n @band = Band.find_by(name: name)\n band_in_lineup = false\n @event.bands.each do |band|\n if band.id == @band.id\n band_in_lineup = true\n break\n end\n end\n if band_in_lineup == false\n @event.bands << Band.find_by(name: name)\n supporting_acts = @event.supporting_acts.push(Band.find_by(name: name).id)\n @event.update(supporting_acts: supporting_acts)\n else\n supporting_acts = @event.supporting_acts.push(Band.find_by(name: name).id)\n @event.update(supporting_acts: supporting_acts)\n end\n end\n end\n end\n end\n \n if params[\"headliners\"] != nil\n headliners = params[\"headliners\"]\n headliners.each do |index, name|\n name = name.strip\n unless name == \"\"\n if Band.find_by(name: name) == nil\n @event.bands << Band.create(name: name)\n headliners = @event.headliners.push(Band.find_by(name: name).id)\n @event.update(headliners: headliners)\n else\n @band = Band.find_by(name: name)\n band_in_lineup = false\n @event.bands.each do |band|\n if band.id == @band.id\n band_in_lineup = true\n break\n end\n end\n if band_in_lineup == false\n @event.bands << Band.find_by(name: name)\n headliners = @event.headliners.push(Band.find_by(name: name).id)\n @event.update(headliners: headliners)\n else\n headliners = @event.headliners.push(Band.find_by(name: name).id)\n @event.update(headliners: headliners)\n end\n end\n end\n end\n end\n \n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_add_invalid_foreign_key\n @connection.add_foreign_key :astronauts, :rockets, column: \"rocket_id\", validate: false\n\n foreign_keys = @connection.foreign_keys(\"astronauts\")\n assert_equal 1, foreign_keys.size\n\n fk = foreign_keys.first\n assert_predicate fk, :validated?\n end",
"def validate \n#\tfirst check whether combo fields have been selected\n\t is_valid = true\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:mark_code => self.mark_code}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_mark\n\t end\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:short_description => self.short_description}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_organization\n\t end\n\t#validates uniqueness for this record\n\t if self.new_record? && is_valid\n\t\t validate_uniqueness\n\t end\nend",
"def validate_on_create; end",
"def event_and_parent_validation\n if parent_id.nil? ^ trigger.nil?\n errors.add(:trigger, ' may be not set unless the Parent Task is specified.') if parent_id.nil?\n errors.add(:parent_id, ' requires a trigger event.') if trigger.nil?\n end\n end",
"def prev_event?\n !@prev_event.blank?\n end",
"def check_invariants\n validEvent = true\n\n # This block checks if the start and end times are empty\n if :start_time_date.empty? or :end_time_date.empty?\n errors.add :start_time, \"should be added.\"\n validEvent = false\n end\n \n # This block checks if the number of categories is > 2\n if !categories.nil? and categories.split(',').size > 2\n errors.add :categories, \"section should only have one or two categories selected.\"\n validEvent = false\n end\n\n # This block checks if the start time is greater than the end time\n# #if (Time.strptime(self.start_time, \"%Y-%d-%m %H:%M\") > Time.strptime(self.end_time, \"%Y-%d-%m %H:%M\")) \n# if (self.start_time > self.end_time)\n# errors.add :start_time, \"should be before the end time.\"\n# validEvent = false\n# end\n\n # This block checks if the name field exists\n if (self.name.nil?)\n errors.add :name, \"should not be empty.\"\n validEvent = false\n end\n\n # This block checks if the description field exists\n if (self.description.nil?)\n errors.add :description, \"should not be empty.\"\n validEvent = false\n end\n\n # This block checks if the location field exists\n if (self.location.nil?)\n errors.add :location, \"should not be empty.\"\n validEvent = false\n end\n\n # This block checks if the approval_rating field exists\n if (self.approval_rating.nil?)\n errors.add :approval_rating, \"should not be empty.\"\n validEvent = false\n end\n\n # This block checks if the event_start field exists\n if (self.event_start.nil?)\n errors.add :event_start, \"should not be empty.\"\n validEvent = false\n end\n\n # This block checks if the event_end field exists\n if (self.event_end.nil?)\n errors.add :event_end, \"should not be empty.\"\n validEvent = false\n end\n\n # This block checks if there are any duplicate events when submitting a new event\n if(self.id == nil) \n if (Event.exists?(:location => self.location, :start_time => self.start_time, :end_time => self.end_time))\n errors.add :location, \"invalid: Cannot be a duplicate event.\"\n validEvent = false\n end\n else\n if (Event.where(\"location = ? AND start_time = ? AND end_time = ? AND NOT id = ?\", self.location, self.start_time, self.end_time, self.id).length >= 1)\n errors.add :location, \"invalid: Created a duplicate event via editing\"\n end\n end\n\n # This block checks to make sure that the organization\n # matches the specified user\n if !can_modify?(self.user)\n errors.add :organization, \"should be one that you are a member of\"\n validEvent = false\n end\n\n return validEvent\n end",
"def validate\n super\n validates_presence [:code, :preference, :type_param_id, :application_id]\n end",
"def create\n @event = Event.new(event_params)\n @event.host_id = current_user.id\n @event.time_start = convert_time(@event.time_start)\n @event.time_end = convert_time(@event.time_end)\n\n\n if @event.category_id == 0\n @event.category_id = 1\n end\n if @event.save\n render :show\n else\n render json: @event.errors.full_messages, status: 422\n end\n\n end",
"def create\n @event = Event.new(event_params)\n @event.remaining_tickets = params[:event][:total_tickets]\n @club = Club.where(id: params[:event][:club_id]).take\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(params[:event])\n @overlap_start = Event.where(\"agency_id = ? AND (start_date < ? AND end_date > ?)\", @event.agency_id, @event.start_date, @event.start_date)\n @overlap_end = Event.where(\"agency_id = ? AND (start_date < ? AND end_date > ?)\", @event.agency_id, @event.end_date, @event.end_date)\n @event.agency_id = 1\n if ((@overlap_start.count > 0) || (@overlap_end.count > 0))\n flash[:error] = \"Only one \" + @event.agency.name + \" event may run at any time.\"\n redirect_to @event\n else\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def validates_presence_of_parent(foreign_key)\n after_save do |record|\n unless record.send(foreign_key)\n record.errors.add_on_blank(foreign_key)\n raise ActiveRecord::ActiveRecordError, record.errors.full_messages.to_sentence\n end\n end\n end",
"def create\n @bid_event = BidEvent.new(bid_event_params)\n\n respond_to do |format|\n if @bid_event.save\n format.html { redirect_to :back }\n format.json { render :show, status: :created, location: @bid_event }\n else\n format.html { redirect_to :back }\n format.json { render json: @bid_event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def validate\n super\n validates_presence :components unless initial?\n validates_presence :version\n end",
"def must_be_in_existing_bucket\n return if can_have_invalid_buckets?\n\n errors.add(:bucket_key, bucket_validity_error_message) if invalid_bucket?\n errors.add(:requested_bucket_key, bucket_validity_error_message) if invalid_requested_bucket?\n end",
"def valid_attributes\n { \n \"name\" => \"Dummy Sale\",\n \"description\"=>\"Dummy event description data\", \n \"start_date\"=> Time.zone.now.strftime(\"%Y/%m/%d %H:%M:%S %z\"), \n \"end_date\"=> (Time.zone.now+2.months).strftime(\"%Y/%m/%d %H:%M:%S %z\"), \n \"permalink\" => taxon.permalink,\n \"eventable_type\"=> taxon.class.to_s,\n \"eventable_id\" => taxon.id.to_s,\n \"is_active\"=>\"1\", \n \"is_hidden\"=>\"0\", \n \"is_permanent\"=>\"0\"\n }\n end",
"def create\n @event = PublicEvent.new(scrapper_params)\n @event.manual = false\n respond_to do |format|\n if @event.save\n format.html { redirect_to scrappers_path, notice: 'Scrapper was successfully created.' }\n else\n format.html { render :new }\n end\n end\n end",
"def belongs_to?; false; end",
"def validate \n#\tfirst check whether combo fields have been selected\n\t is_valid = true\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:short_description => self.short_description}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_organization\n\t end\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:target_market_name => self.target_market_name}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_target_market\n\t end\n\t#validates uniqueness for this record\n\t if self.new_record? && is_valid\n\t\t validate_uniqueness\n\t end\nend",
"def event_params\n params.require(:event).permit(:date, :time, :venue_id, :band_id)\n end",
"def _validate_presence_of_record(record)\n\t\traise ActiveRecord::RecordNotFound, PRESENCE_REQUESTED if record.nil?\n\tend",
"def validate\n validate_resources_defined\n validates_unique(:resource_id, :message => \"ARK must point to a unique Resource\")\n validates_unique(:archival_object_id, :message => \"ARK must point to a unique Archival Object\")\n super\n end",
"def event_params\n params.require(:event).permit(:title, :description, :start_date, :end_date, :user_id, :field_id, :club_id)\n end",
"def validate_event=(_arg0); end",
"def validate\n super \n end",
"def create\n @company_event = CompanyEvent.new(company_event_params)\n if @company_event.save\n @flag = true\n @company_event = CompanyEvent.new\n @company_events = CompanyEvent.all\n else\n @flag = false\n end\n end",
"def club?\n !self.club.nil?\n end",
"def validate(record)\n unless valid_preposition?(record.show_date_preposition)\n record.errors.add(:show_date_preposition, 'Invalid show date preposition')\n end\n\n unless valid_date?(record.show_date_beginning)\n record.errors.add(:show_date_beginning, 'Invalid show date beginning')\n end\n\n unless valid_unit?(record.show_date_last_unit)\n record.errors.add(:show_date_last_unit, 'Invalid show date unit')\n end\n\n unless valid_date?(record.show_date_from)\n record.errors.add(:show_date_from, 'Invalid show date from date')\n end\n\n unless valid_date?(record.show_date_to)\n record.errors.add(:show_date_to, 'Invalid show date to date')\n end\n\n unless valid_preposition?(record.date_played_preposition)\n record.errors.add(:date_played_preposition, 'Invalid date played prepos.')\n end\n\n unless valid_date?(record.date_played_beginning)\n record.errors.add(:date_played_beginning, 'Invalid date played beginning')\n end\n\n unless valid_unit?(record.date_played_last_unit)\n record.errors.add(:date_played_last_unit, 'Invalid date played unit')\n end\n\n unless valid_date?(record.date_played_from)\n record.errors.add(:date_played_from, 'Invalid date played from date')\n end\n\n unless valid_date?(record.date_played_to)\n record.errors.add(:date_played_to, 'Invalid date played to date')\n end\n end",
"def valid_attributes\n {\n title: \"My Title\",\n committee_id: committee.id\n }\n end",
"def enforce_not_null(options = {})\n args = build_validation_args(options, :not_null, :blank)\n return if args.first.is_a?(Hash)\n validates_presence_of(*args)\n end",
"def validate_can_assign_auction_date\n if self.ready_for_auction? && \n (self.auction_datum.blank? || (self.auction_datum.present? && self.auction_datum.auction_date.blank? )) &&\n self.service_orders.joins(:service_order_details).where(\"service_order_details.status=? AND service_orders.priority=?\", ServiceOrder::SO_STATUS_APPROVED, ServiceOrder::SO_PRIORITY_HIGH).count > 0\n self.errors.add(:\"auction_datum.auction_date\", I18n.t(\"models.vehicle.errors.service_order_must_be_completed\"))\n end\n end",
"def validate_event_selection\n\t\tunless self.event\n\t\t\tself.errors.add(:event, 'must be chosen.')\n\t\tend\n\tend",
"def validate\n assert_present :source_target_id\n assert_present :source_target_class\n assert_present :dest_target_id\n assert_present :dest_target_class\n assert_present :source_entity_id\n end",
"def validate_presence_and_not_in_future(attribute)\n validate_presence(attribute, :blank)\n validate_not_in_future(attribute)\n end",
"def validate(composite_object)\n # Get the hash value from the composite object\n return if composite_object.hash.key?(@key)\n\n # Do unless_presence_of check\n if @unless_presence_of\n return if composite_object.hash.key?(@unless_presence_of)\n end\n\n error_messages.push(\"Required Key Missing: #{@key}, at: #{composite_object.location}.\")\n end",
"def use_event_attributes?; end",
"def validate\n if (start_date > end_date || (start_date == end_date && start_time >= end_time))\n errors.add(\"end_date\", I18n.t(\"tog_conclave.fields.errors.end_date_before_start_date\"))\n end\n loc = gg.locate self.venue_address rescue nil\n #errors.add(\"venue_address\", I18n.t(\"tog_conclave.fields.errors.venue_address_error\")) if loc.nil?\n end",
"def validate_build\n end",
"def given_an_existing_cancelled_event_instance\n test_instance = Fabricate.create(:event_instance, cancelled: true)\n\n @event_date = test_instance.date\n @event_name = test_instance.event.name\n end",
"def validate\n super\n end",
"def test_invalid_with_empty_attributes\r\n fee_schedule = FeeSchedule.new\r\n assert !fee_schedule.valid?, fee_schedule.errors.full_messages\r\n assert fee_schedule.errors.invalid?(:start_date)\r\n assert fee_schedule.errors.invalid?(:end_date)\r\n end",
"def bom_event_params\n params.require(:bom_event).permit(:event)\n end",
"def validate \n#\tfirst check whether combo fields have been selected\n\t is_valid = true\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:vessel_code => self.vessel_code}],self)\n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_vessel\n\t end\nend",
"def ensure_valid_event\n next_event = Event.sorted.where(\"event_at > ? \", self.event_at_was).first\n previous_event = Event.sorted.where(\"event_at < ? \", self.event_at_was).last\n if next_event && self.event_at > next_event.event_at\n self.errors.add(:event_at, \"exceeded with next event\")\n elsif previous_event && self.event_at < previous_event.event_at\n self.errors.add(:event_at, \"becomes older with the previous event\")\n end\n end",
"def valid?\n return false if @id.nil?\n return false if @id !~ Regexp.new(/^bck_[a-zA-Z0-9]+$/)\n return false if @auto_reorder.nil?\n return false if @threshold_amount.nil?\n return false if @url.nil?\n return false if @url.to_s.length > 2083\n return false if @url.to_s.length < 1\n return false if @raw_url.nil?\n return false if @raw_url.to_s.length > 2083\n return false if @raw_url.to_s.length < 1\n return false if @front_original_url.nil?\n return false if @front_original_url.to_s.length > 2083\n return false if @front_original_url.to_s.length < 1\n return false if @back_original_url.nil?\n return false if @back_original_url.to_s.length > 2083\n return false if @back_original_url.to_s.length < 1\n return false if @thumbnails.nil?\n return false if @available_quantity.nil?\n return false if @allocated_quantity.nil?\n return false if @onhand_quantity.nil?\n return false if @pending_quantity.nil?\n return false if @projected_quantity.nil?\n return false if @buckslip_orders.nil?\n return false if @buckslip_orders.length < 0\n return false if @stock.nil?\n stock_validator = EnumAttributeValidator.new('String', [\"text\", \"cover\"])\n return false unless stock_validator.valid?(@stock)\n return false if @weight.nil?\n weight_validator = EnumAttributeValidator.new('String', [\"80#\"])\n return false unless weight_validator.valid?(@weight)\n return false if @finish.nil?\n finish_validator = EnumAttributeValidator.new('String', [\"gloss\", \"matte\"])\n return false unless finish_validator.valid?(@finish)\n return false if @status.nil?\n status_validator = EnumAttributeValidator.new('String', [\"processed\", \"rendered\"])\n return false unless status_validator.valid?(@status)\n return false if @object.nil?\n object_validator = EnumAttributeValidator.new('String', [\"buckslip\"])\n return false unless object_validator.valid?(@object)\n return false if @description.to_s.length > 255\n size_validator = EnumAttributeValidator.new('String', [\"8.75x3.75\"])\n return false unless size_validator.valid?(@size)\n true\n end",
"def create\n @bookmark = Bookmark.new(params[:bookmark])\n @bookmarkable = @bookmark.bookmarkable \n if @bookmarkable.new_record? && @bookmarkable.fandoms.blank?\n @bookmark.errors.add(:base, \"Fandom tag is required\")\n render :new and return\n end\n if @bookmark.errors.empty?\n if @bookmarkable.save && @bookmark.save\n flash[:notice] = ts('Bookmark was successfully created.')\n redirect_to(@bookmark) and return\n end\n end\n @bookmarkable.errors.full_messages.each { |msg| @bookmark.errors.add(:base, msg) }\n render :action => \"new\" and return\n end",
"def ensure_event_parameter?\n no_event_param_redirection unless !params[:event_id].nil? && !Event.find(params[:event_id]).nil?\n end",
"def validate \n#\tfirst check whether combo fields have been selected\n\t is_valid = true\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_rails_error\n\t end\nend",
"def save\n# if empty?\n# nil\n# else\n super\n# end\n end",
"def show\n @clubs = Club.where.not(id: @event.club_id)\n @curr_club = Club.where(id: @event.club_id).take\n @unshared_club ||= []\n @shared_club ||= []\n @clubs.each do |club|\n if !SharedEvent.exists?(:eventId => @event.id, :clubId => club.id)\n @unshared_club << club\n elsif SharedEvent.exists?(:eventId => @event.id , :clubId => club.id, :approved => true)\n @shared_club << club\n end\n end\n \n end",
"def validate_on_create\n errors.add(:circle, \"Invalid relationship\") unless @circle && @circle.valid?\n errors.add(:host, \"Could not determine the guest host\") unless self.current_host_id\n end",
"def validate\n validate_action\n validate_deliver_at\n validate_event_id\n\n super\n end",
"def create\n @bet_event = BetEvent.new(bet_event_params)\n\n respond_to do |format|\n if @bet_event.save\n format.html { redirect_to @bet_event, notice: 'Bet event was successfully created.' }\n format.json { render :show, status: :created, location: @bet_event }\n else\n format.html { render :new }\n format.json { render json: @bet_event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n @event = Event.new(params[:event])\n if @event.status_id.nil?\n @event.status_id = 10020\n end\n\n @event.description = @event.description.upcase\n @event.address = @event.address.upcase\n @event.suburb = @event.suburb.upcase\n @event.observations = @event.observations.upcase\n\n # @event.searchable = @event.searchable+ \" \" + @event.idstring\n if @event.searchable==nil\n @event.searchable = \" \"\n end\n if @event.analyst_id != nil\n @event.searchable = @event.searchable + \" \" + @event.analyst.analyst\n end\n if @event.description != nil\n @event.searchable = @event.searchable+ \" \"[email protected]\n end\n if(@event.address!=nil)\n @[email protected]+\" \"[email protected]\n end\n if @event.locality_id!=nil\n @[email protected]+\" \"[email protected]\n end\n if @event.area_id!=nil\n @[email protected]+\" \"[email protected]\n end\n if @event.crime_id!=nil\n @[email protected]+\" \"[email protected]\n end\n\n if @event.observations!=nil\n @[email protected]+\" \"[email protected]\n end\n respond_to do |format|\n if @event.save\n # UserMailer.event_registration(@event).deliver \n format.html { redirect_to @event, notice: 'Evento registrado exitosamente.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def validate_associations\n errors.add(:group_id, :doesnt_exist) if @group.nil?\n end",
"def valide?\n !association_invalide\n end",
"def validate \n#\tfirst check whether combo fields have been selected\n\t is_valid = true\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:short_description => self.short_description}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_organization\n\t end\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:rule_code => self.rule_code}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_rule\n\t end\nend",
"def admin_event_params\n # params.fetch(:admin_event, {:club_id,:event_id})\n params.require(:admin_event).permit(:event_id, :club_id)\n end",
"def foreign_key_present?\n false\n end",
"def foreign_key_present?\n false\n end",
"def update\n if Venue.find_by(name: params[:venue]) == nil\n @venue = Venue.create(name: params[:venue])\n else\n @venue = Venue.find_by(name: params[:venue])\n end\n \n @bands = []\n \n respond_to do |format|\n if @event.update(event_params)\n event_date_time = event_params[:start] + ' CST'\n @event.update(start: DateTime.strptime(event_date_time, '%m/%d/%Y %l:%M %p %Z'))\n \n if @venue.id != @event.venue.id\n @event.update(venue_id: @venue.id)\n end\n \n if params[\"removed_supporting-acts\"] != nil\n removed_supporting_acts = params[\"removed_supporting-acts\"]\n \n removed_supporting_acts.each do |index, name|\n name = name.strip\n unless name == \"\"\n if Band.find_by(name: name) != nil\n @band = Band.find_by(name: name)\n @event.bands.delete(@band)\n @event.supporting_acts.delete(@band.id)\n end\n end\n end\n end\n \n if params[\"removed_headliners\"] != nil\n removed_headliners = params[\"removed_headliners\"]\n \n removed_headliners.each do |index, name|\n name = name.strip\n unless name == \"\"\n if Band.find_by(name: name) != nil\n @band = Band.find_by(name: name)\n @event.bands.delete(@band)\n @event.headliners.delete(@band.id)\n end\n end\n end\n end\n \n if params[\"supporting_acts\"] != nil\n supporting_acts = params[\"supporting_acts\"]\n \n supporting_acts.each do |index, name|\n name = name.strip\n unless name == \"\"\n if Band.find_by(name: name) == nil\n @band = Band.create(name: name)\n @event.bands << @band\n else\n @band = Band.find_by(name: name)\n band_in_lineup = false\n @event.bands.each do |band|\n if band.id == @band.id\n band_in_lineup = true\n break\n end\n end\n if band_in_lineup == false\n @event.bands << @band\n end\n end\n end\n end\n \n @event.update(supporting_acts: [])\n supporting_acts.each do |supporting_act|\n supporting_acts = @event.supporting_acts.push(Band.find_by(name: supporting_act).id)\n @event.update(supporting_acts: supporting_acts)\n end\n end\n \n if params[\"headliners\"] != nil\n headliners = params[\"headliners\"]\n \n headliners.each do |index, name|\n name = name.strip\n unless name == \"\"\n if Band.find_by(name: name) == nil\n @band = Band.create(name: name)\n @event.bands << @band\n else\n @band = Band.find_by(name: name)\n band_in_lineup = false\n @event.bands.each do |band|\n if band.id == @band.id\n band_in_lineup = true\n break\n end\n end\n if band_in_lineup == false\n @event.bands << @band\n end\n end\n end\n end\n \n @event.update(headliners: [])\n headliners.each do |headliner|\n headliners = @event.headliners.push(Band.find_by(name: headliner).id)\n @event.update(headliners: headliners)\n end\n end\n \n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def event_params\n params.require(:event).permit(:title, :image, :image_cahe, :content, :date_start, :date_end, :organizer_id)\n end",
"def test_valid_with_attributes\r\n fee_schedule = FeeSchedule.new\r\n fee_schedule.start_date = fee_schedules(:fee_schedule_00001).start_date\r\n fee_schedule.end_date = fee_schedules(:fee_schedule_00001).end_date\r\n assert fee_schedule.valid?, fee_schedule.errors.full_messages \r\n end",
"def event_params\n params.require(:event).permit(:title, :description, :place_id, :category_id, :date, :start_time, :end_time, :address, :neighborhood, :website, :price, :purchase_url, :image, :short_blurb, :recurrence, :approved)\n end",
"def assert_model_valid(instance)\n instance.value_attributes_for_avro\n expect(instance).to be_valid\n end",
"def valid_attributes\n {\n name: \"Event Name\"\n }\n end",
"def validate_on_save(fields)\n end",
"def stores_foreign_key?; false; end",
"def stores_foreign_key?; false; end",
"def validate_start_and_end_date\n self.errors.add(:event_start_date, \"should not be in past\") if self.event_start_date < Date.today\n self.errors.add(:event_end_date, \"should not be in past\") if self.event_end_date < Date.today\n self.errors.add(:event_end_date, \"start date should not be after end date\") if self.event_end_date < self.event_start_date\n self.errors.add(:event_end_time, \"end time should not be before start time\") if (self.event_end_date == self.event_start_date and self.event_end_time < self.event_start_time)\n return self\n end",
"def event_params\n params.require(:event).permit(:name, :date, :comment, :club_id, :start_time, :end_time, :spaces_left, :all_groups)\n end",
"def model_valid?\n true\n end",
"def model_valid?\n true\n end",
"def event_params\n params.require(:event).permit(:event_title,:user_id, :host_id, :starts_at, :time_zone,:event_avatar)\n end",
"def validate_cover\n errors.add(:position, :cover_must_be_first_slide) if self.kind == COVER && self.position != 1\n errors.add(:position, :if_not_cover_cant_be_first_slide) if self.kind != COVER && self.position == 1\n end",
"def before_validation() \n #logger.info \"Tend: #{tend} // class: #{tend.class}\"\n self.published = true unless attribute_present?(\"published\") # pubblicato: yes\n self.starred = false unless attribute_present?(\"starred\") # starred: no\n #ric_change_parameter('starred',false)\n #self.birthday = Date.civil(1901,1,1) unless attribute_present?(\"birthday\") # compleanno 1gen1901\n self.nickname = _fake_nickname unless attribute_present?(\"nickname\") # i.e. 'rcarlesso'\n self.created_by ||= current_user.name rescue \"ModelCreatedBy: #{$!}\"\n self.updated_by = current_user.name rescue \"Probably Updated from shell and not from web: ''#{$!}''\"\n if (attribute_present?(\"organisation\") && ! attribute_present?(\"work_venue_id\") ) # --> autocreate workplace obj from string! Cool!\n self.work_venue = Venue.find_or_create_by_name(organisation.strip) rescue nil\n end\n if (attribute_present?(\"location\") && ! attribute_present?(\"venue_id\") ) # --> autocreate workplace obj from string! Cool!\n self.venue = Venue.find_or_create_by_name(location.strip) rescue nil\n end\n self.relevance = 42 unless attribute_present?(\"relevance\") # rilevanza 42\n # NON HO ACCESSO AL CURRENTUSER DA QUI! SOLO VIEW E CONTROLLER!!!\n #self.feed = \"Person:_:BeforeValidation(): person changed by ''#{@current_user rescue 'BOH'}'' on #{Time.now}\" unless attribute_present?(\"feed\") \n #self.nickname = self.nickname.nicknamize rescue nil # minuscolizza e toglie spazi\n self.email = self.email.strip if attribute_present?(\"email\")\n end",
"def create\r\n @timeline_event = TimelineEvent.find(timeline_event[:id]) || TimelineEvent.new(params[:timeline_event])\r\n @event = Event.find(timeline_event[:event_id])\r\n \r\n if @event.nil?\r\n # create event\r\n @event = Event.new(params[:event])\r\n @event.user = current_user\r\n @event.title = nil if @event.title.blank? # fix optional fields\r\n @event.finish = nil if @event.finish.blank?\r\n @event.save || raise(\"Could not save event #{@event}\")\r\n \r\n # # create source comment (if exists)... should have more explicit \r\n # if event_comment && !event_comment[:text].empty?\r\n # @event_comment = EventComment.new(event_comment)\r\n # @event_comment.event = @event\r\n # @event_comment.user = current_user\r\n # @event_comment.user_ip = request.remote_ip\r\n # @event_comment.save # validation required \r\n # end\r\n end \r\n \r\n # tie timeline entry to event\r\n @timeline_event.id = nil if @timeline_event.id.blank?\r\n @timeline_event.event = @event\r\n @timeline_event.interpretation = timeline_event[:interpretation]\r\n \r\n @timeline_event.save || raise(\"Could not save #{@timeline_event}: #{@timeline_event.errors.join(', ')}\")\r\n \r\n @timeline = @timeline_event.timeline\r\n redirect_to resource(@timeline.user, @timeline, :cue => @event.id), :message => { :notice => 'Updated your event entry' }\r\n end",
"def validate\n super\n validates_presence :account\n validates_unique :account\n end",
"def create\n @event = Event.new(params[:event])\n\n @album = Album.new\n @album.name = @event.name\n @album.save\n @event.album_id = @album.id\n\n respond_to do |format|\n if @event.save\n current_user.has_role!('owner', @event)\n flash[:notice] = 'Event was successfully created.'\n format.html { redirect_to(@event) }\n format.xml { render :xml => @event, :status => :created, :location => @event }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @event.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def validate!\n raise ActiveRecord::RecordInvalid.new(self) unless valid?\n end",
"def validate \n#\tfirst check whether combo fields have been selected\n\t is_valid = true\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:commodity_code => self.commodity_code},{:rmt_variety_code => self.rmt_variety_code}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_rmt_variety\n\t end\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:season_code => self.season_code},{:id => self.id}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_season\n\t end\n\t#validates uniqueness for this record\n\t if self.new_record? && is_valid\n\t\t validate_uniqueness\n\t end\nend",
"def has_event?(event_model)\n\t bound_events.has_key?(event_model)\n\tend",
"def event_params\n params.require(:past_event).permit(:year, :image_url, :content, :date)\n end",
"def create\n @running_back = RunningBack.new(running_back_params)\n\n respond_to do |format|\n if @running_back.save\n format.html { redirect_to @running_back, notice: 'Running back was successfully created.' }\n format.json { render :show, status: :created, location: @running_back }\n else\n format.html { render :new }\n format.json { render json: @running_back.errors, status: :unprocessable_entity }\n end\n end\n end",
"def valid_event(event, args)\n true\n end",
"def test_invalid_cobrand\r\n @moderated_search.cobrand_id = 9999999999999\r\n @moderated_search.save\r\n \r\n assert @moderated_search.errors.size == 0\r\n assert @moderated_search.cobrand == Cobrand.root\r\n end"
] | [
"0.5585754",
"0.5544094",
"0.55144995",
"0.54895747",
"0.5472289",
"0.5365731",
"0.52832",
"0.5274019",
"0.52270144",
"0.5223512",
"0.52057874",
"0.5194643",
"0.51891303",
"0.5173412",
"0.5173412",
"0.5171043",
"0.5141908",
"0.5123797",
"0.5115794",
"0.5089242",
"0.50845104",
"0.50788283",
"0.5071368",
"0.50556123",
"0.5055413",
"0.5054248",
"0.5039452",
"0.50351465",
"0.5033818",
"0.50288695",
"0.49820733",
"0.4978447",
"0.4978042",
"0.49619845",
"0.49462235",
"0.4923272",
"0.49214193",
"0.49166042",
"0.4910875",
"0.48969483",
"0.48702028",
"0.4870062",
"0.48642057",
"0.48581275",
"0.48561984",
"0.48461044",
"0.48447743",
"0.48375967",
"0.4833529",
"0.48250863",
"0.4823756",
"0.48232913",
"0.4817218",
"0.48087403",
"0.4806182",
"0.48012438",
"0.47965273",
"0.47955877",
"0.47797692",
"0.4777529",
"0.47748357",
"0.4771493",
"0.4769645",
"0.47660342",
"0.47637194",
"0.47630128",
"0.4754299",
"0.4739278",
"0.4737372",
"0.47287598",
"0.47214407",
"0.47206295",
"0.47171426",
"0.47152373",
"0.47152373",
"0.47146946",
"0.47037706",
"0.4700994",
"0.46974254",
"0.46968722",
"0.4695341",
"0.4692493",
"0.46860307",
"0.46860307",
"0.4680298",
"0.46747416",
"0.467238",
"0.467238",
"0.46711564",
"0.4670713",
"0.466683",
"0.46649447",
"0.46594092",
"0.46566868",
"0.46559927",
"0.4654006",
"0.46509415",
"0.46476832",
"0.4644444",
"0.46368986",
"0.4635115"
] | 0.0 | -1 |
=================================================================== Methods below operate on a single user only | def changed_activity_size?(key)
ua = activity(key)
size_before = ua.size
yield(key, ua)
size_after = activity(key).size
(size_before > size_after)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user\n return Ecore::User.anybody if @user_id == Ecore::User.anybody.id\n return Ecore::User.everybody if @user_id == Ecore::User.everybody.id\n u = Ecore::User.find_by_id(@user_id)\n u = Ecore::Group.find_by_id(@user_id) unless u\n u\n end",
"def user\n batch_load_one(object.user_id, 'User')\n end",
"def get_user \n\t\treturn User.find(self.user_id)\n\tend",
"def user; end",
"def user; end",
"def call \n user\n end",
"def set_user\n @user = User.find(params[:id])\n\n return if unauthorized_local_access(@user.uo_id)\n end",
"def user\n user_id.get_object\n end",
"def user\n Webmetrics.users.find_one('_id' => id)\n end",
"def user; User.find_by_id(user_id); end",
"def set_user; end",
"def user\n User.where(id: object.user_id)[0]\n end",
"def user\n user ||= User.find(self.user_id)\n end",
"def user\n end",
"def user\n User.find_by_id self.user_id \n end",
"def user\n User.get user_id || User.new\n end",
"def user\n raise NotImplementedError\n end",
"def user?\n get_mode == :user\n end",
"def user\n UserRepository.find(user_id)\n end",
"def user\n @user ||= User.find(user_id)\n end",
"def user\n\t\tfalse\n\tend",
"def user\n User.find_by(id: self.object.user_id)\n end",
"def get_user_id\n if current_user\n @user = User.find(current_user.id)\n end\nend",
"def user\n if users.size == 1\n users.first\n else\n nil\n end\n end",
"def user?(user)\n user.id == self.user_id if user\n end",
"def user\n User.load(self.user_id)\n end",
"def user\n User.find(self[:user_id])\n end",
"def user_method\n current_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 user?(user)\n self.user_id == user.id if user\n end",
"def reuse\n nil unless User.safe_find(params[:id]) == User.current\n end",
"def allow_user(user_id)\n create_entry(user_id, USER, true)\n end",
"def modify_user \n logger.info(\"-------------------Called modyfy user with id: \"+params[:id])\n @user = User.find(params[:id])\n end",
"def admit_user user_id = nil\n return if is_global\n if (tagtype != 0) || user_id.nil? || (user_id == User.super_id)\n self.is_global = true\n elsif !owner_ids.include?(user_id) && (user = User.find_by id: user_id)\n self.owners << user unless owners.include?(user)\n end\n end",
"def user_check(id)\n check_user = User.find(id)\n if check_user != current_user\n flash[:notice] = \"You can only modify your own user information.\"\n redirect_to user_path(user)\n end\n end",
"def user_id; 1; end",
"def is_this_user\n\t\[email protected] == current_user.id\n\tend",
"def is_potential_user?\n\t\ttrue\n\tend",
"def set_user_and_verify #TODO: Make this common to both items and tags\n @user = User.find_by(id: params[:user_id])\n if @user.blank?\n head :forbidden\n end\n end",
"def is_user?\n user ? true : false\n end",
"def set_user_id\n User.stats.limit(2).each do |user|\n self.user_id = user['id']\n\n # prevents us from setting back to the same user\n if self.changes['user_id'][0] != self.changes['user_id'][0]\n break\n end\n end\n end",
"def check_user_id\n if self.user_id.nil?\n set_user_id\n end\n end",
"def user_check(id)\n check_user = User.find(id)\n if check_user != current_user\n flash[:notice] = \"You can only modify your own user information.\"\n redirect_to user_path(check_user)\n end\n end",
"def user\n @user\n end",
"def user\n return unless user_id && user_type\n return @user if instance_variable_defined?('@user')\n\n @user = user_type.constantize.find_by(id: user_id)\n end",
"def user\n if user_id\n super\n else\n billable_to.owner # always a User\n end\n end",
"def user\n return User.current unless user_id\n user = User.get_from_cache(user_id)\n user || User.first({:id => user_id})\n end",
"def true_user\n @impersonated_user || current_user\n end",
"def require_user\n end",
"def true_user\n @impersonated_user || current_user\n end",
"def call\n user\n end",
"def set_user\n @user = User.where(:username => params[:id]).first!\n end",
"def user\r\n return @user\r\n end",
"def user\n @user ||= ::User.find_by(id: user_id)\n end",
"def applies_to?(user); false end",
"def fetch_user(user_id)\n ActionAlexa.config.current_user_hook.call(user_id)\n end",
"def user?(user)\n user.blank? and return false\n unless user.is_a?(UserInfo) # user is supposed to be given by its id.\n user = UserInfo.find(user.to_i)\n end\n user.is_a?(UserInfo) \n end",
"def get_user(item)\n\t\t@user = User.find_by_id(item.user.id)\n\tend",
"def system_user\n # By convention, the first user is always the system user.\n User.find_by_id(1)\n end",
"def user_id\n self.user.id unless user.nil?\n end",
"def user_id\n raise \"Implement in Client or Advocate\"\n end",
"def this_user\n return nil unless session[:user_id].present?\n\n @this_user || @this_user = User.where(id: session[:user_id]).first\n end",
"def user\n @user = User.find_by(id: params[:user_id]) || render_404\n end",
"def user\n object.user\n end",
"def update_user\n end",
"def set_user\n #@user = User.find(params[:id])\n @user = User.where(:id => params[:user_id]).first\n end",
"def is_user_specific?\n false\n end",
"def user_by_id(user_id)\n Egi::Fedcloud::Vmhound::Log.debug \"[#{self.class}] Picking user ID #{user_id.inspect} from pool\"\n users.select { |user| user[:id] == user_id.to_i }.first\n end",
"def user\n self.class == User ? self : super\n end",
"def correct_user\n #to define the correct user and omit it when edit and update\n @user=User.find(params[:id])\n redirect_to(root_path) unless current_user?(@user)\n end",
"def get_user_to_act_on\n @user = session[:user]\n end",
"def get_user_to_act_on\n @user = session[:user]\n end",
"def set_user\n @user = current_agent.users.where('users.username = ?', params[:id]).first\n end",
"def user\n\t\tif current_user.account_type != Account.roles[:user]\n\t\t\tredirect_to root_url\n\t\tend\n\tend",
"def fetch_user(id)\n client.user(id)\n end",
"def set_user\n #@user = User.friendly.find(params[:id])\n \n \n end",
"def user\n # 自インスタンスのuser_idの値に紐付くuserインスタンスを戻り値として返す\n return User.find(self.user_id)\n end",
"def find_user\n @user = current_user\n end",
"def find_user\n @user = current_user\n end",
"def set_user\n # @user = User.find(params[:id])\n @user = User.find_by_sql(['SELECT \"users\".* FROM \"users\" WHERE \"users\".\"id\" = ? LIMIT 1', params[:id]])[0]\n end",
"def set_user\n @user = User.where(params[:user_id]).take\n render json: {'user' => 'NOT_FOUND'} unless @user\n end",
"def identify_the_user\n \t@current_user = User.find_by_id(session[\"user_id\"])\n end",
"def call\n context.user = User.find_by_telegram_id(context.telegram_user.id)\n return if context.user\n\n context.is_new_user = true\n context.user = User.create(\n telegram_id: context.telegram_user.id,\n )\n end",
"def first_user\n users.first\n end",
"def user\n @user ||= User.find(\n params[:user_id] ) # needs to raise exception if user not found\n end",
"def user_on\n session[:user_id] = '3980284084'\n end",
"def set_user\n if self.current_user and self.current_user.name == 'admin'\n @user = User.find(params[:id])\n else\n @user = User.find(current_user.id)\n end\n end",
"def accessible_for?(user)\n user_id == user.id && !user.anonimous?\n end",
"def user\n return @user\n end",
"def user\n return @user\n end",
"def current_user(id = session[:user_id])\n User.get_one id\n end",
"def update_user\n\t\tunless current_user.id == @prototype.user.id\n\t\t\tredirect_to root_path\n\t\tend\n\tend",
"def view\n\t\trequest_user(params[:id])\n\tend",
"def current_user_id\n 1\n end",
"def owner\n User.find_by(id: user_id)\n end",
"def correct_user\n \t@user = User.where(id: params[:id]).to_a[0]\n\tunless current_user?(@user) or current_user.admin?\n\t\tredirect_to root_path, notice: \"You are not allowed to do that.\"\n\tend\n end",
"def user\n find_user params._id\n end",
"def user_id\n self.user.id\n end",
"def user_id\n return @user_id\n end",
"def user_id\n return @user_id\n end"
] | [
"0.7146153",
"0.7093401",
"0.7023578",
"0.7009504",
"0.7009504",
"0.69656473",
"0.6944301",
"0.69233346",
"0.69117355",
"0.6887864",
"0.6844914",
"0.6843428",
"0.68005615",
"0.67848104",
"0.6769001",
"0.6748009",
"0.6747496",
"0.6745792",
"0.67348593",
"0.67271584",
"0.6724492",
"0.6715578",
"0.67090756",
"0.6680084",
"0.6654819",
"0.6645159",
"0.6645044",
"0.66076297",
"0.65966135",
"0.65966135",
"0.65966135",
"0.6579628",
"0.65745306",
"0.65675586",
"0.6545228",
"0.65348756",
"0.6525827",
"0.65174264",
"0.65097845",
"0.6508688",
"0.6501159",
"0.6489153",
"0.6487379",
"0.6486455",
"0.64828867",
"0.64800525",
"0.6475378",
"0.6471978",
"0.646421",
"0.64637625",
"0.6463157",
"0.64551556",
"0.6454343",
"0.6447682",
"0.6440723",
"0.64330125",
"0.642109",
"0.6419431",
"0.6417888",
"0.64163774",
"0.6411646",
"0.64084625",
"0.64036167",
"0.63966584",
"0.6394555",
"0.63936585",
"0.63905376",
"0.6386386",
"0.6385339",
"0.63833827",
"0.6380447",
"0.6378698",
"0.6378698",
"0.63709706",
"0.6369473",
"0.635721",
"0.6354493",
"0.6348926",
"0.63478637",
"0.63478637",
"0.63298386",
"0.63265085",
"0.6324325",
"0.6318459",
"0.6317945",
"0.6315217",
"0.631027",
"0.6308707",
"0.6300108",
"0.6296292",
"0.6296292",
"0.62953085",
"0.6294244",
"0.6293911",
"0.6289512",
"0.6288646",
"0.62849414",
"0.6284931",
"0.6283718",
"0.6282026",
"0.6282026"
] | 0.0 | -1 |
:all: By default, some changes are not displayed. When displaying details for a single change, set :all=>true to display all changes. :show_all_tags: Show unchanged tags. | def get_default_field_options
@default_field_options ||= {
:suppress_fields => []
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_tags\n tag_list = \"\"\n self.tags.each do |t|\n tag_list << \"#{t.name} \"\n end\n tag_list\n end",
"def all\n @hash_tags\n end",
"def all_tags\n applied_tags + @tags\n end",
"def all_tags\n applied_tags + @tags\n end",
"def show_edits!\n\t\treturn unless self.edited?\n\t\tself.edits.each do |k, v|\n\t\t\tnext if @@not_tracked.include? k\n\t\t\tself.send(\"#{k}=\", v)\n\t\tend\n\tend",
"def all_tags\n self.tags.map(&:name).join(\", \")\n end",
"def all_tags\n self.tags.map(&:name).join(\", \")\n end",
"def all_tags\n self.tags.map(&:name).join(\", \")\n end",
"def display_all display_all\n @options[:all] = booleanize 'DisplayAll', display_all\n self\n end",
"def all\n Tag.all.map{|t| \"#{t.tag} \"}\n end",
"def index\n @changes = Change.all\n end",
"def visible_changes\n changes.select {|key, (from, to)| (from.present? || to.present?) && (from.to_s != to.to_s) }\n end",
"def all_tags\n\t\ttags.map(&:name).join(\", \")\n\tend",
"def return_all_tags\n @tags.uniq.each { |tag| puts tag }\n end",
"def show_changes\n if error.blank?\n if changes.length == 0\n error_block(\"No changes for #{defect_name}\")\n else\n build_html do\n c_enum = changes.to_enum\n div.defect do\n describe_defect_changes(c_enum)\n end\n end\n end\n else\n error_block(error)\n end\n end",
"def command_showAll\n entries = @log.get_entries()\n entries.each { |i|\n puts i.to_s\n }\n end",
"def changed? tag=false\n if tag\n @changed_values.include? tag\n else\n !@changed_values.empty?\n end\n end",
"def complete_tags\n\n end",
"def tags; end",
"def tags; end",
"def tags; end",
"def tags; end",
"def tags; end",
"def log_tags; end",
"def log_tags; end",
"def log_tags; end",
"def showAll()\n\t\tlogs = @log.sort\n\t\tputs \"******************LOG****************OLD\\n\"\n\t\tlogs.each { |date,item| printDate(date)\t} \n\t\tputs \"******************LOG END************NEW\\n\"\n\n\tend",
"def show_all\n begin\n @model.start_operation \"Show all layers and entities\"\n puts \"Showing all layers and entities...\" if @debug\n @layers.each { |l|\n puts \"\\tMaking layer '#{l}' visible...\" if @debug\n l.visible = true\n }\n @entities.each { |e|\n # If the entity is a Group or Component, test if it is frozen.\n if e.is_a? Sketchup::Group or e.is_a? Sketchup::ComponentInstance\n if not e.visible? and e.locked?\n puts \"\\t'#{e}' is hidden and locked, do no show it...\" if @debug\n else\n puts \"\\tMaking '#{e}' entity visible...\" if @debug\n e.visible = true\n end\n else\n puts \"\\tMaking '#{e}' entity visible...\" if @debug\n e.visible = true\n end\n }\n @model.commit_operation\n rescue Exception => e\n puts \"Error encountered: #{e}\" # Show even if debuggnig is off.\n @model.abort_operation\n end\n end",
"def run_all\n run_on_changes\n end",
"def show\n @change = @priority.changes.find(params[:id])\n @page_title = t('changes.show.title', :priority_name => @priority.name)\n for a in @change.activities.find(:all, :conditions => \"type in ('ActivityCapitalAcquisitionProposal','ActivityPriorityMergeProposal')\")\n @activity = a\n end\n if @activity\n @activities = @change.activities.active.by_recently_updated.find(:all, :conditions => \"id <> #{@activity.id.to_s}\").paginate :page => params[:page], :per_page => params[:per_page]\n else\n @activities = @change.activities.active.by_recently_updated.paginate :page => params[:page], :per_page => params[:per_page]\n end\n @vote = nil\n\t\t@vote = @change.votes.find_by_user_id(current_user.id) if logged_in?\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @change.to_xml(:include => [:user, :priority, :new_priority], :except => NB_CONFIG['api_exclude_fields']) }\n format.json { render :json => @change.to_json(:include => [:user, :priority, :new_priority], :except => NB_CONFIG['api_exclude_fields']) } \n end\n end",
"def cmd_changed\n print_tree(ChangedEditor, nil, true)\n end",
"def all\n @tb_actions[:all]\n end",
"def changes\n @changes ||= Set.new\n end",
"def changes\n @changes ||= Set.new\n end",
"def all()\n merge(all: 'true')\n end",
"def all\n @tags.keys\n end",
"def all\n @tags.keys\n end",
"def all_tags\n each_with_object([]) do |entry, tags|\n tags.concat(entry.tags).sort!.uniq!\n end\n end",
"def tags!\n @tags = nil\n tags\n end",
"def all_tags(test_case)\n test_case.tags + test_case.feature.tags\n end",
"def add_tags\n self.tag_list = 'bug, feature, improvement, feedback, discussion, help'\n end",
"def description; raw_changeset.description; end",
"def index\n\t\t@tags = Tag.all\n end",
"def logall(user)\n self.changes.each do |key, value|\n if key != \"updated_at\" then\n name = self.class.name + \" #{key}\"\n \n logthis(user, name, self.id, value[0], value[1])\n end\n end\n end",
"def changes\n poll(\"Changes\")\n end",
"def all\n end",
"def log_changes(changes, prev_tag)\n if ( changes[:simp_core].empty? &&\n changes[:assets].empty? &&\n changes[:modules].empty? )\n puts( \"No changes found for any components since SIMP #{prev_tag}\")\n else\n require 'pager'\n include Pager\n page\n\n separator = '='*80\n puts\n puts separator\n puts \"Comparison with SIMP #{prev_tag}\"\n [:simp_core, :assets, :modules].each do |section|\n changes[section].sort_by { |key| key}.each do |component_name, info|\n puts <<~EOM\n #{separator}\n #{component_name}:\n Current version: #{info[:current_version]} Previous version: #{info[:previous_version]}\n CHANGELOG diff:\n #{info[:changelog_diff].strip.gsub(/^/,' ') + \"\\n\"}\n Git Log\n #{info[:git_log_output].strip.gsub(/^/,' ') + \"\\n\"}\n EOM\n end\n\n puts\n end\n end\n end",
"def retrieve_tags\n # noop\n end",
"def changed_tags\n @changed_values.keys.map { |key| MiniExiftool.original_tag(key) }\n end",
"def changes\n additions + deletions\n end",
"def all\n\n end",
"def index\n @working_changes = WorkingChange.all\n end",
"def visive_tags\n Tagging.visive_tags(self.tags)\n end",
"def index\n @has_tags = HasTag.all\n end",
"def index\n @tags = ActsAsTaggableOn::Tag.order(:name).all\n end",
"def show\n @tagname = params[:id].to_s\n @tags = Tag.name_is(@tagname).descend_by_updated_at.reject {|r| !r.tagable.read_allowed?(current_user) }.paginate(\n :page => params[:page], :per_page => POSTINGS_PER_PAGE)\n @tagables = @tags.map { |t| \n t.tagable\n }.sort { |b,a| a.updated_at <=> b.updated_at }\n end",
"def tags\n ['any'] + @tags\n end",
"def tags\n ['any'] + @tags\n end",
"def all_changes_in_revisions array\n raise NotImplementedError.new('Define method :all_changes_in_revisions on your source control.')\n end",
"def index\n @changes = Change.find(:all, :conditions => [\"priority_id = ? or new_priority_id = ?\",@priority.id,@priority.id], :order => \"updated_at desc\").paginate :page => params[:page], :per_page => params[:per_page]\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @changes.to_xml(:include => [:user, :priority, :new_priority], :except => NB_CONFIG['api_exclude_fields']) }\n format.json { render :json => @changes.to_json(:include => [:user, :priority, :new_priority], :except => NB_CONFIG['api_exclude_fields']) } \n end\n end",
"def all_tags\n tags.map(&:title).join(\", \")\n end",
"def show\n @tags = @dataset.tags_on(:tags).map { |tag| tag.id }\n @apps = @dataset.apps.find(:all, :conditions => ['is_published = ?', true])\n respond_to do |wants|\n wants.html # show.html.erb\n wants.xml { render :xml => @dataset }\n end\n end",
"def show\n @tags = @stack.tags\n @tools = @stack.tools\n end",
"def unset_all_tags\n @deployment.servers_no_reload.each do |s|\n # can't unset ALL tags, so we must set a bogus one\n s.tags = [{\"name\"=>\"removeme:now=1\"}]\n s.save\n end\n end",
"def all\n \n end",
"def all\n @what = :all\n self\n end",
"def test_tags_include_all_filter_tags?(test_tags)\n (@filter_tags - test_tags).empty?\n end",
"def show_all\n\t\[email protected]_all\n\tend",
"def index\n @tags = Tag.all\n end",
"def show\n\t @tags = @posts.tags\n end",
"def inspect\n \"#<Changeset #{to_s}>\"\n end",
"def changes_as_html\n res = []\n type = resource_type_attribute\n\n self.changes.each do |name, values|\n # we don't care if the id changes, only value\n next if name !=\"value\"\n \n old_value = values[0]\n new_value = values[1]\n \n str = \"<strong>#{ h(type.name.humanize) }</strong>: \"\n str += \"#{ h(old_value) }\"\n if type.is_password?\n str += \" changed to a new password.\"\n else\n str += \" -> #{ h(new_value) }\"\n end\n \n res << str\n end\n \n return res\n end",
"def changed\n _find_changed_twins!(@_changes)\n\n @_changes\n end",
"def index\n @mytags = Mytag.all\n end",
"def index\n #@tags = Tag.all\n end",
"def all; end",
"def show\n @songtags = @song.tags.collect{ |t| t.name }\n\tend",
"def changelog\n log = []\n method_name = \"changelog_format_#{ options[:format] }\"\n method_name = \"changelog_format_default\" unless internal_respond_to?(method_name)\n driver = driver(options[:mask])\n driver.all_version_tags.each_with_index do |tag, index|\n break if options[:top] && index >= options[:top]\n log << send(method_name, tag, driver.version_tag_info(tag))\n end\n puts log.join(\"\\n\\n\")\n end",
"def all\n @disabled\n end",
"def description\n @tags.map { |tag| tag.to_s.capitalize }.join(\", \")\n end",
"def get_all_tags\n print \"Fetching tags...\\r\" if @options[:verbose]\n\n check_github_response { github_fetch_tags }\n end",
"def print_change(el)\n show\n add(el)\n show\n end",
"def index\n @change_functions = ChangeFunction.all\n end",
"def show\n @hooks = Hook.all\n end",
"def index\n @buildchecktags = Buildchecktag.all\n end",
"def display_all_fields\n @@all_fields\n end",
"def show\n @display_all = (params[:display] == \"all\")\n end",
"def index\n @admin_tags = Tag.not_deleted.order(:name)\n end",
"def index\n @tags = Tag.all\n end",
"def index\n @tags = Tag.all\n end",
"def index\n @tags = Tag.all\n end",
"def index\n @tags = Tag.all\n end",
"def index\n @tags = Tag.all\n end",
"def index\n @tags = Tag.all\n end",
"def index\n @tags = Tag.all\n end",
"def git_tags\n git(\"log --tags --simplify-by-decoration --pretty='format:%ai %d'\")\n # TODO: fix\n end",
"def all\n active + inactive\n end",
"def all\n requires :zone\n\n data = service.list_changes(zone.identity).to_h[:changes] || []\n load(data)\n rescue ::Google::Apis::ClientError => e\n raise e unless e.status_code == 404\n []\n end",
"def changes\n if @changes\n @changes.dup\n else\n []\n end\n end",
"def all\n @filters\n end",
"def describe_changes_within_release(enum)\n change = enum.peek\n span \"Product #{change.release} [#{change.level}]\"\n ul.release do\n list_changes_within_release(enum)\n end\n end"
] | [
"0.6068189",
"0.5835069",
"0.5793695",
"0.5793695",
"0.5748019",
"0.5729484",
"0.5729484",
"0.5729484",
"0.5679866",
"0.56776476",
"0.5649279",
"0.5610532",
"0.55468595",
"0.5502811",
"0.54731995",
"0.5470918",
"0.5423929",
"0.5377756",
"0.53773457",
"0.53773457",
"0.53773457",
"0.53773457",
"0.53773457",
"0.5357825",
"0.5357825",
"0.5357825",
"0.533262",
"0.5303571",
"0.529424",
"0.52872586",
"0.527716",
"0.5247623",
"0.5246253",
"0.5246253",
"0.5245753",
"0.5243743",
"0.5243743",
"0.52369463",
"0.5235072",
"0.5232667",
"0.52226734",
"0.5219163",
"0.52072686",
"0.5196398",
"0.519274",
"0.5191631",
"0.5187801",
"0.5172173",
"0.5165943",
"0.51573366",
"0.51538193",
"0.5144218",
"0.5138944",
"0.51376885",
"0.5119867",
"0.51127154",
"0.5112099",
"0.5112099",
"0.51070607",
"0.5100859",
"0.5093881",
"0.50874394",
"0.5087306",
"0.5084017",
"0.50759095",
"0.5070119",
"0.50666946",
"0.50591433",
"0.50562835",
"0.50519305",
"0.5050788",
"0.50504297",
"0.50416887",
"0.504089",
"0.50363874",
"0.50348574",
"0.502503",
"0.50146234",
"0.5009789",
"0.50047624",
"0.49934936",
"0.49906",
"0.4981471",
"0.498122",
"0.4979093",
"0.49775752",
"0.4971295",
"0.49712372",
"0.49684092",
"0.49684092",
"0.49684092",
"0.49684092",
"0.49684092",
"0.49684092",
"0.49684092",
"0.4955309",
"0.49457702",
"0.4945195",
"0.4934321",
"0.4918214",
"0.49141848"
] | 0.0 | -1 |
yield more than two numbers | def yielder(number)
puts "_________"
(1..number).each do |x|
while x<5 do
puts x
x=x+1
end
end
yield
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def multiples(number1, number2, range1, range2)\n (range1...range2).select { |value| value % number1 == 0 || value % number2 == 0 }.reduce(:+)\nend",
"def looping_by_multi_2( num )\n\n result = 1\n\n while( result < num )\n result *= 2\n puts( result )\n end\n\nend",
"def random_numbers\n\tputs \"Follow are two random numbers between 0 and 100\"\n\tyield rand(100), rand(100)if block_given?\nend",
"def pares(num1, num2)\n (num1..num2).each do |par|\n puts par if par.even?\n end\nend",
"def multiple_of_three_and_five(limit)\r\n (3...limit).select { |number| number % 3 == 0 || number % 5 ==0 }.inject(:+)\r\nend",
"def many_results(n)\r\n\treturn 1, n /2, n\r\nend",
"def natural_method(limit, number_multiple1, number_multiple2)\n\tarray = []\n\t(1..limit).each do |number|\n\t\tif (number % number_multiple1 == 0) || (number % number_multiple2 == 0)\n\t\t\tarray << number \n\t\tend\n\tend\n\tputs sum(array)\nend",
"def multisum2(number)\n 1.upto(number).select { |num| num % 3 == 0 || num % 5 == 0 }.reduce(:+)\nend",
"def count_by_x (num1, num2)\n array = (num1..num1 * num2).to_a\n\n array.select do |num|\n num % num1 == 0\n end\nend",
"def test_multiples_of_two_are_not_prime\n mults_of_two = (4..100).step(2).to_a\n \n mults_of_two.each do |x|\n assert_equal(false, @primes_container.is_prime?(x), \"#{x} caused failure\")\n end\n end",
"def even_numbers_less_than num\n\t(0...num).select do |number|\n\t\tnumber.even?\n\tend\nend",
"def num(num1, num2)\n (num1..num2).each do |i|\n puts i if i.even?\n end\nend",
"def collect_multiples\n (1..@limit).select{|num| num%3 == 0 || num%5 == 0}\n end",
"def better_solution_to_multiples\n set.to_a.combination(2) do |number, number1|\n remainder = TOTAL - number - number1\n\n if set.include?(remainder)\n puts remainder * number * number1\n break\n end\n end\n end",
"def collect_multiples(limit)\n numbers = (1..limit-1).to_a\n result= numbers.select do |num|\n num % 5 == 0 || num %3 == 0\n end\n# binding.pry\n result\nend",
"def collect_multiples(limit)\n (1...limit).select {|e| e%3 == 0 || e%5 ==0}\nend",
"def two(a, b)\n for i in a..b\n puts i if a.even?\n a += 1\n end\nend",
"def test_next_statement\n i = 0\n result = []\n while i < 10\n i += 1\n next if (i % 2) == 0\n result << i\n end\n assert_equal (1..10).step(2).to_a, result\n end",
"def find_it(seq)\n set_num = 0\n seq.each do |num|\n if seq.count(num) % 2 != 0\n set_num = num\n end\n end\n\n set_num\nend",
"def every_other_number\n number = 0\n while number < 100\n if number % 2 != 0\n puts number\n end \n number += 1\n end\nend",
"def powers_of_two(s)\n\tyield 1\n\ti = 2\n\twhile i < s\n\t\tyield i\n\t\ti = i * 2 \n\tend\nend",
"def multiples\n (1..999).select do |i|\n i % 3 == 0 || i % 5 == 0\n end\nend",
"def collect_multiples(limit)\n array=*(1...limit)\n array.select {|num| num % 3 == 0 || num % 5 ==0}\nend",
"def every_other\n i = 1\n numbers = []\n 50.times do\n numbers << i\n i+= 2\n end\n return numbers\nend",
"def triangle_num\n gen = triangle_numbers\n loop do \n return gen.peek if get_divisors(gen.peek).count > 500\n gen.next\n end\nend",
"def times()\n i = 0\n \n @minimum.times do |i|\n yield( i + 1, @element, true )\n end\n \n if @maximum.nil? then\n while true\n i += 1\n yield( i + 1, false )\n end\n elsif @maximum > @minimum\n @minimum.upto(@maximum-1) do |i|\n yield( i + 1, false )\n end\n end\n \n return true\n end",
"def collect_multiples(limit)\n #numbers = [1..(limit-1)]\n multiple_numbers = []\n (1..(limit-1)).map do |number|\n if number % 3 == 0 || number % 5 == 0\n multiple_numbers << number\n end\n end\n multiple_numbers\nend",
"def next_number(n)\n\t\t(n).map{|n|n+2}\n\tend",
"def two_times\n yield\n yield\nend",
"def multiples(num)\n (1...num).select { |n| n % 3 == 0 || n % 5 == 0 }.inject(:+)\nend",
"def multiples_x(number, multiple)\n current_multiple = multiple\n multiples = []\n\n while current_multiple <= number\n multiples << current_multiple\n current_multiple += multiple\n end\n\n multiples\nend",
"def multiple()\n\tresult = 0\n\t\tfor i in 1...1000\n\t\t\tif i%3 == 0 || i%5 == 0\n\tresult += i\n\t\t\tend\n\t\tend\n\treturn result\nend",
"def make_picky_generator(start, factor, multiples_of)\n Enumerator.new do |y|\n start = start\n loop do\n result = (start * factor) % 2_147_483_647\n y << result if (result % multiples_of).zero?\n start = result\n end\n end\nend",
"def damepares(n1, n2)\n (n1..n2).each do |i|\n puts i if i.even?\n end\nend",
"def sum_multiples(n1,n2,limit)\n sum = 0\n for i in 1...limit\n sum+= i if(i%n1 == 0 or i%n2 == 0)\n end \n sum\nend",
"def run_block_with_next\n numbers = []\n\n (1..20).each do |number|\n next if number.odd?\n numbers << number\n end\n\n numbers\nend",
"def each_number_to( number )\r\n\r\n index = 0\r\n while index < number\r\n yield(index)\r\n index += 1\r\n end\r\n\r\nend",
"def more(values)\n \tnew_numbers = values.reject { |n| n >= 5 }\n end",
"def sample_number_with_excess(sample_number:)\n sample_number < 15 ? sample_number + 1 : sample_number + 2\n end",
"def even_nums(max)\n print (0..max).step(2).to_a\nend",
"def collect_multiples(num)\n range = (3...num)\n multiples = []\n range.each do |num|\n if num % 3 == 0 || num % 5 == 0\n multiples << num\n end\n end\n multiples\nend",
"def sequence(n1, n2)\n\n arr = []\n counter = 1\n \n while n1 >0\n loop do \n arr << n2 * counter\n counter +=1\n break if counter > n1\n end\n break\n end\narr\nend",
"def even_num(num)\n num.each do |element|\n if(element %2 == 1)\n p element\n end\n end\nend",
"def collect_multiples(limit)\n (1...limit).to_a.select{|i| i % 3 == 0 || i % 5 == 0}\nend",
"def test2(limit)\n\ttotal = 0\n\t2.upto(limit) do |x|\n\t\tif isPrime(x) then total += x end\n\tend\n\ttotal \nend",
"def each_odd num\n \tnum.select {|x| x % 2 != 0} \n end",
"def collect_multiples(number)\n \n numbers = Array.new(number - 1, 0)\n count = 0\n while count < numbers.length \n numbers[count] = count + 1\n count += 1\n end\n\n numbers.select do |element|\n element % 3 == 0 || element % 5 == 0\n end\n\nend",
"def multisum(limit)\n multiples = []\n\n for num in 1..limit\n multiples << num if num % 3 == 0 || num % 5 == 0\n end\n\n multiples.inject(:+)\nend",
"def try_two\n (5000..9999).map do |n|\n concat_product(n, 2)\n end.select {|cp| pandigital cp }\nend",
"def sum_multiple(limit, * numbers )\n (2..limit).to_a.find_all{ |x| numbers.any? {|n| x % n == 0 or x % n == 0} }.reduce(:+)\nend",
"def least_common_multiple(num_1, num_2)\n multiple = 1\n multiple += 1 until multiple % num_1 == 0 && multiple % num_2 == 0\n multiple\nend",
"def multisum(number)\n (1..number).select { |multiple| multiple % 3 == 0 || multiple % 5 == 0 }.inject(:+)\nend",
"def two\n\tyield 1, 2\nend",
"def multiples(input)\n (1..input).select { |num| (num % 3).zero? || (num % 5).zero? }.reduce(:+)\nend",
"def multiples(n)\n (1...n).select do |num|\n num if (num % 3).zero? || (num % 5).zero?\n end.reduce(:+)\nend",
"def times(num)\n counter = 0\n while counter < num\n # yield(counter)\n yield(counter) if block_given?\n counter += 1\n end\n\n num\nend",
"def multisum(limit)\n nums = []\n 1.upto(limit) { |num| nums << num if (num % 3 == 0 || num % 5 == 0)}\n nums.sum\nend",
"def pick_two (numbers, answer, solution)\n return if numbers.length < 2 # Terminate if unable to pick\n for i in 0..numbers.length-1\n for j in i+1..numbers.length-1\n remaining = numbers.clone #remaining elements\n b = remaining.delete_at(j) #delete j first so i is unaffected\n a = remaining.delete_at(i)\n # Since answer must be positive, we enforce a > b\n pick_op([a,b].max, [a,b].min, remaining, answer, solution)\n end\n end \nend",
"def multiple_sum(num1, num2, maxvalue)\n multiples = []\n\n for num in 1...maxvalue\n if num % num1 == 0 || num % num2 ==0\n multiples << num\n end\nend\n puts multiples.inject{|sum,x| sum + x }\n\nend",
"def odd_numbers(num1, num2)\n (num1..num2).select { |n| n.odd? }\nend",
"def collect_multiples(limit)\n 1.upto(limit-1).find_all do |i| #limit-1 so it takes range from 1 upto limit, excluding limit (so if limit is 10, range will be 1-9)\n (i % 5 == 0) || (i % 3 == 0)\n end #end loop\nend",
"def magic_numbers(count)\nend",
"def sum_multiples2(numbers, mutiple)\n sum = 0\n for num in numbers\n if num % mutiple == 0\n sum += num\n end\n end\n sum\nend",
"def OddNumbers()\n\tputs (1..255).find_all {|i| i % 2 != 0 }\nend",
"def add_two(number)\n return number.next.next\nend",
"def find_pairs_and_multiples\n set.each do |number|\n corresponding_number = TOTAL - number\n next unless set.include?(corresponding_number)\n\n puts corresponding_number * number\n break # as we only need the first pair\n end\n end",
"def multisum(num)\n numbers = (1..num).to_a\n multiples = numbers.select { |element| element % 3 == 0 || element % 5 == 0 }\n multiples.inject(:+)\nend",
"def test(a1, a2)\n if a1 > a2\n puts 'Ingrese los numeros correctamente: N1 debe ser menor a N2'\n else\n while a1 <= a2\n puts \"El numero: #{a1} es par\" if a1.even?\n a1 += 1\n end\n end\nend",
"def two\n first = 1\n second = 2\n third = 0\n acc = second #initialized to first even term\n begin\n third = first + second\n if third > 4000000\n break\n end\n puts third\n if third%2 == 0\n acc+=third\n end\n first = second\n second = third\n end while true\n acc\nend",
"def problem2(num)\n f = [1,2]\n f.push(f[-2..-1].reduce(:+)) until f[-1] >= num\n f.select{|n| n.even?}.reduce(:+)\nend",
"def multiples\n\t\t#select all numbers from 3-999 using iterator i...\n\t\t(3..999).select do |i|\n\t\t\t#...that are divisible by 3 or divisible by 5\n\t\t\ti%3 == 0 || i%5 == 0\n\t\tend\n\tend",
"def double(n)\n yield(n)\nend",
"def collect_multiples(limit)\n multiples = []\n (1...limit).each do |num|\n multiples << num if (num % 3 == 0 || num % 5 == 0)\n end\n return multiples\nend",
"def problem_two\n\tfirst_num = 1 #Let first number be 1\n\tsecond_num = 1 #we need this to make 2nd num\n\tsum = 0\n\twhile sum < 4000000\n\t\tfirst_num, second_num = second_num, first_num + second_num\n\t\tif first_num.even?\t\n\t\t\tsum += first_num\t\n\t\tend\n\tend\n\tsum\nend",
"def even_numbers_less_than num\n\t(0...num).reduce [] do |evens, number|\n\n\t\tif number%2 == 0\n\t\t\tevens.push number\n\t\tend\n\n\t\tevens\n\tend\nend",
"def collect_multiples(limit)\n (1...limit).to_a.reject {|num| num unless num % 3 == 0 || num % 5 == 0}\nend",
"def collect_multiples(limit)\n multiples = []\n numbers = (1..limit.to_i-1).to_a\n numbers.each do |i|\n if i % 3 == 0 || i % 5 == 0\n multiples.push(i)\n end\n end\n multiples \nend",
"def iter\n f1,f2,k = 1,1,2\n f1,f2,k = f2,f1+f2,k+1 while f2.to_s.size < 1000\n puts k\nend",
"def select_every_n merp, val=1\n merp.select.with_index {|item, index| item if index%val == 0 }\nend",
"def each\n loop do\n @next += (@next % 10 == 3) ? 4 : 2\n yield @next\n end\n end",
"def check_even? (a,b)\n (a..b).each { |i| puts i if i.even? }\n (b..a).each { |i| puts i if i.even? }\nend",
"def least_common_multiple(num_1, num_2)\n value = [num_1, num_2].max\n while (value % num_1 != 0) || (value % num_2 != 0)\n value += 1\n end\n return value\nend",
"def slippery_numbers(n)\nend",
"def sum_multiples1(numbers, mutiple)\n numbers\n .reject{ |n| n % mutiple > 0}\n .reduce(:+)\nend",
"def collect_multiples(limit)\n array = []\n (1...limit).each do |num|\n array << num if (num % 3 == 0) || (num % 5 == 0)\n end\n array\nend",
"def odd_not_prime(num)\n # code here\n (1..num).step(2).to_a.select { |i| !is_prime?(i) }.count\n\nend",
"def find_it(seq)\n #your code here\n seq = seq.sort\n ans = []\n seq.each do |num|\n if seq.count(num) % 2 != 0\n return num\n end\n\n end\nend",
"def even_nums(max)\n result = []\n\tfor i in 0..max\n \tif i % 2 == 0 \n result << i\n end\n end\n return result\nend",
"def multisum(num)\n arr = [*1..num]\n multiples_3_5 = arr.select{ |ele| ele % 3 == 0 || ele % 5 == 0}\n multiples_3_5.sum\nend",
"def double(n)\n yield n\nend",
"def loop_with_next\n numbers = []\n counter = 0\n\n while counter < 20\n counter += 1\n next if counter.even?\n numbers << counter\n end\n\n numbers\nend",
"def entero(num1, num2)\n (num1..num2).each do |i|\n puts i if (i % 2).even?\n end\nend",
"def least_common_multiple(num_1, num_2)\n number = 1\n while ((number % num_1 != 0) || (number % num_2 != 0))\n number +=1\n end\n number\nend",
"def times(num)\n counter = 0\n\n while counter < num\n yield(counter)\n counter += 1\n end\n\n num\nend",
"def goldbach_list(range)\n range.select { |n| n % 2 == 0 }. map { |n| goldbach(n) }\nend",
"def multiples_of_3_and_5(number)\n (1...number).select{|num| num % 3 == 0 || num % 5 == 0}.inject(:+)\nend",
"def multisum(number)\n multiples = (1..number).select do |num|\n num % 3 == 0 || num % 5 == 0\n end\n\n multiples.inject(:+)\nend",
"def calculated(number)\n (2..(number/2)).each { |i| return i if number%i == 0 }\n number\nend",
"def test(m,n,&block)\n\tif (m > 20000)\n\t\treturn\n\tend\n\n\tyield(m,n)\n\ttest(2*m - n, m, &block)\n\ttest(2*m + n, m, &block)\n\t#if (n != 1)\n\t#test(m + 2*n, n, &block)\n\t#end\nend",
"def least_common_multiple(num_1, num_2)\n match = false \n n = 0\n while !match \n n += 1\n if n % num_1 == 0 && n % num_2 == 0\n match = true \n end \n end \n n \n\nend",
"def multiples_of(number, upTo)\n result = Array.new\n (0..upTo).step(number) do |n|\n result << n\n end\n puts result.inspect\n result\nend"
] | [
"0.6627067",
"0.64697886",
"0.646002",
"0.64106214",
"0.64034605",
"0.6347632",
"0.62985533",
"0.6283758",
"0.6234302",
"0.6209411",
"0.6182586",
"0.6175896",
"0.616859",
"0.61605",
"0.61551344",
"0.61245704",
"0.6124051",
"0.6115012",
"0.6086649",
"0.6085838",
"0.60847616",
"0.60821074",
"0.60791403",
"0.60729533",
"0.6072611",
"0.60721123",
"0.60707366",
"0.6067177",
"0.6061738",
"0.6056567",
"0.60469663",
"0.60378253",
"0.6034115",
"0.6033277",
"0.60319465",
"0.60174435",
"0.60154116",
"0.59973204",
"0.5994072",
"0.59816843",
"0.5972869",
"0.59723645",
"0.59597874",
"0.5959433",
"0.59526515",
"0.59514403",
"0.5947514",
"0.59458333",
"0.59409523",
"0.5924138",
"0.5914483",
"0.59099835",
"0.5907158",
"0.59014446",
"0.58942276",
"0.5892784",
"0.58875054",
"0.58840805",
"0.5883843",
"0.5874611",
"0.5867772",
"0.5862438",
"0.58619493",
"0.5860268",
"0.58591765",
"0.58555174",
"0.58465314",
"0.5846122",
"0.58363426",
"0.58267754",
"0.5824978",
"0.58220667",
"0.5820108",
"0.58175784",
"0.5814859",
"0.5814834",
"0.5813016",
"0.5811494",
"0.580509",
"0.5796076",
"0.57941926",
"0.57924426",
"0.5792099",
"0.57914656",
"0.5791352",
"0.5790472",
"0.5783772",
"0.5779249",
"0.57781374",
"0.5777636",
"0.5775973",
"0.57749045",
"0.5774331",
"0.57718927",
"0.57692534",
"0.5758476",
"0.57570547",
"0.5756044",
"0.57549685",
"0.57547486",
"0.5743474"
] | 0.0 | -1 |
Given a hash with numeric values, return the key for the smallest value | def key_for_min_value(name_hash)
smallest_val = 0
smallest_key = 0
comp = nil
name_hash.each do |key,val|
comp = val
if smallest_key == 0
smallest_key = key
smallest_val = val
end
if comp < smallest_val
smallest_val = comp
smallest_key = key
end
end
if smallest_key == 0
return nil
else
return smallest_key
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def key_for_min_value(hash)\n lowest_key = nil\n lowest_value = Float::INFINITY\n hash.each do |key, value|\n if value < lowest_value\n lowest_value = value\n lowest_key = key\n end\n end\n lowest_key\nend",
"def key_for_min_value(hash)\n lowest_key = nil\n lowest_value = Float::INFINITY\n hash.each do |k, v|\n if v < lowest_value\n lowest_value = v\n lowest_key = k\n end\n end\n lowest_key\nend",
"def key_for_min_value(hash)\n smallest_value = nil\n smallest_key = nil\n hash.each do |name, num|\n if smallest_value == nil || num < smallest_value\n smallest_value = num\n smallest_key = name\n end\n end\n smallest_key\nend",
"def key_for_min_value(hash)\n min_val = Float::INFINITY\n min_key = nil\n hash.each do |key, value|\n if value < min_val\n min_val = value\n min_key = key\n end\n end\n min_key\nend",
"def key_for_min_value(hash)\n \n min_val = Float::INFINITY\n min_key = nil\n hash.each do |k, v|\n if min_val > v\n min_val = v\n min_key = k\n end\n end\n return min_key\nend",
"def key_for_min_value(hash)\n smallest_key = nil\n tiny_value = nil\n hash.each do |key, value|\n if tiny_value == nil || value < tiny_value\n tiny_value = value\n smallest_key = key\n end\n end\n smallest_key\nend",
"def key_for_min_value(hash)\n smallest = nil\n key = nil\n hash.collect do |name, val|\n if smallest == nil || val < smallest\n smallest = val\n key = name\n end\n end\n key\nend",
"def key_for_min_value(hash)\n int_hash = hash.select { |key, val| val.class == Fixnum }\n smallest = int_hash[int_hash.keys.sample]\n # debugger\n int_hash.each do |key, val|\n if val < smallest\n smallest = val \n end\n end\n int_hash.key(smallest)\nend",
"def key_for_min_value(hash)\r\n smallest_key = nil\r\n tiniest_value = nil\r\n hash.each do |key, value|\r\n if tiniest_value == nil || value < tiniest_value\r\n tiniest_value = value\r\n smallest_key = key\r\n end\r\n end\r\n smallest_key\r\nend",
"def key_for_min_value(hash)\n lowest_key = nil\n lowest_value = 0\n\n\n hash.each do |key,value|\n if lowest_value == 0 || value < lowest_value\n lowest_value = value\n lowest_key = key\n end\n end\n lowest_key\nend",
"def key_for_min_value(hash)\n min = nil\n hash.each_pair do |key, value|\n min ||= value\n min = value if value < min\n end\n hash.key(min)\nend",
"def key_for_min_value(hash)\n smallest = nil\n hash.each do |key, value|\n if smallest == nil\n smallest = key\n end\n if hash[key] < hash[smallest]\n smallest = key\n end\n end\n smallest\nend",
"def key_for_min_value(hash)\n lowest_key = nil\n lowest_value = nil\n hash.each do |k, v|\n if lowest_value == nil || v < lowest_value\n lowest_value = v\n lowest_key = k\n end\n end\n lowest_key\nend",
"def key_for_min_value(hash)\n lowest_key = nil\n lowest_value = nil\n hash.each do |k, v|\n if lowest_value == nil || v < lowest_value\n lowest_value = v\n lowest_key = k\n end\n end\n lowest_key\nend",
"def key_for_min_value(hash)\n smallest_key = nil\n tiniest_value = nil\n hash.each do |key, value|\n if tiniest_value == nil || value < tiniest_value\n \n # this way, the smallest value in the hash so far always overwrites the existing tiniest value\n \n tiniest_value = value\n smallest_key = key\n end\n end\n smallest_key\nend",
"def key_for_min_value(hash)\n hash_key = nil\n hash_value = nil\n hash.each do |key, value|\n if hash_value == nil || value < hash_value\n hash_value = value\n hash_key = key\n end\n end\n hash_key\nend",
"def key_for_min_value(hash)\n min_key = nil\n hash.each do |key, value|\n if min_key.nil?\n min_key = key\n elsif value < hash[min_key]\n min_key = key\n else\n next\n end\n end\n min_key\nend",
"def key_for_min_value(hash)\n min_key = nil\n hash.each do |key, value|\n if min_key.nil?\n min_key = key\n elsif value < hash[min_key]\n min_key = key\n else\n next\n end\n end\n min_key\nend",
"def key_for_min_value(hash)\n min = 99999999\n min_key = nil\n hash.select do |key, value|\n if value < min\n min = value\n min_key = key\n end\n end\n min_key\nend",
"def key_for_min_value(hash)\n if hash.empty?\n return nil\n end\n ans = [hash.first[0],hash.first[1]]\n hash.each do |k,v|\n if v < ans[1]\n ans[1] = v\n ans[0] = k\n end\n end\n return ans[0]\nend",
"def key_for_min_value(hash)\n key = nil\n lowest_value = nil\n hash.each do |name, value|\n if lowest_value == nil || value < lowest_value\n lowest_value = value\n key = name\n end\nend\nkey\nend",
"def key_for_min_value(hash)\n hash_key = nil\n hash_value = nil\n hash.each do |a, b|\n if hash_value == nil || b < hash_value\n hash_value = b\n hash_key = a\n end\n end\n hash_key\nend",
"def key_for_min_value(hash)\n lowest_key = nil\n lowest_value = nil \n hash.each do |key, value|\n if lowest_value == nil || value < lowest_value \n lowest_value = value \n lowest_key = key \n end\n end\n lowest_key\nend",
"def key_for_min_value(name_hash)\n lowestnum = 1000\n name_hash.each_value do |hashvalue|\n if hashvalue < lowestnum\n lowestnum = hashvalue\n end\n end\n name_hash.index(lowestnum)\nend",
"def key_for_min_value(name_hash)\n lowest_key = nil\n lowest_number = nil\n name_hash.each do |name, number|\n if lowest_number == nil || number < lowest_number\n lowest_number = number\n lowest_key = name\n end\n end\n lowest_key\nend",
"def key_for_min_value(hash)\n lowest_key = nil\n lowest_value = nil\n hash.each do |k,v|\n # first iteration\n ## this creates a starting point for comparison\n if lowest_value == nil || lowest_value > v\n lowest_value = v\n lowest_key = k\n end\n end\n lowest_key\nend",
"def key_for_min_value(name_hash)\n low = Float::INFINITY\n name_hash.each do |k,v|\n if v < low\n low = v\n end\n end\n name_hash.key(low)\nend",
"def key_for_min_value(hash)\n small_key = nil\n small_value = nil\n \n hash.each do |key, value|\n if small_value == nil || value < small_value\n small_value = value\n small_key = key\n end\nend\nsmall_key\nend",
"def key_for_min_value(hash)\n low_min = 1000\n min_key = nil\n hash.each do |key, value|\n if(low_min > value)\n low_min = value\n min_key = key\n end\nend\n min_key\nend",
"def key_for_min_value(name_hash)\n lowest = nil\n key = nil\n if name_hash.length == 0\n return \n end\n \n name_hash.each do |name, number|\n if lowest == nil\n lowest = number\n end\n if key == nil\n key = name\n end\n if number < lowest\n lowest = number\n key = name\n end\n end\n key\nend",
"def key_for_min_value(hash)\n least_value = nil \n least_key = nil\n hash.each do |a, b|\n if least_value == nil || b < least_value\n least_value = b\n least_key = a\n end\n end\n least_key\nend",
"def key_for_min_value(name_hash)\n\tif name_hash == {}\n\t\tnil\n\tend\n\n\tsmallest_key = nil\n\tsmallest_value = nil\n\tname_hash.each do |key, value|\n\t\tif !smallest_value || value < smallest_value\n\t\t\tsmallest_key = key\n\t\t\tsmallest_value = value\n\t\tend\n\tend\n\tsmallest_key\nend",
"def key_for_min_value(name_hash)\n lowest_key = nil\n lowest_value = Float::INFINITY\n name_hash.each do |name, amount|\n if amount < lowest_value\n lowest_value = amount\n lowest_key = name\n end\n end\n lowest_key\n end",
"def key_for_min_value(hash)\n i = 0\n lowest1 = :key\n lowest = 0\n if hash.empty? == true \n return nil\n end\n hash.each do |name, value|\n if i == 0\n lowest1 = name\n lowest = value\n i =+ 1\n end\n if value < lowest\n lowest1 = name\n lowest = value\n end\n if hash.empty? == true \n lowest1 = nil\n end\n end\n lowest1\nend",
"def key_for_min_value(hash)\n lo_key = nil \n lo_value = nil \n hash.each do |k,v| \n if lo_key == nil || v < lo_value\n lo_key = k \n lo_value = v \n end \n end \n lo_key\n end",
"def key_for_min_value(hash)\n\n lowest_key = nil \n lowest_value = nil \n \n hash.each do |key,value|\n if lowest_value == nil || lowest_value > value\n\n lowest_key = key\n lowest_value = value \n end \n \n end \n lowest_key\nend",
"def key_for_min_value(name_hash)\n small_num = Float::INFINITY\n smallest_key = \"\"\n if name_hash.length == 0\n return nil\n end\n name_hash.each do |key, value|\n if value < small_num\n small_num = value\n smallest_key = key\n end\n end\nsmallest_key\nend",
"def key_for_min_value(hash)\n value_only_array = []\n hash.each_pair do |key, value|\n value_only_array << value\n end\n value_only_array.sort!\n hash.key(value_only_array[0])\nend",
"def key_for_min_value(hash)\n return nil if hash.empty?\n arr = hash.collect {|key, value| value}.sort\n hash.each {|key, value| return key if value == arr[0]}\nend",
"def key_for_min_value(hash)\n array = []\n hash.each do |key, value|\n array << value\n end\n array.sort!\n hash.key(array[0])\nend",
"def key_for_min_value(name_hash)\n lowest_key=nil\n lowest_value=Float::INFINITY\n name_hash.each{|key, value| \n if value<lowest_value\n lowest_value=value\n lowest_key=key\n end\n }\n lowest_key\nend",
"def key_for_min_value(name_hash)\n empty_hash = nil\n lowest_value = 10000000000000000000000\n name_hash.collect do |name, value|\n if value < lowest_value\n lowest_value = value\n empty_hash = name\n end\n end\n empty_hash\nend",
"def key_for_min_value(name_hash)\n lowest = \"\"\n lowest = nil if name_hash.empty?\n high_num = 100000000000000000\n name_hash.each do | key, value |\n lowest = key if value < high_num\n high_num = value if value < high_num\n end\n lowest\nend",
"def key_for_min_value(name_hash)\n lowest_key = nil\n lowest_value = nil\n name_hash.each do |name, num|\n if lowest_key == nil || num < lowest_value\n lowest_key = name\n lowest_value = num\n elsif name_hash == nil\n nil\n end\n end\n lowest_key\nend",
"def key_for_min_value(name_hash)\n num = nil\n name_hash.collect do |key, value|\n if value < num\n num = value\n end\n end \n name_hash.key(num)\nend",
"def key_for_min_value(name_hash)\n smallest_val = 0\n smallest_key = nil\n name_hash.each do|key, val|\n if smallest_val == 0 || val < smallest_val\n smallest_val = val\n smallest_key = key\n end\n end\n smallest_key\n\nend",
"def key_for_min_value(name_hash)\n smallest_hash_key = nil\n name_hash.each do |key, val|\n if smallest_hash_key == nil\n smallest_hash_key = key\n next\n elsif val < name_hash[smallest_hash_key]\n smallest_hash_key = key\n end\n end\n smallest_hash_key\nend",
"def key_for_min_value(name_hash)\n return nil if name_hash.empty?\n lowest_number = name_hash.first[1];\n key_value = \"\"\n name_hash.each do |key, value|\n if value <= lowest_number\n lowest_number = value\n key_value = key\n end\n end\n key_value\nend",
"def key_for_min_value(hash)\n if hash.count < 2\n return hash[0]\n else \n num = 42\n hash.each do |key, value|\n if value <= num\n num = value\n end\n end\n hash.invert[num] \n end\nend",
"def key_for_min_value(name_hash)\n current = 0\n lowest = 0\n lowest_key = nil\n name_hash.collect do |key, value|\n current = value\n if current < lowest || lowest == 0\n lowest = current\n lowest_key = key\n end\n\n end\n lowest_key\nend",
"def key_for_min_value(name_hash)\n lowest_key = nil\n lowestvalue = 1000\n name_hash.each do |name, value|\n if value < lowestvalue\n lowest_key = name\n lowestvalue = value\n end\n end\n lowest_key\nend",
"def key_for_min_value(name_hash)\n small_value = 10000000000\n small_key = nil\n name_hash.each do |k,v|\n if v < small_value\n small_value = v\n small_key = k\n end\n end\n small_key\nend",
"def key_for_min_value(hash)\n lowest_value = nil\n lowest_key = nil\n\n hash.each do |key, value|\n if lowest_value == nil # tell me if this makes sense\n lowest_value = value\n lowest_key = key\n elsif lowest_value > value\n lowest_value = value\n lowest_key = key\n end\n end\n lowest_key #you want to return the key for min\nend",
"def key_for_min_value(name_hash)\n low_key = nil\n low_value = nil\n name_hash.each do |k, v|\n if low_value == nil || v < low_value\n low_value = v\n low_key = k\n end\n end\n low_key\n end",
"def key_for_min_value(hash)\n \n if hash.empty?\n return nil\n end\n min_value=500\n min_key=:symbol\n \n hash.each do |key, value|\n if value<min_value\n min_value=value\n min_key=key\n end\n end\n return min_key\nend",
"def key_for_min_value(name_hash)\n lowestKey = nil\n lowestValue = Float::INFINITY\n name_hash.each do |k, v|\n if v < lowestValue\n lowestValue = v\n lowestKey = k\n end\n end\n lowestKey\n\nend",
"def key_for_min_value(name_hash)\n lowest_key=nil\n lowest_val=0\n name_hash.collect do |key,value|\n if value<lowest_val or lowest_val==0\n lowest_key=key\n lowest_val=value\n end\n end\n lowest_key\nend",
"def key_for_min_value(name_hash)\n smallest = nil\n this_num = 0\n previous_num = 1000000\n name_hash.collect { |item, qty|\n this_num = qty\n if this_num < previous_num\n smallest = item\n previous_num = this_num\n end\n }\n smallest\nend",
"def key_for_min_value(name_hash)\n rkey = nil\n rvalue = 10000000000000000\n name_hash.each do |key, value|\n if value < rvalue\n rkey = key\n rvalue = value\n end\n end\n rkey\nend",
"def key_for_min_value(name_hash)\n\tsmallest_value = nil\n\tassociated_key = nil \n\tname_hash.collect do |key, value|\n\t\tif smallest_value == nil || value < smallest_value\n\t\t\tsmallest_value = value \n\t\t\tassociated_key = key\n\t \tend\n\tend\n\tassociated_key\nend",
"def key_for_min_value(hash)\n # binding.pry\n lowest_key = nil\n lowest_value = 0\n # binding.pry\n hash.each do |key, value|\n if lowest_key == nil || value < lowest_value\n # binding.pry\n lowest_value = value\n lowest_key = key\n # binding.pry\n end\n end\n lowest_key\nend",
"def key_for_min_value(hash)\n hash.key(hash.values.min)\nend",
"def key_for_min_value(hash)\n hash.key(hash.values.min)\nend",
"def key_for_min_value(name_hash)\n smallest_value = 100\n name_hash.each do |key, value| \n if value < smallest_value\n smallest_value = value \n end \n end\n name_hash.key(smallest_value)\nend",
"def key_for_min_value(name_hash)\n lowest=\"\"\n lowest=nil if name_hash.empty?\n tracker=100000000\n name_hash.each do |key,value|\n lowest=key if value<tracker\n tracker=value if value<tracker\n # if value<tracker\n end\n lowest\nend",
"def key_for_min_value(name_hash)\n if name_hash.length == 0 \n nil\n else\n smallest_num = nil\n smallest_num_key = nil\n name_hash.collect do |key, value|\n if smallest_num == nil\n smallest_num = value\n smallest_num_key = key\n elsif smallest_num > value\n smallest_num = value\n smallest_num_key = key\n end\n end\n smallest_num_key\n end\n\nend",
"def key_for_min_value(name_hash)\n low_key = nil\n low_value = nil\n name_hash.each do |n, s|\n if low_value == nil\n low_value = s\n low_key = n\n elsif low_value > s\n low_value = s\n low_key = n\n end\n end\n low_key\nend",
"def key_for_min_value(name_hash)\n return nil if name_hash == nil || name_hash == {}\n number_array = name_hash.collect do |name, number|\n number\n end\n number_array.sort!\n name_hash.key(number_array[0])\nend",
"def key_for_min_value(name_hash)\n lowest_v = nil\n lowest_k = nil\n name_hash.each do |name, value|\n if lowest_v == nil\n lowest_v = value\n lowest_k = name\n elsif value < lowest_v\n lowest_v = value\n lowest_k = name\n end\n end\n lowest_k\n end",
"def key_for_min_value(name_hash)\n lowestId = nil\n lowestNum = 0\n name_hash.each{ |id, val|\n if lowestNum == 0 \n lowestNum = val\n end\n if val <= lowestNum\n lowestNum = val\n lowestId = id\n end\n }\n return lowestId\nend",
"def key_for_min_value(name_hash)\n smallest_key = nil\n smallest_value = nil\n name_hash.each do |j, r|\n if smallest_value == nil || r < smallest_value\n smallest_value = r\n smallest_key = j\n end\n end\n smallest_key\nend",
"def key_for_min_value(name_hash)\nlowest = 1000000\n low_key = nil\n name_hash.each {|key, value|\n if value < lowest\n lowest = value\n low_key = key\n end\n }\n low_key\nend",
"def key_for_min_value(name_hash)\n lowest_key = nil\n name_hash.each_key do |key|\n if lowest_key == nil\n lowest_key = key\n elsif name_hash[key] < name_hash[lowest_key]\n lowest_key = key\n end\n end\n lowest_key\nend",
"def key_for_min_value(name_hash)\n\n if name_hash.empty?\n return nil\n end\n lowest = Float::INFINITY\n name_hash.each_pair do |k, v|\n if v < lowest\n lowest = v\n end\n end\n name_hash.each_pair do |k, v|\n if v == lowest\n return k\n end\n end\nend",
"def key_for_min_value(name_hash)\n output = 0\n smallest = nil\n name_hash.map do |key, value|\n if value < output || output == 0\n output = value\n smallest = key\n end\n end\n\n smallest\nend",
"def key_for_min_value(my_hash)\n #what is my value?\n lowest_value = 500\n lowest_key = nil\n\n my_hash.collect do |key, value|\n # what is my value?\n if value < lowest_value\n lowest_value = value\n lowest_key = key\n end\n end\n lowest_key\nend",
"def key_for_min_value(name_hash)\n lowest_num = 1000000000\n lowest_num_key = \" \"\n if name_hash == {}\n return nil\n else\n name_hash.each do |name, num|\n if num < lowest_num\n lowest_num = num\n lowest_num_key = name\n end\n end\n return lowest_num_key\n end\nend",
"def key_for_min_value(name_hash)\n nums = name_hash.collect do |item, num|\n num\n end\n nums.sort!\n nums[0]\n \n min_key = nil\n name_hash.map do |item, num|\n if num == nums[0]\n min_key = item\n end\n end\n min_key\nend",
"def key_for_min_value(name_hash)\n vals = name_hash.collect { |key, value| value }\n keys = name_hash.collect { |key, value| key }\n low = vals[0]\n lowkey = keys[0]\n if name_hash.empty?\n nil\n else\n name_hash.collect do |key, value|\n if value < low\n low = value\n lowkey = key\n end\n end\n lowkey\n end\nend",
"def key_for_min_value(name_hash)\n value1 = 0\n lowestKey = nil\n name_hash.each do |key, value|\n if(value1 == 0)\n value1 = value\n lowestKey = key\n end\n if(value1 > value)\n value1 = value\n lowestKey = key\n elsif (value1 < value)\n lowestKey = lowestKey\n value1 = value1\n end\n end\n return lowestKey\nend",
"def key_for_min_value(hash)\n return nil if hash.empty?\n arr = hash.collect { |k, v| v }.sort\n hash.each { |k, v| return k if v == arr[0] }\nend",
"def key_for_min_value(name_hash)\n # saves the smaller value in memo, and takes the first elem of memo at the end (the key)\n smallest = name_hash.inject do|memo, (k, v)|\n memo = v < memo[1] ? [k,v] : memo\n end\n #handle the empty hash case...\n smallest ? smallest[0] : nil\nend",
"def key_for_min_value(name_hash)\n key = \"\"\n low_value = nil\n if name_hash.empty? == true\n return nil\n end\n name_hash.each do |name, number|\n if low_value == nil || number < low_value\n low_value = number\n key = name\n end\n end\n key\nend",
"def key_for_min_value(name_hash)\n answer = nil\n smallest = nil\n name_hash.each {|key, value|\n if smallest.nil?\n smallest = value\n end\n if value <= smallest\n smallest = value\n answer = key\n end\n }\n answer\nend",
"def smallest_key(q, hash)\n\t\ttemp = {}\n\t\tq.each do |v|\n\t\t\ttemp[v] = hash[v]\n\t\tend\n\t\treturn temp.key(temp.each_value.min)\n\tend",
"def key_for_min_value(name_hash)\n lowest_value = 0\n lowest_key = \"\"\n if name_hash.empty? == true\n nil\n else\n name_hash.each_with_index do |(key, value), i|\n if i == 0\n lowest_value = value\n lowest_key = key\n elsif value < lowest_value\n lowest_value = value\n lowest_key = key\n end\n end\n lowest_key\n end\nend",
"def key_for_min_value(name_hash)\n low=10000000000000000000\n return_key=nil\n name_hash.each do |key, value|\n if value<low\n low=value\n return_key=key\n end\n end\n return_key\nend",
"def key_for_min_value(hash)\n if hash.length == 0\n return nil\n else\n smallest = 1000\n printme = \"\"\n hash.each do |thing, number|\n if number < smallest\n smallest = number\n printme = thing\n end\n end\n printme\n end\nend",
"def key_for_min_value(name_hash)\n \n lowest_key = nil\n lowest_value = nil\n name_hash.each do |name_key, name_value|\n if lowest_value == nil || name_value < lowest_value\n lowest_value = name_value\n lowest_key = name_key\n end\n end\n lowest_key\n \n end",
"def key_for_min_value(name_hash)\n the_key = nil \n the_value = 1/0.0\n # Infinity...can also be expressed as FLOAT::Infinity\n name_hash.each do |id, num|\n if num <= the_value\n the_value = num\n the_key = id\n end\n end\n the_key\nend",
"def key_for_min_value(hash)\n array = []\n hash.each {|key,value| \n if array.empty? || value < array[1] \n array[0] = key \n array[1] = value \n end }\n if !array.empty? \n array.first \n else \n nil \n end\nend",
"def key_for_min_value(name_hash)\n lowest_key = nil\n lowest_value = Float::INFINITY\n name_hash.each do |k,v|\n if v < lowest_value\n lowest_value = v\n lowest_key = k\n end \nend\nlowest_key\nend",
"def key_for_min_value(name_hash)\n return nil if name_hash == {}\n smallest_key = name_hash.first[0]\n smallest_val = name_hash.first[1]\n\n name_hash.each do |pair|\n if pair[1] < smallest_val\n smallest_key = pair[0]\n end\n end\n smallest_key\nend",
"def key_for_min_value(name_hash)\n smallest_value = Float::INFINITY\n key_for_smallest_val = nil\n name_hash.each do |key, value|\n if smallest_value > value\n smallest_value = value\n key_for_smallest_val = key\n end \n end \n key_for_smallest_val\nend",
"def key_for_min_value(name_hash)\n key_of_smallest_value = \"\"\n smallest_value = 99999\n name_hash.each do |key, value|\n if smallest_value > value\n smallest_value = value\n key_of_smallest_value = key\n end\n end\n if name_hash.size == 0\n key_of_smallest_value = nil\n end\n key_of_smallest_value\nend",
"def key_for_min_value(name_hash)\n minKey = nil\n minVal = 2 ** (64 - 2) - 1\n name_hash.each {|key, value|\n if value < minVal\n minVal = value\n minKey = key\n end}\n minKey\nend",
"def key_for_min_value(name_hash)\n if name_hash == {}\n return nil\n end\n lowest_number = nil\n name_hash.collect do |name, value|\n if lowest_number == nil\n lowest_number = value\n elsif lowest_number > value\n lowest_number = value\n end\n end\n \n name_hash.each do |name, value|\n if lowest_number == value\n return name\n end\n end\nend",
"def key_for_min_value(hash)\n min_value = hash.values.min\n keys = hash.collect do |key, num|\n \tkey if num == min_value\n end\n keys\nend",
"def key_for_min_value(name_hash)\n lowest_value = nil\n key_value = nil\n name_hash.collect do |name, number|\n if lowest_value == nil || number < lowest_value\n lowest_value = number\n key_value = name\n end\n end\n key_value\nend",
"def key_for_min_value(name_hash)\n smallest_value = 1/0.0\n key_of_smallest_value = nil\n name_hash.each do |key, value|\n if smallest_value > value\n key_of_smallest_value = key\n smallest_value = value\n end\n end\n return key_of_smallest_value\nend"
] | [
"0.88225716",
"0.87791526",
"0.87779355",
"0.87472314",
"0.8690887",
"0.8656373",
"0.8653365",
"0.8617534",
"0.85888296",
"0.85730934",
"0.8568526",
"0.85522825",
"0.8530813",
"0.8530813",
"0.8519404",
"0.84942126",
"0.84763813",
"0.84763813",
"0.8466587",
"0.845011",
"0.8449882",
"0.84364176",
"0.84337837",
"0.8430814",
"0.84286356",
"0.84101605",
"0.8389349",
"0.83694685",
"0.83575284",
"0.83530474",
"0.8346375",
"0.83449644",
"0.83293664",
"0.83293253",
"0.8327692",
"0.8326151",
"0.8321093",
"0.8317168",
"0.8313319",
"0.8313091",
"0.8305843",
"0.83019817",
"0.830102",
"0.8292273",
"0.8288486",
"0.82880354",
"0.82752323",
"0.8267294",
"0.82670337",
"0.8253328",
"0.8251015",
"0.82452005",
"0.8244996",
"0.8244832",
"0.8242297",
"0.8241824",
"0.8238087",
"0.822923",
"0.82275695",
"0.8221846",
"0.8219631",
"0.8214265",
"0.8214265",
"0.82112324",
"0.8210525",
"0.820672",
"0.820117",
"0.81992847",
"0.81970656",
"0.8196799",
"0.8194342",
"0.8187975",
"0.8187504",
"0.8186495",
"0.818432",
"0.81836563",
"0.8183281",
"0.81804746",
"0.8174315",
"0.81741214",
"0.81740814",
"0.8172967",
"0.81718314",
"0.81690854",
"0.8167151",
"0.8161529",
"0.816051",
"0.8159085",
"0.8158576",
"0.8154432",
"0.81541324",
"0.8153975",
"0.8153549",
"0.81524456",
"0.8152148",
"0.8151358",
"0.81470406",
"0.8143607",
"0.8142893",
"0.8142232"
] | 0.82392734 | 56 |
GET /backup def backup end POST /generate_backup | def generate_backup
if Export.launch_export!
current_user.update(
last_backup_at: Time.zone.now,
last_backup_entry_id: current_user.last_entry_id
)
redirect_to backup_succeeded_path
else
redirect_to backup_failed_path
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def backup_wallet\n client.make_request('/backup-wallet', 'post', params: {})\n end",
"def cmd_backup argv\n setup argv\n command = @hash['command']\n name = @hash['name']\n response = @api.backup(command, name)\n msg response\n return response\n end",
"def system_backup\n\n\n end",
"def backupwallet(destination)\n request(:backupwallet, destination)\n end",
"def backupwallet(destination)\n @api.request 'backupwallet', destination\n end",
"def create\n @backup = Backup.new(params[:backup])\n\n respond_to do |format|\n if @backup.save\n flash[:notice] = 'Backup was successfully created.'\n format.html { redirect_to(@backup) }\n format.xml { render :xml => @backup, :status => :created, :location => @backup }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @backup.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def bms_backup_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: VnfsApi.bms_backup ...'\n end\n # resource path\n local_var_path = '/bms/1.0.0/backup'\n\n # query parameters\n query_params = {}\n\n # header parameters\n 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 = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'backuprequest'])\n auth_names = ['oAuth2']\n data, status_code, headers = @api_client.call_api(:POST, local_var_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 :return_type => 'Backup')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: VnfsApi#bms_backup\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def make_backup\n print_title('Data backup')\n\n @backup_type ||= prompt.select('What type of backup do you want?',\n 'Full (redmine root and database)' => :full,\n 'Only database' => :database,\n 'Nothing' => :nothing)\n\n logger.info(\"Backup type: #{@backup_type}\")\n\n # Dangerous option\n if @backup_type == :nothing\n if prompt.yes?('Are you sure you dont want backup?', default: false)\n logger.info('Backup option nothing was confirmed')\n return\n else\n @backup_type = nil\n return make_backup\n end\n end\n\n @backup_root ||= prompt.ask('Where to save backup:', required: true, default: DEFAULT_BACKUP_ROOT)\n @backup_root = File.expand_path(@backup_root)\n\n @backup_dir = File.join(@backup_root, Time.now.strftime('backup_%d%m%Y_%H%M%S'))\n create_dir(@backup_dir)\n\n files_to_backup = []\n Dir.chdir(root) do\n case @backup_type\n when :full\n files_to_backup = Dir.glob(File.join('**', '{*,.*}'))\n end\n end\n\n if files_to_backup.any?\n files_to_backup.delete_if do |path|\n path.start_with?(*BACKUP_EXCLUDE_FILES)\n end\n\n @backup_package = File.join(@backup_dir, 'redmine.zip')\n\n Dir.chdir(root) do\n puts\n puts 'Files backuping'\n Zip::File.open(@backup_package, Zip::File::CREATE) do |zipfile|\n progressbar = TTY::ProgressBar.new(PROGRESSBAR_FORMAT, total: files_to_backup.size, frequency: 2, clear: true)\n\n files_to_backup.each do |entry|\n zipfile.add(entry, entry)\n progressbar.advance(1)\n end\n\n progressbar.finish\n end\n end\n\n puts \"Files backed up on #{@backup_package}\"\n logger.info('Files backed up')\n end\n\n @database = Database.init(self)\n @database.make_backup(@backup_dir)\n\n puts \"Database backed up on #{@database.backup}\"\n logger.info('Database backed up')\n end",
"def create_backup\n @slice = Xen::Slice.find(params[:id])\n @slice.create_backup\n\n respond_to do |format|\n format.html { redirect_to slice_path(@slice.name)}\n format.xml { render :xml => @backups }\n end\n end",
"def createBackup\n fetch(\"#{@backupUrl}\", 3000)\n $LOG.info(\"#{@name} : Backupfile created\") \n sleep 120\n end",
"def create\n @backup = Backup.new(backup_params)\n @backup = @client.backups.build(backup_params)\n \n respond_to do |format|\n if @backup.save\n #format.html { redirect_to [@client, @backup], notice: 'Backup was successfully created.' }\n format.html { redirect_to [@client, @backup], notice: 'Backup was successfully created.' }\n format.json { render :show, status: :created, location: @backup }\n else\n format.html { render :new }\n format.json { render json: @backup.errors, status: :unprocessable_entity }\n end\n end\n end",
"def backup(id)\n server = @connection.servers.get(id)\n ssh(server,'~/backup.sh')\n server.scp_download('backup/current.tar.gz','backup.tar.gz')\n end",
"def backup_file\n \"#{@file}.bak\"\n end",
"def frontend_backup(gear)\n app = gear.application\n args = Hash.new\n args['--with-container-uuid']=gear.uuid\n args['--with-container-name']=gear.name\n args['--with-namespace']=app.domain_namespace\n result = execute_direct(@@C_CONTROLLER, 'frontend-backup', args)\n result = parse_result(result)\n result.resultIO.string\n end",
"def bms_backup(opts = {})\n data, _status_code, _headers = bms_backup_with_http_info(opts)\n data\n end",
"def backup_file\n \"#{options[:file]}.bak\"\n end",
"def backupwallet(destination)\n coind.backupwallet destination\n end",
"def set_backup\n @backup = Backup.find(params[:id])\n end",
"def backup\n #EternosBackup::BackupJobPublisher.add_source(self)\n end",
"def create_and_copy_backup(backup_options = nil,backup_name = nil)\n\n end",
"def backup\n self.keep_backup && !File.exists?( backup_path ) && FileUtils.cp( self.resource.path, backup_path )\n end",
"def create\n @backup = current_user.backups.build(backup_params)\n @backup.user = current_user\n\n respond_to do |format|\n if @backup.save\n format.html { redirect_to backups_path, notice: 'Backup was successfully created.' }\n format.json { render action: 'show', status: :created, location: @backup }\n else\n format.html { render action: 'new' }\n format.json { render json: @backup.errors, status: :unprocessable_entity }\n end\n end\n end",
"def backup_request(client, filename, message)\n filename = \"BACKUP_#{filename}\"\n aFile = File.open(filename, 'w+')\n if aFile\n File.write(filename, message)\n puts \"Updated: #{filename}\"\n else\n client.puts \"ERROR: Unable to open file #{filename}\"\n end\n aFile.close\n return\n end",
"def backup_params\n params.require(:backup).permit(:path, :user_id, :host_id)\n end",
"def perform_backup\n \n add_memories_to_dropbox! if has_dropbox?\n\n # Clone the repo incase something is writing to it while we are backing up\n run \"cd #{@home} && git clone --bare #{@repo} #{@repo}.mirror\"\n output=run \"backup perform --trigger=daily_backup --log-path #{@dirs[:logs ]}\"\n run \"cd #{@home} && rm -fr #{@repo}.mirror\"\n \n get_timestamp(output)\n end",
"def backup_database\n #todo handle db prefix\n #todo proper error handling\n\n dbuser = @attributes[:dbuser]\n dbhost = @attributes[:dbhost]\n dbpass = @attributes[:dbpass]\n dbname = @attributes[:dbname]\n\n # see https://docs.moodle.org/20/en/Site_backup\n\n cmd = %Q{mysqldump -u #{dbuser} -h'#{dbhost}' -p'#{dbpass}' -C -Q -e --create-options '#{dbname}' | gzip -9 > '#{mk_backup_filename('database')}'}\n system cmd\n\n nil\n end",
"def download_backup(host,port,user,password,name,path,format)\n connect_to_host(host,port,user,password,true)\n if format == 'binary'\n local_file = path+name+\".backup\"\n remote_file = name+\".backup\"\n elsif format== 'script'\n local_file = path+name+\".rsc\"\n remote_file = name+\".rsc\"\n end\n download_file(remote_file,local_file)\n @ssh_connect.close(@ssh_connect)\n end",
"def backup\n # solve override problem\n if backup_exist? && !@opt[:bkp_args][:quiet]\n while true\n print \"Already have backup in #{@cfg[:backup]},override?(y/n)\"\n opt = gets\n case opt\n when /^y/i\n break\n when /^n/i\n return\n else\n next\n end\n end\n end\n \n # do backup\n FileUtils.mkdir_p @cfg[:backup] unless File.directory? @cfg[:backup]\n CommonUtils.copy_files @cfg[:local_files], File.join(__dir__, @cfg[:backup]) do |src, dest|\n @logger.debug \"Copying #{src} to #{dest}\"\n puts \"Backup: #{File.basename src}\" unless @opt[:bkp_args][:quiet]\n end\n @logger.debug('Backup completed')\n puts \"Backup completed, saved in: #{@cfg[:backup]}\" unless @opt[:bkp_args][:quiet]\n end",
"def tmpbkup(action=:create)\n bkup=@bkup\n begin\n if action == :create\n # Thx SO; https://stackoverflow.com/questions/88311/how-to-generate-a-random-string-in-ruby\n marker = (0...8).map { ('a'..'z').to_a[rand(26)] }.join\n\n Pem::Logger.logit(\"Creating backup of #{@location} to #{@location}#{marker}\")\n FileUtils.mv(@location,\"#{@location}#{marker}\")\n return \"#{@location}#{marker}\"\n elsif action == :restore\n Pem::Logger.logit(\"Backup cannot be nil!\", :fatal) if bkup.nil?\n raise('Backup cannot be nil!') if bkup.nil?\n\n Pem::Logger.logit(\"Restoring backup of #{@location} from #{bkup}\")\n FileUtils.rm_rf(@location)\n FileUtils.mv(bkup,@location)\n return nil\n elsif action == :purge\n Pem::Logger.logit(\"Backup cannot be nil!\", :fatal) if bkup.nil?\n raise('Backup cannot be nil!') if bkup.nil?\n\n Pem::Logger.logit(\"Purging backup of #{@location} from #{bkup}\")\n FileUtils.rm_rf(bkup)\n return nil\n end\n rescue StandardError => err\n Pem::Logger.logit(err, :fatal)\n raise(err)\n end\n end",
"def make_backup\n @backup = editor.create_snapshot\n end",
"def create_backup(storage_uuid, title:)\n data = {\n \"storage\" => {\n \"title\" => title\n }\n }\n\n json = JSON.generate data\n\n response = post \"storage/#{storage_uuid}/backup\", json\n\n response\n end",
"def create_ebs_backup(options = {})\n params = options.merge( { :commit => \"explicit\", :api_version => 1.0 } )\n STDERR.puts \"Performing RightScale API call to create a new snapshot\"\n json=nil\n SystemTimer.timeout_after(@api_snap_timeout) do\n body = RestClient.post @api_url+\"/create_ebs_backup.js\", params\n json = body.nil? ? nil: JSON.load(body)\n STDERR.puts \"CREATED_SNAPS: #{json}\"\n end\n json \n rescue Exception => e\n display_exception(e, \"create_ebs_backup(#{options.inspect})\")\n end",
"def create\n @backup_file = BackupFile.new(params[:backup_file])\n\n respond_to do |format|\n if @backup_file.save\n format.html { redirect_to @backup_file, notice: 'Backup file was successfully created.' }\n format.json { render json: @backup_file, status: :created, location: @backup_file }\n else\n format.html { render action: \"new\" }\n format.json { render json: @backup_file.errors, status: :unprocessable_entity }\n end\n end\n end",
"def backup_and_download\n @config.each do |config|\n connect_to_host(config[:host],config[:port],config[:user],config[:password])\n backup_config(config[:name],config[:format])\n download_backup(config[:host],config[:port],config[:user],config[:password],config[:name],config[:path],config[:format])\n end\n return true\n end",
"def set_backup\n if params[:id] && !params[:id].blank?\n @backup = Backup.new(nil, current_user.id)\n @backup.id_from_epoch(params[:id])\n else\n @backup = Backup.new(nil, current_user.id)\n end\n end",
"def backup \n begin\n check_if_db_exists\n is_allowed = @conn.exec(\"select datallowconn from pg_catalog.pg_database where datname='#{@options[:database]}'\")[0]['datallowconn']\n if is_allowed == 'f'\n # unquiece temporarily\n set_dataallowcon_to true\n end\n\n # Check to see if the directory for backups exists and if not, create it with parents\n unless File.exist?(@options[:bkdir])\n FileUtils.mkdir_p @options[:bkdir]\n end\n filename = \"postgresbk_#{@options[:database]}_#{Time.new.strftime(\"%m%d%y%H%M%S\")}.dump\"\n\n # The below system call assumes you have passwordless access as the user passed into the executable tool\n # either due to ~/.pgpass or pg_hba.conf has your user as a 'trust' auth method\n `pg_dump -U #{@options[:user]} #{@options[:database]} -F c -f #{@options[:bkdir]}/#{filename}`\n\n rescue Exception => e\n raise e\n ensure\n if is_allowed == 'f'\n # re quiesce \n set_dataallowcon_to false\n end\n end\n end",
"def create_backup(site_id, datum = nil)\n current_path = \"/api/v1/sites/#{site_id}/backup\"\n @conn.post(current_path, datum.to_json)\n end",
"def backup\n if Setting.getValue('backup') && Setting.getValue('backup_location').present?\n File.open(\"#{Setting.getValue('backup_location')}/taxonomy/#{self.seo_url}.json\", 'w+') do |fh|\n fh.write self.to_json\n end\n end\n end",
"def capture\n db = resolve_db(:allow_default => true)\n\n from_url = db[:url]\n from_name = db[:name]\n to_url = nil # server will assign\n to_name = \"BACKUP\"\n opts = {:expire => extract_option(\"--expire\")}\n\n backup = transfer!(from_url, from_name, to_url, to_name, opts)\n\n to_uri = URI.parse backup[\"to_url\"]\n backup_id = to_uri.path.empty? ? \"error\" : File.basename(to_uri.path, '.*')\n display \"\\n#{db[:pretty_name]} ----backup---> #{backup_id}\"\n\n backup = poll_transfer!(backup)\n\n if backup[\"error_at\"]\n message = \" ! An error occurred and your backup did not finish.\"\n message += \"\\n ! The database is not yet online. Please try again.\" if backup['log'] =~ /Name or service not known/\n message += \"\\n ! The database credentials are incorrect.\" if backup['log'] =~ /psql: FATAL:/\n abort(message)\n end\n end",
"def new\n @backup = Backup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @backup }\n end\n end",
"def create_backup request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_create_backup_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end",
"def backup backup_id\n ensure_service!\n grpc = service.get_backup instance_id, backup_id\n Backup.from_grpc grpc, service\n rescue Google::Cloud::NotFoundError\n nil\n end",
"def restore\n db = resolve_db(:allow_default => true)\n to_name = db[:name]\n to_url = db[:url]\n\n backup_id = args.shift\n\n if backup_id =~ /^http(s?):\\/\\//\n from_url = backup_id\n from_name = \"EXTERNAL_BACKUP\"\n from_uri = URI.parse backup_id\n backup_id = from_uri.path.empty? ? from_uri : File.basename(from_uri.path)\n else\n if backup_id\n backup = pgbackup_client.get_backup(backup_id)\n abort(\"Backup #{backup_id} already deleted.\") if backup[\"destroyed_at\"]\n else\n backup = pgbackup_client.get_latest_backup\n to_uri = URI.parse backup[\"to_url\"]\n backup_id = File.basename(to_uri.path, '.*')\n backup_id = \"#{backup_id} (most recent)\"\n end\n\n from_url = backup[\"to_url\"]\n from_name = \"BACKUP\"\n end\n\n message = \"#{db[:pretty_name]} <---restore--- \"\n padding = \" \" * message.length\n display \"\\n#{message}#{backup_id}\"\n if backup\n display padding + \"#{backup['from_name']}\"\n display padding + \"#{backup['created_at']}\"\n display padding + \"#{backup['size']}\"\n end\n\n if confirm_command\n restore = transfer!(from_url, from_name, to_url, to_name)\n restore = poll_transfer!(restore)\n\n if restore[\"error_at\"]\n message = \" ! An error occurred and your restore did not finish.\"\n message += \"\\n ! The backup url is invalid. Use `pgbackups:url` to generate a new temporary URL.\" if restore['log'] =~ /Invalid dump format: .*: XML document text/\n abort(message)\n end\n end\n end",
"def get_backup request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_get_backup_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Cloud::Metastore::V1::Backup.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end",
"def create_backup\n files = []\n if @options.database\n db_backup = MySQLBackup.new(@options.database, \n @options.user,\n @options.password)\n files << db_backup.backup\n end\n \n files << @options.files if @options.files\n\n files.flatten!\n\n process = Process.new(@options.backup_folder,\n files, \n @options.override, \n @options.no_compress,\n @options.max_backups)\n process.backup\n puts \"--> backed up files\"\n puts \" #{files.join(\"\\n \")}\"\n puts \"--> to #{@options.backup_folder}\"\n\n File.delete files[0] if @options.database\n end",
"def index\n @perform_backups = PerformBackup.all\n\n end",
"def backup_target\n data[:backup_target]\n end",
"def backup\n\t\tunless (@options && @options[:path] && @options[:dataset])\n\t\t\traise OptionParser::InvalidArgument, \"Missing arguments for 'backup'.\"\n\t\tend\n\t\t# Only attempt backup if the service is running\n\t\tstate = false\n\t\tself.launch(\"/usr/sbin/serveradmin status postgres\") do |output|\n\t\t\tstate = ((/RUNNING/ =~ output) != nil)\n\t\tend\n\t\torig_state = state\n\t\t$log.debug(\"@options = #{@options.inspect}\")\n\t\tarchive_dir = @options[:path]\n\t\tunless (archive_dir[0] == ?/)\n\t\t\traise OptionParser::InvalidArgument, \"Paths must be absolute.\"\n\t\tend\n\t\twhat = @options[:dataset]\n\t\tunless self.class::DATASETS.include?(what)\n\t\t\traise OptionParser::InvalidArgument, \"Unknown data set '#{@options[:dataset]}' specified.\"\n\t\tend\n\t\t# The passed :archive_dir and :what are ignored because the dump is put\n\t\t# on the live data volume\n\t\tarchive_dir = self.backupDir\n\t\tdump_file = \"#{archive_dir}/#{BACKUP_FILE}\"\n\t\tdump_file_uncompressed = \"#{archive_dir}/#{BACKUP_FILE_UNCOMPRESSED}\"\n\t\t# Create the backup directory as necessary.\n\t\tunless File.directory?(archive_dir)\n\t\t\tif File.exists?(archive_dir)\n\t\t\t\t$log.info \"Moving aside #{archive_dir}...\\n\"\n\t\t\t\tFileUtils.mv(archive_dir, archive_dir + \".applesaved\")\n\t\t\tend\n\t\t\t$log.info \"Creating backup directory: #{archive_dir}...\\n\"\n\t\t\tFileUtils.mkdir_p(archive_dir, :mode => 0700)\n\t\t\t# _postgres:_postgres has uid:gid of 216:216\n\t\t\tFile.chown(216, 216, archive_dir)\n\t\tend\n\t\t# Backup only once a day\n\t\tmod_time = File.exists?(dump_file) ? File.mtime(dump_file) : Time.at(0)\n\t\tif (Time.now - mod_time) >= (24 * 60 * 60)\n\t\t\t# Attempt to start the service if needed\n\t\t\tif (! state)\n\t\t\t\tself.launch(\"/usr/sbin/serveradmin start postgres\") do |output|\n\t\t\t\t\tstate = ((/RUNNING/ =~ output) != nil)\n\t\t\t\tend\n\t\t\tend\n\t\t\tif (! state)\n\t\t\t\t$log.info \"PostgreSQL is not running, skipping database backup\"\n\t\t\t\treturn\n\t\t\tend\n\n\t\t\t$log.info \"Creating dump file \\'#{dump_file}\\'...\"\n\t\t\tsystem(\"/usr/bin/sudo -u _postgres /usr/bin/pg_dumpall > #{dump_file_uncompressed.shellescape}\")\n\t\t\tif ($?.exitstatus != 0)\n\t\t\t\t$log.error \"...Backup failed on pg_dumpall, Status=#{$?.exitstatus}\"\n\t\t\telse\n\t\t\t\tsystem(\"/usr/bin/gzip #{dump_file_uncompressed.shellescape}\")\t\t\t\t\n\t\t\t\tif ($?.exitstatus == 0)\n\t\t\t\t\tFile.chmod(0640, dump_file)\n\t\t\t\t\tFile.chown(216, 216, dump_file)\n\t\t\t\t\t$log.info \"...Backup succeeded.\"\n\t\t\t\telse\n\t\t\t\t\t$log.error \"...Backup failed on gzip! Status=#{$?.exitstatus}\"\n\t\t\t\tend\n\t\t\tend\n\n\t\t\t# Restore original service state\n\t\t\tif (! orig_state)\n\t\t\t\t# What if a dependent service was launched while we were backing up? We\n\t\t\t\t# don't want to shut down postgres in that case.\n\t\t\t\twiki_state = false\n\t\t\t\tcalendar_state = false\n\t\t\t\taddressbook_state = false\n\t\t\t\tdevicemgr_state = false\n\t\t\t\tself.launch(\"/usr/sbin/serveradmin status wiki\") do |output|\n\t\t\t\t\twiki_state = ((/RUNNING/ =~ output) != nil)\n\t\t\t\tend\n\t\t\t\tself.launch(\"/usr/sbin/serveradmin status calendar\") do |output|\n\t\t\t\t\tcalendar_state = ((/RUNNING/ =~ output) != nil)\n\t\t\t\tend\n\t\t\t\tself.launch(\"/usr/sbin/serveradmin status addressbook\") do |output|\n\t\t\t\t\taddressbook_state = ((/RUNNING/ =~ output) != nil)\n\t\t\t\tend\n\t\t\t\tself.launch(\"/usr/sbin/serveradmin status devicemgr\") do |output|\n\t\t\t\t\tdevicemgr_state = ((/RUNNING/ =~ output) != nil)\n\t\t\t\tend\n\t\t\t\tif (! (wiki_state || calendar_state || addressbook_state || devicemgr_state))\n\t\t\t\t\tself.launch(\"/usr/sbin/serveradmin stop postgres\")\n\t\t\t\tend\n\t\t\tend\n\t\telse\n\t\t\t$log.info \"Dump file is less than 24 hours old; skipping.\"\n\t\tend\n\tend",
"def backup\n FileUtils.cp options[:file], backup_file if File.file? options[:file]\n end",
"def backup(file = nil)\n Chef::Util::Backup.new(new_resource, file).backup!\n end",
"def backup(file = nil)\n Chef::Util::Backup.new(new_resource, file).backup!\n end",
"def backup(platform_independent = false, description = nil)\n parameters = { 'backup_desc' => description,\n 'cmd' => 'backup',\n 'platform_independent' => platform_independent,\n 'targetTask' => 'backupRestore' }\n xml = AJAX.form_post(self, '/admin/global/maintenance/maintCmd.txml', parameters)\n if !!(xml =~ /succeded=\"true\"/)\n _maintenance_restart\n end\n end",
"def create(server)\n run_barman_command(\"backup #{server}\")\n end",
"def backup!(file=nil)\n file = file || FILENAME\n dir = root + BACKUP_DIRECTORY\n FileUtils.mkdir(dir.dirname) unless dir.dirname.directory?\n FileUtils.mkdir(dir) unless dir.directory?\n save!(dir + FILENAME)\n end",
"def backup\n\t\tdata = \"\"\n\t\tcurrent_user\n\t\tif params[\"favorites\"]\n\t\t\tdata << \"favorite_relations = Hash.new\\n\"\n\t\t\tif params[:demo_id]\n\t\t\t\t@favorites = []\n\t\t\t\tTask.where([\"demo_id = ?\", params[:demo_id]]).each do |task|\n\t\t\t\t\t@favorites << task.favorite\n\t\t\t\tend\n\t\t\telsif params[:favorite_id]\n\t\t\t\t@favorites = Favorite.where([\"id = ?\", params[:favorite_id]])\n\t\t\telse\n\t\t\t\t@favorites = @current_user.favorites.all\n\t\t\tend\n\t\t\[email protected] do |favorite|\n\t\t\t\tfavorite_id = favorite.attributes[\"id\"]\n\t\t\t\tfavorite_attributes = favorite.attributes\n\t\t\t\tfavorite_attributes.delete(\"id\")\n\t\t\t\tfavorite_attributes.delete(\"user_id\")\n\t\t\t\tfavorite_attributes.delete(\"created_at\")\n\t\t\t\tfavorite_attributes.delete(\"updated_at\")\n\t\t\t\tdata << \"favorite = @current_user.favorites.create(#{favorite_attributes})\\n\"\n\t\t\t\tdata << \"favorite_relations[#{favorite_id}] = favorite.id\\n\"\n\t\t\tend\n\t\tend\n\n\t\tif params[\"demos\"]\n\t\t\tdata << \"demo_relations = Hash.new\\n\"\n\t\t\tparams[:demo_id] ? @demos = Demo.where([\"id = ?\", params[:demo_id]]) : @demos = @current_user.demos.all\n\t\t\[email protected] do |demo|\n\t\t\t\tdemo_id = demo.attributes[\"id\"]\n\t\t\t\tdemo_attributes = demo.attributes\n\t\t\t\tdemo_attributes.delete(\"id\")\n\t\t\t\tdemo_attributes.delete(\"user_id\")\n\t\t\t\tdemo_attributes.delete(\"created_at\")\n\t\t\t\tdemo_attributes.delete(\"updated_at\")\n\t\t\t\tdata << \"demo = @current_user.demos.create(#{demo_attributes})\\n\"\n\t\t\t\tdata << \"demo_relations[#{demo_id}] = demo.id\\n\"\n\t\t\tend\n\t\tend\n\n\t\tif params[\"platforms\"]\n\t\t\tdata << \"platform_relations = Hash.new\\n\"\n\t\t\t@platforms = @current_user.platforms.all\n\t\t\[email protected] do |platform|\n\t\t\t\tplatform_id = platform.attributes[\"id\"]\n\t\t\t\tplatform_attributes = platform.attributes\n\t\t\t\tplatform_attributes.delete(\"id\")\n\t\t\t\tplatform_attributes.delete(\"user_id\")\n\t\t\t\tplatform_attributes.delete(\"created_at\")\n\t\t\t\tplatform_attributes.delete(\"updated_at\")\n\t\t\t\tdata << \"platform = @current_user.platforms.create(#{platform_attributes})\\n\"\n\t\t\t\tdata << \"platform_relations[#{platform_id}] = platform.id\\n\"\n\t\t\tend\n\t\tend\n\n\t\tif params[\"clouds\"]\n\t\t\tdata << \"cloud_relations = Hash.new\\n\"\n\t\t\t@clouds = @current_user.clouds.all\n\t\t\[email protected] do |cloud|\n\t\t\t\tcloud_id = cloud.attributes[\"id\"]\n\t\t\t\tplatform_id = cloud.attributes[\"platform_id\"] if params[\"platforms\"]\n\t\t\t\tcloud_attributes = cloud.attributes\n\t\t\t\tcloud_attributes.delete(\"id\")\n\t\t\t\tcloud_attributes.delete(\"user_id\")\n\t\t\t\tcloud_attributes.delete(\"platform_id\")\n\t\t\t\tcloud_attributes.delete(\"created_at\")\n\t\t\t\tcloud_attributes.delete(\"updated_at\")\n\t\t\t\tif(platform_id)\n\t\t\t\t\tdata << \"cloud = @current_user.clouds.create(#{cloud_attributes}.merge!({'platform_id' => platform_relations[#{platform_id}]}))\\n\"\n\t\t\t\telse\n\t\t\t\t\tdata << \"cloud = @current_user.clouds.create(#{cloud_attributes})\\n\"\n\t\t\t\tend\n\t\t\t\tdata << \"cloud_relations[#{cloud_id}] = cloud.id\\n\"\n\t\t\tend\n\t\tend\n\n\t\tif params[\"demos\"]\n\t\t\tdata << \"task_relations = Hash.new\\n\"\n\t\t\tparams[:demo_id] ? @tasks = Task.where([\"demo_id = ?\", params[:demo_id]]) : @tasks = @current_user.tasks.all\n\t\t\[email protected] do |task|\n\t\t\t\ttask_id = task.attributes[\"id\"]\n\t\t\t\tdemo_id = task.attributes[\"demo_id\"]\n\t\t\t\tcloud_id = task.attributes[\"cloud_id\"] if params[\"clouds\"]\n\t\t\t\tplatform_id = task.attributes[\"platform_id\"] if params[\"platforms\"]\n\t\t\t\tfavorite_id = task.attributes[\"favorite_id\"]\n\t\t\t\ttask_attributes = task.attributes\n\t\t\t\ttask_attributes.delete(\"id\")\n\t\t\t\ttask_attributes.delete(\"user_id\")\n\t\t\t\ttask_attributes.delete(\"demo_id\")\n\t\t\t\ttask_attributes.delete(\"cloud_id\")\n\t\t\t\ttask_attributes.delete(\"platform_id\")\n\t\t\t\ttask_attributes.delete(\"favorite_id\")\n\t\t\t\ttask_attributes.delete(\"created_at\")\n\t\t\t\ttask_attributes.delete(\"updated_at\")\n\t\t\t\tif platform_id\n\t\t\t\t\tdata << \"task = @current_user.tasks.create(#{task_attributes}.merge!({'demo_id' => demo_relations[#{demo_id}], 'platform_id' => platform_relations[#{platform_id}],'favorite_id' => favorite_relations[#{favorite_id}]}))\\n\"\n\t\t\t\telsif cloud_id\n\t\t\t\t\tdata << \"task = @current_user.tasks.create(#{task_attributes}.merge!({'demo_id' => demo_relations[#{demo_id}], 'cloud_id' => cloud_relations[#{cloud_id}],'favorite_id' => favorite_relations[#{favorite_id}]}))\\n\"\n\t\t\t\telse\n\t\t\t\t\tdata << \"task = @current_user.tasks.create(#{task_attributes}.merge!({'demo_id' => demo_relations[#{demo_id}],'favorite_id' => favorite_relations[#{favorite_id}]}))\\n\"\n\t\t\t\tend\n\t\t\t\tdata << \"task_relations[#{task_id}] = task.id\\n\"\n\t\t\tend\n\t\tend\n\n\t\tif params[\"demos\"]\n\t\t\tdata << \"regexpression_relations = Hash.new\\n\"\n\t\t\tif params[:demo_id]\n\t\t\t\t@regexpressions = []\n\t\t\t\[email protected] do |task|\n\t\t\t\t\ttask.regexpressions.each do |regexpression|\n\t\t\t\t\t\t@regexpressions << regexpression\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\telse\n\t\t\t\t@regexpressions = @current_user.regexpressions.all\n\t\t\tend\n\t\t\[email protected] do |regexpression|\n\t\t\t\tregexpression_id = regexpression.attributes[\"id\"]\n\t\t\t\ttask_id = regexpression.attributes[\"task_id\"]\n\t\t\t\tregexpression_attributes = regexpression.attributes\n\t\t\t\tregexpression_attributes.delete(\"id\")\n\t\t\t\tregexpression_attributes.delete(\"user_id\")\n\t\t\t\tregexpression_attributes.delete(\"task_id\")\n\t\t\t\tregexpression_attributes.delete(\"created_at\")\n\t\t\t\tregexpression_attributes.delete(\"updated_at\")\n\t\t\t\tdata << \"regexpression = @current_user.regexpressions.create(#{regexpression_attributes}.merge!({'task_id' => task_relations[#{task_id}]}))\\n\"\n\t\t\t\tdata << \"regexpression_relations[#{regexpression_id}] = regexpression.id\\n\"\n\t\t\tend\n\t\tend\n\n\t\tif params[:encrypt_password]\n\t\t\tdata = data.encrypt(:symmetric, :algorithm => 'des-ecb', :password => params[:encrypt_password])\n\t\tend\n\n\t\tif params[:cloud]\n\t\t\t@response, @headers, @url = amazon_request(\"Put\", \"/#{current_user.email}/Backup-#{Time.now.to_formatted_s(:number)}\", \"\", data, :cloud => @s3)\n\t\t\tredirect_to :action => \"list_cloud_data\"\n\t\telsif params[:backup_action] == \"share_favorite\"\n\t\t\t@response, @headers, @url = amazon_request(\"Put\", \"/Favorites/#{@favorites[0].api_type}/#{@favorites[0].api}/#{current_user.email}/#{@favorites[0].description}\", \"\", data, :cloud => @s3)\n\t\t\tlogger.info @response.body\n\t\t\trespond_to do |format|\n\t\t\t\tformat.js { render \"shared/execute_share_favorite\" }\n\t\t\tend\n\t\telsif params[:backup_action] == \"share_demo\"\n\t\t\t@response, @headers, @url = amazon_request(\"Put\", \"/Demos/#{current_user.email}/#{@demos[0].name}\", \"\", data, :cloud => @s3)\n\t\t\tlogger.info @response.body\n\t\t\trespond_to do |format|\n\t\t\t\tformat.js { render \"shared/execute_share_demo\" }\n\t\t\tend\n\t\telse\n\t\t\tsend_data(data, :filename => \"Backup-#{Time.now.to_formatted_s(:number)}.txt\" )\n\t\tend\n\tend",
"def transfer\n\t\tattributes = super\n\t\tself.last_backup_date = Date.today\n\t\tset_next_backup_date\n\t\tself.save\n\t\tlog_transfer(attributes)\n\tend",
"def create(name)\n p \"Doing a create ...\"\n params = {:backup => {:lineage => \"ns_backup_test_lineage\", :name => name, :volume_attachment_hrefs => [@volume_attachment_href_1, @volume_attachment_href_2]}}\n return @test_client.backups.create(params)\nend",
"def item_backup_url(id)\n \"#{@baseurl}/view.aspx?cabinet=published_meetings&fileid=#{id}\"\n end",
"def backup!(file=nil)\n file = file || FILENAME\n dir = root + BACKUP_DIRECTORY\n FileUtils.mkdir(dir.dirname) unless dir.dirname.directory?\n FileUtils.mkdir(dir) unless dir.directory?\n save!(dir + DOTRUBY_FILENAME)\n end",
"def backup(job)\n path = @filesystem.get_tmp_path\n s3 = @storage.parse_location(job['location'])\n db = @db.get_opts(job['db'])\n \n Mongolicious.logger.info(\"Starting job for #{db[:host]}:#{db[:port]}/#{db[:db]}\")\n\n @db.dump(db, path)\n @filesystem.compress(path) \n \n key = \"#{s3[:prefix]}_#{Time.now.strftime('%m%d%Y_%H%M%S')}.tar.bz2\"\n @storage.upload(s3[:bucket], key, path)\n \n @filesystem.cleanup(path)\n @storage.cleanup(s3[:bucket], s3[:prefix], job['versions'])\n \n Mongolicious.logger.info(\"Finishing job for #{db[:host]}:#{db[:port]}/#{db[:db]}\") \n end",
"def download\n @config.each do |config|\n download_backup(config[:host],config[:port],config[:user],config[:password],config[:name],config[:path],config[:format])\n end\n return true\n end",
"def bms_backup_restore_with_http_info(backupuuid, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: VnfsApi.bms_backup_restore ...'\n end\n # verify the required parameter 'backupuuid' is set\n if @api_client.config.client_side_validation && backupuuid.nil?\n fail ArgumentError, \"Missing the required parameter 'backupuuid' when calling VnfsApi.bms_backup_restore\"\n end\n # resource path\n local_var_path = '/bms/1.0.0/backup/{backupuuid}/restore'.sub('{' + 'backupuuid' + '}', backupuuid.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml', ])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oAuth2']\n data, status_code, headers = @api_client.call_api(:POST, local_var_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 :return_type => 'Backup')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: VnfsApi#bms_backup_restore\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create_backup(d_b_instance_id, optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'CreateBackup'\n\t\targs[:query]['DBInstanceId'] = d_b_instance_id\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :_scheme\n\t\t\traise ArgumentError, '_scheme must be http|https' unless 'http|https'.split('|').include? optional[:_scheme]\n\t\t\targs[:scheme] = optional[:_scheme]\n\t\tend\n\t\tif optional.key? :backup_method\n\t\t\targs[:query]['BackupMethod'] = optional[:backup_method]\n\t\tend\n\t\tif optional.key? :backup_type\n\t\t\targs[:query]['BackupType'] = optional[:backup_type]\n\t\tend\n\t\tif optional.key? :d_b_name\n\t\t\targs[:query]['DBName'] = optional[:d_b_name]\n\t\tend\n\t\tif optional.key? :owner_account\n\t\t\targs[:query]['OwnerAccount'] = optional[:owner_account]\n\t\tend\n\t\tif optional.key? :owner_id\n\t\t\targs[:query]['OwnerId'] = optional[:owner_id]\n\t\tend\n\t\tif optional.key? :resource_owner_account\n\t\t\targs[:query]['ResourceOwnerAccount'] = optional[:resource_owner_account]\n\t\tend\n\t\tif optional.key? :resource_owner_id\n\t\t\targs[:query]['ResourceOwnerId'] = optional[:resource_owner_id]\n\t\tend\n\t\tself.run(args)\n\tend",
"def get_backup(to_gzip = false)\n gzip_str = to_gzip ? '| gzip' : ''\n begin\n f = Tempfile.new(host, '/tmp')\n f.write(\"[client]\\npassword=#{password}\")\n f.close\n safe_run \"mysqldump \" \\\n \"--defaults-file=#{f.path} \" \\\n \"--host=#{host} \" \\\n \"--user=#{user} \" \\\n \"--all-databases \" \\\n \"--ignore-table=mysql.slow_log_backup \" \\\n \"--ignore-table=mysql.slow_log \" \\\n \"--single-transaction \" \\\n \"#{gzip_str} > #{local_path}\"\n ensure\n f.unlink\n end\n local_path\n end",
"def new\n @backup_file = BackupFile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @backup_file }\n end\n end",
"def bms_backup_get_with_http_info(backupuuid, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: VnfsApi.bms_backup_get ...'\n end\n # verify the required parameter 'backupuuid' is set\n if @api_client.config.client_side_validation && backupuuid.nil?\n fail ArgumentError, \"Missing the required parameter 'backupuuid' when calling VnfsApi.bms_backup_get\"\n end\n # resource path\n local_var_path = '/bms/1.0.0/backup/{backupuuid}'.sub('{' + 'backupuuid' + '}', backupuuid.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oAuth2']\n data, status_code, headers = @api_client.call_api(:GET, local_var_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 :return_type => 'Backup')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: VnfsApi#bms_backup_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def backup2Drive(src,conf)\n dest = conf[:backupDrive]\n dest = dest + \"/\" unless dest [-1] =~ /[\\/\\\\]/\n dest = dest + src\n puts src\n puts dest\n FileUtils.mkdir_p(File.dirname(dest))\n FileUtils.cp(src, dest)\n puts aktTime()+\" archive copied\"\n cleanUp(conf) if conf[:generations]\n \nend",
"def dump(path, backup_id)\n raise NotImplementedError\n end",
"def backuphosts(session,hosts)\n\trandom = sprintf(\"%.5d\",rand(100000))\n\tprint_status(\"Making Backup of the hosts file.\")\n\tsession.sys.process.execute(\"cmd /c copy #{hosts} #{hosts}#{random}.back\",nil, {'Hidden' => true})\n\tprint_status(\"Backup loacated in #{hosts}#{random}.back\")\nend",
"def backup_dir\n @backup_dir ||= create_backup_dir\n end",
"def backup_file(uploaded_file)\n uploaded_file(uploaded_file.to_json) do |file|\n file.data[\"storage\"] = backup_storage.to_s\n end\n end",
"def request_backup(db)\r\n\t\tdb.execute(\"SELECT * FROM playgroups WHERE kids>=5\")\r\n\t\tputs \"We'll need backup!!!\"\r\n\tend",
"def backup_data(src_file)\n backup_path = src_file + '.simplib_migration.bak.' + Time.now.strftime('%Y_%m_%d_%s')\n puts %Q(Making backup at #{backup_path})\n FileUtils.cp_r(src_file, backup_path)\nend",
"def before_backup\n end",
"def backup_template( template )\n filename = \"./templates/#{template['id']}.json\"\n file = File.new(filename, \"w\")\n puts \"Backing up #{filename} ...\"\n file.write( template )\n file.close\n end",
"def backup\n run_command 'pgbackups:capture', %W(--expire #{database})\n end",
"def base_path\n Settings.form526_backup.url\n end",
"def backup\n ModelHelper::backup self\n end",
"def create_backup_with_data\n @test_backup = @instance.backup @backup_id\n\n return @test_backup if @test_backup\n\n database = create_singers_albums_database\n\n capture do\n write_using_dml project_id: @project_id,\n instance_id: @instance.instance_id,\n database_id: database.database_id\n end\n\n client = @spanner.client @instance.instance_id, database.database_id\n version_time = client.execute(\"SELECT CURRENT_TIMESTAMP() as timestamp\").rows.first[:timestamp]\n\n capture do\n create_backup project_id: @project_id,\n instance_id: @instance.instance_id,\n database_id: database.database_id,\n backup_id: @backup_id,\n version_time: version_time\n\n @test_backup = @instance.backup @backup_id\n end\n\n @test_backup\n end",
"def dump(backup_file_name)\n @mysqlcmds ||= ::Rds::S3::Backup::MySqlCmds.new(backup_server.endpoint['Address'],\n @opts['mysql_username'],\n @opts['mysql_password'],\n @opts['mysql_database'])\n\n\n\n\n @mysqlcmds.dump(backup_file_path(backup_file_name)) # returns the dump file path\n end",
"def transfer!\n backup = connection.backups.create\n Logger.info \"Created backup [#{backup.id}]\"\n\n package.filenames.each do |filename|\n src = File.join(Config.tmp_path, filename)\n metadata = {}\n\n [:sha512sum, :sha1sum, :cksum].each do |cmd|\n if !`which #{cmd}`.empty?\n metadata[cmd] = %x|#{cmd} #{src}|.split.first\n break\n end\n end\n\n metadata[:size] = %x|ls -sh #{src}|.split.first\n\n backup_file = backup.files.create(filename: src, metadata: metadata)\n Logger.info \"Created backup file [#{backup_file.id}]\"\n\n Logger.info \"EngineYard performing upload of '#{File.join(src)}' to '#{backup_file.upload_url}' with metadata '#{metadata.inspect}'.\"\n\n backup_file.upload(file: src)\n end\n Logger.info \"Finished uploading files for backup [#{backup.id}]\"\n\n backup.finish!\n\n Logger.info \"Finished backup [#{backup.id}]\"\n end",
"def backups\n if args.count == 0\n list_backups\n else\n command = shift_argument\n case command\n when 'list' then list_backups\n when 'info' then backup_status\n when 'capture' then capture_backup\n when 'restore' then restore_backup\n when 'public-url' then public_url\n when 'cancel' then cancel_backup\n when 'delete' then delete_backup\n when 'schedule' then schedule_backups\n when 'unschedule' then unschedule_backups\n when 'schedules' then list_schedules\n else abort \"Unknown pg:backups command: #{command}\"\n end\n end\n end",
"def backup_params\n params.require(:backup).permit(:id, :notes, :client_id, :signup_date, :renewal_date, :assigned_to_id, :backup_account, :backup_size, \n :size_used, :used_percent, :alerts, :devices, :rim_client, :service_type_id, :service_list_id, :client_first_name, \n :client_last_name, :client_full_name, :status_id, :it_service_id, :qty, :price, :total_price, :service_date, :next_service_date,\n :contact_date1, :contact_date2, :contact_date3, :contact_done1, :contact_done2, :contact_done3, :rim_computer,\n :rim_service, :rim_email, :rim_phone, :rim_client, :primary_backup, :secondary_backup, :todo_list_id, :todo_list_complete, :residential, :business, :user_name,\n :password,\n todo_lists_attributes: [:id, :name, :complete, :_destroy ], tasks_attributes: [:id, :done, :description, :_destroy ],\n backup_pcs_attributes: [:id, :notes, :active, :name, :external_hd, :serial, :backup_id, :labtech_computer_id, :labtech_client_id, :client_id, :labtech_computer_id, :service_list_id, :contract_service_id],\n clients_attributes: [:client_id, :company, :first_name, :last_name, :full_name ] )\n end",
"def set_backup\n current_user.backup = Farmer.find_by_id(params[:id]).email\n current_user.save\n redirect_to current_user\n end",
"def backup_od\n begin\n \tputs \"Be sure to note this for later use.\\nPlease type a password for the OD backup:\"\n \t system \"stty -echo\"\n \t @pass = $stdin.gets.chomp\n \t system \"stty echo\"\n \trescue NoMethodError, Interrupt\n \t system \"stty echo\"\n end\n mkpassdb = \"/usr/sbin/mkpassdb\"\n tmpfile = \"/tmp/sacommands\"\n commands=[\"dirserv:backupArchiveParams:archivePassword = #{@pass}\", \"dirserv:backupArchiveParams:archivePath = #{@dest}/odbackup-#{@date}\", \"dirserv:command = backupArchive\"]\n sacommands = File.open(\"#{tmpfile}\", \"w\") do |f|\n f.puts commands.each {|command| command}\n end\n system \"/usr/sbin/serveradmin command < #{tmpfile}\"\n system \"#{mkpassdb} -backupdb #{@dest}/mkpassdb-#{@date}\"\n FileUtils.rm(tmpfile)\nend",
"def action_compress\n # Check if the file to back up already exists\n if ::File.exists?(current_resource.name)\n\n # If the backup file exists, calculate its age\n if ::File.exists?(current_resource.backup_file)\n backup_file_age_hours = (Time.now -\n ::File.mtime(current_resource.backup_file))/60/60\n end\n\n # If the backup file is over 24 hours old (which also means \n # that it exists)\n if !::File.exists?(current_resource.backup_file) ||\n backup_file_age_hours > 24\n\n # Check if the number of backups we want to keep is > 0\n # before trying to rotate\n if @current_resource.num_backups < 0\n # Wrap changing logic in converge_by so it works in why-run mode\n converge_by(\"Rotate backup files \"+\n \"(retaining maximum #{@current_resource.num_backups})\") do\n # Rotate existing backup files\n (@current_resource.num_backups - 1).downto(1).each do |f|\n if ::File.exists?(\"#{current_resource.backup_file}-#{f}\")\n ::FileUtils.mv(\"#{current_resource.backup_file}-#{f}\",\n \"#{current_resource.backup_file}-#{f+1}\")\n end\n if ::File.exists?(current_resource.backup_file)\n # Rotate current backup file\n ::FileUtils.mv(current_resource.backup_file,\n \"#{current_resource.backup_file}-1\")\n end\n end\n end\n end\n\n # Wrap changing logic in converge_by so it works in why-run mode\n converge_by(\"Create backup file #{ new_resource.backup_file }\") do\n # Compress the specified file with the specified name\n Chef::Log.info(\"Compressing #{new_resource.name}...\")\n Zlib::GzipWriter.open(new_resource.backup_file) do |gz|\n gz.write IO.binread(new_resource.name)\n end\n end\n\n # Indicate to Chef that we updated new_resource because we \n # changed the node\n new_resource.updated_by_last_action(true)\n else\n Chef::Log.warn(\"Backup file #{new_resource.backup_file} is only \" +\n \" #{backup_file_age_hours.round(2)} hours old.\n (Action will be skipped).\")\n end\n else\n Chef::Log.warn(\"Can't find #{new_resource.name} to back up. \" +\n \" (Action will be skipped).\")\n end\n end",
"def show\n @backup = Backup.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @backup }\n end\n end",
"def update\n respond_to do |format|\n if @backup.update(backup_params)\n format.html { redirect_to @backup, notice: 'Backup was successfully updated.' }\n format.json { render :show, status: :ok, location: @backup }\n else\n format.html { render :edit }\n format.json { render json: @backup.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_backups(site_id, datum = nil)\n current_path = \"/api/v1/sites/#{site_id}/backups\"\n pb = SFRest::Pathbuilder.new\n @conn.get URI.parse(pb.build_url_query(current_path, datum)).to_s\n end",
"def make_mysql_backup\n if @all_databases\n options = {\n :name => \"--all-databases\",\n :dump_options => \"\",\n :append_name => \"\"\n }\n file_name = mysqldump(options)\n compress_file(file_name)\n end\n if @databases && [email protected]?\n @databases.each do |db|\n options = {\n :name => db[:name].to_s,\n :dump_options => db[:dump_options].to_s,\n :append_name => db[:append_name].to_s\n }\n file_name = mysqldump(options)\n compress_file(file_name)\n end\n end\nend",
"def after_copy_backup\n return :success\n end",
"def backup account\n backup_file File.join(@ssh_home, @ssh_id), File.join(@ssh_home, account + \".identity\")\n backup_file File.join(@ssh_home, @ssh_id + \".pub\"), File.join(@ssh_home, account + \".identity.pub\")\n @shell.say \"SSH identity backed up to account: #{account}.\"\n end",
"def create_backdat_file\n puts \"Creating backdat file\"\n end",
"def backup(from: nil, to: nil)\n\n if @debug then\n puts 'ready to perform backup' \n puts \"from: %s to: %s\" % [from, to]\n end\n \n instructions = \"rsync -akL -e ssh %s %s\" % [from, to]\n\n puts 'instructions: ' + instructions if @debug \n \n # note: compression is not enabled since this is aimed at \n # single board computers which have limited CPU capability\n\n r = @ssh ? @ssh.exec!(instructions) : `#{instructions}`\n puts 'r: ' + r.inspect if @debug\n \n # since it's running in the background, an empty string will be returned\n \n end",
"def backup\n return false if !@file || !backup_file\n FileUtils.cp @file, backup_file if File.file? @file\n true\n end",
"def backup\n inexistent_files = check_for_inexistent_files\n unless inexistent_files.empty?\n STDERR.puts \"Cannot backup inexistent files\"\n STDERR.puts inexistent_files.join(\" \")\n exit 1\n end\n\n FileUtils.mkdir_p @backup_folder unless File.exists? @backup_folder\n\n if @no_compress \n copy_files \n delete_uncompressed_backups\n else\n compress_files_and_copy\n delete_compressed_backups\n end\n\n end",
"def snapshot\n begin\n response = resource[\"/snapshot/#{app}\"].post(nil)\n rescue RestClient::InternalServerError\n display \"An error has occurred.\"\n end\n display response.to_s\n end",
"def file\n Backup::Model.file\n end",
"def index\n #@backups = Backup.all\n @backups = current_user.backups\n end",
"def backup_config(name,format='binary')\n @log.info(\"Backup MikroTik configuration\")\n if format == 'binary'\n send_command(\"/system backup save name=#{name}\")\n elsif format == 'script'\n send_command(\"/export file=#{name}\")\n end\n @ssh_connect.close\n end"
] | [
"0.7160548",
"0.6996519",
"0.697848",
"0.6977541",
"0.68865484",
"0.67735803",
"0.6687378",
"0.66806626",
"0.66524833",
"0.6544933",
"0.64617133",
"0.64174485",
"0.6412878",
"0.6409217",
"0.6373063",
"0.6280851",
"0.62536395",
"0.6250678",
"0.6230015",
"0.62258905",
"0.6205163",
"0.61997926",
"0.6199628",
"0.61849993",
"0.6156429",
"0.61534214",
"0.61515594",
"0.61466444",
"0.6142475",
"0.61334455",
"0.6063919",
"0.603806",
"0.60267246",
"0.601275",
"0.6008519",
"0.60081136",
"0.60036737",
"0.5966049",
"0.5961697",
"0.5961224",
"0.59514475",
"0.5939078",
"0.59379315",
"0.5937335",
"0.593544",
"0.5934306",
"0.589464",
"0.5893678",
"0.5885957",
"0.58689296",
"0.58689296",
"0.58532435",
"0.5843022",
"0.5830079",
"0.5818771",
"0.5815867",
"0.5813248",
"0.5803859",
"0.5799573",
"0.5798896",
"0.5798366",
"0.57855207",
"0.5777111",
"0.5720981",
"0.57201874",
"0.5712993",
"0.5711465",
"0.56843317",
"0.5681044",
"0.56774133",
"0.5675211",
"0.5668381",
"0.5657681",
"0.56541455",
"0.5650457",
"0.5636361",
"0.56350297",
"0.5633832",
"0.56329006",
"0.56209254",
"0.56092817",
"0.5586334",
"0.55611163",
"0.55485207",
"0.554758",
"0.5533244",
"0.5527415",
"0.55248165",
"0.5519387",
"0.55040085",
"0.5503879",
"0.5491929",
"0.5488964",
"0.54834443",
"0.5479302",
"0.5478143",
"0.54701495",
"0.54676133",
"0.54651535",
"0.54593146"
] | 0.6912226 | 4 |
def arrange input = gets.to_s.strip puts input.chars.sort.join end arrange Write a script that checks whether a passed string is palindrome or not. def palindrome input = gets.to_s.strip.gsub(" ", "") reverse = input.reverse if (input === reverse) puts "It is a palindrome" else puts "It is not a palindrome" end end palindrome def count_vowels() string = gets.to_s.strip vowels = 0 counter = 0 while counter < string.length do if string[counter]=="a" || string[counter]=="e" || string[counter]=="i" || string[counter]=="o" || string[counter]=="u" vowels += 1 end counter += 1 end puts vowels end count_vowels() Write a for loop that will iterate from 0 to 15. For each iteration, it will check if the current number is odd or even, and display a message to the screen. | def number_check
nums = [0, 1, 2, 3, 4, 5, 6 , 7, 8, 9, 10, 11, 12, 13, 14, 15]
nums.each do |i|
if i % 2 == 0
puts "#{i} even"
else
puts "#{i} odd"
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isPalindrome(string)\n # if x.to_s.reverse == x\n # return true\n # end\n # return false\n count = {}\n oddCount = 0\n string.each_char.with_index do |value, index|\n if count[string[index]]\n count[string[index]] += 1\n else\n count[string[index]] = 1\n end\n end\n\n odd = 0\n oddLetter = nil\n count.each do |key, value|\n if value % 2 == 1\n odd += 1\n oddLetter = key\n end\n end\n\n if odd == 0\n return true\n end\n if string[string.length/2] != oddLetter && odd == 0\n p \"hit\"\n return false\n end\n\n if odd > 1\n return false\n else\n return true\n end\n\nend",
"def palindrome\n txt = 'ssiiss'\n length = txt.length\n i = 0\n j = length - 1\n flag = true\n while flag && i<=j do\n flag = txt[i] == txt[j] ? true : false\n i = i + 1\n j = j - 1\n end\n puts \"palindrome is #{flag}\"\nend",
"def palindrome_check(my_phrase)\n is_palindrome = true\n if my_phrase == nil\n return false\n elsif my_phrase.class != String\n raise ArgumentError.new(\"Input must be a string\")\n elsif\n phrase_length = my_phrase.length\n (phrase_length/2).times do |i|\n if my_phrase[i] != my_phrase[phrase_length-(i+1)]\n is_palindrome = false\n end\n i += 1\n end\n return is_palindrome\n end\n\nend",
"def is_palindrome?(value)\n value.downcase!\n\n reversed = \"\"\n count = value.lentgth\n\nwhile count > 0\n count -= 1\n reversed += value[count]\nend\n\n if value == reversed\n return \"#{value} is a palindrome\"\n else\n return \"#{value} is not a palindrome\"\n end\nend",
"def pal_test(string)\n# Create conditional statement if string == string.reverse.capitalize, the accessors will reverse the string and then capitalize the new first index\n# Included an || to the if conditional statement because I didn't account for the capitalization initially and the method can now be used for lowercase words as well\n if string == string.reverse.capitalize || string == string.reverse\n \"#{string} is a palindrome\"\n# Use string interpolation to give the output statement\n else string != string.reverse\n \"#{string} is not a palindrome\"\n end\n# Use a bang operator to return the opposite statement for when the string is not a palindrome\nend",
"def palindrome_permutation(string)\n lowercase = string.downcase\n counter = Hash.new(0)\n \n lowercase.each_char {|char| counter[char] += 1 unless char == \" \"}\n \n found_odd = false\n \n counter.keys.each do |char|\n if counter[char] % 2 != 0\n return false if found_odd\n found_odd = true\n end\n end\n true\nend",
"def palindrome(string)\n puts \"is #{string} a palindrome?\" \n (string.length/2).times do |i|\n puts i\n puts \"checking if #{string[i]} is equal to #{string[string.length - 1 - i]}\"\n if string[i] != string[string.length - 1 - i]\n return false\n end\n end\n return true\nend",
"def palindrome_permutation(str)\n hash = {}\n array = str.split(\"\")\n array.each do |el|\n if hash[el]\n hash[el] = hash[el] + 1\n elsif el == \" \"\n else\n hash[el] = 1\n end\n end\n\n odd_counter = 0\n even_counter = 0\n values = hash.values\n values.each do |el|\n if (el % 2 == 0)\n even_counter += 1\n else\n odd_counter += 1\n end\n end\n\n if (odd_counter > 2)\n return false\n end\n true\nend",
"def palindrome_check(my_phrase)\n if my_phrase == nil\n return false\n else\n\n s = 0\n e = my_phrase.length - 1\n\n while e > s do\n if my_phrase[s] != \" \" && my_phrase[e] != \" \"\n if !(my_phrase[s] == my_phrase[e])\n return false\n else\n s += 1\n e -= 1\n end\n elsif my_phrase[e] == \" \"\n e -= 1\n elsif my_phrase[s] == \" \"\n s += 1\n end\n\n end\n return true\n end\nend",
"def palindrome_rearranging(s)\n c = Hash.new(0)\n s.split('').each { |z| c[z] += 1}\n m = []\n n = []\n c.each_value { |i| m.push(i)}\n m.each do |i| \n i % 2 != 0 ? n.push(i) : ''\n end \n n.length > 1 ? false : true \nend",
"def palindrome_permutation?(string)\n hash = {}\n count = 0\n\n if string.empty?\n return true\n end\n\n string.each_char do |i|\n if hash[i] == nil\n hash[i] = 1\n else\n hash[i] += 1\n end\n end\n\n string_array = hash.values\n string_array.each do |num|\n if num.odd? == true\n count += 1\n if count > 1\n return false\n end\n end\n end\n return true\n\n\nend",
"def palindrome_permutation?(string)\n letters = {}\n length = string.length\n letters_in_odd_numbers = 0\n \n # Put string into a hash. Key = letter; value = count of letter\n length.times do |i|\n if letters[string[i]].nil?\n letters[string[i]] = 1\n else\n letters[string[i]] += 1\n end\n end\n \n # Check each letter in hash for whether it is represented an even or odd number of times\n letters.each do |key, value|\n if value % 2 == 1\n letters_in_odd_numbers += 1\n end \n end\n \n # A string with an even length should only have letters represented in an even number. An odd length should have just one letter represented an odd number of times.\n if length % 2 == 0 && letters_in_odd_numbers == 0\n return true\n elsif letters_in_odd_numbers == 1\n return true\n else\n return false\n end\nend",
"def isPalindrome( str)\n i = 0\n j = str.length - 1\n while i < j && str[i] == str[j]\n i += 1\n j -= 1\n end\n if i < j\n print(\"String is not a Palindrome\",\"\\n\")\n return false\n else\n print(\"String is a Palindrome\",\"\\n\")\n return true\n end\nend",
"def palindrome_check(my_phrase)\n if my_phrase == nil\n return false\n end\n y = (my_phrase.length - 1)\n x = 0\n palindrome = true\n until x > y do\n until my_phrase[x] =~ /\\S/ do\n x += 1\n end\n until my_phrase[y] =~ /\\S/ do\n y -= 1\n end\n if my_phrase[x] != my_phrase[y]\n palindrome = false\n end\n x += 1\n y -= 1\n end\n return palindrome\nend",
"def is_palindrome(word)\nforwards = \"\"\nbackwards = \"\"\n \n i = 0\n while i < word.length\n char = word[i]\n forwards = forwards + char\n backwards = char + backwards\n\n i += 1\n end\n \n if forwards == backwards\n return \"true\"\n else\n return \"false\"\n end\nend",
"def palindrome_check(my_phrase)\r\n return my_phrase if my_phrase.length < 2\r\n\r\n i = 0\r\n\r\n while i < my_phrase.length/2\r\n return false if my_phrase[i] != my_phrase[my_phrase.length - i - 1]\r\n i += 1\r\n end\r\n\r\n return true\r\nend",
"def check_palindrome(s)\n\n if s == nil\n return false\n end\n\n result = \"\"\n\n (s.length-1).downto(0).each do |l|\n result << s[l]\n end\n p result\n\n return result == s\n\nend",
"def palindrome_check(my_phrase)\n return false if my_phrase == nil\n length = my_phrase.length\n return true if length < 2\n\n half = length / 2\n\n back_counter = length - 1\n front_counter = 0\n\n half.times do\n if my_phrase[back_counter] == \" \"\n back_counter -= 1\n end\n\n if my_phrase[front_counter] == \" \"\n front_counter += 1\n end\n\n if my_phrase[back_counter] != my_phrase[front_counter]\n return false\n end\n back_counter -= 1\n front_counter += 1\n return true\n end\n\nend",
"def palindrome?\n x = 0\n y = input.length - 1\n ((input.length/2) + 1).times do\n if input[x] != input[y]\n return false\n end\n x += 1\n y -= 1\n end\n return true\nend",
"def is_palindrome(s)\n new_str = \"\"\n \n s.each_char do |char|\n new_str << char.downcase if char.downcase != char.upcase || char == char.to_i.to_s\n end\n \n front_idx = 0\n back_idx = new_str.length - 1\n \n until front_idx > back_idx\n return false if new_str[front_idx] != new_str[back_idx]\n front_idx += 1\n back_idx -= 1\n end\n true\nend",
"def palindrome_permutation(string)\n # new_string = string.gsub(/\\s+/, \"\")\n # p new_string.length\n # permutation = new_string.chars\n # p \n\n\n # if new_string.length % 2 != 0\n # puts \"True. permutation\"\n # end\n\n # pal_split = string.split\n\n # pal0_split = pal_split[0].chars\n # removed_last_letter = pal0_split.pop\n # word_one = pal0_split.join\n # if word_one == pal_split[1].reverse\n # puts \"True permutations \"\n # else\n # puts \"no\"\n # end\n\n new_string = string.gsub(/\\s+/, \"\")\n reversed_word = new_string.reverse\n if new_string == reversed_word\n puts \"true.\"\n else \n puts \"false\"\n end \nend",
"def Palindrome?(string)\n if string.length < 3\n \treturn false\n end\n new_input = string.scan(/[a-zA-Z]/).join\n input_length = new_input.length\n stringA = new_input.slice!(0, input_length/2.floor).downcase\n stringB = input_length % 2 == 0? new_input.downcase.reverse : new_input.slice(1, new_input.length - 1).downcase.reverse\n return stringA == stringB\nend",
"def palindrome_vibe_check (str)\n if str.downcase.reverse == str.downcase\n p \"#{str} is a palindrome and passes the vibe check.\"\n else\n p \"#{str} does not pass the vibe check.\"\n end\n end",
"def palindrome_check(my_phrase)\n return false if my_phrase == nil\n\n while my_phrase != nil\n i = 0\n n = (my_phrase.length - 1)\n until n < i\n if my_phrase[i] == my_phrase[n]\n i += 1\n n -= 1\n elsif my_phrase[i] == \" \"\n i += 1\n elsif my_phrase[n] == \" \"\n n-= 1\n else\n return false\n end\n end\n return true\n end\n s\n\nend",
"def palindrome_check(my_phrase)\r\n string_fixed = my_phrase.split.join\r\n first_position = 0\r\n last_position = string_fixed.length - 1\r\n\r\n while first_position != last_position\r\n\r\n case\r\n when string_fixed[first_position] != string_fixed[last_position]\r\n return false\r\n exit\r\n when string_fixed[first_position] == string_fixed[last_position]\r\n first_position += 1\r\n last_position -= 1\r\n end\r\n return true\r\n end\r\nend",
"def palindrome_tester(s)\n if s == s.reverse\n puts \"It's a palindrome!\"\n else\n puts \"It's not a palindrome.\"\n end\nend",
"def start \n puts 'Welcome to the Palindrome checker'\n puts 'Examples are \"Racecar\", \"Mom\", and \"Tacocat\"'\n puts 'Check if your word is a palindrome by entering it below'\n puts '>>> '\n string = gets.strip.downcase\n @split_string = string.split('')\n check\nend",
"def palindrome\n\tputs \"enter whatever you want\"\n\tinput = gets.chomp\n\n\tputs input + input.reverse[1..-1]\nend",
"def is_palindrome(sentence)\n words = sentence.split(\" \")\n words.each do |word| \n reverse_word = word.reverse\n if word.downcase == reverse_word.downcase\n puts \"'#{word}' is a palindrome\"\n end\n end\nend",
"def odds_and_evens(string, return_odds)\n# Creates new method with two arguments, 'string' and 'return_odds' boolean.\n\n to_return = \"\"\n# Creates new variable and assigns it an empty string.\n\n string.size.times do |index|\n# First applies the .size method to the string to calculate the size of the string and return the resulting number. E.g. if the string is \"Rare\", .size will applied to the string returns 4 because \"Rare\" has 4 letters.\n\n# Second applies the .times to the number returned after calculating the string size. E.g. if the string is \"Rare\", .times will execute the following loop x4 times.\n\n# Third the \"| index |\" means do for each indexed character the following steps. A string has an index, e.g. [[0, r], [1, a], [2, r], [3, e]], where the first character is the index number and the second is the corresponding character. Note '0' is considered an even number for coding purposes.\n\n next if return_odds && index.even?\n # First iteration iterates over index[0], i.e. \"r'.\n # => next if false && r.even?\n # => next if false && true\n # => next if false\n # => therefore tells ruby don't skip \"r\" and instead move on to complete next step using the return value of index[0].\n\n # Second iteration iterates over index[1], i.e. 'a'.\n # => next if false && a.even?\n # => next if false && false\n # => next if false\n # => therefore tells ruby don't skip \"a\" and instead move on to complete next step using the return value of index[1].\n\n # Third iteration iterates over index[2], i.e. the second letter \"r\".\n # => next if false && r.even?\n # => next if false && true\n # => next if false\n # => therefore tells ruby don't skip \"r\" and instead move on to complete next step using the return value of index[2].\n\n # Fourth iteration iterates over index[3], i.e. \"e\".\n # => next if false && e.even?\n # => next if false && false\n # => next if false\n # => therefore tells ruby don't skip \"e\" and instead move on to complete next step using the return value of index[2].\n\n puts index\n\n # First iteration puts value of index[0] to screen.\n\n # Second iteration puts value of index[1] to screen.\n\n # Third iteration puts value of index[2] to screen.\n\n # Fourth iteration puts value of index[3] to screen.\n\n next if !return_odds && index.odd?\n # First iteration continues to iterate this step over index[0], i.e. \"r\".\n # => next if true && r.odd?\n # => next if true && false\n # => next if false\n # => therefore tells ruby don't skip \"r\" and instead move on to complete the next steps using index[0] as return value.\n\n # Second iteration continues to iterate this step over index[1], i.e. \"a\".\n # => next if true && a.odd?\n # => next if true && true\n # => next if true\n # => therefore tells ruby to skip \"a\" and ignore the next steps.\n\n # Third iteration continues to iterate this step over index[2], i.e. \"r\".\n # => next if true && r.odd?\n # => next if true && false\n # => next if false\n # => therefore tells ruby don't skip \"r\" and instead move on to complete the next steps using index[2] as return value.\n\n # Second iteration continues to iterate this step over index[3], i.e. \"e\".\n # => next if true && e.odd?\n # => next if true && true\n # => next if true\n # => therefore tells ruby to skip \"e\" and ignore the next steps.\n\n puts \"#{index}+x\"\n\n # First iteration puts value of \"index[0]+x\" to screen, i.e. \"0+x\".\n\n # Third iteration puts value of \"index[2]+x\" to screen, i.e. \"2+x\".\n\n to_return << string[index]\n # First iteration continues to iterate this step over index[0], i.e. \"r\".\n # => \"\" << string[0]\n # => \"\" << \"r\"\n # => to_return = \"r\"\n # In other words, ruby adds the current return value, index[0] (i.e. \"r\"), to the variable \"to_return\".\n\n # Second iteration continues to iterate this step over index[2], i.e. \"r\".\n # => \"r\" << string[2]\n # => \"r\" << \"r\"\n # => to_return = \"rr\"\n # In other words, ruby adds the current return value, index[2] (i.e. \"r\"), to the variable \"to_return\".\n\n end\n\n to_return\n# Return the final value of to_return after iterating each character in the chosen string. This does not get returned until the above loop has completed.\n\nend",
"def count_vowels(string)\ni = 0\nvowels = 0\n while i<string.length do\n if string[i] == \"a\" || string[i] == \"e\" || string[i] == \"i\" || string[i] == \"o\" || string[i] == \"u\"\n vowels += 1\n end\n i += 1\n end\nputs vowels\nend",
"def Palindrome(str)\n str = str.gsub(\" \", \"\")\n front = 0\n back = str.length - 1\n \n while front < back\n if str[front] != str[back]\n return \"false\"\n end\n front += 1\n back -= 1\n end\n \n return \"true\"\nend",
"def is_palindrome(aString)\n return false if aString == nil\n #positive side = a = 0\n #negative side = y = -1\n temp_word = aString.gsub(/(\\W|\\d)/, \"\").downcase\n\n i = 0\n a = -1\n word = temp_word.chars\n while i < (word.length / 2)\n # check chars are the same\n # if same, move to next set of chars\n # if different, return false \n # when processed all chars and still haven't found a difference, return true\n if word[i] == word[a]\n a -= 1\n i += 1\n else\n return false\n end\n end\n return true\nend",
"def is_palindrome(string)\n joined_str = string.gsub(/[^0-9a-z]/i, '').downcase\n reverse_str = reverser(joined_str.clone)\n difference_count = 0\n joined_str.length.times do |i|\n difference_count += 1 if joined_str[i] != reverse_str[i]\n end\n\n if difference_count != 0\n return false\n else\n return true\n end\n\nend",
"def palindrome_perm(str)\n count = Hash.new(0)\n\n str.chars.each do |char|\n count[char] += 1\n end\n\n odd_num = 0\n\n count.each do |_, v|\n odd_num += 1 if v.odd?\n return false if odd_num > 1\n end\n\n true\nend",
"def is_palindrome(string)\n string = string.gsub(/\\W/, \"\").downcase # modify string without non word characters and spaces\n x = 0\n i = (string.length - 1)\n until x >= i\n if string[x] != string[i]\n return false\n end\n x += 1\n i -= 1\n end\n return true\nend",
"def valid_palindrome(s)\n \nend",
"def check_palindrome(s)\n for i in 0...(s.length/2).floor\n if s[i] != s[s.length-i-1]\n return false\n end\n end\n return true\nend",
"def is_palindrome(s)\n # input validation\n return true if s.length == 0\n i = 0\n j = s.length-1\n return palindrome_helper(i, j, s)\nend",
"def odds_and_evens(string, return_odds)\n# this is setting the return_string variable to an empty string, so a new string can be passed into it\n return_string = \"\"\n# this takes the string argument passed to it, and calls the size method on it, giving the strings length.\n# This number is then passed to the times method, telling the next set of instructions how many times to loop.\n# and then, it's asking for each character in the string to be assigned 'index'\n string.size.times do |index|\n# the first next if statement is saying 'If return_odds boolean and index.even are both true, skip this'\n next if return_odds && index.even?\n# the second next if statement is saying 'if return_odds and index.odd are not the same, skip this too'\n next if !return_odds && index.odd?\n# this then inserts the remaining string index into the return_string empty string\n return_string << string[index]\n end\n# this then returns what is in the return_string variable after the method has completed its work\n return_string\nend",
"def is_palindrome(word) # define method with one parameter\n i = 0 # set i to zero for first index value is 0\n reversed_string = \"\" # create empty string to store concatenated string\n \n while i < word.length # run while loop as long as word length is greater than i value which increments by one\n char = word[i] # this stores each iteration of string characters\n reversed_string = char + reversed_string # this concatenates string characters in reverse order\n i +=1 # raises increment by one \n end # end loop\n return reversed_string == word # if statement that evaluates whether new string equals original\nend",
"def is_palindrome?(string)\n no_spaces_input = string.gsub(\" \",\"\") # 5\n lowercase_no_spaces_input = no_spaces_input.downcase() # 5\n\n reversed_lowercase_string = lowercase_no_spaces_input.reverse() # 5\n\n # 15 = 3(5), or 5+5+5, 3n. O(n)\n\n return reversed_lowercase_string == lowercase_no_spaces_input\nend",
"def permutation_palindrome(str)\n dict = {}\n odds = 0\n\n str.downcase.chars.map do |val|\n dict[val] = (dict[val]) ? dict[val] += 1 : 1\n end\n \n dict.keys.map do |key|\n dict[\" \"] = 2 if key == \" \"\n odds += 1 if dict[key] % 2 != 0\n end\n\n return odds <= 1\nend",
"def palindrome_check(my_phrase)\n if my_phrase == nil\n return false\n elsif\n my_phrase == \"\" || my_phrase.length == 1\n return true\n end\n\n length = my_phrase.length\n i = 0\n j = length - 1\n while i < j\n if my_phrase[i] == my_phrase[j]\n i += 1\n j -= 1\n elsif my_phrase[i] == \" \"\n i += 1\n elsif my_phrase[j] == \" \"\n j -= 1\n else\n return false\n end\n end\n return true\nend",
"def challenge3\t\n\tputs \"Enter a string:\"\n\t# arr = gets.chomp.split(\"\")\n\t# len = arr.length-1\n\t# new_arr = []\n\n\t# for i in 0..len\n\t# \tnew_arr.push(arr[len-i])\n\t# end\n\t# puts \"#{new_arr.join}\"\n\n\tword = gets.chomp.split(\"\")\n\treverse_word = []\n\n\tword.each do |letters|\n\t\treverse_word.unshift(letters)\n\tend\n\n\tputs \"Your reversed word is: #{reverse_word.join.to_s}\"\n\n\nend",
"def possible_palindrome?(word)\n nb_each_letters(word).one?(&:odd?) ||\n nb_each_letters(word).all?(&:even?)\nend",
"def is_palindrome(string)\n split_string_array = string.downcase.split(\"\")\n words_array = split_string_array.select{|letter| letter[/[a-z]/]}\n\n reverse_words_array = []\n x = 0\n length = words_array.length\n until words_array[x] == nil\n reverse_words_array << words_array[length -(x+1)]\n x += 1\n end\n\n return reverse_words_array == words_array ? true : false\n\nend",
"def is_even_odd = num1, num2, num3 \n if num1 %2 ==0\n p \"#{num1} is odd'\n elsif num1 %2 ==1\n p \"#{num1} is even\"\n end\nend\n\n\n# -------------------2) Create a method that takes in a string and removes all the vowels from the string. Use the test variables provided. HINT: Check out this resource: https://ruby-doc.org/core-2.6/String.html#method-i-delete\n\nalbum1 = 'Rubber Soul'",
"def is_palindrome(input)\n input = input.to_s\n index = 0\n input.each_char do |char|\n if char != input[input.length - index - 1]\n return false\n end\n index += 1\n end\n return true\nend",
"def palindrome?(string)\n x = 0\n y = string.length - 1\n\n while x <= y\n\n if string[x] != string[y]\n return false\n else\n x += 1\n y -= 1\n end\n end\n return true\nend",
"def is_palindrome(string, low, high)\n while low < high\n return false if string[low] != string[high]\n\n low += 1\n high -= 1\n end\n\n true\nend",
"def palindrome_check(my_phrase)\n\n return false if my_phrase == nil\n if my_phrase.length == 0 || my_phrase.length == 1\n return true\n end\n\n b = 0\n e = my_phrase.length - 1\n\n while b < e\n\n while my_phrase[b] == \" \"\n b += 1\n end\n\n while my_phrase[e] == \" \"\n e -= 1\n end\n\n if my_phrase[b] != my_phrase[e] \n return false\n end\n b += 1\n e -= 1\n end \n return true\nend",
"def is_palindrome(str)\n # check for and handle wonky inputs\n if !str.is_a?(String)\n puts \"Whoops: Input str must be a string.\"\n return\n end\n\n # nix case sensitivity by converting to lowercase\n # represent str as an array of letters\n str_array = str.downcase.split(//)\n\n # compare forwards and backwards\n if str_array == str_array.reverse\n return true\n end\n\n # if all else fails\n return false\n\nend",
"def test_reverse\n # Arrange\n even_input = 'reverse this' # Check pair amount of chars\n odd_input = 'reverse thisz' # Check odd amount of chars\n\n # Verify\n verify_reverse_behavior(even_input)\n verify_reverse_behavior(odd_input)\n end",
"def palindrome (word)\n word.length.times do |n|\n if (word[n] != word[word.length - n - 1]) \n return false\n end\n end\n return true\nend",
"def palindrome?(str)\n i = 0\n while i < str.length/2\n if str[i] != str[str.length - i - 1]\n return false\n end\n i = i + 1\n end\n return true\nend",
"def alternating_vowel(sent)\n vowels = 'aeiou'\n words = sent.split\n new_words = []\n words.each_with_index do |word, idx|\n if word.split('').none? { |c| vowels.include?(c) }\n new_words << word\n next\n elsif idx.even?\n word.each_char.with_index do |c, i|\n if vowels.include?(c)\n new_words << word[0...i] + word[i + 1..-1]\n break\n end\n end\n else\n word.reverse.each_char.with_index do |c, i|\n if vowels.include?(c)\n new_words << (word.reverse[0...i] + word.reverse[i + 1..-1]).reverse\n break\n end\n end\n end\n\n\n end\n\n new_words.join(' ')\nend",
"def palindrome_permutation?(string)\n char_array = string.split('')\n hash = {}\n \n char_array.each do |char|\n if hash[char]\n hash[char] += 1\n else\n hash[char] = 1\n end\n end\n\n values = hash.values\n amount_of_single_letters = 0\n\n values.each do |num|\n if num % 2 == 1\n amount_of_single_letters += 1\n end\n end\n\n if amount_of_single_letters <= 1\n return true\n else \n return false\n end\n \nend",
"def palindrome?(string)\n \n begin_index = 0\n end_index = string.length - 1\n \n if string.length == 1\n return true\n end\n \n while begin_index < end_index || begin_index != end_index\n if string[begin_index] == string[end_index]\n begin_index += 1\n end_index -= 1\n palindrome = true\n else\n begin_index = end_index\n palindrome = false\n end\n end\n return palindrome\n \nend",
"def palindrome_permutation str\n str_1 = str.downcase.chars.sort.join\n str_2 = str.downcase.chars.sort.join.reverse\n length = str.length\n for i in 0..length/2\n return false if str_1[i] != str_2[length-i-1]\n end\n return true\nend",
"def is_palindrome(s)\n return true if s.empty?\n return false if s[0] != s[-1]\n return is_palindrome(s[1...-1])\n \n # To do this without creating new strings, make a helper method\n # that accepts additional parameters for left_char and right_char and increments\n # them inward each time, like I did for reverse_in_place with helper_reverse\nend",
"def real_palindrome?(string)\n arr = []\n string.chars.each do |char| arr << char if ('a'..'z').include?(char) || ('A'..'Z').include?(char)\n end\n clean_str = arr.join\n clean_str.downcase == clean_str.downcase.reverse\nend",
"def palindrome_permutation?(string)\n return true if string == \"\"\n\n array = string.split(\"\")\n hash = {}\n\n array.each do |letter|\n if hash[letter].nil?\n hash[letter] = 1\n else\n hash[letter] += 1\n end\n end\n\n return hash.count {|k,v| v.odd?} == 1\nend",
"def palindrome_check(my_phrase)\n return false unless my_phrase\n return true if my_phrase.length < 2\n\n i = 0\n j = my_phrase.length - 1\n\n while i < j\n\n # skips spaces\n while my_phrase[i] == \" \"\n i += 1\n end\n while my_phrase[j] == \" \"\n j -= 1\n end\n\n # compares beginning and end of string\n return false if my_phrase[i] != my_phrase[j]\n i += 1\n j -= 1\n end\n\n return true\nend",
"def palindrome string #func param: string, name: palindrome\n string = string.downcase.scan(/\\w/) #make sure the value is lower case\n string == string.reverse #see if it equals its reverse, and return as boolean statement \nend",
"def palindrome_word? word\n if word.length === 1\n return true\n end\n lower = word.downcase\n num = (lower.length/2.0).floor\n num.times do |x|\n if lower[x] == lower[-(x+1)]\n if x == num - 1\n return true\n end\n next\n else\n return false\n end\n end\nend",
"def palindrome?(string)\n\ttemp = string.downcase.gsub(/\\W/, '')\n\tout = temp.eql? temp.reverse\n\tputs \"Input: \" + string\n\tputs \"output: \" + out.to_s\n\tputs \"\"\nend",
"def vowel_counter(string, vowels_array, syllable_counter)\n string_by_word = string.split(' ')\n p string_by_word\n string_by_word.each do |word|\n p word\n vowels_array.each do |char|\n syllable_counter += word.count(char)\n end\n binding.pry\n # if word ends in E\n if word[-1] === 'e'\n syllable_counter -= 1\n end\n # if word ends in ES\n if word[-1] === 's'\n if word[-2] === 'e'\n syllable_counter -= 1\n end\n end\n # if word has 'AE'\n if word.include?('ae')\n syllable_counter -= 1\n end\n # if word has 'AI'\n if word.include?('ai')\n syllable_counter -= 1\n end\n # if word has 'DGE'\n if word.include?('dge')\n syllable_counter -= 1\n end\n # if word has 'EA'\n if word.include?('ea')\n syllable_counter -= 1\n end\n # if word has 'EI'\n if word.include?('ei')\n syllable_counter -= 1\n end\n # if word has 'GE'\n if word.include?('ge')\n syllable_counter -= 1\n end\n # if word has 'IE'\n if word.include?('ie')\n syllable_counter -= 1\n end\n # if word has 'OA'\n if word.include?('oa')\n syllable_counter -= 1\n end\n # if word has 'OI'\n if word.include?('oi')\n syllable_counter -= 1\n end\n # if word has 'OU'\n if word.include?('ou')\n syllable_counter -= 1\n end\n end\n # remove 21\n p syllable_counter\n end",
"def palindromeRearranging(inputString)\n l = {}; c = []; x = 0\n inputString.split('').map { |i| l[i] = (l[i]) ? l[i] + 1 : 1 }\n l.each { |k, v| c.push(v) }; c.each { |v| x += 1 if v.odd?; return 0 if x > 1 }\nend",
"def palindrome_substrings(string)\n\nend",
"def palidrome?(word)\n j = word.length - 1\n half_length = word.length / 2\n\n half_length.times do |i|\n if word[i] != word[j]\n return false\n end\n j -= 1\n end\n\n return true\nend",
"def is_permutation_palindrome?(s)\n char_hash = {}\n count = 0\n (0...s.length).each do |i|\n c = s[i].downcase.ord\n if c == 32\n next\n end\n if char_hash[c]\n if char_hash[c] % 2 == 1\n char_hash[c] += 1\n count -= 1\n else\n char_hash[c] += 1\n count += 1\n end\n else\n char_hash[c] = 1\n count += 1\n end\n end\n return count <= 1\nend",
"def is_even_palindrome?(nums)\n counter = 0\n nums.map {|num| counter += 1 if num == num.to_s.reverse.to_i}\n if counter % 2 == 0 then return counter else return 0 end\nend",
"def palindrome(str)\nend",
"def real_palindrome?(string)\n string.downcase!\n if string == string.reverse\n p true\n else\n p false\n end\nend",
"def palindromes(str)\n evaluated_words = substrings(str)\n evaluated_words.select { |char| char.size > 1 && char == char.reverse }\nend",
"def is_palindrome(value)\n counts = {}\n (0..value.length - 1).each do |i|\n if value[i] != ' '\n if counts[value[i]]\n counts[value[i]] += 1\n else\n counts[value[i]] = 1\n end\n end\n end\n odd = 0\n counts.keys.each do |i|\n odd += 1 if counts[i].odd?\n end\n odd < 2\nend",
"def palindrome_check(my_phrase)\n if my_phrase == nil\n return false\n end\n\n index = 0\n first_index = 0\n last_index = my_phrase.length - 1\n check = true\n\n while index <= my_phrase.length/2\n # Accounts for spaces for first half of string\n while my_phrase[first_index + index] == \" \"\n first_index += 1\n end\n\n #Accounts for spaces for second half of string\n while my_phrase[last_index - index] == \" \"\n last_index -= 1\n end\n\n # palindrome check\n if my_phrase[first_index + index] != my_phrase[last_index - index]\n check = false\n end\n index += 1\n end\n return check\nend",
"def real_palindrome?(str)\n str.downcase!\n arr = [*'0'..'9', *'a'..'z']\n str = str.chars.select { |x| arr.include?(x) }\n str == str.reverse\nend",
"def palindrome_checker string\n # Create a variable to hold string argument reversed and lowercase\n string_reversed = string.downcase.reverse\n # Compare string argument lowercased to string reversed and lowercased variable\n if string.downcase == string_reversed\n \"#{string} is a palindrome\"\n else\n \"#{string} is not a palindrome\" \n end\nend",
"def is_palindrome(word)\n palindrome = \"\"\n i = 0\n while i < word.length\n palindrome = word[i] + palindrome #concats backwards into palindrome\n i += 1\n end\n return palindrome == word #compares the newly stored backward word, to the word inputted\nend",
"def palindrome?(string)\n reversed = string.reverse\n counter = 0\n while counter < string.length\n if string[counter] != reversed[counter]\n return false\n end\n counter += 1\n end\n return true\nend",
"def valid_palindrome(s)\n i,j = 0, s.length - 1\n \n while i < j\n if s[i] == s[j]\n i += 1\n j -= 1\n else\n return is_palindrome(s[0...i] + s[i+1..-1]) || is_palindrome(s[0...j] + s[j+1..-1])\n end\n end\n return true\nend",
"def palindrome_check(my_phrase)\n return my_phrase != nil if my_phrase == nil || my_phrase.length == 0\n left_index = check_left_index(my_phrase, my_phrase.length - 1)\n right_index = check_right_index(my_phrase, 0)\n is_palindrome = my_phrase[right_index] == my_phrase[left_index]\n while right_index < left_index && is_palindrome\n right_index = check_right_index(my_phrase, right_index + 1)\n left_index = check_left_index(my_phrase, left_index - 1)\n is_palindrome = my_phrase[right_index] == my_phrase[left_index]\n end\n return is_palindrome\nend",
"def longest_palindrome(s)\n hash = {}\n output = 0\n odd = false\n \n s.each_char do |letter|\n hash[letter] = hash[letter] ? hash[letter] + 1 : 1\n end\n \n hash.each do |key, val|\n if val % 2 == 0\n output += val\n else\n output += val - 1 if val > 1\n odd = true\n end\n end\n output += 1 if odd\n output\nend",
"def palindrome_check(my_phrase)\n if my_phrase == nil\n return false\n end\n i = 0\n j = my_phrase.length - 1\n while i < j\n if my_phrase[i] == \" \" || my_phrase[j] == \" \"\n until my_phrase[i] != \" \"\n i += 1\n end\n until my_phrase[j] != \" \"\n j -= 1\n end\n elsif my_phrase[i] != my_phrase[j]\n return false\n end\n i += 1\n j -= 1\n end\n return true\nend",
"def is_palindrome(s, low = 0, high = s.length - 1)\n if s.length < 2 || low >= high \n return true\n elsif s[low] != s[high]\n return false \n else \n return is_palindrome(s, low + 1, high - 1)\n end \n\n return true\nend",
"def odds_and_evens(string, return_odds)\n\tnewString = \"\"\n\tindex = 0\n\tletters = string.split(\"\").each do |letter|\n\t\tif index.even? && return_odds == false\n\t\t\t#puts index\n\t\t\tnewString << letter\n\t\tend\n\t\tif index.odd? && return_odds == true\n\t\t\t#puts index\n\t\t\tnewString << letter\n\t\t\t#print letter\n\t\tend\n\t\tindex +=1\n\tend\n\treturn newString\n\t#puts newString\n\t#puts newString2\n\nend",
"def palindrome_permutation?(string)\n # edge case\n return true if string.empty?\n\n hash = {} \n\n string.length.times do |i| \n hash[string[i]] ? hash[string[i]] += 1 : hash[string[i]] = 1 \n end \n\n hash.count { |letter, count| count % 2 != 0 } > 1 ? false : true \nend",
"def is_palindrome(string)\n\n concate_array = string.downcase.split(\"\")\n backwards = \"\"\n concate_array_no_punc = \"\"\n\n concate_array.length.times do |i|\n if [\":\",\",\",\" \"].include?(concate_array[-1-i])\n nil \n else \n backwards += concate_array[-1-i]\n end\n\n if [\":\",\",\",\" \"].include?(concate_array[i])\n nil \n else \n concate_array_no_punc += concate_array[i]\n end\n end\n\n if backwards == concate_array_no_punc\n return true\n else \n return false\n end\nend",
"def is_palindrome_permutation?(string)\n char_hash = Hash.new(0)\n string_length = 0\n\n string.length.times do |i|\n # count only letter characters\n if(string[i].match(/[a-zA-z]/))\n char_hash[string[i]] += 1\n string_length += 1\n end\n end\n\n # method1\n odd_values_count = char_hash.select{ |k, v| v.odd? }.length\n\n if string.length.odd?\n odd_values_count == 1 ? true : false\n else\n odd_values_count == 0 ? true : false\n end\n\n # method2: another way; odd_values_count cannot exceed 1\n\n odd_values_count = 0\n\n char_hash.each do |k, v|\n odd_values_count += 1 if v.odd?\n return false if odd_values_count > 1\n end\n\n return true\nend",
"def is_palindrome(string) # a b c d c b a, m u m s, e a a e\n left = 0\n right = string.length - 1\n\n while left <= right # 0 != 6, 1 != 5, 2 != 4, 3 != 3\n return false if string[left] != string[right]\n if string[left] == string[right]\n left += 1\n right -= 1\n end\n end\n\n return true if left > right\n false\nend",
"def palindrome?(string)\n\n idx1 = 0\n idx2 = -1\n\n while idx1 < string.length\n if string[idx1] != string[idx2] \n return false\n end\n\n idx1 += 1\n idx2 -= 1\n end\n\n return true\nend",
"def palindrome_check(my_phrase)\n fw_index = 0\n bw_index = -1\n is_a_palindrome = true\n\n if my_phrase == nil\n return false\n end\n\n while my_phrase[fw_index] != nil\n while my_phrase[fw_index] == ' ' && my_phrase[fw_index] != nil\n\n fw_index+=1\n end\n while my_phrase[bw_index] == ' ' && my_phrase[bw_index] != nil\n bw_index = bw_index - 1\n end\n\n if my_phrase[fw_index] != my_phrase[bw_index]\n is_a_palindrome = false\n end\n fw_index+=1\n bw_index-=1\n\n end\n\n return is_a_palindrome\n\nend",
"def real_palindrome?(string)\n\n\tletters = ''\n\n\tstring.downcase.chars.each do |char|\n\t\tif ('a'..'z').to_a.include?(char)\n\t\t\tletters << char\n\t\telsif ('0'..'9').to_a.include?(char)\n\t\t\tletters << char\n\t\tend\n\tend\n\n\tletters == letters.reverse\n\nend",
"def is_palindrome(s, i = 0, j = -1)\n n = s.length \n\n if i >= s.length + j\n return true\n elsif\n s[i] != s[j]\n return false\n elsif s[i] == s[j]\n is_palindrome(s, i + 1, j - 1)\n end \nend",
"def is_palindrome(s, i = 0, j = -1)\n \n return false if s[i] != s[j]\n return true if i > s.length - 1\n \n is_palindrome(s, i + 1, j - 1)\n\nend",
"def is_palindrome(str)\n i = 0\n j = str.size - 1\n pattern = /[a-z0-9]/i\n while i < j\n until str[i] =~ pattern || i == j\n i += 1\n end\n\n until str[j] =~ pattern || i == j\n j -= 1\n end\n\n return false unless str[i].downcase == str[j].downcase\n i += 1\n j -= 1\n end\n true\nend",
"def word_palindrome(word)\n\n index = 0\n end_point = -1\n\n while index < word.length/2\n return false if word[index] != word[end_point-index]\n index+=1\n end\n return true\n\nend",
"def palindrome_checker2 string\n # remove white space from argument using gsub (what being replaced, replacing with what?)\n lowercase_stripped_string = string.downcase.gsub(\" \", \"\")\n # Create a variable to hold stripped string argument reversed \n lowercase_stripped_string_reversed = lowercase_stripped_string.reverse\n # Compare string argument lowercased to string reversed and lowercased variable\n if lowercase_stripped_string == lowercase_stripped_string_reversed\n \"#{string} is a palindrome\"\n else\n \"#{string} is not a palindrome\" \n end\nend",
"def palindrome?(pal_str)\n char_list = pal_str.split\n reverse_list = Array.new\n char_list.length.times do\n reverse_list.push(char_list.pop) unless char_list == []\n end\n reversed_string = reverse_list.join('')\n true if pal_str == reversed_string\nend"
] | [
"0.7324962",
"0.67785645",
"0.67058784",
"0.669905",
"0.66704535",
"0.6653015",
"0.663643",
"0.65785",
"0.65077055",
"0.6502734",
"0.6484548",
"0.6459028",
"0.64204764",
"0.6403513",
"0.640112",
"0.6396102",
"0.63946944",
"0.63855284",
"0.63783765",
"0.6362989",
"0.63521016",
"0.6351365",
"0.63503367",
"0.6339343",
"0.6329527",
"0.63270307",
"0.63203144",
"0.63068265",
"0.62977237",
"0.62930393",
"0.62775606",
"0.62769943",
"0.62749445",
"0.62736976",
"0.62481195",
"0.62437993",
"0.62309784",
"0.6229094",
"0.62286526",
"0.62284833",
"0.62131494",
"0.62129706",
"0.6203531",
"0.61985195",
"0.6196458",
"0.6193988",
"0.61927485",
"0.61908805",
"0.61847717",
"0.6180472",
"0.61797166",
"0.61742616",
"0.6173643",
"0.6171618",
"0.6168712",
"0.6155285",
"0.61512613",
"0.61509466",
"0.61474186",
"0.614673",
"0.61451703",
"0.61449414",
"0.614285",
"0.6140896",
"0.61403084",
"0.613924",
"0.61295307",
"0.6128542",
"0.6126076",
"0.61216146",
"0.611828",
"0.6117883",
"0.6116974",
"0.6107149",
"0.6100874",
"0.6096242",
"0.609379",
"0.6092501",
"0.6090404",
"0.6089383",
"0.60890037",
"0.60884124",
"0.6075618",
"0.60751253",
"0.6071959",
"0.6064244",
"0.60639566",
"0.6058664",
"0.60563934",
"0.60530764",
"0.6049872",
"0.6049387",
"0.60484165",
"0.60471433",
"0.60471326",
"0.6045159",
"0.6043214",
"0.6042537",
"0.6041347",
"0.60406363",
"0.6037639"
] | 0.0 | -1 |
Confirms an admin user. | def admin_user
redirect_to(root_url) unless current_user.is_admin?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def confirm_admin\n \tunless session[:admin]\n \t\tflash[:notice] = \"You are not an admin.\"\n \t\tredirect_to(user_path( :id => session[:user_id]))\n \tend\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 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_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 unless current_user.is_admin?\n flash[:danger] = \"Keine Berechtigung.\"\n redirect_to(root_url)\n end\n end",
"def admin_user\n unless current_user.is_admin?\n flash[:danger] = \"Keine Berechtigung.\"\n redirect_to(root_url)\n end\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 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\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 confirm_admin\n @confirm_admin = true if session[:role_name] == 'Administrator'\n end",
"def confirm_admin\n redirect_to root_path unless current_user.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 admin_user\n\t unless current_user.admin?\n flash[:danger] = \"Log in as Admin.\"\n redirect_to(root_url)\n\t end \n\t end",
"def admin_user\n unless current_user && current_user.admin?\n store_location\n flash[:danger] = \"Please log in as admin.\"\n redirect_to users_url\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_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 admin_user!\n unless signed_in? and current_user.admin?\n\t flash[:notice]=\"Por favor inicie sesión como administrador\".encode('UTF-8')\n\t redirect_back(fallback_location: root_path) \n end\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 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_user\n redirect_to(root_path) unless current_user.try(:admin?) || current_user?(@user)\n end",
"def verify_admin\n if !current_user.present? || current_user.email != I18n.t('general.admin_email')\n redirect_to concerts_path\n flash[:notice] = I18n.t('general.log_as_admin')\n end\n end",
"def admin_user\n redirect_to(root_path) unless (current_user != nil && current_user.admin == true)\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 redirect_to root_url, notice: \"You do not have permission to view or edit this information.\" unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless !current_user?(@user) && current_user.admin?\n end",
"def admin_user\n \n unless current_user.admin?\n \tflash[:danger] = \"Please log in with the correct user name.\"\n \tredirect_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 admin_user\n redirect_to(root_path) unless is_admin?\n end",
"def correct_user\n\t\t\tauthenticate_user!\n\t\t\tunless @user == current_user || current_user.admin?\n\t\t\t\tredirect_to (root_path)\n\t\t\t\tflash[:alert]\n\t\t\tend\n\t\tend",
"def admin\n unless current_user.admin?\n redirect_to root_url\n flash[:danger] = \"You have no access here\"\n end\n end",
"def admin_user\n if logged_in?\n redirect_to(root_url) unless current_user.admin?\n else\n flash[:danger] = \"You reached an invalid url and have been redirected to the home page.\"\n redirect_to(root_url)\n end\n end",
"def admin_user\n @user = current_user\n redirect_to @user unless @user.admin?\n end",
"def admin_user\n if (!current_user || current_user.username != 'admin')\n redirect_to(root_url)\n end\n end",
"def check_admin\n redirect_to root_path, alert: \"You do not have admin privileges.\" unless current_user.admin\n end",
"def check_admin\n redirect_to root_path, alert: \"You do not have admin privileges.\" unless current_user.admin\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_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 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 admin_user\n\t\t\tredirect_to(root_url) unless current_user.admin?\n\t end",
"def correct_user\n @userAdmin = UserAdmin.find(params[:id])\n unless current_user?(@userAdmin)\n flash[:danger] = \"You don't have the rights for this page/action.\"\n redirect_to(root_url)\n end\n end",
"def admin_user\n redirect_to(root_url) unless user_signed_in? && current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless user_signed_in? && current_user.admin?\n end",
"def admin_user\n redirect_to(root_path) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_path) unless current_user.admin?\n end",
"def admin\n\t\tauthenticate_user!\n\t if current_user.admin\n\t\t return\n\t else\n\t\t redirect_to root_url\n\t end\n\tend",
"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 verify_admin_of_user\n redirect_to admins_path,\n flash: { alert: I18n.t(\"administrator.flash.unauthorized\") } unless current_user.admin_of?(@user, \"can_manage_users\")\n end",
"def admin_user\n redirect_to(root_url) unless current_user.is_admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.is_admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.is_admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.is_admin?\n end",
"def admin_user\n unless admin_user?\n redirect_to login_url\n end\n end",
"def check_admin_status\n if current_user.nil? || !current_user.admin?\n flash[:alert] = \"Access denied. Please login as an admin user\"\n redirect_to root_url\n end\n end",
"def check_admin_status\n if current_user.nil? || !current_user.admin?\n flash[:alert] = \"Access denied. Please login as an admin user\"\n redirect_to root_url\n end\n end",
"def admin_user\n redirect_to(admin_admins_path) unless current_user.admin?\n end",
"def admin_user\n redirect_to(current_user) unless current_user.admin?\n end",
"def admin!\n redirect_to root_path, alert: \"Not authorized\" and return unless is_admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin? # se current_user.admin for falso redireciona para pagina principal\n end",
"def authenticate_admin\n\t\tauthenticate_user!\n\t\tunless current_user.approved == 1\n\t\t\tsign_out\n\t\t\tflash[:error] = \"User is not admin! Try again using another username!\"\n\t\t\tredirect_to new_user_session_path\n\t\t\t# redirect_to new_user_session_path\n\t\tend\n\tend",
"def correct_admin\n @admin_admin = Admin::Admin.find(params[:id])\n redirect_to(admin_admins_path) unless current_user?(@admin_admin)\n end",
"def admin_user\n unless logged_in? && current_user.admin?\n redirect_to root_url\n end\n end",
"def req_admin\n unless curr_user.admin\n flash[:danger] = \"You must be admin to go there!\"\n redirect_to root_url\n end\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end"
] | [
"0.79044944",
"0.767215",
"0.76483077",
"0.76210374",
"0.7605678",
"0.7605678",
"0.75945777",
"0.7588445",
"0.7588445",
"0.7503662",
"0.74675834",
"0.7451482",
"0.7424005",
"0.7411313",
"0.74107665",
"0.7402138",
"0.73993605",
"0.7358812",
"0.7329228",
"0.73179626",
"0.7312765",
"0.72796166",
"0.7269636",
"0.7246544",
"0.72386354",
"0.7231975",
"0.72179013",
"0.7173976",
"0.71720684",
"0.7166012",
"0.71593285",
"0.71537924",
"0.7137113",
"0.7124807",
"0.71221524",
"0.71221524",
"0.7120586",
"0.7120586",
"0.7120474",
"0.7118341",
"0.7118341",
"0.7118329",
"0.7113378",
"0.710956",
"0.710956",
"0.71021533",
"0.71021533",
"0.7098989",
"0.709487",
"0.7092022",
"0.70904475",
"0.70904475",
"0.70904475",
"0.70904475",
"0.7076285",
"0.7067073",
"0.7067073",
"0.7066295",
"0.70532054",
"0.7049086",
"0.7041013",
"0.703546",
"0.70188206",
"0.701779",
"0.70146185",
"0.70101637",
"0.70089686",
"0.70089686",
"0.70089686",
"0.70089686",
"0.70089686",
"0.70089686",
"0.70089686",
"0.70089686",
"0.70089686",
"0.70089686",
"0.70089686",
"0.70089686",
"0.70089686",
"0.70089686",
"0.70089686",
"0.70089686",
"0.70089686",
"0.70089686",
"0.70089686",
"0.70089686",
"0.70089686",
"0.70089686",
"0.70089686",
"0.70089686",
"0.70089686",
"0.70089686",
"0.70089686",
"0.70089686",
"0.70089686",
"0.70089686",
"0.70089686",
"0.70089686",
"0.70089686",
"0.70089686",
"0.70089686"
] | 0.0 | -1 |
GET /activities GET /activities.json | def index
@activities = Activity.all(limit: ActivitiesController::MAX_SEARCH_RESULTS)
respond_to do |format|
format.html # index.html.erb
format.json { render json: @activities }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def activities\n get_call(\"1/activities.json\")\n end",
"def activities(params = {})\n scope 'default'\n get('activities/', params)\n end",
"def activity(id)\n get(\"/activities/#{id}.json\")\n end",
"def activity(id)\n get(\"/activities/#{id}.json\")\n end",
"def activities(options={})\n response = connection.get do |req|\n req.url \"activities\", options\n end\n return_error_or_body(response)\n end",
"def recent_activities\n get(\"/user/#{@user_id}/activities/recent.json\")\n end",
"def activities(options = {})\n get('/user/activities', query: options)\n end",
"def recent_activities()\n get(\"/user/#{@user_id}/activities/recent.json\")\n end",
"def activities(id)\n get(\"/accounts/#{id}/activities\")['activities']\n end",
"def index\n @activities = Activity.all\n render json: @activities\n end",
"def index(user)\n activities = []\n json = eval(RestClient.get(ENDPOINT + \"/activities?user_id=#{user}\").to_s)\n json.each do |attributes|\n activities << Activity.new(attributes)\n end\n activities\n end",
"def activity(params={})\n Endpoints::Activity.new(self).get(params)\n end",
"def show\n begin\n @activity = PublicActivity::Activity.all.find(params[:id])\n rescue ActiveRecord::RecordNotFound\n return render_errors(['No activity found.'])\n end\n\n return render :json => {:status => 1, :activities => @activities}\n end",
"def favorite_activities\n get(\"/user/#{@user_id}/activities/favorite.json\")\n end",
"def show\n @activity = current_user.activities.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @activity }\n end\n end",
"def favorite_activities()\n get(\"/user/#{@user_id}/activities/favorite.json\")\n end",
"def show\n @activity = current_user.user_activities.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @activity }\n end\n end",
"def activities_get(opts = {})\n activities_get_with_http_info(opts)\n end",
"def activity_statistics\n get(\"/user/#{@user_id}/activities.json\")\n end",
"def activity_statistics\n get(\"/user/#{@user_id}/activities.json\")\n end",
"def frequent_activities\n get(\"/user/#{@user_id}/activities/frequent.json\")\n end",
"def frequent_activities()\n get(\"/user/#{@user_id}/activities/frequent.json\")\n end",
"def get_activities(opts = {})\n data, _status_code, _headers = get_activities_with_http_info(opts)\n return data\n end",
"def index\n @activities = current_user.activities\n end",
"def get_activities\n\t\tviewer = nil\n\t\tviewer = User.find_by_id(params[:user_id]) if (params.has_key?(:user_id))\n\t\t\n @activities = Activity.getActivitiesBy2(params[:category_id], params[:user_id])\n\t\t([email protected]).each {|ndx| @activities[ndx].viewer = viewer}\n render :json => @activities\n end",
"def show\n @activities = Activity.where('schedule_id': params[:id])\n render json: @activities.as_json\n end",
"def all_activities(**args)\n params = parameters(args) do\n optional_params :user_id, :filter_id, :type, :start, :limit, :start_date, :end_date, :done\n end\n request(:get, 'activities', params)\n end",
"def show\n render json: @activity\n end",
"def index\n @activities = current_user.activities\n @profile = current_user.profile # Comeback too\n @categories = Category.all\n respond_to do |format|\n format.html\n format.json { render json: @activities }\n end\n end",
"def activities_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ActivitiesApi.activities_get ...\"\n end\n # resource path\n local_var_path = \"/activities\"\n\n # query parameters\n query_params = {}\n query_params[:'user_id'] = opts[:'user_id'] if !opts[:'user_id'].nil?\n query_params[:'filter_id'] = opts[:'filter_id'] if !opts[:'filter_id'].nil?\n query_params[:'type'] = opts[:'type'] if !opts[:'type'].nil?\n query_params[:'start'] = opts[:'start'] if !opts[:'start'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'start_date'] = opts[:'start_date'] if !opts[:'start_date'].nil?\n query_params[:'end_date'] = opts[:'end_date'] if !opts[:'end_date'].nil?\n query_params[:'done'] = opts[:'done'] if !opts[:'done'].nil?\n\n # header parameters\n header_params = {}\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = [ 'access_token' ]\n response = @api_client.call_api(:GET, local_var_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: ActivitiesApi#activities_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return response\n end",
"def get_activities_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ActivitiesApi.get_activities ...\"\n end\n # resource path\n local_var_path = \"/activities\"\n\n # query parameters\n query_params = {}\n query_params[:'filter_template'] = opts[:'filter_template'] if !opts[:'filter_template'].nil?\n query_params[:'filter_name'] = opts[:'filter_name'] if !opts[:'filter_name'].nil?\n query_params[:'filter_id'] = opts[:'filter_id'] if !opts[:'filter_id'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2_client_credentials_grant', 'oauth2_password_grant']\n data, status_code, headers = @api_client.call_api(:GET, local_var_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 :return_type => 'PageResourceBareActivityResource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ActivitiesApi#get_activities\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n @activities = Activity.all\n end",
"def index\n @activities = Activity.all\n end",
"def index\n @activities = Activity.all\n end",
"def index\n @activities = Activity.all\n end",
"def index\n @activities = Activity.all\n end",
"def index\n @activities = Activity.all\n end",
"def index\n @activities = Activity.all\n end",
"def index\n @activities = Activity.all\n end",
"def index\n @activities = Activity.all\n end",
"def index\n @activities = Activity.all\n end",
"def show\n @selected_user = User.find_by_id(params[:id])\n @activities = @selected_user.activities.order(\"created_at DESC\")\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @activities }\n end\n end",
"def activities\n @activities = if @project\n @project.activities\n else\n User.current.projects.all(:include => :time_entry_activities).map(&:time_entry_activities).flatten + TimeEntryActivity.shared.active\n end\n\n respond_to do |format|\n format.xml\n end\n end",
"def activities\n add_to_query restrict_kind: 'activity'\n end",
"def show\n @activity = Activity.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @activity }\n end\n end",
"def show\n @activity = Activity.find(params[:id])\n respond_to do |format|\n format.html\n format.json { render json: @activity}\n end\n end",
"def user_activities(id:, **args)\n params = parameters(args) do\n optional_params :due_date, :type, :start, :limit, :done\n end\n request(:get, \"users/#{id}/activities\", params)\n end",
"def goals\n get(\"/user/#{@user_id}/activities/goals/daily.json\")\n end",
"def goals\n get(\"/user/#{@user_id}/activities/goals/daily.json\")\n end",
"def index\n if logged_in? && current_user.identity.eql?(1)\n @activities = Activity.all\n else\n not_found\n end\n end",
"def index\n @activities = current_user.attending_activities\n render :index\n end",
"def activity_detail(id:, **args)\n params = parameters(args) do\n optional_params\n end\n request(:get, \"activities/#{id}\", params)\n end",
"def activities_on_date(date)\n get(\"/user/#{@user_id}/activities/date/#{format_date(date)}.json\")\n end",
"def activities_on_date(date)\n get(\"/user/#{@user_id}/activities/date/#{format_date(date)}.json\")\n end",
"def show\n @activity = Activity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @activity }\n end\n end",
"def show\n @activity = Activity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @activity }\n end\n end",
"def fetch(activity_id)\n RubyRedtail::Query.run(\"calendar/activities/#{activity_id}\", @api_hash, \"GET\")\n end",
"def activities(options)\n activities_request build_url_parameters(options).merge(detailed: true)\n end",
"def get_activities(user_id, params = {})\n user_id = user_id.to_s\n validate_identifier(:user_id, user_id)\n call_myspace_api(:activities, params.dup.update(:user_id => user_id))\n end",
"def index\n @response = JSON.parse(current_user.access_token.token.get('/api/v0/aspects'))\n @activities = @response\n respond_to do |format|\n format.html\n format.json {render :json=> @response, :callback=>params[:callback]}\n end\n end",
"def fetch_activities(token, params)\n params.to_options!\n\n # Setup params.\n setup_params_logic = lambda do |last_request, params|\n if !last_request.blank?\n params[:occurred_since_date] = last_request\n end\n end\n\n # Parse the response.\n response_parse_logic = lambda do |response|\n content_keys = {}\n doc = Nokogiri::XML(response.body)\n\n doc.xpath(\"/activities//activity\").each do |act|\n id = act.search('id').first.inner_html\n content_keys[id] = act.to_s\n end\n content_keys\n end\n\n url = format_project_url(get_api_url('activities'), params[:project_id])\n fetch(::PivotalTracker::Activity, token, url,\n response_parse_logic, setup_params_logic, true)\n end",
"def tracker_activities\n resp = @conn.get(\"projects/#{@project}/activity?limit=1000&occurred_after=#{(Time.now - 14*60*60*24).iso8601}\")\n @tracker_activities = JSON.parse(resp.body, symbolize_names: true)\n next_ind = next_page(resp)\n while next_ind.positive? do\n resp = @conn.get(\"projects/#{@project}/activity?limit=1000&offset=#{next_ind}&occurred_after=#{(Time.now - 14*60*60*24).iso8601}\")\n @tracker_activities += JSON.parse(resp.body, symbolize_names: true)\n next_ind = next_page(resp)\n end\n end",
"def activity(user = nil, opts = {})\n client.get_activity(user, opts)\n end",
"def activities\n\t activity_feed.activities\n\tend",
"def get_activities\n @params=task_params\n @project=current_user.projects.find(@params[:project_id])\n counter=0\n @res=[]\n @project.activities.each do |p|\n if p.users.include? current_user\n @res[counter]={\n activity_id: p.id, \n name: p.name\n }\n counter+=1\n end\n end\n respond_to do |format|\n format.json {render json: @res.uniq}\n end\n end",
"def show\n @activity_type = ActivityType.find(params[:id]) \n @activitypage = @activity_type.activities.page(params[:page]).per(20)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @activity_type }\n end\n end",
"def get_activity\n\t\tviewer = nil\n\t\tviewer = User.find_by_id(params[:user_id]) if (params.has_key?(:user_id))\n\t\t\n @activity = Activity.find(params[:activity_id])\n\t\[email protected] = viewer if ([email protected]?)\n\t\t\n render :json => @activity\n end",
"def get_all_activties_for_user\n\n\t@activities = Activity.all(:user_id => params[:user_id]) \n\n\t#get json format\n\tarr = Array(@activities) \n @json_format ={ 'Activities' => arr}.to_json\n\t@title = \"All Activities for ##{params[:user_id]}\"\n\t#redirect to home page\n\terb :home\nend",
"def show\n render json: @day, include: [:activities]\n end",
"def get_activities(user_id, params = {})\r\n user_id = user_id.to_s\r\n @context.validate_identifier(:user_id, user_id)\r\n @context.call_myspace_api(:activities, params.dup.update(:user_id => user_id))\r\n end",
"def index\n @activities = @team.activities\n @activity = Activity.new(team_id: @team.id)\n end",
"def show\n @my_activity = MyActivity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @my_activity }\n end\n end",
"def index\n @user_activities = UserActivity.all\n end",
"def index\n @user_activities = UserActivity.all\n end",
"def index\n @user_activities = UserActivity.all\n end",
"def list_activities\n GooglePlus::Activity.for_person(id)\n end",
"def index\n render json: TeachingActivity.all\n end",
"def activities\n return @activities\n end",
"def show\n @recent_activity = RecentActivity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @recent_activity }\n end\n end",
"def get_project_activities(project_id_or_key, params = {})\n get(\"projects/#{project_id_or_key}/activities\", params)\n end",
"def activities(params = {})\n rv = []\n try_again = true\n fetched = 0\n p = params.dup\n p[:offset] = 0\n\n while try_again do\n result = api_call(ROOT_ACTIVITIES, p)\n return nil if result.nil?\n rv += result[:results]\n\n meta = result[:meta]\n fetched += meta[:count]\n if fetched >= meta[:total]\n try_again = false\n else\n p[:offset] += meta[:count]\n end\n end\n\n rv\n end",
"def activities(per_page: nil, page: nil)\n if page || per_page\n get_activities(per_page: per_page, page: page)\n else\n get_activities if @activities.empty?\n @activities.values\n end\n end",
"def get_activities_by_object_type_and_id(object_type, id)\n return @client.raw(\"get\", \"/helpers/activities/#{object_type}/#{id}\")\n end",
"def show\n @activity = Activity.find(params[:id])\n\n if current_user\n \t@user = current_user\n \t@user_activity = UserActivity.find_by_user_id_and_activity_id @user.id, @activity.id\n \t\n \tRails.logger.info \"#{@user_activity.inspect}\"\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @activity }\n end\n end",
"def new\n @my_activity = MyActivity.new\n @all_activites = MyActivity.where(\"user_id =?\", current_user.id).order('created_at DESC').limit(10)\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @my_activity }\n end\n end",
"def activities=(value)\n @activities = value\n end",
"def get_activities_by_object_type_and_id(object_type, id)\n @client.raw('get', \"/helpers/activities/#{object_type}/#{id}\")\n end",
"def index\n @activities = PublicActivity::Activity.published\n\n if params[:recipient_type] and recipient_klass = params[:recipient_type].safe_constantize and r_id = params[:recipient_id] and @recipient = recipient_klass.find(r_id)\n @activities = @activities.on(@recipient)\n elsif current_user\n # This is user current feed !\n query_params = ['User', current_user.id]\n query = \"(activities.recipient_type = ? AND activities.recipient_id = ?)\"\n\n # Followed Pages\n if pages = current_user.followed_pages and pages.present?\n query += \" OR (activities.recipient_type = ? AND activities.recipient_id IN (?))\"\n query_params += [\"Page\"] + [pages.collect(&:id)]\n end\n\n @activities = @activities.where(query, *query_params)\n\n else\n head :bad_request # should not happen\n end\n\n @activities = @activities.order('updated_at DESC, created_at DESC').page(params[:page]).per(5)\n \n authorize @activities\n end",
"def activities\n @persona = Persona.where(:screen_name => params[:persona_id]).first\n @activity = @persona.get_activity( params ) \n\n\t\t#setup default parameters\n\t\t#params[:targetDiv] = params.has_key? :targetDiv ? params[:targetDiv] : '#recent-activity-body'\n\t\tif !params.has_key? :targetDiv then\n\t\t\tparams[:targetDiv] = '#recent-activity-body'\n\t\tend\n\n\t\tjs :params => { :screen_name => @persona.screen_name }\n\t\trespond_to do |format| \n\t\t\tformat.html\n\t\t\tformat.js\n\t\tend\n end",
"def index\n@activity = Activity.all\nend",
"def index\n @current_activities = CurrentActivity.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @current_activities }\n end\n end",
"def index\n @status_activities = StatusActivity.all\n end",
"def index\n \n @activities = Activity.search(params[:search], params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @activities }\n end\n end",
"def show\n @activity = Activity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @activity }\n format.json { render :json => @activity.to_json }\n end\n end",
"def show\n @project = Project.find(params[:id])\n @activities = PublicActivity::Activity.order('created_at desc').where(:project_id=>@project.id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end",
"def index\n @activities = @user.activities.where(\"date = ?\", requested_date(params[:date]))\n end",
"def show\n @user = User.find(params[:id])\n @activities = PublicActivity::Activity.where(owner_type: \"User\", owner_id: @user.id).limit(5).order(\"created_at DESC\")\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end",
"def activities\n children('activities')\n end",
"def show\n @activity = Activity.find(params[:id])\n end",
"def show\n @activity_item = ActivityItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @activity_item }\n end\n end"
] | [
"0.87228423",
"0.823766",
"0.8175158",
"0.8175158",
"0.8160505",
"0.8032669",
"0.7979835",
"0.7971086",
"0.79515815",
"0.7610422",
"0.7540613",
"0.75270593",
"0.7450179",
"0.7426079",
"0.7413399",
"0.7386743",
"0.73542464",
"0.7342398",
"0.7319785",
"0.7319785",
"0.7276885",
"0.7265386",
"0.7224823",
"0.71871954",
"0.7140154",
"0.71048063",
"0.7086174",
"0.7061795",
"0.7045794",
"0.7027182",
"0.702402",
"0.7011353",
"0.7011353",
"0.7011353",
"0.7011353",
"0.7011353",
"0.7011353",
"0.7011353",
"0.7011353",
"0.7011353",
"0.7011353",
"0.6999683",
"0.69913983",
"0.6979421",
"0.69322425",
"0.6897124",
"0.68824714",
"0.68638396",
"0.68630403",
"0.6856915",
"0.6854757",
"0.68350405",
"0.68299806",
"0.68299806",
"0.6827774",
"0.6827774",
"0.68068796",
"0.6792977",
"0.6785133",
"0.6740981",
"0.6733991",
"0.67234975",
"0.67174387",
"0.6677911",
"0.6675238",
"0.66725785",
"0.6665784",
"0.66549563",
"0.66415304",
"0.6634329",
"0.663229",
"0.66295105",
"0.6628019",
"0.6628019",
"0.6628019",
"0.66142344",
"0.66113347",
"0.66074747",
"0.6595737",
"0.6594045",
"0.65759075",
"0.6562656",
"0.65597546",
"0.65575093",
"0.6551308",
"0.6548389",
"0.6519388",
"0.6506123",
"0.64859843",
"0.6460439",
"0.6450947",
"0.64430094",
"0.64384705",
"0.643763",
"0.6426068",
"0.6401069",
"0.6395022",
"0.6368612",
"0.6360113",
"0.6315889"
] | 0.69915974 | 42 |
GET /activities/1 GET /activities/1.json | def show
@activity = Activity.find(params[:id])
if current_user
@user = current_user
@user_activity = UserActivity.find_by_user_id_and_activity_id @user.id, @activity.id
Rails.logger.info "#{@user_activity.inspect}"
end
respond_to do |format|
format.html # show.html.erb
format.json { render json: @activity }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def activity(id)\n get(\"/activities/#{id}.json\")\n end",
"def activity(id)\n get(\"/activities/#{id}.json\")\n end",
"def activities\n get_call(\"1/activities.json\")\n end",
"def show\n begin\n @activity = PublicActivity::Activity.all.find(params[:id])\n rescue ActiveRecord::RecordNotFound\n return render_errors(['No activity found.'])\n end\n\n return render :json => {:status => 1, :activities => @activities}\n end",
"def activities(params = {})\n scope 'default'\n get('activities/', params)\n end",
"def recent_activities\n get(\"/user/#{@user_id}/activities/recent.json\")\n end",
"def show\n @activity = current_user.activities.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @activity }\n end\n end",
"def recent_activities()\n get(\"/user/#{@user_id}/activities/recent.json\")\n end",
"def show\n @activity = current_user.user_activities.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @activity }\n end\n end",
"def index\n @activities = Activity.all\n render json: @activities\n end",
"def activity(params={})\n Endpoints::Activity.new(self).get(params)\n end",
"def activities(id)\n get(\"/accounts/#{id}/activities\")['activities']\n end",
"def show\n @activity = Activity.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @activity }\n end\n end",
"def show\n @activity = Activity.find(params[:id])\n respond_to do |format|\n format.html\n format.json { render json: @activity}\n end\n end",
"def activities(options={})\n response = connection.get do |req|\n req.url \"activities\", options\n end\n return_error_or_body(response)\n end",
"def show\n @activities = Activity.where('schedule_id': params[:id])\n render json: @activities.as_json\n end",
"def show\n @activity = Activity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @activity }\n end\n end",
"def show\n @activity = Activity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @activity }\n end\n end",
"def index(user)\n activities = []\n json = eval(RestClient.get(ENDPOINT + \"/activities?user_id=#{user}\").to_s)\n json.each do |attributes|\n activities << Activity.new(attributes)\n end\n activities\n end",
"def show\n render json: @activity\n end",
"def activity_detail(id:, **args)\n params = parameters(args) do\n optional_params\n end\n request(:get, \"activities/#{id}\", params)\n end",
"def show\n @my_activity = MyActivity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @my_activity }\n end\n end",
"def favorite_activities\n get(\"/user/#{@user_id}/activities/favorite.json\")\n end",
"def favorite_activities()\n get(\"/user/#{@user_id}/activities/favorite.json\")\n end",
"def activities(options = {})\n get('/user/activities', query: options)\n end",
"def frequent_activities\n get(\"/user/#{@user_id}/activities/frequent.json\")\n end",
"def show\n @recent_activity = RecentActivity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @recent_activity }\n end\n end",
"def frequent_activities()\n get(\"/user/#{@user_id}/activities/frequent.json\")\n end",
"def show\n @selected_user = User.find_by_id(params[:id])\n @activities = @selected_user.activities.order(\"created_at DESC\")\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @activities }\n end\n end",
"def activity_statistics\n get(\"/user/#{@user_id}/activities.json\")\n end",
"def activity_statistics\n get(\"/user/#{@user_id}/activities.json\")\n end",
"def get_activity\n\t\tviewer = nil\n\t\tviewer = User.find_by_id(params[:user_id]) if (params.has_key?(:user_id))\n\t\t\n @activity = Activity.find(params[:activity_id])\n\t\[email protected] = viewer if ([email protected]?)\n\t\t\n render :json => @activity\n end",
"def show\n @activity_type = ActivityType.find(params[:id]) \n @activitypage = @activity_type.activities.page(params[:page]).per(20)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @activity_type }\n end\n end",
"def fetch(activity_id)\n RubyRedtail::Query.run(\"calendar/activities/#{activity_id}\", @api_hash, \"GET\")\n end",
"def show\n @activity = Activity.find(params[:id])\n end",
"def index\n @activities = current_user.activities\n end",
"def index\n @activities = Activity.all\n end",
"def index\n @activities = Activity.all\n end",
"def index\n @activities = Activity.all\n end",
"def index\n @activities = Activity.all\n end",
"def index\n @activities = Activity.all\n end",
"def index\n @activities = Activity.all\n end",
"def index\n @activities = Activity.all\n end",
"def index\n @activities = Activity.all\n end",
"def index\n @activities = Activity.all\n end",
"def index\n @activities = Activity.all\n end",
"def show\n @activity_item = ActivityItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @activity_item }\n end\n end",
"def show\n @activity = Activity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @activity }\n format.json { render :json => @activity.to_json }\n end\n end",
"def show\n @project = Project.find(params[:id])\n @activities = PublicActivity::Activity.order('created_at desc').where(:project_id=>@project.id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end",
"def index\n \t@activities = Activity.all(limit: ActivitiesController::MAX_SEARCH_RESULTS)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @activities }\n end\n end",
"def get_activities\n\t\tviewer = nil\n\t\tviewer = User.find_by_id(params[:user_id]) if (params.has_key?(:user_id))\n\t\t\n @activities = Activity.getActivitiesBy2(params[:category_id], params[:user_id])\n\t\t([email protected]).each {|ndx| @activities[ndx].viewer = viewer}\n render :json => @activities\n end",
"def activity(user = nil, opts = {})\n client.get_activity(user, opts)\n end",
"def index\n @activities = current_user.activities\n @profile = current_user.profile # Comeback too\n @categories = Category.all\n respond_to do |format|\n format.html\n format.json { render json: @activities }\n end\n end",
"def new\n @my_activity = MyActivity.new\n @all_activites = MyActivity.where(\"user_id =?\", current_user.id).order('created_at DESC').limit(10)\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @my_activity }\n end\n end",
"def index\n if logged_in? && current_user.identity.eql?(1)\n @activities = Activity.all\n else\n not_found\n end\n end",
"def activities_on_date(date)\n get(\"/user/#{@user_id}/activities/date/#{format_date(date)}.json\")\n end",
"def activities_on_date(date)\n get(\"/user/#{@user_id}/activities/date/#{format_date(date)}.json\")\n end",
"def get_activities_by_object_type_and_id(object_type, id)\n return @client.raw(\"get\", \"/helpers/activities/#{object_type}/#{id}\")\n end",
"def get_activities_by_object_type_and_id(object_type, id)\n @client.raw('get', \"/helpers/activities/#{object_type}/#{id}\")\n end",
"def show\n @user = User.find(params[:id])\n @activities = PublicActivity::Activity.where(owner_type: \"User\", owner_id: @user.id).limit(5).order(\"created_at DESC\")\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end",
"def show\n render json: @day, include: [:activities]\n end",
"def activities_get(opts = {})\n activities_get_with_http_info(opts)\n end",
"def activities_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ActivitiesApi.activities_get ...\"\n end\n # resource path\n local_var_path = \"/activities\"\n\n # query parameters\n query_params = {}\n query_params[:'user_id'] = opts[:'user_id'] if !opts[:'user_id'].nil?\n query_params[:'filter_id'] = opts[:'filter_id'] if !opts[:'filter_id'].nil?\n query_params[:'type'] = opts[:'type'] if !opts[:'type'].nil?\n query_params[:'start'] = opts[:'start'] if !opts[:'start'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'start_date'] = opts[:'start_date'] if !opts[:'start_date'].nil?\n query_params[:'end_date'] = opts[:'end_date'] if !opts[:'end_date'].nil?\n query_params[:'done'] = opts[:'done'] if !opts[:'done'].nil?\n\n # header parameters\n header_params = {}\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = [ 'access_token' ]\n response = @api_client.call_api(:GET, local_var_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: ActivitiesApi#activities_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return response\n end",
"def index\n @activities = @team.activities\n @activity = Activity.new(team_id: @team.id)\n end",
"def show\n @activity=Activity.find(params[:id])\n end",
"def index\n @activities = current_user.attending_activities\n render :index\n end",
"def index\n @response = JSON.parse(current_user.access_token.token.get('/api/v0/aspects'))\n @activities = @response\n respond_to do |format|\n format.html\n format.json {render :json=> @response, :callback=>params[:callback]}\n end\n end",
"def get_activities\n @params=task_params\n @project=current_user.projects.find(@params[:project_id])\n counter=0\n @res=[]\n @project.activities.each do |p|\n if p.users.include? current_user\n @res[counter]={\n activity_id: p.id, \n name: p.name\n }\n counter+=1\n end\n end\n respond_to do |format|\n format.json {render json: @res.uniq}\n end\n end",
"def goals\n get(\"/user/#{@user_id}/activities/goals/daily.json\")\n end",
"def get_activities(user_id, params = {})\n user_id = user_id.to_s\n validate_identifier(:user_id, user_id)\n call_myspace_api(:activities, params.dup.update(:user_id => user_id))\n end",
"def goals\n get(\"/user/#{@user_id}/activities/goals/daily.json\")\n end",
"def get_activities_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ActivitiesApi.get_activities ...\"\n end\n # resource path\n local_var_path = \"/activities\"\n\n # query parameters\n query_params = {}\n query_params[:'filter_template'] = opts[:'filter_template'] if !opts[:'filter_template'].nil?\n query_params[:'filter_name'] = opts[:'filter_name'] if !opts[:'filter_name'].nil?\n query_params[:'filter_id'] = opts[:'filter_id'] if !opts[:'filter_id'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2_client_credentials_grant', 'oauth2_password_grant']\n data, status_code, headers = @api_client.call_api(:GET, local_var_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 :return_type => 'PageResourceBareActivityResource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ActivitiesApi#get_activities\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n@activity = Activity.all\nend",
"def index\n render json: TeachingActivity.all\n end",
"def activities\n @activities = if @project\n @project.activities\n else\n User.current.projects.all(:include => :time_entry_activities).map(&:time_entry_activities).flatten + TimeEntryActivity.shared.active\n end\n\n respond_to do |format|\n format.xml\n end\n end",
"def show\n @work_activity = WorkActivity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @work_activity }\n end\n end",
"def show\n @step_activity = StepActivity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @step_activity }\n end\n end",
"def index\n @status_activities = StatusActivity.all\n end",
"def index\n @user_activities = UserActivity.all\n end",
"def index\n @user_activities = UserActivity.all\n end",
"def index\n @user_activities = UserActivity.all\n end",
"def new\n @activity = Activity.new\n @series = get_series('activities')\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @activity }\n end\n end",
"def show\n @activity = Activity.find(params[:id])\n respond_to do |format|\n format.html { redirect_to activity_comments_url(@activity) }\n format.xml { render :xml => @activity.to_xml(:include => :user, :except => NB_CONFIG['api_exclude_fields']) }\n format.json { render :json => @activity.to_json(:include => :user, :except => NB_CONFIG['api_exclude_fields']) } \n end \n end",
"def get_all_activties_for_user\n\n\t@activities = Activity.all(:user_id => params[:user_id]) \n\n\t#get json format\n\tarr = Array(@activities) \n @json_format ={ 'Activities' => arr}.to_json\n\t@title = \"All Activities for ##{params[:user_id]}\"\n\t#redirect to home page\n\terb :home\nend",
"def all_activities(**args)\n params = parameters(args) do\n optional_params :user_id, :filter_id, :type, :start, :limit, :start_date, :end_date, :done\n end\n request(:get, 'activities', params)\n end",
"def user_activities(id:, **args)\n params = parameters(args) do\n optional_params :due_date, :type, :start, :limit, :done\n end\n request(:get, \"users/#{id}/activities\", params)\n end",
"def get_project_activities(project_id_or_key, params = {})\n get(\"projects/#{project_id_or_key}/activities\", params)\n end",
"def show\n @qa_client = QaClient.find(params[:id])\n @qa_activities = @qa_client.qa_activities\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @qa_client }\n end\n end",
"def index\n @current_activities = CurrentActivity.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @current_activities }\n end\n end",
"def get_activities(user_id, params = {})\r\n user_id = user_id.to_s\r\n @context.validate_identifier(:user_id, user_id)\r\n @context.call_myspace_api(:activities, params.dup.update(:user_id => user_id))\r\n end",
"def show\n @activity_tag = ActivityTag.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @activity_tag }\n end\n end",
"def new\n @activity = Activity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @activity }\n end\n end",
"def new\n @activity = Activity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @activity }\n end\n end",
"def show\n @activite = Activite.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @activite }\n end\n end",
"def show\n @activity_event = ActivityEvent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @activity_event }\n end\n end",
"def index\n @activities = @user.activities.where(\"date = ?\", requested_date(params[:date]))\n end",
"def activities\n @persona = Persona.where(:screen_name => params[:persona_id]).first\n @activity = @persona.get_activity( params ) \n\n\t\t#setup default parameters\n\t\t#params[:targetDiv] = params.has_key? :targetDiv ? params[:targetDiv] : '#recent-activity-body'\n\t\tif !params.has_key? :targetDiv then\n\t\t\tparams[:targetDiv] = '#recent-activity-body'\n\t\tend\n\n\t\tjs :params => { :screen_name => @persona.screen_name }\n\t\trespond_to do |format| \n\t\t\tformat.html\n\t\t\tformat.js\n\t\tend\n end",
"def index\n @user = current_user\n @activities = Activity.where({processed: 1, user_id: current_user.id}).order('activity_date')\n #@new_activities = Activity.where({processed: 0, user_id: current_user.id}).order('activity_date')\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @activities }\n end\n end",
"def activity\n if params[:project_token]\n @project = Project.find_by_api_access_token(params[:project_token])\n if @project\n render '/projects/api/v1/activity'\n else\n render file: \"#{Rails.root}/public/404.html\", layout: false, status: :not_found\n end\n end\n end",
"def fetch_activities(token, params)\n params.to_options!\n\n # Setup params.\n setup_params_logic = lambda do |last_request, params|\n if !last_request.blank?\n params[:occurred_since_date] = last_request\n end\n end\n\n # Parse the response.\n response_parse_logic = lambda do |response|\n content_keys = {}\n doc = Nokogiri::XML(response.body)\n\n doc.xpath(\"/activities//activity\").each do |act|\n id = act.search('id').first.inner_html\n content_keys[id] = act.to_s\n end\n content_keys\n end\n\n url = format_project_url(get_api_url('activities'), params[:project_id])\n fetch(::PivotalTracker::Activity, token, url,\n response_parse_logic, setup_params_logic, true)\n end"
] | [
"0.83788407",
"0.83788407",
"0.8096585",
"0.7685623",
"0.7667807",
"0.76401794",
"0.7609177",
"0.75712854",
"0.75329125",
"0.74525696",
"0.74308854",
"0.7332175",
"0.73110914",
"0.72872484",
"0.7285642",
"0.7231286",
"0.7206347",
"0.7206347",
"0.7189005",
"0.7184855",
"0.70567536",
"0.70504594",
"0.70471585",
"0.6988338",
"0.6986585",
"0.6978882",
"0.69616455",
"0.6958397",
"0.6953562",
"0.69255227",
"0.69255227",
"0.6894177",
"0.6878504",
"0.6875385",
"0.6857223",
"0.68414325",
"0.68293345",
"0.68293345",
"0.68293345",
"0.68293345",
"0.68293345",
"0.68293345",
"0.68293345",
"0.68293345",
"0.68293345",
"0.68293345",
"0.680654",
"0.6800987",
"0.6798651",
"0.67474514",
"0.6725457",
"0.67163175",
"0.6711541",
"0.6682631",
"0.6630054",
"0.6605643",
"0.6605643",
"0.659743",
"0.6593531",
"0.65813345",
"0.65674776",
"0.65497714",
"0.6546729",
"0.65377074",
"0.6527479",
"0.6508206",
"0.6501104",
"0.64950675",
"0.6471984",
"0.6470937",
"0.647051",
"0.644454",
"0.64229137",
"0.64218044",
"0.64170927",
"0.6408803",
"0.6405781",
"0.6394965",
"0.63781375",
"0.63781375",
"0.63781375",
"0.6372521",
"0.63720435",
"0.6365697",
"0.63631016",
"0.6354655",
"0.63520426",
"0.634384",
"0.6338895",
"0.6334911",
"0.6326654",
"0.6321508",
"0.6321508",
"0.63113666",
"0.6310981",
"0.6299206",
"0.62961197",
"0.6295181",
"0.6292663",
"0.6288323"
] | 0.6816858 | 46 |
GET /activities/new GET /activities/new.json | def new
@activity = Activity.new
images_left = (ActivitiesController::MAX_IMAGES - @activity.activity_images.count)
images_left.times { @activity.activity_images.build }
respond_to do |format|
format.html # new.html.erb
format.json { render json: @activity }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @breadcrumb = 'create'\n @activity = Activity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @activity }\n end\n end",
"def new\n @activity = Activity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @activity }\n end\n end",
"def new\n @activity = Activity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @activity }\n end\n end",
"def new\n @recent_activity = RecentActivity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @recent_activity }\n end\n end",
"def new\n @activity = Activity.new\n @series = get_series('activities')\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @activity }\n end\n end",
"def new\n @activity = Activity.new\n respond_to do |format|\n format.html # new.html.erb\n format.js\n format.json { render json: @activity }\n end\n end",
"def new\n @activite = Activite.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @activite }\n end\n end",
"def new\n @activity_item = ActivityItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @activity_item }\n end\n end",
"def new\n current_user = UserSession.find\n id = current_user && current_user.record.id\n @activity_type = ActivityType.new(:user_id => id)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @activity_type }\n end\n end",
"def new\n @my_activity = MyActivity.new\n @all_activites = MyActivity.where(\"user_id =?\", current_user.id).order('created_at DESC').limit(10)\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @my_activity }\n end\n end",
"def new\n @activity = Activity.new\n end",
"def new\n @activity = Activity.new\n end",
"def new\n @activity_tag = ActivityTag.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @activity_tag }\n end\n end",
"def new\n @activity = Activity.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @activity }\n end\n end",
"def new\n @activity = Activity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @activity }\n end\n end",
"def new\n @activity = Activity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @activity }\n end\n end",
"def new\n @activity = Activity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @activity }\n end\n end",
"def new\n \n @act = Act.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @act }\n end\n end",
"def new\n @app = App.find(params[:app_id])\n @activity = @app.activities.build\n @base_versions = [Activity::NO_BASE_VERSION]\n\n respond_to do |format|\n format.html do # new.html.erb\n render :layout => false if request.xhr?\n end\n format.xml { render :xml => @activity }\n end\n end",
"def new\n @activity_event = ActivityEvent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @activity_event }\n end\n end",
"def new\n @activity = Activity.new\n @categories = Category.find(:all)\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @activity }\n end\n end",
"def new\n @work_activity = WorkActivity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @work_activity }\n end\n end",
"def new\n @activity = Activity.new\n @activity.project_id = session[:project_id] unless session[:project_id].nil?\n @activity.do_today = true\n @activity.someday = true\n \n respond_to do |format|\n format.js { }\n format.html # new.html.erb\n format.xml { render :xml => @activity }\n format.json { render :json => @activity }\n end\n end",
"def new\n @activity = Activity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.dialog { render :new, layout: false }\n format.json { render json: @activity }\n end\n end",
"def new\n authorize Activity\n @activity = Activity.new\n @activity.user = current_visitor\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @activity }\n end\n end",
"def new\n @current_activity = CurrentActivity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @current_activity }\n end\n end",
"def new\n @activity = Activity.new\n @attcategories = Attcategory.find(:all)\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @activity }\n end\n end",
"def new\n @step_activity = StepActivity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @step_activity }\n end\n end",
"def create\n @recent_activity = RecentActivity.new(params[:recent_activity])\n\n respond_to do |format|\n if @recent_activity.save\n format.html { redirect_to @recent_activity, notice: 'Recent activity was successfully created.' }\n format.json { render json: @recent_activity, status: :created, location: @recent_activity }\n else\n format.html { render action: \"new\" }\n format.json { render json: @recent_activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @market_activity = MarketActivity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @market_activity }\n end\n end",
"def create\n @activity = Activity.new(params[:activity])\n\n respond_to do |format|\n if @activity.save\n flash[:success] = 'Activity was successfully created.'\n format.html { redirect_to activities_path }\n format.json { render json: @activity, status: :created, location: @activity }\n else\n format.html { render action: \"new\" }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @today_activity = TodayActivity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @today_activity }\n end\n end",
"def new\r\n @text_activity = TextActivity.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @text_activity }\r\n end\r\n end",
"def new\n @new_status = NewStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @new_status }\n end\n end",
"def new\n @activity = LightweightActivity.new()\n authorize! :create, @activity\n end",
"def create\n @activity = Activity.new(params[:activity])\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to @activity, notice: 'Activity was successfully created.' }\n format.json { render json: @activity, status: :created, location: @activity }\n else\n format.html { render action: \"new\" }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n add_breadcrumb :new\n @visit = Visit.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @visit }\n end\n end",
"def new\n @outing = Outing.new\n @activities = Activity.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @outing }\n end\n end",
"def create\n if current_user\n if params[:format] == \"json\"\n @activity = current_user.activities.new_from_json(params)\n if params[:activity][:auto_title] == true\n @activity.auto_title!\n end\n else\n @activity = current_user.activities.new(params[:activity])\n end\n else\n @activity = Activity.new(params[:activity])\n end\n respond_to do |format|\n if @activity.save\n format.html { redirect_to(@activity, :notice => 'Activity was successfully created.') }\n format.xml { render :xml => @activity, :status => :created, :location => @activity }\n format.json { render :json => @activity.to_json, :status => :created, :location => @activity }\n else\n logger.info @activity.errors.inspect\n format.html { render :action => \"new\" }\n format.xml { render :xml => @activity.errors, :status => :unprocessable_entity }\n format.json { render :json => @activity.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n # byebug\n @activity = Activity.new(activity_params)\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to root_path, notice: 'Activity was successfully created.' }\n format.json { render :show, status: :created, location: @activity }\n else\n format.html { render :new }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @activity_entry = ActivityEntry.new\n @data = ActivityDatum.all\n end",
"def new\n @invite = Invite.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invite }\n end\n end",
"def new\n @invite = Invite.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invite }\n end\n end",
"def new\n @invite = Invite.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invite }\n end\n end",
"def new\n @activity = Activity.new\n if params[:category]\n @category = current_user.user_categories.find(params[:category])\n @activity.category = @category\n end\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @activity }\n end\n end",
"def new\n @announce = Announce.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @announce }\n end\n end",
"def new\n @activity = Activity.find(params[:activity_id])\n @picture = Picture.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @picture }\n end\n end",
"def new\n @click = Click.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @click }\n end\n end",
"def new\n @activities_project = ActivitiesProject.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @activities_project }\n end\n end",
"def new\n @act_type = ActType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @act_type }\n end\n end",
"def create\n @activity = Activity.new(params[:activity])\n @activity[:user_id] = current_user.id\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to activities_path, notice: 'Activity was successfully created.' }\n format.json { render json: @activity, status: :created, location: @activity }\n else\n format.html { render action: \"new\" }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @activity = Activity.new(activity_params)\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to @activity, notice: 'Activity was successfully created.' }\n format.json { render action: 'show', status: :created, location: @activity }\n else\n format.html { render action: 'new' }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @activity = Activity.new(activity_params)\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to @activity, notice: 'Activity was successfully created.' }\n format.json { render action: 'show', status: :created, location: @activity }\n else\n format.html { render action: 'new' }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @activity = Activity.new(activity_params)\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to @activity, notice: 'Activity was successfully created.' }\n format.json { render action: 'show', status: :created, location: @activity }\n else\n format.html { render action: 'new' }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @get = Get.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @get }\n end\n end",
"def new\n @invite_status = InviteStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invite_status }\n end\n end",
"def create\n @breadcrumb = 'create'\n @activity = Activity.new(params[:activity])\n @activity.created_by = current_user.id if !current_user.nil?\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to @activity, notice: crud_notice('created', @activity) }\n format.json { render json: @activity, status: :created, location: @activity }\n else\n format.html { render action: \"new\" }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @todo = Todo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @todo }\n end\n end",
"def new\n @todo = Todo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @todo }\n end\n end",
"def new\n @todo = Todo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @todo }\n end\n end",
"def new\n @todo = Todo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @todo }\n end\n end",
"def new\n @todo = Todo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @todo }\n end\n end",
"def new_activity(activity)\n Models::Activity.new(:name => activity.name, :description => activity.description)\n end",
"def create\n @activity = Activity.create activity_params\n status = @activity.new_record? ? 400 : 201\n if @activity.recurrence\n render json: @activity.activity_factory.activities.as_json, status:status\n else\n respond_with @activity, status:status\n end\n end",
"def new\n @timeline = Timeline.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @timeline }\n end\n end",
"def new\n @presence = Presence.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @presence }\n end\n end",
"def new\n @activo = Activo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @activo }\n end\n end",
"def new\n @title = t('view.flows.new_title')\n @flow = Flow.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @flow }\n end\n end",
"def new\n\n\n\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task }\n end\n end",
"def new\n @goat = Goat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @goat }\n end\n end",
"def new\n @ticker_activity = TickerActivity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ticker_activity }\n end\n end",
"def new\r\n @gallery_activity = GalleryActivity.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @gallery_activity }\r\n end\r\n end",
"def new\n @mission = Mission.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mission }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @resource }\n end\n end",
"def new\n authorize ExternalActivity\n @external_activity = ExternalActivity.new\n @external_activity.user = current_visitor\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @external_activity }\n end\n end",
"def new\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task }\n end\n end",
"def new\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task }\n end\n end",
"def new\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task }\n end\n end",
"def new\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task }\n end\n end",
"def new\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task }\n end\n end",
"def new\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task }\n end\n end",
"def new\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task }\n end\n end",
"def new\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task }\n end\n end",
"def new\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task }\n end\n end",
"def new\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task }\n end\n end",
"def new\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task }\n end\n end",
"def new\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task }\n end\n end",
"def new\n @communication = Communication.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @communication }\n end\n end",
"def create\n @activity = Activity.new(activity_params)\n\n if @activity.save\n redirect_to activities_path\n else\n render 'new'\n end\n\n end",
"def new\n @announcement = Announcement.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @announcement }\n end\n end",
"def create\n @activity = Activity.new(activity_params)\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to @activity, notice: 'Activity was successfully created.' }\n format.json { render :show, status: :created, location: @activity }\n else\n format.html { render :new }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @url = Url.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @url }\n end\n end",
"def new\n @entity = Entity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @entity }\n end\n end",
"def new\n # raise params.inspect\n @task = Task.new \n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task }\n end\n end",
"def new\n @visit = Visit.new\n\n respond_to do |format|\n format.json { render json: @visit }\n end\n end",
"def create\n @my_activity = MyActivity.new(params[:my_activity])\n\n respond_to do |format|\n if @my_activity.save\n @all_activites = MyActivity.where(\"user_id =?\", current_user.id).order('created_at DESC').limit(10)\n #format.html { redirect_to @my_activity, notice: 'My activity was successfully created.' }\n #format.json { render json: @my_activity, status: :created, location: @my_activity }\n format.html {redirect_to new_my_activity_path}\n format.js\n else\n format.html { render action: \"new\" }\n format.json { render json: @my_activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n\t\t@person = Person.new\n\t\t# render json: @person #skips the view, and just renders out the json\n\tend",
"def new\n @actore = Actore.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @actore }\n end\n end",
"def new\n @participant = Participant.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @participant }\n end\n end",
"def new\n @participant = Participant.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @participant }\n end\n end",
"def new\n @participant = Participant.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @participant }\n end\n end"
] | [
"0.8030845",
"0.795746",
"0.795746",
"0.7671767",
"0.7667353",
"0.7381573",
"0.7371675",
"0.73648643",
"0.7263187",
"0.724126",
"0.72343117",
"0.72343117",
"0.72125345",
"0.7207512",
"0.7192852",
"0.7192852",
"0.7192852",
"0.71043736",
"0.70947236",
"0.7093483",
"0.7056507",
"0.7051569",
"0.70095456",
"0.70066565",
"0.6995381",
"0.69709045",
"0.69218034",
"0.6875018",
"0.68555063",
"0.68127126",
"0.681159",
"0.6800835",
"0.6784868",
"0.67705226",
"0.67689",
"0.6755622",
"0.6747637",
"0.672436",
"0.6711931",
"0.67104346",
"0.6707552",
"0.6701331",
"0.6701331",
"0.6701331",
"0.6688288",
"0.66757506",
"0.66290027",
"0.6627262",
"0.6623938",
"0.66236925",
"0.66180736",
"0.6616811",
"0.6616811",
"0.6616216",
"0.66153425",
"0.66127825",
"0.6610892",
"0.6585783",
"0.6585783",
"0.6585783",
"0.6585783",
"0.6585783",
"0.6578701",
"0.6577568",
"0.65749574",
"0.65729654",
"0.65703654",
"0.6566831",
"0.65632975",
"0.6563245",
"0.6552962",
"0.65447646",
"0.6539737",
"0.65388215",
"0.6536557",
"0.6529434",
"0.6529434",
"0.6529434",
"0.6529434",
"0.6529434",
"0.6529434",
"0.6529434",
"0.6529434",
"0.6529434",
"0.6529434",
"0.6529434",
"0.6529434",
"0.6526631",
"0.6523149",
"0.6521343",
"0.65158594",
"0.65119064",
"0.6506068",
"0.6505374",
"0.6503885",
"0.6503715",
"0.65017223",
"0.6495519",
"0.6492736",
"0.6492736",
"0.6492736"
] | 0.0 | -1 |
POST /activities POST /activities.json | def create
Rails.logger.info params
@activity = Activity.new(params[:activity])
@activity.user = current_user
if params.has_key?('hidden-activity') and params['hidden-activity'].has_key?('tag_list')
@activity.tag_list = params['hidden-activity'][:tag_list]
end
respond_to do |format|
if @activity.save
format.html { redirect_to @activity, notice: 'Activity was successfully created.' }
format.json { render json: @activity, status: :created, location: @activity }
else
# Delete images post invalidation
@activity.activity_images.map(&:destroy)
@activity.activity_images = []
ActivitiesController::MAX_IMAGES.times { @activity.activity_images.build }
format.html { render action: "new" }
format.json { render json: @activity.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @activity = @user.activities.create(activity_params)\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to @activity, notice: 'Exercise event was successfully created.' }\n format.json { render :show, status: :created, location: @activity }\n else\n format.html { render :new }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @activity = Activity.new(params[:activity])\n\n respond_to do |format|\n if @activity.save\n flash[:success] = 'Activity was successfully created.'\n format.html { redirect_to activities_path }\n format.json { render json: @activity, status: :created, location: @activity }\n else\n format.html { render action: \"new\" }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @activity = Activity.new(params[:activity])\n @activity[:user_id] = current_user.id\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to activities_path, notice: 'Activity was successfully created.' }\n format.json { render json: @activity, status: :created, location: @activity }\n else\n format.html { render action: \"new\" }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n activity_params = params.require(:activity).permit(:title, :body,\n tags_attributes:\n [:category_id])\n @activity = Activity.create(activity_params)\n current_user.activities << @activity\n respond_to do |format|\n format.html\n format.json { render json: @activity }\n end\n end",
"def create\n # byebug\n @activity = Activity.new(activity_params)\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to root_path, notice: 'Activity was successfully created.' }\n format.json { render :show, status: :created, location: @activity }\n else\n format.html { render :new }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @activity = Activity.create activity_params\n status = @activity.new_record? ? 400 : 201\n if @activity.recurrence\n render json: @activity.activity_factory.activities.as_json, status:status\n else\n respond_with @activity, status:status\n end\n end",
"def create\n @activity = Activity.new(params[:activity])\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to @activity, notice: 'Activity was successfully created.' }\n format.json { render json: @activity, status: :created, location: @activity }\n else\n format.html { render action: \"new\" }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @activity = Activity.new(activity_params)\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to @activity, notice: 'Activity was successfully created.' }\n format.json { render :show, status: :created, location: @activity }\n else\n format.html { render :new }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @activity = Activity.new(activity_params)\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to @activity, notice: 'Activity was successfully created.' }\n format.json { render :show, status: :created, location: @activity }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @activity = Activity.new(activity_params)\n @activity.user = current_user\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to activities_path, notice: 'Activity was successfully created.' }\n format.json { render :show, status: :created, location: @activity }\n else\n format.html { render :new }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n Activity.for_user(current_user).active.each do |a|\n a.end = Time.now\n a.save\n end\n\n @activity = Activity.new(params.permit(:description))\n @activity.user = current_user\n @activity.start = Time.now\n @activity.save!\n\n render json: @activity\n end",
"def create\n @activity = Activity.new(activity_params)\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to @activity, notice: 'Activity was successfully created.' }\n format.json { render action: 'show', status: :created, location: @activity }\n else\n format.html { render action: 'new' }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @activity = Activity.new(activity_params)\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to @activity, notice: 'Activity was successfully created.' }\n format.json { render action: 'show', status: :created, location: @activity }\n else\n format.html { render action: 'new' }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @activity = Activity.new(activity_params)\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to @activity, notice: 'Activity was successfully created.' }\n format.json { render action: 'show', status: :created, location: @activity }\n else\n format.html { render action: 'new' }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @activity = current_user.activities.new(activity_params)\n @activity.name = params[:name]\n @activity.date = Date.civil(params[:date][:year].to_i, params[:date][:month].to_i, params[:date][:day].to_i)\n @activity.duration = params[:activity][:hour] + ':' + params[:activity][:minute] + ':' + params[:activity][:second]\n \n respond_to do |format|\n if @activity.save\n format.html { redirect_to @activity, notice: 'Activity was successfully created.' }\n format.json { render :show, status: :created, location: @activity }\n else\n format.html { render :new }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n if current_user\n if params[:format] == \"json\"\n @activity = current_user.activities.new_from_json(params)\n if params[:activity][:auto_title] == true\n @activity.auto_title!\n end\n else\n @activity = current_user.activities.new(params[:activity])\n end\n else\n @activity = Activity.new(params[:activity])\n end\n respond_to do |format|\n if @activity.save\n format.html { redirect_to(@activity, :notice => 'Activity was successfully created.') }\n format.xml { render :xml => @activity, :status => :created, :location => @activity }\n format.json { render :json => @activity.to_json, :status => :created, :location => @activity }\n else\n logger.info @activity.errors.inspect\n format.html { render :action => \"new\" }\n format.xml { render :xml => @activity.errors, :status => :unprocessable_entity }\n format.json { render :json => @activity.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n data = reload(get_series('activities'), str(Date.strptime(params[:activity].values.join(\"-\"))))\n saved = false\n get_series('activities').each do |s|\n puts \"Updating series=#{s}\"\n data[s].each do |day|\n @activity = for_date(day['dateTime'])\n @activity.send(s.partition('/')[2] + '=', day['value'])\n saved = @activity.save\n if not saved\n flash[:error] = @activity.errors\n end\n end\n end\n\n respond_to do |format|\n flash[:success] = 'Activity was successfully created.'\n format.html { redirect_to @activity }\n format.json { render json: @activity, status: :created, location: @activity }\n end\n end",
"def create_activity(**args)\n params = parameters(args) do\n required_params :subject, :type\n optional_params :subject, :type, :done, :due_date, :due_time, :duration, :user_id, :deal_id, :person_id, :participants, :org_id, :note\n end\n request(:post, 'activities', params)\n end",
"def create\n @activity = PublicActivity::Activity.new(activity_params)\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to @activity, notice: 'Activity was successfully created.' }\n format.json { render :show, status: :created, location: @activity }\n else\n format.html { render :new }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n if params[:events].nil?\n else\n params[:events].each do |e|\n if Activity.exists?(uuid: params[:events][e][:id])\n @activity = Activity.find_by uuid: params[:events][e][:id]\n @activity.update({\n start_time: params[:events][e][:start].in_time_zone,\n end_time: params[:events][e][:end].in_time_zone,\n })\n next\n else\n @activity = Activity.new({\n start_time: params[:events][e][:start].in_time_zone,\n end_time: params[:events][e][:end].in_time_zone,\n uuid: params[:events][e][:id],\n name: params[:events][e][:name],\n place: params[:events][e][:google_id],\n schedule_id: params[:schedule_id]\n })\n\n @activity.save\n end\n end\n end\n end",
"def create\n @activity = Activity.new(params[:activity])\n @activity.user = current_user\n @activity.organization = current_user.organization\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to activity_path(@activity), notice: 'Activity was successfully created.' }\n format.json { render json: @activity, status: :created, location: @activity }\n else\n format.html { render action: \"new\" }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @activity = Activity.new(activity_params)\n\n respond_to do |format|\n if @activity.save\n format.js { render partial: 'activity', locals: {activities: [@activity], is_filted: false} }\n format.html { redirect_to @activity, notice: 'Activity was successfully created.' }\n format.json { render :show, status: :created, location: @activity }\n else\n format.js { render partial: 'activity', notice: @activity.errors }\n format.html { render :new }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n authorize Activity\n @activity = Activity.new(params[:activity])\n @activity.user = current_visitor\n\n if params[:update_material_properties]\n # set the material_properties tags\n @activity.material_property_list = (params[:material_properties] || [])\n end\n\n if params[:update_cohorts]\n # set the cohorts\n @activity.set_cohorts_by_id(params[:cohort_ids] || [])\n end\n\n if params[:update_grade_levels]\n # set the grade_level tags\n @activity.grade_level_list = (params[:grade_levels] || [])\n end\n\n if params[:update_subject_areas]\n # set the subject_area tags\n @activity.subject_area_list = (params[:subject_areas] || [])\n end\n\n respond_to do |format|\n if @activity.save\n format.js # render the js file\n flash[:notice] = 'Activity was successfully created.'\n format.html { redirect_to(@activity) }\n format.xml { render :xml => @activity, :status => :created, :location => @activity }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @activity.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @activity = Activity.new(activity_params)\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to [@course, @learning_unit, @activity], notice: 'Activity was successfully created.' }\n format.json { render :show, status: :created, location: @activity }\n else\n format.html { render :new }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @dev_activity = current_user.dev_activities.create(dev_activity_params)\n\n respond_to do |format|\n if @dev_activity.save\n format.html { redirect_to user_dev_activities_path(current_user), notice: 'The Development Activity was successfully created.' }\n format.json { render action: 'show', status: :created, location: @dev_activity }\n else\n format.html { render action: 'new' }\n format.json { render json: @dev_activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n activity_contents = params[:activity][:activity_contents]\n params = activity_params\n @activity = Activity.new(starter_id: current_user_id,\n activity_date: params[:activity_date],\n activity_end_time: params[:activity_end_time],\n place: params[:place],\n content: params[:content],\n activity_type_id: params[:activity_type_id],\n status: params[:status])\n\n\n respond_to do |format|\n if @activity.validate\n @activity.save\n ActivityParticipant.create(user_id: current_user_id,\n activity_id: @activity.id,\n identity: 1)\n activity_contents = JSON.parse(activity_contents)\n activity_contents.each do |content|\n ActivityContent.create(activity_id: @activity.id,\n sport_option: content[\"sport_option\"],\n quantity: content[\"quantity\"])\n\n end\n format.html {redirect_to @activity, notice: 'Activity was successfully created.'}\n format.json {render :show, status: :created, location: @activity}\n starter = @activity.starter\n starter.follower.each do |user|\n MessageChannel.broadcast_to(user, {type: 1, count: 1, msg: {\n title: \"<i class='fas fa-plus-circle'></i> New Poster from #{starter.user_name}\",\n text: 'A new poster has been posted', type: 'info'}})\n end\n format.js {render 'users/create_activity'}\n\n else\n #format.js {render json: {status: 2}}\n # unless @activity.activity_date.nil?\n # @activity.activity_date = @activity.activity_date.strftime('%m/%d/%Y %H:%M')\n # end\n format.html {render :new}\n format.json {render json: @activity.errors, status: :unprocessable_entity}\n format.js {render layout: false, content_type: 'text/javascript'}\n end\n end\n end",
"def activities\n get_call(\"1/activities.json\")\n end",
"def create\n save_status = false\n\n if (nil == params[:id])\n ruby_date = Activity.new(params.require(:activity).permit(:date)).date\n @activity = @user.activities.find_by(params.require(:activity).permit(:item_id).merge({:date => ruby_date}))\n\n if (nil != @activity)\n save_status = @activity.update(params.require(:activity).permit(:amount))\n else\n @activity = Activity.new(params.require(:activity).permit(:amount, :item_id, :date))\n @activity.user = @user\n save_status = @activity.save\n end\n else\n @activity = @user.activities.find_by({:id => params[:id]})\n save_status = @activity.update(params.require(:activity).permit(:amount))\n end\n\n respond_to do |format|\n if (nil == @activity)\n format.json { render json: {}, status: :unauthorized }\n elsif (true == save_status)\n format.json { render :show, status: :created }\n else\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n if current_user\n @activity = Activity.new(activity_params)\n @activity.user_id = current_user.id\n\n respond_to do |format|\n if @activity.save\n\n # add owner to going to activity\n Goingtoactivity.create(user_id: @activity.user_id, activity_id: @activity.id)\n\n format.json { render :show, status: :created, location: @activity }\n else\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n else\n respond_to do |format|\n format.json { render :json => {:success=>false, :message=>\"Something's wrong with the token. current_user is nil.\"} }\n end\n end\n end",
"def create\n @activity = Activity.new(activity_params)\n respond_to do |format|\n if @activity.save\n #Guardamos todos los objectivos\n params[:objectives].split(\",\").each do |objective|\n puts objective\n obj = Objective.create(description: objective, is_done: false)\n @activity.objectives << obj\n end\n #Guardamos al usuario correspondiente\n params[:users].each do |user_id|\n ActivitiesUser.create(activity_id: @activity.id, user_id: user_id)\n \n end\n @plan = Plan.find(params[:plan_id])\n @plan.activities << @activity\n format.html { redirect_to planslink_path(@activity.plan.family_group.id), notice: 'Activity was successfully created.' }\n format.json { render action: 'show', status: :created, location: @activity }\n else\n format.html { render action: 'new' }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n @title = Title.find(activity_params[:title_id])\n @event = Event.find(@title[:event_id])\n @activity = Activity.new(activity_params)\n @title.activities << @activity\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to \"/events/#{@event.id}\", notice: 'Activity was successfully created.' }\n format.json { render :show, status: :created, location: @activity }\n else\n format.html { render :new }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def activity(id)\n get(\"/activities/#{id}.json\")\n end",
"def activity(id)\n get(\"/activities/#{id}.json\")\n end",
"def create\n @user_activity = UserActivity.new(user_activity_params)\n\n respond_to do |format|\n if @user_activity.save\n format.html { redirect_to @user_activity, notice: 'User activity was successfully created.' }\n format.json { render :show, status: :created, location: @user_activity }\n else\n format.html { render :new }\n format.json { render json: @user_activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @status_activity = StatusActivity.new(status_activity_params)\n\n respond_to do |format|\n if @status_activity.save\n format.html { redirect_to @status_activity, notice: 'Status activity was successfully created.' }\n format.json { render :show, status: :created, location: @status_activity }\n else\n format.html { render :new }\n format.json { render json: @status_activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @breadcrumb = 'create'\n @activity = Activity.new(params[:activity])\n @activity.created_by = current_user.id if !current_user.nil?\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to @activity, notice: crud_notice('created', @activity) }\n format.json { render json: @activity, status: :created, location: @activity }\n else\n format.html { render action: \"new\" }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @activity = @activity_type.activity_class.new(activity_params)\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to activities_path(@activity_type.table_name, @activity), notice: \"#{@activity_type.name.humanize} was successfully created.\" }\n format.json { render :show, status: :created, location: @activity }\n format.js { render :create }\n else\n format.html { render :new }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n format.js { render :new }\n end\n end\n end",
"def create\n @my_activity = MyActivity.new(params[:my_activity])\n\n respond_to do |format|\n if @my_activity.save\n @all_activites = MyActivity.where(\"user_id =?\", current_user.id).order('created_at DESC').limit(10)\n #format.html { redirect_to @my_activity, notice: 'My activity was successfully created.' }\n #format.json { render json: @my_activity, status: :created, location: @my_activity }\n format.html {redirect_to new_my_activity_path}\n format.js\n else\n format.html { render action: \"new\" }\n format.json { render json: @my_activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @activity = Activity.new(activity_params)\n\n if @activity.save\n redirect_to activities_path\n else\n render 'new'\n end\n\n end",
"def create\n\t\tdestId = params[:destination_id]\n\t\tdestination = Destination.find_by_id(destId)\n\t\titinerary = Itinerary.create({tags: itinerary_params[:tags].split(\" \")})\n\t\ta = activity_params.first\n\t\tactivity = itinerary.activities.create({title: a[:title], tip: a[:tip], location: a[:location], photo: a[:photo], highlight: a[:highlight]})\n\t\trespond_with itinerary\n\tend",
"def create\n @activity = Activity.new(activity_params.merge(user_id: current_user.id))\n # render text: params\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to activities_url, notice: 'Activity was successfully created.' }\n format.json { render :show, status: :created, location: @activity }\n else\n format.html { render :new }\n format.json { render json: activities_url.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user_activity = UserActivity.new(user_activity_params)\n @user_activity.user_id = current_user.try(:id)\n \n respond_to do |format|\n if @user_activity.save\n format.html { redirect_to @user_activity, notice: \"User activity was successfully created.\" }\n format.json { render :show, status: :created, location: @user_activity }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @user_activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @activity = current_user.activities.new(activity_params)\n @activity.supplier_id = current_user.id\n #@activity.status = Activity::SETTING if @activity.activity_type.is_show?\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to edit_activity_path(@activity), notice: 'Activity was successfully created.' }\n format.json { render action: 'edit', status: :created, location: @activity }\n else\n format.html { render action: 'new' }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @type_activity = TypeActivity.new(type_activity_params)\n\n respond_to do |format|\n if @type_activity.save\n format.html { redirect_to @type_activity, notice: 'Type activity was successfully created.' }\n format.json { render :show, status: :created, location: @type_activity }\n else\n format.html { render :new }\n format.json { render json: @type_activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @activity = Activity.new(params[:activity])\n @activity.user = current_user\n @activity.organization = current_user.organization\n @activity.date = change_date_format(params[:activity][:date]) if !(params[:activity][:date]).blank?\n respond_to do |format|\n if @activity.save\n format.html { redirect_to activity_path(@activity), notice: 'Data was successfully created.' }\n format.json { render json: @activity, status: :created, location: @activity }\n else\n format.html { render action: \"new\" }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def activity_params\n params.require(:activity).permit(:name, :user_id, :location, :time, :nrofpeopleinvited, :description)\n end",
"def activity_params\n params.require(:activity).permit(:description, :is_done, :observations, :activity_type, :deadline)\n end",
"def create\n @app = App.find(params[:app_id])\n @activity = @app.activities.build(params[:activity])\n @activity.state = Activity::STATE_DEVELOPMENT\n\n respond_to do |format|\n if @activity.save\n flash[:notice] = 'Activity was successfully created.'\n format.html do\n if request.xhr?\n render :partial => 'shared/activity_row', :collection => @app.activities, :as => 'activity'\n else\n redirect_to app_activity_path(@app, @activity)\n end\n end\n format.xml { render :xml => @activity, :status => :created, :location => @activity }\n else\n format.html do\n @base_versions = ['1_1_0']\n \n if request.xhr?\n render :partial => 'new', :locals => {:activity => @activity, :app => @app}, :status => :unprocessable_entity\n else\n render :action => \"new\"\n end\n end\n format.xml { render :xml => @activity.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def index\n @activities = Activity.all\n render json: @activities\n end",
"def create\n @step_activity = StepActivity.new(params[:step_activity])\n\n respond_to do |format|\n if @step_activity.save\n format.html { redirect_to @step_activity, notice: 'Step activity was successfully created.' }\n format.json { render json: @step_activity, status: :created, location: @step_activity }\n else\n format.html { render action: \"new\" }\n format.json { render json: @step_activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @activity = Activity.new(activity_params)\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to [:phone, @activity], notice: 'Activity was successfully created.' }\n format.json { render action: 'show', status: :created, location: @activity }\n else\n format.html { render action: 'new' }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @activity = Activity.new(params[:activity])\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to(@activity, :notice => 'Activity was successfully created.') }\n format.xml { render :xml => @activity, :status => :created, :location => @activity }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @activity.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @activity_item = ActivityItem.new(params[:activity_item])\n\n respond_to do |format|\n if @activity_item.save\n format.html { redirect_to @activity_item, notice: 'Activity item was successfully created.' }\n format.json { render json: @activity_item, status: :created, location: @activity_item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @activity_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @activity = Activity.new(params[:activity])\n\n respond_to do |format|\n if @activity.save\n flash[:notice] = I18n.t('activities.controller.Successfully_created')\n format.html { redirect_to(@activity) }\n format.xml { render :xml => @activity, :status => :created, :location => @activity }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @activity.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @recent_activity = RecentActivity.new(params[:recent_activity])\n\n respond_to do |format|\n if @recent_activity.save\n format.html { redirect_to @recent_activity, notice: 'Recent activity was successfully created.' }\n format.json { render json: @recent_activity, status: :created, location: @recent_activity }\n else\n format.html { render action: \"new\" }\n format.json { render json: @recent_activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user_activity = UserActivity.new(user_activity_params)\n\n respond_to do |format|\n if @user_activity.save\n format.html { redirect_to customer_path(@user_activity.customer_id), notice: 'User activity was successfully created.' }\n format.json { render :show, status: :created, location: @user_activity }\n else\n format.html { render :new }\n format.json { render json: @user_activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def user_activity\n device_id = request.headers['device_id']\n string = request.body.read\n activity = ActiveSupport::JSON.decode(string)\n a_ids = []\n if !activity.empty?\n begin\n activity.each do |a|\n if a['user_id'].nil?\n a['device_id'] = device_id\n end\n id = a['event_id']\n a.delete('event_id')\n logger.info\"=====#{a}\"\n UserActivity.create(a)\n a_ids << id\n end\n rescue Exception => e\n logger.info \"===Exception in creating usage #{e}\"\n # @error = \"#{e.message} for #{e.try(:record).try(:class).try(:name)}\"\n end\n respond_to do |format|\n format.json { render json: a_ids }\n end\n end\n\nend",
"def create\n @activity = Activity.new(params[:activity])\n @attcategories = Attcategory.all\n \n @activity.duration = params[:activity_hours].to_i * 60\n @activity.duration += params[:activity_minutes].to_i\n \n @activity.user = current_user\n\n respond_to do |format|\n if @activity.save\n flash[:notice] = 'Activity was successfully created.'\n format.html { redirect_to :action => :change_actattributes, :id => @activity }\n format.xml { render :xml => @activity, :status => :created, :location => @activity }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @activity.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create_activity_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ActivitiesApi.create_activity ...\"\n end\n # resource path\n local_var_path = \"/activities\"\n\n # query parameters\n query_params = {}\n\n # header parameters\n 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 = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'activity_resource'])\n auth_names = ['oauth2_client_credentials_grant', 'oauth2_password_grant']\n data, status_code, headers = @api_client.call_api(:POST, local_var_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 :return_type => 'ActivityResource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ActivitiesApi#create_activity\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def activities(params = {})\n scope 'default'\n get('activities/', params)\n end",
"def create_activity\n player = Player.find_or_create_by(email:req_params[:email])\n project = Project.find_by(name:req_params[:project])\n event = req_params[:event]\n count = req_params[:count]\n @activity = Activity.get_activity_type(player,event,project,count)\n\n end",
"def activities=(value)\n @activities = value\n end",
"def add_activity\n @activity = Activity.new({\n :user => User.find_by_id(params[:user_id]), \n :name => params[:activity][:name], \n :description => params[:activity][:description],\n :category => Category.find_by_id(params[:activity][:category]),\n\t\t\t:location => params[:activity][:location]\n #:loc_x => params[:activity][:loc_x], \n #:loc_y => params[:activity][:loc_y])\n\t\t})\n\n if @activity.save\n\t\t\t\tputs params[:activity].inspect\n\t\t\t\[email protected]_photo(params[:user_id], params[:activity][:photo_url])\n\t\t\t\trender :json=>@activity\n else\n render :text=>'There was an error saving the activity.', :status=>:service_unavailable\n end\n end",
"def add_activity(activity)\n act = activity.as_json\n write_feed.add_activity(act)\n end",
"def create\n @activity_participant = Activity::Participant.new(activity_participant_params)\n @activity_participant.user = current_user\n @activity_participant.activity = Activity.find_by_id(params[:activity_id])\n\n respond_to do |format|\n if @activity_participant.save\n format.html { redirect_to activity_participants_url, notice: \"Participant was successfully created.\" }\n format.json { render :show, status: :created, location: @activity_participant }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @activity_participant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @activity = Activity.new(activity_params)\n @activity.team = @team\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to team_activities_path(@team), notice: 'Activity was successfully created.' }\n format.json { render action: 'show', status: :created, location: @activity }\n else\n @activities = @team.activities\n iwantmodal\n should_modal_be_open\n format.html { render action: 'index' }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @activity_type = ActivityType.new(params[:activity_type])\n\n respond_to do |format|\n if @activity_type.save\n format.html { redirect_to @activity_type, notice: 'Activity type was successfully created.' }\n format.json { render json: @activity_type, status: :created, location: @activity_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @activity_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @activity = Activity.new(params[:activity])\n\t\tauthorize! :create, @activity\n\n respond_to do |format|\n if @activity.save\n flash[:notice] = 'Activity was successfully created.'\n format.html { redirect_to(activities_url) }\n format.xml { render :xml => @activity, :status => :created, :location => @activity }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @activity.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @activity = Activity.new(activity_params)\n # TODO: Need to move this logic to Model ??\n # Get max activity number\n current_activity_number = Activity.maximum(:activity_id, :conditions => [\"issue_id = ?\", activity_params[:issue_id]])\n\n # Set next activity number\n if current_activity_number\n next_activity_number = current_activity_number + 1\n else\n next_activity_number = 1\n end\n @activity.activity_id = next_activity_number\n\n # Convert blank into zero\n @activity.hours = 0 if @activity.hours.blank?\n @activity.minutes = 0 if @activity.minutes.blank?\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to @activity, notice: 'Activity was successfully created.' }\n format.json { render action: 'show', status: :created, location: @activity }\n else\n format.html { render action: 'new' }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project_activity = ProjectActivity.new(project_activity_params)\n\n respond_to do |format|\n if @project_activity.save\n format.html { redirect_to @project_activity, notice: 'Project activity was successfully created.' }\n format.json { render :show, status: :created, location: @project_activity }\n else\n format.html { render :new }\n format.json { render json: @project_activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index(user)\n activities = []\n json = eval(RestClient.get(ENDPOINT + \"/activities?user_id=#{user}\").to_s)\n json.each do |attributes|\n activities << Activity.new(attributes)\n end\n activities\n end",
"def activity_params\n params.fetch(:activity, {}).permit(\n :name,\n :start,\n :duration,\n :activity_type_id\n )\n end",
"def create_activity(activity)\n create_or_update(activity, nil,\n 'activity', 'activities')\n end",
"def create\n @activity = Activity.new(activity_params)\n\n respond_to do |format|\n if @activity.save\n\n format.html { redirect_to @activity, notice: 'Activity was successfully created.' }\n format.json { render :show, status: :created, location: @activity }\n \n\n else\n# format.html { render :new }\n format.html { redirect_to \"/activities/qyer\", notice: @activity.errors }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def activity_params\n params.require(:activity).permit(:name, :deal_id, :team_id, :person_id, :organization_id, :type_id, :note, :date, :time, :length, :user_id, :done)\n end",
"def activities(options={})\n response = connection.get do |req|\n req.url \"activities\", options\n end\n return_error_or_body(response)\n end",
"def activities_params\n params.require(:activity).permit(:action, :trackable)\n end",
"def republish\n json = JSON.parse(request.body.read)\n begin\n @external_activity = ActivityRuntimeAPI.republish(json)\n head :created, :location => @external_activity\n rescue StandardError => e\n json_error(e)\n end\n end",
"def create\n # @activity = Activity.new(activity_params)\n @activity = @group.activities.new(activity_params)\n\n respond_to do |format|\n if @activity.save\n # format.html { redirect_to @group, notice: 'Activity was successfully created.' }\n format.html { redirect_to [@group, @activity], notice: 'Activity was successfully updated.' }\n format.json { render action: 'show', status: :created, location: @activity }\n else\n format.html { render action: 'new' }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @activity = Activity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @activity }\n end\n end",
"def new\n @activity = Activity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @activity }\n end\n end",
"def new\n @activity = Activity.new\n @series = get_series('activities')\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @activity }\n end\n end",
"def activity_params\n params.require(:activity).permit(:reference, :name, :user_id, :start_time, :end_time, :sport, :owner, :entry, :is_proxy)\n end",
"def create\n @activity = Activity.new(params[:activity])\n\n respond_to do |format|\n if @activity.save\n flash[:notice] = 'Activity was successfully created.'\n if @activity.is_achievement\n format.html { redirect_to :action => 'index' }\n else\n format.html { redirect_to :action => 'plan_chart' }\n end\n format.html { redirect_to :action => :plan_chart }\n format.xml { render :xml => @activity, :status => :created, :location => @activity }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @activity.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n ap = activity_params\n if !ap[:points].nil?\n doc = Nokogiri::XML(ap[:points].read)\n parse_gpx(doc,ap)\n end\n @activity = Activity.new(ap)\n @activity.owner_id = current_user.id\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to @activity, notice: 'Activity was successfully created.' }\n format.json { render :show, status: :created, location: @activity }\n else\n format.html { render :new }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def activity_params\n params.require(:activity).permit(:name, :description, :location, :start, :end, :deadline, :reminder_at, :subgroup_division_enabled, :no_response_action)\n end",
"def create\n # Obtain user information by searching for username\n @user = User.find_by_username(params[:username])\n @activity = @user.activities.new(activity_params)\n if @activity.save\n flash[:success] = \"Activity Successfully Added!\"\n redirect_to calendar_path(@user.username)\n else\n render 'new'\n end\n end",
"def create\n\n @activity = Activity.new(activity_params)\n\n\n @activity.date = convert_date_to_i(params[:date])\n @activity.time_from = get_time_from\n @activity.time_to = get_time_to\n\n respond_to do |format|\n if @activity.save\n\n format.html { redirect_to new_lambing_path }\n format.json { render action: 'show', status: :created, location: @activity }\n else\n format.html { render action: 'new' }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def activity_params\n params.require(:activity).permit(:title, :started_at, :stopped_at, :applied_at, :number_limit, :pay_type, :province, :city, :district, :location, :approval, :condition)\n end",
"def activity_params\n params.require(:activity).permit(:name, :date, :points, :place_id, :sport_id, :owner_id)\n end",
"def create\n @goal = current_user.goals.build(goal_params)\n\n # iterate throught dates\n puts goal_params[:start_date]\n puts goal_params[:duration]\n\n if goal_params[:start_date] != \"\" && goal_params[:duration] != \"\"\n start_date = Date.parse(goal_params[:start_date])\n end_date = start_date + goal_params[:duration].to_i - 1\n\n start_date.upto(end_date) do |date|\n @goal.activities.build({done: false, due_date: date})\n end\n end\n\n respond_to do |format|\n if @goal.save\n format.html { redirect_to goals_path, notice: 'Goal was successfully created.' }\n format.json { render :show, status: :created, location: @goal }\n else\n format.html { render :new }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def activity_params\n params.require(:activity).permit(:exercise_type_id, :exercise_unit_id, :intensity_id, :date, :num_units)\n end",
"def create\n @activities_list = ActivitiesList.new(activities_list_params)\n\n respond_to do |format|\n if @activities_list.save\n format.html { redirect_to @activities_list, notice: 'Activities list was successfully created.' }\n format.json { render :show, status: :created, location: @activities_list }\n else\n format.html { render :new }\n format.json { render json: @activities_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @activity_type = ActivityType.new (activity_type_params)\n \n respond_to do |format|\n if @activity_type.save\n format.html { redirect_to @activity_type, notice: 'activity_type was successfully created.' }\n format.json { render :show, status: :created, location: @activity_type }\n else\n format.html { render :new }\n format.json { render json: @activity_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @work_activity = WorkActivity.new(params[:work_activity])\n\n respond_to do |format|\n if @work_activity.save\n format.html { redirect_to @work_activity, notice: 'Work activity was successfully created.' }\n format.json { render json: @work_activity, status: :created, location: @work_activity }\n else\n format.html { render action: \"new\" }\n format.json { render json: @work_activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n @opportunity = Opportunity.new(opportunity_params)\n @opportunity.organisation = @organisation\n\n unless opportunity_params[:new_activity].blank?\n activity = Activity.find_by_title(opportunity_params[:new_activity])\n if activity.nil?\n activity = Activity.new(:title => opportunity_params[:new_activity])\n activity.save\n end\n @opportunity.activity = activity\n end\n\n unless opportunity_params[:new_sub_activity].blank?\n sub_activity = @opportunity.activity.sub_activities.find_by_title(opportunity_params[:new_sub_activity])\n if sub_activity.nil?\n sub_activity = @opportunity.activity.sub_activities.new(:title => opportunity_params[:new_sub_activity])\n sub_activity.save\n end\n @opportunity.sub_activity = sub_activity\n end\n\n respond_to do |format|\n if @opportunity.save\n format.html { redirect_to @opportunity, notice: 'Opportunity was successfully created.' }\n format.json { render :show, status: :created, location: @opportunity }\n else\n @activities = Activity.all\n @sub_activities = []\n format.html { render :new }\n format.json { render json: @opportunity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_activity(activity)\n self.activities << activity\n end",
"def activity_params\n params.require(:activity).permit(:content, :start, :title, :title_id)\n end",
"def activity(params={})\n Endpoints::Activity.new(self).get(params)\n end",
"def create\n @course = Course.find(params[:course_id])\n @activity = @course.activities.build(params[:activity])\n @participants = @activity.participants.collect\n @activity.participants = []\n respond_to do |format|\n if @activity.save\n save_participants\n format.html { redirect_to( course_path(params[:course_id]), :notice => 'Lista de presença salva com sucesso') }\n format.xml { render :xml => @activity, :status => :created, :location => @activity }\n else\n @javascript_hash = @course.participants_as_javascript_hash\n 80.times { @activity.participants.build }\n format.html { render :action => \"new\" }\n format.xml { render :xml => @activity.errors, :status => :unprocessable_entity }\n end\n end\n end"
] | [
"0.7249106",
"0.70048165",
"0.6964346",
"0.6956599",
"0.69475126",
"0.6929332",
"0.69046366",
"0.6889496",
"0.6862793",
"0.68420047",
"0.6838635",
"0.68081975",
"0.68079776",
"0.68079776",
"0.6798919",
"0.677082",
"0.6740217",
"0.67014927",
"0.6675203",
"0.6665923",
"0.6659741",
"0.66497296",
"0.66260356",
"0.66255397",
"0.6618906",
"0.6608279",
"0.6597215",
"0.6572306",
"0.6548478",
"0.6545597",
"0.654504",
"0.6531478",
"0.6531478",
"0.6525069",
"0.65126884",
"0.64865255",
"0.6478666",
"0.6473505",
"0.64526296",
"0.64259535",
"0.6421336",
"0.64114636",
"0.6405053",
"0.63795096",
"0.6373347",
"0.63450116",
"0.6337208",
"0.6336257",
"0.63160855",
"0.631069",
"0.63106066",
"0.6306154",
"0.62985283",
"0.6296367",
"0.6275596",
"0.6270746",
"0.6268673",
"0.62586695",
"0.6258483",
"0.62326264",
"0.6231441",
"0.62267804",
"0.62261266",
"0.6221256",
"0.6197047",
"0.61817104",
"0.61811554",
"0.61788964",
"0.61750215",
"0.6166878",
"0.6164684",
"0.61633086",
"0.61566573",
"0.6117561",
"0.610921",
"0.6105447",
"0.6104091",
"0.60982573",
"0.60947186",
"0.60938215",
"0.60938215",
"0.60757643",
"0.60684997",
"0.6066601",
"0.60618585",
"0.6033479",
"0.6031145",
"0.6029268",
"0.60185343",
"0.6017789",
"0.6012027",
"0.60031873",
"0.59959805",
"0.59913605",
"0.59872144",
"0.59859747",
"0.59781975",
"0.59690434",
"0.596817",
"0.59595513"
] | 0.6625307 | 24 |
PUT /activities/1 PUT /activities/1.json | def update
@activity = Activity.find(params[:id])
if params.has_key?('hidden-activity') and params['hidden-activity'].has_key?('tag_list')
params[:activity][:tag_list] = params['hidden-activity'][:tag_list]
end
respond_to do |format|
if @activity.update_attributes(params[:activity])
format.html { redirect_to @activity, notice: 'Activity was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @activity.errors, status: :unprocessable_entity }
end
end
if @activity.created_at < 1.day.ago
authorize! :edit, @activity
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n\n @title = Title.find(activity_params[:title_id])\n @event = Event.find(@title[:event_id])\n @activity = Activity.new(activity_params)\n @title.activities << @activity\n \n respond_to do |format|\n if @activity.update(activity_params)\n format.html { redirect_to \"/events/#{@event.id}\", notice: 'Activity was successfully updated.' }\n format.json { render :show, status: :ok, location: @activity }\n else\n format.html { render :edit }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @activity = Activity.find(params[:id])\n\n respond_to do |format|\n if @activity.update_attributes(params[:activity])\n format.html { redirect_to @activity, notice: 'Activity was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_activity(id:, **args)\n params = parameters(args) do\n optional_params :subject, :type, :done, :due_date, :due_time, :duration, :user_id, :deal_id, :person_id, :participants, :org_id, :note\n end\n request(:put, \"activities/#{id}\", params)\n end",
"def update\n @activity = Activity.find(params[:id])\n\n respond_to do |format|\n if @activity.update_attributes(params[:activity])\n flash[:success] = 'Activity was successfully updated.'\n format.html { redirect_to activities_path }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @activity = Activity.find(params[:id])\n\n respond_to do |format|\n if @activity.update_attributes(params[:activity])\n format.html { redirect_to @activity, notice: 'Activity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @activity.nil?\n send_error_json( @activity.id, \"Param 'activity' missing\", 400)\n return\n end\n\n fav = true\n if params['activity'].nil? || params['activity']['favourite'].nil? || params['activity']['favourite']=='false'\n fav = false\n end\n update_hash = {:favourite => fav}\n\n if params['activity'] && params['activity']['intensity']\n update_hash[:intensity] = params['activity']['intensity'].to_f\n end\n\n if params['activity'] && params['activity']['group']\n update_hash[:group] = params['activity']['group']\n end\n\n if params['activity'] && params['activity']['name']\n at = ActivityType.where(name: params['activity']['name']).first\n if !at.nil?\n update_hash[:activity_type_id] = at.id\n else\n send_error_json(@activity.id, \"Invalid activity type\", 400)\n return\n end\n end\n\n if @activity.update_attributes(update_hash)\n send_success_json(@activity.id)\n else\n send_error_json(@activity.id, @activity.errors.full_messages.to_sentence, 400)\n end\n\n end",
"def update\n @activity = Activity.find(params[:id])\n\n respond_to do |format|\n if @activity.update_attributes(params[:activity])\n format.html { redirect_to current_user, notice: 'Activity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @activity = Activity.find(params[:id])\n \n respond_to do |format|\n if @activity.update_attributes(params[:activity])\n format.html { redirect_to activities_path }\n format.xml { render :nothing => true }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @activity.errors.to_xml }\n end\n end\n end",
"def update\n # make sure that user have access to activity else raise execption\n current_user.user_activities.find(params[:id])\n \n # re query from database beacuse user_activities call have joins operation that make the record readony\n @activity = Activity.find(params[:id])\n\n respond_to do |format|\n if @activity.update_attributes(params[:activity])\n format.html { redirect_to activity_path(@activity), notice: 'Activity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @activity.update(activity_params)\n format.html { redirect_to activities_path, notice: 'Exercise event was successfully updated.' }\n format.json { render :show, status: :ok, location: @activity }\n else\n format.html { render :edit }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @activity.update(activity_params)\n format.html { redirect_to activities_path, notice: 'Activity was successfully updated.' }\n format.json { render :show, status: :ok, location: @activity }\n else\n format.html { render :edit }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @activity.update(activity_params)\n format.html { redirect_to @activity, notice: 'Activity was successfully updated.' }\n format.json { render :show, status: :ok, location: @activity }\n else\n format.html { render :edit }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @activity.update(activity_params)\n format.html { redirect_to @activity, notice: 'Activity was successfully updated.' }\n format.json { render :show, status: :ok, location: @activity }\n else\n format.html { render :edit }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @activity.update(activity_params)\n format.html { redirect_to @activity, notice: 'Activity was successfully updated.' }\n format.json { render :show, status: :ok, location: @activity }\n else\n format.html { render :edit }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @activity.update(activity_params)\n format.html { redirect_to @activity, notice: 'Activity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @activity.update(activity_params)\n format.html { redirect_to @activity, notice: 'Activity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @activity.update(activity_params)\n format.html { redirect_to @activity, notice: 'Activity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @activity.update(activity_params)\n format.html { redirect_to @activity, notice: 'Activity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @activity.update(activity_params)\n format.html { redirect_to @activity, notice: 'Activity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @activity.update(activity_params)\n format.html { redirect_to @activity, notice: 'Activity was successfully updated.' }\n format.json { render :show, status: :ok, location: @activity }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @activity.update(activity_params)\n format.html { redirect_to project_activity_url(@project, @activity), notice: 'Activity was successfully updated.' }\n format.json { render :show, status: :ok, location: @activity }\n else\n format.html { render :edit }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n @activity.status = Activity::SETTED if @activity.setting?\n if @activity.update(activity_params)\n format.html { redirect_to activities_url, notice: 'Activity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @activity.update(activity_params)\n format.html { redirect_to [@course, @learning_unit, @activity], notice: 'Activity was successfully updated.' }\n format.json { render :show, status: :ok, location: @activity }\n else\n format.html { render :edit }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @activity.update(activity_params)\n format.html { redirect_to @activity, notice: 'Activity was successfully updated.' }\n format.json { render :show, status: :ok, location: @activity }\n else\n format.html { render :edit }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n r = Reciever.where(\"name == ? \", activity_params[:reciever][:name].upcase)\n r.empty? ? @reciever = Reciever.new(name: activity_params[:reciever][:name].upcase) : @reciever = r.first\n\n respond_to do |format|\n if @activity.update(activity_params.except(:reciever))\n @reciever.save\n @reciever.activities << @activity\n format.html { redirect_to @activity, notice: 'Activity was successfully updated.' }\n format.json { render :show, status: :ok, location: @activity }\n else\n format.html { render :edit }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @activity = Activity.find(params[:id])\n\n respond_to do |format|\n if @activity.update_attributes(params[:activity])\n format.html { redirect_to(@activity, :notice => 'Activity was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @activity.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_activities!\n _, _, host, = URI.split url\n PublicActivity::Activity.where(trackable: self).update_all(\n parameters: {\n namespace_id: namespace.id,\n namespace_name: namespace.clean_name,\n webhook_url: url,\n webhook_host: host\n }\n )\n end",
"def update\n respond_to do |format|\n if @activity.update(activity_params)\n #remove all existed contents first\n @activity.activity_contents.destroy_all\n activity_contents = JSON.parse(params[:activity][:activity_contents])\n activity_contents.each do |content|\n ActivityContent.create(activity_id: @activity.id,\n sport_option: content[\"sport_option\"],\n quantity: content[\"quantity\"])\n end\n format.html {redirect_to @activity, notice: 'Activity was successfully updated.'}\n format.json {render :show, status: :ok, location: @activity}\n format.js {render 'users/create_activity'}\n else\n format.html {render :edit}\n format.json {render json: @activity.errors, status: :unprocessable_entity}\n format.js {render 'activities/create', layout: false, content_type: 'text/javascript'}\n end\n end\n end",
"def edit_activity\n @activity = Activity.find(params[:id])\n end",
"def update\n @activity = Activity.find(params[:id])\n\n respond_to do |format|\n if @activity.update_attributes(params[:activity])\n flash[:notice] = I18n.t('activities.controller.Successfully_updated')\n format.html { redirect_to(activities_path) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @activity.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @activity.update(activity_params)\n format.html { redirect_to [:phone, @activity], notice: 'Activity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @activity = Activity.find(params[:id])\n\n respond_to do |format|\n if @activity.update_attributes(params[:activity])\n flash[:notice] = 'Activity was successfully updated.'\n format.html { redirect_to(@activity) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n end\n end\n end",
"def update\n # only the owner can edit his / her activity\n if current_user.id == @activity.user_id\n respond_to do |format|\n if @activity.update(activity_params)\n format.json { render :json => {:success=>true, :message=>\"Activity was successfully updated.\"} }\n else\n format.json { render :json => {:success=>false, :message=>\"Something went wrong. Could not update activity.\"} }\n end\n end\n else\n respond_to do |format|\n format.json { render :json => {:success=>false, :message=>\"You are not the owner of this activity.\"} }\n end\n end\n end",
"def update\n @activity_type = ActivityType.find(params[:id])\n\n respond_to do |format|\n if @activity_type.update_attributes(params[:activity_type])\n format.html { redirect_to @activity_type, notice: 'Activity type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @activity_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_activity(activity, slug)\n create_or_update(activity, slug,\n 'activity', 'activities',\n false)\n end",
"def activity(id)\n get(\"/activities/#{id}.json\")\n end",
"def activity(id)\n get(\"/activities/#{id}.json\")\n end",
"def update\n respond_to do |format|\n if @activity.update(activity_params)\n# format.html { redirect_to @activity, notice: 'Activity was successfully updated.' }\n format.html { redirect_to \"/activities/nanjingstart\", notice: 'Activity was successfully updated.' }\n format.json { render :show, status: :ok, location: @activity }\n else\n format.html { render :edit }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @breadcrumb = 'update'\n @activity = Activity.find(params[:id])\n @activity.updated_by = current_user.id if !current_user.nil?\n\n respond_to do |format|\n if @activity.update_attributes(params[:activity])\n format.html { redirect_to @activity,\n notice: (crud_notice('updated', @activity) + \"#{undo_link(@activity)}\").html_safe }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @activity.update(activity_params)\n format.html { redirect_to activities_path(@activity_type.table_name, @activity.id), notice: \"#{@activity_type.name.humanize} was successfully updated.\" }\n format.json { render :show, status: :ok, location: @activity }\n format.js { render :update }\n else\n format.html { render :edit }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n format.js { render :edit }\n end\n end\n end",
"def update\n @activity_item = ActivityItem.find(params[:id])\n\n respond_to do |format|\n if @activity_item.update_attributes(params[:activity_item])\n format.html { redirect_to @activity_item, notice: 'Activity item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @activity_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @activity = Activity.find(params[:id])\n\t\tauthorize! :update, @activity\n\n respond_to do |format|\n if @activity.update_attributes(params[:activity])\n flash[:notice] = 'Activity was successfully updated.'\n format.html { redirect_to(activities_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @activity.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @activity = Activity.find(params[:id])\n @attcategories = Attcategory.find(:all)\n \n duration = params[:activity_hours].to_i * 60\n duration += params[:activity_minutes].to_i\n \n args = params[:activity].merge!({\"duration\" => duration})\n \n # Work around - initialize attributes to zero every\n # time before filling them back in\n @activity.update_attributes(:actattribute_ids => [])\n\n respond_to do |format|\n if @activity.update_attributes(args)\n flash[:notice] = 'Activity was successfully updated.'\n format.html { redirect_to(@activity) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @activity.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @step_activity = StepActivity.find(params[:id])\n\n respond_to do |format|\n if @step_activity.update_attributes(params[:step_activity])\n format.html { redirect_to @step_activity, notice: 'Step activity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @step_activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @activity = Activity.find(params[:id])\n\n respond_to do |format|\n if @activity.update_attributes(params[:activity])\n flash[:notice] = 'Attività aggiornata correttamente'\n format.html { redirect_to(@activity) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @activity.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_activity\n # @user = User.find(params[:user_id])\n @activity = Activity.find(params[:id])\n rescue ActiveRecord::RecordNotFound\n render json: { message: 'no activity matches that ID' }, status: 404\n end",
"def set_activity\n @activity = Activity.find(params[:id])\n end",
"def set_activity\n @activity = Activity.find(params[:id])\n end",
"def set_activity\n @activity = Activity.find(params[:id])\n end",
"def set_activity\n @activity = Activity.find(params[:id])\n end",
"def set_activity\n @activity = Activity.find(params[:id])\n end",
"def set_activity\n @activity = Activity.find(params[:id])\n end",
"def set_activity\n @activity = Activity.find(params[:id])\n end",
"def set_activity\n @activity = Activity.find(params[:id])\n end",
"def update\n @activity = Activity.find(params[:id])\n\n respond_to do |format|\n if @activity.update_attributes(params[:activity])\n format.html { redirect_to( course_path(params[:course_id]), :notice => 'Lista de presença salva com sucesso') }\n format.html { redirect_to(@activity, :notice => 'activity was successfully updated.') }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @activity.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def edit\n @activity = Activity.find(params[:id])\n @categories = Category.all\n respond_to do |format|\n format.json { render json: @activity }\n end\n end",
"def update\n # render text: params\n respond_to do |format|\n if @activity.update(activity_params.merge(user_id: current_user.id))\n format.html { redirect_to @activity, notice: 'Activity was successfully updated.' }\n format.json { render :show, status: :ok, location: @activity }\n else\n format.html { render :edit }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @activity_event = ActivityEvent.find(params[:id])\n\n respond_to do |format|\n if @activity_event.update_attributes(params[:activity_event])\n format.html { redirect_to @activity_event, notice: 'Activity event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @activity_event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @activity.update(activity_params)\n format.html { redirect_to [@group, @activity], notice: 'Activity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @status_activity.update(status_activity_params)\n format.html { redirect_to @status_activity, notice: 'Status activity was successfully updated.' }\n format.json { render :show, status: :ok, location: @status_activity }\n else\n format.html { render :edit }\n format.json { render json: @status_activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @activity = Activity.where(:user_id => current_user.id).find(params[:id])\n\n respond_to do |format|\n if params[:activity][:force_update]\n \n params[:activity][:force_update] = nil\n @activity.completed = params[:activity][:completed]\n \n if @activity.save(:validate => false)\n flash[:success] = \"Activity updated\"\n format.html { redirect_to(request.env[\"HTTP_REFERER\"]) }\n format.xml { head :ok }\n end\n \n elsif @activity.update_attributes(params[:activity])\n flash[:success] = \"Activity updated\"\n \n format.js { render :text => 'OK' }\n format.html { redirect_to( activities_path , :success => 'Activity updated.') }\n format.xml { head :ok }\n format.json { head :ok }\n else\n format.js { render :text => 'KO' }\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @activity.errors, :status => :unprocessable_entity }\n format.json { render :json => @activity.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_activity\n @activity = Activity.find(params[:id])\n end",
"def set_activity\n @activity = Activity.find(params[:id])\n end",
"def set_activity\n @activity = Activity.find(params[:id])\n end",
"def set_activity\n @activity = Activity.find(params[:id])\n end",
"def set_activity\n @activity = Activity.find(params[:id])\n end",
"def set_activity\n @activity = Activity.find(params[:id])\n end",
"def set_activity\n @activity = Activity.find(params[:id])\n end",
"def set_activity\n @activity = Activity.find(params[:id])\n end",
"def set_activity\n @activity = Activity.find(params[:id])\n end",
"def set_activity\n @activity = Activity.find(params[:id])\n end",
"def set_activity\n @activity = Activity.find(params[:id])\n end",
"def set_activity\n @activity = Activity.find(params[:id])\n end",
"def set_activity\n @activity = Activity.find(params[:id])\n end",
"def set_activity\n @activity = Activity.find(params[:id])\n end",
"def set_activity\n @activity = Activity.find(params[:id])\n end",
"def set_activity\n @activity = Activity.find(params[:id])\n end",
"def set_activity\n @activity = Activity.find(params[:id])\n end",
"def set_activity\n @activity = Activity.find(params[:id])\n end",
"def set_activity\n @activity = Activity.find(params[:id])\n end",
"def set_activity\n @activity = Activity.find(params[:id])\n end",
"def set_activity\n @activity = Activity.find(params[:id])\n end",
"def set_activity\n @activity = Activity.find(params[:id])\n end",
"def set_activity\n @activity = Activity.find(params[:id])\n end",
"def update\n @activity = Activity.find(params[:id])\n\n respond_to do |format|\n if @activity.update_attributes(params[:activity])\n flash[:notice] = 'Activity was successfully updated.'\n if @activity.is_achievement\n format.html { redirect_to :action => 'index' }\n else\n format.html { redirect_to :action => 'plan_chart' }\n end\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @activity.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n # make sure that user have access to activity else raise execption\n # current_user.user_activities.find(params[:id])\n \n # re query from database beacuse user_activities call have joins operation that make the record readony\n @activity = Activity.find(params[:id])\n params[:activity][:date] = change_date_format(params[:activity][:date]) if !(params[:activity][:date]).blank?\n respond_to do |format|\n if @activity.update_attributes(params[:activity])\n format.html { redirect_to activity_path(@activity), notice: 'Data was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @recent_activity = RecentActivity.find(params[:id])\n\n respond_to do |format|\n if @recent_activity.update_attributes(params[:recent_activity])\n format.html { redirect_to @recent_activity, notice: 'Recent activity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recent_activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @activity\n if @activity.delete\n head :no_content\n else\n head :gone\n end\n else\n head :unprocessable_entity\n end\n\n end",
"def update\n authorize @workflow\n respond_to do |format|\n if @workflow.update(workflow_params)\n @workflow.create_activity(:update, owner: current_user) if @workflow.log_update_activity?\n format.html { redirect_to @workflow, notice: 'Workflow was successfully updated.' }\n format.json { render :show, status: :ok, location: @workflow }\n else\n format.html { render :edit }\n format.json { render json: @workflow.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @type_activity.update(type_activity_params)\n format.html { redirect_to @type_activity, notice: 'Type activity was successfully updated.' }\n format.json { render :show, status: :ok, location: @type_activity }\n else\n format.html { render :edit }\n format.json { render json: @type_activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @spot_activity = SpotActivity.find(params[:id])\n\n respond_to do |format|\n if @spot_activity.update_attributes(params[:spot_activity])\n format.html { redirect_to(@spot_activity, :notice => 'SpotActivity was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @spot_activity.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_activity\n @activity = Activity.find_by_id(params[:id])\n end",
"def set_activity\n @activity = current_user.activities.find(params[:id])\n end",
"def update\n @activity_tag = ActivityTag.find(params[:id])\n\n respond_to do |format|\n if @activity_tag.update_attributes(params[:activity_tag])\n format.html { redirect_to @activity_tag, notice: 'Activity tag was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @activity_tag.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_activity\n @activity = PublicActivity::Activity.find(params[:activity_id])\n unless @activity\n head :bad_request\n end\n end",
"def update\n\n params = opportunity_params\n\n unless params[:new_activity].blank?\n activity = Activity.find_by_title(params[:new_activity])\n if activity.nil?\n activity = Activity.new(:title => params[:new_activity])\n activity.save\n end\n params[:activity_id] = activity.id\n end\n\n unless params[:new_sub_activity].blank?\n sub_activity = @opportunity.activity.sub_activities.find_by_title(params[:new_sub_activity])\n if sub_activity.nil?\n sub_activity = @opportunity.activity.sub_activities.new(:title => params[:new_sub_activity])\n sub_activity.save\n end\n params[:sub_activity_id] = sub_activity.id\n end\n respond_to do |format|\n if @opportunity.update(params)\n format.html { redirect_to @opportunity, notice: 'Opportunity was successfully updated.' }\n format.json { render :show, status: :ok, location: @opportunity }\n else\n @activities = Activity.all\n @sub_activities = @opportunity.activity.sub_activities.order(:title)\n format.html { render :edit }\n format.json { render json: @opportunity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @google_account_activity.update(google_account_activity_params)\n format.html { redirect_to google_account_activities_path }\n response = {status: 200}\n format.json { render json: response, status: response[:status] }\n else\n format.html { render action: 'edit' }\n format.json { render json: @google_account_activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n #@activity = Activity.find(params[:id])\n @activity = Activity.find_by_permalink(params[:id])\n\n respond_to do |format|\n if @activity.update_attributes(params[:activity])\n format.html { redirect_to(@activity, :notice => 'Activity was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @activity.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n \"\"\"\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:activity])\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 \"\"\"\n end",
"def update\n respond_to do |format|\n if @user_activity.update(user_activity_params)\n format.html { redirect_to @user_activity, notice: 'User activity was successfully updated.' }\n format.json { render :show, status: :ok, location: @user_activity }\n else\n format.html { render :edit }\n format.json { render json: @user_activity.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.67760414",
"0.6759261",
"0.67530906",
"0.6727096",
"0.67267734",
"0.6719355",
"0.66723365",
"0.6667481",
"0.6626926",
"0.6595789",
"0.6546449",
"0.65202326",
"0.65202326",
"0.65202326",
"0.6504074",
"0.6504074",
"0.6504074",
"0.6504074",
"0.6504074",
"0.65034425",
"0.6479778",
"0.64704263",
"0.6426313",
"0.64200145",
"0.64058644",
"0.6395241",
"0.6388535",
"0.63879216",
"0.6387762",
"0.6367051",
"0.635108",
"0.6334203",
"0.63334477",
"0.63224065",
"0.632226",
"0.63112634",
"0.63112634",
"0.63048244",
"0.6295931",
"0.626248",
"0.62439585",
"0.62410223",
"0.6212501",
"0.6190675",
"0.6181429",
"0.6177342",
"0.61542165",
"0.61542165",
"0.61542165",
"0.61542165",
"0.61542165",
"0.61542165",
"0.61542165",
"0.61542165",
"0.615332",
"0.6150697",
"0.6150101",
"0.61440027",
"0.6141778",
"0.6119491",
"0.6099138",
"0.609501",
"0.609501",
"0.609501",
"0.609501",
"0.609501",
"0.609501",
"0.609501",
"0.609501",
"0.609501",
"0.609501",
"0.609501",
"0.609501",
"0.609501",
"0.609501",
"0.609501",
"0.609501",
"0.609501",
"0.609501",
"0.609501",
"0.609501",
"0.609501",
"0.609501",
"0.609501",
"0.6083932",
"0.6078044",
"0.6074435",
"0.60603106",
"0.6056548",
"0.60458463",
"0.6043842",
"0.60357755",
"0.60322773",
"0.602762",
"0.6013778",
"0.6012909",
"0.6012038",
"0.60025454",
"0.5998466",
"0.5998272"
] | 0.6235562 | 42 |
DELETE /activities/1 DELETE /activities/1.json | def destroy
@activity = Activity.find(params[:id])
@activity.destroy
respond_to do |format|
format.html { redirect_to activities_url }
format.json { head :no_content }
end
if @activity.created_at < 1.day.ago
authorize! :edit, @activity
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to activities_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to activities_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to activities_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to activities_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to activities_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @activity = current_user.activities.find(params[:id])\n @activity.destroy\n\n respond_to do |format|\n format.html { redirect_to activities_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @activity = Activity.find(params[:id])\n @activity.destroy\n\n respond_to do |format|\n format.html { redirect_to activities_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @activity = Activity.find(params[:id])\n @activity.destroy\n\n respond_to do |format|\n format.html { redirect_to activities_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @activity = Activity.find(params[:id])\n @activity.destroy\n\n respond_to do |format|\n format.html { redirect_to activities_url }\n format.json { head :no_content }\n end\n end",
"def destroy \n @activity = current_user.user_activities.find(params[:id])\n @activity.destroy\n\n respond_to do |format|\n format.html { redirect_to activities_path }\n format.json { head :no_content }\n end\n end",
"def destroy \n @activity = current_user.user_activities.find(params[:id])\n @activity.destroy\n\n respond_to do |format|\n format.html { redirect_to activities_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n\n if @activity.nil?\n send_error_json(nil, \"Delete error\", 400)\n return\n end\n\n currid = @activity.id\n\n if @activity.destroy\n send_success_json(currid, {})\n else\n send_error_json(currid, \"Delete error\", 400)\n end\n end",
"def destroy\n @my_activity = MyActivity.find(params[:id])\n @my_activity.destroy\n\n respond_to do |format|\n format.html { redirect_to my_activities_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dev_activity.destroy\n respond_to do |format|\n format.html { redirect_to dev_activities_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @activity = current_user.activities.find(params[:id])\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to activities_url, notice: 'Activity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to api_activities_url, notice: 'Activity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to :back}\n format.json { head :no_content }\n end\n end",
"def destroy\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to activities_url, notice: 'Activity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to activities_url, notice: 'Activity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to activities_url, notice: 'Activity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to activities_url, notice: 'Activity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to activities_url, notice: 'Activity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to activities_url, notice: 'Activity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to team_activities_path(@team) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @activity.destroy\n respond_to do |format|\n format.html {redirect_to activities_url, notice: 'Activity was successfully destroyed.'}\n format.json {head :no_content}\n end\n end",
"def destroy\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to phone_activities_url, notice: 'Activity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to project_activities_url(@project), notice: 'Activity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @activity = Activity.find(params[:id])\n @activity.destroy\n \n respond_to do |format|\n format.html { redirect_to activities_url }\n format.xml { render :nothing => true }\n end\n end",
"def destroy\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to activities_url, notice: 'Exercise event was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @activity = Activity.find(params[:id])\n @activity.destroy\n\n respond_to do |format|\n format.html { redirect_to(activities_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @activity = Activity.find(params[:id])\n @activity.destroy\n\n respond_to do |format|\n format.html { redirect_to(activities_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @activity = Activity.find(params[:id])\n @activity.destroy\n\n respond_to do |format|\n format.html { redirect_to(activities_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @activity = Activity.find(params[:id])\n @activity.destroy\n\n respond_to do |format|\n format.html { redirect_to(activities_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @activity.destroy\n respond_to do |format|\n format.html do\n flash[:success] = 'Activity was successfully destroyed.'\n redirect_to activities_url\n end\n format.json { head :no_content }\n end\n end",
"def destroy\n @step_activity = StepActivity.find(params[:id])\n @step_activity.destroy\n\n respond_to do |format|\n format.html { redirect_to step_activities_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @current_activity.destroy\n\n respond_to do |format|\n format.html { redirect_to(activities_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n if Activity.exists?(uuid: params[:id])\n @activity = Activity.find_by(uuid: params[:id])\n @activity.destroy\n end\n end",
"def destroy\n @recent_activity = RecentActivity.find(params[:id])\n @recent_activity.destroy\n\n respond_to do |format|\n format.html { redirect_to recent_activities_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @activity = Activity.find(params[:id])\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to([:manage, activities_url]) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @status_activity.destroy\n respond_to do |format|\n format.html { redirect_to status_activities_url, notice: 'Status activity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to activities_group_url(@group) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @activity_type = ActivityType.find(params[:id])\n @activity_type.destroy\n\n respond_to do |format|\n format.html { redirect_to activity_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @activity_item = ActivityItem.find(params[:id])\n @activity_item.destroy\n\n respond_to do |format|\n format.html { redirect_to activity_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n activity = Activity.find(params[:id])\n activity.destroy\n redirect_to root_url\n end",
"def destroy\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to [@course, @learning_unit], notice: 'Activity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @activity.destroy\n @title = Title.find(@activity[:title_id])\n @event = Event.find(@title[:event_id])\n respond_to do |format|\n format.html { redirect_to event_path(@event), notice: 'Activity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy_activity\n @activity = Activity.find(params[:id])\n @activity.destroy\n end",
"def destroy\n @activity = Activity.find(params[:id])\n\n respond_to do |format|\n if @activity.destroy\n format.html { redirect_to activities_url,\n notice: (crud_notice('destroyed', @activity) + \"#{undo_link(@activity)}\").html_safe }\n format.json { head :no_content }\n else\n format.html { redirect_to activities_url, alert: \"#{@activity.errors[:base].to_s}\".gsub('[\"', '').gsub('\"]', '') }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def delete_activity(id:, **args)\n params = parameters(args) do\n optional_params\n end\n request(:delete, \"activities/#{id}\", params)\n end",
"def destroy\n @activity = Activity.find(params[:id])\n\n @activity.destroy\n\n redirect_to activities_path\n end",
"def destroy\n @judge_activity.destroy\n respond_to do |format|\n format.html { redirect_to judge_activities_url }\n format.json { head :no_content }\n end\n end",
"def delete_activities(**args)\n params = parameters(args) do\n required_params :ids\n optional_params :ids\n end\n request(:delete, 'activities', params)\n end",
"def destroy\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to activities_path(@activity_type.table_name), notice: \"#{@activity_type.name.humanize} was successfully deleted.\" }\n format.json { head :no_content }\n format.js { render :destroy }\n end\n end",
"def destroy\n #@activity = Activity.find(params[:id])\n @activity = Activity.find_by_permalink(params[:id])\n @activity.destroy\n\n respond_to do |format|\n format.html { redirect_to(activities_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @activity = Activity.find(params[:id])\n\t\tauthorize! :destroy, @activity\n @activity.destroy\n\n respond_to do |format|\n format.html { redirect_to(activities_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @type_activity.destroy\n respond_to do |format|\n format.html { redirect_to type_activities_url, notice: 'Type activity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_activity(db, act_id)\n\tdb.execute(\"DELETE FROM activities WHERE id=?\", [act_id])\nend",
"def destroy\n @user_activity.destroy\n respond_to do |format|\n format.html { redirect_to user_activities_url, notice: \"User activity was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user_activity.destroy\n respond_to do |format|\n format.html { redirect_to user_activities_url, notice: 'User activity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @activity_item.destroy\n respond_to do |format|\n format.html { redirect_to activity_items_url, notice: 'Activity item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n activity_type.destroy\n respond_to do |format|\n format.html { redirect_to activity_types_url, notice: 'activity_type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @activite = Activite.find(params[:id])\n @activite.destroy\n\n respond_to do |format|\n format.html { redirect_to activites_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @activity_event = ActivityEvent.find(params[:id])\n @activity_event.destroy\n\n respond_to do |format|\n format.html { redirect_to activity_events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vacination = Vacination.find(params[:id])\n @vacination.activity.destroy\n respond_to do |format|\n format.html { redirect_to vacinations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @activity = Activity.where(:user_id => current_user.id).find(params[:id])\n @activity.destroy\n flash[:success] = \"Activity deleted\"\n\n respond_to do |format|\n format.js { render :text => 'OK' }\n format.html { redirect_to(activities_url) }\n format.xml { head :ok }\n format.json { head :ok }\n end\n end",
"def destroy\n if current_user.activity_ids.include?(params[:id].to_i)\n @activity = current_user.activities.find(params[:id])\n elsif current_user.admin?\n @activity = Activity.find(params[:id])\n else\n redirect_to root_path, :notice => \"Not authorized\"\n end\n respond_to do |format|\n format.html { redirect_to activities_url, notice: 'Activity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @today_activity = TodayActivity.find(params[:id])\n @today_activity.destroy\n\n respond_to do |format|\n format.html { redirect_to(today_activities_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @activity_tag = ActivityTag.find(params[:id])\n @activity_tag.destroy\n\n respond_to do |format|\n format.html { redirect_to activity_tags_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @project_activity.destroy\n respond_to do |format|\n format.html { redirect_to project_activities_url, notice: 'Project activity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @activity.destroy\n respond_to do |format|\n format.html do\n redirect_to group_activities_url(@group)\n flash_message(:info, 'Activity was successfully destroyed.')\n end\n format.json { head :no_content }\n end\n end",
"def destroy\n @evactivity = Evactivity.find(params[:id])\n @evactivity.destroy\n\n respond_to do |format|\n format.html { redirect_to(evactivities_url) }\n format.xml { head :ok }\n end\n end",
"def destroy_intent(base_path)\n delete_json(intent_url(base_path))\n rescue GdsApi::HTTPNotFound => e\n e\n end",
"def destroy\n @activities_list.destroy\n respond_to do |format|\n format.html { redirect_to activities_lists_url, notice: 'Activities list was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @spot_activity = SpotActivity.find(params[:id])\n @spot_activity.destroy\n\n respond_to do |format|\n format.html { redirect_to(spot_activities_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @activity_record.destroy\n respond_to do |format|\n format.html { redirect_to activity_records_url, notice: 'Activity record was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @activity_notice.destroy\n respond_to do |format|\n format.html { redirect_to activity_notices_url }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @gallery_activity = GalleryActivity.find(params[:id])\r\n @gallery_activity.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to gallery_activities_url }\r\n format.json { head :ok }\r\n end\r\n end",
"def destroy\n @activity = Activity.find(params[:id])\n @activity.destroy\n\n respond_to do |format|\n format.html { redirect_to(course_path(params[:course_id])) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @activity = Activity.find(params[:id])\n @activity.destroy\n\n respond_to do |format|\n format.html { redirect_to :action => :plan_chart }\n format.xml { head :ok }\n end\n end",
"def destroy\n @activity_log.destroy\n respond_to do |format|\n format.html { redirect_to activity_logs_url, notice: 'Activity log was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @activity.destroy\n flash[:success] = \"Activity deleted\"\n\n format.html { redirect_to(people_url(current_user)) }\n end",
"def delete_activities\n self.activities.delete_all\n end",
"def destroy\r\n @text_activity = TextActivity.find(params[:id])\r\n @text_activity.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to :back }\r\n format.json { head :ok }\r\n end\r\n end",
"def destroy\n @user_activity = current_user.user_activities.find_by(user_id: current_user.id)\n\n if @activity.owner_id == current_user.id\n @activity.destroy\n elsif !@user_activity.nil?\n @user_activity.destroy\n else\n render file: 'app/views/errors/forbidden_access.html', status: :unauthorized\n end\n\n respond_to do |format|\n format.html { redirect_to list_user_activities_path, notice: 'Activity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @activity = Activity.find(params[:id])\n access_denied unless current_user.is_admin? or @activity.user_id == current_user.id\n @activity.delete!\n respond_to do |format|\n format.html { redirect_to(activities_url) }\n format.js {\n render :update do |page|\n page.remove 'activity_and_comments_' + @activity.id.to_s\n end \n }\n end\n end",
"def destroy\n @activity_title.destroy\n respond_to do |format|\n format.html { redirect_to activity_titles_url, notice: 'Activity title was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @activity_type_f.destroy\n respond_to do |format|\n format.html { redirect_to activity_type_fs_url, notice: 'Activity type f was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @work_activity = WorkActivity.find(params[:id])\n @work_activity.destroy\n\n respond_to do |format|\n format.html { redirect_to work_activities_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @activity_kind.destroy\n respond_to do |format|\n format.html { redirect_to activity_kinds_url, notice: 'Activity kind was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n c_id = @user_activity.customer_id\n @user_activity.destroy\n\n respond_to do |format|\n format.html { redirect_to customer_url(c_id), notice: 'User activity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @activite = Activite.find(params[:id])\n @activite.destroy\n\n respond_to do |format|\n format.html { redirect_to(activites_url) }\n format.xml { head :ok }\n format.json {render :json => {\"success\"=>true,\"data\"=>[]}}\n \n end\n end",
"def destroy\n @visit = Visit.find(params[:id])\n @visit.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @activity_category.destroy\n respond_to do |format|\n format.html { redirect_to activity_categories_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @market_activity = MarketActivity.find(params[:id])\n @market_activity.destroy\n\n respond_to do |format|\n format.html { redirect_to market_activities_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @activite.destroy\n respond_to do |format|\n format.html { redirect_to activites_url, notice: 'Activite was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def DeleteView id\n \n APICall(path: \"views/#{id}.json\",method: 'DELETE')\n \n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end"
] | [
"0.7712568",
"0.7712568",
"0.7712568",
"0.7712568",
"0.7712568",
"0.76978153",
"0.7688336",
"0.7663404",
"0.7663404",
"0.76458544",
"0.76458544",
"0.7643713",
"0.7564872",
"0.75457203",
"0.745816",
"0.73909366",
"0.73904556",
"0.73731923",
"0.73731923",
"0.73731923",
"0.73731923",
"0.73731923",
"0.73731923",
"0.73481995",
"0.73416245",
"0.7341086",
"0.7332064",
"0.73257965",
"0.73257756",
"0.72915006",
"0.72915006",
"0.72915006",
"0.72915006",
"0.7275883",
"0.7268724",
"0.72669137",
"0.7246248",
"0.7230373",
"0.7227545",
"0.7216078",
"0.72103095",
"0.7202828",
"0.7199694",
"0.7179847",
"0.7143273",
"0.71384317",
"0.71219426",
"0.7121868",
"0.7121433",
"0.7106636",
"0.70878696",
"0.70865566",
"0.70853233",
"0.7067567",
"0.7030781",
"0.70211947",
"0.7012679",
"0.69987464",
"0.69941527",
"0.6985621",
"0.69706845",
"0.6967915",
"0.6967435",
"0.69258755",
"0.69219923",
"0.6913831",
"0.6880847",
"0.68805844",
"0.6874126",
"0.6850702",
"0.68496335",
"0.6841298",
"0.68394154",
"0.6837306",
"0.6836624",
"0.6833475",
"0.6820451",
"0.68156445",
"0.68129987",
"0.6808387",
"0.68075055",
"0.6793785",
"0.6790162",
"0.6773047",
"0.6739487",
"0.6723926",
"0.6717819",
"0.67053896",
"0.67026925",
"0.66904825",
"0.66743493",
"0.6669548",
"0.6663775",
"0.6654555",
"0.6641795",
"0.6631505",
"0.6606946",
"0.66062915",
"0.66062915",
"0.66062915"
] | 0.7001932 | 57 |
What is the sum of the digits of the number 2^1000? | def get_digits(num)
digits = []
result = num
first_iter_flag = true
while(result != 0)
result = result/10 if(!first_iter_flag)
first_iter_flag = false if(first_iter_flag)
digits.unshift result%10 if(result != 0)
end
digits
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sixteen\n sum_of_digits 2**1000\nend",
"def power_digit_sum(base, exponent)\n\t(2 ** 1000).to_s.split(\"\").inject(0) {|sum, n| sum + n.to_i}\nend",
"def digit_summer(pow_pow)\n\tdigit = 2**pow_pow\n\n\tdigit_string = digit.to_s\n\n\tsum = 0\n\n\tdigit_string.each_char do |num|\n\t\tsum = sum + num.to_i\n\tend\n\treturn sum\nend",
"def power_digits(n)\r\n sum = 2 ** n\r\n sum = sum.to_s.split(\"\").map{|x| x.to_i}.reduce(:+)\r\n return sum \r\nend",
"def sum_base_2_number(pow = 1)\n (2**pow).to_s.split('').map(&:to_i).inject(:+)\nend",
"def power_digit_sum(power)\n result = 2 ** power\n result.to_s.chars.map(&:to_i).inject(&:+)\nend",
"def power_sum\n num_ary = []\n ary = (2 ** 1000).to_s.split('') # Because of BigNum\n ary.each { |x| num_ary << x.to_i }\n print num_ary.inject { |sum, x| sum + x }\nend",
"def euler016\n (2 ** 1000).to_s.split('').map { |x| x.to_i }.reduce(:+)\nend",
"def sum_digits\n self.to_s.split('').inject(0) { |memo, c| memo + c.to_i }\n end",
"def calculate_sum\n 1000000000000\n end",
"def sum_of_factorial_digits(factorial)\r\n\tthe_factorial = (1..factorial).inject(1){ |milti, i| milti * i }\r\n\r\n\treturn the_factorial.to_s.split('').inject(0){ |sum, i| sum + i.to_i }\r\nend",
"def twenty\n sum_of_digits(factorial(100))\nend",
"def square_digits_2 num\n num.to_s.chars.map{|x| x.to_i**2}.join.to_i\nend",
"def power(n)\r\n sum = (2**n).to_s.each_char.inject {|a, b| a.to_i + b.to_i}\r\n \"The Sum of The Digits of The Number 2**#{n} is: #{sum}\"\r\nend",
"def sum_power\n\tsum = 2**1000\n\tputs sum\n\n\tsum_s = sum.to_s\n puts sum_s.split(\"\").inject(0){|accum, value| accum += value.to_i}\n #some how sum_s.length doesn't work\n #puts (0...(sum_s.length)).inject(0){|accum, value| accum += (sum_s[value] - ?0)}\n\n #puts \"1230989\".length\nend",
"def power_digit_sum(num)\n num_array = num.to_s.split(//).map do |s|\n s.to_i\n end\n num_array.reduce(:+)\nend",
"def power_digit_sum(base, exponent)\n # 1) calculate the power\n power = base ** exponent\n sum = 0\n\n # 2) convert to string to iterate each digit\n len = power.to_s.length\n for index in (0...len)\n # 3) convert back to number to calculate sum\n sum += power.to_s[index].to_i\n end\n\n # 4) return sum\n return sum\nend",
"def sum(n)\n n.digits.sum\nend",
"def super_digit(n)\n return n if n < 10\n sum = n.to_s.chars.map(&:to_i).sum\n return super_digit(sum)\nend",
"def digit_sum(a,b)\n\tsums = []\n\tnum = a**b\n\tarr = num.to_s.split('')\n\tnum_arr = arr.map{|n| n.to_i}\n\tsums << num_arr.reduce(:+)\n\tp sums.max\nend",
"def two_to_sum(n)\n result = 2 ** n\n \n result.to_s.split('').map {|x| x.to_i }.reduce(:+)\nend",
"def suma(num)\n\t\ttotal =0\n\t\t((num*2).to_s.chars.map(&:to_i)).each{|x| total+=x}\n\t\treturn total\n\tend",
"def euler048\n (1..1000).each.reduce { |a,i| a + i**i }.to_s.slice(-10, 10).to_i\nend",
"def problem_80b(size = 100)\n total = 0\n (2..100).each do |n|\n r = n.sqrt_digits(size+1)\n next if r.length == 1\n r = r[0,size].reduce(&:+)\n total += r\n# puts \"#{n} #{r.inspect}\"\n end\n total\nend",
"def super_digit(n)\n return n if n < 10 \n return super_digit(n.to_s.chars.map(&:to_i).sum)\nend",
"def power_digit_sum(power)\n product = 2**(power)\n product.to_s.split('').inject(0) do |sum, num|\n sum += num.to_i\n sum\n end\nend",
"def sum_of_digits(number)\n sum = 0\n digits = number.to_s\n digits.each_char { |c| sum += c.to_i }\n sum\nend",
"def square_digits(num)\n num.to_s.chars.map{|x| x.to_i**2}.join.to_i\nend",
"def square_digits(num)\n num.to_s.chars.map { |d| d.to_i**2 }.join.to_i\nend",
"def sum_of_digits(n)\n sum = 0\n n.each_char {|digit| sum += digit.to_i}\n\n puts sum\nend",
"def power_digit_sum(num)\n x = num.to_s\n index = 0\n total = 0\n while index < x.length\n total += x[index].to_i\n index += 1\n end\n print total\nend",
"def base2to10(binary)\n bin_array = binary.chars.reverse\n i = 0\n sum = 0\n while i < bin_array.length\n sum += bin_array[i].to_i*(2**i)\n i+=1\n end\n sum\nend",
"def sum_of_digits(num)\n\tsum = 0\n\tnum.to_s.each_char { |x| sum = sum + x.to_i}\n\tputs sum\nend",
"def selfPowers\n\nsum = 0\n\nfor n in (1..1000)\n\n\tsum += n ** n\n\nend\n\nputs sum.to_s[-10..-1]\n\nend",
"def intSumOfDigitsInt2 i\n result = 0\n i.to_s.bytes.each do |i|\n result += i - 48\n end\n result\nend",
"def pwr_sum(pwr)\n (2**pwr).to_s.split('').map(&:to_i).sum\nend",
"def sum_of_digits(number)\n\treturn (number/100)+((number/10)%10)+(number%10)\nend",
"def digit_sum(int)\n return int.digits.sum\nend",
"def sum_of_digits(int)\n int.digits.sum\nend",
"def sum_of_digits(n)\n digits = n.to_s.split(//).map(&:to_i)\n digits.inject(0) { |sum, digit| sum + digit}\nend",
"def square_digits(num)\n num.to_s.chars.map { |x| x.to_i ** 2 }.join.to_i\nend",
"def powerdigitsum(exponent)\n product = 1\n sum = 0\n \n product = 2 ** exponent\n \n array = product.to_s.split(//)\n array.each do |el|\n sum += el.to_i\n end\n\n p sum\nend",
"def sum(int)\n int.digits.sum\nend",
"def sum_digits(num)\n\nend",
"def base2to10(binary)\n\tresult = 0\n digits = binary.chars.reverse\n\n digits.each_with_index do |bit, idx|\n result += bit.to_i * (2**idx)\n end\n\n result\nend",
"def find_digit_amount(num)\n\treturn num.to_s.length()\nend",
"def s(n)\n n.to_s.gsub(/\\d/) { |d| d.to_i**2 }.to_i\nend",
"def nDigits n,a\n return 1000 if a == 10 && n == 1000 # incorrect test\n ((Math.log10(a)*n)+1).to_i\nend",
"def total\n sum = 0\n 64.times do |counter|\n sum += (2**counter)\n end\n sum\n end",
"def sum(number)\r\n number.digits.sum\r\nend",
"def sum(number)\n number.digits.sum\nend",
"def sum(number)\n number.digits.sum\nend",
"def sum(number)\n sum = 0\n str_digits = number.to_s.chars\n\n str_digits.each do |str_digit|\n sum += str_digit.to_i\n end\n\n sum\nend",
"def sum_of_digit(n)\n sum = 0\n n.to_s.each_char {|i| sum = sum + i.to_i}\n puts sum\nend",
"def digital_root(n)\r\n while n > 9\r\n n = n.digits.inject(:+)\r\n end\r\n n\r\nend",
"def self_powers_2\n (1..1000).map {|i| i**i}.reduce(:+) % (10**10)\nend",
"def sum(num)\n num.digits.sum\nend",
"def sum(num)\n num.digits.sum\nend",
"def sum(num)\n num.digits.sum\nend",
"def sum(num)\n num.digits.sum\nend",
"def base2to10(binary)\n #split to single digits\n digits = binary.split('').map{|str| str.to_i}.reverse\n #loop through multiply by 2 raised to index and add to result\n result = 0\n digits.each_with_index do |num, i|\n result += (num *(2**i))\n end\n result\nend",
"def checksum\n (10 - (digits.each_with_index.inject(0) do |sum, (digit, index)|\n sum + (digit * (index.even? ? 1 : 3))\n end % 10)) % 10\n end",
"def sum(num)\n digits = []\n sum = 0\n digits = num.digits\n sum = digits.sum\n return sum\nend",
"def digit_sum (number)\n sum = 0\n base = 10\n while number > 0 do\n sum += number % base\n number /= base\n end\n return sum\nend",
"def round_1_sig_fig n \n get_first_digit(n) * 10**length(n)\nend",
"def sum(integer)\n integer.digits.sum\nend",
"def total (n=64)\n (2**n)-1\n end",
"def digit_factorial_sum(num)\n sum = 0\n num.to_s.split(//).each do |digit|\n sum += factorial(digit.to_i)\n end\n return sum\nend",
"def count_chars\n\t\ttime do\n\t\t\tans = 0\n\t\t\t# much faster, 0.000126 s (order of magnitude reduction!)\n\t\t\tans += self.sum_below_1000(@max)\n\t\t\tans += @max == 1000 ? self.count_n(@max) : 0\n\n\t\t\t# brute force works, and pretty quickly, 0.00204 s\n\t\t\t# (1..@max).each do |num|\n\t\t\t# \tans += self.count_n(num)\n\t\t\t# end\n\t\t\tputs \"The sum of characters of the numbers 1 to #{@max} is #{ans}.\"\n\t\tend\n\tend",
"def digit_factorials\r\n\tanswer = 0\r\n\t# Find upper bound for calculations. Since 9!*7 has seven digits and 9!*8 has seven digits, we use 9!*7\r\n\tlimit = (1..9).inject(:*)*7\r\n\t(10..limit).each do |x|\r\n\t\tputs x\r\n\t\tsum = 0\r\n\t\tnumber = x\r\n\t\t# Cycle through all digits of the number\r\n\t\twhile number > 0\r\n\t\t\t# Add factorial of digit to sum unless digit is 0, then add 1 because 0! is 1\r\n\t\t\tnumber%10 == 0 ? sum += 1 : sum += (1..number%10).inject(:*) \r\n\t\t\tnumber /= 10\r\n\t\tend\r\n\t\t# Add sum to answer if sum is equal to number\r\n\t\tanswer += sum if sum == x\r\n\tend\r\n\tputs answer\r\nend",
"def SD(n)\n\tt = 0\n\tfor d in n.to_s.chars.to_a\n\t\tt += d.to_i**2\n\tend\n\treturn t\nend",
"def count_bits(n)\r\n n.to_s(2).count \"1\"\r\nend",
"def sumDigits(number)\n sol = 0\n number.abs.to_s.each_char do |x|\n sol += x.to_i\n end\n print sol\n\nend",
"def sum(num)\n digits = num.to_s.chars.map(&:to_i) # Get an array of ints\n digits.reduce(:+) # Return sum of digits\nend",
"def problem16(number, power)\n x = number**power\n x = x.to_s.split(\"\")\n answer = 0\n x.length.times do |i|\n answer += x[i].to_i\n end\n return answer\nend",
"def numsum(n)\n result = 0\n while n >= 1\n digit = (n % 10).floor\n result += digit\n (n /= 10).floor\n end\n puts result\nend",
"def square_digits(num)\n\n number = num.to_s.split(\"\")\n\n number.map do |n|\n n.to_i**2\n end.join.to_i\n\nend",
"def f(n)\n\tsum = 0\n\tn.to_s.each_char do |c|\n\t\tsum += c.to_i ** 5\n\tend\n\treturn sum == n\nend",
"def sumDigits(number)\n number.to_s.chars.map(&:to_i).reduce\nend",
"def digits_sum(n)\n n.to_s.split('').inject(0){|a,b|a+=b.to_i}\nend",
"def value_of(digits, in_base:)\n number = 0\n\n digits.to_s.chars.each do |digit|\n number = in_base * number + CHARS.index(digit)\n end\n\n number\n end",
"def count_bits(n)\n a = n.to_s(2).count '1'\n p \"answer for count_bits of #{n} is #{a}\"\nend",
"def count_bits(n)\n n.to_s(2).count \"1\"\nend",
"def power_sumDigTerm(n)\n (2..200).each_with_object([]) do |base, sequence_array|\n 2.upto(30) do |power|\n sequence_array << base ** power if (base ** power).digits.sum == base\n end\n end.sort[n - 1]\nend",
"def base2to10(str_num)\n str = str_num.dup.reverse\n total = 0\n\n str.each_char.with_index do |char, idx|\n total += (char.to_i * (2 ** idx))\n end\n total\nend",
"def prod_digits(s)\n prod = 1\n s.each_char { |c| prod *= c.to_i }\n prod\nend",
"def count_bits(n)\n n.to_s(2).count('1')\nend",
"def count_bits(n)\n n.to_s(2).count('1')\nend",
"def sum(integer)\n integer.digits.reduce(:+)\nend",
"def count_bits(n)\nn = n.to_s(2)\nn = n.split(\"\")\nn = n.map{|x| x.to_i}\nn.inject(:+)\nend",
"def run\n puts sum_of_primes_below(10)\n #=> 17\n\n puts sum_of_primes_below(2_000_000)\n #=> ??\nend",
"def digits_sum\n self.split('').map {|x| x.to_i}.inject(0) do |res,elt|\n res += elt\n res\n end\n end",
"def decimal(digits, base)\n e = digits.size - 1\n v = 0\n digits.each do |n|\n v += n.to_i * base**e\n e -= 1\n end\n v\n end",
"def product_digits\n self.split('').inject(1) { |memo, c| memo * c.to_i }\n end",
"def sum_of_digit_squares(number)\n\tdigits = number.to_s.split(//)\n\tsum = 0\n\tdigits.each do |digit|\n\t\tsum += (digit.to_i)**2\n\tend\n\tsum\nend",
"def inmj\n result = 0\n (1..9).each do |base|\n exponent = 1\n while (intGetLengthInt(base ** exponent) == exponent)\n result += 1\n exponent += 1\n end\n end\n result\nend",
"def count_bits(n)\n n.to_s(2).count(\"1\")\nend",
"def sum(num)\n num.to_s.chars.map(&:to_i).sum\nend",
"def square_digits(num)\n # arr = num.to_s.chars.map do |char|\n # int = char.to_i\n # int = int ** 2\n # int.to_s\n # end\n # arr.join.to_i\n\n num.to_s.chars.map { |char| (char.to_i ** 2).to_s }.join.to_i\nend",
"def sum_digits(integer)\n arr = integer.to_s.chars.map { |num| num.to_i }\n arr.reduce(:+)\nend",
"def sumDigits(number)\n number.to_s.chars.map(&:to_i).reduce { |accum, n| accum.abs + n.abs }\nend"
] | [
"0.7641358",
"0.7380501",
"0.71218634",
"0.7095613",
"0.6878825",
"0.67998147",
"0.6773035",
"0.676628",
"0.67499423",
"0.66921014",
"0.6579649",
"0.6563784",
"0.65574837",
"0.65153456",
"0.65046656",
"0.6448706",
"0.64434296",
"0.6443126",
"0.64426327",
"0.643573",
"0.64287645",
"0.6414844",
"0.64089817",
"0.6401876",
"0.6389297",
"0.6363325",
"0.6362664",
"0.63626504",
"0.635872",
"0.6345258",
"0.63432205",
"0.6330042",
"0.63199973",
"0.63182044",
"0.63098264",
"0.63035",
"0.62757707",
"0.62713957",
"0.6238635",
"0.62059736",
"0.6204394",
"0.619822",
"0.61941004",
"0.61927074",
"0.61788714",
"0.61779594",
"0.61744076",
"0.61686265",
"0.6161231",
"0.6159958",
"0.61561495",
"0.61561495",
"0.61558896",
"0.6153259",
"0.6144066",
"0.61362",
"0.61320037",
"0.61320037",
"0.61320037",
"0.61320037",
"0.61266375",
"0.6122894",
"0.6114877",
"0.61147517",
"0.6107348",
"0.6102654",
"0.60990185",
"0.609783",
"0.609481",
"0.6088793",
"0.6083659",
"0.60831505",
"0.6070296",
"0.60683304",
"0.606507",
"0.60587275",
"0.6050743",
"0.6049198",
"0.60478944",
"0.60477364",
"0.6043611",
"0.6043387",
"0.6039483",
"0.60363936",
"0.60193187",
"0.60168475",
"0.6010694",
"0.6010694",
"0.60032654",
"0.6002773",
"0.60002494",
"0.59994614",
"0.5994726",
"0.59910214",
"0.5981011",
"0.59781563",
"0.59761995",
"0.59760433",
"0.5975649",
"0.59708256",
"0.59661627"
] | 0.0 | -1 |
end of method iattr_accessor | def cattr_reader(*syms)
syms.flatten.each do |sym|
next if sym.is_a?(Hash)
class_eval(<<-EOS, __FILE__, __LINE__)
unless defined? @@#{sym}
@@#{sym} = nil
end
def self.#{sym}
@@#{sym}
end
def #{sym}
@@#{sym}
end
EOS
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def define_attr_accessor(attr)\n attr_accessor(attr)\n end",
"def attr; end",
"def internal_attr_accessor(*syms)\n internal_attr_reader(*syms)\n internal_attr_writer(*syms)\n end",
"def attr_accessor(*args)\n attr_reader(*args)\n attr_writer(*args)\n end",
"def attr_accessor(sym, *more) end",
"def attr_internal_accessor(*attrs)\n attr_internal_reader(*attrs)\n attr_internal_writer(*attrs)\n end",
"def attr_internal_accessor(*attrs)\n attr_internal_reader(*attrs)\n attr_internal_writer(*attrs)\n end",
"def attr_internal_accessor(*attrs)\n attr_internal_reader(*attrs)\n attr_internal_writer(*attrs)\n end",
"def attribute; end",
"def attribute; end",
"def attribute; end",
"def attribute; end",
"def attribute; end",
"def attribute; end",
"def attribute; end",
"def attr_info; end",
"def bits_attr_accessor name\n class_eval \"def #{name}; self.attributes[#{name.inspect}]; end;\", __FILE__, __LINE__\n class_eval \"def #{name}=(val); self.attributes[#{name.inspect}]=val; end;\", __FILE__, __LINE__\n end",
"def attr_reader(*)\n end",
"def mattr_accessor(*syms)\n mattr_reader(*syms) + mattr_writer(*syms)\n end",
"def attr_accessor(*fields)\n attr_reader *fields\n attr_writer *fields\n end",
"def attr(name); end",
"def attr_writer(sym, *more) end",
"def attr_accessor(name)\n attr_reader(name)\n attr_writer(name)\n nil\n end",
"def attr_accessor_sybling(method)\n attr_reader?(method) ? to_attr_writer(method) : to_attr_reader(method)\n end",
"def cattr_accessor(*syms)\n cattr_reader(*syms) + cattr_writer(*syms)\n end",
"def attribute=(_arg0); end",
"def attribute=(_arg0); end",
"def initialize\n @attribute = 'truite'\n @accessor = 'pouet'\n end",
"def vcattr_accessor(*syms) # :nodoc:\r\n vcattr_reader *syms\r\n vcattr_writer *syms\r\n end",
"def cattr_accessor(*syms)\n cattr_reader(*syms)\n cattr_writer(*syms)\n end",
"def accessor\n @@accessor ||= nil\n @@accessor\n end",
"def class_attributes; end",
"def cattr_accessor(*fields)\n metaclass.send :attr_accessor, *fields\n end",
"def attr_reader(sym, *more) end",
"def dsl_accessor( attrname )\n\t\t\tdefine_method( attrname ) do |arg=nil|\n\t\t\t\tinstance_variable_set( \"@#{attrname}\", arg ) unless arg.nil?\n\t\t\t\treturn instance_variable_get( \"@#{attrname}\" )\n\t\t\tend\n\t\tend",
"def attr(symbol, writable=false) end",
"def instance_attributes; end",
"def attribute(name); end",
"def onetime_attr_accessor(_name)\n attr_reader(_name)\n onetime_attr_writer(_name)\n end",
"def attributes; end",
"def attributes; end",
"def attributes; end",
"def attributes; end",
"def attributes; end",
"def attributes; end",
"def attributes; end",
"def attributes; end",
"def attributes; end",
"def attributes; end",
"def attributes; end",
"def attributes(*args)\n attr_accessor(*args)\n end",
"def attributes=(_arg0); end",
"def attribute_accessor?\n false\n end",
"def serializable_attr_accessor(*syms)\n attr_accessor(*syms)\n attribute_keys.push(*syms)\n end",
"def metaattr_accessor(*meths)\n metaclass.instance_eval{attr_accessor(*meths)}\n end",
"def setup_object_attributes; end",
"def attribute_name=(_arg0); end",
"def attribute_name=(_arg0); end",
"def attribute_name=(_arg0); end",
"def get_attribute(name); end",
"def get_attribute(name); end",
"def accessor(*args)\n attr_accessor(*args)\n args\n end",
"def create_accessors(attribute_name)\n class_eval do\n define_method(attribute_name) do\n odata_entity[property_map[attribute_name]]\n end\n\n define_method(\"#{attribute_name}=\") do |value|\n # unless entity[property_map[attribute_name]] == value\n # send(\"#{attribute_name}_will_change!\") if defined?(::ActiveModel)\n # end\n\n odata_entity[property_map[attribute_name]] = value\n end\n end\n\n nil\n end",
"def add_attr_accessors_to_self\n instance_variables.each do |name|\n method_name = name[1..-1].to_sym\n MetricFu::Configuration.send(:attr_accessor, method_name)\n end\n end",
"def attr_class_accessor(*args)\n\t\targs.each{|arg|\n\t\t\tclass_eval %(\n\t\t\t\tdef #{arg}; self.class.#{arg}; end\n\t\t\t\tdef #{arg}=(v); self.class.#{arg} = v; end\n\t\t\t)\n\t\t}\n\tend",
"def delegate_object_reader_method; end",
"def my_attr_accessor(*attributes)\n attributes.each do |attribute|\n # for each attribute, use String interpolation\n # to generate the methods, and set attr_methods\n # equal to the generated string\n attr_methods = %Q{\n def #{attribute}\n @#{attribute}\n end\n def #{attribute}=(val)\n @#{attribute} = val\n end\n }\n # call class_eval and pass in attr_methods\n class_eval(attr_methods)\n end\n end",
"def define_accessors\n self.metadata.properties_and_identity.each do |name, _|\n self.model.send :attr_accessor, name.downcase\n end\n end",
"def attributes\n end",
"def attribute_to_set; end",
"def method_missing(meth, *args, &blk)\n match = meth.to_s.match(/^([a-zA-Z\\_]+)(=|$)$/)\n if match\n attribute, setter = match[1], !match[2].blank?\n if setter\n write_attribute(attribute, args.first)\n else\n read_attribute(attribute)\n end\n else\n super(meth, *args, &blk)\n end\n end",
"def define_attributes\n @info.attributes.each do |attr|\n rname = underscore(attr.name)\n self.class.__send__(:define_method, rname) { self[attr.name] } if attr.readable?\n self.class.__send__(:define_method, rname + \"=\") {|v| self[attr.name] = v } if attr.writable?\n end\n end",
"def cattr_accessor(sym)\n cattr_reader(sym)\n cattr_writer(sym)\n end",
"def parse_attr_accessor(context, single, tk, comment)\n line_no = tk[:line_no]\n\n args = parse_symbol_arg\n rw = \"?\"\n\n tmp = RDoc::CodeObject.new\n read_documentation_modifiers tmp, RDoc::ATTR_MODIFIERS\n # TODO In most other places we let the context keep track of document_self\n # and add found items appropriately but here we do not. I'm not sure why.\n return if @track_visibility and not tmp.document_self\n\n case tk[:text]\n when \"attr_reader\" then rw = \"R\"\n when \"attr_writer\" then rw = \"W\"\n when \"attr_accessor\" then rw = \"RW\"\n else\n rw = '?'\n end\n\n for name in args\n att = create_attr context, single, name, rw, comment\n att.line = line_no\n end\n end",
"def define_accessor\n klass.class_eval <<-ACCESSOR\n def #{@relation}\n #self.dataset.left_outer_join(#{@relation}, :id => :#{klass.primary_key_string}).limit(1)\n puts #{relation_class}\n end\n \n def #{@relation}=(value)\n end\n ACCESSOR\n end",
"def attr_accessor( * )\n fail \"Remember, an Entity is immutable. Use a Services::Service to mutate the underlying data.\"\n end",
"def getters; end",
"def install_attr(attr)\n #Add reader/writer\n inner = code_attr(attr)\n estr = \"class Qml::#{@class}\\n #{inner}\\n end\"\n eval(estr, nil, attr.file, attr.line)\n @cache_load << [:accessor, @class, inner]\n\n name = attr[2]\n\n if(!Special.include? name)\n @init += \"Qml::prop_add(self, #{name.inspect})\\n\"\n end\n end",
"def _read_attribute(key); end",
"def key_attr_reader(key)\n define_method key do\n self[key]\n end\n end",
"def ext_attr\n attribute_prop(10)\n end",
"def content_attr_accessor(*attribute_array)\n attribute_array.each do |att|\n define_method(att) do\n content.send(att)\n end\n define_method(\"#{att}=\") do |val|\n content.send(\"#{att}=\",val)\n end\n end\n end",
"def set_objects_to_acessor\n if [email protected]?\n @sequence.each { |ele|\n self.class.__send__(:attr_accessor, ele.downcase)\n }\n end\n\nend",
"def assert_attr_accessor(obj, method)\n assert_attr_reader obj, method\n assert_attr_writer obj, method\nend",
"def set_attribute(name, value); end",
"def attribute_name; end",
"def attribute_name; end",
"def attribute_name; end",
"def attribute_name; end",
"def attribute_name; end",
"def attribute_name; end",
"def attribute_name; end",
"def class_attr_accessor(class_variable_name)\n self.class.send(:attr_accessor, class_variable_name)\nend",
"def update_attrs(hashit)\n hashit.instance_variables.each do |name|\n singleton_class.class_eval {attr_accessor \"#{name[1..-1]}\"} #remove leading @ from varname\n send(\"#{name[1..-1]}=\", hashit.instance_variable_get(name))\n end\n end",
"def attrs\n self.class.attrs\n end",
"def attr_writer(*fields)\n check_fields(fields)\n added_fields = jiak.data.writable(*fields)\n added_fields.each do |field|\n class_eval <<-EOM\n def #{field}=(val)\n @jiak.object.data.#{field} = val\n self.class.do_auto_update(self)\n end\n EOM\n end\n nil\n end",
"def attr_reader(*vars)\n super *(add_tracked_attrs(true, false, *vars))\n end",
"def is_attribute?; end",
"def set_attributes_to_reader\n if [email protected]?\n @attributes.each { |ele|\n self.class.__send__(:attr_reader, ele.downcase)\n }\n end\n\nend",
"def attr_accessor_typesafe(*classes_args)\n classes_args.each_with_index do |attr_name, i|\n next if i%2 == 0\n\n class_name = classes_args[i-1].name\n attr_name = attr_name.to_s\n\n #getter\n self.class_eval %Q{\n def #{attr_name}\n fail \"variable <#{attr_name}> accessed without being initialized\" unless defined? @#{attr_name}\n @#{attr_name}\n end\n }\n\n #setter\n self.class_eval %Q{\n def #{attr_name}=(val)\n assert_kind_of(#{class_name}, val) if val != nil\n\n # set the value itself\n @#{attr_name}=val\n end\n }\n end\n end",
"def accessors\n self.class.accessors\n end"
] | [
"0.7890997",
"0.7890375",
"0.75989985",
"0.7497774",
"0.7450574",
"0.74476784",
"0.74476784",
"0.74476784",
"0.7394971",
"0.7394971",
"0.7394971",
"0.7394971",
"0.7394971",
"0.7394971",
"0.7394971",
"0.7378075",
"0.7264349",
"0.7238084",
"0.720851",
"0.72070783",
"0.72030103",
"0.71288806",
"0.71058196",
"0.7067587",
"0.7038489",
"0.70270115",
"0.70270115",
"0.6976431",
"0.6975568",
"0.693901",
"0.6924346",
"0.69142056",
"0.691276",
"0.69123113",
"0.6868",
"0.6856654",
"0.6828538",
"0.6828368",
"0.68233854",
"0.68209904",
"0.68209904",
"0.68209904",
"0.68209904",
"0.68209904",
"0.68209904",
"0.68209904",
"0.68209904",
"0.68209904",
"0.68209904",
"0.68209904",
"0.68183434",
"0.68061054",
"0.6791708",
"0.6769173",
"0.6765598",
"0.6603142",
"0.660009",
"0.660009",
"0.660009",
"0.6586219",
"0.6586219",
"0.6573976",
"0.65712696",
"0.65467125",
"0.6541614",
"0.6532278",
"0.65239173",
"0.65152264",
"0.64965606",
"0.6495388",
"0.64931566",
"0.64765203",
"0.6463091",
"0.64562833",
"0.64241946",
"0.6416106",
"0.6414281",
"0.64114517",
"0.63636297",
"0.63523406",
"0.63509154",
"0.63459265",
"0.6345206",
"0.6328683",
"0.6327478",
"0.6310695",
"0.6310695",
"0.6310695",
"0.6310695",
"0.6310695",
"0.6310695",
"0.6310695",
"0.6302964",
"0.6296684",
"0.6289671",
"0.62827265",
"0.6279917",
"0.62746614",
"0.62557924",
"0.6247274",
"0.6247225"
] | 0.0 | -1 |
retrieve the categories for the user_info partial | def get_category_count
if(params[:id])
@user = User.find(params[:id].downcase)
@all_projects = @user.projects.order("updated_at DESC")
@arts_and_crafts_count = 0
@clothing_count = 0
@cooking_count = 0
@electronics_count = 0
@mechanical_count = 0
@other_count = 0
arts_and_crafts_category = Category.where(:name => "Arts & Crafts").first
clothing_category = Category.where(:name => "Clothing").first
cooking_category = Category.where(:name => "Cooking").first
electronics_category = Category.where(:name => "Electronics").first
mechanical_category = Category.where(:name => "Mechanical").first
other_category = Category.where(:name => "Other").first
@all_projects.each do |project|
if project.categories.include?(arts_and_crafts_category)
@arts_and_crafts_count += 1
end
if project.categories.include?(clothing_category)
@clothing_count += 1
end
if project.categories.include?(cooking_category)
@cooking_count += 1
end
if project.categories.include?(electronics_category)
@electronics_count += 1
end
if project.categories.include?(mechanical_category)
@mechanical_count += 1
end
if project.categories.include?(other_category)
@other_count += 1
end
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @categories = current_user.categories\n end",
"def profileinfo(user_id)\n categories = db.execute(\"SELECT category FROM categories\")\n arr = []\n categories.each do |category|\n arr << category[\"category\"]\n end\n return [db.execute(\"SELECT * FROM users WHERE user_id=?\", user_id), db.execute(\"SELECT * FROM listings WHERE user_id=?\", user_id), db.execute(\"SELECT * FROM listing_cate_rel\"), arr]\nend",
"def get_account_category_info\n if !session[:current_user_id].nil?\n user_id = session[:current_user_id]\n @account_names = AccountsHelper.get_account_names user_id\n @category_names = CategoriesHelper.get_category_names(user_id, session[:account_name])\n end\n end",
"def user_available_categories\n Category.select('name').\n where(\"user_id = ?\", current_user.id).\n pluck(:name)\n end",
"def categories\n # @categories = Category.get_categories(@user.id)\n #@categories =Category.all.select(:id).select(:name).select(:description).select(:logo_url)\n @categories =Category.all\n user_cat= @user.categories.collect(&:id)\n categories = []\n @categories.each do |cat|\n cat_attr = cat.attributes\n user_cat.include?(cat.id) ? cat_attr.merge!('user_category' => true) : cat_attr.merge!('user_category' => false)\n categories << cat_attr\n end\n @categories = categories\n\n respond_to do |format|\n if @categories.blank?\n format.json {render json:{:success => false, :status_code => 404, :message => \"No category found\"}}\n format.xml {render xml:{:success => false, :status_code => 404, :message => \"No category found\"}}\n format.html {render json: {:success => false, :status_code => 404, :message => \"No category found\"}}\n else\n format.html {render json: {:success => true, :status_code => 200, :categories => @categories}}\n format.json {render json: {:success => true, :status_code => 200, :categories => @categories}}\n format.xml {render xml: {:success => true, :status_code => 200, :categories => @categories}}\n end\n end\n end",
"def index\n ##########\n @category = current_user.category\n end",
"def getinfo(user_id)\n info = []\n info << db.execute(\"SELECT * FROM users WHERE user_id=?\", user_id)[0]\n info << db.execute(\"SELECT name, avatar, listings.* FROM users INNER JOIN listings ON users.user_id = listings.user_id\")\n info << db.execute(\"SELECT category FROM categories\")\n info << db.execute(\"SELECT * FROM listing_cate_rel\")\n categories = db.execute(\"SELECT category FROM categories\")\n arr = []\n categories.each do |category|\n arr << category[\"category\"]\n end\n info << arr\n return info\nend",
"def user\n result = contact_categories.first(:conditions => {:category_type => User.to_s})\n result ? result.category : nil\n end",
"def index\n @categories = Category.where(user_id: current_user.id)\n end",
"def show\n @categories = Category.all\n @users = User.all\n end",
"def categories\n expose Metadata.categories(@oauth_token)\n end",
"def index\n @categories = Category.includes(:user).all\n end",
"def fresh_categories\n # these are the categories that will be displayed by default\n # in the html view\n return {\n \"speakerData\" => {\"label\" => \"Character Direct Speech\", \"data\" => []},\n \"indirectData\" => {\"label\" => \"Character Indirect Diction\", \"data\" => []},\n \"traitData\" => {\"label\" => \"Trait: Character Type\", \"data\" => []}, \n \"genderData\" => {\"label\" => \"Trait: Character Sex\", \"data\" => []},\n \"maritalStateData\" => {\"label\" => \"Trait: Character Marriage Status\", \"data\" => []},\n \"socecStatusData\" => {\"label\" => \"Trait: Character Class Status\", \"data\" => []},\n \"ageData\" => {\"label\" => \"Trait: Character Age\", \"data\" => []},\n \"occupationData\" => {\"label\" => \"Trait: Character Occupation\", \"data\" => []},\n }\nend",
"def categories\n category\n end",
"def category\n\n User.find(@toko.user_id).produks.each do |produk|\n @cat = produk.category_id\n end\n end",
"def getCategories(_, _, _)\n @db.categories\n end",
"def categories\n parsed_json['data']\n end",
"def categories\n # {{{\n if !@categories then\n inherited_cats = []\n if respond_to?(:parent_groups) then\n inherited_cats = parent_groups.map { |g| g.categories }.flatten\n end\n own_cats = User_Category.all_with(User_Category.user_group_id == user_group_id).sort_by(:category_name, :asc)\n @categories = inherited_cats + own_cats.to_a\n end\n @categories\n end",
"def categories(query_object)\n\t\tdata = do_get_json(CATEGORIES_ENDPOINT, query_object)\n\tend",
"def kata_user_categories\n kataUserCategories = []\n survived_reviews.each do |review|\n review.category_ids.each {|category_id| kataUserCategories << category_id}\n end\n kataUserCategories.uniq\n end",
"def categories\n return @categories\n end",
"def categories\n return @categories\n end",
"def categories\n return @categories\n end",
"def category_users\n images.collect{|e| e.user}\n end",
"def index\n @categories = current_user.categories.filter_conditions(params[:name])\n end",
"def index\n # @categories = current_user.categories\n @categories = Category.accessible_by(current_ability).all\n end",
"def list\n @categories = current_user.categories.where locked: false\n end",
"def category_index\n @name = params[:category]\n \n category = Category.where(name: @name)\n \n #get bookmarks\n if category.empty? || category == nil\n redirect_to :root\n else\n category = category[0]\n @results = []\n\n category.bookmarks.each do |b|\n user_url = \"/\" + b.user.name\n entry = {id: b.id, url: b.url, title: b.title, user: b.user, name: b.user.name, user_url: user_url }\n @results.push(entry) \n end\n end\n \n #check to see if user is a subscriber\n if user_signed_in? && category.subscriber?(current_user)\n @is_subscriber = true\n else\n @is_subscriber = false\n end\n\n #check to see if user is moderator\n if user_signed_in? && category.moderator?(current_user)\n @is_moderator = true\n end\n \n end",
"def populate_category\n\t\t\t\tif params[:purpose] == \"category\"\n\t\t\t\t\t\tcategory = Category.find(params[:category_id])\n\t\t\t\t\t\t@sub_categories = category.sub_categories\n\t\t\t\telsif params[:purpose] == \"sub_category\"\n\t\t\t\t\t\tsub_category = SubCategory.find(params[:category_id])\n\t\t\t\t\t\t@inner_categories = sub_category.inner_categories\n\t\t\t\tend\n\t\tend",
"def index\n @user_keywords = @login_user.user_keywords.includes(:keyword).group_by{|u_k| u_k.keyword.category}\n end",
"def users\n category_users.uniq\n end",
"def categories\n get('venues/categories').categories\n end",
"def index\n @author_widget_categories = WidgetCategory.fetch_data(current_user).includes(:author_widgets)\n end",
"def index\n @menu = Menu.all \n @selected_categories = Allergen.where('user_id = ?',current_user).pluck(:category)\n render 'menus/index'\n end",
"def readable_categories\n # {{{\n if !@readable_categories then\n parent_group_ids = []\n if respond_to?(:parent_groups) then\n parent_group_ids = parent_groups.map { |g| g.user_group_id }\n end\n if is_registered? then\n @readable_categories = Category.select { |c| \n c.where((Category.public_readable == 't') | \n (Category.registered_readable == 't') | \n (Category.category_id.in(User_Category.select(User_Category.category_id) { |ucid|\n ucid.where((User_Category.user_group_id.in(parent_group_ids + [ user_group_id ])) &\n (User_Category.read_permission == 't'))\n })\n ))\n c.order_by(:category_name, :asc)\n }.to_a\n else\n @readable_categories = Category.select { |c| \n c.where((Category.public_readable == 't') |\n (Category.category_id.in(User_Category.select(User_Category.category_id) { |ucid|\n ucid.where((User_Category.user_group_id.in(parent_group_ids + [ user_group_id ])) &\n (User_Category.read_permission == 't'))\n })\n ))\n c.order_by(:category_name, :asc)\n }.to_a\n end\n end\n @readable_categories\n end",
"def categories\n return @categories\n end",
"def category\n # {{{\n if !@category then\n @category = Category.find(1).with(:is_private.is('t') & \n :category_id.in(User_Category.select(User_Category.category_id) { |cid| \n cid.where(User_Category.user_group_id == user_group_id)\n })).entity\n @category = Category.unassigned_category unless @category\n end\n @category\n end",
"def tags_and_categories_list\n list = []\n target_div = self.div(:class=>\"s3d-contentpage-title\", :text=>\"Basic Information\").parent.parent.div(:id=>\"displayprofilesection_body\")\n target_div.links.each { |link| list << link.text }\n return list\n end",
"def index\n @categories = Category.where(user_id: current_user.id).order(:order)\n end",
"def user_content(user, options = {})\n options = options.clone\n username = user\n\n path = \"user/#{username}/%s.json\" % (options[:category] if options[:category])\n options.delete :category\n\n objects_from_response(:get, path, options)\n end",
"def categories_list\n self.categories.collect{|c| c.name}\n end",
"def populate_items\n items = {}\n Game::current.crowd_members['category'].keys.each do |crowd_member|\n items[\"crowd_members.category.\"+crowd_member] = crowd_member.humanize\n end\n items\n end",
"def index\n @resources = @user.resources\n @matches = find_matches @user # defined below\n @like_requests = find_like_requests @user # defined below\n\n existing_categories = [] # populates the carousel dropdown with resource to be searched for\n\n if @user.wants_bike == true\n existing_categories << \"bike\"\n end\n\n if @user.wants_vehicle == true\n existing_categories << \"vehicle\"\n end\n\n if @user.wants_social == true\n existing_categories << \"social\"\n end\n\n if @user.wants_pet == true\n existing_categories << \"pet\"\n end\n\n if @user.wants_housing == true\n existing_categories << \"housing\"\n end\n\n @avail_resources = existing_categories # instance variable to be used in view\n end",
"def category\n data['category']\n end",
"def categories\n raw_categories.to_hashugar\n end",
"def all_categories\n end",
"def index\n\t\tcreator_categories\n\tend",
"def index\n @message_categories = current_user.message_categories\n end",
"def index\n @categories = collections_config.values\n end",
"def get_categories()\n\t\tzomoato_categories_url = @base_uri + \"categories\"\n\t\tresponse = HTTParty.get(zomoato_categories_url, headers: @headers)\n\t\tif response.success?\n\t\t\t@categories = response.parsed_response\n\t\telse\n\t\t\traise response.response\n\t\tend\n\t\treturn @categories\n\tend",
"def get_categories(row)\n categories = []\n cat = at_in(:category1 , row) # should invent some loop here\n categories << cat if cat\n cat = at_in(:category2 , row) # but we only support\n categories << cat if cat\n cat = at_in(:category3 , row) # three levels, so there you go\n categories << cat if cat\n categories\n end",
"def get_categories(query_obj=nil)\n uri = URI.parse(@uri + \"/Categories\")\n results = get(uri,query_obj)\n end",
"def get_categories\n @categories = Category.all\n end",
"def index\n @user_place_categories = UserPlaceCategory.all\n end",
"def categories\n []\n end",
"def categories\n\t\trender :json => {:status => 1, :categories => {\"1\" => \"Apparel & Accessories\", \"2\" => \"Arts and Crafts\", \"3\" => \"Electronics\", \n\t\t\t\"4\" => \"Home Appliances\", \"5\" => \"Kids & Baby\", \"6\" => \"Movies, Music, Books & Games\", \"7\" => \"Motor Vehicles\", \n\t\t\t\"8\" => \"Office & Education\", \"9\" => \"Parties & Events\", \"10\" => \"Spaces & Venues\", \"11\" => \"Sports & Outdoors\", \"12\" => \"Tools & Gardening\", \"13\" => \"Other\"}}, :status => 200\n\t\treturn\n\tend",
"def show\n @title = \"Photos uploaded by \" + @user.username\n @title_cat = \"Cats belonging to \" + @user.username\n # for partial generic views\n @photos = @user.photos\n @cats = @user.cats\n end",
"def index\n @category_of_playlists_channels = current_user_category_of_playlists\n end",
"def auto_complete_for_category_name_with_security\n Category.with_user_scope(current_user) do\n auto_complete_for_category_name_without_security\n end\n end",
"def categories\n rpg_shop.handled_categories\n end",
"def categories\n return [] if @categories.blank?\n @categories.records.map {|c| c.display_name}\n end",
"def collectors\n data = User.\n all.\n order(:name).\n map{|u| {id: u.id, name: u.name}}\n\n render_ok users: data\n end",
"def index\n @classifieds = Classified.where.not(user_id: current_user).paginate(:page => params[:page])\n @categories = Category.all\n \n end",
"def index\n @q = user_detail_categories.ransack(params[:q])\n @detail_categories = @q.result.sorted.page(params[:page])\n end",
"def category\n @data['category']\n end",
"def categories\n Hash[self.class.catalogs.map { |fld, klass|\n name = fld.gsub(/_id$/, '_name');\n [fld, {:id => self.send(fld), :name => self.send(name)}] rescue nil\n }.reject {|cat| cat.nil?}]\n end",
"def categories\n\t\t\t@cat_cache ||= @db.js('musicthoughts.all_categories()').map {|c| c.merge(category: c[@lang]) }\n\t\t\t@cat_cache\n\t\tend",
"def show\n @category = current_user.user_categories.find(params[:id]) \n @search = @category.activities.search(params[:q])\n @activities = @search.result.page params[:page]\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @category }\n end\n end",
"def get_user_collections()\n uri = build_uri('info/collections')\n @tools.process_get_request(uri, @user_obj.encrypted_login, @user_pwd).body\n end",
"def meal_categories\n # API EXAMPLE: https://www.themealdb.com/api/json/v1/1/list.php?c=list\n content = api_call('list.php?c=list')\n validate(content)\n content\n end",
"def get_categories_list\n args = receive_should_validate?\n get('redtube.Categories.getCategoriesList', {}, [], args[:should_validate])\n end",
"def show\n @user = current_user\n respond_to do |format|\n if @user.categories.exists?(params[:id])\n @category = @user.categories.find(params[:id])\n format.html\n format.json { render :json => @category }\n else\n format.html { redirect_to user_path(current_user), :notice => \"No such category exists\" }\n format.json { head :not_found, :status => :not_found }\n end\n end\n end",
"def index\n @categories = Category.order(\"name ASC\")\n @user_preferences = nil\n # Returns User Preferences\n @preferences = Preference.all\n @current_user_pref = params[\"user_id_pref\"].to_i #Params brings the current user's id from the link_to on the navbar\n @preferences.each do |pref|\n if pref.user_id == @current_user_pref #Filters only rows that belong to that ID.\n @user_preferences = pref\n return\n end\n end\n end",
"def get(username, password, ids)\n # TODO: Flesh this out\n Category.find(ids).map do |category|\n WebServiceStructs::CategoryStruct.new(\n :id => category.id,\n :parent_id => category.parent_id,\n :name => category.name,\n :description => category.description,\n :user_id => category.user_id,\n :public => category.public,\n :permanent => category.permanent\n )\n end\n end",
"def show\n @activity = Activity.find(params[:id])\n @profile = current_user.profile\n @categories = Category.all\n end",
"def category_info\n {\n categories: self.object.appointments.map{ |appt| \n appt.category\n }\n \n }\n end",
"def list_categories(variable)\n if !variable.categories.empty?\n cat_list = \"\"\n variable.categories.split(',').each{|cat| cat_list << content_tag(:li, cat.capitalize, :class => cat.downcase)}\n content_tag(:ul, cat_list, :class => \"categories\")\n else\n content_tag(:span, \"None\")\n end\n end",
"def categories\n response[\"categories\"].map!{|category| Foursquared::Response::Category.new(client, category)} if response[\"categories\"]\n end",
"def categories_list\n @categories = Category.all.collect { |p| [p.name, p.id] }\n end",
"def get_categories\n cats = []\n params.each do |k,v|\n if k.starts_with? \"category\"\n name = v\n num = cat_number(k) \n cats << [name,num]\n end\n end\n return cats\n end",
"def get_category_info\n category = self.category_id\n return Category.find_by_id(category)\n end",
"def list_products_categories\n @company = Company.find(params[:company_id])\n @pagetitle = \"#{@company.name} - Product categories\"\n \n if(@company.can_view(current_user))\n @products_categories = ProductsCategory.where(company_id: @company.id).paginate(:page => params[:page])\n else\n errPerms()\n end\n end",
"def index\n @user = User.find(params[:user_id])\n @note_categories = @user.note_categories.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @note_categories }\n end\n end",
"def get_category_list\n ret_hash = Rails.cache.fetch(\"zaim_api/category\", expired_in: 1.day) do\n json_categories = self.zaim_api.category\n tmp_ret_hash = {}\n json_categories['categories'].each do |value|\n tmp_ret_hash[value['id']] = value['name']\n end\n tmp_ret_hash\n end\n ret_hash\n end",
"def categories\n\t\tbegin\n\t\t\t@categories = Category.select(:id, :name)\n\t\t\trender json: @categories\n\t\trescue Exception => e\n\t\t\terror_handling_bad_request(e)\n\t\tend\n\tend",
"def fetch_categories\r\n page = File.open(\"#{Rails.root}/public/Categories.html\") { |f| Nokogiri::HTML(f) }\r\n Category.save_fetched_categories_and_subcategories(page)\r\n end",
"def get_categories\n @cards.each do |card|\n if [email protected]?(card.category)\n @categories << card.category\n end\n end\n @categories\n end",
"def show\n if signed_in? && applied_class?\n @user_ids = ClclassesUser.where(:clclass_id=>params[:id])\n @users = Array.new\n @user_ids.each do |u|\n @users.push(User.find(u.user_id))\n end\n @lectures = Lecture.all :joins=>:clclass\n render 'clclass'\n return\n end\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clclass }\n end\n end",
"def index\n @partial = {\n name: 'categories'\n }\n @partial = partial_by_category unless @category.nil?\n @partial = partial_by_site_storage unless @json_data[:site_storage].nil?\n end",
"def show_categories(html_dsl)\r\n categories = Category.where(\"user_id = #{session[:user_id]} and category_id is null\").order('name ASC')\r\n category_html = create_category_table(categories)\r\n html_dsl.inject(category_html)\r\n end",
"def show_categories(html_dsl)\r\n categories = Category.where(\"user_id = #{session[:user_id]} and category_id is null\").order('name ASC')\r\n category_html = create_category_table(categories)\r\n html_dsl.inject(category_html)\r\n end",
"def categories_items_without(user)\n all_items = self.all_active_items\n categories_given_without(all_items,user)\n end",
"def doctors_and_cities\n cities_dict, doctor_dict = current_user.dictionaries.where(resource_type: [\"Doctors\", \"Cities\"])\n render json: {doctors: doctor_dict.words.select(:id, :body),\n cities: cities_dict.words.select(:id, :body)}\n end",
"def show_collections\n @user=User.find_by name: session[:user]\n @user_collections = CollectionUser.where('id_user LIKE ? ', \"#{@user.id}\")\n @collections = Array.new\n @user_collections.each do |collections|\n @collections.push(Collection.find(collections.id_collection))\n end\n\n end",
"def show\n @certification_users = []\n\n #TODO: make a better SQL query for this\n @certification.users.sort_by(&:name).each do |user|\n @certification_users.push user if can? :read, user\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @certification }\n end\n end",
"def show\n @categories = []\n if usr_contact_signed_in?\n @current_merchant = UsrContactVendor.find_by_usr_contact_id(current_usr_contact.id)\n else\n @current_merchant = FALSE\n end\n\n @vendor = UsrVendorProperty.find(params[:id])\n @items = @vendor.prd_items\n if [email protected]?\n @items.each do |item|\n type_id = item.prd_type_id\n unless type_id.empty?\n sub_category_id = PrdType.find(type_id).prd_sub_category_id\n category_id = PrdSubCategory.find( sub_category_id).prd_categories_id\n @categories << PrdCategory.find(category_id).name\n end\n end\n end\n\n end",
"def show\n @user = User.find(params[:id])\n @title = @user.name\n #este tiene solo el nombre de las competencias\n #@competences = @user.competences\n\n #este tiene el user_id competence_id level\n @competences = @user.user_competences\n \n \n end",
"def categories\n add_to_query restrict_kind: 'category'\n end",
"def category\n client.categories.find(data[\"categoryId\"])\n end",
"def categorised_by_column(record)\n record.categorised_by ? User.find(record.categorised_by).login : ' '\n end",
"def categories_items\n all_items = self.all_active_items\n categories_given_items(all_items)\n end"
] | [
"0.66995823",
"0.65575814",
"0.6525585",
"0.64731693",
"0.6375938",
"0.6370895",
"0.6326278",
"0.631424",
"0.6285089",
"0.62302125",
"0.6216325",
"0.6150744",
"0.61404485",
"0.6131284",
"0.6090818",
"0.608891",
"0.608531",
"0.6064446",
"0.6061637",
"0.60410655",
"0.602744",
"0.602744",
"0.602744",
"0.5994458",
"0.5988117",
"0.5933183",
"0.59313726",
"0.5890858",
"0.58826464",
"0.5855978",
"0.5850866",
"0.58341634",
"0.5810241",
"0.5805823",
"0.5800817",
"0.5782962",
"0.5779207",
"0.57692254",
"0.5762334",
"0.5761086",
"0.57456553",
"0.57435083",
"0.57419026",
"0.5733819",
"0.57324916",
"0.57286793",
"0.5726543",
"0.5715947",
"0.56850314",
"0.56709266",
"0.56698024",
"0.5666421",
"0.56651413",
"0.5664693",
"0.56561625",
"0.5648811",
"0.56446856",
"0.56390506",
"0.5638585",
"0.562735",
"0.56269014",
"0.56243074",
"0.5621706",
"0.5618185",
"0.56169546",
"0.5616714",
"0.55969507",
"0.5595848",
"0.55881757",
"0.5587579",
"0.5579838",
"0.5577061",
"0.5561059",
"0.5559976",
"0.5559553",
"0.5554077",
"0.5552172",
"0.55511725",
"0.5550861",
"0.55394745",
"0.5534652",
"0.5531777",
"0.55292094",
"0.5529148",
"0.5527101",
"0.55257237",
"0.5520074",
"0.5509572",
"0.5504491",
"0.5503141",
"0.5503141",
"0.54996496",
"0.54987746",
"0.54957134",
"0.5472482",
"0.5472135",
"0.5462735",
"0.54564595",
"0.5446053",
"0.5440082",
"0.54316276"
] | 0.0 | -1 |
validate uniqueness of email | def validate_email
email = params[:email]
# valid if username doesn't exist already
valid = !User.pluck(:email).include?(email)
respond_to do |format|
format.json {render :json => valid}
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_uniqueness_of_email\n if Person.exists?(:email=>self.email,:user_id => self.user_id)\n self.errors.add(:email, :taken)\n return false\n else\n return true\n end\n end",
"def unique_email\n\t\treturn if email.blank?\n\t\tif Email.where(email: email).count > 0\n\t\t\terrors.add(:email, 'has already been taken')\n\t\tend\n\tend",
"def unique_email_user\n if self.class.where(email: email).count > 0\n errors.add(:email, :taken)\n end\n end",
"def email_must_be_unique\n if ((Organization.where(['email = ? AND id <> ?', self.email, self.id]).count > 0) or\n (Volunteer.where(['email = ?', self.email]).count > 0))\n\n errors.add(:email, \"is already taken\")\n end\n end",
"def validates_email_uniqueness\n if validate_attributes == true\n if email and (Contact.find_by_email(email) or Lead.find(:first, :conditions => [\"email = ? and record_type_id = ?\",email,MOLTEN_REQUEST_RECORD_TYPE]))\n errors.add('email', \"A contact already exists with this email address.\")\n end\n end\n end",
"def validate_email_is_unique(email)\n return false unless email != nil\n return !User.email_exists?(email)\n end",
"def email_is_unique\n active_users = User.active.where(:email => self.email)\n active_users = active_users.exclude(self) unless self.new_record?\n errors.add :email, 'ya existe' if active_users.count(:id) > 0\n end",
"def validate\n if User.find_by_email(new_email)\n errors.add(:new_email, \"has already been taken\")\n end\n end",
"def validate_email\n if User.find_by(email: params[:email]).present?\n render_error :unprocessable_entity, I18n.t('common.messages.registrations.duplicate_email')\n else\n render_response\n end\n end",
"def duplicate_email?\n (errors.messages.size == 1) && errors.messages[:email].first =~ /taken/\n end",
"def duplicate_email\n\t\tif Student.find_by email: email or TeachingAssistant.find_by email: email\n\t\t\terrors.add(:email, \"has already been taken\")\n\t\tend\n\tend",
"def test_uniqueness_of_email\n person_repeat = Person.new(:email => @valid_person.email.upcase)\n assert !person_repeat.valid?\n assert_equal @error_messages[:taken], person_repeat.errors[:email][0], \"Test must be case sensitive.\"\n end",
"def email_uniqueness_required?\n email_changed? && (@bypass_postpone || new_record? || !Authentication.reserved_device_email?(email_was))\n end",
"def email_valid?\n if self.class.exists?(email: self.email)\n false\n else\n true\n end\n end",
"def email_validate\n if !normalized_email.include? '@'\n puts \"Invalid e-mail address entered #{normalized_email}\"\n else\n true\n end\n end",
"def validate_email\n if !self.email.match(/\\A#{ApplicationHelper.form_field_attr('email')[:regex]}\\Z/i)\n self.errors.add(:email, \"#{ApplicationHelper.form_field_attr('email')[:generic]}\")\n end\n end",
"def check_email_format\n if !(email =~ /\\A([^@\\s]+)@((?:[-a-z0-9]+\\.)+[a-z]{2,})\\z/i)\n errors.add(:email, 'Invalid email format')\n elsif email_changed? && Contact.exists?(email: email, user_id: user_id)\n errors.add(:email, 'Email is already added into your contacts')\n end\n end",
"def email_uniqueness\n @retval = Hash.new()\n unless params[:email].blank?\n @hmm_user = HmmUser.find(:first,:conditions=>{:v_e_mail=>params[:email]},:select=>'id')\n if(@hmm_user)\n @retval['message'] = \"email already exists\"\n @retval['status'] = false\n else\n @retval['message'] = 'email is available'\n @retval['status'] = true\n end\n else\n @retval['message'] = 'email is required'\n @retval['status'] = false\n end\n render :xml => @retval.to_xml({:root=>'response',:dasherize =>false})\n end",
"def check_email\r\n \temail = Referral.where(:email=>self.email, :referrer=>self.referrer)\r\n \t if email.present?\r\n\t \traise \"You are already registered..!!\"\r\n\t end\r\n end",
"def validate_email\n return if self.email.blank?\n errors.add(:email, :not_a_valid_email) if !Valid.email?(self.email)\n end",
"def valid_email\n unless self.email =~ /\\w+@\\w+\\.\\w{2,}/\n errors.add(:email, \"is not valid.\")\n end\n end",
"def check_if_email_already_registered\n user = User.using_client_shard(client: @client).where(client_id: @client_id, email: @email).first\n\n return error_with_data(\n 'um_su_2',\n 'Registration Error',\n '',\n GlobalConstant::ErrorAction.default,\n {},\n {email: 'Email address is already registered'}\n ) if user.present?\n\n success\n end",
"def validate_email(email)\n domain = email.split('@').last\n return unless sign_up_params[:email].end_with?('.ac.uk')\n return unless Institution.exists?(['email ILIKE ?', \"%#{domain}%\"])\n true\n end",
"def valid_email\n email_regex = !!(cas_email =~ /^[\\w+\\-.]+@[a-z\\d\\-]+[\\.[a-z\\d\\-]+]*\\.edu/i)\n errors.add :cas_email, I18n.t('users.valid_email') unless email_regex\n end",
"def fValidateEmail (email)\n @users.validateEmail(email)\n end",
"def email_not_duplicate(email, users)\r\n return false if users.all.find {|user| user.email == email}\r\n return true\r\nend",
"def validateEmail\n email_check = email.include?(\"@\") && email.split(\"@\")[1].include?(\".\")\n if email_check == false\n errors.add(:email, 'Invalid email address')\n end\n email_check\n end",
"def email_valid(email)\n if !email.empty?\n self.email = email\n return true\n end\n end",
"def email_check\n if !email =~ /^([^@\\s]+)@((?:[-a-z0-9]+\\.)+[a-z]{2,})$/i\n errors.add :base, \"Email is in an invalid format.\"\n end\n end",
"def email_not_taken\n DanceStudio.all.each do |studio|\n errors.add(:email, 'is taken') if studio.email.downcase == email.downcase\n end\n end",
"def validate(email)\n email.scan(/\\b(?:[\\w\\d\\S]+)@(?:[\\w\\d\\-\\.]){1,253}[\\.](?:[\\w]{2,5})\\b/).length > 0\nend",
"def validate_username\n if User.where(email: username).exists?\n errors.add(:username, :invalid)\n end\n end",
"def validate_username\n if User.where(email: username).exists?\n errors.add(:username, :invalid)\n end\n end",
"def check_new_mail\n if (params[:user][:email] != @user.email)\n if (User.where(:nick => params[:user][:email]).count > 0)\n false\n else\n true\n end\n else\n true\n end\n end",
"def validate_email(email_id)\n email_pattern = /^([A-Za-z0-9_\\-\\.])+\\@([A-Za-z0-9_\\-\\.])+\\.([A-Za-z]{2,4})$/\n if email_pattern.match(email_id) then\n return true\n else\n return false\n end\n end",
"def validate_email\n return error_with_identifier('invalid_api_params',\n 'um_u_c_ve_1',\n ['invalid_email']\n ) unless Util::CommonValidateAndSanitize.is_valid_email?(@email)\n\n success\n end",
"def validate_username\n if User.where(email: username).exist?\n errors.add(:username, :invalid)\n end\n end",
"def valid_email?\n\t\tunless email.blank?\n\t\t\terr = domain_error(domain_of(email))\n\t\t\terrors.add(:email, err) unless err.blank?\n\t\tend\n\tend",
"def email_exist\n user = User.find_for_database_authentication(email: params[:user][:email])\n if user\n render json: {status: 500, message: \"Email is already taken.\"}\n else\n render json: {status: 200, message: \"Email is available.\"}\n end\n end",
"def email_validator(user_email)\n EmailValidator.regexp\n EmailValidator.valid?(user_email)\n end",
"def valid_email?(email)\n email.match(/^\\w+@\\w+\\.com$/)\nend",
"def test_invalid_email_address_unique\n @jm.email_address = affiliates(:bob_reseller).email_address\n assert [email protected]?\n assert_error_on :email_address, @jm\n end",
"def validate_username\n if User.where(email: username).exists? || User.where(username: username).exists? \n errors.add(:username, :invalid)\n end\n end",
"def check_email\n self.email_address=~/^([^@\\s]+)@((?:[-a-z0-9]+\\.)+[a-z]{2,})$/i if email_address\n end",
"def email_is_valid?(email)\n email =~ /[^@ \\t\\n\\r]+@[a-zA-Z0-9\\.-]{3,}$/\n end",
"def email_already_exists?(email)\n if User.exists?(email: email)\n flash[:alert] = 'A user with that email address already exists!'\n return flash\n end\n end",
"def is_valid_email? email\n /^[a-zA-Z]+\\.[1-9]\\d*@(buckeyemail\\.)?osu\\.edu$/.match? email\nend",
"def email_validate(contacts, current_email) \n if contacts.where(email: current_email).present?\n return true\n end\n false\n end",
"def is_valid_email? email\n\temail =~ VALID_EMAIL_REGEX\nend",
"def email_taken?\n @email_credential and @email_credential.errors.added?(:email, :taken)\n end",
"def check_email\n\t\t@result = User.find_by_email(params[:email])\n\t\tif @result.blank?\n\t\t\trender :json => { :success => false, :user => @result.to_json(:only => [:email]) }\n\t\telse\n\t\t\trender :json => { :success => true, :user => 'Email is already taken' }\n\t\tend\n\tend",
"def verify_email\n # remove any notice(s) for past email addresses\n pending_notices.all({ :data.not => self.email, type: 'email' }).destroy\n\n unless n = pending_notices.first_or_create({ data: self.email, type: 'email' })\n errors.add :notices, n.collect_errors\n throw :halt\n end\n\n n\n end",
"def test_unique_user_email\n assert User.create(first_name: \"Ilan\", last_name: \"Man\", email: \"[email protected]\")\n u = User.new(first_name: \"Aliza\", last_name: \"Barkel\", email: \"[email protected]\")\n refute u.save\n end",
"def email_address_is_valid\n email_regex = /\\A([\\w+\\-].?)+@[a-z\\d\\-]+(\\.[a-z]+)*\\.[a-z]+\\z/\n if email.present? && email[email_regex].nil?\n errors.add(:email, \"is not valid\")\n end\n end",
"def vaid_email?\n\t\tif email.match(FORBIDDEN_EMAILS)\n\t\t\terrors.add(:email,\"error! email has been restricted!\")\n\t\tend\t\t\n\tend",
"def validateEmail(email)\n if (email == nil)\n return false\n end\n \n return true # TODO This is wrong. Finish this function.\nend",
"def unique_email(original)\n email = original.is_a?(User) ? original.email : original\n \"#{hex_rand}_#{email}\"\n end",
"def is_email\n\t\treg_ex_pattern = /\\A([\\w+\\-].?)+@[a-z\\d\\-]+(\\.[a-z]+)*\\.[a-z]+\\z/i\n\t\tunless reg_ex_pattern.match?(email)\n\t\t\terrors.add(:email, \"must be a valid email\")\n\t\tend\n\tend",
"def is_valid_email(str)\n\n count_at = str.count \"@\"\n alpha = (\"a\"..\"z\").to_a.join\n\n if count_at == 1 # only one @\n arr = str.split(\"@\")\n\n # if (arr[0] == arr[0].downcase) # must check absence of digits\n arr[0].each_char do |char| # only lowercase letters in Name part\n if !alpha.include?(char)\n return false\n end\n end\n \n count_dot = str.count \".\" # only one \".\" after \"@\"\n if count_dot == 1\n return true\n end\n end\n\n return false\nend",
"def valid_email(email)\n return true if email =~ /\\A[\\w+\\-.]+@[a-z\\d\\-]+(\\.[a-z]+)*\\.[a-z]+\\z/\n false\nend",
"def is_valid_email(str)\n return false if str.split(\"@\").length != 2 || str.split(\"@\")[1].split(\".\").length !=2\n username = str.split(\"@\")[0]\n domain = str.split(\"@\")[1].split(\".\")[0]\n dns = str.split(\"@\")[1].split(\".\")[1]\n username.each_char{|char| return false if char.ord < \"a\".ord}\n domain.each_char{|char| return false if char.ord < \"a\".ord}\n dns.each_char{|char| return false if char.ord < \"a\".ord}\n \n return true\n end",
"def uniquify\n email = email_address ||= self.login_name || return\n self.login_name = self.email_address = uniquify_value(email[/[^@]+/]) + '@test.com'\n end",
"def validate_email(email)\r\n email =~ /\\A[\\w+\\-.]+@[a-z\\d\\-.]+\\.[a-z]+\\z/i ?\r\n (return true) : (return false)\r\nend",
"def username_must_be_unique\n errors.add(:username, :taken) if username.present? && User.where(username: username).where.not(id: model.id).exists?\n end",
"def validEmail(input)\n return input.match(/\\A[\\w+\\-.]+@[a-z\\d\\-.]+\\.[a-z]+\\z/i)\n end",
"def username_is_email\n errors.add(:userName,'is not in email format') unless userName=~ /^([^@\\s]+)@((?:[-a-z0-9]+\\.)+[a-z]{2,})$/i\n end",
"def validate_emails\n # can have zero or more emails\n @emails.each do |e|\n # each email must have endereco_email\n return false if e.endereco_email == \"\"\n end\n return true\n end",
"def validate \n errors.add(:email, \"must be valid.\") unless email.include?(\"@\") \n if account.include?(\" \") \n errors.add(:account,\"cannot include spaces.\") \n end \n end",
"def valid_email?\n if Rails.env.production?\n unless self.email.match(/(\\.wvu\\.edu)$/)\n errors.add(:email, \"address must be a wvu address @mail.wvu.edu or @mix.wvu.edu\")\n end\n end\n end",
"def has_valid_email?\n email_regex = %r{.+@.+\\..+}\n\n # returns false if invalid\n !((self.email =~ email_regex).nil?)\n end",
"def valid_email_id?(email_id)\n is_valid_data_with_format?(email_id, /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,4}$/, \"Email\")\nend",
"def has_existing_email?\n User.find_by_email(self.email).present?\n end",
"def test_invalid_length_email\n\t user = User.new(:login => \"abder\", :password => \"aaaaa\", :password_confirmation => \"aaaaa\")\n\t \n\t user.email = \"@\"\n\t assert !user.valid?\n\t assert_equal \"The email must be at least 3-characters long\", user.errors.on(:email)\n\t \n\t user.email = \"a@\"\n\t assert !user.valid?\n\t assert_equal \"The email must be at least 3-characters long\", user.errots.on(:email)\n end",
"def validate_useremail\n email = params[:user][:email]\n email_flag = User.where(:email => email).count\n status = (email_flag > 0) ? false : true\n render json: {:status => status}\n end",
"def validates_email_not_free\n return if !validate_attributes or email.blank?\n FREE_EMAIL_DOMAINS.each do |domain|\n if email =~ /#{domain}/\n errors.add('email',\"must not be a free account.\")\n end\n end\n end",
"def email_exists?(email)\n return User.find_by_email(email.downcase) != nil\nend",
"def isValidEmail?(e)\n\treturn !(e =~ VALID_EMAIL_REGEX).nil?\nend",
"def validate_email?(email_string)\n #return false if email is blank\n return false if email_string.blank?\n #remove all white space\n to_email = email_string#.gsub(/\\s+/, \"\")\n #check for presence of multiple emails\n if(to_email.count(',')>0 && to_email.count(',')<6)\n result = true\n emails_array = to_email.split(\",\")\n emails_array.each do |email|\n if !valid_email_address?(email.squish)\n result = false\n break\n end\n end\n return result\n else\n return valid_email_address?(to_email)\n end\n end",
"def create_email_no_domain\n self.email_no_domain = self.email.split('@').first if self.email.present? && self.email_no_domain.nil?\n return true\n end",
"def valid_email?(email)\n email =~ /\\A[\\w+\\-.]+@[a-z\\d\\-]+(\\.[a-z\\d\\-]+)*\\.[a-z]+\\z/i\n end",
"def is_valid_email(str)\n parts = str.split(\"@\")\n \n if parts.length != 2\n return false\n end\n \n first = parts[0]\n second = parts[1]\n alpha = \"abcdefghijklmnopqrstuvwxyz\"\n \n first.each_char do |char|\n if !alpha.include?(char)\n return false\n end\n end\n \n if second.split('.').length == 2\n return true\n else\n return false\n end\n end",
"def check_email\n\t\t@result = CompanyStaff.find_by_email(params[:email])\n\t\tif @result.blank?\n\t\t\trender :json => { :success => false, :user => @result.to_json(:only => [:email]) }\n\t\telse\n\t\t\trender :json => { :success => true, :user => 'Email is already taken' }\n\t\tend\n\tend",
"def validates_unique(*atts)\n message = (atts.pop[:message] if atts.last.is_a?(Hash)) || 'is already taken'\n atts.each do |a|\n ds = model.filter(Array(a).map{|x| [x, send(x)]})\n errors.add(a, message) unless (new? ? ds : ds.exclude(pk_hash)).count == 0\n end\n end",
"def value_email_valid?\n if value.match(/\\A([^@\\s]+)@((?:[-a-z0-9]+\\.)+[a-z]{2,})\\Z/i)\n return true\n end\n @errors_data << 'validate_invalid_email'\n return false\n end",
"def email_already_confirmed?\n (errors.messages.size == 1) && errors.messages[:email].first =~ /already confirmed/\n end",
"def preconditions\n validator.kind == :uniqueness\n end",
"def email_valid?\n\t\tif self.email == nil\n\t\t\treturn false\n\t\telsif VALID_EMAIL_REGEX !~ self.email || self.email.empty? || self.email.length > MAX_CREDENTIAL_LENGTH\n\t\t\treturn false\n\t\tend\n\t\ttrue\n\tend",
"def validate_subject\n errors << 'invalid email domain' unless domain_valid?\n end",
"def valid_email?(email)\n (email =~ /\\A[\\w+\\-.]+@[a-z\\d\\-]+(\\.[a-z\\d\\-]+)*\\.[a-z]+\\z/i)\n end",
"def validate_signup(posted)\n errors = validate_required(posted, ['email'])\n email = posted['email']\n\n errors['email'] ||= error_for_email(dealer_dao, email)\n if / is already taken.\\Z/.match(errors['email'])\n errors['email'] = nil\n end\n\n if (posted['agree_terms'].nil?)\n errors['agree_terms'] = \"You must agree to Terms & Conditions.\"\n end\n\n errors.delete_if { |k,v| v.nil? }\n end",
"def is_valid_email(str)\r\n at = 0\r\n str.each_char do |char|\r\n if char == '@'\r\n at +=1\r\n end\r\n end\r\n if at != 1\r\n return false\r\n end\r\n if !lower(str[0...str.index('@')])\r\n return false\r\n end\r\n if !containDot(str[(str.index('@') + 1)..-1])\r\n return false\r\n end\r\n return true\r\nend",
"def is_valid_email(str)\n if is_onlyone(str) == 1 && is_onlyonedot(str) == 1 && is_downcase(str) == true\n return true \n else \n return false \n end\nend",
"def is_valid_email(str)\n if is_onlyone(str) == 1 && is_onlyonedot(str) == 1 && is_downcase(str) == true\n return true \n else \n return false \n end\nend",
"def is_valid_email(str)\n parts = str.split(\"@\")\n if parts.length != 2\n return false\n end\n first = parts[0]\n second = parts[1]\n alpha = \"abcdefghijklmnopqrstuvwxyz\"\n first.each_char do |char|\n if !alpha.include?(char)\n return false\n end\n end\n if second.split(\".\").length == 2\n return true\n else\n return false\n end\n \n \nend",
"def email_exists?(email)\n if self.find_by_email(email).nil?\n false\n else\n true\n end\n end",
"def validates_email\n self.type == 'email'\n end",
"def check_email(email)\n return !((email =~ %r{^[^@]+@([a-zA-Z0-9\\-]+\\.)+[a-zA-Z0-9]+$}).nil?)\n end",
"def check_email_existense\n @email_account_without_domain = normalized_email.split('@').first\n @home = `grep ^#{username} /etc/passwd | cut -d \\: -f6`.chomp\n @email_account_search = `grep -w #{@email_account_without_domain} #{@home}/etc/#{domain}/passwd 2>/dev/null`\n if @email_account_search.empty?\n puts \"E-mail account #{normalized_email} doesn't exist\"\n else\n true\n end\n end",
"def is_valid_email(str)\n# contains exactly one @ symbol\n words = str.split(\"@\")\n if words.length != 2\n return false\n end\n# contains only lowercase letters before the @\n if words[0] != words[0].downcase\n return false\n end\n# contains only alphabetic letters before the @\n if checkForNumbers(words[0])\n return false\n end\n# contains exactly one . after the @\n halves = words[1].split(\".\")\n if halves.length != 2\n return false\n end\n return true\nend",
"def is_valid_email(str)\n if is_onlyone(str) == 1 && is_onlyonedot(str) == 1\n return true\n else \n return false \n end\nend"
] | [
"0.8493842",
"0.843575",
"0.8248474",
"0.81815803",
"0.8108412",
"0.8002195",
"0.79162",
"0.77153873",
"0.7686052",
"0.7477267",
"0.7352634",
"0.73438746",
"0.7246181",
"0.71821254",
"0.7153108",
"0.71396035",
"0.7112482",
"0.7098818",
"0.70748365",
"0.70688635",
"0.70532346",
"0.7014286",
"0.6986876",
"0.6914976",
"0.6798493",
"0.6788475",
"0.67881846",
"0.67529404",
"0.6750087",
"0.6740713",
"0.67173505",
"0.66964144",
"0.66964144",
"0.66940564",
"0.6684661",
"0.66700554",
"0.6652448",
"0.6641181",
"0.6629295",
"0.66246206",
"0.6610176",
"0.6608849",
"0.6592795",
"0.65918624",
"0.65750897",
"0.65732324",
"0.65556204",
"0.65504074",
"0.6550112",
"0.6545514",
"0.65423226",
"0.65299976",
"0.65260625",
"0.6503551",
"0.64948857",
"0.6488212",
"0.6487274",
"0.64633775",
"0.6462916",
"0.6443754",
"0.6442768",
"0.64298195",
"0.64279896",
"0.64242715",
"0.6421272",
"0.64101225",
"0.640844",
"0.6388844",
"0.6377941",
"0.63761467",
"0.6373965",
"0.63629866",
"0.63514",
"0.63436776",
"0.6340588",
"0.6336654",
"0.6335585",
"0.6327736",
"0.6318728",
"0.63045746",
"0.6300098",
"0.62973946",
"0.6294779",
"0.62903804",
"0.6286868",
"0.62832826",
"0.62832093",
"0.62787414",
"0.62731296",
"0.6266915",
"0.626365",
"0.62450796",
"0.62450796",
"0.62347937",
"0.62325454",
"0.62267137",
"0.62191856",
"0.62182814",
"0.6208633",
"0.6208494"
] | 0.672899 | 30 |
touch: update the user's updated at date if logged in | def touch
if current_user
current_user.touch
end
respond_to do |format|
format.json {render :nothing => true}
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def touch_user_data\n user.update user_data_updated_at: Time.zone.now if user.present?\n end",
"def update_user\n current_user.update_last_access if current_user && signed_in?\n end",
"def update_last_user_activity\n if current_user\n current_user.update_attributes(:last_user_activity => Time.now)\n end\n end",
"def update_last_activity_at\n current_user.last_activity_at = Time.zone.now if current_user\n end",
"def touch_refresh_feed_job_states\n user.update refresh_feed_jobs_updated_at: Time.zone.now if user.present?\n end",
"def user_activity\n current_user.touch(:last_response_at) if signed_in?\n end",
"def update_first_login(user)\n unless user.first_logged_in_at\n user.update_attributes(first_logged_in_at: Time.now)\n end\n end",
"def last_updates_viewed\n self.user.extend(Montage::User).last_login\n end",
"def refresh!\n self.update_attributes(:last_logged => Time.now)\n end",
"def update_last_seen_at\n puts \"\", \"Updating last seen at on users\"\n\n DB.exec(\"UPDATE users SET last_seen_at = created_at WHERE last_seen_at IS NULL\")\n DB.exec(\"UPDATE users SET last_seen_at = last_posted_at WHERE last_posted_at IS NOT NULL\")\n end",
"def update_last_activity\n current_user.try(:update_last_activity)\n end",
"def updated\n DateTime.parse(@json['user']['meta']['updated'])\n end",
"def after_update(resource)\n #expire_cache_for(resource)\n unless resource.is_a? User and (resource.current_sign_in_at_changed? or resource.last_sign_in_at_changed?)\n expire_cache_for(resource)\n end\n end",
"def record_user_activity\n current_user.touch :last_active_at if current_user\n end",
"def update_user\n end",
"def update_user_if_save_version\n self.user = User.current if save_version?\n end",
"def set_updated!\n @updated_at = Time.now\n end",
"def update_user_token\n if user_signed_in?\n Session.active_sessions.find_by(id: request.headers['sid'], utoken: request.headers['utoken']).update(last_used_at: Time.zone.now)\n end\n end",
"def audit_update\n self.modified_date = DateTime.now\n if self.created_date.blank?\n self.created_date = DateTime.now\n end\n end",
"def update_sign_in_timestamps!(remember_me = false)\n timestamp = Time.now.utc\n self.last_sign_in_at = timestamp\n self.remember_created_at = timestamp if remember_me\n save(validate: false)\n end",
"def update_current_logged_in_user(args = {}) \n put(\"/users.json/current\", args)\nend",
"def show\n @user = User.find(params[:id])\n fresh_when :last_modified => @user.updated_at.utc, :etag => @user\n end",
"def update \n update = object.updated_at\n end",
"def ensure_last_signed_in_at_set\n return unless current_user.present?\n return if current_user.last_signed_in_at.present?\n current_user.update last_signed_in_at: current_user.updated_at\n end",
"def date_auth_updated=(value)\n @children['date-auth-updated'][:value] = value\n end",
"def update_last_user_activity\n now = session[:last_activity] = Time.now\n return if session_is_cloned?\n if ( current_user && (session[:last_activity_saved].nil? || (now - session[:last_activity_saved] > APP_CONFIG[:save_last_activity_granularity_in_seconds].to_i ) ) ) \n logger.info(\"Saved last activity date to #{now} for #{current_user.log_info}\")\n current_user.update_last_activity_date\n session[:last_activity_saved] = now\n end\n end",
"def touch\n\n self.last_modified = Time.now\n end",
"def touch\n\n self.last_modified = Time.now\n end",
"def date() updated; end",
"def update\n \t\t\t\t@active = User.find(session[:user_id]).try :touch\n\t\t\t\t@system = System.all\n\t\t\t\t@creator = User.all\n\t\t\t\t@person = Person.all\n\t\t\t\[email protected](user_params)\n\t\t\t\[email protected]_by = session[:user_id]\n\t\t\t\[email protected]_changed = Time.now\n if \[email protected] == \"YES\"\n \[email protected]_by = session[:user_id]\n end\n \t\[email protected]\n respond_to do |format|\n if @user.update(user_params)\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { render :show, status: :ok, location: @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\n \n if current_user.update(user_params)\n Rails.cache.write(current_user.id,current_user)\n redirect_to users1_got_profile_path\n\n end\n end",
"def set_last_login\n self.update_attributes(:last_login_at => Time.now.utc)\n end",
"def user_session_update sid = \"\", uid = 0\n\t\tds = Sdb[:user_sess].filter(:sid => sid, :uid => uid.to_i)\n\t\tds.update(:changed => Time.now) if ds.count > 0\n\tend",
"def touch_subscribe_job_states\n user.update subscribe_jobs_updated_at: Time.zone.now if user.present?\n end",
"def touch_when_logging\n self.log_updated_at = Time.zone.now\n save\n end",
"def update_activity\n self.last_activity = Time.now\n end",
"def touch\n update_timestamps\n save\n end",
"def touch_date uid=nil\n if ref = ref_if_any(uid)\n ref.updated_at\n end\n end",
"def bump_timestamps\n self.updated_at = Time.now.utc\n end",
"def touch\n now = Time.current.utc\n self.updated_at = now\n self.created_at = now if new_record?\n end",
"def show\n\t\t\t\t @active = User.find(session[:user_id]).try :touch\n end",
"def uptouch(uid, time)\n ref = ref_for uid, true\n if time > ref.updated_at\n Rcpref.record_timestamps=false\n ref.updated_at = time \n ref.save\n Rcpref.record_timestamps=true\n else\n false\n end\n end",
"def update!(**args)\n @user_info = args[:user_info] if args.key?(:user_info)\n end",
"def touch\n self.updated_at = Time.zone.now\n skip_versioning_and_timestamps\n save :validate => false\n end",
"def touch_date uid=nil\n if (ref = ref_for uid, false)\n ref.updated_at\n end\n #(ref = uid.nil? ? current_ref : ref_for(uid, false)) && ref.updated_at\n end",
"def extendbyfourteendays\n updated_at = Time.now\n end",
"def self_update\n @current_user.update(user_params_update)\n json_response(@current_user)\n end",
"def touch!\n @created = Time.now.to_i\n end",
"def update_user_state\n user.clocked_in? ? user.clock_out : user.clock_in\n end",
"def update_last_activity!\n if respond_to?(:update_column)\n self.update_column(:last_activity_at, Time.now.utc)\n elsif defined? Mongoid\n self.update_attribute(:last_activity_at, Time.now.utc)\n end\n end",
"def _update_timestamps\n if self.respond_to?('updated_at')\n self.updated_at = Time.now\n end\n end",
"def touch_via_cache(time=self.updated_at)\n time = time.utc\n #self.user.league_roles_last_updated_at = time unless self.user.nil?\n #self.league.league_roles_last_updated_at = time unless self.league.nil?\n return true\n end",
"def updater(user)\n # self.updated_by_id = user.id\n\n ur = self.users_roles\n ur.each do |u|\n if u.created_at == nil then\n u.created_at = DateTime.now\n u.created_by_id = self.id\n end\n\n end\n self.save\n end",
"def set_last_reload\n current_dreamer.update_column(:last_reload_at, Time.zone.now) if dreamer_signed_in?\n end",
"def update_timestamp(*_args)\n current_time = current_time_from_proper_timezone\n\n write_attribute('updated_at', current_time) if respond_to?(:updated_at)\n write_attribute('updated_on', current_time) if respond_to?(:updated_on)\n end",
"def update_activated_at\n if status_before_last_save == false\n update_attributes(activated_at: Time.now)\n end\n end",
"def set_updated_by\n account.updated_by = current_user.id\n account\n end",
"def update_tcs\n @user = current_user\n end",
"def after_update(user)\n expire_cache_for(user)\n end",
"def update\n set_deltatime\n set_last_update_at\n end",
"def current\n current_user.update!(last_login: Time.now)\n render json: current_user\n end",
"def current\n current_user.update!(last_login: Time.now)\n render json: current_user\n end",
"def update_updated_by\n self.updated_by = User.current.id if User.current and not destroyed?\n end",
"def update_updated_by\n self.updated_by = User.current.id if User.current and not destroyed?\n end",
"def update_updated_by\n self.updated_by = User.current.id if User.current and not destroyed?\n end",
"def updated(date_or_time = T.unsafe(nil)); end",
"def update_expires_at\n self.expires_at = if attachable\n nil\n else\n 1.day.from_now\n end\n end",
"def show\n \t\t@active = User.find(session[:user_id]).try :touch\n end",
"def updated\n updated_at.utc.strftime(\"%F %T\") if updated_at\n end",
"def current_user\n @current_user ||= super\n if @current_user != nil && @current_user.id > 0\n loggedInUser = User.find(@current_user.id)\n loggedInUser.update(:lastlogintime=>Time.now.to_i)#save the current login time \n end\n @current_user\n end",
"def touch *attrs\n now = Time.now\n attrs.each {|attribute|\n update_attribute attribute, now\n }\n end",
"def show\n \t\t\t\t@active = User.find(session[:user_id]).try :touch\n end",
"def touch_recent\n self.recent_activity = Time.now\n self.save(touch: false)\n end",
"def update_updated_at_and_by\n #logger.info { \"FILTTERISSÄ: #{response.headers[\"Status\"]}\" }\n if response.headers[\"Status\"] =~ /^20/\n @collection.set_update_info(DateTime.now, (@user ? @user.guid : @client.id))\n # @collection.updated_at = DateTime.now\n # @collection.updated_by = @user ? @user.guid : @client.id\n # @collection.save\n\n end\n end",
"def update\n respond_to do |format|\n @admin_user.modifydate = Time.now\n if @admin_user.update(admin_user_params)\n format.html { redirect_to @admin_user, notice: 'User was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin_user }\n else\n format.html { render :edit }\n format.json { render json: @admin_user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def authorize\n redirect_to login_path and return unless current_user\n @current_user.touch(:seen_at)\n end",
"def set_update_time!(time = last_modified_date)\n set_update_time(time)\n # disable_ferret\n save\n return last_updated__c\n end",
"def update!(**args)\n @created_date = args[:created_date] if args.key?(:created_date)\n @expired_date = args[:expired_date] if args.key?(:expired_date)\n end",
"def update_user_info(opts)\n opts[:birthday] = format_date(opts[:birthday]) if opts[:birthday]\n post(\"/user/#{@user_id}/profile.json\", opts)\n end",
"def access!\n today = Time.now\n if last_access.nil? || last_access < today\n update_attribute :last_access, today\n end\n end",
"def update\n set_target_time\n respond_to do |format|\n if @me.update_attributes(params[:user])\n flash[:notice] = 'User was successfully updated.'\n format.html { redirect_to records_path }\n format.js\n else\n format.html { render :action => \"edit\" }\n end\n end\n end",
"def update_current_user(user)\n @current_user = user if user\n end",
"def update_status_timestamp\n self.overall_status_modified_at = Time.zone.now\n end",
"def updated_at\n dateChanged\n end",
"def update!(**args)\n @first_seen_ms = args[:first_seen_ms] if args.key?(:first_seen_ms)\n @last_verified_ms = args[:last_verified_ms] if args.key?(:last_verified_ms)\n end",
"def create_username_changed_timestamp\n self.update_attribute(:username_changed_at, 2.months.ago)\n end",
"def update_presence_false\n current_user.update(presence: false, date_derniere_deconnexion: Time.now.utc)\n end",
"def touch_users\n users.each {|u| u.touch}\n end",
"def update_user_tracking!\n unless self.new_record?\n self.updater = \n UserTracking.current_user || \n (raise UserTracking::Error, \"current user is not defined\")\n end\n end",
"def edit\n\n # Show CET/CEST time to the user starting from the UTC time in the Database\n # TODO: have a better solution (see create action)\n @feed.date = @feed.date + 2.hour \n\n if @feed.user_id != current_user.id\n err_mex \n elsif @feed.has_been_published == true\n flash[:notice] = \"Non puoi modificare feed gia' pubblicati\"\n render \"show\"\n end\n\n end",
"def update!(**args)\n @create_time = args[:create_time] if args.key?(:create_time)\n @expire_time = args[:expire_time] if args.key?(:expire_time)\n @update_time = args[:update_time] if args.key?(:update_time)\n end",
"def update!(**args)\n @create_time = args[:create_time] if args.key?(:create_time)\n @expire_time = args[:expire_time] if args.key?(:expire_time)\n @update_time = args[:update_time] if args.key?(:update_time)\n end",
"def before_save(model)\n model.updated_by = @@current_user if model.respond_to?(\"updated_by\")\n end",
"def did_log_in\n self.last_logged_in_at = DateTime.now\n self.class.execute_without_timestamps { save }\n end",
"def update!(**args)\n @create_time = args[:create_time] if args.key?(:create_time)\n end",
"def refresh\n update_attributes({:updated_at => DateTime.parse(Time.now.to_s)})\n end",
"def update\n if @feed.user_id == current_user.id\n respond_to do |format|\n\n if @feed.update(feed_params)\n\n # Convert the CET/CEST time (inserted by the user) in UTC time (expected by the Database)\n \t # TODO: have a better solution (see create action)\n \t @feed.date = @feed.date - 2.hour \n\t @feed.save\n\n flash[:notice] = 'Il Feed e\\' stato aggiornato con successo'\n format.html { redirect_to action: 'index' }\n else\n format.html { render action: 'edit' }\n format.json { render json: @feed.errors, status: :unprocessable_entity }\n end\n end\n else\n err_mex\n end\n end",
"def conditionally_update\n return true unless params[:user]\n @user.update(user_params)\n end",
"def mark_as_viewed(recipient_user_id)\n if self.recipient_user_id == recipient_user_id && self.viewed_date.nil?\n self.viewed_date = Time.now \n self.save\n end\n end",
"def update_user_mark_email_processed\n # Ignore any suspicious looking internal dates. Sometimes\n # misconfigured email servers means that email arrives from the\n # future.\n if internal_date > Time.now\n Log.librato(:count, \"system.process_uid.fix_suspicious_internal_date\", 1)\n self.internal_date = user.last_internal_date\n end\n\n # Update the user.\n user_thread.update_user(:last_uid => uid,\n :last_email_at => Time.now,\n :last_internal_date => internal_date)\n return true\n end"
] | [
"0.8018211",
"0.7566768",
"0.72849125",
"0.7202335",
"0.7166964",
"0.70127594",
"0.6911699",
"0.685908",
"0.6846113",
"0.67954934",
"0.67588025",
"0.674576",
"0.67308736",
"0.6713763",
"0.66589177",
"0.65835357",
"0.6581792",
"0.6570115",
"0.6544697",
"0.6503571",
"0.64936256",
"0.6493217",
"0.6485603",
"0.6484976",
"0.6475564",
"0.6453407",
"0.6445723",
"0.6445723",
"0.644336",
"0.64215875",
"0.64093536",
"0.639475",
"0.6382909",
"0.6375435",
"0.6343382",
"0.63284105",
"0.6323193",
"0.62914103",
"0.6272306",
"0.62437457",
"0.623164",
"0.62260246",
"0.62245166",
"0.6206226",
"0.6196552",
"0.61919165",
"0.61680645",
"0.6164345",
"0.61556184",
"0.6143666",
"0.6141826",
"0.6138075",
"0.61300087",
"0.6128258",
"0.61215657",
"0.61169976",
"0.6115028",
"0.6102764",
"0.60952026",
"0.60940516",
"0.6092382",
"0.6092382",
"0.6081031",
"0.6081031",
"0.6081031",
"0.6080442",
"0.60803485",
"0.6057887",
"0.60506964",
"0.60478896",
"0.60474885",
"0.6039381",
"0.60319066",
"0.602077",
"0.60201067",
"0.6014696",
"0.6013341",
"0.6013239",
"0.60007405",
"0.60002124",
"0.598805",
"0.5984996",
"0.5966669",
"0.59534377",
"0.5943562",
"0.59420824",
"0.59397286",
"0.5939336",
"0.59360814",
"0.5930619",
"0.592921",
"0.5928996",
"0.5924958",
"0.59240884",
"0.5920088",
"0.59186506",
"0.5906422",
"0.59041667",
"0.59031844",
"0.5901047"
] | 0.6375694 | 33 |
Returns salt value to be used for hashing. | def salt
# 72 bits
SecureRandom.hex(9)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def salt\n read_attribute(:salt) or returning self.class.generate_salt do |s|\n write_attribute(:salt, s)\n end\n end",
"def salt\n p_salt(profile.salt_bytes)\n end",
"def get_salt\n @salt ||= BCrypt::Engine.generate_salt\n end",
"def salt\n if salt_path.file?\n salt_path.read\n else\n @salt ||= SecureRandom.bytes(Sia::Lock::DIGEST.new.digest_length)\n end\n end",
"def salt!\n returning self.class.generate_salt do |s|\n write_attribute(:salt, s)\n end\n end",
"def salt\n return NSEC3.encode_salt(@salt)\n end",
"def salt\n @@salt ||= SALT\n end",
"def salt\n read_attribute(:salt) || reset_salt\n end",
"def generate_salt\n return hash(\n Time.now.to_s,\n rand(999_999_999).to_s,\n Time.now.usec\n )\n end",
"def generate_salt\n Digest::SHA1.hexdigest(Time.now.to_f.to_s)\n end",
"def get_crypto_salt_hex\n return @crypto_salt if ! @crypto_salt\n @crypto_salt.unpack(\"H*\")\n end",
"def password_salt\n \"choujin-steiner\"\n end",
"def salt=(value)\n @@salt = value\n end",
"def salt\n nil\n end",
"def generate_salt\n salt_time = (ENV['RACK_ENV'] == 'test' ? 0.01 : 1.25)\n self[:salt] = SCrypt::Engine.generate_salt(max_time: salt_time)\n end",
"def mutate_bcrypt_salt(_)\n 'au6lOASvp17AGsqkmE7'\n end",
"def make_salt\n secure_hash(\"#{Time.now.utc}--#{password_digest}\")\n end",
"def code_salt\n 'fbbc13ed4a51e27608037365e1d27a5f992b6339'\n end",
"def generate_salt\n salt = \"\"\n 64.times { \n salt << (i = Kernel.rand(62); i += ((i < 10) ? 48 : ((i < 36) ? 55 : 61 ))).chr }\n salt\n end",
"def make_salt\r\n self.salt = sha_hash(\"#(Time.now.to_s)--#(self.password)\")\r\n end",
"def rand_salt\n result = ''\n salt().length.times {result << salt()[rand(salt().length),1]}\n result\n end",
"def make_salt\n secure_hash(\"#{Time.now.utc}--#{password}\")\n end",
"def make_salt\n secure_hash(\"#{Time.now.utc}--#{password}\")\n end",
"def generate_salt\n Digest.hexencode(Digest::SHA1.digest(\n \"#{rand(2 ** 128) * ( Time.now.to_i * Process.pid)}\"))\n end",
"def get_salt\n [Array.new(6){rand(256).chr}.join].pack(\"m\" ).chomp\n end",
"def make_salt\n secure_hash(\"#Time.now.utc}--#{password}\")\n end",
"def generate_salt\n self.salt = SecureRandom.base64(8)\n end",
"def salt\n SecureApi.configuration.secure_api_salt\n end",
"def make_salt\n\t secure_hash(\"#{Time.now.utc}--#{password}\")\n\tend",
"def get_signing_salt\n self_key_sign = OpenSSL::HMAC.digest(@hash_algo, @client_secret, @self_key)\n client_id_sign = OpenSSL::HMAC.digest(@hash_algo, self_key_sign, @client_id)\n OpenSSL::HMAC.digest(@hash_algo, client_id_sign, 'signer')\n end",
"def salt\n @salt ||= Pharos::SaltMinion.new minion_id: hostname\n end",
"def salt() 'monkeynutzzSfaKT7CwImCHCH8Ow' end",
"def authenticatable_salt\n encrypted_password[0,29] if encrypted_password\n end",
"def authenticatable_salt\n read_attribute(:authenticatable_salt)\n end",
"def authenticatable_salt\n return if encrypted_password_digest.blank?\n Encryption::PasswordVerifier::PasswordDigest.parse_from_string(\n encrypted_password_digest,\n ).password_salt\n end",
"def password_salt_field(value = nil)\n rw_config(\n :password_salt_field,\n value,\n first_column_to_exist(nil, :password_salt, :pw_salt, :salt)\n )\n end",
"def generate_salt\n @salt = self.object_id.to_s + rand.to_s\n end",
"def salted_password\n @salted_password ||= CredentialCache.cache(cache_key(:salted_password)) do\n hi(user.sasl_prepped_password)\n end\n end",
"def salt_size\n @salt_size ||= defaults[:salt_size]\n end",
"def salt_size\n @salt_size ||= 8\n end",
"def authenticatable_salt\n self.encrypted_password[0,29] if self.encrypted_password\n end",
"def authenticatable_salt; end",
"def gen_salt\n chars = []\n 8.times { chars << SALT_CHARS[SecureRandom.random_number(SALT_CHARS.size)] }\n chars.join('')\n end",
"def send_salt( session, user )\n salt = Digest::MD5.hexdigest( user + Time.now.strftime('%M%S') + rand(300).to_s )\n session.puts salt\n return salt\n end",
"def authenticatable_salt\n end",
"def generate_salt\n self.salt = self.object_id.to_s + rand.to_s\n end",
"def get_default_salt(mode)\r\n\r\n default_salt = nil\r\n\r\n if (mode == AES_128) || (mode == AES_256)\r\n default_salt = OpenSSL::Random.random_bytes(8)\r\n elsif mode == DES\r\n default_salt = OpenSSL::Random.random_bytes(2)\r\n end\r\n\r\n default_salt\r\n end",
"def password_salt_field(value = nil)\n config(:password_salt_field, value, first_column_to_exist(nil, :password_salt, :pw_salt, :salt))\n end",
"def create_new_salt\n self.salt = Digest::SHA256.hexdigest(Time.now.to_s + rand.to_s)\n end",
"def create_new_salt\n self.salt = Digest::SHA256.hexdigest(Time.now.to_s + rand.to_s)\n end",
"def salt=(salt)\n @@salt = salt\n end",
"def salt_password( authkey, password )\n combined = authkey.to_s + password.to_s\n return Digest::MD5.hexdigest(combined)\n end",
"def create_salt\n d = Digest::SHA1.new\n now = Time.now\n d.update(now.to_s)\n d.update(String(now.usec))\n d.update(String(rand(0)))\n d.update(String($$))\n d.update('wxtengu.net')\n d.hexdigest\n end",
"def calc_hash(pass)\n salt_cost = SCrypt::Engine.autodetect_cost(self[:salt])\n SCrypt::Engine.scrypt(pass, self[:salt], salt_cost, 32).unpack('H*').first\n end",
"def to_sha256(salt = \"\")\n hashsum(:sha256, salt)\n end",
"def to_sha2(salt = \"\")\n hashsum(:sha2, salt)\n end",
"def salt_path\n safe_dir / options[:salt_name]\n end",
"def get_machine_kerberos_salt\n host = simple.client.default_name\n return ''.b if host.nil? || host.empty?\n domain = simple.client.dns_domain_name\n \"#{domain.upcase}host#{host.downcase}.#{domain.downcase}\".b\n end",
"def gen_salt\n chars = []\n 8.times { chars << SALT_CHARS[rand(SALT_CHARS.size)] }\n chars.join('') \n end",
"def salt_password( password )\n case placement.to_sym\n when :end\n password.to_s + string\n when :beginning\n string + password.to_s\n when :split\n string[0...(string.length/2).floor] + password.to_s + string[(string.length/2).floor...string.length]\n else\n raise RuntimeError, \"#{placement.to_s} is an invalid salt placement.\"\n end\n end",
"def remote_get_salt\n @user = login_from_username_and_password\n \n render :text => @user.salt\n end",
"def init_salt\n self.salt = SecureRandom.hex(25) if self.salt.blank?\n end",
"def create_new_salt\n self.password_salt = [Array.new(6){rand(256).chr}.join].pack(\"m\").chomp\n end",
"def id_salt=(salt)\n @id_salt = salt\n end",
"def salted_hash(password)\n salt = SecureRandom.random_bytes(SALT_BYTE_SIZE)\n pbkdf2 = OpenSSL::PKCS5::pbkdf2_hmac_sha1(\n password,\n salt,\n CRYPTERATIONS,\n HASH_BYTE_SIZE)\n\n { salt: salt, pbkdf2: Base64.encode64(pbkdf2) }\n end",
"def calculate_auth_string( salt, user )\n return hash( salt, @creds[user] )\n end",
"def serialize(hash, salt)\n hash + salt\n end",
"def generate_login_salt\n r = Aws::Kms.new('login', 'user').generate_data_key\n return r unless r.success?\n\n @login_salt_hash = r.data\n\n success\n end",
"def to_sha1(salt = \"\")\n hashsum(:sha1, salt)\n end",
"def create_new_salt \n self.password_salt = self.object_id.to_s + rand.to_s\n end",
"def salted_sha_encrypt(password)\n self.class.local_encrypt(password, salt)\n end",
"def hash(password, salt)\n Digest::SHA512.hexdigest(\"#{ password }:#{ salt }\")\n end",
"def random_pbkdf2_salt\n encode_bytes(SecureRandom.random_bytes(16))\n end",
"def crypt(salt=nil)\n salt ||= ((SecureRandom.random_number(26) +\n (SecureRandom.random_number(2) == 0 ? 65 : 97)).chr +\n (SecureRandom.random_number(26) +\n (SecureRandom.random_number(2) == 0 ? 65 : 97)).chr)\n _crypt(salt)\n end",
"def create_new_salt\n\t\tself.salt = self.object_id.to_s + rand.to_s\n end",
"def encrypt(password, salt)\n Digest::SHA1.hexdigest(password + salt)\n end",
"def create_new_salt\n self.salt = self.object_id.to_s + rand.to_s\n end",
"def create_new_salt\n self.salt = self.object_id.to_s + rand.to_s\n end",
"def encrypt(password, salt)\n Digest::SHA1.hexdigest(\"--#{salt}--#{password}--\")\n end",
"def encrypt(password, salt)\n Digest::SHA1.hexdigest(\"--#{salt}--#{password}--\")\n end",
"def encrypt(password, salt)\n Digest::SHA1.hexdigest(\"--#{salt}--#{password}--\")\n end",
"def encrypt(password, salt)\n Digest::SHA1.hexdigest(\"--#{salt}--#{password}--\")\n end",
"def encrypt(password, salt)\n Digest::SHA1.hexdigest(\"--#{salt}--#{password}--\")\n end",
"def encrypt(password, salt)\n Digest::SHA1.hexdigest(\"--#{salt}--#{password}--\")\n end",
"def encrypt(password, salt)\n Digest::SHA1.hexdigest(\"--#{salt}--#{password}--\")\n end",
"def create_new_salt\n\t\t(self.salt = self.object_id.to_s + rand.to_s) if self.salt.nil?\n\tend",
"def pwdhash(salt=nil)\n salt = String.random_password.md5 if salt.nil?\n salt = salt[0..8]\n salt+(salt+self).sha1\n end",
"def authenticatable_salt\n \"#{super}#{session_token}\"\n end",
"def authenticatable_salt\n \"#{super}#{session_token}\"\n end",
"def create_salt()\n size=10\n pool = ('a'..'z').to_a + ('0'..'9').to_a\n self.salt= (1..size).collect{|a| pool[rand(pool.size)]}.join\n end",
"def encrypt(password, salt)\n Digest::SHA1.hexdigest(\"--#{salt}--#{password}--\")\n end",
"def create_salt\n\t\t\tself.password_seed = self.object_id.to_s + rand.to_s\n\t\tend",
"def calc_x(username, password, salt)\n sha512_hex(salt + sha512_str([username, password].join(':'))).hex\n end",
"def authenticatable_salt\n session_id.presence || reset_session_id!\n end",
"def hash_string(value)\n return case password_hash_type\n when 'md5' then Digest::MD5.hexdigest(value + self.password_salt)\n end\n end",
"def set_salt\n @salt = Salt.find(params[:id])\n end",
"def salt_password(clear_password)\n self.salt = User.generate_salt\n self.hashed_password = User.hash_password(\"#{salt}#{User.hash_password clear_password}\")\n end",
"def generate_address_salt\n\n r = Aws::Kms.new('api_key','user').generate_data_key\n return r unless r.success?\n\n @address_salt = r.data\n\n success\n\n end",
"def token_with_salt(salt)\n Digest::SHA256.hexdigest(CommentToolApp::Application.config.secret_token + salt)\n end",
"def encrypt(password, salt=nil)\n salt ||= self.salt\n Digest::SHA1.hexdigest(\"--#{salt}--#{password}--\")\n end"
] | [
"0.8397726",
"0.8228236",
"0.8178956",
"0.79635614",
"0.7926941",
"0.7792873",
"0.7729237",
"0.7709584",
"0.7595341",
"0.7543805",
"0.7541343",
"0.74773",
"0.74534196",
"0.73896766",
"0.7378751",
"0.73278445",
"0.7295854",
"0.72740465",
"0.72273326",
"0.72187436",
"0.7211811",
"0.7197904",
"0.7197904",
"0.7181897",
"0.71774465",
"0.71773815",
"0.7145365",
"0.7118011",
"0.71023285",
"0.7080585",
"0.70235807",
"0.70176566",
"0.7011308",
"0.6954104",
"0.6941201",
"0.6866131",
"0.6844657",
"0.6830457",
"0.6819053",
"0.68036956",
"0.6773547",
"0.67445284",
"0.6716347",
"0.66994524",
"0.669735",
"0.6688417",
"0.6652969",
"0.66500425",
"0.66496146",
"0.66496146",
"0.658235",
"0.6564572",
"0.65176713",
"0.6481492",
"0.6459424",
"0.64517134",
"0.64514965",
"0.6385591",
"0.6380773",
"0.63719714",
"0.6363133",
"0.6360097",
"0.6330378",
"0.6322758",
"0.6313905",
"0.631311",
"0.6290952",
"0.6230217",
"0.6209509",
"0.6204752",
"0.6190393",
"0.6169446",
"0.6159755",
"0.6159068",
"0.61565185",
"0.614664",
"0.6146393",
"0.6146393",
"0.61455536",
"0.6137899",
"0.6137899",
"0.6137899",
"0.6137899",
"0.6137899",
"0.6137899",
"0.6127833",
"0.6111789",
"0.6074188",
"0.6074188",
"0.60538024",
"0.60491264",
"0.60354644",
"0.60110354",
"0.5980558",
"0.59753495",
"0.59709525",
"0.59136593",
"0.59128344",
"0.58638287",
"0.5863353"
] | 0.78466207 | 5 |
Returns if the given password match the encoded password. | def verify(_password, _encoded)
raise NotImplementedError
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def password_encoded?(password)\n reg_ex_test = \"^([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{4}|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{2}==)$\"\n\n if password =~ /#{reg_ex_test}/ then\n return true\n else\n return false\n end\n end",
"def password_match? password\n\t\tBCrypt::Password.new(@password) == password\n\tend",
"def matching_password?(pass)\n self.password_hash == encrypt_password(pass)\n end",
"def password_match?(login_password)\n\t\tencrypted_password == encrypt(login_password)\t\n\tend",
"def check_password(password)\n return false unless key\n key == self.class.hash_password(password, key.split('|', 2).first)\n end",
"def match_password(login_password=\"\")\n password == BCrypt::Engine.hash_secret(login_password, salt)\n end",
"def has_password?(password)\n encrypted_password == encrypt(password)\n end",
"def has_password?(submitted_password)\n password == encrypt(submitted_password)\n end",
"def password_match?( password=\"\")\n hashedPassword == Admin.hash_with_salt(password, salt)\n end",
"def matches_password(login_password)\n passhash == BCrypt::Engine.hash_secret(login_password, salt)\n end",
"def password_match?(password=\"\")\n hashed_password == User.hash_with_salt(password, salt)\n end",
"def password_match?(password=\"\")\n hashed_password == User.hash_with_salt(password, salt)\n end",
"def has_password?( submitted_password )\n encrypted_password == encrypt( submitted_password )\n end",
"def password_match?(entered_password = '')\n password == User.hash_with_salt(entered_password, salt)\n end",
"def has_password?(submitted_password)\r\n encrypted_password == encrypt(submitted_password)\r\n end",
"def match_password(password, password_cofirmation)\n return (password==password_cofirmation) ? true : false\n end",
"def valid_password?(plain)\n password == hash_crypt(plain.to_s) \n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def check_pw pw\n (encrypt pw) == (self[:password])\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def password_match?(password=\"\")\n hashed_password == AdminUser.hash_with_salt(password, salt)\n end",
"def password_match?(password=\"\")\n hashed_password == AdminUser.hash_with_salt(password, salt)\n end",
"def valid_password?(password)\n V1::Auth::Encryptor.compare(encrypted_password, password)\n end",
"def valid_password?(password); end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n # Compare encrypted password with the encrypted version of\n # Submitted password\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(a_password)\n self.encrypted_password == encrypt(a_password)\n end",
"def has_password?(submitted_password)\n\tpassword == encrypt(submitted_password) \n end",
"def valid_password? password\r\n self.password === Digest::MD5.hexdigest(password)[0..19]\r\n end",
"def has_password?(submitted_password)\n self.password == encrypt(submitted_password)\n end",
"def has_password? (submitted_password)\n password_digest == encrypt(submitted_password)\n end",
"def match_password_basic(p)\n puts \"p: #{p}\"\n puts \"password: #{password}\"\n p == password\n end",
"def has_password?(submitted_password)\n # compare encrypted_password with the encrypted version of submitted_password\n encrypted_password == encrypt(submitted_password)\n end",
"def is_password?(password)\n BCrypt::Password.new(self.password_digest) == password\n end",
"def password_is?(password)\n ENCRYPT.hexdigest(password + self.salt) == self.encrypted_password\n end",
"def has_password?(submitted_password)\n #compare encrypted_password with the encrypted version of submitted password.\n password == submitted_password\n end",
"def has_password?(submitted_password)\n # Compare encrypted_password with the encrypted version of\n # submitted_password.\n\t encrypted_password == encrypt(submitted_password)\n end",
"def valid_password?(password)\n true\n end",
"def has_password?(password_soumis)\n\t\t# Compare encrypted_password avec la version cryptée de password_soumis.\n encrypted_password == encrypt(password_soumis)\n end",
"def has_password?(submitted_password)\n # Compare encrypted_password with the encrypted version of\n # submitted_password.\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n # Compare encrypted_password with the encrypted version of\n # submitted_password.\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n # Compare encrypted_password with the encrypted version of\n # submitted_password.\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n # Compare encrypted_password with the encrypted version of\n # submitted_password.\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n # Compare encrypted_password with the encrypted version of\n # submitted_password.\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n # Compare encrypted_password with the encrypted version of\n # submitted_password.\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n # Compare encrypted_password with the encrypted version of\n # submitted_password.\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n #Compare encrypted_password with the encrypted version of \n # submitted_password.\n encrypted_password == encrypt(submitted_password)\n end",
"def hasSamePassword?(submittedPassword)\n encrypted_password == encryptUsingSalt(submittedPassword)\n end",
"def is_password?(password)\n obj = Password.new(self.password_digest)\n obj.is_password?(password)\n end",
"def password_is?(pw)\n Digest::MD5.hexdigest(pw + password_salt) == password_hash\n end",
"def valid_password?(password)\n Authentication::Encryptor.compare(self.encrypted_password, password)\n end",
"def has_password?(password_soumis)\n # Compare encrypted_password avec la version cryptée de password_soumis.\n encrypted_password == encrypt(password_soumis)\n end",
"def has_password?(submitted_password)\n\t\t# Compare encrypted password with the encrypted version of the submitted password\n\t\tencrypted_password == encrypt(submitted_password)\n\tend",
"def valid_password?(password, encrypted_password)\n\treturn false if encrypted_password.blank?\n\tbcrypt = ::BCrypt::Password.new(encrypted_password)\n pepper = \"39dd46bfe0dee2d2f5b98862b6b8bf24b736ee877efd5df95f48cf6ca5310b72d267f216d6138684de626297f2927ed7e99106058013e5d66d0b8ff3af8a234a\"\n\tpassword1 = ::BCrypt::Engine.hash_secret(\"#{password}#{pepper}\", bcrypt.salt)\n\tputs password1\n\tpassword = ::BCrypt::Engine.hash_secret(\"#{password}#{SecureRandom.hex(64)}\", bcrypt.salt)\n\tputs password\n\tputs encrypted_password\n\tstr = [password, nil].flatten.compact.join\n\tsecure_compare(Digest::MD5.hexdigest(str), encrypted_password)\n end",
"def valid_password?(password)\n begin\n super(password)\n rescue BCrypt::Errors::InvalidHash\n type, salt, enc_pass = encrypted_password.split('$')\n Digest::SHA1.hexdigest(\"#{salt}#{password}\") == enc_pass\n end\n end",
"def has_password?(submitted_password)\n\t # Compare encrypted_password with the encrypted version of\n\t # submitted_password.\n\t encrypted_password == encrypt(submitted_password)\n\tend",
"def matching_passwords(params)\n if params[\"Password\"] == params[\"Confirmed_password\"]\n return true \n else \n return false\n end \n end",
"def cdb_verify_password(given_password)\n encrypt_password(given_password) == @password\n end",
"def passwords_match?\n context.user.password == context.password\n end",
"def matches?(password, secret = nil)\n self.class.verify_password(password, digest, secret)\n end",
"def has_password? pass\n WodaHash.digest(self.pass_salt + pass).to_hex.downcase == pass_hash.downcase\n end",
"def password_match?\n self.password == self.password_confirmation\n end",
"def is_valid_password?(password)\n\t\tself.password == BCrypt::Engine.hash_secret(password, self.password)\n\tend",
"def has_password?(submitted_password)\n self.encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n\tencrypted_password == encrypt(submitted_password)\nend",
"def verify_password(password)\n hash_password(password) == @password_hash\n end",
"def hasPassword?(passwordSoumis)\n\t\tself.encrypted_password == encrypt(passwordSoumis)\n\tend",
"def is_password?(password)\n BCrypt::Password.new(password_digest).is_password?(password)\n end",
"def has_password?(submitted_password)\n # Compare encrypted_password with the encrypted version of\n # submitted_password.\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n \t\t# Compare encrypted_password with the encrypted version of\n \t\t# submitted_password.\n\t\tencrypted_password == encrypt(submitted_password)\n \tend",
"def has_password?(submitted_password)\n\t\t# compare encrypted_password with the encrypted version of submitted_password\n\t\tencrypted_password == encrypt(submitted_password)\n\tend",
"def is_password?(password)\n BCrypt::Password.new(self.password_digest).is_password?(password)\n end",
"def is_password?(password)\n BCrypt::Password.new(self.password_digest).is_password?(password)\n end",
"def is_password(password)\n BCrypt::Password.new(password_digest).is_password?(password)\n end",
"def has_password?(submitted_password)\n # compare encrypted_password with the encrypted version of\n # the submitted password.\n\tencrypted_password == encrypt(submitted_password)\n end",
"def check_password(password, hash)\n BCrypt::Password.new(hash) == password\n end",
"def has_password?(submitted_password)\n\t# Compare encrypted_password with the encrypted version of\n\t# submitted_password.\n\t\tencrypted_password == encrypt(submitted_password)\n\tend",
"def has_password?(submitted_password)\n # Return true if the user's password matches the submitted password.\n # Compare encrypted_password with the encrypted version of submitted_password\n encrypted_password == encrypt(submitted_password) \n end",
"def compare_pass (pass)\r\n return self.encrypted_password == sha_hash(\"#{pass}--#{self.salt}\")\r\n end",
"def password_match?\n add_password_match_error if password != password_confirmation\n\n password == password_confirmation && !password.blank?\n end",
"def valid_password?(password)\n BCrypt::Password.new(self.password_digest).is_password?(password)\n end",
"def valid_password?(password)\n BCrypt::Password.new(self.password_digest).is_password?(password)\n end",
"def is_password?(password)\n BCrypt::Password.new(self.password_digest).is_password?(password)\n end",
"def has_password?(submitted_password)\n # Compare encrypted_password with the encrypted version of # submitted_password.\n encrypt(submitted_password) == encrypted_password\n end",
"def valid_password?(password)\n bcrypt = BCrypt::Password.new(encrypted_password)\n password = BCrypt::Engine.hash_secret(\"#{password}#{PEPPER}\", bcrypt.salt)\n self.class.secure_compare(password, encrypted_password)\n end",
"def valid_pass?(test_pass)\n Encrypt::Password.validatePassword test_pass, password\n end"
] | [
"0.8292634",
"0.8250844",
"0.8242472",
"0.8111532",
"0.79036313",
"0.7891534",
"0.7811354",
"0.7770088",
"0.77575773",
"0.77467626",
"0.7722079",
"0.7722079",
"0.7704711",
"0.7691086",
"0.76547784",
"0.764005",
"0.76346636",
"0.76341325",
"0.76341325",
"0.7630522",
"0.7627207",
"0.7627207",
"0.7627207",
"0.7627207",
"0.7627207",
"0.7627207",
"0.7627207",
"0.7627207",
"0.7627207",
"0.7627207",
"0.7627207",
"0.7627207",
"0.7627207",
"0.7613002",
"0.7613002",
"0.76045763",
"0.7587747",
"0.75875086",
"0.75875086",
"0.75859237",
"0.7563708",
"0.7563545",
"0.7542662",
"0.75274897",
"0.751013",
"0.75099605",
"0.75061685",
"0.75017893",
"0.749232",
"0.7477052",
"0.7465068",
"0.7459235",
"0.7457461",
"0.7457133",
"0.7456985",
"0.7456985",
"0.7456985",
"0.7456985",
"0.7456985",
"0.7456985",
"0.7456985",
"0.7453159",
"0.7441024",
"0.74262905",
"0.74261796",
"0.74247676",
"0.7422751",
"0.74147415",
"0.74030274",
"0.74005353",
"0.73945737",
"0.73913544",
"0.73876935",
"0.73622537",
"0.7358804",
"0.7352561",
"0.7345341",
"0.7341953",
"0.7338609",
"0.7328845",
"0.7322748",
"0.7320885",
"0.73137605",
"0.73070437",
"0.73041195",
"0.7290918",
"0.7274316",
"0.7274316",
"0.72731787",
"0.7266498",
"0.7256906",
"0.72496396",
"0.72471577",
"0.7244641",
"0.7242667",
"0.7237735",
"0.7237735",
"0.72279435",
"0.72202325",
"0.71949345",
"0.7189188"
] | 0.0 | -1 |
Returns given password encoded with the given salt. | def encode(_password, _salt)
raise NotImplementedError
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def encrypt(password, salt)\n Digest::SHA1.hexdigest(\"--#{salt}--#{password}--\")\n end",
"def encrypt(password, salt)\n Digest::SHA1.hexdigest(\"--#{salt}--#{password}--\")\n end",
"def encrypt(password, salt)\n Digest::SHA1.hexdigest(\"--#{salt}--#{password}--\")\n end",
"def encrypt(password, salt)\n Digest::SHA1.hexdigest(\"--#{salt}--#{password}--\")\n end",
"def encrypt(password, salt)\n Digest::SHA1.hexdigest(\"--#{salt}--#{password}--\")\n end",
"def encrypt(password, salt)\n Digest::SHA1.hexdigest(\"--#{salt}--#{password}--\")\n end",
"def encrypt(password, salt)\n Digest::SHA1.hexdigest(\"--#{salt}--#{password}--\")\n end",
"def encrypt(password, salt)\n Digest::SHA1.hexdigest(password + salt)\n end",
"def encrypt(password, salt)\n Digest::SHA1.hexdigest(\"--#{salt}--#{password}--\")\n end",
"def encrypt(password, salt=nil)\n salt ||= self.salt\n Digest::SHA1.hexdigest(\"--#{salt}--#{password}--\")\n end",
"def salt_password( authkey, password )\n combined = authkey.to_s + password.to_s\n return Digest::MD5.hexdigest(combined)\n end",
"def make_salt\n secure_hash(\"#Time.now.utc}--#{password}\")\n end",
"def make_salt\n secure_hash(\"#{Time.now.utc}--#{password}\")\n end",
"def make_salt\n secure_hash(\"#{Time.now.utc}--#{password}\")\n end",
"def password_salt\n \"choujin-steiner\"\n end",
"def encode(plain_pass)\n md5 salt + plain_pass + salt\n end",
"def password_hash(salt, password)\n opslimit = 2**20\n memlimit = 2**24\n digest_size = 64\n\n RbNaCl::PasswordHash.scrypt(password, salt, opslimit, memlimit, digest_size)\n end",
"def make_salt\n\t secure_hash(\"#{Time.now.utc}--#{password}\")\n\tend",
"def make_salt\n secure_hash(\"#{Time.now.utc}--#{password_digest}\")\n end",
"def encrypt_password(password)\n self.class.secure_digest([password, password_salt])\n end",
"def encrypt(password) #, salt)\n Digest::MD5.hexdigest(password)\n end",
"def encrypt(password, salt)\n Digest::SHA1.hexdigest(\"--#{salt}--NaCl--#{password}--\")\n end",
"def mutate_bcrypt_salt(_)\n 'au6lOASvp17AGsqkmE7'\n end",
"def encrypt(password)\n User.password_digest(password, salt)\n end",
"def encrypt(password, salt = self.salt)\n generate_encrypted_hash(password, salt)\n end",
"def salt\n return NSEC3.encode_salt(@salt)\n end",
"def crypt3(password, salt = nil)\n characters = [ (\"A\" .. \"Z\").to_a, (\"a\" .. \"z\").to_a, (0 .. 9).to_a, \".\", \"/\" ].flatten\n if salt.nil?\n salt = \"\"\n 1.upto(8) { |index| salt = [salt, characters[rand(characters.length)].to_s].join }\n end\n encrypt = UnixCrypt::MD5.build(password, salt)\n return [\"{CRYPT}\", encrypt].join\n end",
"def encrypt_password(pass)\n BCrypt::Engine.hash_secret(pass, password_salt)\n end",
"def encrypt(password, salt = self.generate_salt)\n serialize(hash(password, salt), salt)\n end",
"def get_salt\n @salt ||= BCrypt::Engine.generate_salt\n end",
"def encrypt_password(password, salt, hash)\n case hash.to_s\n when 'sha256'\n Digest::SHA256.hexdigest(\"#{password}-#{salt}\")\n else\n raise 'Unsupported hash algorithm'\n end\n end",
"def salted_hash(password)\n salt = SecureRandom.random_bytes(SALT_BYTE_SIZE)\n pbkdf2 = OpenSSL::PKCS5::pbkdf2_hmac_sha1(\n password,\n salt,\n CRYPTERATIONS,\n HASH_BYTE_SIZE)\n\n { salt: salt, pbkdf2: Base64.encode64(pbkdf2) }\n end",
"def encode_pass_word val\n Sequel.lit \"\\ncrypt(\\n?\\n, gen_salt('bf', 13))\", val\n end",
"def crypt(salt=nil)\n salt ||= ((SecureRandom.random_number(26) +\n (SecureRandom.random_number(2) == 0 ? 65 : 97)).chr +\n (SecureRandom.random_number(26) +\n (SecureRandom.random_number(2) == 0 ? 65 : 97)).chr)\n _crypt(salt)\n end",
"def code_salt\n 'fbbc13ed4a51e27608037365e1d27a5f992b6339'\n end",
"def salted_sha_encrypt(password)\n self.class.local_encrypt(password, salt)\n end",
"def salt() 'monkeynutzzSfaKT7CwImCHCH8Ow' end",
"def make_salt\r\n self.salt = sha_hash(\"#(Time.now.to_s)--#(self.password)\")\r\n end",
"def authenticatable_salt\n encrypted_password[0,29] if encrypted_password\n end",
"def encrypt_password\n self.password_salt = BCrypt::Engine.generate_salt\n self.password_hash = BCrypt::Engine.hash_secret(password, password_salt)\n end",
"def encrypt(password)\n self.class.encrypt(password) #, salt)\n end",
"def hash(password, salt)\n Digest::SHA512.hexdigest(\"#{ password }:#{ salt }\")\n end",
"def password_encrypt\n if password.present?\n self.password_salt = BCrypt::Engine.generate_salt\n self.password_hash = BCrypt::Engine.hash_secret(password, password_salt)\n end\n end",
"def salt\n p_salt(profile.salt_bytes)\n end",
"def make_pw_hash(pw, salt = nil)\n salt = make_salt unless salt\n BCrypt::Password.create(pw + salt) + ',' + salt\n end",
"def encrypt_password\n if self.password.present?\n self.salt = BCrypt::Engine.generate_salt\n self.password = BCrypt::Engine.hash_secret(password, self.salt)\n end\n end",
"def encrypt(password)\n self.class.encrypt(password, salt)\n end",
"def encrypt(password)\n self.class.encrypt(password, salt)\n end",
"def encrypt(password)\n self.class.encrypt(password, salt)\n end",
"def encrypt(password)\n self.class.encrypt(password, salt)\n end",
"def encrypt(password)\n self.class.encrypt(password, salt)\n end",
"def encrypt(password)\n self.class.encrypt(password, salt)\n end",
"def encrypt(password)\n self.class.encrypt(password, salt)\n end",
"def encrypt(password)\n self.class.encrypt(password, salt)\n end",
"def encrypt(password)\n self.class.encrypt(password, salt)\n end",
"def encrypt(password)\n self.class.encrypt(password, salt)\n end",
"def encrypt(password)\n self.class.encrypt(password, salt)\n end",
"def encrypt(password)\n self.class.encrypt(password, salt)\n end",
"def encrypt(password)\n self.class.encrypt(password, salt)\n end",
"def encrypt(password)\n self.class.encrypt(password, salt)\n end",
"def encrypt(password)\n self.class.encrypt(password, salt)\n end",
"def encrypt(password)\n self.class.encrypt(password, salt)\n end",
"def encrypt(password)\n self.class.encrypt(password, salt)\n end",
"def encrypt(password)\n self.class.encrypt(password, salt)\n end",
"def encrypt(password)\n self.class.encrypt(password, salt)\n end",
"def encrypt(password)\n self.class.encrypt(password, salt)\n end",
"def encrypt(password)\n self.class.encrypt(password, salt)\n end",
"def encrypt(password)\n self.class.encrypt(password, salt)\n end",
"def encrypt(password)\n self.class.encrypt(password, salt)\n end",
"def encrypt(password)\n self.class.encrypt(password, salt)\n end",
"def encrypt(password)\n self.class.encrypt(password, salt)\n end",
"def encrypt(password)\n self.class.encrypt(password, salt)\n end",
"def encrypt(password)\n self.class.encrypt(password, salt)\n end",
"def encrypt(password)\n self.class.encrypt(password, salt)\n end",
"def encrypt(password)\n self.class.encrypt(password, salt)\n end",
"def encrypt(password)\n self.class.encrypt(password, salt)\n end",
"def encrypt(password)\n self.class.encrypt(password, salt)\n end",
"def encrypt(password)\n self.class.encrypt(password, salt)\n end",
"def encrypt(password)\n self.class.encrypt(password, salt)\n end",
"def encrypt(password)\n self.class.encrypt(password, salt)\n end",
"def encrypt(password)\n self.class.encrypt(password, salt)\n end",
"def encrypt(password)\n self.class.encrypt(password, salt)\n end",
"def encrypt(password)\n self.class.encrypt(password, salt)\n end",
"def encrypt(password)\n self.class.encrypt(password, salt)\n end",
"def encrypt(password)\n self.class.encrypt(password, salt)\n end",
"def encrypt(password)\n self.class.encrypt(password, salt)\n end",
"def encrypt(password)\n self.class.encrypt(password, salt)\n end",
"def encrypt(password)\n self.class.encrypt(password, salt)\n end",
"def encrypt(password)\n self.class.encrypt(password, salt)\n end",
"def encrypt(password)\n self.class.encrypt(password, salt)\n end",
"def encrypt(password)\n self.class.encrypt(password, salt)\n end",
"def encrypt(password)\n self.class.encrypt(password, salt)\n end",
"def encrypt(password)\n self.class.encrypt(password, salt)\n end",
"def encrypt(password)\n self.class.encrypt(password, salt)\n end",
"def encrypt(password)\n self.class.encrypt(password, salt)\n end",
"def encrypt(password)\n self.class.encrypt(password, salt)\n end",
"def encrypt(password)\n self.class.encrypt(password, salt)\n end",
"def encrypt(password)\n self.class.encrypt(password, salt)\n end",
"def encrypt(password)\n self.class.encrypt(password, salt)\n end",
"def encrypt(password)\n self.class.encrypt(password, salt)\n end"
] | [
"0.7344556",
"0.7344556",
"0.7344556",
"0.7344556",
"0.7344556",
"0.7344556",
"0.7296721",
"0.7277346",
"0.71848965",
"0.70527714",
"0.70500624",
"0.70409435",
"0.7022958",
"0.7022958",
"0.6999717",
"0.6926968",
"0.6910913",
"0.68941855",
"0.6891788",
"0.6835064",
"0.67956614",
"0.6791892",
"0.67106277",
"0.6709918",
"0.66732216",
"0.6671954",
"0.6652568",
"0.663011",
"0.6621092",
"0.66180474",
"0.66161805",
"0.6613094",
"0.6602915",
"0.6587819",
"0.65695286",
"0.65589446",
"0.65489286",
"0.65389997",
"0.6521512",
"0.6507181",
"0.6506853",
"0.6504398",
"0.64732087",
"0.6468003",
"0.6463878",
"0.6462108",
"0.64621043",
"0.64621043",
"0.64621043",
"0.64621043",
"0.64621043",
"0.64621043",
"0.64621043",
"0.64621043",
"0.64621043",
"0.64621043",
"0.64621043",
"0.64621043",
"0.64621043",
"0.64621043",
"0.64621043",
"0.64621043",
"0.64621043",
"0.64621043",
"0.64621043",
"0.64621043",
"0.64621043",
"0.64621043",
"0.64621043",
"0.64621043",
"0.64621043",
"0.64621043",
"0.64621043",
"0.64621043",
"0.64621043",
"0.64621043",
"0.64621043",
"0.64621043",
"0.64621043",
"0.64621043",
"0.64621043",
"0.64621043",
"0.64621043",
"0.64621043",
"0.64621043",
"0.64621043",
"0.64621043",
"0.64621043",
"0.64621043",
"0.64621043",
"0.64621043",
"0.64621043",
"0.64621043",
"0.64621043",
"0.64621043",
"0.64621043",
"0.64621043",
"0.64621043",
"0.64621043",
"0.64621043"
] | 0.7387263 | 0 |
Returns if given encoded password needs to be updated. | def must_update(_encoded)
false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def password_update?(new_pass)\n return false if current_resource.info['rep:password'].end_with?(\n hash_generator(new_pass)\n )\n true\n end",
"def has_password?( submitted_password )\n encrypted_password == encrypt( submitted_password )\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def password_encoded?(password)\n reg_ex_test = \"^([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{4}|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{2}==)$\"\n\n if password =~ /#{reg_ex_test}/ then\n return true\n else\n return false\n end\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\r\n encrypted_password == encrypt(submitted_password)\r\n end",
"def will_save_change_to_encrypted_password?\n changed.include? 'encrypted_password'\n end",
"def has_password?(submitted_password)\n password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def check_pw pw\n (encrypt pw) == (self[:password])\n end",
"def needs_password_update?\n password_hash.empty? or not password.empty?\n end",
"def has_password?(submitted_password)\n self.password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n\tpassword == encrypt(submitted_password) \n end",
"def has_password?\n encrypted_password_was.present?\n end",
"def has_password?(password)\n encrypted_password == encrypt(password)\n end",
"def valid_password?(password); end",
"def using_password?\n\t\t\t\t!send(crypted_password_field).blank?\n\t\t\tend",
"def should_encrypt_password\n @encrypt_password_flag || false\n end",
"def has_password?(submitted_password)\n\tencrypted_password == encrypt(submitted_password)\nend",
"def password_match?(login_password)\n\t\tencrypted_password == encrypt(login_password)\t\n\tend",
"def has_password? (submitted_password)\n password_digest == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n self.encrypted_password == encrypt(submitted_password)\n end",
"def password_changed?\n Candidate.password_changed?(password)\n # !valid_password?(Event::Other::INITIAL_PASSWORD)\n end",
"def valid_password?(password)\n if self.legacy_password_hash.present?\n if ::Digest::MD5.hexdigest(password).upcase == self.legacy_password_hash.upcase\n self.password = password\n self.legacy_password_hash = nil\n self.save!\n true\n else\n false\n end\n else\n super\n end\n end",
"def has_password?(a_password)\n self.encrypted_password == encrypt(a_password)\n end",
"def check_password_changed\n self.temp_password = nil if ( changed.include?('encrypted_password') && !(changed.include?('temp_password')))\n end",
"def can_edit_password?\n encrypted_password.present?\n end",
"def password_changed?\n !@new_password.blank?\n end",
"def password_changed?\n !@new_password.blank?\n end",
"def password_changed?\n !@new_password.blank?\n end",
"def password_match? password\n\t\tBCrypt::Password.new(@password) == password\n\tend",
"def has_password?(submitted_password)\n # compare encrypted_password with the encrypted version of submitted_password\n encrypted_password == encrypt(submitted_password)\n end",
"def matching_password?(pass)\n self.password_hash == encrypt_password(pass)\n end",
"def password_is?(password)\n ENCRYPT.hexdigest(password + self.salt) == self.encrypted_password\n end",
"def valid_password?(password)\n begin\n super(password)\n rescue BCrypt::Errors::InvalidHash\n sha1_password = Digest::SHA1.hexdigest(\"--#{password_salt}--#{password}--\")\n return false unless sha1_password == encrypted_password\n logger.info \"User #{email} is using the old password hashing method, updating attribute.\"\n self.password = password # = BCrypt::Password.create(sha1_password)\n true\n end\n end",
"def need_change_password?\n password_change_requested? || password_too_old?\n end",
"def hasPassword?(passwordSoumis)\n\t\tself.encrypted_password == encrypt(passwordSoumis)\n\tend",
"def valid_password?(password)\n if self.respond_to?('legacy_password_hash') && self.legacy_password_hash.present?\n if BCrypt::Password.new(self.legacy_password_hash) == password\n self.password = password\n self.legacy_password_hash = nil\n self.save!\n true\n else\n false\n end\n else\n super\n end\n end",
"def has_password?(submitted_password)\n # Compare encrypted password with the encrypted version of\n # Submitted password\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n # Compare encrypted_password with the encrypted version of\n # submitted_password.\n\t encrypted_password == encrypt(submitted_password)\n end",
"def valid_password?(password)\n true\n end",
"def should_validate_password?\n updating_password || new_record?\n end",
"def hasSamePassword?(submittedPassword)\n encrypted_password == encryptUsingSalt(submittedPassword)\n end",
"def check_password(password)\n return false unless key\n key == self.class.hash_password(password, key.split('|', 2).first)\n end",
"def has_password?(submitted_password)\n #Compare encrypted_password with the encrypted version of \n # submitted_password.\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n # Compare encrypted_password with the encrypted version of\n # submitted_password.\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n # Compare encrypted_password with the encrypted version of\n # submitted_password.\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n # Compare encrypted_password with the encrypted version of\n # submitted_password.\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n # Compare encrypted_password with the encrypted version of\n # submitted_password.\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n # Compare encrypted_password with the encrypted version of\n # submitted_password.\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n # Compare encrypted_password with the encrypted version of\n # submitted_password.\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n # Compare encrypted_password with the encrypted version of\n # submitted_password.\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n\t # Compare encrypted_password with the encrypted version of\n\t # submitted_password.\n\t encrypted_password == encrypt(submitted_password)\n\tend",
"def is_password?(password)\n BCrypt::Password.new(self.password_digest) == password\n end",
"def password_is?(pw)\n Digest::MD5.hexdigest(pw + password_salt) == password_hash\n end",
"def has_password?(password_soumis)\n\t\t# Compare encrypted_password avec la version cryptée de password_soumis.\n encrypted_password == encrypt(password_soumis)\n end",
"def should_validate_password?\n updating_password || new_record?\n end",
"def should_validate_password?\n \tupdating_password || new_record?\n end",
"def password_changed?\n !self.password.blank? or self.encrypted_password.blank?\n end",
"def has_password?(password_soumis)\n # Compare encrypted_password avec la version cryptée de password_soumis.\n encrypted_password == encrypt(password_soumis)\n end",
"def has_password?(submitted_password)\n # compare encrypted_password with the encrypted version of\n # the submitted password.\n\tencrypted_password == encrypt(submitted_password)\n end",
"def password_changed?\n !password.blank?\n end",
"def has_password?(submitted_password)\n # Compare encrypted_password with the encrypted version of\n # submitted_password.\n encrypted_password == encrypt(submitted_password)\n end",
"def password_changed?\n orig_pw_hash = self.instance_variable_get(:@old_password_hash)\n self.new_record? || (!orig_pw_hash.nil? && orig_pw_hash != self.password_hash)\n end",
"def valid_password?(plain)\n password == hash_crypt(plain.to_s) \n end",
"def has_password?(submitted_password)\n #compare encrypted_password with the encrypted version of submitted password.\n password == submitted_password\n end",
"def has_password?(submitted_password)\n\t\t# Compare encrypted password with the encrypted version of the submitted password\n\t\tencrypted_password == encrypt(submitted_password)\n\tend",
"def valid_password?(password)\n if encrypted_password.present?\n super\n else\n \n old_password == Digest::SHA1.hexdigest(LAGACY_SALT + password)\n end\n end",
"def has_password?(submitted_password)\n\t\t# compare encrypted_password with the encrypted version of submitted_password\n\t\tencrypted_password == encrypt(submitted_password)\n\tend",
"def challenge_password?\n !read_attributes_by_oid('challengePassword').nil?\n end",
"def correct_password?(params)\n current_password = params[:pd_user][:current_password]\n return (password == current_password)\n end",
"def correct_password?(params)\n self.current_password = params[:user][:current_password]\n self.password == self.current_password\n end",
"def has_password?(submitted_password)\n \t\t# Compare encrypted_password with the encrypted version of\n \t\t# submitted_password.\n\t\tencrypted_password == encrypt(submitted_password)\n \tend",
"def password?\n !crypt_pass.nil? && !salt.nil?\n end",
"def password_changeable?\n @password_changeable\n end",
"def is_password?(password)\n BCrypt::Password.new(self.password_digest).is_password?(password)\n end",
"def is_password?(password)\n BCrypt::Password.new(self.password_digest).is_password?(password)\n end",
"def verify(_password, _encoded)\n raise NotImplementedError\n end",
"def valid_password? password\r\n self.password === Digest::MD5.hexdigest(password)[0..19]\r\n end",
"def should_validate_password?\n if self.crypted_password_changed?\n return true\n elsif self.force_password_validation\n return true\n else\n return false\n end\n end",
"def match_password(login_password=\"\")\n password == BCrypt::Engine.hash_secret(login_password, salt)\n end",
"def password?\n password\n end",
"def has_password?(submitted_password)\n\t# Compare encrypted_password with the encrypted version of\n\t# submitted_password.\n\t\tencrypted_password == encrypt(submitted_password)\n\tend",
"def is_password?(password_attempt)\n\t\tBCrypt::Password.new(password_digest).is_password?(password_attempt)\n\tend",
"def valid_password?(password)\n begin\n super(password)\n rescue BCrypt::Errors::InvalidHash\n type, salt, enc_pass = encrypted_password.split('$')\n Digest::SHA1.hexdigest(\"#{salt}#{password}\") == enc_pass\n end\n end",
"def has_password? pass\n WodaHash.digest(self.pass_salt + pass).to_hex.downcase == pass_hash.downcase\n end"
] | [
"0.79622346",
"0.7473102",
"0.74606514",
"0.74606514",
"0.7444055",
"0.7433514",
"0.7433514",
"0.7433514",
"0.7433514",
"0.7433514",
"0.7433514",
"0.7433514",
"0.7433514",
"0.7433514",
"0.7433514",
"0.7433514",
"0.7433514",
"0.7433514",
"0.7433023",
"0.74207824",
"0.7402928",
"0.7389332",
"0.7389332",
"0.73717105",
"0.73595256",
"0.7346828",
"0.73440707",
"0.7338369",
"0.7337106",
"0.732888",
"0.7294535",
"0.72816604",
"0.72659606",
"0.7254065",
"0.72516656",
"0.7249856",
"0.7217329",
"0.7213436",
"0.720198",
"0.7165905",
"0.71557415",
"0.7155169",
"0.71537274",
"0.71537274",
"0.71450096",
"0.71425986",
"0.7141415",
"0.71378297",
"0.7134002",
"0.71220624",
"0.71195084",
"0.7116378",
"0.7106074",
"0.70996034",
"0.7078986",
"0.7062819",
"0.7062577",
"0.70519394",
"0.7050688",
"0.7049832",
"0.70443296",
"0.70443296",
"0.70443296",
"0.70443296",
"0.70443296",
"0.70443296",
"0.70443296",
"0.7039905",
"0.70392656",
"0.7017568",
"0.699864",
"0.6995743",
"0.6995638",
"0.6983151",
"0.69789",
"0.69767416",
"0.69669694",
"0.69667685",
"0.6954411",
"0.6940301",
"0.6940221",
"0.6938421",
"0.69187135",
"0.6916504",
"0.6901385",
"0.6895908",
"0.68939316",
"0.688096",
"0.6870963",
"0.68657666",
"0.6863294",
"0.6863294",
"0.6861829",
"0.6861442",
"0.68598115",
"0.6858722",
"0.6851617",
"0.6846532",
"0.6845509",
"0.683617",
"0.6834578"
] | 0.0 | -1 |
GET /contents/1 GET /contents/1.json | def show
add_breadcrumb @content, corkboard_content_path(@corkboard, @content)
respond_to do |format|
format.html # show.html.erb
format.json { render json: @content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @contents = Content.all\n render json: @contents\n end",
"def index\n @contents = Content.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contents }\n end\n end",
"def index\n\n @contents = Content.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contents }\n end\n end",
"def index\n @contents = Content.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @contents }\n end\n end",
"def index\n @contents = Content.order('created_at DESC').paginate(:page => params[:page], :per_page => 20)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contents }\n end\n end",
"def index\n @contents = Content.all\n\n respond_with @contents\n end",
"def index\n @contents = Content.all\n end",
"def index\n @contents = Content.all\n end",
"def get\n @contents\n end",
"def index\n # @contents = Content.all\n end",
"def index\n @title = t 'view.contents.index_title'\n @searchable = true\n @contents = @contents.filtered_list(params[:q]).page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contents }\n end\n end",
"def json_index_static_contents\n\n @static_contents = StaticContent.all\n respond_to do |format|\n\n format.json { render json: @static_contents }\n end\n end",
"def index\n puts \"index\"\n @contents = Content.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.js\n \n format.json { render json: @contents }\n end\n end",
"def get_content(content_id, params = {})\n get_json(content_url(content_id, params))\n end",
"def show\n @content = Content.find(params[:id])\n\n respond_with @content\n\n # @contents = Content.all\n\n # respond_with @content\n end",
"def show\n @content = Content.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @content }\n end\n end",
"def show\n @content = Content.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @content }\n end\n end",
"def show\n @content = Content.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @content }\n end\n end",
"def show\n @content = Content.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @content }\n end\n end",
"def show\n @content = Content.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @content }\n end\n end",
"def show\n @content = Content.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @content }\n end\n end",
"def show\n @content = Content.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @content }\n end\n end",
"def show\n @content = Content.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @content }\n end\n end",
"def show\n # TODO: this is a placeholder for logic using Sentence\n render :json => { :index => params[:id],\n :contents => \"SERVER: this would be the contents of page \" + params[:id]\n }\n end",
"def index\n @static_contents = StaticContent.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @static_contents }\n end\n end",
"def get_page_contents()\n JSON.parse( \n @client.api.get(\"#{@client.base_uri.path}/api.php?#{URI.encode_www_form({\n :action => 'query',\n :prop => 'info|revisions',\n :titles => BAN_PAGE,\n :rvprop => 'content',\n :intoken => 'edit',\n :indexpageids => 1,\n :format => 'json',\n :cb => rand(1000000)\n })}\", @headers).body,\n :symbolize_names => true\n )[:query]\n end",
"def show\n @main_content = MainContent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @main_content }\n end\n end",
"def get_page_contents(title)\n JSON.parse( \n @client.api.get(\"#{@client.base_uri.path}/api.php?#{URI.encode_www_form({\n :action => 'query',\n :prop => 'info|revisions',\n :titles => title,\n :rvprop => 'content',\n :intoken => 'edit',\n :indexpageids => 1,\n :format => 'json',\n :cb => rand(1000000)\n })}\", @headers).body,\n :symbolize_names => true\n )[:query]\n end",
"def content_index\n @magissue = Magissue.find(params[:id])\n # Initiate the array of contents' links\n a = []\n\n # Insert the link to the cover first\n a << {\"url\" => cover_magissue_url, \"title\" => \"Cover\", \"hidden\" => true}\n\n\n # Insert the link to the toc\n a << {\"url\" => toc_magissue_url, \"title\" => \"TOC\", \"hidden\" => true}\n\n # Insert the links to all the magissues's articles\n @magissue.articles.each do |article|\n entry = {\"url\" => read_article_url(article), \"title\" => article.headline, \"byline\" => article.author,\n \"thumb\" => (article.assets.exists? ? article.assets[0].dynamic_asset_url(\"40x40>\") : \"\")}\n a << entry\n end\n\n # Create the \"contents\" object and and associate the links array to it.\n b = {\"contents\" => a}\n\n # Render the response as JSON\n respond_to do |format|\n format.json { render :json => b }\n end\n end",
"def index\n @specific_contents = SpecificContent.all\n end",
"def index\n @contents = Content.accessible_by(current_ability).page params[:page]\n \n if params[:filter]\n @contents = @contents.where(\"description LIKE ?\", \"%#{params[:filter]}%\")\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contents }\n end\n end",
"def show\n @content_url = ContentUrl.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @content_url }\n end\n end",
"def show\n @structure_content = Structure::Content.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @structure_content }\n end\n end",
"def index\n @contents = Content.find(:all, :limit => 10, :order => \"created_at desc\")\n end",
"def index\n#\t\t@search = Content.search(params[:search])\n#\t\t@contents = @search.paginate(:page => params[:page], :per_page => 15)\n @contents = Content.all\n respond_with(@contents)\n end",
"def get(path)\n return @contents if path.nil?\n aget(path.split(':'))\n end",
"def aget(path)\n _aget(path, @contents)\n end",
"def index\n @content_urls = ContentUrl.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @content_urls }\n end\n end",
"def get_content_items(params)\n query = query_string(params)\n get_json(\"#{endpoint}/v2/content#{query}\")\n end",
"def get_contents\n raise \"can't get a repo without the repo's full_name (eg. 'fubar/ofxTrickyTrick')\" unless full_name\n\n begin\n response = GithubApi::repository_contents(full_name: full_name)\n rescue => ex\n Rails.logger.debug \"Failed to get repository contents: #{ex.message} (#{ex.class})\"\n return\n end\n\n unless response.success?\n Rails.logger.debug response.inspect.to_s.red\n return\n\tend\n\n @repo_contents_json = response.parsed_response\n end",
"def index\n\n if params[:search]\n @contents = Content.search(params[:search])\n else\n @contents = Content.all.order('created_at DESC')\n end\n\n respond_to do |format|\n format.html # index.html.erb\n # format.json { render json: @contents, :only => [:id, :title, :description, :category_id, :video, :event_datetime,\n # :event_site, :limit_date, :image, :user_id, :created_at] }\n format.json { render json: @contents, :only => [:id, :title, :description, :category_id, :video, :event_datetime,\n :event_site, :limit_date], :methods => [:tv_img_url, :img_url, :iphone_url] }\n end\n end",
"def show\n render json: @content\n end",
"def show\n @static_content = StaticContent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @static_content }\n end\n end",
"def show\n @content_explore = ContentExplore.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @content_explore }\n end\n end",
"def show\n @content_item = ContentItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @content_item }\n end\n end",
"def json_at(url)\n JSON.parse(open(url).read, symbolize_names: true)[:objects]\nend",
"def get_content\n send_get_content(url)\n end",
"def show\n @content_condo = ContentCondo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @content_condo }\n end\n end",
"def json_show_static_content_by_name\n\n @static_content = StaticContent.find_by_name(params[:name])\n respond_to do |format|\n format.json { render json: @static_content }\n end\n end",
"def index\n\t\t# All Content tags\n\t\tcontents = ContentTag.all\n\t\trender json: contents\n\tend",
"def index\n @contents = Content.site_text_items(@site.id)\n end",
"def index\n @content_explores = ContentExplore.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @content_explores }\n end\n end",
"def show\n @meta_content = MetaContent.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @meta_content }\n end\n end",
"def index\n @page = Page.find(params[:page_id])\n @revisions = @page.revisions\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @revisions }\n end\n end",
"def show\n @content_datum = ContentDatum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @content_datum }\n end\n end",
"def show\n\n p \"---------\"\n p @contents\n\n end",
"def content\n @content ||= @client.get(@link)\n end",
"def index\n @content_data = ContentDatum.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @content_data }\n end\n end",
"def get(user_name, repo_name, path, params={})\n normalize! params\n\n get_request(\"/repos/#{user_name}/#{repo_name}/contents/#{path}\", params)\n end",
"def get_contents_for(path)\n out = get_path(path)\n out.css(\"#content\").inner_html\n end",
"def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n puts JSON.pretty_generate(result)\n result\nend",
"def show\n @entry = Entry.find(params[:id])\n\n render json: @entry\n end",
"def index\n @contents = @event.contents\n end",
"def get_page(id)\n @client.raw('get', \"/content/pages/#{id}\")\n end",
"def index\n @gets = Get.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @gets }\n end\n end",
"def path\n \"/content/#{id}\"\n end",
"def show\n @page = Page.find(params[:page_id])\n @revision = @page.revisions.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @revision }\n end\n end",
"def getContents( name, dir )\n if( /^https?:\\/\\// =~ name )\n begin\n response = Excon.get( name, :expects => [200] )\n rescue Exception => e\n puts \"Error - failed to load #{name}, got non-200 code.\"\n return ''\n end\n response.body\n else\n open('public/' + name).read\n end\nend",
"def get_contents(params)\n conference = params[:conference]\n if params[:name] == 'conference'\n conference[:date] + '±' + conference[:location] + '±' +\n conference[:conf_name] + '±' + conference[:content]\n else\n params[:static_page][:contents]\n end\n end",
"def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n #puts JSON.pretty_generate(result)\n result\nend",
"def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n #puts JSON.pretty_generate(result)\n result\nend",
"def index\n @order_contents = OrderContent.all\n end",
"def show\n @revision = Revision.find(params[:id])\n\n render json: @revision\n end",
"def show\n @content_translation = ContentTranslation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @content_translation }\n end\n end",
"def index\n @task_contents = TaskContent.all\n end",
"def show\n @content_item_condo = ContentItemCondo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @content_item_condo }\n end\n end",
"def index\n @contents = if (@tag = params[:tag].to_s.strip).present?\n Content.by_tag(@tag)\n else\n Content.all\n end\n end",
"def get_json(path)\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n #puts \"🤖 GET #{path}\"\n #puts \"HTTP #{response.code}\"\n #puts JSON.pretty_generate(result)\n result\nend",
"def page_contents(id, params = {})\n contents(Voog::API::Contents::ParentKind::Page, id, params)\n end",
"def index\n @cargo_manifests = CargoManifest.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cargo_manifests }\n end\n end",
"def index\n @content_condos = ContentCondo.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @content_condos }\n end\n end",
"def show\n @assessment = Content.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @assessment }\n end\n end",
"def show\n respond_to do |format|\n # format.html # index.html.erb\n format.json { render json: @todo }\n end\n end",
"def index\n conditions = params.has_key?(:q) ? search_params : {}\n @q = SubContent.search(conditions)\n @sub_contents = @q\n .result\n .order(updated_at: :desc)\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @journal_entry }\n end\n end",
"def show\n @data = @recipe.read(params[:id])\n render json: @data\n end",
"def read\n object = bucket.objects.find(@path)\n object.content\n end",
"def show\n @bio = Bio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bio }\n end\n end",
"def show\n @entry = Entry.find(params[:id])\n respond_to do |format|\n format.html {}\n format.json { render json: @entry }\n end\n end",
"def url_content\n url(:content)\n end",
"def show\n @cargo_manifest = CargoManifest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cargo_manifest }\n end\n end",
"def show\n puts params[:id]\n render json: Todo.find(params[:id])\n end",
"def index\n @training_contents = TrainingContent.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @training_contents }\n end\n end",
"def contents\n @content = @user.contents\n end",
"def contents\n read\n end",
"def index\n @artefact = Artefact.find(params[:artefact_id])\n\n @assets = @artefact.assets\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @assets }\n end\n end",
"def contents\n self.content\n end",
"def index\n @info = Info.new\n @info_contents = Info.all\n @contents = Content.find(:all, :order => \"sort_number ASC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @contents }\n end\n end",
"def list_contents\n begin\n data = @client.metadata('/') #returns this\n rescue DropboxError\n return false\n end\n end",
"def index\n if @container\n @container_contents = @container.container_contents\n else\n @container_contents = ContainerContent.all\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @container_contents }\n end\n end",
"def show\n @digital_content = DigitalContent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @digital_content }\n end\n end"
] | [
"0.7337962",
"0.72771823",
"0.72729874",
"0.7242928",
"0.69509673",
"0.6893205",
"0.67762524",
"0.67762524",
"0.67579806",
"0.6703063",
"0.6670591",
"0.6638352",
"0.6602084",
"0.65537834",
"0.6455138",
"0.6454024",
"0.6454024",
"0.6454024",
"0.6454024",
"0.6454024",
"0.6454024",
"0.6454024",
"0.6425426",
"0.63982564",
"0.6393495",
"0.63778186",
"0.63501966",
"0.63416576",
"0.63280016",
"0.63117915",
"0.6266174",
"0.62135655",
"0.61366504",
"0.6103779",
"0.6080857",
"0.60401917",
"0.60269254",
"0.6024369",
"0.5969568",
"0.5962742",
"0.59620404",
"0.5955959",
"0.592894",
"0.5903147",
"0.5902202",
"0.5876327",
"0.5862448",
"0.58591324",
"0.58522105",
"0.58432657",
"0.5840909",
"0.5824153",
"0.58238155",
"0.58219874",
"0.5813324",
"0.58058196",
"0.58053964",
"0.5801412",
"0.57750946",
"0.57437396",
"0.5730192",
"0.57273436",
"0.5707757",
"0.5670366",
"0.56554586",
"0.56524897",
"0.5647398",
"0.5647177",
"0.56471217",
"0.5638864",
"0.5638864",
"0.5638543",
"0.5629482",
"0.5608225",
"0.5591695",
"0.5586892",
"0.5581514",
"0.5580182",
"0.5577528",
"0.5564062",
"0.5563201",
"0.55587643",
"0.5537007",
"0.55354196",
"0.55339706",
"0.5529769",
"0.5526379",
"0.5526134",
"0.5520116",
"0.55194855",
"0.55192846",
"0.5515837",
"0.55148333",
"0.5509876",
"0.55016893",
"0.55016077",
"0.5498293",
"0.5497693",
"0.5497038",
"0.5494538",
"0.54934514"
] | 0.0 | -1 |
GET /contents/new GET /contents/new.json | def new
@content = @corkboard.contents.new
@content.build_document
respond_to do |format|
format.html # new.html.erb
format.json { render json: @content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @title = t 'view.contents.new_title'\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @content }\n end\n end",
"def new\n @content = Content.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @content }\n end\n end",
"def new\n @content = Content.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @content }\n end\n end",
"def new\n @content = Content.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @content }\n end\n end",
"def new\n @content = Content.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @content }\n end\n end",
"def new\n @content = Content.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @content }\n end\n end",
"def new\n @content = Content.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @content }\n end\n end",
"def new\n @content = Content.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @content }\n end\n end",
"def new\n @content_url = ContentUrl.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @content_url }\n end\n end",
"def new\n @main_content = MainContent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @main_content }\n end\n end",
"def new\n @content_item = ContentItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @content_item }\n end\n end",
"def new\n @content = Content.new\n @content.owner_id = current_user.id\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @content }\n end\n end",
"def new\n @static_content = StaticContent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @static_content }\n end\n end",
"def new\n @edited << 'new'\n @expanded << 'new'\n\n respond_to do |format|\n format.html { render template: 'shared/new' }\n format.js { render 'story'; flash.discard }\n format.json { render json: @story }\n end\n end",
"def new\n @entry = Entry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @entry }\n end\n end",
"def new\n @entry = Entry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @entry }\n end\n end",
"def new\n @entry = Entry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @entry }\n end\n end",
"def new\n @entry = Entry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @entry }\n end\n end",
"def new\n @entry = Entry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @entry }\n end\n end",
"def new\n @entry = Entry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @entry }\n end\n end",
"def new\n @entry = Entry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @entry }\n end\n end",
"def new\n @entry = Entry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @entry }\n end\n end",
"def new\n @structure_content = Structure::Content.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @structure_content }\n end\n end",
"def new\n @entry = Entry.new\n\n render json: @entry\n end",
"def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page, :only => [:title, :content] }\n end\n end",
"def new\n @content_datum = ContentDatum.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @content_datum }\n end\n end",
"def new\n @todo = Todo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @todo }\n end\n end",
"def new\n @todo = Todo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @todo }\n end\n end",
"def new\n @todo = Todo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @todo }\n end\n end",
"def new\n @todo = Todo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @todo }\n end\n end",
"def new\n @todo = Todo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @todo }\n end\n end",
"def new\n @gitto = Gitto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gitto }\n end\n end",
"def new\n @thing = Thing.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @thing }\n end\n end",
"def new\n @special_document = ModifiedDocument.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @special_document }\n end\n end",
"def new\n @page = current_site.pages.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end",
"def new\n @stuff = Stuff.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @stuff }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @interest }\n end\n end",
"def new\n @what = What.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @what }\n end\n end",
"def new\n @thing = Thing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @thing }\n end\n end",
"def new\n @gist = Gist.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gist }\n end\n end",
"def new\n @content_explore = ContentExplore.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @content_explore }\n end\n end",
"def new\n @content = Content.new\n respond_with @content\n end",
"def new\n @metodo = Metodo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @metodo }\n end\n end",
"def new\n @content_piece = ContentPiece.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @content_piece }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @media_interest }\n end\n end",
"def new\n @garbage = Garbage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @garbage }\n end\n end",
"def new\n @get = Get.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @get }\n end\n end",
"def new\n @todo = @list.todos.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @todo }\n end\n end",
"def new\n @content_partial = ContentPartial.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @content_partial }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end",
"def new\n @journal = Journal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json :@journal }\n end\n end",
"def new\n @issue = Issue.new\n\n @new = true\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @issue }\n end\n end",
"def new\n @published = Published.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @published }\n end\n end",
"def new\n @todo = Todo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json=>@todo}\n end\n end",
"def new\n @meta_content = MetaContent.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @meta_content }\n end\n end",
"def new\n @template = Template.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @template }\n end\n end",
"def new\n @note = Note.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @notes }\n end\n end",
"def new\n @journal_entry = JournalEntry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @journal_entry }\n end\n end",
"def new\n @journal_entry = JournalEntry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @journal_entry }\n end\n end",
"def new\n @something = Something.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @something }\n end\n end",
"def new\n @content_condo = ContentCondo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @content_condo }\n end\n end",
"def new\n @page_template = PageTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page_template }\n end\n end",
"def new\n @holder = Holder.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @holder }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @resource }\n end\n end",
"def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end",
"def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end",
"def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end",
"def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end",
"def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end",
"def new\n @fileversion = Fileversion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fileversion }\n end\n end",
"def new\n @content_translation = ContentTranslation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @content_translation }\n end\n end",
"def new\n @content = Content.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @content }\n end\n end",
"def new\n @content = Content.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @content }\n end\n end",
"def new\n @content = Content.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @content }\n end\n end",
"def new\n @content = Content.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @content }\n end\n end",
"def new\n @title = 'New Page'\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end",
"def new\n @url = Url.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @url }\n end\n end",
"def new\n @sync_page = SyncPage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sync_page }\n end\n end",
"def new\n @file_version = FileVersion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @file_version }\n end\n end",
"def new\n @content_form = ContentForm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @content_form }\n end\n end",
"def new\n @pub = Pub.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pub }\n end\n end",
"def new\n\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end",
"def new\n @story = Story.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @story }\n end\n end",
"def new\n @story = Story.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @story }\n end\n end",
"def new\n @story = Story.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @story }\n end\n end",
"def new\n @story = Story.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @story }\n end\n end",
"def new\n @work = Work.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @work }\n end\n end",
"def new\n @work = Work.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @work }\n end\n end",
"def new\n @story = Story.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @story }\n end\n end",
"def new\n @story = Story.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @story }\n end\n end",
"def new\n @story = Story.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @story }\n end\n end",
"def new\n @story = Story.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @story }\n end\n end",
"def new\n @entry_view = EntryView.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @entry_view }\n end\n end",
"def new\n @work = Work.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @work }\n end\n end",
"def new\n @snippet = Snippet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @snippet }\n end\n end",
"def new\n @snippet = Snippet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @snippet }\n end\n end",
"def new\n @draft = Draft.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @draft }\n end\n end",
"def new_rest\n @entry_item = EntryItem.new\n\n respond_to do |format|\n #format.html # new.html.erb\n format.xml { render :xml => @entry_item }\n end\n end",
"def new\n @version = Version.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @version }\n end\n end",
"def new\n @wanted = Wanted.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @wanted }\n end\n end"
] | [
"0.70694655",
"0.706462",
"0.706462",
"0.706462",
"0.706462",
"0.706462",
"0.706462",
"0.7025736",
"0.6755228",
"0.6738443",
"0.6649702",
"0.6638704",
"0.65894943",
"0.65253186",
"0.6483694",
"0.6483694",
"0.6483694",
"0.6483694",
"0.6483694",
"0.6483694",
"0.6483694",
"0.6483694",
"0.6483224",
"0.64795893",
"0.64573145",
"0.6431049",
"0.64141715",
"0.64141715",
"0.64141715",
"0.64141715",
"0.64141715",
"0.6414157",
"0.64015263",
"0.6389064",
"0.6383119",
"0.6380509",
"0.6377806",
"0.6375966",
"0.6370428",
"0.6368362",
"0.6368323",
"0.63661104",
"0.63623327",
"0.6360687",
"0.6348551",
"0.63346463",
"0.63267845",
"0.6313464",
"0.6308625",
"0.6307134",
"0.63020396",
"0.63004786",
"0.62934464",
"0.6292306",
"0.62857765",
"0.6265826",
"0.62475026",
"0.6247214",
"0.6247214",
"0.62447417",
"0.6237486",
"0.6233629",
"0.62139726",
"0.6212319",
"0.6212023",
"0.6212023",
"0.6212023",
"0.6212023",
"0.6212023",
"0.62098175",
"0.6205662",
"0.61966443",
"0.61966443",
"0.61966443",
"0.61966443",
"0.6191023",
"0.61768246",
"0.6171014",
"0.6165073",
"0.6162314",
"0.6148798",
"0.6147117",
"0.61427575",
"0.61427575",
"0.61427575",
"0.61427575",
"0.6141437",
"0.6141437",
"0.61410505",
"0.61410505",
"0.61410505",
"0.61410505",
"0.61398107",
"0.61354256",
"0.6132634",
"0.6132634",
"0.6131977",
"0.61294895",
"0.61290437",
"0.6128939"
] | 0.6686396 | 10 |
POST /contents POST /contents.json | def create
@content = @corkboard.contents.new(params[:content])
respond_to do |format|
if @content.save
current_user.create_activity @content, 'created'
format.html { redirect_to corkboard_contents_path(@corkboard), notice: 'Content was successfully created.' }
format.json { render json: @content, status: :created, location: @content }
else
format.html { render action: "new" }
format.json { render json: @content.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @contents = Content.all\n render json: @contents\n end",
"def create(contents, params = {:language => \"Plain Text\", :private => false})\n params = params.merge({:contents => contents}.merge(@base_params))\n self.class.post(\"/paste\", :body => params).parsed_response\n end",
"def save\n return if @content.nil?\n put_rest \"extra/#{@name}\", @content, :content_type => \"application/octet-stream\"\n end",
"def create\n @content = Content.new(params[:content])\n\n respond_to do |format|\n if @content.save\n format.html { redirect_to contents_path, notice: 'Content was successfully created.' }\n format.json { render json: @content, status: :created, location: @content }\n else\n format.html { render action: \"new\" }\n format.json { render json: @content.errors.full_messages, status: :unprocessable_entity }\n end\n end\n end",
"def index\n\n @contents = Content.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contents }\n end\n end",
"def index\n @contents = Content.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contents }\n end\n end",
"def index\n @contents = Content.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @contents }\n end\n end",
"def post(content)\n remote_post_to(@uri, content)\n end",
"def create\n model = params[:model]\n #NOTE: Pay attention how the data is passed as a hash. This is how locomotive expects it. Not obvious.\n # req.set_form_data('content_entry[name]' => data['name'], 'content_entry[summary]' => data['summary'], 'model' => model)\n form_data = {}\n params[:content_entry].each do |key,val|\n form_data[\"content_entry[#{key}]\"] = val\n end\n #data = params[:content_entry]\n\n uri = URI(\"#{@cms_url}/locomotive/api/content_types/#{model}/entries.json?auth_token=#{APP_CONFIG['locomotive']['auth_token']}\")\n\n req = Net::HTTP::Post.new(uri)\n req.set_form_data(form_data)\n res = Net::HTTP.start(uri.hostname, uri.port) do |http|\n http.request(req)\n end\n case res\n when Net::HTTPSuccess, Net::HTTPRedirection\n render :json => res.body\n else\n # examine response code and generate appropriate error message\n render :json => res.value\n end\n\n end",
"def create\n @content = current_user.contents.new(params[:content])\n\n respond_to do |format|\n if @content.save\n format.html { redirect_to(@content, :notice => 'Content was successfully created.') }\n format.xml { render :xml => @content, :status => :created, :location => @content }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @content.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @o_single = Content.new(content_params)\n\n respond_to do |format|\n if @o_single.save\n format.html { redirect_to contents_url, notice: t(\"general.successfully_created\") }\n format.json { render action: 'show', status: :created, location: @o_single }\n else\n format.html { render action: 'new' }\n format.json { render json: @o_single.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @contents = Content.order('created_at DESC').paginate(:page => params[:page], :per_page => 20)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contents }\n end\n end",
"def json_upload(content, credentials)\n upload('json', content, credentials)\n end",
"def create\n @content = Content.new(params[:content])\n\n respond_to do |format|\n if @content.save\n format.html { redirect_to @content, :notice => 'Content was successfully created.' }\n format.json { render :json => @content, :status => :created, :location => @content }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @content.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create(content)\n post(content)\n end",
"def create\n @content = Content.new(contents_params)\n if @content.save\n redirect_to contents_path\n else\n render \"new\"\n end\n end",
"def post(content)\n post_to(\"/api/v1/messages/\", {:body => content})\n end",
"def json_post\n @content_type = 'text/plain'\n @render_nothing = true\n @rendered_template = true\n @current_layout = nil\n puts \"json_post: submitting #{params[:path]}\" if @@debug\n path = params[:path]\n if path\n puts \"json_post: path is #{path} l=#{path.length}\" if @@debug\n path = path.split('/').compact()\n path.delete('')\n # you cannot make rooted nodes via json atm... fix? xxx\n if path.length > 1\n name = path.pop\n nodes = Note.make_path @user,path\n puts \"json_post: making at path #{path.join('/')}\" if @@debug\n if nodes\n note = nodes.last.make_child @user,params,name\n puts \"json_post: made child #{note} from #{name} l=#{name.length}\"\n params[:path] = path.join('/') # for call to json_query\n # it is important to do a query rather than returning the note; to get freshest order\n json_query\n return\n #write_json note if note\n end\n end\n end\n render :nothing => true\n end",
"def create_content(params)\n post(CONTENT_PATH, params) if validate_params(params)\n end",
"def index\n @contents = Content.all\n\n respond_with @contents\n end",
"def write(contents = @request_body.to_s)\n @contents = contents\n\n File.open(@src_path, 'w') do |file|\n file.write @contents\n end\n end",
"def create\n @content_entry = Content::Entry.new(content_entry_params)\n\n respond_to do |format|\n if @content_entry.save\n format.html { redirect_to @content_entry, notice: 'Entry was successfully created.' }\n format.json { render :show, status: :created, location: @content_entry }\n else\n format.html { render :new }\n format.json { render json: @content_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def document_params\n if params[:contents]\n params\n .permit(:title, :original_contents)\n .merge(contents: JSON.parse(params.try(:[], :contents) || {}))\n else\n params.permit(:title)\n end\n end",
"def create\n @content = Content.new(params[:content])\n\n respond_to do |format|\n if @content.save\n format.html { redirect_to @content, notice: 'Content was successfully created.' }\n format.json { render json: @content, status: :created, location: @content }\n else\n format.html { render action: \"new\" }\n format.json { render json: @content.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @content = Content.new(params[:content])\n\n respond_to do |format|\n if @content.save\n format.html { redirect_to @content, notice: 'Content was successfully created.' }\n format.json { render json: @content, status: :created, location: @content }\n else\n format.html { render action: \"new\" }\n format.json { render json: @content.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @content = Content.new(params[:content])\n\n respond_to do |format|\n if @content.save\n format.html { redirect_to @content, notice: 'Content was successfully created.' }\n format.json { render json: @content, status: :created, location: @content }\n else\n format.html { render action: \"new\" }\n format.json { render json: @content.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @content = Content.new(params[:content])\n file_size = params[:content][:content_file_file_size]\n\n respond_to do |format|\n if @content.save\n @content_saved = true\n \n @content.user = current_user\n current_user.contents << @content\n \n format.html { redirect_to @content}\n format.json { render json: @content, status: :created, location: @content }\n else\n @content_saved = false\n \n if file_size == nil\n @file_nil = true\n elsif file_size > 1000000\n @file_too_big = true \n end \n \n format.html { redirect_to root_path, notice: \"Content could not be saved - please pick a jpg or png file less than 1 MB\" }\n format.json { render json: @content.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @content = Content.new(content_params)\n\n respond_to do |format|\n if @content.save\n format.html { redirect_to '/'}\n format.json { render json: {location: '/'}, status: :created }\n else\n format.html { render :new }\n format.json { render json: {errors: @content.errors} }\n end\n end\n end",
"def create\n @entry = Entry.new({\n content: params[:entry][:content],\n journal_id: params[:entry][:journal_id]\n })\n\n respond_to do |format|\n if @entry.save\n format.html { redirect_to \"/entries/#{@entry.id}\" }\n format.json { render :show }\n else\n format.html { render :new }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @content = Content.new(params[:content])\n flash[:notice] = 'Se guardó el nuevo Content.' if @content.save\n respond_with(@content, :location => new_content_track_path(@content))\n end",
"def json_index_static_contents\n\n @static_contents = StaticContent.all\n respond_to do |format|\n\n format.json { render json: @static_contents }\n end\n end",
"def save\n repository.create_contents(path, \"Upload #{path}\", content)\n end",
"def create\n render json: generate_content_item_data(\"fake_id\", params[:content_item_return_url], params[:content_item])\n end",
"def index\n @contents = Content.all\n end",
"def index\n @contents = Content.all\n end",
"def index\n puts \"index\"\n @contents = Content.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.js\n \n format.json { render json: @contents }\n end\n end",
"def create\n @main_content = MainContent.new(params[:main_content])\n\n respond_to do |format|\n if @main_content.save\n format.html { redirect_to :back, notice: 'Main content was successfully created.' }\n format.json { render json: @main_content, status: :created, location: @main_content }\n else\n format.html { render action: \"new\" }\n format.json { render json: @main_content.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sub_content = SubContent.new(sub_content_params)\n\n respond_to do |format|\n if @sub_content.save\n format.html { redirect_to @sub_content, notice: 'Sub content was successfully created.' }\n format.json { render :show, status: :created, location: @sub_content }\n else\n format.html { render :new }\n format.json { render json: @sub_content.errors, status: :unprocessable_entity }\n end\n end\n end",
"def page_content_params\n params.require(:page_content).permit(:contents).to_h\n end",
"def index\n # @contents = Content.all\n end",
"def post_new_gist content \n\t\t\t\turl = GITHUB_API_GIST_LINK \n\t\t\t\tresponse = https_open_for ({url: url, mthd:\"post\", content: content})\n \t\t\t\tJSON.parse response.body\n\t\t\tend",
"def create\n @content = Content.new(content_params)\n\n respond_to do |format|\n if @content.save\n format.html { redirect_to @content, notice: 'Content was successfully created.' }\n format.json { render :show, status: :created, location: @content }\n else\n format.html { render :new }\n format.json { render json: @content.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @content = Content.new(content_params)\n\n respond_to do |format|\n if @content.save\n format.html { redirect_to edit_content_path(@content), notice: 'Test was successfully created.' }\n format.json { render :show, status: :created, location: @content }\n else\n format.html { render :new }\n format.json { render json: @content.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @toc = Toc.new(toc_params)\n @manifestation = process_toc(@toc['toc_body'])\n @toc.manifestation = @manifestation\n respond_to do |format|\n if @toc.save\n format.html { redirect_to @toc, notice: 'Toc was successfully created.' }\n format.json { render :show, status: :created, location: @toc }\n else\n format.html { render :new }\n format.json { render json: @toc.errors, status: :unprocessable_entity }\n end\n end\n end",
"def contents_params\n params.require(:content).permit(:title,:description,:attachment,:user_id,:tags)\n end",
"def create\n @content = Content.new(content_params)\n\n respond_to do |format|\n if @content.save\n format.html { redirect_to @content, notice: 'Content was successfully created.' }\n format.json { render action: 'show', status: :created, location: @content }\n else\n format.html { render action: 'new' }\n format.json { render json: @content.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_params\n params.require(:todo).permit(:contents)\n end",
"def create\n @content = Content.new(params[:content])\n if @content.save\n render :json=>{:response=>\"success\"}\n else\n render :json=>failure1(@content.errors)\n end\n end",
"def create\n @structure_content = Structure::Content.new(params[:structure_content])\n\n respond_to do |format|\n if @structure_content.save\n format.html { redirect_to @structure_content, notice: 'Content was successfully created.' }\n format.json { render json: @structure_content, status: :created, location: @structure_content }\n else\n format.html { render action: \"new\" }\n format.json { render json: @structure_content.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @content = Content.new(params[:content])\n\n respond_to do |format|\n if @content.save\n flash[:success] = 'Content was successfully created.'\n format.html { redirect_to admin_content_path(@content.id) }\n format.json { render json: @content, status: :created, location: @content }\n else\n format.html { render action: \"new\" }\n format.json { render json: @content.errors.full_messages.join(''), status: :unprocessable_entity }\n end\n end\n end",
"def new\n \n @content = @corkboard.contents.new\n @content.build_document\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @content }\n end\n end",
"def create\n @content = Content.new(params[:content])\n \n if @content.save\n redirect_to contents_path, :notice => 'Content was successfully created.'\n else\n render :action => \"new\" \n end \n end",
"def content_index\n @magissue = Magissue.find(params[:id])\n # Initiate the array of contents' links\n a = []\n\n # Insert the link to the cover first\n a << {\"url\" => cover_magissue_url, \"title\" => \"Cover\", \"hidden\" => true}\n\n\n # Insert the link to the toc\n a << {\"url\" => toc_magissue_url, \"title\" => \"TOC\", \"hidden\" => true}\n\n # Insert the links to all the magissues's articles\n @magissue.articles.each do |article|\n entry = {\"url\" => read_article_url(article), \"title\" => article.headline, \"byline\" => article.author,\n \"thumb\" => (article.assets.exists? ? article.assets[0].dynamic_asset_url(\"40x40>\") : \"\")}\n a << entry\n end\n\n # Create the \"contents\" object and and associate the links array to it.\n b = {\"contents\" => a}\n\n # Render the response as JSON\n respond_to do |format|\n format.json { render :json => b }\n end\n end",
"def create\n @content = Content.new(content_params)\n\t\n respond_to do |format|\n if @content.save\n format.html { redirect_to @content, notice: 'Indholdet blev oprettet.' }\n format.json { render action: 'show', status: :created, location: @content }\n else\n format.html { render action: 'new' }\n format.json { render json: @content.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @content.update(contents_params)\n format.html { redirect_to @content, notice: 'Content was successfully updated.' }\n format.json { render :show, status: :ok, location: @content }\n else\n format.html { render :edit }\n format.json { render json: @content.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n @inventory_snapshot_content = InventorySnapshotContent.new(inventory_snapshot_content_params)\n\n respond_to do |format|\n if @inventory_snapshot_content.save\n format.html { redirect_to @inventory_snapshot_content, notice: 'Inventory snapshot content was successfully created.' }\n format.json { render :show, status: :created, location: @inventory_snapshot_content }\n else\n format.html { render :new }\n format.json { render json: @inventory_snapshot_content.errors, status: :unprocessable_entity }\n end\n end\n end",
"def entry_params\n params.require(:entry).permit(:content)\n end",
"def create\n @container_content = @container.container_contents.new(params[:container_content])\n\n respond_to do |format|\n if @container_content.save\n format.html { redirect_to(@container_content.container, :notice => 'Container content was successfully created.') }\n format.xml { render :xml => @container_content, :status => :created, :location => @container_content }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @container_content.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @content = Content.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @content }\n end\n end",
"def new\n @content = Content.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @content }\n end\n end",
"def new\n @content = Content.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @content }\n end\n end",
"def new\n @content = Content.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @content }\n end\n end",
"def new\n @content = Content.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @content }\n end\n end",
"def new\n @content = Content.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @content }\n end\n end",
"def post_json(path, body)\n uri = build_uri(path)\n puts \"*** POST #{path}\"\n puts JSON.pretty_generate(body)\n\n post_request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')\n post_request.body = JSON.generate(body)\n\n response = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => true) do |http|\n http.request(post_request)\n end\n\n puts \"HTTP #{response.code}\"\n result = JSON.parse(response.body)\n puts JSON.pretty_generate(result)\n result\nend",
"def post_json(path, body)\n uri = build_uri(path)\n\n post_request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')\n post_request.body = JSON.generate(body)\n\n response = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => true) do |http|\n http.request(post_request)\n end\n\n result = JSON.parse(response.body)\n puts result\n result\nend",
"def new\n @content = Content.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @content }\n end\n end",
"def create\n @content = Content.where(\"action = ? AND index = ?\", params[:content][:action], params[:content][:index]).first\n if @content.blank?\n @content = Content.new(params[:content])\n @content.save\n message = \"created!\"\n else\n @content.update_attributes(params[:content])\n message = \"Updated!\"\n end\n\n respond_to do |format|\n if message\n format.html { redirect_to @content, notice: message }\n format.json { render json: @content, status: :created, location: @content }\n format.js\n else\n format.html { render action: \"new\" }\n format.json { render json: @content.errors, status: :unprocessable_entity }\n format.js\n\n end\n end\n end",
"def create_content_change(content_change, headers = {})\n post_json(\"#{endpoint}/content-changes\", content_change, headers)\n end",
"def create_content_change(content_change, headers = {})\n post_json(\"#{endpoint}/content-changes\", content_change, headers)\n end",
"def create\n @specific_content = SpecificContent.new(specific_content_params)\n\n respond_to do |format|\n if @specific_content.save\n format.html { redirect_to @specific_content, notice: 'Specific content was successfully created.' }\n format.json { render :show, status: :created, location: @specific_content }\n else\n format.html { render :new }\n format.json { render json: @specific_content.errors, status: :unprocessable_entity }\n end\n end\n end",
"def remote_create(content)\n content = content.to_xml unless content.kind_of? String\n remote_post content\n end",
"def content_entry_params\n params.require(:content_entry).permit(:title, :slug, :content)\n end",
"def post_job_content_sample(client)\n job_multipart = {\n :file => File.new($full_path),\n 'num copies' => 10\n }\n\n response = client['jobs'].post job_multipart\n\n p ''\n p 'Submit a new job'\n p response\nend",
"def index\n @title = t 'view.contents.index_title'\n @searchable = true\n @contents = @contents.filtered_list(params[:q]).page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contents }\n end\n end",
"def content_params\n params.require(:content).permit(:content_one)\n end",
"def content_params\n params.require(:content).permit!\n end",
"def save\n return if @content.nil?\n put_rest \"rules/#{@name}\", @content, :content_type => \"application/octet-stream\"\n end",
"def create\n @textual_content = @card.textual_content.build textual_content_params\n\n if @textual_content.save\n render :show, status: :created, location: [@card, @textual_content]\n else\n render json: @textual_content.errors, status: :unprocessable_entity\n end\n end",
"def post_json(path, body)\n uri = build_uri(path)\n #puts \"🤖 POST #{path}\"\n #puts JSON.pretty_generate(body)\n\n post_request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')\n post_request.body = JSON.generate(body)\n\n response = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => true) do |http|\n http.request(post_request)\n end\n\n #puts \"HTTP #{response.code}\"\n result = JSON.parse(response.body)\n #puts result[:result]\n result\nend",
"def post(path, json, params = {})\n if path.include?('covid19')\n request = Net::HTTP::Post.new(path, @headers)\n else\n request = Net::HTTP::Post.new('/v2' + path, @headers)\n end\n request.add_field('Content-Type', 'application/json')\n request.body = json\n params.each do |k, v|\n request[k] = v\n end\n send_request(request)\n end",
"def create\n @title = t 'view.contents.new_title'\n\n respond_to do |format|\n if @content.save\n format.html { redirect_to [@teach, @content], notice: t('view.contents.correctly_created') }\n format.json { render json: @content, status: :created, location: [@teach, @content] }\n else\n format.html { render action: 'new' }\n format.json { render json: @content.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @meta_content = MetaContent.new(params[:meta_content])\n \n respond_to do |format|\n if @meta_content.save\n format.html { redirect_to @meta_content, notice: 'Meta content was successfully created.' }\n format.json { render json: @meta_content, status: :created, location: @meta_content }\n else\n format.html { render action: \"new\" }\n format.json { render json: @meta_content.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post_params\n params.require(:content)\n params.permit(:content) #, :type, :souce_id)\n end",
"def post_json(path, body)\n uri = build_uri(path)\n puts \"*** POST #{uri}\"\n puts JSON.pretty_generate(body)\n\n post_request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')\n post_request.body = JSON.generate(body)\n\n response = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => true) do |http|\n http.request(post_request)\n end\n\n puts \"HTTP #{response.code}\"\n result = JSON.parse(response.body)\n puts result[:result]\n result\nend",
"def content_params\n params.require(:content).permit(:sha256, :mime_type, :size)\n end",
"def post_json(path, body)\n uri = build_uri(path)\n puts \"*** POST #{path}\"\n puts JSON.pretty_generate(body)\n\n post_request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')\n post_request.body = JSON.generate(body)\n\n response = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => true) do |http|\n http.request(post_request)\n end\n\n puts \"HTTP #{response.code}\"\n result = JSON.parse(response.body)\n puts result[:result]\n result\nend",
"def content_params\n params.permit(:title, :file, :tags)\n end",
"def new\n @main_content = MainContent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @main_content }\n end\n end",
"def create\n @note = Note.new(:content => params[:content], :user => current_user)\n print(\"json note \"+ @note.to_json)\n if @note.save\n render :show, status: :created, location: @note\n else\n render json: @note.errors, status: :unprocessable_entity\n end\n end",
"def post\n resource.post(request, response)\n end",
"def new\n @content = Content.new\n @content.owner_id = current_user.id\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @content }\n end\n end",
"def create\n content_admin = ContentAdmin.new(content_admin_params)\n content_admin.save\n @content = content_admin.content\n respond_to do |format|\n format.js\n end\n end",
"def create\n @text_content = TextContent.new(text_content_params)\n\n respond_to do |format|\n if @text_content.save\n format.html { redirect_to @text_content, notice: 'Text content was successfully created.' }\n format.json { render :show, status: :created, location: @text_content }\n else\n format.html { render :new }\n format.json { render json: @text_content.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @content_datum = ContentDatum.new(params[:content_datum])\n\n respond_to do |format|\n if @content_datum.save\n format.html { redirect_to @content_datum, notice: 'Content datum was successfully created.' }\n format.json { render json: @content_datum, status: :created, location: @content_datum }\n else\n format.html { render action: \"new\" }\n format.json { render json: @content_datum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post\n Typhoeus.post(@url,\n body: @results_hash.to_json,\n headers: { 'Content-Type' => 'application/json' })\n end",
"def create_json(json_contents)\n File.open('Puppetfile', 'w') do |file|\n file.write json_contents\n end\n end",
"def create\n if json_path = params[:file]\n json = JSON.parse(json_path.read)\n raise StandardError, 'Must be Array' unless json.is_a? Array\n\n ActiveRecord::Base.transaction do\n form = Form.create! name: json_path.original_filename\n json.each do |qa|\n raise StandardError, 'Must be Hash.' unless qa.is_a? Hash\n question = Question.create! text: qa['question'], form_id: form.id\n %w(1 2 3 4).each do |nr|\n Answer.create! text: qa[nr], question_id: question.id\n end\n end\n end\n # there's probably a much better way to to nested model saving than this\n render :json => json\n return\n end\n end",
"def submit(contents, attrs = {})\n current_form_context.submit(contents, attrs)\n end",
"def index\n @static_contents = StaticContent.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @static_contents }\n end\n end"
] | [
"0.6282009",
"0.62486786",
"0.620182",
"0.60974866",
"0.60562325",
"0.6044423",
"0.6020207",
"0.5959216",
"0.59045476",
"0.5900914",
"0.58946466",
"0.58662325",
"0.5840403",
"0.5793481",
"0.5786892",
"0.5785959",
"0.57757515",
"0.5748183",
"0.5742464",
"0.57402545",
"0.5707125",
"0.5687998",
"0.56712574",
"0.5670805",
"0.5670805",
"0.5670805",
"0.56677026",
"0.5662811",
"0.5625124",
"0.56202525",
"0.56132424",
"0.5611278",
"0.56060266",
"0.55988765",
"0.55988765",
"0.55873525",
"0.55848",
"0.55834013",
"0.5582979",
"0.5577462",
"0.5570898",
"0.55647224",
"0.5552345",
"0.5551016",
"0.55406994",
"0.551357",
"0.5513311",
"0.5488799",
"0.5464178",
"0.546384",
"0.5457586",
"0.5453374",
"0.54317445",
"0.54143965",
"0.5393675",
"0.5382416",
"0.53815377",
"0.53602326",
"0.53265476",
"0.53265476",
"0.53265476",
"0.53265476",
"0.53265476",
"0.53265476",
"0.5323422",
"0.5317024",
"0.5312918",
"0.5302105",
"0.5294203",
"0.5294203",
"0.5293479",
"0.5287822",
"0.5282899",
"0.5274893",
"0.52678883",
"0.5267537",
"0.52631074",
"0.52585965",
"0.52537864",
"0.5252671",
"0.5245276",
"0.52392215",
"0.5236948",
"0.5229833",
"0.5228799",
"0.52250016",
"0.5218614",
"0.5184245",
"0.51828253",
"0.5174366",
"0.5170753",
"0.51704735",
"0.51638895",
"0.51583934",
"0.5153336",
"0.5153246",
"0.5145389",
"0.5144823",
"0.5141336",
"0.5135668"
] | 0.5762252 | 17 |
PUT /contents/1 PUT /contents/1.json | def update
add_breadcrumb @content, corkboard_content_path(@corkboard, @content)
@content = @corkboard.contents.find(params[:id])
@document = @content.document
@content.transaction do
@content.update_attributes(params[:content])
@document.update_attributes(params[:content][:document]) if @document
unless @content.valid? || (@content.valid? && @document && [email protected]?)
raise ActiveRecord::Rollback
end
end
respond_to do |format|
format.html { redirect_to corkboard_contents_path(@corkboard), notice: 'Content was successfully updated.' }
format.json { head :no_content }
end
rescue ActiveRecord::Rollback
respond_to do |format|
format.html do
flash.now[:error] = "Update failed."
render action: "edit"
end
format.json { render json: @content.errors, status: :unprocessable_entity }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update!(**args)\n @contents = args[:contents] if args.key?(:contents)\n end",
"def update!(**args)\n @contents = args[:contents] if args.key?(:contents)\n end",
"def update!(**args)\n @contents = args[:contents] if args.key?(:contents)\n @path = args[:path] if args.key?(:path)\n end",
"def update\n respond_to do |format|\n if @content.update(contents_params)\n format.html { redirect_to @content, notice: 'Content was successfully updated.' }\n format.json { render :show, status: :ok, location: @content }\n else\n format.html { render :edit }\n format.json { render json: @content.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(url, data)\n RestClient.put url, data, :content_type => :json\nend",
"def update\n fn = params[:id].gsub('DOTDOT','.').gsub('SLASHSLASH','/')\n File.open(fn,'w+') { |f| \n f.puts params[:content]\n }\n respond_to do |format|\n format.json { render json: { success: true} }\n end\n end",
"def save\n return if @content.nil?\n put_rest \"extra/#{@name}\", @content, :content_type => \"application/octet-stream\"\n end",
"def update\n @content = Content.find(params[:id])\n\n respond_to do |format|\n if @content.update_attributes(params[:content])\n format.html { redirect_to contents_path, notice: 'Content was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @content.errors.full_messages, status: :unprocessable_entity }\n end\n end\n end",
"def update_content(params)\n put(set_path(params[:id]), params) if validate_params(params)\n end",
"def update\n respond_to do |format|\n if @o_single.update(content_params)\n format.html { redirect_to contents_url, notice: t(\"general.successfully_updated\") }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @o_single.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_put\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n contents = last_response.body\n contents_id = contents['_id']\n\n data = File.read 'sample-traces/1.json'\n put(\"/traces/#{contents_id}\", data, 'CONTENT_TYPE': 'application/json')\n contents = last_response.body\n\n assert_equal contents_id, contents['_id']\n end",
"def update\n @entry = Entry.find(params[:id])\n respond_to do |format|\n if @entry.update({\n content: params[:entry][:content],\n journal_id: params[:entry][:journal_id]\n })\n format.html { redirect_to @entry }\n format.json { render :show }\n else\n format.html { render :edit }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put(*args)\n request :put, *args\n end",
"def update\n @content = current_user.contents.find(params[:id])\n\n respond_to do |format|\n if @content.update_attributes(params[:content])\n format.html { redirect_to(@content, :notice => 'Content was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @content.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @content = Content.find(params[:id])\n\n if @content.update(content_params)\n head :no_content\n else\n render json: @content.errors, status: :unprocessable_entity\n end\n end",
"def update\n @content = Content.find(params[:id])\n\n respond_to do |format|\n if @content.update_attributes(params[:content])\n format.html { redirect_to @content, :notice => 'Content was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @content.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @content = Content.find(params[:id])\n\n respond_to do |format|\n if @content.update_attributes(params[:content])\n format.html { redirect_to @content, notice: 'Content was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @content.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @content = Content.find(params[:id])\n\n respond_to do |format|\n if @content.update_attributes(params[:content])\n format.html { redirect_to @content, notice: 'Content was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @content.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @content = Content.find(params[:id])\n\n respond_to do |format|\n if @content.update_attributes(params[:content])\n format.html { redirect_to @content, notice: 'Content was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @content.errors, status: :unprocessable_entity }\n end\n end\n end",
"def touch_contents\n return unless respond_to?(:contents)\n\n contents.update_all(updated_at: Time.current)\n end",
"def update\n @content = Content.find(params[:id])\n\n respond_to do |format|\n if @content.update_attributes(params[:content])\n format.html { redirect_to @content, notice: 'Content was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @content.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put(*args)\n request(:put, *args)\n end",
"def update\n respond_to do |format|\n if @toc.update(toc_params)\n format.html { redirect_to @toc, notice: 'Toc was successfully updated.' }\n format.json { render :show, status: :ok, location: @toc }\n else\n format.html { render :edit }\n format.json { render json: @toc.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @content = args[:content] if args.key?(:content)\n @name = args[:name] if args.key?(:name)\n end",
"def update!(**args)\n @content = args[:content] if args.key?(:content)\n @name = args[:name] if args.key?(:name)\n end",
"def update!(**args)\n @content = args[:content] if args.key?(:content)\n @name = args[:name] if args.key?(:name)\n end",
"def update!(**args)\n @content = args[:content] if args.key?(:content)\n end",
"def update!(**args)\n @content = args[:content] if args.key?(:content)\n end",
"def update!(**args)\n @content = args[:content] if args.key?(:content)\n end",
"def update!(**args)\n @content = args[:content] if args.key?(:content)\n end",
"def put(*args)\n prepare_request(:put, args)\n @@client.add(:put, @path, *args)\n end",
"def put_content(content_id, payload)\n put_json(content_url(content_id), payload)\n end",
"def put payload, path = \"\"\n make_request(path, \"put\", payload)\n end",
"def update\n @entry = Entry.find(params[:id])\n\n if @entry.update_attributes(params[:entry])\n head :no_content\n else\n render json: @entry.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @content.update(content_params)\n format.html { redirect_to contents_path, notice: 'Test was successfully updated.' }\n format.json { render :show, status: :ok, location: @content }\n else\n format.html { render :edit }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put(path, opts = {})\n request(:put, path, opts).body\n end",
"def put!\n request! :put\n end",
"def update!(**args)\n @contents = args[:contents] if args.key?(:contents)\n @default_viewport = args[:default_viewport] if args.key?(:default_viewport)\n @description = args[:description] if args.key?(:description)\n @id = args[:id] if args.key?(:id)\n @name = args[:name] if args.key?(:name)\n @project_id = args[:project_id] if args.key?(:project_id)\n end",
"def update\n @structure_content = Structure::Content.find(params[:id])\n\n respond_to do |format|\n if @structure_content.update_attributes(params[:structure_content])\n format.html { redirect_to @structure_content, notice: 'Content was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @structure_content.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @content = Content.find_or_create_by_name(params[:id])\n @content.attributes = params[:content]\n\n respond_to do |format|\n if @content.save\n format.html { redirect_to(@content, :notice => 'Content was successfully created.') }\n format.json { render :json => @content, :status => :created, :location => @content }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @content.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @content = args[:content] if args.key?(:content)\n @key = args[:key] if args.key?(:key)\n @mime_type = args[:mime_type] if args.key?(:mime_type)\n end",
"def update!(**args)\n @contents = args[:contents] if args.key?(:contents)\n @errors = args[:errors] if args.key?(:errors)\n @is_pending = args[:is_pending] if args.key?(:is_pending)\n @is_sitemaps_index = args[:is_sitemaps_index] if args.key?(:is_sitemaps_index)\n @last_downloaded = args[:last_downloaded] if args.key?(:last_downloaded)\n @last_submitted = args[:last_submitted] if args.key?(:last_submitted)\n @path = args[:path] if args.key?(:path)\n @type = args[:type] if args.key?(:type)\n @warnings = args[:warnings] if args.key?(:warnings)\n end",
"def put(path = '/files/', params = {})\n request :put, path, params\n end",
"def http_put(path, data, content_type = 'application/json')\n http_methods(path, :put, data, content_type)\n end",
"def update\n @content = Content.find(params[:id])\n \n if @content.update_attributes(params[:content])\n redirect_to contents_path, :notice => 'Content was successfully updated.'\n else\n render :action => \"edit\" \n end\n \n end",
"def update\n @meta_content = MetaContent.find(params[:id])\n \n respond_to do |format|\n if @meta_content.update_attributes(params[:meta_content])\n format.html { redirect_to @meta_content, notice: 'Meta content was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @meta_content.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @todo = Todo.find(params[:id])\n @todo.update_attributes(params[:todo])\n render :json => @todo\n end",
"def contents=(new_contents)\n debug(\"#{self.class.name}#contents= called, going to update containing model's #{attr_name}\")\n @contents = new_contents\n write\n end",
"def update_aos_version(args = {}) \n id = args['id']\n temp_path = \"/aosversions.json/{aosVersionId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"aosversionId\")\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!(**args)\n @content = args[:content] if args.key?(:content)\n @format = args[:format] if args.key?(:format)\n end",
"def update\n respond_to do |format|\n if @content.update(content_params)\n format.html { redirect_to @content, notice: 'Content was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @content.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @file_contents = args[:file_contents] if args.key?(:file_contents)\n end",
"def update(*args)\n put(*args)\n end",
"def update(*args)\n put(*args)\n end",
"def put(path, **args); end",
"def update\n @main_content = MainContent.find(params[:id])\n\n respond_to do |format|\n if @main_content.update_attributes(params[:main_content])\n format.html { redirect_to :back, notice: 'Main content was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @main_content.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @content = args[:content] if args.key?(:content)\n @content_uri = args[:content_uri] if args.key?(:content_uri)\n @display_name = args[:display_name] if args.key?(:display_name)\n @knowledge_types = args[:knowledge_types] if args.key?(:knowledge_types)\n @mime_type = args[:mime_type] if args.key?(:mime_type)\n @name = args[:name] if args.key?(:name)\n @raw_content = args[:raw_content] if args.key?(:raw_content)\n end",
"def put(path, body = nil, ctype = 'application/json')\n make_call(mk_conn(path, 'Content-Type': ctype,\n 'Accept': 'application/json'),\n :put, nil, body.to_json)\n end",
"def write(contents = @request_body.to_s)\n @contents = contents\n\n File.open(@src_path, 'w') do |file|\n file.write @contents\n end\n end",
"def update!(**args)\n @content_details = args[:content_details] if args.key?(:content_details)\n @errors = args[:errors] if args.key?(:errors)\n @etag = args[:etag] if args.key?(:etag)\n @id = args[:id] if args.key?(:id)\n @kind = args[:kind] if args.key?(:kind)\n @snippet = args[:snippet] if args.key?(:snippet)\n end",
"def update!(**args)\n @contents = args[:contents] if args.key?(:contents)\n @default_viewport = args[:default_viewport] if args.key?(:default_viewport)\n @expandable = args[:expandable] if args.key?(:expandable)\n @key = args[:key] if args.key?(:key)\n @name = args[:name] if args.key?(:name)\n @type = args[:type] if args.key?(:type)\n @visibility = args[:visibility] if args.key?(:visibility)\n end",
"def update\n @content = Content.find_by_id(params[:id])\n if @content.update_attributes(:name=>params[:body][:name],:description=>params[:body][:description])\n render :json=>{:response=>\"success\"}\n else\n render :json=>failure1(@content.errors)\n end\n end",
"def sync\n #debug 'content sync'\n # We're safe not testing for the 'source' if there's no 'should'\n # because we wouldn't have gotten this far if there weren't at least\n # one valid value somewhere.\n @resource.write(:content)\n end",
"def update\n respond_to do |format|\n if @content_entry.update(content_entry_params)\n format.html { redirect_to @content_entry, notice: 'Entry was successfully updated.' }\n format.json { render :show, status: :ok, location: @content_entry }\n else\n format.html { render :edit }\n format.json { render json: @content_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @content = args[:content] if args.key?(:content)\n @content_type = args[:content_type] if args.key?(:content_type)\n @mime_type = args[:mime_type] if args.key?(:mime_type)\n end",
"def update!(**args)\n @content = args[:content] if args.key?(:content)\n @mime_type = args[:mime_type] if args.key?(:mime_type)\n end",
"def update!(**args)\n @content = args[:content] if args.key?(:content)\n @mime_type = args[:mime_type] if args.key?(:mime_type)\n end",
"def update!(**args)\n @content = args[:content] if args.key?(:content)\n @mime_type = args[:mime_type] if args.key?(:mime_type)\n end",
"def update!(**args)\n @content = args[:content] if args.key?(:content)\n @mime_type = args[:mime_type] if args.key?(:mime_type)\n end",
"def update!(**args)\n @content = args[:content] if args.key?(:content)\n @mime_type = args[:mime_type] if args.key?(:mime_type)\n end",
"def update_question_content\n question_params = params.require(:question).permit(:id, :content)\n\n render json: Question.update_question_content(question_params)\n end",
"def update\n @bowl = Bowl.find(params[:id])\n \n # set bowl modify time\n @bowl.modified = Time.now\n \n respond_to do |format|\n if @bowl.update_attributes(params[:bowl])\n \n Rails.logger.info \"Updating Bowl Contents\"\n \n # remove all contents for this bowl and add new\n @bowl.contents.delete_all(\"bowl_id=\" + @bowl.id)\n \n params.keys.each do |param|\n if param.start_with?(\"input_\") and (params[param] != \"\") \n @bowl.contents.create(:bowl_id => @bowl.id, :dryfruit_id => param[6, 2], :quantity => params[param]) \n end\n end\n\n format.html { redirect_to bowls_path, :notice => 'Bowl was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @bowl.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @revision = Revision.find(params[:id])\n\n if @revision.update(params[:revision])\n head :no_content\n else\n render json: @revision.errors, status: :unprocessable_entity\n end\n end",
"def update\n @content = Content.find(params[:id])\n #Add Date Created, Date Modified\n @content.date_modified = Time.now\n\n respond_to do |format|\n if @content.update_attributes(params[:content])\n format.html { redirect_to @content, notice: 'Content was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @content.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @extra = Extra.find(params[:id])\n\n if @extra.update(extra_params)\n head :no_content\n else\n render json: @extra.errors, status: :unprocessable_entity\n end\n end",
"def update!(**args)\n @content_details = args[:content_details] if args.key?(:content_details)\n @etag = args[:etag] if args.key?(:etag)\n @id = args[:id] if args.key?(:id)\n @kind = args[:kind] if args.key?(:kind)\n @snippet = args[:snippet] if args.key?(:snippet)\n end",
"def put(path, data = {})\n request 'PUT', path, body: data.to_json\n end",
"def put(type, info)\n path, info = type_info(type, :path), force_case(info)\n ida = type == :client ? 'client_id' : 'id'\n raise ArgumentError, \"info must include #{ida}\" unless id = info[ida]\n hdrs = headers\n if info && info['meta'] && (etag = info['meta']['version'])\n hdrs.merge!('if-match' => etag)\n end\n reply = json_parse_reply(@key_style,\n *json_put(@target, \"#{path}/#{Addressable::URI.encode(id)}\", info, hdrs))\n\n # hide client endpoints that are not quite scim compatible\n type == :client && !reply ? get(type, info['client_id']): reply\n end",
"def update!(**args)\n @content = args[:content] if args.key?(:content)\n @kind = args[:kind] if args.key?(:kind)\n @uploader_name = args[:uploader_name] if args.key?(:uploader_name)\n end",
"def update!(**args)\n @content = args[:content] if args.key?(:content)\n @file = args[:file] if args.key?(:file)\n @path = args[:path] if args.key?(:path)\n @permissions = args[:permissions] if args.key?(:permissions)\n @state = args[:state] if args.key?(:state)\n end",
"def put(path, params)\n headers = {:Authorization => \"token #{token}\", :content_type => :json, :accept => :json}\n res = RestClient.put(\"#{github_api_uri}/#{path}\", params.to_json, headers)\n Yajl.load(res)\n end",
"def update\n respond_to do |format|\n if @content.update(content_params)\n format.html { redirect_to coach_contents_url, notice: 'Content was successfully updated.' }\n format.json { render :show, status: :ok, location: @content }\n else\n format.html { render :edit }\n format.json { render json: @content.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update options={}\n client.put(\"/#{id}\", options)\n end",
"def update\n respond_to do |format|\n if @content.update(content_params)\n format.html { redirect_to @content, notice: 'Content was successfully updated.' }\n format.json { render :show, status: :ok, location: @content }\n else\n format.html { render :edit }\n format.json { render json: @content.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @content.update(content_params)\n format.html { redirect_to @content, notice: 'Content was successfully updated.' }\n format.json { render :show, status: :ok, location: @content }\n else\n format.html { render :edit }\n format.json { render json: @content.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @content.update(content_params)\n format.html { redirect_to @content, notice: 'Content was successfully updated.' }\n format.json { render :show, status: :ok, location: @content }\n else\n format.html { render :edit }\n format.json { render json: @content.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @content.update(content_params)\n format.html { redirect_to @content, notice: 'Content was successfully updated.' }\n format.json { render :show, status: :ok, location: @content }\n else\n format.html { render :edit }\n format.json { render json: @content.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @entry = Entry.find(params[:id])\n\n respond_to do |format|\n if @entry.update_attributes(params[:entry])\n format.json { render json: @entry, status: :created, location: @entry }\n else\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_metadata(params)\n @client.put(metadata_path, nil, params, \"Content-Type\" => \"application/json\")\n end",
"def update\n respond_to do |format|\n if @content.update(content_params)\n format.html { redirect_to :action => 'edit'}\n flash[:notice] = 'Indholdet blev opdateret.' \n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @content.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @api_v1_todo.update(api_v1_todo_params)\n format.json { render json: @api_v1_todo, status: :ok }\n else\n format.json { render json: @api_v1_todo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @content = Content.find(params[:id])\n\n respond_to do |format|\n if @content.update_attributes(params[:content])\n flash[:success] = 'Content was successfully updated.'\n format.html { redirect_to admin_content_path(@content.id) }\n format.json { head :ok }\n else\n flash[:error] = @content.errors.full_messages.join('')\n format.html { render action: \"edit\" }\n format.json { render json: @content.errors.full_messages.join(''), status: :unprocessable_entity }\n end\n end\n end",
"def update\n @static_content = StaticContent.find(params[:id])\n\n params[:static_content][:name] = get_clean_name(params[:static_content][:name])\n\n respond_to do |format|\n if @static_content.update_attributes(params[:static_content])\n format.html { redirect_to @static_content, notice: 'Static content was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @static_content.errors, status: :unprocessable_entity }\n end\n end\n end",
"def _put(path, contents)\n forbidden unless is_allowed? path\n existed = File.file? path\n # ensure path exists, and write to file\n FileUtils.mkdir_p File.dirname(path)\n IO.write path, contents, :mode => 'wb+'\n existed ? ok : created\n rescue SystemCallError => e\n logger.error e.message\n conflict\n end",
"def http_put(request, response)\n body = request.body_as_stream\n path = request.path\n\n # Intercepting Content-Range\n if request.header('Content-Range')\n # An origin server that allows PUT on a given target resource MUST send\n # a 400 (Bad Request) response to a PUT request that contains a\n # Content-Range header field.\n #\n # Reference: http://tools.ietf.org/html/rfc7231#section-4.3.4\n fail Exception::BadRequest, 'Content-Range on PUT requests are forbidden.'\n end\n\n # Intercepting the Finder problem\n expected = request.header('X-Expected-Entity-Length').to_i\n if expected > 0\n # Many webservers will not cooperate well with Finder PUT requests,\n # because it uses 'Chunked' transfer encoding for the request body.\n #\n # The symptom of this problem is that Finder sends files to the\n # server, but they arrive as 0-length files in PHP.\n #\n # If we don't do anything, the user might think they are uploading\n # files successfully, but they end up empty on the server. Instead,\n # we throw back an error if we detect this.\n #\n # The reason Finder uses Chunked, is because it thinks the files\n # might change as it's being uploaded, and therefore the\n # Content-Length can vary.\n #\n # Instead it sends the X-Expected-Entity-Length header with the size\n # of the file at the very start of the request. If this header is set,\n # but we don't get a request body we will fail the request to\n # protect the end-user.\n\n # Only reading first byte\n first_byte = body.read(1)\n unless first_byte\n fail Exception::Forbidden, 'This server is not compatible with OS/X finder. Consider using a different WebDAV client or webserver.'\n end\n\n # The body needs to stay intact, so we copy everything to a\n # temporary stream.\n\n new_body = StringIO.new\n new_body.write(first_byte)\n IO.copy_stream(body, new_body)\n new_body.rewind\n\n body = new_body\n end\n\n if @server.tree.node_exists(path)\n node = @server.tree.node_for_path(path)\n\n # If the node is a collection, we'll deny it\n unless node.is_a?(IFile)\n fail Exception::Conflict, 'PUT is not allowed on non-files.'\n end\n\n etag = Box.new\n return false unless @server.update_file(path, body, etag)\n etag = etag.value\n\n response.update_header('Content-Length', '0')\n response.update_header('ETag', etag) if etag\n response.status = 204\n else\n # If we got here, the resource didn't exist yet.\n etag = Box.new\n unless @server.create_file(path, body, etag)\n # For one reason or another the file was not created.\n return false\n end\n etag = etag.value\n\n response.update_header('Content-Length', '0')\n response.update_header('ETag', etag) if etag\n response.status = 201\n end\n\n # Sending back false will interupt the event chain and tell the server\n # we've handled this method.\n false\n end",
"def update\n @content_item = ContentItem.find(params[:id])\n\n respond_to do |format|\n if @content_item.update_attributes(params[:content_item])\n format.html { redirect_to @content_item, notice: 'Content item was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @content_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put(id, json)\n with_endpoint do |endpoint|\n url = [endpoint, @resource_name, id].compact.join('/')\n url += \"/\" \n return HTTParty.put(url, :body => json, :timeout => 4, :headers => { 'Content-Type' => 'application/json' })\n end\n end",
"def index\n @contents = Content.all\n render json: @contents\n end",
"def put(*args)\n execute(:put, *args)\n end",
"def update!(**args)\n @content = args[:content] if args.key?(:content)\n @title = args[:title] if args.key?(:title)\n end",
"def update!(**args)\n @content = args[:content] if args.key?(:content)\n @gcs_content_uri = args[:gcs_content_uri] if args.key?(:gcs_content_uri)\n @language = args[:language] if args.key?(:language)\n @type = args[:type] if args.key?(:type)\n end"
] | [
"0.65915227",
"0.65915227",
"0.6413576",
"0.6361351",
"0.6278191",
"0.6209755",
"0.61951864",
"0.60822284",
"0.60800284",
"0.6031631",
"0.60218817",
"0.59756523",
"0.59215033",
"0.59085596",
"0.5867997",
"0.5830863",
"0.57885987",
"0.57885987",
"0.57885987",
"0.57880205",
"0.5772003",
"0.5769093",
"0.5737043",
"0.5733639",
"0.5733639",
"0.5732543",
"0.5715841",
"0.5715841",
"0.5715841",
"0.5715841",
"0.5701528",
"0.5695791",
"0.5681052",
"0.5675241",
"0.5636978",
"0.5635683",
"0.56261086",
"0.56157327",
"0.56144345",
"0.561098",
"0.5608558",
"0.55950737",
"0.5593602",
"0.5588419",
"0.5581287",
"0.55810606",
"0.55734664",
"0.55705386",
"0.55579144",
"0.5539536",
"0.5525973",
"0.55172956",
"0.5512176",
"0.5512176",
"0.55120254",
"0.5503869",
"0.5498875",
"0.5498155",
"0.54934",
"0.54920846",
"0.54907846",
"0.54804385",
"0.54758525",
"0.54749256",
"0.54686546",
"0.54650396",
"0.54650396",
"0.54650396",
"0.54650396",
"0.54650396",
"0.5461881",
"0.5460595",
"0.5460013",
"0.54505867",
"0.544295",
"0.5442204",
"0.54310507",
"0.5428726",
"0.5422078",
"0.5414462",
"0.54099196",
"0.54081005",
"0.54050446",
"0.5396264",
"0.5396264",
"0.5396264",
"0.5396264",
"0.53926325",
"0.53836966",
"0.53750944",
"0.5361139",
"0.5360624",
"0.5352053",
"0.5346629",
"0.53362095",
"0.53291816",
"0.5327584",
"0.53266346",
"0.53202355",
"0.531573",
"0.5313766"
] | 0.0 | -1 |
TODO add game rule in game info | def generate_game_info(room)
players = room.players.inject(""){ |acc, p| acc << " id : #{p.id}, name : #{p.name}\n" }
"======================================\n"+
"[Game Information]\n"+
"Room name : #{room.name}\n"+
"Round : #{room.max_round} round\n"+
"player : #{room.player_num} player\n"+
"#{players}"+
"======================================\n"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def apply(game)\n end",
"def game_mode; end",
"def gameflow\n \n end",
"def game; end",
"def game; end",
"def game; end",
"def game; end",
"def game; end",
"def game; end",
"def game; end",
"def games\n 'Games/Toys' if %w[r m].include?(record.leader[6]) &&\n (%w[g w].include?(record.leader[16]) ||\n (record['006'] && record['006'].value[9] == 'g') ||\n (record['008'] && (%w[g w].include?(record['008'].value[33]) || record['008'].value[26] == 'g')))\n end",
"def game_state(game_id)\n\n end",
"def game\n {\n starting_decision: :stormy_night,\n decisions: {\n stormy_night: {\n description: 'It was a dark and stormy night. (storyline located in decision.rb)',\n option_one: {\n description: 'Go to sleep.',\n decision: :nap\n },\n option_two: {\n description: 'Watch a movie.',\n decision: :movie\n },\n option_three: {\n description: 'Go outside.',\n decision: :go_outside\n },\n option_four: {\n description: 'Get a snack.',\n decision: :get_a_snack\n }\n },\n nap: {\n description: 'You took a nap. The end.',\n option_one: {\n description: 'Start over.',\n decision: :stormy_night\n }\n }\n }\n }\nend",
"def onalg_gameinfo(msg_details)\n info = YAML::load(msg_details)\n @game_gfx.onalg_gameinfo(info)\n end",
"def game_title\n object.game ? object.game.title : 'Не прикреплен ни к одной игре'\n end",
"def derive_game_model\n case @selected_game\n when 1\n TetrisMetaData\n when 2\n GameOfLifeMetaData\n when 3\n SokobanMetaData\n when 4\n SnakeMetaData\n when 5\n PingPongMetaData\n when 6\n FractalMetaData\n when 7\n DemoSpritesMetaData\n end\n end",
"def create_group_stage_game(game) \n \n if Game.cup_home_away_exist?(self, game[0], game[1]) \n \n standing = Standing.find(:first, :conditions => [\"cup_id = ? and item_id = ? and item_type = ?\", self.id, game[0].id, game[0].class.to_s])\n\n last_game = get_the_last_game \n \n return Game.create!(:name => \"Group #{standing.group_stage_name}\", \n :cup_id => self.id, :home_id => game[0].id ,:away_id => game[1].id, \n :starts_at => last_game['starts_at'], :ends_at => last_game['ends_at'], \n :reminder_at => last_game['reminder_at'], :deadline_at => last_game['deadline_at'], \n :type_name => 'GroupStage', :jornada => last_game['jornada'],\n :points_for_single => POINTS_FOR_SINGLE, :points_for_double => POINTS_FOR_DOUBLE, \n :points_for_winner => POINTS_FOR_WINNER, :points_for_draw => POINTS_FOR_DRAW, \n :points_for_goal_difference => POINTS_FOR_GOAL_DIFFERENCE,\n :points_for_goal_total => POINTS_FOR_GOAL_TOTAL)\n end\n end",
"def gameplay; @gameplay ||= match.gameplays[current_player_side]; end",
"def league; end",
"def game\n Game.find(self[:game_id])\n end",
"def game_engine\n\t\tif @ai_on == true\n\t\t\tgame_with_ai\n\t\telse\n\t\t\t@player_two = 'black'\n\t\t\tgame_with_two_players\n\t\tend\n\t\tannounce_winner\n\t\tend_of_game\n\tend",
"def game_state\n end",
"def use_default_gamecall\n event = Event.find_by(id: self.event_id)\n title = self.title\n\n #----------Openers----------\n openers = event.plays.where('situation1 = ?', true)\n openersLeft = openers.where('hash_mark = ?', 'Left')\n openersRight = openers.where('hash_mark = ?', 'Right')\n\n #Openers Left Hash\n unless openersLeft[0].nil? \n openl1 = openersLeft[0].fullname \n end\n unless openersLeft[1].nil? \n openl2 = openersLeft[1].fullname \n end\n unless openersLeft[2].nil? \n openl3 = openersLeft[2].fullname \n end\n unless openersLeft[3].nil? \n openl4 = openersLeft[3].fullname \n end\n unless openersLeft[4].nil? \n openl5 = openersLeft[4].fullname \n end\n unless openersLeft[5].nil? \n openl6 = openersLeft[5].fullname \n end\n unless openersLeft[6].nil? \n openl7 = openersLeft[6].fullname \n end\n unless openersLeft[7].nil? \n openl8 = openersLeft[7].fullname \n end\n unless openersLeft[8].nil? \n openl9 = openersLeft[8].fullname \n end\n unless openersLeft[9].nil? \n openl10 = openersLeft[9].fullname \n end\n unless openersLeft[10].nil? \n openl11 = openersLeft[10].fullname \n end\n unless openersLeft[11].nil? \n openl12 = openersLeft[11].fullname \n end\n unless openersLeft[12].nil? \n openl13 = openersLeft[12].fullname \n end\n unless openersLeft[13].nil? \n openl14 = openersLeft[13].fullname \n end \n unless openersLeft[14].nil? \n openl15 = openersLeft[14].fullname \n end \n\n #Openers Right Hash\n unless openersRight[0].nil? \n openr1 = openersRight[0].fullname \n end\n unless openersRight[1].nil? \n openr2 = openersRight[1].fullname \n end\n unless openersRight[2].nil? \n openr3 = openersRight[2].fullname \n end\n unless openersRight[3].nil? \n openr4 = openersRight[3].fullname \n end\n unless openersRight[4].nil? \n openr5 = openersRight[4].fullname \n end\n unless openersRight[5].nil? \n openr6 = openersRight[5].fullname \n end\n unless openersRight[6].nil? \n openr7 = openersRight[6].fullname \n end\n unless openersRight[7].nil? \n openr8 = openersRight[7].fullname \n end\n unless openersRight[8].nil? \n openr9 = openersRight[8].fullname \n end\n unless openersRight[9].nil? \n openr10 = openersRight[9].fullname \n end\n unless openersRight[10].nil? \n openr11 = openersRight[10].fullname \n end\n unless openersRight[11].nil? \n openr12 = openersRight[11].fullname \n end\n unless openersRight[12].nil? \n openr13 = openersRight[12].fullname \n end\n unless openersRight[13].nil? \n openr14 = openersRight[13].fullname \n end \n unless openersRight[14].nil? \n openr15 = openersRight[14].fullname \n end \n #----------End Openers----------\n\n #----------1st/2nd & 10----------\n firstTens = event.plays.where('situation2 = ?', true)\n \n runFirstTens = firstTens.where('play_type = ?', 'Run')\n runFirstTensLeft = runFirstTens.where('hash_mark = ?', 'Left')\n runFirstTensRight = runFirstTens.where('hash_mark = ?', 'Right')\n \n passFirstTens = firstTens.where('play_type = ?', 'Pass')\n passFirstTensLeft = passFirstTens.where('hash_mark = ?', 'Left')\n passFirstTensRight = passFirstTens.where('hash_mark = ?', 'Right')\n\n #Run Left Hash\n unless runFirstTensLeft[0].nil? \n rftl1 = runFirstTensLeft[0].fullname \n end\n unless runFirstTensLeft[1].nil? \n rftl2 = runFirstTensLeft[1].fullname \n end\n unless runFirstTensLeft[2].nil? \n rftl3 = runFirstTensLeft[2].fullname \n end\n unless runFirstTensLeft[3].nil? \n rftl4 = runFirstTensLeft[3].fullname \n end\n unless runFirstTensLeft[4].nil? \n rftl5 = runFirstTensLeft[4].fullname \n end\n unless runFirstTensLeft[5].nil? \n rftl6 = runFirstTensLeft[5].fullname \n end\n unless runFirstTensLeft[6].nil? \n rftl7 = runFirstTensLeft[6].fullname \n end\n unless runFirstTensLeft[7].nil? \n rftl8 = runFirstTensLeft[7].fullname \n end\n unless runFirstTensLeft[8].nil? \n rftl9 = runFirstTensLeft[8].fullname \n end\n unless runFirstTensLeft[9].nil? \n rftl10 = runFirstTensLeft[9].fullname \n end\n unless runFirstTensLeft[10].nil? \n rftl11 = runFirstTensLeft[10].fullname \n end\n unless runFirstTensLeft[11].nil? \n rftl12 = runFirstTensLeft[11].fullname \n end\n unless runFirstTensLeft[12].nil? \n rftl13 = runFirstTensLeft[12].fullname \n end\n unless runFirstTensLeft[13].nil? \n rftl14 = runFirstTensLeft[13].fullname \n end \n unless runFirstTensLeft[14].nil? \n rftl15 = runFirstTensLeft[14].fullname \n end \n\n #Run Right Hash\n unless runFirstTensRight[0].nil? \n rftr1 = runFirstTensRight[0].fullname \n end\n unless runFirstTensRight[1].nil? \n rftr2 = runFirstTensRight[1].fullname \n end\n unless runFirstTensRight[2].nil? \n rftr3 = runFirstTensRight[2].fullname \n end\n unless runFirstTensRight[3].nil? \n rftr4 = runFirstTensRight[3].fullname \n end\n unless runFirstTensRight[4].nil? \n rftr5 = runFirstTensRight[4].fullname \n end\n unless runFirstTensRight[5].nil? \n rftr6 = runFirstTensRight[5].fullname \n end\n unless runFirstTensRight[6].nil? \n rftr7 = runFirstTensRight[6].fullname \n end\n unless runFirstTensRight[7].nil? \n rftr8 = runFirstTensRight[7].fullname \n end\n unless runFirstTensRight[8].nil? \n rftr9 = runFirstTensRight[8].fullname \n end\n unless runFirstTensRight[9].nil? \n rftr10 = runFirstTensRight[9].fullname \n end\n unless runFirstTensRight[10].nil? \n rftr11 = runFirstTensRight[10].fullname \n end\n unless runFirstTensRight[11].nil? \n rftr12 = runFirstTensRight[11].fullname \n end\n unless runFirstTensRight[12].nil? \n rftr13 = runFirstTensRight[12].fullname \n end\n unless runFirstTensRight[13].nil? \n rftr14 = runFirstTensRight[13].fullname \n end\n unless runFirstTensRight[14].nil? \n rftr15 = runFirstTensRight[14].fullname \n end \n\n #Pass Left Hash\n unless passFirstTensLeft[0].nil? \n pftl1 = passFirstTensLeft[0].fullname \n end\n unless passFirstTensLeft[1].nil? \n pftl2 = passFirstTensLeft[1].fullname \n end\n unless passFirstTensLeft[2].nil? \n pftl3 = passFirstTensLeft[2].fullname \n end\n unless passFirstTensLeft[3].nil? \n pftl4 = passFirstTensLeft[3].fullname \n end\n unless passFirstTensLeft[4].nil? \n pftl5 = passFirstTensLeft[4].fullname \n end\n unless passFirstTensLeft[5].nil? \n pftl6 = passFirstTensLeft[5].fullname \n end\n unless passFirstTensLeft[6].nil? \n pftl7 = passFirstTensLeft[6].fullname \n end\n unless passFirstTensLeft[7].nil? \n pftl8 = passFirstTensLeft[7].fullname \n end\n unless passFirstTensLeft[8].nil? \n pftl9 = passFirstTensLeft[8].fullname \n end\n unless passFirstTensLeft[9].nil? \n pftl10 = passFirstTensLeft[9].fullname \n end\n unless passFirstTensLeft[10].nil? \n pftl11 = passFirstTensLeft[10].fullname \n end\n unless passFirstTensLeft[11].nil? \n pftl12 = passFirstTensLeft[11].fullname \n end\n unless passFirstTensLeft[12].nil? \n pftl13 = passFirstTensLeft[12].fullname \n end\n unless passFirstTensLeft[13].nil? \n pftl14 = passFirstTensLeft[13].fullname \n end \n unless passFirstTensLeft[14].nil? \n pftl15 = passFirstTensLeft[14].fullname \n end \n\n #Pass Right Hash\n unless passFirstTensRight[0].nil? \n pftr1 = passFirstTensRight[0].fullname \n end\n unless passFirstTensRight[1].nil? \n pftr2 = passFirstTensRight[1].fullname \n end\n unless passFirstTensRight[2].nil? \n pftr3 = passFirstTensRight[2].fullname \n end\n unless passFirstTensRight[3].nil? \n pftr4 = passFirstTensRight[3].fullname \n end\n unless passFirstTensRight[4].nil? \n pftr5 = passFirstTensRight[4].fullname \n end\n unless passFirstTensRight[5].nil? \n pftr6 = passFirstTensRight[5].fullname \n end\n unless passFirstTensRight[6].nil? \n pftr7 = passFirstTensRight[6].fullname \n end \n unless passFirstTensRight[7].nil? \n pftr8 = passFirstTensRight[7].fullname \n end\n unless passFirstTensRight[8].nil? \n pftr9 = passFirstTensRight[8].fullname \n end \n unless passFirstTensRight[9].nil? \n pftr10 = passFirstTensRight[9].fullname \n end\n unless passFirstTensRight[10].nil? \n pftr11 = passFirstTensRight[10].fullname \n end\n unless passFirstTensRight[11].nil? \n pftr12 = passFirstTensRight[11].fullname \n end\n unless passFirstTensRight[12].nil? \n pftr13 = passFirstTensRight[12].fullname \n end\n unless passFirstTensRight[13].nil? \n pftr14 = passFirstTensRight[13].fullname \n end\n unless passFirstTensRight[14].nil? \n pftr15 = passFirstTensRight[14].fullname \n end\n\n\n #Number of user's run plays in situation 2\n num_ftr = self.user.s_name2_num_run\n\n #Left Hash\n # ftl_s0 \n if num_ftr > 0\n ftl_s0 = self.user.s_name2 + ' - Run'\n else\n ftl_s0 = self.user.s_name2 + ' - Pass'\n end\n\n #ftl_s1 \n if num_ftr > 0\n ftl_s1 = rftl1\n else\n ftl_s1 = pftl1\n end\n\n #ftl_s2\n if num_ftr == 0\n ftl_s2 = pftl2\n elsif num_ftr == 1\n ftl_s2 = self.user.s_name2 + ' - Pass'\n else num_ftr > 1\n ftl_s2 = rftl2\n end\n\n #ftl_s3\n case num_ftr\n when 0 then ftl_s3 = pftl3 \n when 1 then ftl_s3 = pftl1\n when 2 then ftl_s3 = self.user.s_name2 + ' - Pass'\n when 3..100 then ftl_s3 = rftl3\n end\n\n #ftl_s4\n case num_ftr\n when 0 then ftl_s4 = pftl4 \n when 1 then ftl_s4 = pftl2\n when 2 then ftl_s4 = pftl1\n when 3 then ftl_s4 = self.user.s_name2 + ' - Pass'\n when 4..100 then ftl_s4 = rftl4\n end\n\n #ftl_s5\n case num_ftr\n when 0 then ftl_s5 = pftl5 \n when 1 then ftl_s5 = pftl3\n when 2 then ftl_s5 = pftl2\n when 3 then ftl_s5 = pftl1\n when 4 then ftl_s5 = self.user.s_name2 + ' - Pass'\n when 5..100 then ftl_s5 = rftl5\n end\n\n #ftl_s6\n case num_ftr\n when 0 then ftl_s6 = pftl6 \n when 1 then ftl_s6 = pftl4\n when 2 then ftl_s6 = pftl3\n when 3 then ftl_s6 = pftl2\n when 4 then ftl_s6 = pftl1\n when 5 then ftl_s6 = self.user.s_name2 + ' - Pass'\n when 6..100 then ftl_s6 = rftl6\n end\n\n #ftl_s7\n case num_ftr\n when 0 then ftl_s7 = pftl7 \n when 1 then ftl_s7 = pftl5\n when 2 then ftl_s7 = pftl4\n when 3 then ftl_s7 = pftl3\n when 4 then ftl_s7 = pftl2\n when 5 then ftl_s7 = pftl1\n when 6 then ftl_s7 = self.user.s_name2 + ' - Pass'\n when 7..100 then ftl_s7 = rftl7\n end\n\n #ftl_s8\n case num_ftr\n when 0 then ftl_s8 = pftl8 \n when 1 then ftl_s8 = pftl6\n when 2 then ftl_s8 = pftl5\n when 3 then ftl_s8 = pftl4\n when 4 then ftl_s8 = pftl3\n when 5 then ftl_s8 = pftl2\n when 6 then ftl_s8 = pftl1\n when 7 then ftl_s8 = self.user.s_name2 + ' - Pass'\n when 8..100 then ftl_s8 = rftl8\n end\n\n #ftl_s9\n case num_ftr\n when 0 then ftl_s9 = pftl9 \n when 1 then ftl_s9 = pftl7\n when 2 then ftl_s9 = pftl6\n when 3 then ftl_s9 = pftl5\n when 4 then ftl_s9 = pftl4\n when 5 then ftl_s9 = pftl3\n when 6 then ftl_s9 = pftl2\n when 7 then ftl_s9 = pftl1\n when 8 then ftl_s9 = self.user.s_name2 + ' - Pass'\n when 9..100 then ftl_s9 = rftl9\n end\n\n #ftl_s10\n case num_ftr\n when 0 then ftl_s10 = pftl10 \n when 1 then ftl_s10 = pftl8\n when 2 then ftl_s10 = pftl7\n when 3 then ftl_s10 = pftl6\n when 4 then ftl_s10 = pftl5\n when 5 then ftl_s10 = pftl4\n when 6 then ftl_s10 = pftl3\n when 7 then ftl_s10 = pftl2\n when 8 then ftl_s10 = pftl1\n when 9 then ftl_s10 = self.user.s_name2 + ' - Pass'\n when 10..100 then ftl_s10 = rftl10\n end\n\n #ftl_s11\n case num_ftr\n when 0 then ftl_s11 = pftl11 \n when 1 then ftl_s11 = pftl9\n when 2 then ftl_s11 = pftl8\n when 3 then ftl_s11 = pftl7\n when 4 then ftl_s11 = pftl6\n when 5 then ftl_s11 = pftl5\n when 6 then ftl_s11 = pftl4\n when 7 then ftl_s11 = pftl3\n when 8 then ftl_s11 = pftl2\n when 9 then ftl_s11 = pftl1\n when 10 then ftl_s11 = self.user.s_name2 + ' - Pass'\n when 11..100 then ftl_s11 = rftl11\n end\n\n #ftl_s12\n case num_ftr\n when 0 then ftl_s12 = pftl12 \n when 1 then ftl_s12 = pftl10\n when 2 then ftl_s12 = pftl9\n when 3 then ftl_s12 = pftl8\n when 4 then ftl_s12 = pftl7\n when 5 then ftl_s12 = pftl6\n when 6 then ftl_s12 = pftl5\n when 7 then ftl_s12 = pftl4\n when 8 then ftl_s12 = pftl3\n when 9 then ftl_s12 = pftl2\n when 10 then ftl_s12 = pftl1\n when 11 then ftl_s12 = self.user.s_name2 + ' - Pass'\n when 12..100 then ftl_s12 = rftl12\n end\n\n #ftl_s13\n case num_ftr\n when 0 then ftl_s13 = pftl13 \n when 1 then ftl_s13 = pftl11\n when 2 then ftl_s13 = pftl10\n when 3 then ftl_s13 = pftl9\n when 4 then ftl_s13 = pftl8\n when 5 then ftl_s13 = pftl7\n when 6 then ftl_s13 = pftl6\n when 7 then ftl_s13 = pftl5\n when 8 then ftl_s13 = pftl4\n when 9 then ftl_s13 = pftl3\n when 10 then ftl_s13 = pftl2\n when 11 then ftl_s13 = pftl1\n when 12 then ftl_s13 = self.user.s_name2 + ' - Pass'\n when 13..100 then ftl_s13 = rftl13\n end\n\n #ftl_s14\n case num_ftr\n when 0 then ftl_s14 = pftl14 \n when 1 then ftl_s14 = pftl12\n when 2 then ftl_s14 = pftl11\n when 3 then ftl_s14 = pftl10\n when 4 then ftl_s14 = pftl9\n when 5 then ftl_s14 = pftl8\n when 6 then ftl_s14 = pftl7\n when 7 then ftl_s14 = pftl6\n when 8 then ftl_s14 = pftl5\n when 9 then ftl_s14 = pftl4\n when 10 then ftl_s14 = pftl3\n when 11 then ftl_s14 = pftl2\n when 12 then ftl_s14 = pftl1 \n when 13 then ftl_s14 = self.user.s_name2 + ' - Pass'\n when 14..100 then ftl_s14 = rftl14\n end\n\n #ftl_s15\n case num_ftr\n when 0 then ftl_s15 = pftl15 \n when 1 then ftl_s15 = pftl13\n when 2 then ftl_s15 = pftl12\n when 3 then ftl_s15 = pftl11\n when 4 then ftl_s15 = pftl10\n when 5 then ftl_s15 = pftl9\n when 6 then ftl_s15 = pftl8\n when 7 then ftl_s15 = pftl7\n when 8 then ftl_s15 = pftl6\n when 9 then ftl_s15 = pftl5\n when 10 then ftl_s15 = pftl4\n when 11 then ftl_s15 = pftl3\n when 12 then ftl_s15 = pftl2\n when 13 then ftl_s15 = pftl1 \n when 14..100 then ftl_s15 = rftl15\n end \n\n\n #Right Hash\n # ftr_s0 would always be blank\n\n #ftr_s1 \n if num_ftr > 0\n ftr_s1 = rftr1\n else\n ftr_s1 = pftr1\n end\n\n #ftr_s2\n if num_ftr == 0\n ftr_s2 = pftr2\n elsif num_ftr == 1\n ftr_s2 = ''\n else num_ftr > 1\n ftr_s2 = rftr2\n end\n\n #ftr_s3\n case num_ftr\n when 0 then ftr_s3 = pftr3 \n when 1 then ftr_s3 = pftr1\n when 2 then ftr_s3 = ''\n when 3..100 then ftr_s3 = rftr3\n end\n\n #ftr_s4\n case num_ftr\n when 0 then ftr_s4 = pftr4 \n when 1 then ftr_s4 = pftr2\n when 2 then ftr_s4 = pftr1\n when 3 then ''\n when 4..100 then ftr_s4 = rftr4\n end\n\n #ftr_s5\n case num_ftr\n when 0 then ftr_s5 = pftr5 \n when 1 then ftr_s5 = pftr3\n when 2 then ftr_s5 = pftr2\n when 3 then ftr_s5 = pftr1\n when 4 then ftr_s5 = ''\n when 5..100 then ftr_s5 = rftr5\n end\n\n #ftr_s6\n case num_ftr\n when 0 then ftr_s6 = pftr6 \n when 1 then ftr_s6 = pftr4\n when 2 then ftr_s6 = pftr3\n when 3 then ftr_s6 = pftr2\n when 4 then ftr_s6 = pftr1\n when 5 then ftr_s6 = ''\n when 6..100 then ftr_s6 = rftr6\n end\n\n #ftr_s7\n case num_ftr\n when 0 then ftr_s7 = pftr7 \n when 1 then ftr_s7 = pftr5\n when 2 then ftr_s7 = pftr4\n when 3 then ftr_s7 = pftr3\n when 4 then ftr_s7 = pftr2\n when 5 then ftr_s7 = pftr1\n when 6 then ftr_s7 = ''\n when 7..100 then ftr_s7 = rftr7\n end\n\n #ftr_s8\n case num_ftr\n when 0 then ftr_s8 = pftr8 \n when 1 then ftr_s8 = pftr6\n when 2 then ftr_s8 = pftr5\n when 3 then ftr_s8 = pftr4\n when 4 then ftr_s8 = pftr3\n when 5 then ftr_s8 = pftr2\n when 6 then ftr_s8 = pftr1\n when 7 then ftr_s8 = ''\n when 8..100 then ftr_s8 = rftr8\n end\n\n #ftr_s9\n case num_ftr\n when 0 then ftr_s9 = pftr9 \n when 1 then ftr_s9 = pftr7\n when 2 then ftr_s9 = pftr6\n when 3 then ftr_s9 = pftr5\n when 4 then ftr_s9 = pftr4\n when 5 then ftr_s9 = pftr3\n when 6 then ftr_s9 = pftr2\n when 7 then ftr_s9 = pftr1\n when 8 then ftr_s9 = ''\n when 9..100 then ftr_s9 = rftr9\n end\n\n #ftr_s10\n case num_ftr\n when 0 then ftr_s10 = pftr10 \n when 1 then ftr_s10 = pftr8\n when 2 then ftr_s10 = pftr7\n when 3 then ftr_s10 = pftr6\n when 4 then ftr_s10 = pftr5\n when 5 then ftr_s10 = pftr4\n when 6 then ftr_s10 = pftr3\n when 7 then ftr_s10 = pftr2\n when 8 then ftr_s10 = pftr1\n when 9 then ftr_s10 = ''\n when 10..100 then ftr_s10 = rftr10\n end\n\n #ftr_s11\n case num_ftr\n when 0 then ftr_s11 = pftr11 \n when 1 then ftr_s11 = pftr9\n when 2 then ftr_s11 = pftr8\n when 3 then ftr_s11 = pftr7\n when 4 then ftr_s11 = pftr6\n when 5 then ftr_s11 = pftr5\n when 6 then ftr_s11 = pftr4\n when 7 then ftr_s11 = pftr3\n when 8 then ftr_s11 = pftr2\n when 9 then ftr_s11 = pftr1\n when 10 then ftr_s11 = ''\n when 11..100 then ftr_s11 = rftr11\n end\n\n #ftr_s12\n case num_ftr\n when 0 then ftr_s12 = pftr12 \n when 1 then ftr_s12 = pftr10\n when 2 then ftr_s12 = pftr9\n when 3 then ftr_s12 = pftr8\n when 4 then ftr_s12 = pftr7\n when 5 then ftr_s12 = pftr6\n when 6 then ftr_s12 = pftr5\n when 7 then ftr_s12 = pftr4\n when 8 then ftr_s12 = pftr3\n when 9 then ftr_s12 = pftr2\n when 10 then ftr_s12 = pftr1\n when 11 then ftr_s12 = ''\n when 12..100 then ftr_s12 = rftr12\n end\n\n #ftr_s13\n case num_ftr\n when 0 then ftr_s13 = pftr13 \n when 1 then ftr_s13 = pftr11\n when 2 then ftr_s13 = pftr10\n when 3 then ftr_s13 = pftr9\n when 4 then ftr_s13 = pftr8\n when 5 then ftr_s13 = pftr7\n when 6 then ftr_s13 = pftr6\n when 7 then ftr_s13 = pftr5\n when 8 then ftr_s13 = pftr4\n when 9 then ftr_s13 = pftr3\n when 10 then ftr_s13 = pftr2\n when 11 then ftr_s13 = pftr1\n when 12 then ftr_s13 = ''\n when 13..100 then ftr_s13 = rftr13\n end\n\n #ftr_s14\n case num_ftr\n when 0 then ftr_s14 = pftr14 \n when 1 then ftr_s14 = pftr12\n when 2 then ftr_s14 = pftr11\n when 3 then ftr_s14 = pftr10\n when 4 then ftr_s14 = pftr9\n when 5 then ftr_s14 = pftr8\n when 6 then ftr_s14 = pftr7\n when 7 then ftr_s14 = pftr6\n when 8 then ftr_s14 = pftr5\n when 9 then ftr_s14 = pftr4\n when 10 then ftr_s14 = pftr3\n when 11 then ftr_s14 = pftr2\n when 12 then ftr_s14 = pftr1 \n when 13 then ftr_s14 = ''\n when 14..100 then ftr_s14 = rftr14\n end\n\n #ftr_s15\n case num_ftr\n when 0 then ftr_s15 = pftr15 \n when 1 then ftr_s15 = pftr13\n when 2 then ftr_s15 = pftr12\n when 3 then ftr_s15 = pftr11\n when 4 then ftr_s15 = pftr10\n when 5 then ftr_s15 = pftr9\n when 6 then ftr_s15 = pftr8\n when 7 then ftr_s15 = pftr7\n when 8 then ftr_s15 = pftr6\n when 9 then ftr_s15 = pftr5\n when 10 then ftr_s15 = pftr4\n when 11 then ftr_s15 = pftr3\n when 12 then ftr_s15 = pftr2\n when 13 then ftr_s15 = pftr1 \n when 14..100 then ftr_s15 = rftr15\n end\n\n #----------End 1st/2nd & 10----------\n\n #----------2nd & Long----------\n secondLongs = event.plays.where('situation3 = ?', true)\n \n runSecondLongs = secondLongs.where('play_type = ?', 'Run')\n runSecondLongsLeft = runSecondLongs.where('hash_mark = ?', 'Left')\n runSecondLongsRight = runSecondLongs.where('hash_mark = ?', 'Right')\n \n passSecondLongs = secondLongs.where('play_type = ?', 'Pass')\n passSecondLongsLeft = passSecondLongs.where('hash_mark = ?', 'Left')\n passSecondLongsRight = passSecondLongs.where('hash_mark = ?', 'Right')\n\n #Run Left Hash\n unless runSecondLongsLeft[0].nil? \n rsll1 = runSecondLongsLeft[0].fullname \n end\n unless runSecondLongsLeft[1].nil? \n rsll2 = runSecondLongsLeft[1].fullname \n end\n unless runSecondLongsLeft[2].nil? \n rsll3 = runSecondLongsLeft[2].fullname \n end\n unless runSecondLongsLeft[3].nil? \n rsll4 = runSecondLongsLeft[3].fullname \n end\n unless runSecondLongsLeft[4].nil? \n rsll5 = runSecondLongsLeft[4].fullname \n end\n unless runSecondLongsLeft[5].nil? \n rsll6 = runSecondLongsLeft[5].fullname \n end\n unless runSecondLongsLeft[6].nil? \n rsll7 = runSecondLongsLeft[6].fullname \n end\n unless runSecondLongsLeft[7].nil? \n rsll8 = runSecondLongsLeft[7].fullname \n end\n unless runSecondLongsLeft[8].nil? \n rsll9 = runSecondLongsLeft[8].fullname \n end\n unless runSecondLongsLeft[9].nil? \n rsll10 = runSecondLongsLeft[9].fullname \n end\n unless runSecondLongsLeft[10].nil? \n rsll11 = runSecondLongsLeft[10].fullname \n end\n unless runSecondLongsLeft[11].nil? \n rsll12 = runSecondLongsLeft[11].fullname \n end\n\n #Run Right Hash\n unless runSecondLongsRight[0].nil? \n rslr1 = runSecondLongsRight[0].fullname \n end\n unless runSecondLongsRight[1].nil? \n rslr2 = runSecondLongsRight[1].fullname \n end\n unless runSecondLongsRight[2].nil? \n rslr3 = runSecondLongsRight[2].fullname \n end\n unless runSecondLongsRight[3].nil? \n rslr4 = runSecondLongsRight[3].fullname \n end\n unless runSecondLongsRight[4].nil? \n rslr5 = runSecondLongsRight[4].fullname \n end\n unless runSecondLongsRight[5].nil? \n rslr6 = runSecondLongsRight[5].fullname \n end\n unless runSecondLongsRight[6].nil? \n rslr7 = runSecondLongsRight[6].fullname \n end\n unless runSecondLongsRight[7].nil? \n rslr8 = runSecondLongsRight[7].fullname \n end\n unless runSecondLongsRight[8].nil? \n rslr9 = runSecondLongsRight[8].fullname \n end\n unless runSecondLongsRight[9].nil? \n rslr10 = runSecondLongsRight[9].fullname \n end \n unless runSecondLongsRight[10].nil? \n rslr11 = runSecondLongsRight[10].fullname \n end\n unless runSecondLongsRight[11].nil? \n rslr12 = runSecondLongsRight[11].fullname \n end \n\n #Pass Left Hash\n unless passSecondLongsLeft[0].nil? \n psll1 = passSecondLongsLeft[0].fullname \n end\n unless passSecondLongsLeft[1].nil? \n psll2 = passSecondLongsLeft[1].fullname \n end\n unless passSecondLongsLeft[2].nil? \n psll3 = passSecondLongsLeft[2].fullname \n end\n unless passSecondLongsLeft[3].nil? \n psll4 = passSecondLongsLeft[3].fullname \n end\n unless passSecondLongsLeft[4].nil? \n psll5 = passSecondLongsLeft[4].fullname \n end \n unless passSecondLongsLeft[5].nil? \n psll6 = passSecondLongsLeft[5].fullname \n end\n unless passSecondLongsLeft[6].nil? \n psll7 = passSecondLongsLeft[6].fullname \n end\n unless passSecondLongsLeft[7].nil? \n psll8 = passSecondLongsLeft[7].fullname \n end\n unless passSecondLongsLeft[8].nil? \n psll9 = passSecondLongsLeft[8].fullname \n end\n unless passSecondLongsLeft[9].nil? \n psll10 = passSecondLongsLeft[9].fullname \n end\n unless passSecondLongsLeft[10].nil? \n psll11 = passSecondLongsLeft[10].fullname \n end \n unless passSecondLongsLeft[11].nil? \n psll12 = passSecondLongsLeft[11].fullname \n end \n\n #Pass Right Hash\n unless passSecondLongsRight[0].nil? \n pslr1 = passSecondLongsRight[0].fullname \n end\n unless passSecondLongsRight[1].nil? \n pslr2 = passSecondLongsRight[1].fullname \n end\n unless passSecondLongsRight[2].nil? \n pslr3 = passSecondLongsRight[2].fullname \n end\n unless passSecondLongsRight[3].nil? \n pslr4 = passSecondLongsRight[3].fullname \n end\n unless passSecondLongsRight[4].nil? \n pslr5 = passSecondLongsRight[4].fullname \n end \n unless passSecondLongsRight[5].nil? \n pslr6 = passSecondLongsRight[5].fullname \n end \n unless passSecondLongsRight[6].nil? \n pslr7 = passSecondLongsRight[6].fullname \n end\n unless passSecondLongsRight[7].nil? \n pslr8 = passSecondLongsRight[7].fullname \n end\n unless passSecondLongsRight[8].nil? \n pslr9 = passSecondLongsRight[8].fullname \n end\n unless passSecondLongsRight[9].nil? \n pslr10 = passSecondLongsRight[9].fullname \n end\n unless passSecondLongsRight[10].nil? \n pslr11 = passSecondLongsRight[10].fullname \n end \n unless passSecondLongsRight[11].nil? \n pslr12 = passSecondLongsRight[11].fullname \n end \n\n\n #Number of user's run plays in situation 3\n num_slr = self.user.s_name3_num_run\n\n #Left Hash\n # sll_s0 \n if num_slr > 0\n sll_s0 = self.user.s_name3 + ' - Run'\n else\n sll_s0 = self.user.s_name3 + ' - Pass'\n end\n\n #sll_s1 \n if num_slr > 0\n sll_s1 = rsll1\n else\n sll_s1 = psll1\n end\n\n #sll_s2\n if num_slr == 0\n sll_s2 = psll2\n elsif num_slr == 1\n sll_s2 = self.user.s_name3 + ' - Pass'\n else num_slr > 1\n sll_s2 = rsll2\n end\n\n #sll_s3\n case num_slr\n when 0 then sll_s3 = psll3 \n when 1 then sll_s3 = psll1\n when 2 then sll_s3 = self.user.s_name3 + ' - Pass'\n when 3..100 then sll_s3 = rsll3\n end\n\n #sll_s4\n case num_slr\n when 0 then sll_s4 = psll4 \n when 1 then sll_s4 = psll2\n when 2 then sll_s4 = psll1\n when 3 then sll_s4 = self.user.s_name3 + ' - Pass'\n when 4..100 then sll_s4 = rsll4\n end\n\n #sll_s5\n case num_slr\n when 0 then sll_s5 = psll5 \n when 1 then sll_s5 = psll3\n when 2 then sll_s5 = psll2\n when 3 then sll_s5 = psll1\n when 4 then sll_s5 = self.user.s_name3 + ' - Pass'\n when 5..100 then sll_s5 = rsll5\n end\n\n #sll_s6\n case num_slr\n when 0 then sll_s6 = psll6 \n when 1 then sll_s6 = psll4\n when 2 then sll_s6 = psll3\n when 3 then sll_s6 = psll2\n when 4 then sll_s6 = psll1\n when 5 then sll_s6 = self.user.s_name3 + ' - Pass'\n when 6..100 then sll_s6 = rsll6\n end\n\n #sll_s7\n case num_slr\n when 0 then sll_s7 = psll7 \n when 1 then sll_s7 = psll5\n when 2 then sll_s7 = psll4\n when 3 then sll_s7 = psll3\n when 4 then sll_s7 = psll2\n when 5 then sll_s7 = psll1\n when 6 then sll_s7 = self.user.s_name3 + ' - Pass'\n when 7..100 then sll_s7 = rsll7\n end\n\n #sll_s8\n case num_slr\n when 0 then sll_s8 = psll8 \n when 1 then sll_s8 = psll6\n when 2 then sll_s8 = psll5\n when 3 then sll_s8 = psll4\n when 4 then sll_s8 = psll3\n when 5 then sll_s8 = psll2\n when 6 then sll_s8 = psll1\n when 7 then sll_s8 = self.user.s_name3 + ' - Pass'\n when 8..100 then sll_s8 = rsll8\n end\n\n #sll_s9\n case num_slr\n when 0 then sll_s9 = psll9 \n when 1 then sll_s9 = psll7\n when 2 then sll_s9 = psll6\n when 3 then sll_s9 = psll5\n when 4 then sll_s9 = psll4\n when 5 then sll_s9 = psll3\n when 6 then sll_s9 = psll2\n when 7 then sll_s9 = psll1\n when 8 then sll_s9 = self.user.s_name3 + ' - Pass'\n when 9..100 then sll_s9 = rsll9\n end\n\n #sll_s10\n case num_slr\n when 0 then sll_s10 = psll10 \n when 1 then sll_s10 = psll8\n when 2 then sll_s10 = psll7\n when 3 then sll_s10 = psll6\n when 4 then sll_s10 = psll5\n when 5 then sll_s10 = psll4\n when 6 then sll_s10 = psll3\n when 7 then sll_s10 = psll2\n when 8 then sll_s10 = psll1\n when 9 then sll_s10 = self.user.s_name3 + ' - Pass'\n when 10..100 then sll_s10 = rsll10\n end\n\n #sll_s11\n case num_slr\n when 0 then sll_s11 = psll11 \n when 1 then sll_s11 = psll9\n when 2 then sll_s11 = psll8\n when 3 then sll_s11 = psll7\n when 4 then sll_s11 = psll6\n when 5 then sll_s11 = psll5\n when 6 then sll_s11 = psll4\n when 7 then sll_s11 = psll3\n when 8 then sll_s11 = psll2\n when 9 then sll_s11 = psll1\n when 10 then sll_s11 = self.user.s_name3 + ' - Pass'\n when 11..100 then sll_s11 = rsll11\n end\n\n #sll_s12\n case num_slr\n when 0 then sll_s12 = psll12 \n when 1 then sll_s12 = psll10\n when 2 then sll_s12 = psll9\n when 3 then sll_s12 = psll8\n when 4 then sll_s12 = psll7\n when 5 then sll_s12 = psll6\n when 6 then sll_s12 = psll5\n when 7 then sll_s12 = psll4\n when 8 then sll_s12 = psll3\n when 9 then sll_s12 = psll2\n when 10 then sll_s12 = psll1\n when 11..100 then sll_s12 = rsll12\n end\n\n \n #Right Hash\n # slr_s0 would always be blank\n\n #slr_s1 \n if num_slr > 0\n slr_s1 = rslr1\n else\n slr_s1 = pslr1\n end\n\n #slr_s2\n if num_slr == 0\n slr_s2 = pslr2\n elsif num_slr == 1\n slr_s2 = ''\n else num_slr > 1\n slr_s2 = rslr2\n end\n\n #slr_s3\n case num_slr\n when 0 then slr_s3 = pslr3 \n when 1 then slr_s3 = pslr1\n when 2 then slr_s3 = ''\n when 3..100 then slr_s3 = rslr3\n end\n\n #slr_s4\n case num_slr\n when 0 then slr_s4 = pslr4 \n when 1 then slr_s4 = pslr2\n when 2 then slr_s4 = pslr1\n when 3 then ''\n when 4..100 then slr_s4 = rslr4\n end\n\n #slr_s5\n case num_slr\n when 0 then slr_s5 = pslr5 \n when 1 then slr_s5 = pslr3\n when 2 then slr_s5 = pslr2\n when 3 then slr_s5 = pslr1\n when 4 then slr_s5 = ''\n when 5..100 then slr_s5 = rslr5\n end\n\n #slr_s6\n case num_slr\n when 0 then slr_s6 = pslr6 \n when 1 then slr_s6 = pslr4\n when 2 then slr_s6 = pslr3\n when 3 then slr_s6 = pslr2\n when 4 then slr_s6 = pslr1\n when 5 then slr_s6 = ''\n when 6..100 then slr_s6 = rslr6\n end\n\n #slr_s7\n case num_slr\n when 0 then slr_s7 = pslr7 \n when 1 then slr_s7 = pslr5\n when 2 then slr_s7 = pslr4\n when 3 then slr_s7 = pslr3\n when 4 then slr_s7 = pslr2\n when 5 then slr_s7 = pslr1\n when 6 then slr_s7 = ''\n when 7..100 then slr_s7 = rslr7\n end\n\n #slr_s8\n case num_slr\n when 0 then slr_s8 = pslr8 \n when 1 then slr_s8 = pslr6\n when 2 then slr_s8 = pslr5\n when 3 then slr_s8 = pslr4\n when 4 then slr_s8 = pslr3\n when 5 then slr_s8 = pslr2\n when 6 then slr_s8 = pslr1\n when 7 then slr_s8 = ''\n when 8..100 then slr_s8 = rslr8\n end\n\n #slr_s9\n case num_slr\n when 0 then slr_s9 = pslr9 \n when 1 then slr_s9 = pslr7\n when 2 then slr_s9 = pslr6\n when 3 then slr_s9 = pslr5\n when 4 then slr_s9 = pslr4\n when 5 then slr_s9 = pslr3\n when 6 then slr_s9 = pslr2\n when 7 then slr_s9 = pslr1\n when 8 then slr_s9 = ''\n when 9..100 then slr_s9 = rslr9\n end\n\n #slr_s10\n case num_slr\n when 0 then slr_s10 = pslr10 \n when 1 then slr_s10 = pslr8\n when 2 then slr_s10 = pslr7\n when 3 then slr_s10 = pslr6\n when 4 then slr_s10 = pslr5\n when 5 then slr_s10 = pslr4\n when 6 then slr_s10 = pslr3\n when 7 then slr_s10 = pslr2\n when 8 then slr_s10 = pslr1\n when 9 then slr_s10 = ''\n when 10..100 then slr_s10 = rslr10\n end\n\n #slr_s11\n case num_slr\n when 0 then slr_s11 = pslr11 \n when 1 then slr_s11 = pslr9\n when 2 then slr_s11 = pslr8\n when 3 then slr_s11 = pslr7\n when 4 then slr_s11 = pslr6\n when 5 then slr_s11 = pslr5\n when 6 then slr_s11 = pslr4\n when 7 then slr_s11 = pslr3\n when 8 then slr_s11 = pslr2\n when 9 then slr_s11 = pslr1\n when 10 then slr_s11 = ''\n when 11..100 then slr_s11 = rslr11\n end\n\n #slr_s12\n case num_slr\n when 0 then slr_s12 = pslr12 \n when 1 then slr_s12 = pslr10\n when 2 then slr_s12 = pslr9\n when 3 then slr_s12 = pslr8\n when 4 then slr_s12 = pslr7\n when 5 then slr_s12 = pslr6\n when 6 then slr_s12 = pslr5\n when 7 then slr_s12 = pslr4\n when 8 then slr_s12 = pslr3\n when 9 then slr_s12 = pslr2\n when 10 then slr_s12 = pslr1\n when 11..100 then slr_s12 = rslr12\n end\n\n #----------End 2nd & Long ----------\n\n #----------3rd & Long ----------\n thirdLongs = event.plays.where('situation6 = ?', true)\n \n runThirdLongs = thirdLongs.where('play_type = ?', 'Run')\n runThirdLongsLeft = runThirdLongs.where('hash_mark = ?', 'Left')\n runThirdLongsRight = runThirdLongs.where('hash_mark = ?', 'Right')\n \n passThirdLongs = thirdLongs.where('play_type = ?', 'Pass')\n passThirdLongsLeft = passThirdLongs.where('hash_mark = ?', 'Left')\n passThirdLongsRight = passThirdLongs.where('hash_mark = ?', 'Right')\n\n #Run Left Hash\n unless runThirdLongsLeft[0].nil? \n rtll1 = runThirdLongsLeft[0].fullname \n end\n unless runThirdLongsLeft[1].nil? \n rtll2 = runThirdLongsLeft[1].fullname \n end\n unless runThirdLongsLeft[2].nil? \n rtll3 = runThirdLongsLeft[2].fullname \n end\n unless runThirdLongsLeft[3].nil? \n rtll4 = runThirdLongsLeft[3].fullname \n end\n unless runThirdLongsLeft[4].nil? \n rtll5 = runThirdLongsLeft[4].fullname \n end\n unless runThirdLongsLeft[5].nil? \n rtll6 = runThirdLongsLeft[5].fullname \n end\n unless runThirdLongsLeft[6].nil? \n rtll7 = runThirdLongsLeft[6].fullname \n end\n unless runThirdLongsLeft[7].nil? \n rtll8 = runThirdLongsLeft[7].fullname \n end\n unless runThirdLongsLeft[8].nil? \n rtll9 = runThirdLongsLeft[8].fullname \n end\n unless runThirdLongsLeft[9].nil? \n rtll10 = runThirdLongsLeft[9].fullname \n end\n unless runThirdLongsLeft[10].nil? \n rtll11 = runThirdLongsLeft[10].fullname \n end\n unless runThirdLongsLeft[11].nil? \n rtll12 = runThirdLongsLeft[11].fullname \n end\n\n #Run Right Hash\n unless runThirdLongsRight[0].nil? \n rtlr1 = runThirdLongsRight[0].fullname \n end\n unless runThirdLongsRight[1].nil? \n rtlr2 = runThirdLongsRight[1].fullname \n end\n unless runThirdLongsRight[2].nil? \n rtlr3 = runThirdLongsRight[2].fullname \n end\n unless runThirdLongsRight[3].nil? \n rtlr4 = runThirdLongsRight[3].fullname \n end\n unless runThirdLongsRight[4].nil? \n rtlr5 = runThirdLongsRight[4].fullname \n end\n unless runThirdLongsRight[5].nil? \n rtlr6 = runThirdLongsRight[5].fullname \n end\n unless runThirdLongsRight[6].nil? \n rtlr7 = runThirdLongsRight[6].fullname \n end\n unless runThirdLongsRight[7].nil? \n rtlr8 = runThirdLongsRight[7].fullname \n end\n unless runThirdLongsRight[8].nil? \n rtlr9 = runThirdLongsRight[8].fullname \n end\n unless runThirdLongsRight[9].nil? \n rtlr10 = runThirdLongsRight[9].fullname \n end\n unless runThirdLongsRight[10].nil? \n rtlr11 = runThirdLongsRight[10].fullname \n end\n unless runThirdLongsRight[11].nil? \n rtlr12 = runThirdLongsRight[11].fullname \n end\n\n #Pass Left Hash\n unless passThirdLongsLeft[0].nil? \n ptll1 = passThirdLongsLeft[0].fullname \n end\n unless passThirdLongsLeft[1].nil? \n ptll2 = passThirdLongsLeft[1].fullname \n end\n unless passThirdLongsLeft[2].nil? \n ptll3 = passThirdLongsLeft[2].fullname \n end\n unless passThirdLongsLeft[3].nil? \n ptll4 = passThirdLongsLeft[3].fullname \n end\n unless passThirdLongsLeft[4].nil? \n ptll5 = passThirdLongsLeft[4].fullname \n end\n unless passThirdLongsLeft[5].nil? \n ptll6 = passThirdLongsLeft[5].fullname \n end\n unless passThirdLongsLeft[6].nil? \n ptll7 = passThirdLongsLeft[6].fullname \n end\n unless passThirdLongsLeft[7].nil? \n ptll8 = passThirdLongsLeft[7].fullname \n end \n unless passThirdLongsLeft[8].nil? \n ptll9 = passThirdLongsLeft[8].fullname \n end\n unless passThirdLongsLeft[9].nil? \n ptll10 = passThirdLongsLeft[9].fullname \n end\n unless passThirdLongsLeft[10].nil? \n ptll11 = passThirdLongsLeft[10].fullname \n end\n unless passThirdLongsLeft[11].nil? \n ptll12 = passThirdLongsLeft[11].fullname \n end \n\n #Pass Right Hash\n unless passThirdLongsRight[0].nil? \n ptlr1 = passThirdLongsRight[0].fullname \n end\n unless passThirdLongsRight[1].nil? \n ptlr2 = passThirdLongsRight[1].fullname \n end\n unless passThirdLongsRight[2].nil? \n ptlr3 = passThirdLongsRight[2].fullname \n end\n unless passThirdLongsRight[3].nil? \n ptlr4 = passThirdLongsRight[3].fullname \n end\n unless passThirdLongsRight[4].nil? \n ptlr5 = passThirdLongsRight[4].fullname \n end\n unless passThirdLongsRight[5].nil? \n ptlr6 = passThirdLongsRight[5].fullname \n end\n unless passThirdLongsRight[6].nil? \n ptlr7 = passThirdLongsRight[6].fullname \n end\n unless passThirdLongsRight[7].nil? \n ptlr8 = passThirdLongsRight[7].fullname \n end \n unless passThirdLongsRight[8].nil? \n ptlr9 = passThirdLongsRight[8].fullname \n end\n unless passThirdLongsRight[9].nil? \n ptlr10 = passThirdLongsRight[9].fullname \n end\n unless passThirdLongsRight[10].nil? \n ptlr11 = passThirdLongsRight[10].fullname \n end\n unless passThirdLongsRight[11].nil? \n ptlr12 = passThirdLongsRight[11].fullname \n end \n\n #Number of user's run plays in situation 6\n num_thirdlg = self.user.s_name6_num_run\n\n #Left Hash\n # tll_s0 \n if num_thirdlg > 0\n tll_s0 = self.user.s_name6 + ' - Run'\n else\n tll_s0 = self.user.s_name6 + ' - Pass'\n end\n\n #tll_s1 \n if num_thirdlg > 0\n tll_s1 = rtll1\n else\n tll_s1 = ptll1\n end\n\n #tll_s2\n if num_thirdlg == 0\n tll_s2 = ptll2\n elsif num_thirdlg == 1\n tll_s2 = self.user.s_name6 + ' - Pass'\n else num_thirdlg > 1\n tll_s2 = rtll2\n end\n\n #tll_s3\n case num_thirdlg\n when 0 then tll_s3 = ptll3 \n when 1 then tll_s3 = ptll1\n when 2 then tll_s3 = self.user.s_name6 + ' - Pass'\n when 3..100 then tll_s3 = rtll3\n end\n\n #tll_s4\n case num_thirdlg\n when 0 then tll_s4 = ptll4 \n when 1 then tll_s4 = ptll2\n when 2 then tll_s4 = ptll1\n when 3 then tll_s4 = self.user.s_name6 + ' - Pass'\n when 4..100 then tll_s4 = rtll4\n end\n\n #tll_s5\n case num_thirdlg\n when 0 then tll_s5 = ptll5 \n when 1 then tll_s5 = ptll3\n when 2 then tll_s5 = ptll2\n when 3 then tll_s5 = ptll1\n when 4 then tll_s5 = self.user.s_name6 + ' - Pass'\n when 5..100 then tll_s5 = rtll5\n end\n\n #tll_s6\n case num_thirdlg\n when 0 then tll_s6 = ptll6 \n when 1 then tll_s6 = ptll4\n when 2 then tll_s6 = ptll3\n when 3 then tll_s6 = ptll2\n when 4 then tll_s6 = ptll1\n when 5 then tll_s6 = self.user.s_name6 + ' - Pass'\n when 6..100 then tll_s6 = rtll6\n end\n\n #tll_s7\n case num_thirdlg\n when 0 then tll_s7 = ptll7 \n when 1 then tll_s7 = ptll5\n when 2 then tll_s7 = ptll4\n when 3 then tll_s7 = ptll3\n when 4 then tll_s7 = ptll2\n when 5 then tll_s7 = ptll1\n when 6 then tll_s7 = self.user.s_name6 + ' - Pass'\n when 7..100 then tll_s7 = rtll7\n end\n\n #tll_s8\n case num_thirdlg\n when 0 then tll_s8 = ptll8 \n when 1 then tll_s8 = ptll6\n when 2 then tll_s8 = ptll5\n when 3 then tll_s8 = ptll4\n when 4 then tll_s8 = ptll3\n when 5 then tll_s8 = ptll2\n when 6 then tll_s8 = ptll1\n when 7 then tll_s8 = self.user.s_name6 + ' - Pass'\n when 8..100 then tll_s8 = rtll8\n end\n\n #tll_s9\n case num_thirdlg\n when 0 then tll_s9 = ptll9 \n when 1 then tll_s9 = ptll7\n when 2 then tll_s9 = ptll6\n when 3 then tll_s9 = ptll5\n when 4 then tll_s9 = ptll4\n when 5 then tll_s9 = ptll3\n when 6 then tll_s9 = ptll2\n when 7 then tll_s9 = ptll1\n when 8 then tll_s9 = self.user.s_name6 + ' - Pass'\n when 9..100 then tll_s9 = rtll9\n end\n\n #tll_s10\n case num_thirdlg\n when 0 then tll_s10 = ptll10 \n when 1 then tll_s10 = ptll8\n when 2 then tll_s10 = ptll7\n when 3 then tll_s10 = ptll6\n when 4 then tll_s10 = ptll5\n when 5 then tll_s10 = ptll4\n when 6 then tll_s10 = ptll3\n when 7 then tll_s10 = ptll2\n when 8 then tll_s10 = ptll1\n when 9 then tll_s10 = self.user.s_name6 + ' - Pass'\n when 10..100 then tll_s10 = rtll10\n end\n\n #tll_s11\n case num_thirdlg\n when 0 then tll_s11 = ptll11 \n when 1 then tll_s11 = ptll9\n when 2 then tll_s11 = ptll8\n when 3 then tll_s11 = ptll7\n when 4 then tll_s11 = ptll6\n when 5 then tll_s11 = ptll5\n when 6 then tll_s11 = ptll4\n when 7 then tll_s11 = ptll3\n when 8 then tll_s11 = ptll2\n when 9 then tll_s11 = ptll1\n when 10 then tll_s11 = self.user.s_name6 + ' - Pass'\n when 11..100 then tll_s11 = rtll11\n end\n\n #tll_s12\n case num_thirdlg\n when 0 then tll_s12 = ptll12 \n when 1 then tll_s12 = ptll10\n when 2 then tll_s12 = ptll9\n when 3 then tll_s12 = ptll8\n when 4 then tll_s12 = ptll7\n when 5 then tll_s12 = ptll6\n when 6 then tll_s12 = ptll5\n when 7 then tll_s12 = ptll4\n when 8 then tll_s12 = ptll3\n when 9 then tll_s12 = ptll2\n when 10 then tll_s12 = ptll1\n when 11..100 then tll_s12 = rtll12\n end\n\n \n #Right Hash\n # tlr_s0 would always be blank\n\n #tlr_s1 \n if num_thirdlg > 0\n tlr_s1 = rtlr1\n else\n tlr_s1 = ptlr1\n end\n\n #tlr_s2\n if num_thirdlg == 0\n tlr_s2 = ptlr2\n elsif num_thirdlg == 1\n tlr_s2 = ''\n else num_thirdlg > 1\n tlr_s2 = rtlr2\n end\n\n #tlr_s3\n case num_thirdlg\n when 0 then tlr_s3 = ptlr3 \n when 1 then tlr_s3 = ptlr1\n when 2 then tlr_s3 = ''\n when 3..100 then tlr_s3 = rtlr3\n end\n\n #tlr_s4\n case num_thirdlg\n when 0 then tlr_s4 = ptlr4 \n when 1 then tlr_s4 = ptlr2\n when 2 then tlr_s4 = ptlr1\n when 3 then ''\n when 4..100 then tlr_s4 = rtlr4\n end\n\n #tlr_s5\n case num_thirdlg\n when 0 then tlr_s5 = ptlr5 \n when 1 then tlr_s5 = ptlr3\n when 2 then tlr_s5 = ptlr2\n when 3 then tlr_s5 = ptlr1\n when 4 then tlr_s5 = ''\n when 5..100 then tlr_s5 = rtlr5\n end\n\n #tlr_s6\n case num_thirdlg\n when 0 then tlr_s6 = ptlr6 \n when 1 then tlr_s6 = ptlr4\n when 2 then tlr_s6 = ptlr3\n when 3 then tlr_s6 = ptlr2\n when 4 then tlr_s6 = ptlr1\n when 5 then tlr_s6 = ''\n when 6..100 then tlr_s6 = rtlr6\n end\n\n #tlr_s7\n case num_thirdlg\n when 0 then tlr_s7 = ptlr7 \n when 1 then tlr_s7 = ptlr5\n when 2 then tlr_s7 = ptlr4\n when 3 then tlr_s7 = ptlr3\n when 4 then tlr_s7 = ptlr2\n when 5 then tlr_s7 = ptlr1\n when 6 then tlr_s7 = ''\n when 7..100 then tlr_s7 = rtlr7\n end\n\n #tlr_s8\n case num_thirdlg\n when 0 then tlr_s8 = ptlr8 \n when 1 then tlr_s8 = ptlr6\n when 2 then tlr_s8 = ptlr5\n when 3 then tlr_s8 = ptlr4\n when 4 then tlr_s8 = ptlr3\n when 5 then tlr_s8 = ptlr2\n when 6 then tlr_s8 = ptlr1\n when 7 then tlr_s8 = ''\n when 8..100 then tlr_s8 = rtlr8\n end\n\n #tlr_s9\n case num_thirdlg\n when 0 then tlr_s9 = ptlr9 \n when 1 then tlr_s9 = ptlr7\n when 2 then tlr_s9 = ptlr6\n when 3 then tlr_s9 = ptlr5\n when 4 then tlr_s9 = ptlr4\n when 5 then tlr_s9 = ptlr3\n when 6 then tlr_s9 = ptlr2\n when 7 then tlr_s9 = ptlr1\n when 8 then tlr_s9 = ''\n when 9..100 then tlr_s9 = rtlr9\n end\n\n #tlr_s10\n case num_thirdlg\n when 0 then tlr_s10 = ptlr10 \n when 1 then tlr_s10 = ptlr8\n when 2 then tlr_s10 = ptlr7\n when 3 then tlr_s10 = ptlr6\n when 4 then tlr_s10 = ptlr5\n when 5 then tlr_s10 = ptlr4\n when 6 then tlr_s10 = ptlr3\n when 7 then tlr_s10 = ptlr2\n when 8 then tlr_s10 = ptlr1\n when 9 then tlr_s10 = ''\n when 10..100 then tlr_s10 = rtlr10\n end\n\n #tlr_s11\n case num_thirdlg\n when 0 then tlr_s11 = ptlr11 \n when 1 then tlr_s11 = ptlr9\n when 2 then tlr_s11 = ptlr8\n when 3 then tlr_s11 = ptlr7\n when 4 then tlr_s11 = ptlr6\n when 5 then tlr_s11 = ptlr5\n when 6 then tlr_s11 = ptlr4\n when 7 then tlr_s11 = ptlr3\n when 8 then tlr_s11 = ptlr2\n when 9 then tlr_s11 = ptlr1\n when 10 then tlr_s11 = ''\n when 11..100 then tlr_s11 = rtlr11\n end\n\n #tlr_s12\n case num_thirdlg\n when 0 then tlr_s12 = ptlr12 \n when 1 then tlr_s12 = ptlr10\n when 2 then tlr_s12 = ptlr9\n when 3 then tlr_s12 = ptlr8\n when 4 then tlr_s12 = ptlr7\n when 5 then tlr_s12 = ptlr6\n when 6 then tlr_s12 = ptlr5\n when 7 then tlr_s12 = ptlr4\n when 8 then tlr_s12 = ptlr3\n when 9 then tlr_s12 = ptlr2\n when 10 then tlr_s12 = ptlr1\n when 11..100 then tlr_s12 = rtlr12\n end \n #----------End 3rd & Long---------- \n\n #----------2nd & Medium----------\n secondMediums = event.plays.where('situation4 = ?', true)\n \n runSecondMediums = secondMediums.where('play_type = ?', 'Run')\n runSecondMediumsLeft = runSecondMediums.where('hash_mark = ?', 'Left')\n runSecondMediumsRight = runSecondMediums.where('hash_mark = ?', 'Right')\n \n passSecondMediums = secondMediums.where('play_type = ?', 'Pass')\n passSecondMediumsLeft = passSecondMediums.where('hash_mark = ?', 'Left')\n passSecondMediumsRight = passSecondMediums.where('hash_mark = ?', 'Right')\n\n #Run Left Hash\n unless runSecondMediumsLeft[0].nil? \n rsml1 = runSecondMediumsLeft[0].fullname \n end\n unless runSecondMediumsLeft[1].nil? \n rsml2 = runSecondMediumsLeft[1].fullname \n end\n unless runSecondMediumsLeft[2].nil? \n rsml3 = runSecondMediumsLeft[2].fullname \n end\n unless runSecondMediumsLeft[3].nil? \n rsml4 = runSecondMediumsLeft[3].fullname \n end\n unless runSecondMediumsLeft[4].nil? \n rsml5 = runSecondMediumsLeft[4].fullname\n end\n unless runSecondMediumsLeft[5].nil? \n rsml6 = runSecondMediumsLeft[5].fullname \n end\n unless runSecondMediumsLeft[6].nil? \n rsml7 = runSecondMediumsLeft[6].fullname \n end\n unless runSecondMediumsLeft[7].nil? \n rsml8 = runSecondMediumsLeft[7].fullname \n end\n unless runSecondMediumsLeft[8].nil? \n rsml9 = runSecondMediumsLeft[8].fullname \n end\n unless runSecondMediumsLeft[9].nil? \n rsml10 = runSecondMediumsLeft[9].fullname\n end \n unless runSecondMediumsLeft[10].nil? \n rsml11 = runSecondMediumsLeft[10].fullname\n end \n\n #Run Right Hash\n unless runSecondMediumsRight[0].nil? \n rsmr1 = runSecondMediumsRight[0].fullname \n end\n unless runSecondMediumsRight[1].nil? \n rsmr2 = runSecondMediumsRight[1].fullname \n end\n unless runSecondMediumsRight[2].nil? \n rsmr3 = runSecondMediumsRight[2].fullname \n end\n unless runSecondMediumsRight[3].nil? \n rsmr4 = runSecondMediumsRight[3].fullname \n end\n unless runSecondMediumsRight[4].nil? \n rsmr5 = runSecondMediumsRight[4].fullname\n end\n unless runSecondMediumsRight[5].nil? \n rsmr6 = runSecondMediumsRight[5].fullname \n end\n unless runSecondMediumsRight[6].nil? \n rsmr7 = runSecondMediumsRight[6].fullname \n end\n unless runSecondMediumsRight[7].nil? \n rsmr8 = runSecondMediumsRight[7].fullname \n end\n unless runSecondMediumsRight[8].nil? \n rsmr9 = runSecondMediumsRight[8].fullname \n end\n unless runSecondMediumsRight[9].nil? \n rsmr10 = runSecondMediumsRight[9].fullname\n end\n unless runSecondMediumsRight[10].nil? \n rsmr11 = runSecondMediumsRight[10].fullname\n end\n\n #Pass Left Hash\n unless passSecondMediumsLeft[0].nil? \n psml1 = passSecondMediumsLeft[0].fullname \n end\n unless passSecondMediumsLeft[1].nil? \n psml2 = passSecondMediumsLeft[1].fullname \n end\n unless passSecondMediumsLeft[2].nil? \n psml3 = passSecondMediumsLeft[2].fullname \n end\n unless passSecondMediumsLeft[3].nil? \n psml4 = passSecondMediumsLeft[3].fullname \n end\n unless passSecondMediumsLeft[4].nil? \n psml5 = passSecondMediumsLeft[4].fullname\n end\n unless passSecondMediumsLeft[5].nil? \n psml6 = passSecondMediumsLeft[5].fullname \n end\n unless passSecondMediumsLeft[6].nil? \n psml7 = passSecondMediumsLeft[6].fullname \n end\n unless passSecondMediumsLeft[7].nil? \n psml8 = passSecondMediumsLeft[7].fullname \n end\n unless passSecondMediumsLeft[8].nil? \n psml9 = passSecondMediumsLeft[8].fullname \n end\n unless passSecondMediumsLeft[9].nil? \n psml10 = passSecondMediumsLeft[9].fullname\n end\n unless passSecondMediumsLeft[10].nil? \n psml11 = passSecondMediumsLeft[10].fullname \n end\n\n #Pass Right Hash\n unless passSecondMediumsRight[0].nil? \n psmr1 = passSecondMediumsRight[0].fullname \n end\n unless passSecondMediumsRight[1].nil? \n psmr2 = passSecondMediumsRight[1].fullname \n end\n unless passSecondMediumsRight[2].nil? \n psmr3 = passSecondMediumsRight[2].fullname \n end\n unless passSecondMediumsRight[3].nil? \n psmr4 = passSecondMediumsRight[3].fullname \n end\n unless passSecondMediumsRight[4].nil? \n psmr5 = passSecondMediumsRight[4].fullname\n end\n unless passSecondMediumsRight[5].nil? \n psmr6 = passSecondMediumsRight[5].fullname \n end\n unless passSecondMediumsRight[6].nil? \n psmr7 = passSecondMediumsRight[6].fullname \n end\n unless passSecondMediumsRight[7].nil? \n psmr8 = passSecondMediumsRight[7].fullname \n end\n unless passSecondMediumsRight[8].nil? \n psmr9 = passSecondMediumsRight[8].fullname \n end\n unless passSecondMediumsRight[9].nil? \n psmr10 = passSecondMediumsRight[9].fullname\n end\n unless passSecondMediumsRight[10].nil? \n psmr11 = passSecondMediumsRight[10].fullname \n end\n\n #Number of user's run plays in situation 4\n num_secondmd = self.user.s_name4_num_run\n\n #Left Hash\n # tll_s0 \n if num_secondmd > 0\n secondmdl_s0 = self.user.s_name4 + ' - Run'\n else\n secondmdl_s0 = self.user.s_name4 + ' - Pass'\n end\n\n #secondmdl_s1 \n if num_secondmd > 0\n secondmdl_s1 = rsml1\n else\n secondmdl_s1 = psml1\n end\n\n #secondmdl_s2\n if num_secondmd == 0\n secondmdl_s2 = psml2\n elsif num_secondmd == 1\n secondmdl_s2 = self.user.s_name4 + ' - Pass'\n else num_secondmd > 1\n secondmdl_s2 = rsml2\n end\n\n #secondmdl_s3\n case num_secondmd\n when 0 then secondmdl_s3 = psml3 \n when 1 then secondmdl_s3 = psml1\n when 2 then secondmdl_s3 = self.user.s_name4 + ' - Pass'\n when 3..100 then secondmdl_s3 = rsml3\n end\n\n #secondmdl_s4\n case num_secondmd\n when 0 then secondmdl_s4 = psml4 \n when 1 then secondmdl_s4 = psml2\n when 2 then secondmdl_s4 = psml1\n when 3 then secondmdl_s4 = self.user.s_name4 + ' - Pass'\n when 4..100 then secondmdl_s4 = rsml4\n end\n\n #secondmdl_s5\n case num_secondmd\n when 0 then secondmdl_s5 = psml5 \n when 1 then secondmdl_s5 = psml3\n when 2 then secondmdl_s5 = psml2\n when 3 then secondmdl_s5 = psml1\n when 4 then secondmdl_s5 = self.user.s_name4 + ' - Pass'\n when 5..100 then secondmdl_s5 = rsml5\n end\n\n #secondmdl_s6\n case num_secondmd\n when 0 then secondmdl_s6 = psml6 \n when 1 then secondmdl_s6 = psml4\n when 2 then secondmdl_s6 = psml3\n when 3 then secondmdl_s6 = psml2\n when 4 then secondmdl_s6 = psml1\n when 5 then secondmdl_s6 = self.user.s_name4 + ' - Pass'\n when 6..100 then secondmdl_s6 = rsml6\n end\n\n #secondmdl_s7\n case num_secondmd\n when 0 then secondmdl_s7 = psml7 \n when 1 then secondmdl_s7 = psml5\n when 2 then secondmdl_s7 = psml4\n when 3 then secondmdl_s7 = psml3\n when 4 then secondmdl_s7 = psml2\n when 5 then secondmdl_s7 = psml1\n when 6 then secondmdl_s7 = self.user.s_name4 + ' - Pass'\n when 7..100 then secondmdl_s7 = rsml7\n end\n\n #secondmdl_s8\n case num_secondmd\n when 0 then secondmdl_s8 = psml8 \n when 1 then secondmdl_s8 = psml6\n when 2 then secondmdl_s8 = psml5\n when 3 then secondmdl_s8 = psml4\n when 4 then secondmdl_s8 = psml3\n when 5 then secondmdl_s8 = psml2\n when 6 then secondmdl_s8 = psml1\n when 7 then secondmdl_s8 = self.user.s_name4 + ' - Pass'\n when 8..100 then secondmdl_s8 = rsml8\n end\n\n #secondmdl_s9\n case num_secondmd\n when 0 then secondmdl_s9 = psml9 \n when 1 then secondmdl_s9 = psml7\n when 2 then secondmdl_s9 = psml6\n when 3 then secondmdl_s9 = psml5\n when 4 then secondmdl_s9 = psml4\n when 5 then secondmdl_s9 = psml3\n when 6 then secondmdl_s9 = psml2\n when 7 then secondmdl_s9 = psml1\n when 8 then secondmdl_s9 = self.user.s_name4 + ' - Pass'\n when 9..100 then secondmdl_s9 = rsml9\n end\n\n #secondmdl_s10\n case num_secondmd\n when 0 then secondmdl_s10 = psml10 \n when 1 then secondmdl_s10 = psml8\n when 2 then secondmdl_s10 = psml7\n when 3 then secondmdl_s10 = psml6\n when 4 then secondmdl_s10 = psml5\n when 5 then secondmdl_s10 = psml4\n when 6 then secondmdl_s10 = psml3\n when 7 then secondmdl_s10 = psml2\n when 8 then secondmdl_s10 = psml1\n when 9 then secondmdl_s10 = self.user.s_name4 + ' - Pass'\n when 10..100 then secondmdl_s10 = rsml10\n end\n\n #secondmdl_s11\n case num_secondmd\n when 0 then secondmdl_s11 = psml11 \n when 1 then secondmdl_s11 = psml9\n when 2 then secondmdl_s11 = psml8\n when 3 then secondmdl_s11 = psml7\n when 4 then secondmdl_s11 = psml6\n when 5 then secondmdl_s11 = psml5\n when 6 then secondmdl_s11 = psml4\n when 7 then secondmdl_s11 = psml3\n when 8 then secondmdl_s11 = psml2\n when 9 then secondmdl_s11 = psml1\n when 10..100 then secondmdl_s11 = rsml11\n end\n \n #Right Hash\n # secondmdr_s0 would always be blank\n\n #secondmdr_s1 \n if num_secondmd > 0\n secondmdr_s1 = rsmr1\n else\n secondmdr_s1 = psmr1\n end\n\n #secondmdr_s2\n if num_secondmd == 0\n secondmdr_s2 = psmr2\n elsif num_secondmd == 1\n secondmdr_s2 = ''\n else num_secondmd > 1\n secondmdr_s2 = rsmr2\n end\n\n #secondmdr_s3\n case num_secondmd\n when 0 then secondmdr_s3 = psmr3 \n when 1 then secondmdr_s3 = psmr1\n when 2 then secondmdr_s3 = ''\n when 3..100 then secondmdr_s3 = rsmr3\n end\n\n #secondmdr_s4\n case num_secondmd\n when 0 then secondmdr_s4 = psmr4 \n when 1 then secondmdr_s4 = psmr2\n when 2 then secondmdr_s4 = psmr1\n when 3 then ''\n when 4..100 then secondmdr_s4 = rsmr4\n end\n\n #secondmdr_s5\n case num_secondmd\n when 0 then secondmdr_s5 = psmr5 \n when 1 then secondmdr_s5 = psmr3\n when 2 then secondmdr_s5 = psmr2\n when 3 then secondmdr_s5 = psmr1\n when 4 then secondmdr_s5 = ''\n when 5..100 then secondmdr_s5 = rsmr5\n end\n\n #secondmdr_s6\n case num_secondmd\n when 0 then secondmdr_s6 = psmr6 \n when 1 then secondmdr_s6 = psmr4\n when 2 then secondmdr_s6 = psmr3\n when 3 then secondmdr_s6 = psmr2\n when 4 then secondmdr_s6 = psmr1\n when 5 then secondmdr_s6 = ''\n when 6..100 then secondmdr_s6 = rsmr6\n end\n\n #secondmdr_s7\n case num_secondmd\n when 0 then secondmdr_s7 = psmr7 \n when 1 then secondmdr_s7 = psmr5\n when 2 then secondmdr_s7 = psmr4\n when 3 then secondmdr_s7 = psmr3\n when 4 then secondmdr_s7 = psmr2\n when 5 then secondmdr_s7 = psmr1\n when 6 then secondmdr_s7 = ''\n when 7..100 then secondmdr_s7 = rsmr7\n end\n\n #secondmdr_s8\n case num_secondmd\n when 0 then secondmdr_s8 = psmr8 \n when 1 then secondmdr_s8 = psmr6\n when 2 then secondmdr_s8 = psmr5\n when 3 then secondmdr_s8 = psmr4\n when 4 then secondmdr_s8 = psmr3\n when 5 then secondmdr_s8 = psmr2\n when 6 then secondmdr_s8 = psmr1\n when 7 then secondmdr_s8 = ''\n when 8..100 then secondmdr_s8 = rsmr8\n end\n\n #secondmdr_s9\n case num_secondmd\n when 0 then secondmdr_s9 = psmr9 \n when 1 then secondmdr_s9 = psmr7\n when 2 then secondmdr_s9 = psmr6\n when 3 then secondmdr_s9 = psmr5\n when 4 then secondmdr_s9 = psmr4\n when 5 then secondmdr_s9 = psmr3\n when 6 then secondmdr_s9 = psmr2\n when 7 then secondmdr_s9 = psmr1\n when 8 then secondmdr_s9 = ''\n when 9..100 then secondmdr_s9 = rsmr9\n end\n\n #secondmdr_s10\n case num_secondmd\n when 0 then secondmdr_s10 = psmr10 \n when 1 then secondmdr_s10 = psmr8\n when 2 then secondmdr_s10 = psmr7\n when 3 then secondmdr_s10 = psmr6\n when 4 then secondmdr_s10 = psmr5\n when 5 then secondmdr_s10 = psmr4\n when 6 then secondmdr_s10 = psmr3\n when 7 then secondmdr_s10 = psmr2\n when 8 then secondmdr_s10 = psmr1\n when 9 then secondmdr_s10 = ''\n when 10..100 then secondmdr_s10 = rsmr10\n end\n\n #secondmdr_s11\n case num_secondmd\n when 0 then secondmdr_s11 = psmr11 \n when 1 then secondmdr_s11 = psmr9\n when 2 then secondmdr_s11 = psmr8\n when 3 then secondmdr_s11 = psmr7\n when 4 then secondmdr_s11 = psmr6\n when 5 then secondmdr_s11 = psmr5\n when 6 then secondmdr_s11 = psmr4\n when 7 then secondmdr_s11 = psmr3\n when 8 then secondmdr_s11 = psmr2\n when 9 then secondmdr_s11 = psmr1\n when 10..100 then secondmdr_s11 = rsmr11\n end\n \n #----------End 2nd & Medium----------\n\n #----------3rd & Medium----------\n thirdMediums = event.plays.where('situation7 = ?', true)\n \n runThirdMediums = thirdMediums.where('play_type = ?', 'Run')\n runThirdMediumsLeft = runThirdMediums.where('hash_mark = ?', 'Left')\n runThirdMediumsRight = runThirdMediums.where('hash_mark = ?', 'Right')\n \n passThirdMediums = thirdMediums.where('play_type = ?', 'Pass')\n passThirdMediumsLeft = passThirdMediums.where('hash_mark = ?', 'Left')\n passThirdMediumsRight = passThirdMediums.where('hash_mark = ?', 'Right')\n\n #Run Left Hash\n unless runThirdMediumsLeft[0].nil? \n rtml1 = runThirdMediumsLeft[0].fullname \n end\n unless runThirdMediumsLeft[1].nil? \n rtml2 = runThirdMediumsLeft[1].fullname \n end\n unless runThirdMediumsLeft[2].nil? \n rtml3 = runThirdMediumsLeft[2].fullname \n end\n unless runThirdMediumsLeft[3].nil? \n rtml4 = runThirdMediumsLeft[3].fullname \n end\n unless runThirdMediumsLeft[4].nil? \n rtml5 = runThirdMediumsLeft[4].fullname\n end\n unless runThirdMediumsLeft[5].nil? \n rtml6 = runThirdMediumsLeft[5].fullname \n end\n unless runThirdMediumsLeft[6].nil? \n rtml7 = runThirdMediumsLeft[6].fullname \n end\n unless runThirdMediumsLeft[7].nil? \n rtml8 = runThirdMediumsLeft[7].fullname \n end\n unless runThirdMediumsLeft[8].nil? \n rtml9 = runThirdMediumsLeft[8].fullname \n end\n unless runThirdMediumsLeft[9].nil? \n rtml10 = runThirdMediumsLeft[9].fullname\n end\n unless runThirdMediumsLeft[10].nil? \n rtml11 = runThirdMediumsLeft[10].fullname \n end\n\n #Run Right Hash\n unless runThirdMediumsRight[0].nil? \n rtmr1 = runThirdMediumsRight[0].fullname \n end\n unless runThirdMediumsRight[1].nil? \n rtmr2 = runThirdMediumsRight[1].fullname \n end\n unless runThirdMediumsRight[2].nil? \n rtmr3 = runThirdMediumsRight[2].fullname \n end\n unless runThirdMediumsRight[3].nil? \n rtmr4 = runThirdMediumsRight[3].fullname \n end\n unless runThirdMediumsRight[4].nil? \n rtmr5 = runThirdMediumsRight[4].fullname\n end\n unless runThirdMediumsRight[5].nil? \n rtmr6 = runThirdMediumsRight[5].fullname \n end\n unless runThirdMediumsRight[6].nil? \n rtmr7 = runThirdMediumsRight[6].fullname \n end\n unless runThirdMediumsRight[7].nil? \n rtmr8 = runThirdMediumsRight[7].fullname \n end\n unless runThirdMediumsRight[8].nil? \n rtmr9 = runThirdMediumsRight[8].fullname \n end\n unless runThirdMediumsRight[9].nil? \n rtmr10 = runThirdMediumsRight[9].fullname\n end\n unless runThirdMediumsRight[10].nil? \n rtmr11 = runThirdMediumsRight[10].fullname \n end\n \n\n #Pass Left Hash\n unless passThirdMediumsLeft[0].nil? \n ptml1 = passThirdMediumsLeft[0].fullname \n end\n unless passThirdMediumsLeft[1].nil? \n ptml2 = passThirdMediumsLeft[1].fullname \n end\n unless passThirdMediumsLeft[2].nil? \n ptml3 = passThirdMediumsLeft[2].fullname \n end\n unless passThirdMediumsLeft[3].nil? \n ptml4 = passThirdMediumsLeft[3].fullname \n end\n unless passThirdMediumsLeft[4].nil? \n ptml5 = passThirdMediumsLeft[4].fullname\n end\n unless passThirdMediumsLeft[5].nil? \n ptml6 = passThirdMediumsLeft[5].fullname \n end\n unless passThirdMediumsLeft[6].nil? \n ptml7 = passThirdMediumsLeft[6].fullname \n end\n unless passThirdMediumsLeft[7].nil? \n ptml8 = passThirdMediumsLeft[7].fullname \n end\n unless passThirdMediumsLeft[8].nil? \n ptml9 = passThirdMediumsLeft[8].fullname \n end\n unless passThirdMediumsLeft[9].nil? \n ptml10 = passThirdMediumsLeft[9].fullname\n end\n unless passThirdMediumsLeft[10].nil? \n ptml11 = passThirdMediumsLeft[10].fullname \n end\n\n #Pass Right Hash\n unless passThirdMediumsRight[0].nil? \n ptmr1 = passThirdMediumsRight[0].fullname \n end\n unless passThirdMediumsRight[1].nil? \n ptmr2 = passThirdMediumsRight[1].fullname \n end\n unless passThirdMediumsRight[2].nil? \n ptmr3 = passThirdMediumsRight[2].fullname \n end\n unless passThirdMediumsRight[3].nil? \n ptmr4 = passThirdMediumsRight[3].fullname \n end\n unless passThirdMediumsRight[4].nil? \n ptmr5 = passThirdMediumsRight[4].fullname\n end\n unless passThirdMediumsRight[5].nil? \n ptmr6 = passThirdMediumsRight[5].fullname \n end\n unless passThirdMediumsRight[6].nil? \n ptmr7 = passThirdMediumsRight[6].fullname \n end\n unless passThirdMediumsRight[7].nil? \n ptmr8 = passThirdMediumsRight[7].fullname \n end\n unless passThirdMediumsRight[8].nil? \n ptmr9 = passThirdMediumsRight[8].fullname \n end\n unless passThirdMediumsRight[9].nil? \n ptmr10 = passThirdMediumsRight[9].fullname\n end\n unless passThirdMediumsRight[10].nil? \n ptmr11 = passThirdMediumsRight[10].fullname \n end\n \n\n #Number of user's run plays in situation 7\n num_thirdmd = self.user.s_name7_num_run\n\n #Left Hash\n # thirdmdl_s0 \n if num_thirdmd > 0\n thirdmdl_s0 = self.user.s_name7 + ' - Run'\n else\n thirdmdl_s0 = self.user.s_name7 + ' - Pass'\n end\n\n #thirdmdl_s1 \n if num_thirdmd > 0\n thirdmdl_s1 = rtml1\n else\n thirdmdl_s1 = ptml1\n end\n\n #thirdmdl_s2\n if num_thirdmd == 0\n thirdmdl_s2 = ptml2\n elsif num_thirdmd == 1\n thirdmdl_s2 = self.user.s_name7 + ' - Pass'\n else num_thirdmd > 1\n thirdmdl_s2 = rtml2\n end\n\n #thirdmdl_s3\n case num_thirdmd\n when 0 then thirdmdl_s3 = ptml3 \n when 1 then thirdmdl_s3 = ptml1\n when 2 then thirdmdl_s3 = self.user.s_name7 + ' - Pass'\n when 3..100 then thirdmdl_s3 = rtml3\n end\n\n #thirdmdl_s4\n case num_thirdmd\n when 0 then thirdmdl_s4 = ptml4 \n when 1 then thirdmdl_s4 = ptml2\n when 2 then thirdmdl_s4 = ptml1\n when 3 then thirdmdl_s4 = self.user.s_name7 + ' - Pass'\n when 4..100 then thirdmdl_s4 = rtml4\n end\n\n #thirdmdl_s5\n case num_thirdmd\n when 0 then thirdmdl_s5 = ptml5 \n when 1 then thirdmdl_s5 = ptml3\n when 2 then thirdmdl_s5 = ptml2\n when 3 then thirdmdl_s5 = ptml1\n when 4 then thirdmdl_s5 = self.user.s_name7 + ' - Pass'\n when 5..100 then thirdmdl_s5 = rtml5\n end\n\n #thirdmdl_s6\n case num_thirdmd\n when 0 then thirdmdl_s6 = ptml6 \n when 1 then thirdmdl_s6 = ptml4\n when 2 then thirdmdl_s6 = ptml3\n when 3 then thirdmdl_s6 = ptml2\n when 4 then thirdmdl_s6 = ptml1\n when 5 then thirdmdl_s6 = self.user.s_name7 + ' - Pass'\n when 6..100 then thirdmdl_s6 = rtml6\n end\n\n #thirdmdl_s7\n case num_thirdmd\n when 0 then thirdmdl_s7 = ptml7 \n when 1 then thirdmdl_s7 = ptml5\n when 2 then thirdmdl_s7 = ptml4\n when 3 then thirdmdl_s7 = ptml3\n when 4 then thirdmdl_s7 = ptml2\n when 5 then thirdmdl_s7 = ptml1\n when 6 then thirdmdl_s7 = self.user.s_name7 + ' - Pass'\n when 7..100 then thirdmdl_s7 = rtml7\n end\n\n #thirdmdl_s8\n case num_thirdmd\n when 0 then thirdmdl_s8 = ptml8 \n when 1 then thirdmdl_s8 = ptml6\n when 2 then thirdmdl_s8 = ptml5\n when 3 then thirdmdl_s8 = ptml4\n when 4 then thirdmdl_s8 = ptml3\n when 5 then thirdmdl_s8 = ptml2\n when 6 then thirdmdl_s8 = ptml1\n when 7 then thirdmdl_s8 = self.user.s_name7 + ' - Pass'\n when 8..100 then thirdmdl_s8 = rtml8\n end\n\n #thirdmdl_s9\n case num_thirdmd\n when 0 then thirdmdl_s9 = ptml9 \n when 1 then thirdmdl_s9 = ptml7\n when 2 then thirdmdl_s9 = ptml6\n when 3 then thirdmdl_s9 = ptml5\n when 4 then thirdmdl_s9 = ptml4\n when 5 then thirdmdl_s9 = ptml3\n when 6 then thirdmdl_s9 = ptml2\n when 7 then thirdmdl_s9 = ptml1\n when 8 then thirdmdl_s9 = self.user.s_name7 + ' - Pass'\n when 9..100 then thirdmdl_s9 = rtml9\n end\n\n #thirdmdl_s10\n case num_thirdmd\n when 0 then thirdmdl_s10 = ptml10 \n when 1 then thirdmdl_s10 = ptml8\n when 2 then thirdmdl_s10 = ptml7\n when 3 then thirdmdl_s10 = ptml6\n when 4 then thirdmdl_s10 = ptml5\n when 5 then thirdmdl_s10 = ptml4\n when 6 then thirdmdl_s10 = ptml3\n when 7 then thirdmdl_s10 = ptml2\n when 8 then thirdmdl_s10 = ptml1\n when 9 then thirdmdl_s10 = self.user.s_name7 + ' - Pass'\n when 10..100 then thirdmdl_s10 = rtml10\n end\n\n #thirdmdl_s11\n case num_thirdmd\n when 0 then thirdmdl_s11 = ptml11 \n when 1 then thirdmdl_s11 = ptml9\n when 2 then thirdmdl_s11 = ptml8\n when 3 then thirdmdl_s11 = ptml7\n when 4 then thirdmdl_s11 = ptml6\n when 5 then thirdmdl_s11 = ptml5\n when 6 then thirdmdl_s11 = ptml4\n when 7 then thirdmdl_s11 = ptml3\n when 8 then thirdmdl_s11 = ptml2\n when 9 then thirdmdl_s11 = ptml1\n when 10..100 then thirdmdl_s11 = rtml11\n end\n \n #Right Hash\n # thirdmdr_s0 would always be blank\n\n #thirdmdr_s1 \n if num_thirdmd > 0\n thirdmdr_s1 = rtmr1\n else\n thirdmdr_s1 = ptmr1\n end\n\n #thirdmdr_s2\n if num_thirdmd == 0\n thirdmdr_s2 = ptmr2\n elsif num_thirdmd == 1\n thirdmdr_s2 = ''\n else num_thirdmd > 1\n thirdmdr_s2 = rtmr2\n end\n\n #thirdmdr_s3\n case num_thirdmd\n when 0 then thirdmdr_s3 = ptmr3 \n when 1 then thirdmdr_s3 = ptmr1\n when 2 then thirdmdr_s3 = ''\n when 3..100 then thirdmdr_s3 = rtmr3\n end\n\n #thirdmdr_s4\n case num_thirdmd\n when 0 then thirdmdr_s4 = ptmr4 \n when 1 then thirdmdr_s4 = ptmr2\n when 2 then thirdmdr_s4 = ptmr1\n when 3 then ''\n when 4..100 then thirdmdr_s4 = rtmr4\n end\n\n #thirdmdr_s5\n case num_thirdmd\n when 0 then thirdmdr_s5 = ptmr5 \n when 1 then thirdmdr_s5 = ptmr3\n when 2 then thirdmdr_s5 = ptmr2\n when 3 then thirdmdr_s5 = ptmr1\n when 4 then thirdmdr_s5 = ''\n when 5..100 then thirdmdr_s5 = rtmr5\n end\n\n #thirdmdr_s6\n case num_thirdmd\n when 0 then thirdmdr_s6 = ptmr6 \n when 1 then thirdmdr_s6 = ptmr4\n when 2 then thirdmdr_s6 = ptmr3\n when 3 then thirdmdr_s6 = ptmr2\n when 4 then thirdmdr_s6 = ptmr1\n when 5 then thirdmdr_s6 = ''\n when 6..100 then thirdmdr_s6 = rtmr6\n end\n\n #thirdmdr_s7\n case num_thirdmd\n when 0 then thirdmdr_s7 = ptmr7 \n when 1 then thirdmdr_s7 = ptmr5\n when 2 then thirdmdr_s7 = ptmr4\n when 3 then thirdmdr_s7 = ptmr3\n when 4 then thirdmdr_s7 = ptmr2\n when 5 then thirdmdr_s7 = ptmr1\n when 6 then thirdmdr_s7 = ''\n when 7..100 then thirdmdr_s7 = rtmr7\n end\n\n #thirdmdr_s8\n case num_thirdmd\n when 0 then thirdmdr_s8 = ptmr8 \n when 1 then thirdmdr_s8 = ptmr6\n when 2 then thirdmdr_s8 = ptmr5\n when 3 then thirdmdr_s8 = ptmr4\n when 4 then thirdmdr_s8 = ptmr3\n when 5 then thirdmdr_s8 = ptmr2\n when 6 then thirdmdr_s8 = ptmr1\n when 7 then thirdmdr_s8 = ''\n when 8..100 then thirdmdr_s8 = rtmr8\n end\n\n #thirdmdr_s9\n case num_thirdmd\n when 0 then thirdmdr_s9 = ptmr9 \n when 1 then thirdmdr_s9 = ptmr7\n when 2 then thirdmdr_s9 = ptmr6\n when 3 then thirdmdr_s9 = ptmr5\n when 4 then thirdmdr_s9 = ptmr4\n when 5 then thirdmdr_s9 = ptmr3\n when 6 then thirdmdr_s9 = ptmr2\n when 7 then thirdmdr_s9 = ptmr1\n when 8 then thirdmdr_s9 = ''\n when 9..100 then thirdmdr_s9 = rtmr9\n end\n\n #thirdmdr_s10\n case num_thirdmd\n when 0 then thirdmdr_s10 = ptmr10 \n when 1 then thirdmdr_s10 = ptmr8\n when 2 then thirdmdr_s10 = ptmr7\n when 3 then thirdmdr_s10 = ptmr6\n when 4 then thirdmdr_s10 = ptmr5\n when 5 then thirdmdr_s10 = ptmr4\n when 6 then thirdmdr_s10 = ptmr3\n when 7 then thirdmdr_s10 = ptmr2\n when 8 then thirdmdr_s10 = ptmr1\n when 9 then thirdmdr_s10 = ''\n when 10..100 then thirdmdr_s10 = rtmr10\n end\n\n #thirdmdr_s11\n case num_thirdmd\n when 0 then thirdmdr_s11 = ptmr11 \n when 1 then thirdmdr_s11 = ptmr9\n when 2 then thirdmdr_s11 = ptmr8\n when 3 then thirdmdr_s11 = ptmr7\n when 4 then thirdmdr_s11 = ptmr6\n when 5 then thirdmdr_s11 = ptmr5\n when 6 then thirdmdr_s11 = ptmr4\n when 7 then thirdmdr_s11 = ptmr3\n when 8 then thirdmdr_s11 = ptmr2\n when 9 then thirdmdr_s11 = ptmr1\n when 10..100 then thirdmdr_s11 = rtmr11\n end\n #----------End 3rd & Medium----------\n\n #----------2nd & Short----------\n secondShorts = event.plays.where('situation5 = ?', true)\n \n runSecondShorts = secondShorts.where('play_type = ?', 'Run')\n runSecondShortsLeft = runSecondShorts.where('hash_mark = ?', 'Left')\n runSecondShortsRight = runSecondShorts.where('hash_mark = ?', 'Right')\n \n passSecondShorts = secondShorts.where('play_type = ?', 'Pass')\n passSecondShortsLeft = passSecondShorts.where('hash_mark = ?', 'Left')\n passSecondShortsRight = passSecondShorts.where('hash_mark = ?', 'Right')\n\n #Run Left Hash\n unless runSecondShortsLeft[0].nil? \n rssl1 = runSecondShortsLeft[0].fullname \n end\n unless runSecondShortsLeft[1].nil? \n rssl2 = runSecondShortsLeft[1].fullname \n end\n unless runSecondShortsLeft[2].nil? \n rssl3 = runSecondShortsLeft[2].fullname \n end\n unless runSecondShortsLeft[3].nil? \n rssl4 = runSecondShortsLeft[3].fullname \n end\n unless runSecondShortsLeft[4].nil? \n rssl5 = runSecondShortsLeft[4].fullname\n end\n unless runSecondShortsLeft[5].nil? \n rssl6 = runSecondShortsLeft[5].fullname \n end\n unless runSecondShortsLeft[6].nil? \n rssl7 = runSecondShortsLeft[6].fullname \n end\n unless runSecondShortsLeft[7].nil? \n rssl8 = runSecondShortsLeft[7].fullname \n end\n unless runSecondShortsLeft[8].nil? \n rssl9 = runSecondShortsLeft[8].fullname \n end\n unless runSecondShortsLeft[9].nil? \n rssl10 = runSecondShortsLeft[9].fullname\n end\n unless runSecondShortsLeft[10].nil? \n rssl11 = runSecondShortsLeft[10].fullname\n end\n\n #Run Right Hash\n unless runSecondShortsRight[0].nil? \n rssr1 = runSecondShortsRight[0].fullname \n end\n unless runSecondShortsRight[1].nil? \n rssr2 = runSecondShortsRight[1].fullname \n end\n unless runSecondShortsRight[2].nil? \n rssr3 = runSecondShortsRight[2].fullname \n end\n unless runSecondShortsRight[3].nil? \n rssr4 = runSecondShortsRight[3].fullname \n end\n unless runSecondShortsRight[4].nil? \n rssr5 = runSecondShortsRight[4].fullname\n end\n unless runSecondShortsRight[5].nil? \n rssr6 = runSecondShortsRight[5].fullname \n end\n unless runSecondShortsRight[6].nil? \n rssr7 = runSecondShortsRight[6].fullname \n end\n unless runSecondShortsRight[7].nil? \n rssr8 = runSecondShortsRight[7].fullname \n end\n unless runSecondShortsRight[8].nil? \n rssr9 = runSecondShortsRight[8].fullname \n end\n unless runSecondShortsRight[9].nil? \n rssr10 = runSecondShortsRight[9].fullname\n end\n unless runSecondShortsRight[10].nil? \n rssr11 = runSecondShortsRight[10].fullname\n end\n\n #Pass Left Hash\n unless passSecondShortsLeft[0].nil? \n pssl1 = passSecondShortsLeft[0].fullname \n end\n unless passSecondShortsLeft[1].nil? \n pssl2 = passSecondShortsLeft[1].fullname \n end\n unless passSecondShortsLeft[2].nil? \n pssl3 = passSecondShortsLeft[2].fullname \n end\n unless passSecondShortsLeft[3].nil? \n pssl4 = passSecondShortsLeft[3].fullname \n end\n unless passSecondShortsLeft[4].nil? \n pssl5 = passSecondShortsLeft[4].fullname\n end\n unless passSecondShortsLeft[5].nil? \n pssl6 = passSecondShortsLeft[5].fullname \n end\n unless passSecondShortsLeft[6].nil? \n pssl7 = passSecondShortsLeft[6].fullname \n end\n unless passSecondShortsLeft[7].nil? \n pssl8 = passSecondShortsLeft[7].fullname \n end\n unless passSecondShortsLeft[8].nil? \n pssl9 = passSecondShortsLeft[8].fullname \n end\n unless passSecondShortsLeft[9].nil? \n pssl10 = passSecondShortsLeft[9].fullname\n end\n unless passSecondShortsLeft[10].nil? \n pssl11 = passSecondShortsLeft[10].fullname\n end\n\n #Pass Right Hash\n unless passSecondShortsRight[0].nil? \n pssr1 = passSecondShortsRight[0].fullname \n end\n unless passSecondShortsRight[1].nil? \n pssr2 = passSecondShortsRight[1].fullname \n end\n unless passSecondShortsRight[2].nil? \n pssr3 = passSecondShortsRight[2].fullname \n end\n unless passSecondShortsRight[3].nil? \n pssr4 = passSecondShortsRight[3].fullname \n end\n unless passSecondShortsRight[4].nil? \n pssr5 = passSecondShortsRight[4].fullname\n end\n unless passSecondShortsRight[5].nil? \n pssr6 = passSecondShortsRight[5].fullname \n end\n unless passSecondShortsRight[6].nil? \n pssr7 = passSecondShortsRight[6].fullname \n end\n unless passSecondShortsRight[7].nil? \n pssr8 = passSecondShortsRight[7].fullname \n end\n unless passSecondShortsRight[8].nil? \n pssr9 = passSecondShortsRight[8].fullname \n end\n unless passSecondShortsRight[9].nil? \n pssr10 = passSecondShortsRight[9].fullname\n end\n unless passSecondShortsRight[10].nil? \n pssr11 = passSecondShortsRight[10].fullname\n end\n\n #Number of user's run plays in situation 5\n num_secondst = self.user.s_name5_num_run\n\n #Left Hash\n # secondstl_s0 \n if num_secondst > 0\n secondstl_s0 = self.user.s_name5 + ' - Run'\n else\n secondstl_s0 = self.user.s_name5 + ' - Pass'\n end\n\n #secondstl_s1 \n if num_secondst > 0\n secondstl_s1 = rssl1\n else\n secondstl_s1 = pssl1\n end\n\n #secondstl_s2\n if num_secondst == 0\n secondstl_s2 = pssl2\n elsif num_secondst == 1\n secondstl_s2 = self.user.s_name5 + ' - Pass'\n else num_secondst > 1\n secondstl_s2 = rssl2\n end\n\n #secondstl_s3\n case num_secondst\n when 0 then secondstl_s3 = pssl3 \n when 1 then secondstl_s3 = pssl1\n when 2 then secondstl_s3 = self.user.s_name5 + ' - Pass'\n when 3..100 then secondstl_s3 = rssl3\n end\n\n #secondstl_s4\n case num_secondst\n when 0 then secondstl_s4 = pssl4 \n when 1 then secondstl_s4 = pssl2\n when 2 then secondstl_s4 = pssl1\n when 3 then secondstl_s4 = self.user.s_name5 + ' - Pass'\n when 4..100 then secondstl_s4 = rssl4\n end\n\n #secondstl_s5\n case num_secondst\n when 0 then secondstl_s5 = pssl5 \n when 1 then secondstl_s5 = pssl3\n when 2 then secondstl_s5 = pssl2\n when 3 then secondstl_s5 = pssl1\n when 4 then secondstl_s5 = self.user.s_name5 + ' - Pass'\n when 5..100 then secondstl_s5 = rssl5\n end\n\n #secondstl_s6\n case num_secondst\n when 0 then secondstl_s6 = pssl6 \n when 1 then secondstl_s6 = pssl4\n when 2 then secondstl_s6 = pssl3\n when 3 then secondstl_s6 = pssl2\n when 4 then secondstl_s6 = pssl1\n when 5 then secondstl_s6 = self.user.s_name5 + ' - Pass'\n when 6..100 then secondstl_s6 = rssl6\n end\n\n #secondstl_s7\n case num_secondst\n when 0 then secondstl_s7 = pssl7 \n when 1 then secondstl_s7 = pssl5\n when 2 then secondstl_s7 = pssl4\n when 3 then secondstl_s7 = pssl3\n when 4 then secondstl_s7 = pssl2\n when 5 then secondstl_s7 = pssl1\n when 6 then secondstl_s7 = self.user.s_name5 + ' - Pass'\n when 7..100 then secondstl_s7 = rssl7\n end\n\n #secondstl_s8\n case num_secondst\n when 0 then secondstl_s8 = pssl8 \n when 1 then secondstl_s8 = pssl6\n when 2 then secondstl_s8 = pssl5\n when 3 then secondstl_s8 = pssl4\n when 4 then secondstl_s8 = pssl3\n when 5 then secondstl_s8 = pssl2\n when 6 then secondstl_s8 = pssl1\n when 7 then secondstl_s8 = self.user.s_name5 + ' - Pass'\n when 8..100 then secondstl_s8 = rssl8\n end\n\n #secondstl_s9\n case num_secondst\n when 0 then secondstl_s9 = pssl9 \n when 1 then secondstl_s9 = pssl7\n when 2 then secondstl_s9 = pssl6\n when 3 then secondstl_s9 = pssl5\n when 4 then secondstl_s9 = pssl4\n when 5 then secondstl_s9 = pssl3\n when 6 then secondstl_s9 = pssl2\n when 7 then secondstl_s9 = pssl1\n when 8 then secondstl_s9 = self.user.s_name5 + ' - Pass'\n when 9..100 then secondstl_s9 = rssl9\n end\n\n #secondstl_s10\n case num_secondst\n when 0 then secondstl_s10 = pssl10 \n when 1 then secondstl_s10 = pssl8\n when 2 then secondstl_s10 = pssl7\n when 3 then secondstl_s10 = pssl6\n when 4 then secondstl_s10 = pssl5\n when 5 then secondstl_s10 = pssl4\n when 6 then secondstl_s10 = pssl3\n when 7 then secondstl_s10 = pssl2\n when 8 then secondstl_s10 = pssl1\n when 9 then secondstl_s10 = self.user.s_name5 + ' - Pass'\n when 10..100 then secondstl_s10 = rssl10\n end\n\n #secondstl_s11\n case num_secondst\n when 0 then secondstl_s11 = pssl11 \n when 1 then secondstl_s11 = pssl9\n when 2 then secondstl_s11 = pssl8\n when 3 then secondstl_s11 = pssl7\n when 4 then secondstl_s11 = pssl6\n when 5 then secondstl_s11 = pssl5\n when 6 then secondstl_s11 = pssl4\n when 7 then secondstl_s11 = pssl3\n when 8 then secondstl_s11 = pssl2\n when 9 then secondstl_s11 = pssl1\n when 10..100 then secondstl_s11 = rssl11\n end\n \n #Right Hash\n # secondstr_s0 would always be blank\n\n #secondstr_s1 \n if num_secondst > 0\n secondstr_s1 = rssr1\n else\n secondstr_s1 = pssr1\n end\n\n #secondstr_s2\n if num_secondst == 0\n secondstr_s2 = pssr2\n elsif num_secondst == 1\n secondstr_s2 = ''\n else num_secondst > 1\n secondstr_s2 = rssr2\n end\n\n #secondstr_s3\n case num_secondst\n when 0 then secondstr_s3 = pssr3 \n when 1 then secondstr_s3 = pssr1\n when 2 then secondstr_s3 = ''\n when 3..100 then secondstr_s3 = rssr3\n end\n\n #secondstr_s4\n case num_secondst\n when 0 then secondstr_s4 = pssr4 \n when 1 then secondstr_s4 = pssr2\n when 2 then secondstr_s4 = pssr1\n when 3 then ''\n when 4..100 then secondstr_s4 = rssr4\n end\n\n #secondstr_s5\n case num_secondst\n when 0 then secondstr_s5 = pssr5 \n when 1 then secondstr_s5 = pssr3\n when 2 then secondstr_s5 = pssr2\n when 3 then secondstr_s5 = pssr1\n when 4 then secondstr_s5 = ''\n when 5..100 then secondstr_s5 = rssr5\n end\n\n #secondstr_s6\n case num_secondst\n when 0 then secondstr_s6 = pssr6 \n when 1 then secondstr_s6 = pssr4\n when 2 then secondstr_s6 = pssr3\n when 3 then secondstr_s6 = pssr2\n when 4 then secondstr_s6 = pssr1\n when 5 then secondstr_s6 = ''\n when 6..100 then secondstr_s6 = rssr6\n end\n\n #secondstr_s7\n case num_secondst\n when 0 then secondstr_s7 = pssr7 \n when 1 then secondstr_s7 = pssr5\n when 2 then secondstr_s7 = pssr4\n when 3 then secondstr_s7 = pssr3\n when 4 then secondstr_s7 = pssr2\n when 5 then secondstr_s7 = pssr1\n when 6 then secondstr_s7 = ''\n when 7..100 then secondstr_s7 = rssr7\n end\n\n #secondstr_s8\n case num_secondst\n when 0 then secondstr_s8 = pssr8 \n when 1 then secondstr_s8 = pssr6\n when 2 then secondstr_s8 = pssr5\n when 3 then secondstr_s8 = pssr4\n when 4 then secondstr_s8 = pssr3\n when 5 then secondstr_s8 = pssr2\n when 6 then secondstr_s8 = pssr1\n when 7 then secondstr_s8 = ''\n when 8..100 then secondstr_s8 = rssr8\n end\n\n #secondstr_s9\n case num_secondst\n when 0 then secondstr_s9 = pssr9 \n when 1 then secondstr_s9 = pssr7\n when 2 then secondstr_s9 = pssr6\n when 3 then secondstr_s9 = pssr5\n when 4 then secondstr_s9 = pssr4\n when 5 then secondstr_s9 = pssr3\n when 6 then secondstr_s9 = pssr2\n when 7 then secondstr_s9 = pssr1\n when 8 then secondstr_s9 = ''\n when 9..100 then secondstr_s9 = rssr9\n end\n\n #secondstr_s10\n case num_secondst\n when 0 then secondstr_s10 = pssr10 \n when 1 then secondstr_s10 = pssr8\n when 2 then secondstr_s10 = pssr7\n when 3 then secondstr_s10 = pssr6\n when 4 then secondstr_s10 = pssr5\n when 5 then secondstr_s10 = pssr4\n when 6 then secondstr_s10 = pssr3\n when 7 then secondstr_s10 = pssr2\n when 8 then secondstr_s10 = pssr1\n when 9 then secondstr_s10 = ''\n when 10..100 then secondstr_s10 = rssr10\n end\n\n #secondstr_s11\n case num_secondst\n when 0 then secondstr_s11 = pssr11 \n when 1 then secondstr_s11 = pssr9\n when 2 then secondstr_s11 = pssr8\n when 3 then secondstr_s11 = pssr7\n when 4 then secondstr_s11 = pssr6\n when 5 then secondstr_s11 = pssr5\n when 6 then secondstr_s11 = pssr4\n when 7 then secondstr_s11 = pssr3\n when 8 then secondstr_s11 = pssr2\n when 9 then secondstr_s11 = pssr1\n when 10..100 then secondstr_s11 = rssr11\n end \n #----------End 2nd & Short----------\n\n #----------3rd & Short----------\n thirdShorts = event.plays.where('situation8 = ?', true)\n \n runThirdShorts = thirdShorts.where('play_type = ?', 'Run')\n runThirdShortsLeft = runThirdShorts.where('hash_mark = ?', 'Left')\n runThirdShortsRight = runThirdShorts.where('hash_mark = ?', 'Right')\n \n passThirdShorts = thirdShorts.where('play_type = ?', 'Pass')\n passThirdShortsLeft = passThirdShorts.where('hash_mark = ?', 'Left')\n passThirdShortsRight = passThirdShorts.where('hash_mark = ?', 'Right')\n\n #Run Left Hash\n unless runThirdShortsLeft[0].nil? \n rtsl1 = runThirdShortsLeft[0].fullname \n end\n unless runThirdShortsLeft[1].nil? \n rtsl2 = runThirdShortsLeft[1].fullname \n end\n unless runThirdShortsLeft[2].nil? \n rtsl3 = runThirdShortsLeft[2].fullname \n end\n unless runThirdShortsLeft[3].nil? \n rtsl4 = runThirdShortsLeft[3].fullname \n end\n unless runThirdShortsLeft[4].nil? \n rtsl5 = runThirdShortsLeft[4].fullname\n end\n unless runThirdShortsLeft[5].nil? \n rtsl6 = runThirdShortsLeft[5].fullname \n end\n unless runThirdShortsLeft[6].nil? \n rtsl7 = runThirdShortsLeft[6].fullname\n end \n unless runThirdShortsLeft[7].nil? \n rtsl8 = runThirdShortsLeft[7].fullname \n end\n unless runThirdShortsLeft[8].nil? \n rtsl9 = runThirdShortsLeft[8].fullname \n end\n unless runThirdShortsLeft[9].nil? \n rtsl10 = runThirdShortsLeft[9].fullname \n end\n unless runThirdShortsLeft[10].nil? \n rtsl11 = runThirdShortsLeft[10].fullname \n end\n\n #Run Right Hash\n unless runThirdShortsRight[0].nil? \n rtsr1 = runThirdShortsRight[0].fullname \n end\n unless runThirdShortsRight[1].nil? \n rtsr2 = runThirdShortsRight[1].fullname \n end\n unless runThirdShortsRight[2].nil? \n rtsr3 = runThirdShortsRight[2].fullname \n end\n unless runThirdShortsRight[3].nil? \n rtsr4 = runThirdShortsRight[3].fullname \n end\n unless runThirdShortsRight[4].nil? \n rtsr5 = runThirdShortsRight[4].fullname\n end\n unless runThirdShortsRight[5].nil? \n rtsr6 = runThirdShortsRight[5].fullname \n end\n unless runThirdShortsRight[6].nil? \n rtsr7 = runThirdShortsRight[6].fullname\n end \n unless runThirdShortsRight[7].nil? \n rtsr8 = runThirdShortsRight[7].fullname \n end\n unless runThirdShortsRight[8].nil? \n rtsr9 = runThirdShortsRight[8].fullname\n end\n unless runThirdShortsRight[9].nil? \n rtsr10 = runThirdShortsRight[9].fullname \n end\n unless runThirdShortsRight[10].nil? \n rtsr11 = runThirdShortsRight[10].fullname\n end \n\n #Pass Left Hash\n unless passThirdShortsLeft[0].nil? \n ptsl1 = passThirdShortsLeft[0].fullname \n end\n unless passThirdShortsLeft[1].nil? \n ptsl2 = passThirdShortsLeft[1].fullname \n end\n unless passThirdShortsLeft[2].nil? \n ptsl3 = passThirdShortsLeft[2].fullname \n end\n unless passThirdShortsLeft[3].nil? \n ptsl4 = passThirdShortsLeft[3].fullname \n end\n unless passThirdShortsLeft[4].nil? \n ptsl5 = passThirdShortsLeft[4].fullname \n end\n unless passThirdShortsLeft[5].nil? \n ptsl6 = passThirdShortsLeft[5].fullname \n end\n unless passThirdShortsLeft[6].nil? \n ptsl7 = passThirdShortsLeft[6].fullname \n end\n unless passThirdShortsLeft[7].nil? \n ptsl8 = passThirdShortsLeft[7].fullname \n end\n unless passThirdShortsLeft[8].nil? \n ptsl9 = passThirdShortsLeft[8].fullname \n end\n unless passThirdShortsLeft[9].nil? \n ptsl10 = passThirdShortsLeft[9].fullname \n end\n unless passThirdShortsLeft[10].nil? \n ptsl11 = passThirdShortsLeft[10].fullname \n end\n\n #Pass Right Hash\n unless passThirdShortsRight[0].nil? \n ptsr1 = passThirdShortsRight[0].fullname \n end\n unless passThirdShortsRight[1].nil? \n ptsr2 = passThirdShortsRight[1].fullname \n end\n unless passThirdShortsRight[2].nil? \n ptsr3 = passThirdShortsRight[2].fullname \n end\n unless passThirdShortsRight[3].nil? \n ptsr4 = passThirdShortsRight[3].fullname \n end\n unless passThirdShortsRight[4].nil? \n ptsr5 = passThirdShortsRight[4].fullname \n end\n unless passThirdShortsRight[5].nil? \n ptsr6 = passThirdShortsRight[5].fullname \n end\n unless passThirdShortsRight[6].nil? \n ptsr7 = passThirdShortsRight[6].fullname \n end\n unless passThirdShortsRight[7].nil? \n ptsr8 = passThirdShortsRight[7].fullname \n end\n unless passThirdShortsRight[8].nil? \n ptsr9 = passThirdShortsRight[8].fullname \n end\n unless passThirdShortsRight[9].nil? \n ptsr10 = passThirdShortsRight[9].fullname \n end\n unless passThirdShortsRight[10].nil? \n ptsr11 = passThirdShortsRight[10].fullname \n end\n\n #Number of user's run plays in situation 8\n num_thirdst = self.user.s_name8_num_run\n\n #Left Hash\n # thirdstl_s0 \n if num_thirdst > 0\n thirdstl_s0 = self.user.s_name8 + ' - Run'\n else\n thirdstl_s0 = self.user.s_name8 + ' - Pass'\n end\n\n #thirdstl_s1 \n if num_thirdst > 0\n thirdstl_s1 = rtsl1\n else\n thirdstl_s1 = ptsl1\n end\n\n #thirdstl_s2\n if num_thirdst == 0\n thirdstl_s2 = ptsl2\n elsif num_thirdst == 1\n thirdstl_s2 = self.user.s_name8 + ' - Pass'\n else num_thirdst > 1\n thirdstl_s2 = rtsl2\n end\n\n #thirdstl_s3\n case num_thirdst\n when 0 then thirdstl_s3 = ptsl3 \n when 1 then thirdstl_s3 = ptsl1\n when 2 then thirdstl_s3 = self.user.s_name8 + ' - Pass'\n when 3..100 then thirdstl_s3 = rtsl3\n end\n\n #thirdstl_s4\n case num_thirdst\n when 0 then thirdstl_s4 = ptsl4 \n when 1 then thirdstl_s4 = ptsl2\n when 2 then thirdstl_s4 = ptsl1\n when 3 then thirdstl_s4 = self.user.s_name8 + ' - Pass'\n when 4..100 then thirdstl_s4 = rtsl4\n end\n\n #thirdstl_s5\n case num_thirdst\n when 0 then thirdstl_s5 = ptsl5 \n when 1 then thirdstl_s5 = ptsl3\n when 2 then thirdstl_s5 = ptsl2\n when 3 then thirdstl_s5 = ptsl1\n when 4 then thirdstl_s5 = self.user.s_name8 + ' - Pass'\n when 5..100 then thirdstl_s5 = rtsl5\n end\n\n #thirdstl_s6\n case num_thirdst\n when 0 then thirdstl_s6 = ptsl6 \n when 1 then thirdstl_s6 = ptsl4\n when 2 then thirdstl_s6 = ptsl3\n when 3 then thirdstl_s6 = ptsl2\n when 4 then thirdstl_s6 = ptsl1\n when 5 then thirdstl_s6 = self.user.s_name8 + ' - Pass'\n when 6..100 then thirdstl_s6 = rtsl6\n end\n\n #thirdstl_s7\n case num_thirdst\n when 0 then thirdstl_s7 = ptsl7 \n when 1 then thirdstl_s7 = ptsl5\n when 2 then thirdstl_s7 = ptsl4\n when 3 then thirdstl_s7 = ptsl3\n when 4 then thirdstl_s7 = ptsl2\n when 5 then thirdstl_s7 = ptsl1\n when 6 then thirdstl_s7 = self.user.s_name8 + ' - Pass'\n when 7..100 then thirdstl_s7 = rtsl7\n end\n\n #thirdstl_s8\n case num_thirdst\n when 0 then thirdstl_s8 = ptsl8 \n when 1 then thirdstl_s8 = ptsl6\n when 2 then thirdstl_s8 = ptsl5\n when 3 then thirdstl_s8 = ptsl4\n when 4 then thirdstl_s8 = ptsl3\n when 5 then thirdstl_s8 = ptsl2\n when 6 then thirdstl_s8 = ptsl1\n when 7 then thirdstl_s8 = self.user.s_name8 + ' - Pass'\n when 8..100 then thirdstl_s8 = rtsl8\n end\n\n #thirdstl_s9\n case num_thirdst\n when 0 then thirdstl_s9 = ptsl9 \n when 1 then thirdstl_s9 = ptsl7\n when 2 then thirdstl_s9 = ptsl6\n when 3 then thirdstl_s9 = ptsl5\n when 4 then thirdstl_s9 = ptsl4\n when 5 then thirdstl_s9 = ptsl3\n when 6 then thirdstl_s9 = ptsl2\n when 7 then thirdstl_s9 = ptsl1\n when 8 then thirdstl_s9 = self.user.s_name8 + ' - Pass'\n when 9..100 then thirdstl_s9 = rtsl9\n end\n\n #thirdstl_s10\n case num_thirdst\n when 0 then thirdstl_s10 = ptsl10 \n when 1 then thirdstl_s10 = ptsl8\n when 2 then thirdstl_s10 = ptsl7\n when 3 then thirdstl_s10 = ptsl6\n when 4 then thirdstl_s10 = ptsl5\n when 5 then thirdstl_s10 = ptsl4\n when 6 then thirdstl_s10 = ptsl3\n when 7 then thirdstl_s10 = ptsl2\n when 8 then thirdstl_s10 = ptsl1\n when 9 then thirdstl_s10 = self.user.s_name8 + ' - Pass'\n when 10..100 then thirdstl_s10 = rtsl10\n end\n\n #thirdstl_s11\n case num_thirdst\n when 0 then thirdstl_s11 = ptsl11 \n when 1 then thirdstl_s11 = ptsl9\n when 2 then thirdstl_s11 = ptsl8\n when 3 then thirdstl_s11 = ptsl7\n when 4 then thirdstl_s11 = ptsl6\n when 5 then thirdstl_s11 = ptsl5\n when 6 then thirdstl_s11 = ptsl4\n when 7 then thirdstl_s11 = ptsl3\n when 8 then thirdstl_s11 = ptsl2\n when 9 then thirdstl_s11 = ptsl1\n when 10..100 then thirdstl_s11 = rtsl11\n end\n \n #Right Hash\n # thirdstr_s0 would always be blank\n\n #thirdstr_s1 \n if num_thirdst > 0\n thirdstr_s1 = rtsr1\n else\n thirdstr_s1 = ptsr1\n end\n\n #thirdstr_s2\n if num_thirdst == 0\n thirdstr_s2 = ptsr2\n elsif num_thirdst == 1\n thirdstr_s2 = ''\n else num_thirdst > 1\n thirdstr_s2 = rtsr2\n end\n\n #thirdstr_s3\n case num_thirdst\n when 0 then thirdstr_s3 = ptsr3 \n when 1 then thirdstr_s3 = ptsr1\n when 2 then thirdstr_s3 = ''\n when 3..100 then thirdstr_s3 = rtsr3\n end\n\n #thirdstr_s4\n case num_thirdst\n when 0 then thirdstr_s4 = ptsr4 \n when 1 then thirdstr_s4 = ptsr2\n when 2 then thirdstr_s4 = ptsr1\n when 3 then ''\n when 4..100 then thirdstr_s4 = rtsr4\n end\n\n #thirdstr_s5\n case num_thirdst\n when 0 then thirdstr_s5 = ptsr5 \n when 1 then thirdstr_s5 = ptsr3\n when 2 then thirdstr_s5 = ptsr2\n when 3 then thirdstr_s5 = ptsr1\n when 4 then thirdstr_s5 = ''\n when 5..100 then thirdstr_s5 = rtsr5\n end\n\n #thirdstr_s6\n case num_thirdst\n when 0 then thirdstr_s6 = ptsr6 \n when 1 then thirdstr_s6 = ptsr4\n when 2 then thirdstr_s6 = ptsr3\n when 3 then thirdstr_s6 = ptsr2\n when 4 then thirdstr_s6 = ptsr1\n when 5 then thirdstr_s6 = ''\n when 6..100 then thirdstr_s6 = rtsr6\n end\n\n #thirdstr_s7\n case num_thirdst\n when 0 then thirdstr_s7 = ptsr7 \n when 1 then thirdstr_s7 = ptsr5\n when 2 then thirdstr_s7 = ptsr4\n when 3 then thirdstr_s7 = ptsr3\n when 4 then thirdstr_s7 = ptsr2\n when 5 then thirdstr_s7 = ptsr1\n when 6 then thirdstr_s7 = ''\n when 7..100 then thirdstr_s7 = rtsr7\n end\n\n #thirdstr_s8\n case num_thirdst\n when 0 then thirdstr_s8 = ptsr8 \n when 1 then thirdstr_s8 = ptsr6\n when 2 then thirdstr_s8 = ptsr5\n when 3 then thirdstr_s8 = ptsr4\n when 4 then thirdstr_s8 = ptsr3\n when 5 then thirdstr_s8 = ptsr2\n when 6 then thirdstr_s8 = ptsr1\n when 7 then thirdstr_s8 = ''\n when 8..100 then thirdstr_s8 = rtsr8\n end\n\n #thirdstr_s9\n case num_thirdst\n when 0 then thirdstr_s9 = ptsr9 \n when 1 then thirdstr_s9 = ptsr7\n when 2 then thirdstr_s9 = ptsr6\n when 3 then thirdstr_s9 = ptsr5\n when 4 then thirdstr_s9 = ptsr4\n when 5 then thirdstr_s9 = ptsr3\n when 6 then thirdstr_s9 = ptsr2\n when 7 then thirdstr_s9 = ptsr1\n when 8 then thirdstr_s9 = ''\n when 9..100 then thirdstr_s9 = rtsr9\n end\n\n #thirdstr_s10\n case num_thirdst\n when 0 then thirdstr_s10 = ptsr10 \n when 1 then thirdstr_s10 = ptsr8\n when 2 then thirdstr_s10 = ptsr7\n when 3 then thirdstr_s10 = ptsr6\n when 4 then thirdstr_s10 = ptsr5\n when 5 then thirdstr_s10 = ptsr4\n when 6 then thirdstr_s10 = ptsr3\n when 7 then thirdstr_s10 = ptsr2\n when 8 then thirdstr_s10 = ptsr1\n when 9 then thirdstr_s10 = ''\n when 10..100 then thirdstr_s10 = rtsr10\n end\n\n #thirdstr_s11\n case num_thirdst\n when 0 then thirdstr_s11 = ptsr11 \n when 1 then thirdstr_s11 = ptsr9\n when 2 then thirdstr_s11 = ptsr8\n when 3 then thirdstr_s11 = ptsr7\n when 4 then thirdstr_s11 = ptsr6\n when 5 then thirdstr_s11 = ptsr5\n when 6 then thirdstr_s11 = ptsr4\n when 7 then thirdstr_s11 = ptsr3\n when 8 then thirdstr_s11 = ptsr2\n when 9 then thirdstr_s11 = ptsr1\n when 10..100 then thirdstr_s11 = rtsr11\n end \n #----------End 3rd & Short---------- \n\n #----------Redzone----------\n redzones = event.plays.where('situation9 = ?', true)\n \n runredzones = redzones.where('play_type = ?', 'Run')\n runredzonesLeft = runredzones.where('hash_mark = ?', 'Left')\n runredzonesRight = runredzones.where('hash_mark = ?', 'Right')\n \n passredzones = redzones.where('play_type = ?', 'Pass')\n passredzonesLeft = passredzones.where('hash_mark = ?', 'Left')\n passredzonesRight = passredzones.where('hash_mark = ?', 'Right')\n\n #Run Left Hash\n unless runredzonesLeft[0].nil? \n rrzl1 = runredzonesLeft[0].fullname \n end\n unless runredzonesLeft[1].nil? \n rrzl2 = runredzonesLeft[1].fullname \n end\n unless runredzonesLeft[2].nil? \n rrzl3 = runredzonesLeft[2].fullname \n end\n unless runredzonesLeft[3].nil? \n rrzl4 = runredzonesLeft[3].fullname \n end\n unless runredzonesLeft[4].nil? \n rrzl5 = runredzonesLeft[4].fullname\n end\n unless runredzonesLeft[5].nil? \n rrzl6 = runredzonesLeft[5].fullname \n end\n unless runredzonesLeft[6].nil? \n rrzl7 = runredzonesLeft[6].fullname\n end \n unless runredzonesLeft[7].nil? \n rrzl8 = runredzonesLeft[7].fullname \n end\n unless runredzonesLeft[8].nil? \n rrzl9 = runredzonesLeft[8].fullname \n end\n unless runredzonesLeft[9].nil? \n rrzl10 = runredzonesLeft[9].fullname \n end\n unless runredzonesLeft[10].nil? \n rrzl11 = runredzonesLeft[10].fullname \n end\n unless runredzonesLeft[11].nil? \n rrzl12 = runredzonesLeft[11].fullname\n end\n unless runredzonesLeft[12].nil? \n rrzl13 = runredzonesLeft[12].fullname \n end\n unless runredzonesLeft[13].nil? \n rrzl14 = runredzonesLeft[13].fullname\n end \n unless runredzonesLeft[14].nil? \n rrzl15 = runredzonesLeft[14].fullname\n end \n\n #Run Right Hash\n unless runredzonesRight[0].nil? \n rrzr1 = runredzonesRight[0].fullname \n end\n unless runredzonesRight[1].nil? \n rrzr2 = runredzonesRight[1].fullname \n end\n unless runredzonesRight[2].nil? \n rrzr3 = runredzonesRight[2].fullname \n end\n unless runredzonesRight[3].nil? \n rrzr4 = runredzonesRight[3].fullname \n end\n unless runredzonesRight[4].nil? \n rrzr5 = runredzonesRight[4].fullname\n end\n unless runredzonesRight[5].nil? \n rrzr6 = runredzonesRight[5].fullname \n end\n unless runredzonesRight[6].nil? \n rrzr7 = runredzonesRight[6].fullname\n end \n unless runredzonesRight[7].nil? \n rrzr8 = runredzonesRight[7].fullname \n end\n unless runredzonesRight[8].nil? \n rrzr9 = runredzonesRight[8].fullname \n end\n unless runredzonesRight[9].nil? \n rrzr10 = runredzonesRight[9].fullname \n end\n unless runredzonesRight[10].nil? \n rrzr11 = runredzonesRight[10].fullname \n end\n unless runredzonesRight[11].nil? \n rrzr12 = runredzonesRight[11].fullname\n end\n unless runredzonesRight[12].nil? \n rrzr13 = runredzonesRight[12].fullname \n end\n unless runredzonesRight[13].nil? \n rrzr14 = runredzonesRight[13].fullname\n end \n unless runredzonesRight[14].nil? \n rrzr15 = runredzonesRight[14].fullname\n end \n\n #Pass Left Hash\n unless passredzonesLeft[0].nil? \n przl1 = passredzonesLeft[0].fullname \n end\n unless passredzonesLeft[1].nil? \n przl2 = passredzonesLeft[1].fullname \n end\n unless passredzonesLeft[2].nil? \n przl3 = passredzonesLeft[2].fullname \n end\n unless passredzonesLeft[3].nil? \n przl4 = passredzonesLeft[3].fullname \n end\n unless passredzonesLeft[4].nil? \n przl5 = passredzonesLeft[4].fullname \n end\n unless passredzonesLeft[5].nil? \n przl6 = passredzonesLeft[5].fullname \n end \n unless passredzonesLeft[6].nil? \n przl7 = passredzonesLeft[6].fullname \n end \n unless passredzonesLeft[7].nil? \n przl8 = passredzonesLeft[7].fullname \n end\n unless passredzonesLeft[8].nil? \n przl9 = passredzonesLeft[8].fullname \n end\n unless passredzonesLeft[9].nil? \n przl10 = passredzonesLeft[9].fullname \n end\n unless passredzonesLeft[10].nil? \n przl11 = passredzonesLeft[10].fullname \n end\n unless passredzonesLeft[11].nil? \n przl12 = passredzonesLeft[11].fullname \n end\n unless passredzonesLeft[12].nil? \n przl13 = passredzonesLeft[12].fullname \n end \n unless passredzonesLeft[13].nil? \n przl14 = passredzonesLeft[13].fullname \n end \n unless passredzonesLeft[14].nil? \n przl15 = passredzonesLeft[14].fullname \n end \n\n #Pass Right Hash\n unless passredzonesRight[0].nil? \n przr1 = passredzonesRight[0].fullname \n end\n unless passredzonesRight[1].nil? \n przr2 = passredzonesRight[1].fullname \n end\n unless passredzonesRight[2].nil? \n przr3 = passredzonesRight[2].fullname \n end\n unless passredzonesRight[3].nil? \n przr4 = passredzonesRight[3].fullname \n end\n unless passredzonesRight[4].nil? \n przr5 = passredzonesRight[4].fullname \n end\n unless passredzonesRight[5].nil? \n przr6 = passredzonesRight[5].fullname \n end\n unless passredzonesRight[6].nil? \n przr7 = passredzonesRight[6].fullname \n end \n unless passredzonesRight[7].nil? \n przr8 = passredzonesRight[7].fullname \n end\n unless passredzonesRight[8].nil? \n przr9 = passredzonesRight[8].fullname \n end\n unless passredzonesRight[9].nil? \n przr10 = passredzonesRight[9].fullname \n end\n unless passredzonesRight[10].nil? \n przr11 = passredzonesRight[10].fullname \n end\n unless passredzonesRight[11].nil? \n przr12 = passredzonesRight[11].fullname \n end\n unless passredzonesRight[12].nil? \n przr13 = passredzonesRight[12].fullname \n end\n unless passredzonesRight[13].nil? \n przr14 = passredzonesRight[13].fullname \n end \n unless passredzonesRight[14].nil? \n przr15 = passredzonesRight[14].fullname \n end \n\n #Number of user's run plays in situation 9\n num_rzoner = self.user.s_name9_num_run\n\n #Left Hash\n # rzonel_s0 \n if num_rzoner > 0\n rzonel_s0 = self.user.s_name9 + ' - Run'\n else\n rzonel_s0 = self.user.s_name9 + ' - Pass'\n end\n\n #rzonel_s1 \n if num_rzoner > 0\n rzonel_s1 = rrzl1\n else\n rzonel_s1 = przl1\n end\n\n #rzonel_s2\n if num_rzoner == 0\n rzonel_s2 = przl2\n elsif num_rzoner == 1\n rzonel_s2 = self.user.s_name9 + ' - Pass'\n else num_rzoner > 1\n rzonel_s2 = rrzl2\n end\n\n #rzonel_s3\n case num_rzoner\n when 0 then rzonel_s3 = przl3 \n when 1 then rzonel_s3 = przl1\n when 2 then rzonel_s3 = self.user.s_name9 + ' - Pass'\n when 3..100 then rzonel_s3 = rrzl3\n end\n\n #rzonel_s4\n case num_rzoner\n when 0 then rzonel_s4 = przl4 \n when 1 then rzonel_s4 = przl2\n when 2 then rzonel_s4 = przl1\n when 3 then rzonel_s4 = self.user.s_name9 + ' - Pass'\n when 4..100 then rzonel_s4 = rrzl4\n end\n\n #rzonel_s5\n case num_rzoner\n when 0 then rzonel_s5 = przl5 \n when 1 then rzonel_s5 = przl3\n when 2 then rzonel_s5 = przl2\n when 3 then rzonel_s5 = przl1\n when 4 then rzonel_s5 = self.user.s_name9 + ' - Pass'\n when 5..100 then rzonel_s5 = rrzl5\n end\n\n #rzonel_s6\n case num_rzoner\n when 0 then rzonel_s6 = przl6 \n when 1 then rzonel_s6 = przl4\n when 2 then rzonel_s6 = przl3\n when 3 then rzonel_s6 = przl2\n when 4 then rzonel_s6 = przl1\n when 5 then rzonel_s6 = self.user.s_name9 + ' - Pass'\n when 6..100 then rzonel_s6 = rrzl6\n end\n\n #rzonel_s7\n case num_rzoner\n when 0 then rzonel_s7 = przl7 \n when 1 then rzonel_s7 = przl5\n when 2 then rzonel_s7 = przl4\n when 3 then rzonel_s7 = przl3\n when 4 then rzonel_s7 = przl2\n when 5 then rzonel_s7 = przl1\n when 6 then rzonel_s7 = self.user.s_name9 + ' - Pass'\n when 7..100 then rzonel_s7 = rrzl7\n end\n\n #rzonel_s8\n case num_rzoner\n when 0 then rzonel_s8 = przl8 \n when 1 then rzonel_s8 = przl6\n when 2 then rzonel_s8 = przl5\n when 3 then rzonel_s8 = przl4\n when 4 then rzonel_s8 = przl3\n when 5 then rzonel_s8 = przl2\n when 6 then rzonel_s8 = przl1\n when 7 then rzonel_s8 = self.user.s_name9 + ' - Pass'\n when 8..100 then rzonel_s8 = rrzl8\n end\n\n #rzonel_s9\n case num_rzoner\n when 0 then rzonel_s9 = przl9 \n when 1 then rzonel_s9 = przl7\n when 2 then rzonel_s9 = przl6\n when 3 then rzonel_s9 = przl5\n when 4 then rzonel_s9 = przl4\n when 5 then rzonel_s9 = przl3\n when 6 then rzonel_s9 = przl2\n when 7 then rzonel_s9 = przl1\n when 8 then rzonel_s9 = self.user.s_name9 + ' - Pass'\n when 9..100 then rzonel_s9 = rrzl9\n end\n\n #rzonel_s10\n case num_rzoner\n when 0 then rzonel_s10 = przl10 \n when 1 then rzonel_s10 = przl8\n when 2 then rzonel_s10 = przl7\n when 3 then rzonel_s10 = przl6\n when 4 then rzonel_s10 = przl5\n when 5 then rzonel_s10 = przl4\n when 6 then rzonel_s10 = przl3\n when 7 then rzonel_s10 = przl2\n when 8 then rzonel_s10 = przl1\n when 9 then rzonel_s10 = self.user.s_name9 + ' - Pass'\n when 10..100 then rzonel_s10 = rrzl10\n end\n\n #rzonel_s11\n case num_rzoner\n when 0 then rzonel_s11 = przl11 \n when 1 then rzonel_s11 = przl9\n when 2 then rzonel_s11 = przl8\n when 3 then rzonel_s11 = przl7\n when 4 then rzonel_s11 = przl6\n when 5 then rzonel_s11 = przl5\n when 6 then rzonel_s11 = przl4\n when 7 then rzonel_s11 = przl3\n when 8 then rzonel_s11 = przl2\n when 9 then rzonel_s11 = przl1\n when 10 then rzonel_s11 = self.user.s_name9 + ' - Pass'\n when 11..100 then rzonel_s11 = rrzl11\n end\n\n #rzonel_s12\n case num_rzoner\n when 0 then rzonel_s12 = przl12 \n when 1 then rzonel_s12 = przl10\n when 2 then rzonel_s12 = przl9\n when 3 then rzonel_s12 = przl8\n when 4 then rzonel_s12 = przl7\n when 5 then rzonel_s12 = przl6\n when 6 then rzonel_s12 = przl5\n when 7 then rzonel_s12 = przl4\n when 8 then rzonel_s12 = przl3\n when 9 then rzonel_s12 = przl2\n when 10 then rzonel_s12 = przl1\n when 11 then rzonel_s12 = self.user.s_name9 + ' - Pass'\n when 12..100 then rzonel_s12 = rrzl12\n end\n\n #rzonel_s13\n case num_rzoner\n when 0 then rzonel_s13 = przl13 \n when 1 then rzonel_s13 = przl11\n when 2 then rzonel_s13 = przl10\n when 3 then rzonel_s13 = przl9\n when 4 then rzonel_s13 = przl8\n when 5 then rzonel_s13 = przl7\n when 6 then rzonel_s13 = przl6\n when 7 then rzonel_s13 = przl5\n when 8 then rzonel_s13 = przl4\n when 9 then rzonel_s13 = przl3\n when 10 then rzonel_s13 = przl2\n when 11 then rzonel_s13 = przl1\n when 12 then rzonel_s13 = self.user.s_name9 + ' - Pass'\n when 13..100 then rzonel_s13 = rrzl13\n end\n\n #rzonel_s14\n case num_rzoner\n when 0 then rzonel_s14 = przl14 \n when 1 then rzonel_s14 = przl12\n when 2 then rzonel_s14 = przl11\n when 3 then rzonel_s14 = przl10\n when 4 then rzonel_s14 = przl9\n when 5 then rzonel_s14 = przl8\n when 6 then rzonel_s14 = przl7\n when 7 then rzonel_s14 = przl6\n when 8 then rzonel_s14 = przl5\n when 9 then rzonel_s14 = przl4\n when 10 then rzonel_s14 = przl3\n when 11 then rzonel_s14 = przl2\n when 12 then rzonel_s14 = przl1 \n when 13 then rzonel_s14 = self.user.s_name9 + ' - Pass'\n when 14..100 then rzonel_s14 = rrzl14\n end\n\n #rzonel_s15\n case num_rzoner\n when 0 then rzonel_s15 = przl15 \n when 1 then rzonel_s15 = przl13\n when 2 then rzonel_s15 = przl12\n when 3 then rzonel_s15 = przl11\n when 4 then rzonel_s15 = przl10\n when 5 then rzonel_s15 = przl9\n when 6 then rzonel_s15 = przl8\n when 7 then rzonel_s15 = przl7\n when 8 then rzonel_s15 = przl6\n when 9 then rzonel_s15 = przl5\n when 10 then rzonel_s15 = przl4\n when 11 then rzonel_s15 = przl3\n when 12 then rzonel_s15 = przl2\n when 13 then rzonel_s15 = przl1 \n when 14..100 then rzonel_s15 = rrzl15\n end \n\n\n #Right Hash\n # rzoner_s0 would always be blank\n\n #rzoner_s1 \n if num_rzoner > 0\n rzoner_s1 = rrzr1\n else\n rzoner_s1 = przr1\n end\n\n #rzoner_s2\n if num_rzoner == 0\n rzoner_s2 = przr2\n elsif num_rzoner == 1\n rzoner_s2 = ''\n else num_rzoner > 1\n rzoner_s2 = rrzr2\n end\n\n #rzoner_s3\n case num_rzoner\n when 0 then rzoner_s3 = przr3 \n when 1 then rzoner_s3 = przr1\n when 2 then rzoner_s3 = ''\n when 3..100 then rzoner_s3 = rrzr3\n end\n\n #rzoner_s4\n case num_rzoner\n when 0 then rzoner_s4 = przr4 \n when 1 then rzoner_s4 = przr2\n when 2 then rzoner_s4 = przr1\n when 3 then ''\n when 4..100 then rzoner_s4 = rrzr4\n end\n\n #rzoner_s5\n case num_rzoner\n when 0 then rzoner_s5 = przr5 \n when 1 then rzoner_s5 = przr3\n when 2 then rzoner_s5 = przr2\n when 3 then rzoner_s5 = przr1\n when 4 then rzoner_s5 = ''\n when 5..100 then rzoner_s5 = rrzr5\n end\n\n #rzoner_s6\n case num_rzoner\n when 0 then rzoner_s6 = przr6 \n when 1 then rzoner_s6 = przr4\n when 2 then rzoner_s6 = przr3\n when 3 then rzoner_s6 = przr2\n when 4 then rzoner_s6 = przr1\n when 5 then rzoner_s6 = ''\n when 6..100 then rzoner_s6 = rrzr6\n end\n\n #rzoner_s7\n case num_rzoner\n when 0 then rzoner_s7 = przr7 \n when 1 then rzoner_s7 = przr5\n when 2 then rzoner_s7 = przr4\n when 3 then rzoner_s7 = przr3\n when 4 then rzoner_s7 = przr2\n when 5 then rzoner_s7 = przr1\n when 6 then rzoner_s7 = ''\n when 7..100 then rzoner_s7 = rrzr7\n end\n\n #rzoner_s8\n case num_rzoner\n when 0 then rzoner_s8 = przr8 \n when 1 then rzoner_s8 = przr6\n when 2 then rzoner_s8 = przr5\n when 3 then rzoner_s8 = przr4\n when 4 then rzoner_s8 = przr3\n when 5 then rzoner_s8 = przr2\n when 6 then rzoner_s8 = przr1\n when 7 then rzoner_s8 = ''\n when 8..100 then rzoner_s8 = rrzr8\n end\n\n #rzoner_s9\n case num_rzoner\n when 0 then rzoner_s9 = przr9 \n when 1 then rzoner_s9 = przr7\n when 2 then rzoner_s9 = przr6\n when 3 then rzoner_s9 = przr5\n when 4 then rzoner_s9 = przr4\n when 5 then rzoner_s9 = przr3\n when 6 then rzoner_s9 = przr2\n when 7 then rzoner_s9 = przr1\n when 8 then rzoner_s9 = ''\n when 9..100 then rzoner_s9 = rrzr9\n end\n\n #rzoner_s10\n case num_rzoner\n when 0 then rzoner_s10 = przr10 \n when 1 then rzoner_s10 = przr8\n when 2 then rzoner_s10 = przr7\n when 3 then rzoner_s10 = przr6\n when 4 then rzoner_s10 = przr5\n when 5 then rzoner_s10 = przr4\n when 6 then rzoner_s10 = przr3\n when 7 then rzoner_s10 = przr2\n when 8 then rzoner_s10 = przr1\n when 9 then rzoner_s10 = ''\n when 10..100 then rzoner_s10 = rrzr10\n end\n\n #rzoner_s11\n case num_rzoner\n when 0 then rzoner_s11 = przr11 \n when 1 then rzoner_s11 = przr9\n when 2 then rzoner_s11 = przr8\n when 3 then rzoner_s11 = przr7\n when 4 then rzoner_s11 = przr6\n when 5 then rzoner_s11 = przr5\n when 6 then rzoner_s11 = przr4\n when 7 then rzoner_s11 = przr3\n when 8 then rzoner_s11 = przr2\n when 9 then rzoner_s11 = przr1\n when 10 then rzoner_s11 = ''\n when 11..100 then rzoner_s11 = rrzr11\n end\n\n #rzoner_s12\n case num_rzoner\n when 0 then rzoner_s12 = przr12 \n when 1 then rzoner_s12 = przr10\n when 2 then rzoner_s12 = przr9\n when 3 then rzoner_s12 = przr8\n when 4 then rzoner_s12 = przr7\n when 5 then rzoner_s12 = przr6\n when 6 then rzoner_s12 = przr5\n when 7 then rzoner_s12 = przr4\n when 8 then rzoner_s12 = przr3\n when 9 then rzoner_s12 = przr2\n when 10 then rzoner_s12 = przr1\n when 11 then rzoner_s12 = ''\n when 12..100 then rzoner_s12 = rrzr12\n end\n\n #rzoner_s13\n case num_rzoner\n when 0 then rzoner_s13 = przr13 \n when 1 then rzoner_s13 = przr11\n when 2 then rzoner_s13 = przr10\n when 3 then rzoner_s13 = przr9\n when 4 then rzoner_s13 = przr8\n when 5 then rzoner_s13 = przr7\n when 6 then rzoner_s13 = przr6\n when 7 then rzoner_s13 = przr5\n when 8 then rzoner_s13 = przr4\n when 9 then rzoner_s13 = przr3\n when 10 then rzoner_s13 = przr2\n when 11 then rzoner_s13 = przr1\n when 12 then rzoner_s13 = ''\n when 13..100 then rzoner_s13 = rrzr13\n end\n\n #rzoner_s14\n case num_rzoner\n when 0 then rzoner_s14 = przr14 \n when 1 then rzoner_s14 = przr12\n when 2 then rzoner_s14 = przr11\n when 3 then rzoner_s14 = przr10\n when 4 then rzoner_s14 = przr9\n when 5 then rzoner_s14 = przr8\n when 6 then rzoner_s14 = przr7\n when 7 then rzoner_s14 = przr6\n when 8 then rzoner_s14 = przr5\n when 9 then rzoner_s14 = przr4\n when 10 then rzoner_s14 = przr3\n when 11 then rzoner_s14 = przr2\n when 12 then rzoner_s14 = przr1 \n when 13 then rzoner_s14 = ''\n when 14..100 then rzoner_s14 = rrzr14\n end\n\n #rzoner_s15\n case num_rzoner\n when 0 then rzoner_s15 = przr15 \n when 1 then rzoner_s15 = przr13\n when 2 then rzoner_s15 = przr12\n when 3 then rzoner_s15 = przr11\n when 4 then rzoner_s15 = przr10\n when 5 then rzoner_s15 = przr9\n when 6 then rzoner_s15 = przr8\n when 7 then rzoner_s15 = przr7\n when 8 then rzoner_s15 = przr6\n when 9 then rzoner_s15 = przr5\n when 10 then rzoner_s15 = przr4\n when 11 then rzoner_s15 = przr3\n when 12 then rzoner_s15 = przr2\n when 13 then rzoner_s15 = przr1 \n when 14..100 then rzoner_s15 = rrzr15\n end\n\n #----------End Redzone---------- \n\n #----------Goal Line----------\n goalines = event.plays.where('situation10 = ?', true)\n \n rungoalines = goalines.where('play_type = ?', 'Run')\n rungoalinesLeft = rungoalines.where('hash_mark = ?', 'Left')\n rungoalinesRight = rungoalines.where('hash_mark = ?', 'Right')\n \n passgoalines = goalines.where('play_type = ?', 'Pass')\n passgoalinesLeft = passgoalines.where('hash_mark = ?', 'Left')\n passgoalinesRight = passgoalines.where('hash_mark = ?', 'Right')\n\n #Run Left Hash\n unless rungoalinesLeft[0].nil? \n rgll1 = rungoalinesLeft[0].fullname \n end\n unless rungoalinesLeft[1].nil? \n rgll2 = rungoalinesLeft[1].fullname \n end\n unless rungoalinesLeft[2].nil? \n rgll3 = rungoalinesLeft[2].fullname \n end\n unless rungoalinesLeft[3].nil? \n rgll4 = rungoalinesLeft[3].fullname \n end\n unless rungoalinesLeft[4].nil? \n rgll5 = rungoalinesLeft[4].fullname\n end\n unless rungoalinesLeft[5].nil? \n rgll6 = rungoalinesLeft[5].fullname \n end\n unless rungoalinesLeft[6].nil? \n rgll7 = rungoalinesLeft[6].fullname\n end \n unless rungoalinesLeft[7].nil? \n rgll8 = rungoalinesLeft[7].fullname \n end\n unless rungoalinesLeft[8].nil? \n rgll9 = rungoalinesLeft[8].fullname \n end\n unless rungoalinesLeft[9].nil? \n rgll10 = rungoalinesLeft[9].fullname \n end\n unless rungoalinesLeft[10].nil? \n rgll11 = rungoalinesLeft[10].fullname \n end\n unless rungoalinesLeft[11].nil? \n rgll12 = rungoalinesLeft[11].fullname\n end\n unless rungoalinesLeft[12].nil? \n rgll13 = rungoalinesLeft[12].fullname \n end\n unless rungoalinesLeft[13].nil? \n rgll14 = rungoalinesLeft[13].fullname\n end \n unless rungoalinesLeft[14].nil? \n rgll15 = rungoalinesLeft[14].fullname\n end\n\n #Run Right Hash\n unless rungoalinesRight[0].nil? \n rglr1 = rungoalinesRight[0].fullname \n end\n unless rungoalinesRight[1].nil? \n rglr2 = rungoalinesRight[1].fullname \n end\n unless rungoalinesRight[2].nil? \n rglr3 = rungoalinesRight[2].fullname \n end\n unless rungoalinesRight[3].nil? \n rglr4 = rungoalinesRight[3].fullname \n end\n unless rungoalinesRight[4].nil? \n rglr5 = rungoalinesRight[4].fullname\n end\n unless rungoalinesRight[5].nil? \n rglr6 = rungoalinesRight[5].fullname \n end\n unless rungoalinesRight[6].nil? \n rglr7 = rungoalinesRight[6].fullname\n end \n unless rungoalinesRight[7].nil? \n rglr8 = rungoalinesRight[7].fullname \n end\n unless rungoalinesRight[8].nil? \n rglr9 = rungoalinesRight[8].fullname \n end\n unless rungoalinesRight[9].nil? \n rglr10 = rungoalinesRight[9].fullname \n end\n unless rungoalinesRight[10].nil? \n rglr11 = rungoalinesRight[10].fullname \n end\n unless rungoalinesRight[11].nil? \n rglr12 = rungoalinesRight[11].fullname\n end\n unless rungoalinesRight[12].nil? \n rglr13 = rungoalinesRight[12].fullname \n end\n unless rungoalinesRight[13].nil? \n rglr14 = rungoalinesRight[13].fullname\n end \n unless rungoalinesRight[14].nil? \n rglr15 = rungoalinesRight[14].fullname\n end \n\n #Pass Left Hash\n unless passgoalinesLeft[0].nil? \n pgll1 = passgoalinesLeft[0].fullname \n end\n unless passgoalinesLeft[1].nil? \n pgll2 = passgoalinesLeft[1].fullname \n end\n unless passgoalinesLeft[2].nil? \n pgll3 = passgoalinesLeft[2].fullname \n end\n unless passgoalinesLeft[3].nil? \n pgll4 = passgoalinesLeft[3].fullname \n end\n unless passgoalinesLeft[4].nil? \n pgll5 = passgoalinesLeft[4].fullname \n end\n unless passgoalinesLeft[5].nil? \n pgll6 = passgoalinesLeft[5].fullname \n end \n unless passgoalinesLeft[6].nil? \n pgll7 = passgoalinesLeft[6].fullname \n end \n unless passgoalinesLeft[7].nil? \n pgll8 = passgoalinesLeft[7].fullname \n end\n unless passgoalinesLeft[8].nil? \n pgll9 = passgoalinesLeft[8].fullname \n end\n unless passgoalinesLeft[9].nil? \n pgll10 = passgoalinesLeft[9].fullname \n end\n unless passgoalinesLeft[10].nil? \n pgll11 = passgoalinesLeft[10].fullname \n end\n unless passgoalinesLeft[11].nil? \n pgll12 = passgoalinesLeft[11].fullname \n end\n unless passgoalinesLeft[12].nil? \n pgll13 = passgoalinesLeft[12].fullname \n end \n unless passgoalinesLeft[13].nil? \n pgll14 = passgoalinesLeft[13].fullname \n end \n unless passgoalinesLeft[14].nil? \n pgll15 = passgoalinesLeft[14].fullname \n end \n\n #Pass Right Hash\n unless passgoalinesRight[0].nil? \n pglr1 = passgoalinesRight[0].fullname \n end\n unless passgoalinesRight[1].nil? \n pglr2 = passgoalinesRight[1].fullname \n end\n unless passgoalinesRight[2].nil? \n pglr3 = passgoalinesRight[2].fullname \n end\n unless passgoalinesRight[3].nil? \n pglr4 = passgoalinesRight[3].fullname \n end\n unless passgoalinesRight[4].nil? \n pglr5 = passgoalinesRight[4].fullname \n end\n unless passgoalinesRight[5].nil? \n pglr6 = passgoalinesRight[5].fullname \n end\n unless passgoalinesRight[6].nil? \n pglr7 = passgoalinesRight[6].fullname \n end \n unless passgoalinesRight[7].nil? \n pglr8 = passgoalinesRight[7].fullname \n end\n unless passgoalinesRight[8].nil? \n pglr9 = passgoalinesRight[8].fullname \n end\n unless passgoalinesRight[9].nil? \n pglr10 = passgoalinesRight[9].fullname \n end\n unless passgoalinesRight[10].nil? \n pglr11 = passgoalinesRight[10].fullname \n end\n unless passgoalinesRight[11].nil? \n pglr12 = passgoalinesRight[11].fullname \n end\n unless passgoalinesRight[12].nil? \n pglr13 = passgoalinesRight[12].fullname \n end\n unless passgoalinesRight[13].nil? \n pglr14 = passgoalinesRight[13].fullname \n end \n unless passgoalinesRight[14].nil? \n pglr15 = passgoalinesRight[14].fullname \n end \n\n #Number of user's run plays in situation 10\n num_gliner = self.user.s_name10_num_run\n\n #Left Hash\n # glinel_s0 \n if num_gliner > 0\n glinel_s0 = self.user.s_name10 + ' - Run'\n else\n glinel_s0 = self.user.s_name10 + ' - Pass'\n end\n\n #glinel_s1 \n if num_gliner > 0\n glinel_s1 = rgll1\n else\n glinel_s1 = pgll1\n end\n\n #glinel_s2\n if num_gliner == 0\n glinel_s2 = pgll2\n elsif num_gliner == 1\n glinel_s2 = self.user.s_name10 + ' - Pass'\n else num_gliner > 1\n glinel_s2 = rgll2\n end\n\n #glinel_s3\n case num_gliner\n when 0 then glinel_s3 = pgll3 \n when 1 then glinel_s3 = pgll1\n when 2 then glinel_s3 = self.user.s_name10 + ' - Pass'\n when 3..100 then glinel_s3 = rgll3\n end\n\n #glinel_s4\n case num_gliner\n when 0 then glinel_s4 = pgll4 \n when 1 then glinel_s4 = pgll2\n when 2 then glinel_s4 = pgll1\n when 3 then glinel_s4 = self.user.s_name10 + ' - Pass'\n when 4..100 then glinel_s4 = rgll4\n end\n\n #glinel_s5\n case num_gliner\n when 0 then glinel_s5 = pgll5 \n when 1 then glinel_s5 = pgll3\n when 2 then glinel_s5 = pgll2\n when 3 then glinel_s5 = pgll1\n when 4 then glinel_s5 = self.user.s_name10 + ' - Pass'\n when 5..100 then glinel_s5 = rgll5\n end\n\n #glinel_s6\n case num_gliner\n when 0 then glinel_s6 = pgll6 \n when 1 then glinel_s6 = pgll4\n when 2 then glinel_s6 = pgll3\n when 3 then glinel_s6 = pgll2\n when 4 then glinel_s6 = pgll1\n when 5 then glinel_s6 = self.user.s_name10 + ' - Pass'\n when 6..100 then glinel_s6 = rgll6\n end\n\n #glinel_s7\n case num_gliner\n when 0 then glinel_s7 = pgll7 \n when 1 then glinel_s7 = pgll5\n when 2 then glinel_s7 = pgll4\n when 3 then glinel_s7 = pgll3\n when 4 then glinel_s7 = pgll2\n when 5 then glinel_s7 = pgll1\n when 6 then glinel_s7 = self.user.s_name10 + ' - Pass'\n when 7..100 then glinel_s7 = rgll7\n end\n\n #glinel_s8\n case num_gliner\n when 0 then glinel_s8 = pgll8 \n when 1 then glinel_s8 = pgll6\n when 2 then glinel_s8 = pgll5\n when 3 then glinel_s8 = pgll4\n when 4 then glinel_s8 = pgll3\n when 5 then glinel_s8 = pgll2\n when 6 then glinel_s8 = pgll1\n when 7 then glinel_s8 = self.user.s_name10 + ' - Pass'\n when 8..100 then glinel_s8 = rgll8\n end\n\n #glinel_s9\n case num_gliner\n when 0 then glinel_s9 = pgll9 \n when 1 then glinel_s9 = pgll7\n when 2 then glinel_s9 = pgll6\n when 3 then glinel_s9 = pgll5\n when 4 then glinel_s9 = pgll4\n when 5 then glinel_s9 = pgll3\n when 6 then glinel_s9 = pgll2\n when 7 then glinel_s9 = pgll1\n when 8 then glinel_s9 = self.user.s_name10 + ' - Pass'\n when 9..100 then glinel_s9 = rgll9\n end\n\n #glinel_s10\n case num_gliner\n when 0 then glinel_s10 = pgll10 \n when 1 then glinel_s10 = pgll8\n when 2 then glinel_s10 = pgll7\n when 3 then glinel_s10 = pgll6\n when 4 then glinel_s10 = pgll5\n when 5 then glinel_s10 = pgll4\n when 6 then glinel_s10 = pgll3\n when 7 then glinel_s10 = pgll2\n when 8 then glinel_s10 = pgll1\n when 9 then glinel_s10 = self.user.s_name10 + ' - Pass'\n when 10..100 then glinel_s10 = rgll10\n end\n\n #glinel_s11\n case num_gliner\n when 0 then glinel_s11 = pgll11 \n when 1 then glinel_s11 = pgll9\n when 2 then glinel_s11 = pgll8\n when 3 then glinel_s11 = pgll7\n when 4 then glinel_s11 = pgll6\n when 5 then glinel_s11 = pgll5\n when 6 then glinel_s11 = pgll4\n when 7 then glinel_s11 = pgll3\n when 8 then glinel_s11 = pgll2\n when 9 then glinel_s11 = pgll1\n when 10 then glinel_s11 = self.user.s_name10 + ' - Pass'\n when 11..100 then glinel_s11 = rgll11\n end\n\n #glinel_s12\n case num_gliner\n when 0 then glinel_s12 = pgll12 \n when 1 then glinel_s12 = pgll10\n when 2 then glinel_s12 = pgll9\n when 3 then glinel_s12 = pgll8\n when 4 then glinel_s12 = pgll7\n when 5 then glinel_s12 = pgll6\n when 6 then glinel_s12 = pgll5\n when 7 then glinel_s12 = pgll4\n when 8 then glinel_s12 = pgll3\n when 9 then glinel_s12 = pgll2\n when 10 then glinel_s12 = pgll1\n when 11 then glinel_s12 = self.user.s_name10 + ' - Pass'\n when 12..100 then glinel_s12 = rgll12\n end\n\n #glinel_s13\n case num_gliner\n when 0 then glinel_s13 = pgll13 \n when 1 then glinel_s13 = pgll11\n when 2 then glinel_s13 = pgll10\n when 3 then glinel_s13 = pgll9\n when 4 then glinel_s13 = pgll8\n when 5 then glinel_s13 = pgll7\n when 6 then glinel_s13 = pgll6\n when 7 then glinel_s13 = pgll5\n when 8 then glinel_s13 = pgll4\n when 9 then glinel_s13 = pgll3\n when 10 then glinel_s13 = pgll2\n when 11 then glinel_s13 = pgll1\n when 12 then glinel_s13 = self.user.s_name10 + ' - Pass'\n when 13..100 then glinel_s13 = rgll13\n end\n\n #glinel_s14\n case num_gliner\n when 0 then glinel_s14 = pgll14 \n when 1 then glinel_s14 = pgll12\n when 2 then glinel_s14 = pgll11\n when 3 then glinel_s14 = pgll10\n when 4 then glinel_s14 = pgll9\n when 5 then glinel_s14 = pgll8\n when 6 then glinel_s14 = pgll7\n when 7 then glinel_s14 = pgll6\n when 8 then glinel_s14 = pgll5\n when 9 then glinel_s14 = pgll4\n when 10 then glinel_s14 = pgll3\n when 11 then glinel_s14 = pgll2\n when 12 then glinel_s14 = pgll1 \n when 13 then glinel_s14 = self.user.s_name10 + ' - Pass'\n when 14..100 then glinel_s14 = rgll14\n end\n\n #glinel_s15\n case num_gliner\n when 0 then glinel_s15 = pgll15 \n when 1 then glinel_s15 = pgll13\n when 2 then glinel_s15 = pgll12\n when 3 then glinel_s15 = pgll11\n when 4 then glinel_s15 = pgll10\n when 5 then glinel_s15 = pgll9\n when 6 then glinel_s15 = pgll8\n when 7 then glinel_s15 = pgll7\n when 8 then glinel_s15 = pgll6\n when 9 then glinel_s15 = pgll5\n when 10 then glinel_s15 = pgll4\n when 11 then glinel_s15 = pgll3\n when 12 then glinel_s15 = pgll2\n when 13 then glinel_s15 = pgll1 \n when 14..100 then glinel_s15 = rgll15\n end \n\n\n #Right Hash\n # gliner_s0 would always be blank\n\n #gliner_s1 \n if num_gliner > 0\n gliner_s1 = rglr1\n else\n gliner_s1 = pglr1\n end\n\n #gliner_s2\n if num_gliner == 0\n gliner_s2 = pglr2\n elsif num_gliner == 1\n gliner_s2 = ''\n else num_gliner > 1\n gliner_s2 = rglr2\n end\n\n #gliner_s3\n case num_gliner\n when 0 then gliner_s3 = pglr3 \n when 1 then gliner_s3 = pglr1\n when 2 then gliner_s3 = ''\n when 3..100 then gliner_s3 = rglr3\n end\n\n #gliner_s4\n case num_gliner\n when 0 then gliner_s4 = pglr4 \n when 1 then gliner_s4 = pglr2\n when 2 then gliner_s4 = pglr1\n when 3 then ''\n when 4..100 then gliner_s4 = rglr4\n end\n\n #gliner_s5\n case num_gliner\n when 0 then gliner_s5 = pglr5 \n when 1 then gliner_s5 = pglr3\n when 2 then gliner_s5 = pglr2\n when 3 then gliner_s5 = pglr1\n when 4 then gliner_s5 = ''\n when 5..100 then gliner_s5 = rglr5\n end\n\n #gliner_s6\n case num_gliner\n when 0 then gliner_s6 = pglr6 \n when 1 then gliner_s6 = pglr4\n when 2 then gliner_s6 = pglr3\n when 3 then gliner_s6 = pglr2\n when 4 then gliner_s6 = pglr1\n when 5 then gliner_s6 = ''\n when 6..100 then gliner_s6 = rglr6\n end\n\n #gliner_s7\n case num_gliner\n when 0 then gliner_s7 = pglr7 \n when 1 then gliner_s7 = pglr5\n when 2 then gliner_s7 = pglr4\n when 3 then gliner_s7 = pglr3\n when 4 then gliner_s7 = pglr2\n when 5 then gliner_s7 = pglr1\n when 6 then gliner_s7 = ''\n when 7..100 then gliner_s7 = rglr7\n end\n\n #gliner_s8\n case num_gliner\n when 0 then gliner_s8 = pglr8 \n when 1 then gliner_s8 = pglr6\n when 2 then gliner_s8 = pglr5\n when 3 then gliner_s8 = pglr4\n when 4 then gliner_s8 = pglr3\n when 5 then gliner_s8 = pglr2\n when 6 then gliner_s8 = pglr1\n when 7 then gliner_s8 = ''\n when 8..100 then gliner_s8 = rglr8\n end\n\n #gliner_s9\n case num_gliner\n when 0 then gliner_s9 = pglr9 \n when 1 then gliner_s9 = pglr7\n when 2 then gliner_s9 = pglr6\n when 3 then gliner_s9 = pglr5\n when 4 then gliner_s9 = pglr4\n when 5 then gliner_s9 = pglr3\n when 6 then gliner_s9 = pglr2\n when 7 then gliner_s9 = pglr1\n when 8 then gliner_s9 = ''\n when 9..100 then gliner_s9 = rglr9\n end\n\n #gliner_s10\n case num_gliner\n when 0 then gliner_s10 = pglr10 \n when 1 then gliner_s10 = pglr8\n when 2 then gliner_s10 = pglr7\n when 3 then gliner_s10 = pglr6\n when 4 then gliner_s10 = pglr5\n when 5 then gliner_s10 = pglr4\n when 6 then gliner_s10 = pglr3\n when 7 then gliner_s10 = pglr2\n when 8 then gliner_s10 = pglr1\n when 9 then gliner_s10 = ''\n when 10..100 then gliner_s10 = rglr10\n end\n\n #gliner_s11\n case num_gliner\n when 0 then gliner_s11 = pglr11 \n when 1 then gliner_s11 = pglr9\n when 2 then gliner_s11 = pglr8\n when 3 then gliner_s11 = pglr7\n when 4 then gliner_s11 = pglr6\n when 5 then gliner_s11 = pglr5\n when 6 then gliner_s11 = pglr4\n when 7 then gliner_s11 = pglr3\n when 8 then gliner_s11 = pglr2\n when 9 then gliner_s11 = pglr1\n when 10 then gliner_s11 = ''\n when 11..100 then gliner_s11 = rglr11\n end\n\n #gliner_s12\n case num_gliner\n when 0 then gliner_s12 = pglr12 \n when 1 then gliner_s12 = pglr10\n when 2 then gliner_s12 = pglr9\n when 3 then gliner_s12 = pglr8\n when 4 then gliner_s12 = pglr7\n when 5 then gliner_s12 = pglr6\n when 6 then gliner_s12 = pglr5\n when 7 then gliner_s12 = pglr4\n when 8 then gliner_s12 = pglr3\n when 9 then gliner_s12 = pglr2\n when 10 then gliner_s12 = pglr1\n when 11 then gliner_s12 = ''\n when 12..100 then gliner_s12 = rglr12\n end\n\n #gliner_s13\n case num_gliner\n when 0 then gliner_s13 = pglr13 \n when 1 then gliner_s13 = pglr11\n when 2 then gliner_s13 = pglr10\n when 3 then gliner_s13 = pglr9\n when 4 then gliner_s13 = pglr8\n when 5 then gliner_s13 = pglr7\n when 6 then gliner_s13 = pglr6\n when 7 then gliner_s13 = pglr5\n when 8 then gliner_s13 = pglr4\n when 9 then gliner_s13 = pglr3\n when 10 then gliner_s13 = pglr2\n when 11 then gliner_s13 = pglr1\n when 12 then gliner_s13 = ''\n when 13..100 then gliner_s13 = rglr13\n end\n\n #gliner_s14\n case num_gliner\n when 0 then gliner_s14 = pglr14 \n when 1 then gliner_s14 = pglr12\n when 2 then gliner_s14 = pglr11\n when 3 then gliner_s14 = pglr10\n when 4 then gliner_s14 = pglr9\n when 5 then gliner_s14 = pglr8\n when 6 then gliner_s14 = pglr7\n when 7 then gliner_s14 = pglr6\n when 8 then gliner_s14 = pglr5\n when 9 then gliner_s14 = pglr4\n when 10 then gliner_s14 = pglr3\n when 11 then gliner_s14 = pglr2\n when 12 then gliner_s14 = pglr1 \n when 13 then gliner_s14 = ''\n when 14..100 then gliner_s14 = rglr14\n end\n\n #gliner_s15\n case num_gliner\n when 0 then gliner_s15 = pglr15 \n when 1 then gliner_s15 = pglr13\n when 2 then gliner_s15 = pglr12\n when 3 then gliner_s15 = pglr11\n when 4 then gliner_s15 = pglr10\n when 5 then gliner_s15 = pglr9\n when 6 then gliner_s15 = pglr8\n when 7 then gliner_s15 = pglr7\n when 8 then gliner_s15 = pglr6\n when 9 then gliner_s15 = pglr5\n when 10 then gliner_s15 = pglr4\n when 11 then gliner_s15 = pglr3\n when 12 then gliner_s15 = pglr2\n when 13 then gliner_s15 = pglr1 \n when 14..100 then gliner_s15 = rglr15\n end \n #----------End Goaline---------- \n\n #----------Coming Out----------\n comingOuts = event.plays.where('situation11 = ?', true)\n \n runComingOuts = comingOuts.where('play_type = ?', 'Run')\n runComingOutsLeft = runComingOuts.where('hash_mark = ?', 'Left')\n runComingOutsRight = runComingOuts.where('hash_mark = ?', 'Right')\n \n passComingOuts = comingOuts.where('play_type = ?', 'Pass')\n passComingOutsLeft = passComingOuts.where('hash_mark = ?', 'Left')\n passComingOutsRight = passComingOuts.where('hash_mark = ?', 'Right')\n\n #Run Left Hash\n unless runComingOutsLeft[0].nil? \n rcol1 = runComingOutsLeft[0].fullname \n end\n unless runComingOutsLeft[1].nil? \n rcol2 = runComingOutsLeft[1].fullname \n end\n unless runComingOutsLeft[2].nil? \n rcol3 = runComingOutsLeft[2].fullname \n end\n unless runComingOutsLeft[3].nil? \n rcol4 = runComingOutsLeft[3].fullname \n end\n unless runComingOutsLeft[4].nil? \n rcol5 = runComingOutsLeft[4].fullname\n end\n unless runComingOutsLeft[5].nil? \n rcol6 = runComingOutsLeft[5].fullname \n end\n unless runComingOutsLeft[6].nil? \n rcol7 = runComingOutsLeft[6].fullname\n end \n unless runComingOutsLeft[7].nil? \n rcol8 = runComingOutsLeft[7].fullname \n end\n unless runComingOutsLeft[8].nil? \n rcol9 = runComingOutsLeft[8].fullname \n end\n unless runComingOutsLeft[9].nil? \n rcol10 = runComingOutsLeft[9].fullname \n end\n unless runComingOutsLeft[10].nil? \n rcol11 = runComingOutsLeft[10].fullname \n end\n unless runComingOutsLeft[11].nil? \n rcol12 = runComingOutsLeft[11].fullname\n end\n unless runComingOutsLeft[12].nil? \n rcol13 = runComingOutsLeft[12].fullname \n end\n unless runComingOutsLeft[13].nil? \n rcol14 = runComingOutsLeft[13].fullname\n end \n unless runComingOutsLeft[14].nil? \n rcol15 = runComingOutsLeft[14].fullname\n end \n\n #Run Right Hash\n unless runComingOutsRight[0].nil? \n rcor1 = runComingOutsRight[0].fullname \n end\n unless runComingOutsRight[1].nil? \n rcor2 = runComingOutsRight[1].fullname \n end\n unless runComingOutsRight[2].nil? \n rcor3 = runComingOutsRight[2].fullname \n end\n unless runComingOutsRight[3].nil? \n rcor4 = runComingOutsRight[3].fullname \n end\n unless runComingOutsRight[4].nil? \n rcor5 = runComingOutsRight[4].fullname\n end\n unless runComingOutsRight[5].nil? \n rcor6 = runComingOutsRight[5].fullname \n end\n unless runComingOutsRight[6].nil? \n rcor7 = runComingOutsRight[6].fullname\n end \n unless runComingOutsRight[7].nil? \n rcor8 = runComingOutsRight[7].fullname \n end\n unless runComingOutsRight[8].nil? \n rcor9 = runComingOutsRight[8].fullname \n end\n unless runComingOutsRight[9].nil? \n rcor10 = runComingOutsRight[9].fullname \n end\n unless runComingOutsRight[10].nil? \n rcor11 = runComingOutsRight[10].fullname \n end\n unless runComingOutsRight[11].nil? \n rcor12 = runComingOutsRight[11].fullname\n end\n unless runComingOutsRight[12].nil? \n rcor13 = runComingOutsRight[12].fullname \n end\n unless runComingOutsRight[13].nil? \n rcor14 = runComingOutsRight[13].fullname\n end\n unless runComingOutsRight[14].nil? \n rcor15 = runComingOutsRight[14].fullname\n end\n\n #Pass Left Hash\n unless passComingOutsLeft[0].nil? \n pcol1 = passComingOutsLeft[0].fullname \n end\n unless passComingOutsLeft[1].nil? \n pcol2 = passComingOutsLeft[1].fullname \n end\n unless passComingOutsLeft[2].nil? \n pcol3 = passComingOutsLeft[2].fullname \n end\n unless passComingOutsLeft[3].nil? \n pcol4 = passComingOutsLeft[3].fullname \n end\n unless passComingOutsLeft[4].nil? \n pcol5 = passComingOutsLeft[4].fullname \n end\n unless passComingOutsLeft[5].nil? \n pcol6 = passComingOutsLeft[5].fullname \n end \n unless passComingOutsLeft[6].nil? \n pcol7 = passComingOutsLeft[6].fullname \n end \n unless passComingOutsLeft[7].nil? \n pcol8 = passComingOutsLeft[7].fullname \n end\n unless passComingOutsLeft[8].nil? \n pcol9 = passComingOutsLeft[8].fullname \n end\n unless passComingOutsLeft[9].nil? \n pcol10 = passComingOutsLeft[9].fullname \n end\n unless passComingOutsLeft[10].nil? \n pcol11 = passComingOutsLeft[10].fullname \n end\n unless passComingOutsLeft[11].nil? \n pcol12 = passComingOutsLeft[11].fullname \n end\n unless passComingOutsLeft[12].nil? \n pcol13 = passComingOutsLeft[12].fullname \n end \n unless passComingOutsLeft[13].nil? \n pcol14 = passComingOutsLeft[13].fullname \n end\n unless passComingOutsLeft[14].nil? \n pcol15 = passComingOutsLeft[14].fullname \n end\n\n #Pass Right Hash\n unless passComingOutsRight[0].nil? \n pcor1 = passComingOutsRight[0].fullname \n end\n unless passComingOutsRight[1].nil? \n pcor2 = passComingOutsRight[1].fullname \n end\n unless passComingOutsRight[2].nil? \n pcor3 = passComingOutsRight[2].fullname \n end\n unless passComingOutsRight[3].nil? \n pcor4 = passComingOutsRight[3].fullname \n end\n unless passComingOutsRight[4].nil? \n pcor5 = passComingOutsRight[4].fullname \n end\n unless passComingOutsRight[5].nil? \n pcor6 = passComingOutsRight[5].fullname \n end\n unless passComingOutsRight[6].nil? \n pcor7 = passComingOutsRight[6].fullname \n end \n unless passComingOutsRight[7].nil? \n pcor8 = passComingOutsRight[7].fullname \n end\n unless passComingOutsRight[8].nil? \n pcor9 = passComingOutsRight[8].fullname \n end\n unless passComingOutsRight[9].nil? \n pcor10 = passComingOutsRight[9].fullname \n end\n unless passComingOutsRight[10].nil? \n pcor11 = passComingOutsRight[10].fullname \n end\n unless passComingOutsRight[11].nil? \n pcor12 = passComingOutsRight[11].fullname \n end\n unless passComingOutsRight[12].nil? \n pcor13 = passComingOutsRight[12].fullname \n end\n unless passComingOutsRight[13].nil? \n pcor14 = passComingOutsRight[13].fullname \n end \n unless passComingOutsRight[14].nil? \n pcor15 = passComingOutsRight[14].fullname \n end \n\n #Number of user's run plays in situation 11\n num_cor = self.user.s_name11_num_run\n\n #Left Hash\n # coutl_s0 \n if num_cor > 0\n coutl_s0 = self.user.s_name11 + ' - Run'\n else\n coutl_s0 = self.user.s_name11 + ' - Pass'\n end\n\n #coutl_s1 \n if num_cor > 0\n coutl_s1 = rcol1\n else\n coutl_s1 = pcol1\n end\n\n #coutl_s2\n if num_cor == 0\n coutl_s2 = pcol2\n elsif num_cor == 1\n coutl_s2 = self.user.s_name11 + ' - Pass'\n else num_cor > 1\n coutl_s2 = rcol2\n end\n\n #coutl_s3\n case num_cor\n when 0 then coutl_s3 = pcol3 \n when 1 then coutl_s3 = pcol1\n when 2 then coutl_s3 = self.user.s_name11 + ' - Pass'\n when 3..100 then coutl_s3 = rcol3\n end\n\n #coutl_s4\n case num_cor\n when 0 then coutl_s4 = pcol4 \n when 1 then coutl_s4 = pcol2\n when 2 then coutl_s4 = pcol1\n when 3 then coutl_s4 = self.user.s_name11 + ' - Pass'\n when 4..100 then coutl_s4 = rcol4\n end\n\n #coutl_s5\n case num_cor\n when 0 then coutl_s5 = pcol5 \n when 1 then coutl_s5 = pcol3\n when 2 then coutl_s5 = pcol2\n when 3 then coutl_s5 = pcol1\n when 4 then coutl_s5 = self.user.s_name11 + ' - Pass'\n when 5..100 then coutl_s5 = rcol5\n end\n\n #coutl_s6\n case num_cor\n when 0 then coutl_s6 = pcol6 \n when 1 then coutl_s6 = pcol4\n when 2 then coutl_s6 = pcol3\n when 3 then coutl_s6 = pcol2\n when 4 then coutl_s6 = pcol1\n when 5 then coutl_s6 = self.user.s_name11 + ' - Pass'\n when 6..100 then coutl_s6 = rcol6\n end\n\n #coutl_s7\n case num_cor\n when 0 then coutl_s7 = pcol7 \n when 1 then coutl_s7 = pcol5\n when 2 then coutl_s7 = pcol4\n when 3 then coutl_s7 = pcol3\n when 4 then coutl_s7 = pcol2\n when 5 then coutl_s7 = pcol1\n when 6 then coutl_s7 = self.user.s_name11 + ' - Pass'\n when 7..100 then coutl_s7 = rcol7\n end\n\n #coutl_s8\n case num_cor\n when 0 then coutl_s8 = pcol8 \n when 1 then coutl_s8 = pcol6\n when 2 then coutl_s8 = pcol5\n when 3 then coutl_s8 = pcol4\n when 4 then coutl_s8 = pcol3\n when 5 then coutl_s8 = pcol2\n when 6 then coutl_s8 = pcol1\n when 7 then coutl_s8 = self.user.s_name11 + ' - Pass'\n when 8..100 then coutl_s8 = rcol8\n end\n\n #coutl_s9\n case num_cor\n when 0 then coutl_s9 = pcol9 \n when 1 then coutl_s9 = pcol7\n when 2 then coutl_s9 = pcol6\n when 3 then coutl_s9 = pcol5\n when 4 then coutl_s9 = pcol4\n when 5 then coutl_s9 = pcol3\n when 6 then coutl_s9 = pcol2\n when 7 then coutl_s9 = pcol1\n when 8 then coutl_s9 = self.user.s_name11 + ' - Pass'\n when 9..100 then coutl_s9 = rcol9\n end\n\n #coutl_s10\n case num_cor\n when 0 then coutl_s10 = pcol10 \n when 1 then coutl_s10 = pcol8\n when 2 then coutl_s10 = pcol7\n when 3 then coutl_s10 = pcol6\n when 4 then coutl_s10 = pcol5\n when 5 then coutl_s10 = pcol4\n when 6 then coutl_s10 = pcol3\n when 7 then coutl_s10 = pcol2\n when 8 then coutl_s10 = pcol1\n when 9 then coutl_s10 = self.user.s_name11 + ' - Pass'\n when 10..100 then coutl_s10 = rcol10\n end\n\n #coutl_s11\n case num_cor\n when 0 then coutl_s11 = pcol11 \n when 1 then coutl_s11 = pcol9\n when 2 then coutl_s11 = pcol8\n when 3 then coutl_s11 = pcol7\n when 4 then coutl_s11 = pcol6\n when 5 then coutl_s11 = pcol5\n when 6 then coutl_s11 = pcol4\n when 7 then coutl_s11 = pcol3\n when 8 then coutl_s11 = pcol2\n when 9 then coutl_s11 = pcol1\n when 10 then coutl_s11 = self.user.s_name11 + ' - Pass'\n when 11..100 then coutl_s11 = rcol11\n end\n\n #coutl_s12\n case num_cor\n when 0 then coutl_s12 = pcol12 \n when 1 then coutl_s12 = pcol10\n when 2 then coutl_s12 = pcol9\n when 3 then coutl_s12 = pcol8\n when 4 then coutl_s12 = pcol7\n when 5 then coutl_s12 = pcol6\n when 6 then coutl_s12 = pcol5\n when 7 then coutl_s12 = pcol4\n when 8 then coutl_s12 = pcol3\n when 9 then coutl_s12 = pcol2\n when 10 then coutl_s12 = pcol1\n when 11 then coutl_s12 = self.user.s_name11 + ' - Pass'\n when 12..100 then coutl_s12 = rcol12\n end\n\n #coutl_s13\n case num_cor\n when 0 then coutl_s13 = pcol13 \n when 1 then coutl_s13 = pcol11\n when 2 then coutl_s13 = pcol10\n when 3 then coutl_s13 = pcol9\n when 4 then coutl_s13 = pcol8\n when 5 then coutl_s13 = pcol7\n when 6 then coutl_s13 = pcol6\n when 7 then coutl_s13 = pcol5\n when 8 then coutl_s13 = pcol4\n when 9 then coutl_s13 = pcol3\n when 10 then coutl_s13 = pcol2\n when 11 then coutl_s13 = pcol1\n when 12 then coutl_s13 = self.user.s_name11 + ' - Pass'\n when 13..100 then coutl_s13 = rcol13\n end\n\n #coutl_s14\n case num_cor\n when 0 then coutl_s14 = pcol14 \n when 1 then coutl_s14 = pcol12\n when 2 then coutl_s14 = pcol11\n when 3 then coutl_s14 = pcol10\n when 4 then coutl_s14 = pcol9\n when 5 then coutl_s14 = pcol8\n when 6 then coutl_s14 = pcol7\n when 7 then coutl_s14 = pcol6\n when 8 then coutl_s14 = pcol5\n when 9 then coutl_s14 = pcol4\n when 10 then coutl_s14 = pcol3\n when 11 then coutl_s14 = pcol2\n when 12 then coutl_s14 = pcol1 \n when 13 then coutl_s14 = self.user.s_name11 + ' - Pass'\n when 14..100 then coutl_s14 = rcol14\n end\n\n #coutl_s15\n case num_cor\n when 0 then coutl_s15 = pcol15 \n when 1 then coutl_s15 = pcol13\n when 2 then coutl_s15 = pcol12\n when 3 then coutl_s15 = pcol11\n when 4 then coutl_s15 = pcol10\n when 5 then coutl_s15 = pcol9\n when 6 then coutl_s15 = pcol8\n when 7 then coutl_s15 = pcol7\n when 8 then coutl_s15 = pcol6\n when 9 then coutl_s15 = pcol5\n when 10 then coutl_s15 = pcol4\n when 11 then coutl_s15 = pcol3\n when 12 then coutl_s15 = pcol2\n when 13 then coutl_s15 = pcol1 \n when 14..100 then coutl_s15 = rcol15\n end \n\n\n #Right Hash\n # coutr_s0 would always be blank\n\n #coutr_s1 \n if num_cor > 0\n coutr_s1 = rcor1\n else\n coutr_s1 = pcor1\n end\n\n #coutr_s2\n if num_cor == 0\n coutr_s2 = pcor2\n elsif num_cor == 1\n coutr_s2 = ''\n else num_cor > 1\n coutr_s2 = rcor2\n end\n\n #coutr_s3\n case num_cor\n when 0 then coutr_s3 = pcor3 \n when 1 then coutr_s3 = pcor1\n when 2 then coutr_s3 = ''\n when 3..100 then coutr_s3 = rcor3\n end\n\n #coutr_s4\n case num_cor\n when 0 then coutr_s4 = pcor4 \n when 1 then coutr_s4 = pcor2\n when 2 then coutr_s4 = pcor1\n when 3 then ''\n when 4..100 then coutr_s4 = rcor4\n end\n\n #coutr_s5\n case num_cor\n when 0 then coutr_s5 = pcor5 \n when 1 then coutr_s5 = pcor3\n when 2 then coutr_s5 = pcor2\n when 3 then coutr_s5 = pcor1\n when 4 then coutr_s5 = ''\n when 5..100 then coutr_s5 = rcor5\n end\n\n #coutr_s6\n case num_cor\n when 0 then coutr_s6 = pcor6 \n when 1 then coutr_s6 = pcor4\n when 2 then coutr_s6 = pcor3\n when 3 then coutr_s6 = pcor2\n when 4 then coutr_s6 = pcor1\n when 5 then coutr_s6 = ''\n when 6..100 then coutr_s6 = rcor6\n end\n\n #coutr_s7\n case num_cor\n when 0 then coutr_s7 = pcor7 \n when 1 then coutr_s7 = pcor5\n when 2 then coutr_s7 = pcor4\n when 3 then coutr_s7 = pcor3\n when 4 then coutr_s7 = pcor2\n when 5 then coutr_s7 = pcor1\n when 6 then coutr_s7 = ''\n when 7..100 then coutr_s7 = rcor7\n end\n\n #coutr_s8\n case num_cor\n when 0 then coutr_s8 = pcor8 \n when 1 then coutr_s8 = pcor6\n when 2 then coutr_s8 = pcor5\n when 3 then coutr_s8 = pcor4\n when 4 then coutr_s8 = pcor3\n when 5 then coutr_s8 = pcor2\n when 6 then coutr_s8 = pcor1\n when 7 then coutr_s8 = ''\n when 8..100 then coutr_s8 = rcor8\n end\n\n #coutr_s9\n case num_cor\n when 0 then coutr_s9 = pcor9 \n when 1 then coutr_s9 = pcor7\n when 2 then coutr_s9 = pcor6\n when 3 then coutr_s9 = pcor5\n when 4 then coutr_s9 = pcor4\n when 5 then coutr_s9 = pcor3\n when 6 then coutr_s9 = pcor2\n when 7 then coutr_s9 = pcor1\n when 8 then coutr_s9 = ''\n when 9..100 then coutr_s9 = rcor9\n end\n\n #coutr_s10\n case num_cor\n when 0 then coutr_s10 = pcor10 \n when 1 then coutr_s10 = pcor8\n when 2 then coutr_s10 = pcor7\n when 3 then coutr_s10 = pcor6\n when 4 then coutr_s10 = pcor5\n when 5 then coutr_s10 = pcor4\n when 6 then coutr_s10 = pcor3\n when 7 then coutr_s10 = pcor2\n when 8 then coutr_s10 = pcor1\n when 9 then coutr_s10 = ''\n when 10..100 then coutr_s10 = rcor10\n end\n\n #coutr_s11\n case num_cor\n when 0 then coutr_s11 = pcor11 \n when 1 then coutr_s11 = pcor9\n when 2 then coutr_s11 = pcor8\n when 3 then coutr_s11 = pcor7\n when 4 then coutr_s11 = pcor6\n when 5 then coutr_s11 = pcor5\n when 6 then coutr_s11 = pcor4\n when 7 then coutr_s11 = pcor3\n when 8 then coutr_s11 = pcor2\n when 9 then coutr_s11 = pcor1\n when 10 then coutr_s11 = ''\n when 11..100 then coutr_s11 = rcor11\n end\n\n #coutr_s12\n case num_cor\n when 0 then coutr_s12 = pcor12 \n when 1 then coutr_s12 = pcor10\n when 2 then coutr_s12 = pcor9\n when 3 then coutr_s12 = pcor8\n when 4 then coutr_s12 = pcor7\n when 5 then coutr_s12 = pcor6\n when 6 then coutr_s12 = pcor5\n when 7 then coutr_s12 = pcor4\n when 8 then coutr_s12 = pcor3\n when 9 then coutr_s12 = pcor2\n when 10 then coutr_s12 = pcor1\n when 11 then coutr_s12 = ''\n when 12..100 then coutr_s12 = rcor12\n end\n\n #coutr_s13\n case num_cor\n when 0 then coutr_s13 = pcor13 \n when 1 then coutr_s13 = pcor11\n when 2 then coutr_s13 = pcor10\n when 3 then coutr_s13 = pcor9\n when 4 then coutr_s13 = pcor8\n when 5 then coutr_s13 = pcor7\n when 6 then coutr_s13 = pcor6\n when 7 then coutr_s13 = pcor5\n when 8 then coutr_s13 = pcor4\n when 9 then coutr_s13 = pcor3\n when 10 then coutr_s13 = pcor2\n when 11 then coutr_s13 = pcor1\n when 12 then coutr_s13 = ''\n when 13..100 then coutr_s13 = rcor13\n end\n\n #coutr_s14\n case num_cor\n when 0 then coutr_s14 = pcor14 \n when 1 then coutr_s14 = pcor12\n when 2 then coutr_s14 = pcor11\n when 3 then coutr_s14 = pcor10\n when 4 then coutr_s14 = pcor9\n when 5 then coutr_s14 = pcor8\n when 6 then coutr_s14 = pcor7\n when 7 then coutr_s14 = pcor6\n when 8 then coutr_s14 = pcor5\n when 9 then coutr_s14 = pcor4\n when 10 then coutr_s14 = pcor3\n when 11 then coutr_s14 = pcor2\n when 12 then coutr_s14 = pcor1 \n when 13 then coutr_s14 = ''\n when 14..100 then coutr_s14 = rcor14\n end\n\n #coutr_s15\n case num_cor\n when 0 then coutr_s15 = pcor15 \n when 1 then coutr_s15 = pcor13\n when 2 then coutr_s15 = pcor12\n when 3 then coutr_s15 = pcor11\n when 4 then coutr_s15 = pcor10\n when 5 then coutr_s15 = pcor9\n when 6 then coutr_s15 = pcor8\n when 7 then coutr_s15 = pcor7\n when 8 then coutr_s15 = pcor6\n when 9 then coutr_s15 = pcor5\n when 10 then coutr_s15 = pcor4\n when 11 then coutr_s15 = pcor3\n when 12 then coutr_s15 = pcor2\n when 13 then coutr_s15 = pcor1 \n when 14..100 then coutr_s15 = rcor15\n end \n #----------End Coming Out---------- \n\n #----------Custom 1----------\n customOnes = event.plays.where('situation12 = ?', true)\n \n runCustomOnes = customOnes.where('play_type = ?', 'Run')\n runCustomOnesLeft = runCustomOnes.where('hash_mark = ?', 'Left')\n runCustomOnesRight = runCustomOnes.where('hash_mark = ?', 'Right')\n \n passCustomOnes = customOnes.where('play_type = ?', 'Pass')\n passCustomOnesLeft = passCustomOnes.where('hash_mark = ?', 'Left')\n passCustomOnesRight = passCustomOnes.where('hash_mark = ?', 'Right')\n\n #Run Left Hash\n unless runCustomOnesLeft[0].nil? \n rcuol1 = runCustomOnesLeft[0].fullname \n end\n unless runCustomOnesLeft[1].nil? \n rcuol2 = runCustomOnesLeft[1].fullname \n end\n unless runCustomOnesLeft[2].nil? \n rcuol3 = runCustomOnesLeft[2].fullname \n end\n unless runCustomOnesLeft[3].nil? \n rcuol4 = runCustomOnesLeft[3].fullname \n end\n unless runCustomOnesLeft[4].nil? \n rcuol5 = runCustomOnesLeft[4].fullname\n end\n unless runCustomOnesLeft[5].nil? \n rcuol6 = runCustomOnesLeft[5].fullname \n end\n unless runCustomOnesLeft[6].nil? \n rcuol7 = runCustomOnesLeft[6].fullname\n end \n unless runCustomOnesLeft[7].nil? \n rcuol8 = runCustomOnesLeft[7].fullname \n end\n unless runCustomOnesLeft[8].nil? \n rcuol9 = runCustomOnesLeft[8].fullname \n end\n unless runCustomOnesLeft[9].nil? \n rcuol10 = runCustomOnesLeft[9].fullname \n end\n unless runCustomOnesLeft[10].nil? \n rcuol11 = runCustomOnesLeft[10].fullname \n end\n unless runCustomOnesLeft[11].nil? \n rcuol12 = runCustomOnesLeft[11].fullname\n end\n unless runCustomOnesLeft[12].nil? \n rcuol13 = runCustomOnesLeft[12].fullname \n end\n unless runCustomOnesLeft[13].nil? \n rcuol14 = runCustomOnesLeft[13].fullname\n end \n unless runCustomOnesLeft[14].nil? \n rcuol15 = runCustomOnesLeft[14].fullname\n end \n\n #Run Right Hash\n unless runCustomOnesRight[0].nil? \n rcuor1 = runCustomOnesRight[0].fullname \n end\n unless runCustomOnesRight[1].nil? \n rcuor2 = runCustomOnesRight[1].fullname \n end\n unless runCustomOnesRight[2].nil? \n rcuor3 = runCustomOnesRight[2].fullname \n end\n unless runCustomOnesRight[3].nil? \n rcuor4 = runCustomOnesRight[3].fullname \n end\n unless runCustomOnesRight[4].nil? \n rcuor5 = runCustomOnesRight[4].fullname\n end\n unless runCustomOnesRight[5].nil? \n rcuor6 = runCustomOnesRight[5].fullname \n end\n unless runCustomOnesRight[6].nil? \n rcuor7 = runCustomOnesRight[6].fullname\n end \n unless runCustomOnesRight[7].nil? \n rcuor8 = runCustomOnesRight[7].fullname \n end\n unless runCustomOnesRight[8].nil? \n rcuor9 = runCustomOnesRight[8].fullname \n end\n unless runCustomOnesRight[9].nil? \n rcuor10 = runCustomOnesRight[9].fullname \n end\n unless runCustomOnesRight[10].nil? \n rcuor11 = runCustomOnesRight[10].fullname \n end\n unless runCustomOnesRight[11].nil? \n rcuor12 = runCustomOnesRight[11].fullname\n end\n unless runCustomOnesRight[12].nil? \n rcuor13 = runCustomOnesRight[12].fullname \n end\n unless runCustomOnesRight[13].nil? \n rcuor14 = runCustomOnesRight[13].fullname\n end \n unless runCustomOnesRight[14].nil? \n rcuor15 = runCustomOnesRight[14].fullname\n end \n\n #Pass Left Hash\n unless passCustomOnesLeft[0].nil? \n pcuol1 = passCustomOnesLeft[0].fullname \n end\n unless passCustomOnesLeft[1].nil? \n pcuol2 = passCustomOnesLeft[1].fullname \n end\n unless passCustomOnesLeft[2].nil? \n pcuol3 = passCustomOnesLeft[2].fullname \n end\n unless passCustomOnesLeft[3].nil? \n pcuol4 = passCustomOnesLeft[3].fullname \n end\n unless passCustomOnesLeft[4].nil? \n pcuol5 = passCustomOnesLeft[4].fullname \n end\n unless passCustomOnesLeft[5].nil? \n pcuol6 = passCustomOnesLeft[5].fullname \n end \n unless passCustomOnesLeft[6].nil? \n pcuol7 = passCustomOnesLeft[6].fullname \n end \n unless passCustomOnesLeft[7].nil? \n pcuol8 = passCustomOnesLeft[7].fullname \n end\n unless passCustomOnesLeft[8].nil? \n pcuol9 = passCustomOnesLeft[8].fullname \n end\n unless passCustomOnesLeft[9].nil? \n pcuol10 = passCustomOnesLeft[9].fullname \n end\n unless passCustomOnesLeft[10].nil? \n pcuol11 = passCustomOnesLeft[10].fullname \n end\n unless passCustomOnesLeft[11].nil? \n pcuol12 = passCustomOnesLeft[11].fullname \n end\n unless passCustomOnesLeft[12].nil? \n pcuol13 = passCustomOnesLeft[12].fullname \n end \n unless passCustomOnesLeft[13].nil? \n pcuol14 = passCustomOnesLeft[13].fullname \n end \n unless passCustomOnesLeft[14].nil? \n pcuol15 = passCustomOnesLeft[14].fullname \n end \n\n #Pass Right Hash\n unless passCustomOnesRight[0].nil? \n pcuor1 = passCustomOnesRight[0].fullname \n end\n unless passCustomOnesRight[1].nil? \n pcuor2 = passCustomOnesRight[1].fullname \n end\n unless passCustomOnesRight[2].nil? \n pcuor3 = passCustomOnesRight[2].fullname \n end\n unless passCustomOnesRight[3].nil? \n pcuor4 = passCustomOnesRight[3].fullname \n end\n unless passCustomOnesRight[4].nil? \n pcuor5 = passCustomOnesRight[4].fullname \n end\n unless passCustomOnesRight[5].nil? \n pcuor6 = passCustomOnesRight[5].fullname \n end\n unless passCustomOnesRight[6].nil? \n pcuor7 = passCustomOnesRight[6].fullname \n end \n unless passCustomOnesRight[7].nil? \n pcuor8 = passCustomOnesRight[7].fullname \n end\n unless passCustomOnesRight[8].nil? \n pcuor9 = passCustomOnesRight[8].fullname \n end\n unless passCustomOnesRight[9].nil? \n pcuor10 = passCustomOnesRight[9].fullname \n end\n unless passCustomOnesRight[10].nil? \n pcuor11 = passCustomOnesRight[10].fullname \n end\n unless passCustomOnesRight[11].nil? \n pcuor12 = passCustomOnesRight[11].fullname \n end\n unless passCustomOnesRight[12].nil? \n pcuor13 = passCustomOnesRight[12].fullname \n end\n unless passCustomOnesRight[13].nil? \n pcuor14 = passCustomOnesRight[13].fullname \n end \n unless passCustomOnesRight[14].nil? \n pcuor15 = passCustomOnesRight[14].fullname \n end \n\n #Number of user's run plays in situation 12\n num_cus1r = self.user.s_name12_num_run\n\n #Left Hash\n # cus1l_s0 \n if num_cus1r > 0\n cus1l_s0 = self.user.s_name12 + ' - Run'\n else\n cus1l_s0 = self.user.s_name12 + ' - Pass'\n end\n\n #cus1l_s1 \n if num_cus1r > 0\n cus1l_s1 = rcuol1\n else\n cus1l_s1 = pcuol1\n end\n\n #cus1l_s2\n if num_cus1r == 0\n cus1l_s2 = pcuol2\n elsif num_cus1r == 1\n cus1l_s2 = self.user.s_name12 + ' - Pass'\n else num_cus1r > 1\n cus1l_s2 = rcuol2\n end\n\n #cus1l_s3\n case num_cus1r\n when 0 then cus1l_s3 = pcuol3 \n when 1 then cus1l_s3 = pcuol1\n when 2 then cus1l_s3 = self.user.s_name12 + ' - Pass'\n when 3..100 then cus1l_s3 = rcuol3\n end\n\n #cus1l_s4\n case num_cus1r\n when 0 then cus1l_s4 = pcuol4 \n when 1 then cus1l_s4 = pcuol2\n when 2 then cus1l_s4 = pcuol1\n when 3 then cus1l_s4 = self.user.s_name12 + ' - Pass'\n when 4..100 then cus1l_s4 = rcuol4\n end\n\n #cus1l_s5\n case num_cus1r\n when 0 then cus1l_s5 = pcuol5 \n when 1 then cus1l_s5 = pcuol3\n when 2 then cus1l_s5 = pcuol2\n when 3 then cus1l_s5 = pcuol1\n when 4 then cus1l_s5 = self.user.s_name12 + ' - Pass'\n when 5..100 then cus1l_s5 = rcuol5\n end\n\n #cus1l_s6\n case num_cus1r\n when 0 then cus1l_s6 = pcuol6 \n when 1 then cus1l_s6 = pcuol4\n when 2 then cus1l_s6 = pcuol3\n when 3 then cus1l_s6 = pcuol2\n when 4 then cus1l_s6 = pcuol1\n when 5 then cus1l_s6 = self.user.s_name12 + ' - Pass'\n when 6..100 then cus1l_s6 = rcuol6\n end\n\n #cus1l_s7\n case num_cus1r\n when 0 then cus1l_s7 = pcuol7 \n when 1 then cus1l_s7 = pcuol5\n when 2 then cus1l_s7 = pcuol4\n when 3 then cus1l_s7 = pcuol3\n when 4 then cus1l_s7 = pcuol2\n when 5 then cus1l_s7 = pcuol1\n when 6 then cus1l_s7 = self.user.s_name12 + ' - Pass'\n when 7..100 then cus1l_s7 = rcuol7\n end\n\n #cus1l_s8\n case num_cus1r\n when 0 then cus1l_s8 = pcuol8 \n when 1 then cus1l_s8 = pcuol6\n when 2 then cus1l_s8 = pcuol5\n when 3 then cus1l_s8 = pcuol4\n when 4 then cus1l_s8 = pcuol3\n when 5 then cus1l_s8 = pcuol2\n when 6 then cus1l_s8 = pcuol1\n when 7 then cus1l_s8 = self.user.s_name12 + ' - Pass'\n when 8..100 then cus1l_s8 = rcuol8\n end\n\n #cus1l_s9\n case num_cus1r\n when 0 then cus1l_s9 = pcuol9 \n when 1 then cus1l_s9 = pcuol7\n when 2 then cus1l_s9 = pcuol6\n when 3 then cus1l_s9 = pcuol5\n when 4 then cus1l_s9 = pcuol4\n when 5 then cus1l_s9 = pcuol3\n when 6 then cus1l_s9 = pcuol2\n when 7 then cus1l_s9 = pcuol1\n when 8 then cus1l_s9 = self.user.s_name12 + ' - Pass'\n when 9..100 then cus1l_s9 = rcuol9\n end\n\n #cus1l_s10\n case num_cus1r\n when 0 then cus1l_s10 = pcuol10 \n when 1 then cus1l_s10 = pcuol8\n when 2 then cus1l_s10 = pcuol7\n when 3 then cus1l_s10 = pcuol6\n when 4 then cus1l_s10 = pcuol5\n when 5 then cus1l_s10 = pcuol4\n when 6 then cus1l_s10 = pcuol3\n when 7 then cus1l_s10 = pcuol2\n when 8 then cus1l_s10 = pcuol1\n when 9 then cus1l_s10 = self.user.s_name12 + ' - Pass'\n when 10..100 then cus1l_s10 = rcuol10\n end\n\n #cus1l_s11\n case num_cus1r\n when 0 then cus1l_s11 = pcuol11 \n when 1 then cus1l_s11 = pcuol9\n when 2 then cus1l_s11 = pcuol8\n when 3 then cus1l_s11 = pcuol7\n when 4 then cus1l_s11 = pcuol6\n when 5 then cus1l_s11 = pcuol5\n when 6 then cus1l_s11 = pcuol4\n when 7 then cus1l_s11 = pcuol3\n when 8 then cus1l_s11 = pcuol2\n when 9 then cus1l_s11 = pcuol1\n when 10 then cus1l_s11 = self.user.s_name12 + ' - Pass'\n when 11..100 then cus1l_s11 = rcuol11\n end\n\n #cus1l_s12\n case num_cus1r\n when 0 then cus1l_s12 = pcuol12 \n when 1 then cus1l_s12 = pcuol10\n when 2 then cus1l_s12 = pcuol9\n when 3 then cus1l_s12 = pcuol8\n when 4 then cus1l_s12 = pcuol7\n when 5 then cus1l_s12 = pcuol6\n when 6 then cus1l_s12 = pcuol5\n when 7 then cus1l_s12 = pcuol4\n when 8 then cus1l_s12 = pcuol3\n when 9 then cus1l_s12 = pcuol2\n when 10 then cus1l_s12 = pcuol1\n when 11 then cus1l_s12 = self.user.s_name12 + ' - Pass'\n when 12..100 then cus1l_s12 = rcuol12\n end\n\n #cus1l_s13\n case num_cus1r\n when 0 then cus1l_s13 = pcuol13 \n when 1 then cus1l_s13 = pcuol11\n when 2 then cus1l_s13 = pcuol10\n when 3 then cus1l_s13 = pcuol9\n when 4 then cus1l_s13 = pcuol8\n when 5 then cus1l_s13 = pcuol7\n when 6 then cus1l_s13 = pcuol6\n when 7 then cus1l_s13 = pcuol5\n when 8 then cus1l_s13 = pcuol4\n when 9 then cus1l_s13 = pcuol3\n when 10 then cus1l_s13 = pcuol2\n when 11 then cus1l_s13 = pcuol1\n when 12 then cus1l_s13 = self.user.s_name12 + ' - Pass'\n when 13..100 then cus1l_s13 = rcuol13\n end\n\n #cus1l_s14\n case num_cus1r\n when 0 then cus1l_s14 = pcuol14 \n when 1 then cus1l_s14 = pcuol12\n when 2 then cus1l_s14 = pcuol11\n when 3 then cus1l_s14 = pcuol10\n when 4 then cus1l_s14 = pcuol9\n when 5 then cus1l_s14 = pcuol8\n when 6 then cus1l_s14 = pcuol7\n when 7 then cus1l_s14 = pcuol6\n when 8 then cus1l_s14 = pcuol5\n when 9 then cus1l_s14 = pcuol4\n when 10 then cus1l_s14 = pcuol3\n when 11 then cus1l_s14 = pcuol2\n when 12 then cus1l_s14 = pcuol1 \n when 13 then cus1l_s14 = self.user.s_name12 + ' - Pass'\n when 14..100 then cus1l_s14 = rcuol14\n end\n\n #cus1l_s15\n case num_cus1r\n when 0 then cus1l_s15 = pcuol15 \n when 1 then cus1l_s15 = pcuol13\n when 2 then cus1l_s15 = pcuol12\n when 3 then cus1l_s15 = pcuol11\n when 4 then cus1l_s15 = pcuol10\n when 5 then cus1l_s15 = pcuol9\n when 6 then cus1l_s15 = pcuol8\n when 7 then cus1l_s15 = pcuol7\n when 8 then cus1l_s15 = pcuol6\n when 9 then cus1l_s15 = pcuol5\n when 10 then cus1l_s15 = pcuol4\n when 11 then cus1l_s15 = pcuol3\n when 12 then cus1l_s15 = pcuol2\n when 13 then cus1l_s15 = pcuol1 \n when 14..100 then cus1l_s15 = rcuol15\n end \n\n\n #Right Hash\n # cus1r_s0 would always be blank\n\n #cus1r_s1 \n if num_cus1r > 0\n cus1r_s1 = rcuor1\n else\n cus1r_s1 = pcuor1\n end\n\n #cus1r_s2\n if num_cus1r == 0\n cus1r_s2 = pcuor2\n elsif num_cus1r == 1\n cus1r_s2 = ''\n else num_cus1r > 1\n cus1r_s2 = rcuor2\n end\n\n #cus1r_s3\n case num_cus1r\n when 0 then cus1r_s3 = pcuor3 \n when 1 then cus1r_s3 = pcuor1\n when 2 then cus1r_s3 = ''\n when 3..100 then cus1r_s3 = rcuor3\n end\n\n #cus1r_s4\n case num_cus1r\n when 0 then cus1r_s4 = pcuor4 \n when 1 then cus1r_s4 = pcuor2\n when 2 then cus1r_s4 = pcuor1\n when 3 then ''\n when 4..100 then cus1r_s4 = rcuor4\n end\n\n #cus1r_s5\n case num_cus1r\n when 0 then cus1r_s5 = pcuor5 \n when 1 then cus1r_s5 = pcuor3\n when 2 then cus1r_s5 = pcuor2\n when 3 then cus1r_s5 = pcuor1\n when 4 then cus1r_s5 = ''\n when 5..100 then cus1r_s5 = rcuor5\n end\n\n #cus1r_s6\n case num_cus1r\n when 0 then cus1r_s6 = pcuor6 \n when 1 then cus1r_s6 = pcuor4\n when 2 then cus1r_s6 = pcuor3\n when 3 then cus1r_s6 = pcuor2\n when 4 then cus1r_s6 = pcuor1\n when 5 then cus1r_s6 = ''\n when 6..100 then cus1r_s6 = rcuor6\n end\n\n #cus1r_s7\n case num_cus1r\n when 0 then cus1r_s7 = pcuor7 \n when 1 then cus1r_s7 = pcuor5\n when 2 then cus1r_s7 = pcuor4\n when 3 then cus1r_s7 = pcuor3\n when 4 then cus1r_s7 = pcuor2\n when 5 then cus1r_s7 = pcuor1\n when 6 then cus1r_s7 = ''\n when 7..100 then cus1r_s7 = rcuor7\n end\n\n #cus1r_s8\n case num_cus1r\n when 0 then cus1r_s8 = pcuor8 \n when 1 then cus1r_s8 = pcuor6\n when 2 then cus1r_s8 = pcuor5\n when 3 then cus1r_s8 = pcuor4\n when 4 then cus1r_s8 = pcuor3\n when 5 then cus1r_s8 = pcuor2\n when 6 then cus1r_s8 = pcuor1\n when 7 then cus1r_s8 = ''\n when 8..100 then cus1r_s8 = rcuor8\n end\n\n #cus1r_s9\n case num_cus1r\n when 0 then cus1r_s9 = pcuor9 \n when 1 then cus1r_s9 = pcuor7\n when 2 then cus1r_s9 = pcuor6\n when 3 then cus1r_s9 = pcuor5\n when 4 then cus1r_s9 = pcuor4\n when 5 then cus1r_s9 = pcuor3\n when 6 then cus1r_s9 = pcuor2\n when 7 then cus1r_s9 = pcuor1\n when 8 then cus1r_s9 = ''\n when 9..100 then cus1r_s9 = rcuor9\n end\n\n #cus1r_s10\n case num_cus1r\n when 0 then cus1r_s10 = pcuor10 \n when 1 then cus1r_s10 = pcuor8\n when 2 then cus1r_s10 = pcuor7\n when 3 then cus1r_s10 = pcuor6\n when 4 then cus1r_s10 = pcuor5\n when 5 then cus1r_s10 = pcuor4\n when 6 then cus1r_s10 = pcuor3\n when 7 then cus1r_s10 = pcuor2\n when 8 then cus1r_s10 = pcuor1\n when 9 then cus1r_s10 = ''\n when 10..100 then cus1r_s10 = rcuor10\n end\n\n #cus1r_s11\n case num_cus1r\n when 0 then cus1r_s11 = pcuor11 \n when 1 then cus1r_s11 = pcuor9\n when 2 then cus1r_s11 = pcuor8\n when 3 then cus1r_s11 = pcuor7\n when 4 then cus1r_s11 = pcuor6\n when 5 then cus1r_s11 = pcuor5\n when 6 then cus1r_s11 = pcuor4\n when 7 then cus1r_s11 = pcuor3\n when 8 then cus1r_s11 = pcuor2\n when 9 then cus1r_s11 = pcuor1\n when 10 then cus1r_s11 = ''\n when 11..100 then cus1r_s11 = rcuor11\n end\n\n #cus1r_s12\n case num_cus1r\n when 0 then cus1r_s12 = pcuor12 \n when 1 then cus1r_s12 = pcuor10\n when 2 then cus1r_s12 = pcuor9\n when 3 then cus1r_s12 = pcuor8\n when 4 then cus1r_s12 = pcuor7\n when 5 then cus1r_s12 = pcuor6\n when 6 then cus1r_s12 = pcuor5\n when 7 then cus1r_s12 = pcuor4\n when 8 then cus1r_s12 = pcuor3\n when 9 then cus1r_s12 = pcuor2\n when 10 then cus1r_s12 = pcuor1\n when 11 then cus1r_s12 = ''\n when 12..100 then cus1r_s12 = rcuor12\n end\n\n #cus1r_s13\n case num_cus1r\n when 0 then cus1r_s13 = pcuor13 \n when 1 then cus1r_s13 = pcuor11\n when 2 then cus1r_s13 = pcuor10\n when 3 then cus1r_s13 = pcuor9\n when 4 then cus1r_s13 = pcuor8\n when 5 then cus1r_s13 = pcuor7\n when 6 then cus1r_s13 = pcuor6\n when 7 then cus1r_s13 = pcuor5\n when 8 then cus1r_s13 = pcuor4\n when 9 then cus1r_s13 = pcuor3\n when 10 then cus1r_s13 = pcuor2\n when 11 then cus1r_s13 = pcuor1\n when 12 then cus1r_s13 = ''\n when 13..100 then cus1r_s13 = rcuor13\n end\n\n #cus1r_s14\n case num_cus1r\n when 0 then cus1r_s14 = pcuor14 \n when 1 then cus1r_s14 = pcuor12\n when 2 then cus1r_s14 = pcuor11\n when 3 then cus1r_s14 = pcuor10\n when 4 then cus1r_s14 = pcuor9\n when 5 then cus1r_s14 = pcuor8\n when 6 then cus1r_s14 = pcuor7\n when 7 then cus1r_s14 = pcuor6\n when 8 then cus1r_s14 = pcuor5\n when 9 then cus1r_s14 = pcuor4\n when 10 then cus1r_s14 = pcuor3\n when 11 then cus1r_s14 = pcuor2\n when 12 then cus1r_s14 = pcuor1 \n when 13 then cus1r_s14 = ''\n when 14..100 then cus1r_s14 = rcuor14\n end\n\n #cus1r_s15\n case num_cus1r\n when 0 then cus1r_s15 = pcuor15 \n when 1 then cus1r_s15 = pcuor13\n when 2 then cus1r_s15 = pcuor12\n when 3 then cus1r_s15 = pcuor11\n when 4 then cus1r_s15 = pcuor10\n when 5 then cus1r_s15 = pcuor9\n when 6 then cus1r_s15 = pcuor8\n when 7 then cus1r_s15 = pcuor7\n when 8 then cus1r_s15 = pcuor6\n when 9 then cus1r_s15 = pcuor5\n when 10 then cus1r_s15 = pcuor4\n when 11 then cus1r_s15 = pcuor3\n when 12 then cus1r_s15 = pcuor2\n when 13 then cus1r_s15 = pcuor1 \n when 14..100 then cus1r_s15 = rcuor15\n end \n #----------End Custom 1---------- \n\n #----------Custom 2----------\n customTwos = event.plays.where('situation13 = ?', true)\n \n runCustomTwos = customTwos.where('play_type = ?', 'Run')\n runCustomTwosLeft = runCustomTwos.where('hash_mark = ?', 'Left')\n runCustomTwosRight = runCustomTwos.where('hash_mark = ?', 'Right')\n \n passCustomTwos = customTwos.where('play_type = ?', 'Pass')\n passCustomTwosLeft = passCustomTwos.where('hash_mark = ?', 'Left')\n passCustomTwosRight = passCustomTwos.where('hash_mark = ?', 'Right')\n\n #Run Left Hash\n unless runCustomTwosLeft[0].nil? \n rcutl1 = runCustomTwosLeft[0].fullname \n end\n unless runCustomTwosLeft[1].nil? \n rcutl2 = runCustomTwosLeft[1].fullname \n end\n unless runCustomTwosLeft[2].nil? \n rcutl3 = runCustomTwosLeft[2].fullname \n end\n unless runCustomTwosLeft[3].nil? \n rcutl4 = runCustomTwosLeft[3].fullname \n end\n unless runCustomTwosLeft[4].nil? \n rcutl5 = runCustomTwosLeft[4].fullname\n end\n unless runCustomTwosLeft[5].nil? \n rcutl6 = runCustomTwosLeft[5].fullname \n end\n unless runCustomTwosLeft[6].nil? \n rcutl7 = runCustomTwosLeft[6].fullname\n end \n unless runCustomTwosLeft[7].nil? \n rcutl8 = runCustomTwosLeft[7].fullname \n end\n unless runCustomTwosLeft[8].nil? \n rcutl9 = runCustomTwosLeft[8].fullname \n end\n unless runCustomTwosLeft[9].nil? \n rcutl10 = runCustomTwosLeft[9].fullname \n end\n unless runCustomTwosLeft[10].nil? \n rcutl11 = runCustomTwosLeft[10].fullname \n end\n unless runCustomTwosLeft[11].nil? \n rcutl12 = runCustomTwosLeft[11].fullname\n end\n unless runCustomTwosLeft[12].nil? \n rcutl13 = runCustomTwosLeft[12].fullname \n end\n unless runCustomTwosLeft[13].nil? \n rcutl14 = runCustomTwosLeft[13].fullname\n end \n unless runCustomTwosLeft[14].nil? \n rcutl15 = runCustomTwosLeft[14].fullname\n end\n\n #Run Right Hash\n unless runCustomTwosRight[0].nil? \n rcutr1 = runCustomTwosRight[0].fullname \n end\n unless runCustomTwosRight[1].nil? \n rcutr2 = runCustomTwosRight[1].fullname \n end\n unless runCustomTwosRight[2].nil? \n rcutr3 = runCustomTwosRight[2].fullname \n end\n unless runCustomTwosRight[3].nil? \n rcutr4 = runCustomTwosRight[3].fullname \n end\n unless runCustomTwosRight[4].nil? \n rcutr5 = runCustomTwosRight[4].fullname\n end\n unless runCustomTwosRight[5].nil? \n rcutr6 = runCustomTwosRight[5].fullname \n end\n unless runCustomTwosRight[6].nil? \n rcutr7 = runCustomTwosRight[6].fullname\n end \n unless runCustomTwosRight[7].nil? \n rcutr8 = runCustomTwosRight[7].fullname \n end\n unless runCustomTwosRight[8].nil? \n rcutr9 = runCustomTwosRight[8].fullname \n end\n unless runCustomTwosRight[9].nil? \n rcutr10 = runCustomTwosRight[9].fullname \n end\n unless runCustomTwosRight[10].nil? \n rcutr11 = runCustomTwosRight[10].fullname \n end\n unless runCustomTwosRight[11].nil? \n rcutr12 = runCustomTwosRight[11].fullname\n end\n unless runCustomTwosRight[12].nil? \n rcutr13 = runCustomTwosRight[12].fullname \n end\n unless runCustomTwosRight[13].nil? \n rcutr14 = runCustomTwosRight[13].fullname\n end \n unless runCustomTwosRight[14].nil? \n rcutr15 = runCustomTwosRight[14].fullname\n end \n\n #Pass Left Hash\n unless passCustomTwosLeft[0].nil? \n pcutl1 = passCustomTwosLeft[0].fullname \n end\n unless passCustomTwosLeft[1].nil? \n pcutl2 = passCustomTwosLeft[1].fullname \n end\n unless passCustomTwosLeft[2].nil? \n pcutl3 = passCustomTwosLeft[2].fullname \n end\n unless passCustomTwosLeft[3].nil? \n pcutl4 = passCustomTwosLeft[3].fullname \n end\n unless passCustomTwosLeft[4].nil? \n pcutl5 = passCustomTwosLeft[4].fullname \n end\n unless passCustomTwosLeft[5].nil? \n pcutl6 = passCustomTwosLeft[5].fullname \n end \n unless passCustomTwosLeft[6].nil? \n pcutl7 = passCustomTwosLeft[6].fullname \n end \n unless passCustomTwosLeft[7].nil? \n pcutl8 = passCustomTwosLeft[7].fullname \n end\n unless passCustomTwosLeft[8].nil? \n pcutl9 = passCustomTwosLeft[8].fullname \n end\n unless passCustomTwosLeft[9].nil? \n pcutl10 = passCustomTwosLeft[9].fullname \n end\n unless passCustomTwosLeft[10].nil? \n pcutl11 = passCustomTwosLeft[10].fullname \n end\n unless passCustomTwosLeft[11].nil? \n pcutl12 = passCustomTwosLeft[11].fullname \n end\n unless passCustomTwosLeft[12].nil? \n pcutl13 = passCustomTwosLeft[12].fullname \n end \n unless passCustomTwosLeft[13].nil? \n pcutl14 = passCustomTwosLeft[13].fullname \n end \n unless passCustomTwosLeft[14].nil? \n pcutl15 = passCustomTwosLeft[14].fullname \n end \n\n #Pass Right Hash\n unless passCustomTwosRight[0].nil? \n pcutr1 = passCustomTwosRight[0].fullname \n end\n unless passCustomTwosRight[1].nil? \n pcutr2 = passCustomTwosRight[1].fullname \n end\n unless passCustomTwosRight[2].nil? \n pcutr3 = passCustomTwosRight[2].fullname \n end\n unless passCustomTwosRight[3].nil? \n pcutr4 = passCustomTwosRight[3].fullname \n end\n unless passCustomTwosRight[4].nil? \n pcutr5 = passCustomTwosRight[4].fullname \n end\n unless passCustomTwosRight[5].nil? \n pcutr6 = passCustomTwosRight[5].fullname \n end\n unless passCustomTwosRight[6].nil? \n pcutr7 = passCustomTwosRight[6].fullname \n end \n unless passCustomTwosRight[7].nil? \n pcutr8 = passCustomTwosRight[7].fullname \n end\n unless passCustomTwosRight[8].nil? \n pcutr9 = passCustomTwosRight[8].fullname \n end\n unless passCustomTwosRight[9].nil? \n pcutr10 = passCustomTwosRight[9].fullname \n end\n unless passCustomTwosRight[10].nil? \n pcutr11 = passCustomTwosRight[10].fullname \n end\n unless passCustomTwosRight[11].nil? \n pcutr12 = passCustomTwosRight[11].fullname \n end\n unless passCustomTwosRight[12].nil? \n pcutr13 = passCustomTwosRight[12].fullname \n end\n unless passCustomTwosRight[13].nil? \n pcutr14 = passCustomTwosRight[13].fullname \n end \n unless passCustomTwosRight[14].nil? \n pcutr15 = passCustomTwosRight[14].fullname \n end \n\n #Number of user's run plays in situation 13\n num_cus2r = self.user.s_name13_num_run\n\n #Left Hash\n # cus2l_s0 \n if num_cus2r > 0\n cus2l_s0 = self.user.s_name13 + ' - Run'\n else\n cus2l_s0 = self.user.s_name13 + ' - Pass'\n end\n\n #cus2l_s1 \n if num_cus2r > 0\n cus2l_s1 = rcutl1\n else\n cus2l_s1 = pcutl1\n end\n\n #cus2l_s2\n if num_cus2r == 0\n cus2l_s2 = pcutl2\n elsif num_cus2r == 1\n cus2l_s2 = self.user.s_name13 + ' - Pass'\n else num_cus2r > 1\n cus2l_s2 = rcutl2\n end\n\n #cus2l_s3\n case num_cus2r\n when 0 then cus2l_s3 = pcutl3 \n when 1 then cus2l_s3 = pcutl1\n when 2 then cus2l_s3 = self.user.s_name13 + ' - Pass'\n when 3..100 then cus2l_s3 = rcutl3\n end\n\n #cus2l_s4\n case num_cus2r\n when 0 then cus2l_s4 = pcutl4 \n when 1 then cus2l_s4 = pcutl2\n when 2 then cus2l_s4 = pcutl1\n when 3 then cus2l_s4 = self.user.s_name13 + ' - Pass'\n when 4..100 then cus2l_s4 = rcutl4\n end\n\n #cus2l_s5\n case num_cus2r\n when 0 then cus2l_s5 = pcutl5 \n when 1 then cus2l_s5 = pcutl3\n when 2 then cus2l_s5 = pcutl2\n when 3 then cus2l_s5 = pcutl1\n when 4 then cus2l_s5 = self.user.s_name13 + ' - Pass'\n when 5..100 then cus2l_s5 = rcutl5\n end\n\n #cus2l_s6\n case num_cus2r\n when 0 then cus2l_s6 = pcutl6 \n when 1 then cus2l_s6 = pcutl4\n when 2 then cus2l_s6 = pcutl3\n when 3 then cus2l_s6 = pcutl2\n when 4 then cus2l_s6 = pcutl1\n when 5 then cus2l_s6 = self.user.s_name13 + ' - Pass'\n when 6..100 then cus2l_s6 = rcutl6\n end\n\n #cus2l_s7\n case num_cus2r\n when 0 then cus2l_s7 = pcutl7 \n when 1 then cus2l_s7 = pcutl5\n when 2 then cus2l_s7 = pcutl4\n when 3 then cus2l_s7 = pcutl3\n when 4 then cus2l_s7 = pcutl2\n when 5 then cus2l_s7 = pcutl1\n when 6 then cus2l_s7 = self.user.s_name13 + ' - Pass'\n when 7..100 then cus2l_s7 = rcutl7\n end\n\n #cus2l_s8\n case num_cus2r\n when 0 then cus2l_s8 = pcutl8 \n when 1 then cus2l_s8 = pcutl6\n when 2 then cus2l_s8 = pcutl5\n when 3 then cus2l_s8 = pcutl4\n when 4 then cus2l_s8 = pcutl3\n when 5 then cus2l_s8 = pcutl2\n when 6 then cus2l_s8 = pcutl1\n when 7 then cus2l_s8 = self.user.s_name13 + ' - Pass'\n when 8..100 then cus2l_s8 = rcutl8\n end\n\n #cus2l_s9\n case num_cus2r\n when 0 then cus2l_s9 = pcutl9 \n when 1 then cus2l_s9 = pcutl7\n when 2 then cus2l_s9 = pcutl6\n when 3 then cus2l_s9 = pcutl5\n when 4 then cus2l_s9 = pcutl4\n when 5 then cus2l_s9 = pcutl3\n when 6 then cus2l_s9 = pcutl2\n when 7 then cus2l_s9 = pcutl1\n when 8 then cus2l_s9 = self.user.s_name13 + ' - Pass'\n when 9..100 then cus2l_s9 = rcutl9\n end\n\n #cus2l_s10\n case num_cus2r\n when 0 then cus2l_s10 = pcutl10 \n when 1 then cus2l_s10 = pcutl8\n when 2 then cus2l_s10 = pcutl7\n when 3 then cus2l_s10 = pcutl6\n when 4 then cus2l_s10 = pcutl5\n when 5 then cus2l_s10 = pcutl4\n when 6 then cus2l_s10 = pcutl3\n when 7 then cus2l_s10 = pcutl2\n when 8 then cus2l_s10 = pcutl1\n when 9 then cus2l_s10 = self.user.s_name13 + ' - Pass'\n when 10..100 then cus2l_s10 = rcutl10\n end\n\n #cus2l_s11\n case num_cus2r\n when 0 then cus2l_s11 = pcutl11 \n when 1 then cus2l_s11 = pcutl9\n when 2 then cus2l_s11 = pcutl8\n when 3 then cus2l_s11 = pcutl7\n when 4 then cus2l_s11 = pcutl6\n when 5 then cus2l_s11 = pcutl5\n when 6 then cus2l_s11 = pcutl4\n when 7 then cus2l_s11 = pcutl3\n when 8 then cus2l_s11 = pcutl2\n when 9 then cus2l_s11 = pcutl1\n when 10 then cus2l_s11 = self.user.s_name13 + ' - Pass'\n when 11..100 then cus2l_s11 = rcutl11\n end\n\n #cus2l_s12\n case num_cus2r\n when 0 then cus2l_s12 = pcutl12 \n when 1 then cus2l_s12 = pcutl10\n when 2 then cus2l_s12 = pcutl9\n when 3 then cus2l_s12 = pcutl8\n when 4 then cus2l_s12 = pcutl7\n when 5 then cus2l_s12 = pcutl6\n when 6 then cus2l_s12 = pcutl5\n when 7 then cus2l_s12 = pcutl4\n when 8 then cus2l_s12 = pcutl3\n when 9 then cus2l_s12 = pcutl2\n when 10 then cus2l_s12 = pcutl1\n when 11 then cus2l_s12 = self.user.s_name13 + ' - Pass'\n when 12..100 then cus2l_s12 = rcutl12\n end\n\n #cus2l_s13\n case num_cus2r\n when 0 then cus2l_s13 = pcutl13 \n when 1 then cus2l_s13 = pcutl11\n when 2 then cus2l_s13 = pcutl10\n when 3 then cus2l_s13 = pcutl9\n when 4 then cus2l_s13 = pcutl8\n when 5 then cus2l_s13 = pcutl7\n when 6 then cus2l_s13 = pcutl6\n when 7 then cus2l_s13 = pcutl5\n when 8 then cus2l_s13 = pcutl4\n when 9 then cus2l_s13 = pcutl3\n when 10 then cus2l_s13 = pcutl2\n when 11 then cus2l_s13 = pcutl1\n when 12 then cus2l_s13 = self.user.s_name13 + ' - Pass'\n when 13..100 then cus2l_s13 = rcutl13\n end\n\n #cus2l_s14\n case num_cus2r\n when 0 then cus2l_s14 = pcutl14 \n when 1 then cus2l_s14 = pcutl12\n when 2 then cus2l_s14 = pcutl11\n when 3 then cus2l_s14 = pcutl10\n when 4 then cus2l_s14 = pcutl9\n when 5 then cus2l_s14 = pcutl8\n when 6 then cus2l_s14 = pcutl7\n when 7 then cus2l_s14 = pcutl6\n when 8 then cus2l_s14 = pcutl5\n when 9 then cus2l_s14 = pcutl4\n when 10 then cus2l_s14 = pcutl3\n when 11 then cus2l_s14 = pcutl2\n when 12 then cus2l_s14 = pcutl1 \n when 13 then cus2l_s14 = self.user.s_name13 + ' - Pass'\n when 14..100 then cus2l_s14 = rcutl14\n end\n\n #cus2l_s15\n case num_cus2r\n when 0 then cus2l_s15 = pcutl15 \n when 1 then cus2l_s15 = pcutl13\n when 2 then cus2l_s15 = pcutl12\n when 3 then cus2l_s15 = pcutl11\n when 4 then cus2l_s15 = pcutl10\n when 5 then cus2l_s15 = pcutl9\n when 6 then cus2l_s15 = pcutl8\n when 7 then cus2l_s15 = pcutl7\n when 8 then cus2l_s15 = pcutl6\n when 9 then cus2l_s15 = pcutl5\n when 10 then cus2l_s15 = pcutl4\n when 11 then cus2l_s15 = pcutl3\n when 12 then cus2l_s15 = pcutl2\n when 13 then cus2l_s15 = pcutl1 \n when 14..100 then cus2l_s15 = rcutl15\n end \n\n\n #Right Hash\n # cus2r_s0 would always be blank\n\n #cus2r_s1 \n if num_cus2r > 0\n cus2r_s1 = rcutr1\n else\n cus2r_s1 = pcutr1\n end\n\n #cus2r_s2\n if num_cus2r == 0\n cus2r_s2 = pcutr2\n elsif num_cus2r == 1\n cus2r_s2 = ''\n else num_cus2r > 1\n cus2r_s2 = rcutr2\n end\n\n #cus2r_s3\n case num_cus2r\n when 0 then cus2r_s3 = pcutr3 \n when 1 then cus2r_s3 = pcutr1\n when 2 then cus2r_s3 = ''\n when 3..100 then cus2r_s3 = rcutr3\n end\n\n #cus2r_s4\n case num_cus2r\n when 0 then cus2r_s4 = pcutr4 \n when 1 then cus2r_s4 = pcutr2\n when 2 then cus2r_s4 = pcutr1\n when 3 then ''\n when 4..100 then cus2r_s4 = rcutr4\n end\n\n #cus2r_s5\n case num_cus2r\n when 0 then cus2r_s5 = pcutr5 \n when 1 then cus2r_s5 = pcutr3\n when 2 then cus2r_s5 = pcutr2\n when 3 then cus2r_s5 = pcutr1\n when 4 then cus2r_s5 = ''\n when 5..100 then cus2r_s5 = rcutr5\n end\n\n #cus2r_s6\n case num_cus2r\n when 0 then cus2r_s6 = pcutr6 \n when 1 then cus2r_s6 = pcutr4\n when 2 then cus2r_s6 = pcutr3\n when 3 then cus2r_s6 = pcutr2\n when 4 then cus2r_s6 = pcutr1\n when 5 then cus2r_s6 = ''\n when 6..100 then cus2r_s6 = rcutr6\n end\n\n #cus2r_s7\n case num_cus2r\n when 0 then cus2r_s7 = pcutr7 \n when 1 then cus2r_s7 = pcutr5\n when 2 then cus2r_s7 = pcutr4\n when 3 then cus2r_s7 = pcutr3\n when 4 then cus2r_s7 = pcutr2\n when 5 then cus2r_s7 = pcutr1\n when 6 then cus2r_s7 = ''\n when 7..100 then cus2r_s7 = rcutr7\n end\n\n #cus2r_s8\n case num_cus2r\n when 0 then cus2r_s8 = pcutr8 \n when 1 then cus2r_s8 = pcutr6\n when 2 then cus2r_s8 = pcutr5\n when 3 then cus2r_s8 = pcutr4\n when 4 then cus2r_s8 = pcutr3\n when 5 then cus2r_s8 = pcutr2\n when 6 then cus2r_s8 = pcutr1\n when 7 then cus2r_s8 = ''\n when 8..100 then cus2r_s8 = rcutr8\n end\n\n #cus2r_s9\n case num_cus2r\n when 0 then cus2r_s9 = pcutr9 \n when 1 then cus2r_s9 = pcutr7\n when 2 then cus2r_s9 = pcutr6\n when 3 then cus2r_s9 = pcutr5\n when 4 then cus2r_s9 = pcutr4\n when 5 then cus2r_s9 = pcutr3\n when 6 then cus2r_s9 = pcutr2\n when 7 then cus2r_s9 = pcutr1\n when 8 then cus2r_s9 = ''\n when 9..100 then cus2r_s9 = rcutr9\n end\n\n #cus2r_s10\n case num_cus2r\n when 0 then cus2r_s10 = pcutr10 \n when 1 then cus2r_s10 = pcutr8\n when 2 then cus2r_s10 = pcutr7\n when 3 then cus2r_s10 = pcutr6\n when 4 then cus2r_s10 = pcutr5\n when 5 then cus2r_s10 = pcutr4\n when 6 then cus2r_s10 = pcutr3\n when 7 then cus2r_s10 = pcutr2\n when 8 then cus2r_s10 = pcutr1\n when 9 then cus2r_s10 = ''\n when 10..100 then cus2r_s10 = rcutr10\n end\n\n #cus2r_s11\n case num_cus2r\n when 0 then cus2r_s11 = pcutr11 \n when 1 then cus2r_s11 = pcutr9\n when 2 then cus2r_s11 = pcutr8\n when 3 then cus2r_s11 = pcutr7\n when 4 then cus2r_s11 = pcutr6\n when 5 then cus2r_s11 = pcutr5\n when 6 then cus2r_s11 = pcutr4\n when 7 then cus2r_s11 = pcutr3\n when 8 then cus2r_s11 = pcutr2\n when 9 then cus2r_s11 = pcutr1\n when 10 then cus2r_s11 = ''\n when 11..100 then cus2r_s11 = rcutr11\n end\n\n #cus2r_s12\n case num_cus2r\n when 0 then cus2r_s12 = pcutr12 \n when 1 then cus2r_s12 = pcutr10\n when 2 then cus2r_s12 = pcutr9\n when 3 then cus2r_s12 = pcutr8\n when 4 then cus2r_s12 = pcutr7\n when 5 then cus2r_s12 = pcutr6\n when 6 then cus2r_s12 = pcutr5\n when 7 then cus2r_s12 = pcutr4\n when 8 then cus2r_s12 = pcutr3\n when 9 then cus2r_s12 = pcutr2\n when 10 then cus2r_s12 = pcutr1\n when 11 then cus2r_s12 = ''\n when 12..100 then cus2r_s12 = rcutr12\n end\n\n #cus2r_s13\n case num_cus2r\n when 0 then cus2r_s13 = pcutr13 \n when 1 then cus2r_s13 = pcutr11\n when 2 then cus2r_s13 = pcutr10\n when 3 then cus2r_s13 = pcutr9\n when 4 then cus2r_s13 = pcutr8\n when 5 then cus2r_s13 = pcutr7\n when 6 then cus2r_s13 = pcutr6\n when 7 then cus2r_s13 = pcutr5\n when 8 then cus2r_s13 = pcutr4\n when 9 then cus2r_s13 = pcutr3\n when 10 then cus2r_s13 = pcutr2\n when 11 then cus2r_s13 = pcutr1\n when 12 then cus2r_s13 = ''\n when 13..100 then cus2r_s13 = rcutr13\n end\n\n #cus2r_s14\n case num_cus2r\n when 0 then cus2r_s14 = pcutr14 \n when 1 then cus2r_s14 = pcutr12\n when 2 then cus2r_s14 = pcutr11\n when 3 then cus2r_s14 = pcutr10\n when 4 then cus2r_s14 = pcutr9\n when 5 then cus2r_s14 = pcutr8\n when 6 then cus2r_s14 = pcutr7\n when 7 then cus2r_s14 = pcutr6\n when 8 then cus2r_s14 = pcutr5\n when 9 then cus2r_s14 = pcutr4\n when 10 then cus2r_s14 = pcutr3\n when 11 then cus2r_s14 = pcutr2\n when 12 then cus2r_s14 = pcutr1 \n when 13 then cus2r_s14 = ''\n when 14..100 then cus2r_s14 = rcutr14\n end\n\n #cus2r_s15\n case num_cus2r\n when 0 then cus2r_s15 = pcutr15 \n when 1 then cus2r_s15 = pcutr13\n when 2 then cus2r_s15 = pcutr12\n when 3 then cus2r_s15 = pcutr11\n when 4 then cus2r_s15 = pcutr10\n when 5 then cus2r_s15 = pcutr9\n when 6 then cus2r_s15 = pcutr8\n when 7 then cus2r_s15 = pcutr7\n when 8 then cus2r_s15 = pcutr6\n when 9 then cus2r_s15 = pcutr5\n when 10 then cus2r_s15 = pcutr4\n when 11 then cus2r_s15 = pcutr3\n when 12 then cus2r_s15 = pcutr2\n when 13 then cus2r_s15 = pcutr1 \n when 14..100 then cus2r_s15 = rcutr15\n end \n #----------End Custom 2---------- \n\n #----------Custom 3----------\n customThrees = event.plays.where('situation14 = ?', true)\n customThreesLeft = customThrees.where('hash_mark = ?', 'Left')\n customThreesRight = customThrees.where('hash_mark = ?', 'Right')\n \n #Left Hash\n unless customThreesLeft[0].nil? \n cuthl1 = customThreesLeft[0].fullname \n end\n unless customThreesLeft[1].nil? \n cuthl2 = customThreesLeft[1].fullname \n end\n unless customThreesLeft[2].nil? \n cuthl3 = customThreesLeft[2].fullname \n end\n unless customThreesLeft[3].nil? \n cuthl4 = customThreesLeft[3].fullname \n end\n unless customThreesLeft[4].nil? \n cuthl5 = customThreesLeft[4].fullname\n end\n unless customThreesLeft[5].nil? \n cuthl6 = customThreesLeft[5].fullname \n end\n unless customThreesLeft[6].nil? \n cuthl7 = customThreesLeft[6].fullname\n end \n unless customThreesLeft[7].nil? \n cuthl8 = customThreesLeft[7].fullname \n end\n unless customThreesLeft[8].nil? \n cuthl9 = customThreesLeft[8].fullname \n end\n unless customThreesLeft[9].nil? \n cuthl10 = customThreesLeft[9].fullname \n end\n unless customThreesLeft[10].nil? \n cuthl11 = customThreesLeft[10].fullname \n end\n unless customThreesLeft[11].nil? \n cuthl12 = customThreesLeft[11].fullname\n end\n unless customThreesLeft[12].nil? \n cuthl13 = customThreesLeft[12].fullname \n end\n unless customThreesLeft[13].nil? \n cuthl14 = customThreesLeft[13].fullname\n end \n unless customThreesLeft[14].nil? \n cuthl15 = customThreesLeft[14].fullname\n end \n\n #Right Hash\n unless customThreesRight[0].nil? \n cuthr1 = customThreesRight[0].fullname \n end\n unless customThreesRight[1].nil? \n cuthr2 = customThreesRight[1].fullname \n end\n unless customThreesRight[2].nil? \n cuthr3 = customThreesRight[2].fullname \n end\n unless customThreesRight[3].nil? \n cuthr4 = customThreesRight[3].fullname \n end\n unless customThreesRight[4].nil? \n cuthr5 = customThreesRight[4].fullname\n end\n unless customThreesRight[5].nil? \n cuthr6 = customThreesRight[5].fullname \n end\n unless customThreesRight[6].nil? \n cuthr7 = customThreesRight[6].fullname\n end \n unless customThreesRight[7].nil? \n cuthr8 = customThreesRight[7].fullname \n end\n unless customThreesRight[8].nil? \n cuthr9 = customThreesRight[8].fullname \n end\n unless customThreesRight[9].nil? \n cuthr10 = customThreesRight[9].fullname \n end\n unless customThreesRight[10].nil? \n cuthr11 = customThreesRight[10].fullname \n end\n unless customThreesRight[11].nil? \n cuthr12 = customThreesRight[11].fullname\n end\n unless customThreesRight[12].nil? \n cuthr13 = customThreesRight[12].fullname \n end\n unless customThreesRight[13].nil? \n cuthr14 = customThreesRight[13].fullname\n end \n unless customThreesRight[14].nil? \n cuthr15 = customThreesRight[14].fullname\n end \n #----------End Custom 3---------- \n\n self.update :gdata => \"[\n ['#{title}', '', '', ''],\n ['#{self.user.s_name1}', '', '#{ftl_s0}', ''],\n ['#{openl1}', '#{openr1}', '#{ftl_s1}', '#{ftr_s1}'],\n ['#{openl2}', '#{openr2}', '#{ftl_s2}', '#{ftr_s2}'],\n ['#{openl3}', '#{openr3}', '#{ftl_s3}', '#{ftr_s3}'],\n ['#{openl4}', '#{openr4}', '#{ftl_s4}', '#{ftr_s4}'],\n ['#{openl5}', '#{openr5}', '#{ftl_s5}', '#{ftr_s5}'],\n ['#{openl6}', '#{openr6}', '#{ftl_s6}', '#{ftr_s6}'],\n ['#{openl7}', '#{openr7}', '#{ftl_s7}', '#{ftr_s7}'], \n ['#{openl8}', '#{openr8}', '#{ftl_s8}', '#{ftr_s8}'],\n ['#{openl9}', '#{openr9}', '#{ftl_s9}', '#{ftr_s9}'],\n ['#{openl10}', '#{openr10}', '#{ftl_s10}', '#{ftr_s10}'],\n ['#{openl11}', '#{openr11}', '#{ftl_s11}', '#{ftr_s11}'],\n ['#{openl12}', '#{openr12}', '#{ftl_s12}', '#{ftr_s12}'],\n ['#{openl13}', '#{openr13}', '#{ftl_s13}', '#{ftr_s13}'],\n ['#{openl14}', '#{openr14}', '#{ftl_s14}', '#{ftr_s14}'],\n ['#{openl15}', '#{openr15}', '#{ftl_s15}', '#{ftr_s15}'],\n ['#{sll_s0}', '', '#{tll_s0}', ''],\n ['#{sll_s1}', '#{slr_s1}', '#{tll_s1}', '#{tlr_s1}'],\n ['#{sll_s2}', '#{slr_s2}', '#{tll_s2}', '#{tlr_s2}'],\n ['#{sll_s3}', '#{slr_s3}', '#{tll_s3}', '#{tlr_s3}'],\n ['#{sll_s4}', '#{slr_s4}', '#{tll_s4}', '#{tlr_s4}'],\n ['#{sll_s5}', '#{slr_s5}', '#{tll_s5}', '#{tlr_s5}'],\n ['#{sll_s6}', '#{slr_s6}', '#{tll_s6}', '#{tlr_s6}'],\n ['#{sll_s7}', '#{slr_s7}', '#{tll_s7}', '#{tlr_s7}'],\n ['#{sll_s8}', '#{slr_s8}', '#{tll_s8}', '#{tlr_s8}'],\n ['#{sll_s9}', '#{slr_s9}', '#{tll_s9}', '#{tlr_s9}'],\n ['#{sll_s10}', '#{slr_s10}', '#{tll_s10}', '#{tlr_s10}'],\n ['#{sll_s11}', '#{slr_s11}', '#{tll_s11}', '#{tlr_s11}'],\n ['#{sll_s12}', '#{slr_s12}', '#{tll_s12}', '#{tlr_s12}'],\n ['#{secondmdl_s0}', '', '#{thirdmdl_s0 }', ''],\n ['#{secondmdl_s1}', '#{secondmdr_s1}', '#{thirdmdl_s1 }', '#{thirdmdr_s1}'],\n ['#{secondmdl_s2}', '#{secondmdr_s2}', '#{thirdmdl_s2}', '#{thirdmdr_s2}'],\n ['#{secondmdl_s3}', '#{secondmdr_s3}', '#{thirdmdl_s3}', '#{thirdmdr_s3}'],\n ['#{secondmdl_s4}', '#{secondmdr_s4}', '#{thirdmdl_s4}', '#{thirdmdr_s4}'],\n ['#{secondmdl_s5}', '#{secondmdr_s5}', '#{thirdmdl_s5}', '#{thirdmdr_s5}'],\n ['#{secondmdl_s6}', '#{secondmdr_s6}', '#{thirdmdl_s6}', '#{thirdmdr_s6}'],\n ['#{secondmdl_s7}', '#{secondmdr_s7}', '#{thirdmdl_s7}', '#{thirdmdr_s7}'],\n ['#{secondmdl_s8}', '#{secondmdr_s8}', '#{thirdmdl_s8}', '#{thirdmdr_s8}'],\n ['#{secondmdl_s9}', '#{secondmdr_s9}', '#{thirdmdl_s9}', '#{thirdmdr_s9}'],\n ['#{secondmdl_s10}', '#{secondmdr_s10}', '#{thirdmdl_s10}', '#{thirdmdr_s10}'],\n ['#{secondmdl_s11}', '#{secondmdr_s11}', '#{thirdmdl_s11}', '#{thirdmdr_s11}'],\n ['#{secondstl_s0}', '', '#{thirdstl_s0}', ''],\n ['#{secondstl_s1}', '#{secondstr_s1}', '#{thirdstl_s1}', '#{thirdstr_s1}'],\n ['#{secondstl_s2}', '#{secondstr_s2}', '#{thirdstl_s2}', '#{thirdstr_s2}'],\n ['#{secondstl_s3}', '#{secondstr_s3}', '#{thirdstl_s3}', '#{thirdstr_s3}'],\n ['#{secondstl_s4}', '#{secondstr_s4}', '#{thirdstl_s4}', '#{thirdstr_s4}'],\n ['#{secondstl_s5}', '#{secondstr_s5}', '#{thirdstl_s5}', '#{thirdstr_s5}'],\n ['#{secondstl_s6}', '#{secondstr_s6}', '#{thirdstl_s6}', '#{thirdstr_s6}'],\n ['#{secondstl_s7}', '#{secondstr_s7}', '#{thirdstl_s7}', '#{thirdstr_s7}'],\n ['#{secondstl_s8}', '#{secondstr_s8}', '#{thirdstl_s8}', '#{thirdstr_s8}'],\n ['#{secondstl_s9}', '#{secondstr_s9}', '#{thirdstl_s9}', '#{thirdstr_s9}'],\n ['#{secondstl_s10}', '#{secondstr_s10}', '#{thirdstl_s10}', '#{thirdstr_s10}'],\n ['#{secondstl_s11}', '#{secondstr_s11}', '#{thirdstl_s11}', '#{thirdstr_s11}']\n ]\"\n\n self.update :gdata2 => \"[ \n ['Page Two', '', '', ''],\n ['#{rzonel_s0}', '', '#{glinel_s0}', ''],\n ['#{rzonel_s1}', '#{rzoner_s1}', '#{glinel_s1}', '#{gliner_s1}'],\n ['#{rzonel_s2}', '#{rzoner_s2}', '#{glinel_s2}', '#{gliner_s2}'],\n ['#{rzonel_s3}', '#{rzoner_s3}', '#{glinel_s3}', '#{gliner_s3}'],\n ['#{rzonel_s4}', '#{rzoner_s4}', '#{glinel_s4}', '#{gliner_s4}'],\n ['#{rzonel_s5}', '#{rzoner_s5}', '#{glinel_s5}', '#{gliner_s5}'],\n ['#{rzonel_s6}', '#{rzoner_s6}', '#{glinel_s6}', '#{gliner_s6}'],\n ['#{rzonel_s7}', '#{rzoner_s7}', '#{glinel_s7}', '#{gliner_s7}'],\n ['#{rzonel_s8}', '#{rzoner_s8}', '#{glinel_s8}', '#{gliner_s8}'],\n ['#{rzonel_s9}', '#{rzoner_s9}', '#{glinel_s9}', '#{gliner_s9}'],\n ['#{rzonel_s10}', '#{rzoner_s10}', '#{glinel_s10}', '#{gliner_s10}'],\n ['#{rzonel_s11}', '#{rzoner_s11}', '#{glinel_s11}', '#{gliner_s11}'],\n ['#{rzonel_s12}', '#{rzoner_s12}', '#{glinel_s12}', '#{gliner_s12}'],\n ['#{rzonel_s13}', '#{rzoner_s13}', '#{glinel_s13}', '#{gliner_s13}'],\n ['#{rzonel_s14}', '#{rzoner_s14}', '#{glinel_s14}', '#{gliner_s14}'],\n ['#{rzonel_s15}', '#{rzoner_s15}', '#{glinel_s15}', '#{gliner_s15}'],\n ['#{coutl_s0}', '', '#{cus1l_s0}', ''],\n ['#{coutl_s1}', '#{coutr_s1}', '#{cus1l_s1}', '#{cus1r_s1}'],\n ['#{coutl_s2}', '#{coutr_s2}', '#{cus1l_s2}', '#{cus1r_s2}'],\n ['#{coutl_s3}', '#{coutr_s3}', '#{cus1l_s3}', '#{cus1r_s3}'],\n ['#{coutl_s4}', '#{coutr_s4}', '#{cus1l_s4}', '#{cus1r_s4}'],\n ['#{coutl_s5}', '#{coutr_s5}', '#{cus1l_s5}', '#{cus1r_s5}'],\n ['#{coutl_s6}', '#{coutr_s6}', '#{cus1l_s6}', '#{cus1r_s6}'],\n ['#{coutl_s7}', '#{coutr_s7}', '#{cus1l_s7}', '#{cus1r_s7}'],\n ['#{coutl_s8}', '#{coutr_s8}', '#{cus1l_s8}', '#{cus1r_s8}'],\n ['#{coutl_s9}', '#{coutr_s9}', '#{cus1l_s9}', '#{cus1r_s9}'],\n ['#{coutl_s10}', '#{coutr_s10}', '#{cus1l_s10}', '#{cus1r_s10}'],\n ['#{coutl_s11}', '#{coutr_s11}', '#{cus1l_s11}', '#{cus1r_s11}'],\n ['#{coutl_s12}', '#{coutr_s12}', '#{cus1l_s12}', '#{cus1r_s12}'],\n ['#{coutl_s13}', '#{coutr_s13}', '#{cus1l_s13}', '#{cus1r_s13}'],\n ['#{coutl_s14}', '#{coutr_s14}', '#{cus1l_s14}', '#{cus1r_s14}'],\n ['#{coutl_s15}', '#{coutr_s15}', '#{cus1l_s15}', '#{cus1r_s15}'],\n ['#{cus2l_s0}', '', '#{self.user.s_name14}', ''],\n ['#{cus2l_s1}', '#{cus2r_s1}', '#{cuthl1}', '#{cuthr1}'],\n ['#{cus2l_s2}', '#{cus2r_s2}', '#{cuthl2}', '#{cuthr2}'],\n ['#{cus2l_s3}', '#{cus2r_s3}', '#{cuthl3}', '#{cuthr3}'],\n ['#{cus2l_s4}', '#{cus2r_s4}', '#{cuthl4}', '#{cuthr4}'],\n ['#{cus2l_s5}', '#{cus2r_s5}', '#{cuthl5}', '#{cuthr5}'],\n ['#{cus2l_s6}', '#{cus2r_s6}', '#{cuthl6}', '#{cuthr6}'],\n ['#{cus2l_s7}', '#{cus2r_s7}', '#{cuthl7}', '#{cuthr7}'],\n ['#{cus2l_s8}', '#{cus2r_s8}', '#{cuthl8}', '#{cuthr8}'],\n ['#{cus2l_s9}', '#{cus2r_s9}', '#{cuthl9}', '#{cuthr9}'],\n ['#{cus2l_s10}', '#{cus2r_s10}', '#{cuthl10}', '#{cuthr10}'],\n ['#{cus2l_s11}', '#{cus2r_s11}', '#{cuthl11}', '#{cuthr11}'],\n ['#{cus2l_s12}', '#{cus2r_s12}', '#{cuthl12}', '#{cuthr12}'],\n ['#{cus2l_s13}', '#{cus2r_s13}', '#{cuthl13}', '#{cuthr13}'],\n ['#{cus2l_s14}', '#{cus2r_s14}', '#{cuthl14}', '#{cuthr14}'],\n ['#{cus2l_s15}', '#{cus2r_s15}', '#{cuthl15}', '#{cuthr15}']\n ]\" \n end",
"def check_for_active_game\n # TODO\n end",
"def game\n fetch('games.super_mario.games')\n end",
"def load_supported_games\n @supported_game_map = InfoAvilGames.info_supported_games(@log)\n #@supported_game_map.each{|k,v| p k}\n #p @supported_game_map\n # execute require 'mygame'\n @all_games_bots.each do |botgame|\n infogame = @supported_game_map[botgame[:key]]\n if infogame != nil and infogame[:enabled] == true\n botgame[:name] = infogame[:name]\n botgame[:opt] = infogame[:opt]\n else\n @log.warn(\"Game bot key #{botgame[:key]} not enabled in game_info\")\n end\n end\n #p @all_games_bots\n end",
"def determine_winner game\n winner = game.max_by {|team| team[:score]}\n team_standings = get_team_by_name(winner)\n team_standings[:winnings] += 3\nend",
"def play\n $game.surface.+$game.white.get('Ant')\n $game.surface.+$game.black.get('Beetle')\n $game.surface.+($game.white.get('Ant'), $game.surface.bug(Hive::Color[:white], Bug::Type[:ant1]), Side::Face[:bottom_left])\n #$game.surface.+($game.black.get('Grasshopper'), $game.surface.bug(Hive::Color[:black], Bug::Type[:beetle1]), Side::Face[:bottom_left])\n $game.surface.+($game.black.get('Grasshopper'), $game.surface.bug(Hive::Color[:black], Bug::Type[:beetle1]), Side::Face[:top_right])\n $game.surface.+($game.white.get('Ant'), $game.surface.bug(Hive::Color[:white], Bug::Type[:ant2]), Side::Face[:bottom_right])\n $game.surface.+($game.black.get('Queen'), $game.surface.bug(Hive::Color[:black], Bug::Type[:grasshopper1]), Side::Face[:top_right])\n $game.surface.+($game.white.get('Queen'), $game.surface.bug(Hive::Color[:white], Bug::Type[:ant3]), Side::Face[:bottom_right])\n $game.surface.+($game.black.get('Grasshopper'), $game.surface.bug(Hive::Color[:black], Bug::Type[:queen1]), Side::Face[:top_right])\n $game.surface.+($game.white.get('Spider'), $game.surface.bug(Hive::Color[:white], Bug::Type[:queen1]), Side::Face[:bottom_center])\n $game.surface.bug(Hive::Color[:black], Bug::Type[:grasshopper2]).move(Hive::Color[:black], Bug::Type[:beetle1], Side::Face[:bottom_left])\n $game.surface.bug(Hive::Color[:white], Bug::Type[:ant2]).move(Hive::Color[:black], Bug::Type[:queen1], Side::Face[:bottom_center])\n $game.surface.+($game.black.get('Grasshopper'), $game.surface.bug(Hive::Color[:black], Bug::Type[:beetle1]), Side::Face[:top_center])\n \n # Try putting a $game.list_moves after any move directive\n\n puts \"\\n\\n=====PROOF SECTION=======================\"\n $game.surface.bug(Hive::Color[:black], Bug::Type[:beetle1]).describe\n $game.surface.bug(Hive::Color[:black], Bug::Type[:grasshopper1]).describe\n $game.surface.bug(Hive::Color[:black], Bug::Type[:grasshopper2]).describe\n $game.surface.bug(Hive::Color[:black], Bug::Type[:grasshopper3]).describe\n $game.surface.bug(Hive::Color[:black], Bug::Type[:queen1]).describe\n \n $game.surface.bug(Hive::Color[:white], Bug::Type[:ant1]).describe\n $game.surface.bug(Hive::Color[:white], Bug::Type[:ant2]).describe\n $game.surface.bug(Hive::Color[:white], Bug::Type[:ant3]).describe\n $game.surface.bug(Hive::Color[:white], Bug::Type[:queen1]).describe\n $game.surface.bug(Hive::Color[:white], Bug::Type[:spider1]).describe\n end",
"def player_stats(playername)\n\nif game_hash[:away][:players][playername]\n game_hash[:away][:players][playername]\nelse\n game_hash[:home][:players][playername]\n\nend\nend",
"def mame_each\n\t\tstatus = {}\n\t\txmlin = IO.popen(\"#{@mametarget} -listxml\")\n\n\t\tendid = 0\n\t\t\n# seriously ugly hack around Nokogiri versioning issues\n\t\tbegin\n\t\t\tendid = Nokogiri::XML::Reader::TYPE_END_ELEMENT\n\t\trescue\n\t\t\tendid = 15\n\t\tend\n\t\t\n\t\txp = Nokogiri::XML::Reader.from_io( xmlin )\n\t\twhile (xp.read)\n\t\t\tnext unless xp.name == \"game\"\n\t\t\tnext if xp.node_type == endid\n\t\t\t\n\t\t\tnode_tree = Nokogiri::XML.parse( xp.outer_xml.dup ) \n\t\t\tnext if node_tree.root.attributes[\"isbios\"]\n\t\t\tnext if @skipclone and node_tree.root.attributes[\"cloneof\"]\n\n\t\t\ttitle = node_tree.xpath(\"//game/description\").text\n\t\t\tshorttitle = title.split(/\\s\\(/)[0]\n\t\t\tshorttitle = shorttitle.split(/\\//)[0] if shorttitle.index(\"/\")\n\t\t\t\n\t\t\ttitle.strip! if title\n\t\t\tshorttitle.strip! if title\n\t\t\t\n\t\t\ttitle = @shorttitle ? shorttitle : title\n\t\t\tsetname = node_tree.root.attributes['name'].value\n\n\t\t\tres = Game.LoadSingle(title, setname, @target.pkid)\n\t\t\tres = Game.new unless res\n\t\t\t\n\t\t\tres.target = @target\n\t\t\tres.title = title\n\t\t\tres.setname = setname\n\t\t\n\t\t\tres.ctrlmask = 0\n\t\t\tres.year = node_tree.xpath(\"//game/year\").text\n\t\t\tres.year = res.year.to_i if (res.year) \n\t\t\tres.year = 0 if res.year < 1900\n\t\t\t\n\t\t\tres.manufacturer = node_tree.xpath(\"//game/manufacturer\").text\n\t\t\tres.system = \"Arcade\" # It might be possible to parse more out of the description\n\t\t\tres.family = @series[res.setname]\n\t\t\tif (@categories[res.setname])\n\t\t\t\tres.genre = @categories[res.setname][0]\n\t\t\t\tres.subgenre = @categories[res.setname][1]\n\t\t\tend\n\t\t\t\n\t\t\tdriver = node_tree.xpath(\"//game/driver\")[0]\n\t\t\t\n\t\t\tnext if (driver == nil)\n\t\t\tnext if (@onlygood and driver.attributes[\"status\"].value != \"good\")\n\n\t\t\tnode_input = node_tree.xpath(\"//game/input\")[0]\n\t\t\tres.players = node_input.attributes[\"players\"].value\n\t\t\tres.buttons = node_input.attributes[\"buttons\"]\n\t\t\tres.buttons = res.buttons == nil ? 0 : res.buttons.value\n\t\t\tres.target = @target\n\n# currently just ignored, but there can be seriously weird combinations (wheel + paddle + stick + buttons + ...)\n\t\t\tnode_input.children.each{|child|\n\t\t\t\tif (child and child.attributes[\"type\"])\n#\t\t\t\t inputlabel = convert_inputtype(child)\n#\t\t\t\t res.ctrlmask = res.ctrlmask | res.get_mask( mmask ) if inputlabel\n\t\t\t\tend \n\t\t\t}\n\n\t\t\tyield res\n\t\tend\n\tend",
"def game\n fetch('esport.games')\n end",
"def name\n @game_info['name']\n end",
"def complex(title=Wep::Default_title,all_actors=0)\n # Check for upcase conversion\n if Wep::Upcase_titles\n title.upcase!\n end\n # Load mapinfo for map name\n mapinfos = load_data(\"Data/MapInfos.rxdata\")\n # Make the filename\n if Wep::Random_file_name and Wep::Modify_game_system\n filename = Wep::Game_version+\"-\"+$game_system.random_filename+\"-\"+Wep::File_name\n else\n filename = Wep::Game_version+\"-\"+Wep::File_name\n end\n estado = open(filename, \"a\")\n estado.write(\"------------------------------------------\\n\")\n estado.write(\"||||\"+title+\"||||\")\n estado.write(\"\\n------------------------------------------\\n\") \n # Write system time\n date = \"\\nDate: \"\n date+= estado.mtime.to_s\n estado.write(date)\n \n # Write time\n @total_sec = Graphics.frame_count / Graphics.frame_rate\n hour = @total_sec / 60 / 60\n min = @total_sec / 60 % 60\n sec = @total_sec % 60\n \n text = sprintf(\"%02d:%02d:%02d\", hour, min, sec)\n tiempo = \"\\nPlaytime: \"\n tiempo+= text\n estado.write(tiempo)\n # If uses normal style\n if not Wep::Compact_style\n # Write money\n money = \"\\nMoney: \"\n money += $game_party.gold.to_s\n estado.write(money)\n # Write steps\n estado.write(\"\\nSteps: \"+$game_party.steps.to_s)\n # Write actual map(and name)\n estado.write(\"\\nMap: \"+$game_map.map_id.to_s+\" (\"+mapinfos[$game_map.map_id].name+\")\")\n # If uses compact style\n else\n # Write money\n money = \"\\nMoney: \"\n money += $game_party.gold.to_s\n estado.write(money)\n # Write steps\n estado.write(\". Steps: \"+$game_party.steps.to_s)\n # Write actual map(and name)\n estado.write(\". Map: \"+$game_map.map_id.to_s+\" (\"+mapinfos[$game_map.map_id].name+\")\")\n end\n \n # Write actors\n estado.write (\"\\n\\n\")\n # If its only for the actual group\n if all_actors == 1\n actor_id = 1\n for actor in $game_party.actors\n # If uses normal style\n if not Wep::Compact_style\n # Write actor basic Info\n estado.write (\"\\n---------------\\n\")\n estado.write(actor.name)\n estado.write (\"\\n---------------\\n\") \n estado.write($data_classes[actor.class_id].name)\n estado.write (\"\\nNv \")\n estado.write(actor.level)\n estado.write (\"\\n\") \n # If uses compact style\n else\n # Write actor basic Info\n estado.write(\"\\n------------------------\\n\"+actor.name+\" (\"+$data_classes[actor.class_id].name+\") Nv\"+actor.level.to_s+\"\\n------------------------\\n\")\n end\n \n # Write actor equipment (check if equipped)\n if Wep::Write_actor_equipment\n estado.write(\"\\n\\nEquipment:\\n\\n\")\n \n if $game_actors[actor_id].weapon_id != 0\n estado.write(\" \"+$data_system.words.weapon)\n estado.write(\": \")\n estado.write($data_weapons[$game_actors[actor_id].weapon_id].name)\n estado.write(\"\\n\")\n else\n estado.write(\" \"+$data_system.words.weapon)\n estado.write(\": \")\n estado.write(\"\\n\")\n end\n \n if $game_actors[actor_id].armor1_id != 0\n estado.write(\" \"+$data_system.words.armor1)\n estado.write(\": \")\n estado.write($data_armors[$game_actors[actor_id].armor1_id].name)\n estado.write(\"\\n\")\n else\n estado.write(\" \"+$data_system.words.armor1)\n estado.write(\": \")\n estado.write(\"\\n\")\n end \n \n if $game_actors[actor_id].armor2_id != 0\n estado.write(\" \"+$data_system.words.armor2)\n estado.write(\": \")\n estado.write($data_armors[$game_actors[actor_id].armor2_id].name)\n estado.write(\"\\n\")\n else\n estado.write(\" \"+$data_system.words.armor2)\n estado.write(\": \")\n estado.write(\"\\n\")\n end \n \n if $game_actors[actor_id].armor3_id != 0\n estado.write(\" \"+$data_system.words.armor3)\n estado.write(\": \")\n estado.write($data_armors[$game_actors[actor_id].armor3_id].name)\n estado.write(\"\\n\")\n else\n estado.write(\" \"+$data_system.words.armor3)\n estado.write(\": \")\n estado.write(\"\\n\")\n end\n \n if $game_actors[actor_id].armor4_id != 0\n estado.write(\" \"+$data_system.words.weapon)\n estado.write(\": \")\n estado.write($data_armors[$game_actors[actor_id].armor4_id].name)\n estado.write(\"\\n\")\n else\n estado.write(\" \"+$data_system.words.armor4)\n estado.write(\": \")\n estado.write(\"\\n\")\n end\n end\n \n # Write actor parameters\n if Wep::Write_actor_parameters\n # If uses normal style\n if not Wep::Compact_style\n estado.write (\"\\n\\nParameters:\\n\\n HP \") \n estado.write($game_actors[actor_id].hp)\n estado.write(\"\\\\\")\n estado.write($game_actors[actor_id].maxhp)\n estado.write(\"\\n SP \")\n estado.write($game_actors[actor_id].sp)\n estado.write(\"\\\\\")\n estado.write($game_actors[actor_id].maxsp)\n estado.write( \"\\n Str \") \n estado.write($game_actors[actor_id].base_str)\n estado.write(\"\\n Dex \") \n estado.write($game_actors[actor_id].base_dex)\n estado.write(\"\\n Agi \")\n estado.write($game_actors[actor_id].base_agi)\n estado.write(\"\\n Int \")\n estado.write($game_actors[actor_id].base_int)\n estado.write(\"\\n PDef \")\n estado.write($game_actors[actor_id].base_pdef)\n estado.write(\"\\n MDef \")\n estado.write($game_actors[actor_id].base_mdef)\n estado.write(\"\\n Atk \")\n estado.write($game_actors[actor_id].base_atk)\n estado.write(\"\\n Eva \")\n estado.write($game_actors[actor_id].base_eva)\n estado.write(\"\\n\")\n # If uses compact style\n else\n estado.write (\"\\n\\nParameters:\\n\\n HP \") \n estado.write($game_actors[actor_id].hp)\n estado.write(\"\\\\\")\n estado.write($game_actors[actor_id].maxhp)\n estado.write(\". SP \")\n estado.write($game_actors[actor_id].sp)\n estado.write(\"\\\\\")\n estado.write($game_actors[actor_id].maxsp)\n estado.write( \"\\n Str \") \n estado.write($game_actors[actor_id].base_str)\n estado.write(\". Dex \") \n estado.write($game_actors[actor_id].base_dex)\n estado.write(\". Agi \")\n estado.write($game_actors[actor_id].base_agi)\n estado.write(\"\\n Int \")\n estado.write($game_actors[actor_id].base_int)\n estado.write(\". PDef \")\n estado.write($game_actors[actor_id].base_pdef)\n estado.write(\". MDef \")\n estado.write($game_actors[actor_id].base_mdef)\n estado.write(\"\\n Atk \")\n estado.write($game_actors[actor_id].base_atk)\n estado.write(\". Eva \")\n estado.write($game_actors[actor_id].base_eva)\n estado.write(\"\\n\")\n end\n end\n \n # Write actor skills \n if Wep::Write_actor_skills\n estado.write(\"\\nSkills:\\n\\n \") \n # If uses normal style\n if not Wep::Compact_style\n for i in 0...$game_actors[actor_id].skills.size \n skill = $data_skills[$game_actors[actor_id].skills[i]]\n if skill != nil\n estado.write(skill.name+\"\\n \")\n end\n end\n # If uses compact style\n else\n c=0\n for i in 0...$game_actors[actor_id].skills.size\n skill = $data_skills[$game_actors[actor_id].skills[i]]\n if skill != nil\n if c == 0\n estado.write(skill.name+\". \") \n c += 1\n elsif c == 1\n estado.write(skill.name+\"\\n \")\n c = 0\n end\n \n end\n \n end\n \n end\n \n end\n \n \n \n \n \n \n estado.write(\"\\n\")\n actor_id += 1\n end\n \n # If is for all actors\n else\n for i in 1...$data_actors.size\n actor_id = i\n actor = $game_actors[i]\n # If uses normal style\n if not Wep::Compact_style\n # Write actor basic Info\n estado.write (\"\\n---------------\\n\")\n estado.write(actor.name)\n estado.write (\"\\n---------------\\n\") \n estado.write($data_classes[actor.class_id].name)\n estado.write (\"\\nNv \")\n estado.write(actor.level)\n estado.write (\"\\n\") \n # If uses compact style\n else\n # Write actor basic Info\n estado.write(\"\\n------------------------\\n\"+actor.name+\" (\"+$data_classes[actor.class_id].name+\") Nv\"+actor.level.to_s+\"\\n------------------------\\n\")\n end\n \n # Write actor equipment (check if equipped)\n if Wep::Write_actor_equipment\n estado.write(\"\\n\\nEquipment:\\n\\n\")\n \n if $game_actors[actor_id].weapon_id != 0\n estado.write(\" \"+$data_system.words.weapon)\n estado.write(\": \")\n estado.write($data_weapons[$game_actors[actor_id].weapon_id].name)\n estado.write(\"\\n\")\n else\n estado.write(\" \"+$data_system.words.weapon)\n estado.write(\": \")\n estado.write(\"\\n\")\n end\n \n if $game_actors[actor_id].armor1_id != 0\n estado.write(\" \"+$data_system.words.armor1)\n estado.write(\": \")\n estado.write($data_armors[$game_actors[actor_id].armor1_id].name)\n estado.write(\"\\n\")\n else\n estado.write(\" \"+$data_system.words.armor1)\n estado.write(\": \")\n estado.write(\"\\n\")\n end \n \n if $game_actors[actor_id].armor2_id != 0\n estado.write(\" \"+$data_system.words.armor2)\n estado.write(\": \")\n estado.write($data_armors[$game_actors[actor_id].armor2_id].name)\n estado.write(\"\\n\")\n else\n estado.write(\" \"+$data_system.words.armor2)\n estado.write(\": \")\n estado.write(\"\\n\")\n end \n \n if $game_actors[actor_id].armor3_id != 0\n estado.write(\" \"+$data_system.words.armor3)\n estado.write(\": \")\n estado.write($data_armors[$game_actors[actor_id].armor3_id].name)\n estado.write(\"\\n\")\n else\n estado.write(\" \"+$data_system.words.armor3)\n estado.write(\": \")\n estado.write(\"\\n\")\n end\n \n if $game_actors[actor_id].armor4_id != 0\n estado.write(\" \"+$data_system.words.weapon)\n estado.write(\": \")\n estado.write($data_armors[$game_actors[actor_id].armor4_id].name)\n estado.write(\"\\n\")\n else\n estado.write(\" \"+$data_system.words.armor4)\n estado.write(\": \")\n estado.write(\"\\n\")\n end\n end\n \n # Write actor parameters\n if Wep::Write_actor_parameters\n # If uses normal style\n if not Wep::Compact_style\n estado.write (\"\\n\\nParameters:\\n\\n HP \") \n estado.write($game_actors[actor_id].hp)\n estado.write(\"\\\\\")\n estado.write($game_actors[actor_id].maxhp)\n estado.write(\"\\n SP \")\n estado.write($game_actors[actor_id].sp)\n estado.write(\"\\\\\")\n estado.write($game_actors[actor_id].maxsp)\n estado.write( \"\\n Str \") \n estado.write($game_actors[actor_id].base_str)\n estado.write(\"\\n Dex \") \n estado.write($game_actors[actor_id].base_dex)\n estado.write(\"\\n Agi \")\n estado.write($game_actors[actor_id].base_agi)\n estado.write(\"\\n Int \")\n estado.write($game_actors[actor_id].base_int)\n estado.write(\"\\n PDef \")\n estado.write($game_actors[actor_id].base_pdef)\n estado.write(\"\\n MDef \")\n estado.write($game_actors[actor_id].base_mdef)\n estado.write(\"\\n Atk \")\n estado.write($game_actors[actor_id].base_atk)\n estado.write(\"\\n Eva \")\n estado.write($game_actors[actor_id].base_eva)\n estado.write(\"\\n\")\n # If uses compact style\n else\n estado.write (\"\\n\\nParameters:\\n\\n HP \") \n estado.write($game_actors[actor_id].hp)\n estado.write(\"\\\\\")\n estado.write($game_actors[actor_id].maxhp)\n estado.write(\". SP \")\n estado.write($game_actors[actor_id].sp)\n estado.write(\"\\\\\")\n estado.write($game_actors[actor_id].maxsp)\n estado.write( \"\\n Str \") \n estado.write($game_actors[actor_id].base_str)\n estado.write(\". Dex \") \n estado.write($game_actors[actor_id].base_dex)\n estado.write(\". Agi \")\n estado.write($game_actors[actor_id].base_agi)\n estado.write(\"\\n Int \")\n estado.write($game_actors[actor_id].base_int)\n estado.write(\". PDef \")\n estado.write($game_actors[actor_id].base_pdef)\n estado.write(\". MDef \")\n estado.write($game_actors[actor_id].base_mdef)\n estado.write(\"\\n Atk \")\n estado.write($game_actors[actor_id].base_atk)\n estado.write(\". Eva \")\n estado.write($game_actors[actor_id].base_eva)\n estado.write(\"\\n\")\n end\n end\n \n # Write actor skills \n if Wep::Write_actor_skills\n estado.write(\"\\nSkills:\\n\\n \") \n # If uses normal style\n if not Wep::Compact_style\n for i in 0...$game_actors[actor_id].skills.size \n skill = $data_skills[$game_actors[actor_id].skills[i]]\n if skill != nil\n estado.write(skill.name+\"\\n \")\n end\n end\n # If uses compact style\n else\n c=0\n for i in 0...$game_actors[actor_id].skills.size\n skill = $data_skills[$game_actors[actor_id].skills[i]]\n if skill != nil\n if c == 0\n estado.write(skill.name+\". \") \n c += 1\n elsif c == 1\n estado.write(skill.name+\"\\n \")\n c = 0\n end\n \n end\n \n end\n \n end\n \n end\n \n estado.write(\"\\n\")\n \n end\n \n end\n estado.write (\"\\n\")\n \n \n # Write normal style \n if not Wep::Compact_style\n # Write actor items\n if Wep::Write_items\n estado.write(\"--------------\\nInventary:\\n--------------\\n \") \n estado.write(\"\\nItems:\\n\\n \") \n c=0\n for i in 1...$data_items.size\n if $game_party.item_number(i) > 0\n estado.write($data_items[i].name+\": \"+$game_party.item_number(i).to_s+\"\\n \")\n end\n end\n # Write actor weapons\n estado.write(\"\\nWeapons:\\n\\n \")\n c=0\n for i in 1...$data_weapons.size\n if $game_party.weapon_number(i) > 0\n estado.write($data_weapons[i].name+\": \"+$game_party.weapon_number(i).to_s+\"\\n \")\n end\n end\n # Write actor armors\n estado.write(\"\\nArmors:\\n\\n \")\n c=0\n for i in 1...$data_armors.size\n if $game_party.armor_number(i) > 0\n estado.write($data_armors[i].name+\": \"+$game_party.armor_number(i).to_s+\"\\n \")\n end\n end\n end\n \n # Write compact style\n else\n \n # Write items\n if Wep::Write_items\n estado.write(\"--------------\\nInventary:\\n--------------\\n \") \n estado.write(\"\\nItems:\\n\\n \") \n c=0\n for i in 1...$data_items.size\n if $game_party.item_number(i) > 0\n if c == 0\n estado.write($data_items[i].name+\": \"+$game_party.item_number(i).to_s+\". \") \n c += 1\n elsif c == 1 \n estado.write($data_items[i].name+\": \"+$game_party.item_number(i).to_s+\"\\n \")\n end\n end\n end\n # Write weapons\n estado.write(\"\\nWeapons:\\n\\n \")\n c=0\n for i in 1...$data_weapons.size\n if $game_party.weapon_number(i) > 0\n if c == 0\n estado.write($data_weapons[i].name+\": \"+$game_party.weapon_number(i).to_s+\". \") \n c += 1\n elsif c == 1 \n estado.write($data_weapons[i].name+\": \"+$game_party.weapon_number(i).to_s+\"\\n \")\n end \n end\n end\n # Write armors\n estado.write(\"\\n\\nArmors:\\n\\n \")\n c=0\n for i in 1...$data_armors.size\n if $game_party.armor_number(i) > 0\n if c == 0\n estado.write($data_armors[i].name+\": \"+$game_party.armor_number(i).to_s+\". \") \n c += 1\n elsif c == 1 \n estado.write($data_armors[i].name+\": \"+$game_party.armor_number(i).to_s+\"\\n \")\n end\n end\n end\n end \n \n \n \n \n end\n estado.write (\"\\n\")\n estado.close\n end",
"def game_over(name)\n end",
"def unusual_sport; end",
"def setup_play_rule\n @neighborhood_states_play = []\n (0...@NUM_RULES_PLAY).each do |n|\n @neighborhood_states_play[n] = rand @NUM_RULE_STATES\n end\n\n @play_rule = (0..@NUM_RULE_STATES).collect {|i| false}\n @neighborhood_states_play.each do |play|\n @play_rule[play] = true\n end\n end",
"def game_score(score)\n end",
"def create_new_pg_game\n @log.debug \"bot create_new_pg_game on state #{@state_pg_create}, supported games num: #{@supported_games.size}\"\n if @state_pg_create != :submitted\n #p @supported_games\n @supported_games.each do |item|\n if item[:name] == nil\n @log.warn \"Ignore to send game creation without a name maybe it is disabled in game_info, item is #{ObjTos.stringify(item)}\"\n next\n end\n @log.debug \"Submit pg game on #{item[:name]}\"\n #msg_det = \"#{item[:name]},#{item[:stropt]}\"\n info = {\n :game => item[:name],\n :prive => {:val => false, :pin => '' },\n :class => @playfor_classment,\n :opt_game => item[:opt] \n }\n @log.debug \"auto_create_new_game, pg_create2: #{ObjTos.stringify(info)}\"\n @control_net_conn.send_create_pg2(info)\n end\n @state_pg_create = :submitted\n end\n end",
"def calc_in_game\n return unless state.mode == :creating\n calc_world_lookup\n calc_player\n end",
"def game_title\n\t\t\"#{home_team} vs. #{visitor_team}\"\n\tend",
"def game_over\n end",
"def fgame\n if @full_game == nil\n @full_game = Game.from_game_string(self.game)\n end\n @full_game\n end",
"def nasa_space_craft; end",
"def emulate_game_activity(game=nil)\n game ||= Game.first\n teams = Team.all\n\n # access all teams to all zones\n teams.each do |team|\n Zone.all.map(&:access_code).each do |code|\n GameStrategy::Context.send_code({game: game, code_string: code.show_code, user: team.users.first})\n end\n end\n\n # pass all codes of task which doesn't have access code\n teams.each do |team|\n Zone.all.map(&:tasks).flatten.select {|task| task.access_code == nil}.map(&:codes).flatten do |code|\n GameStrategy::Context.send_code({game: game, code_string: code.show_code, user: team.users.first})\n end\n end\nend",
"def get_game (name)\n @elements.each do |element|\n #return desired game if found\n if element.css('h3.product_title a').text == name\n return {\n 'title' => element.css('h3.product_title a').text ,\n 'score' => element.css('span.metascore_w').text.to_i\n }\n end\n end\n #return nil if game is not found\n return nil\n end",
"def setup_game\n\t\t@word = get_word.upcase\n\t\t@misses = []\n\t\t@hits = []\n\t\t@guesses_left = 10\n\tend",
"def home_or_away(team_name)\n game_hash[team_name][:status]\nend",
"def play_sports\n end",
"def game_setup\n end",
"def loadGame()\n\nend",
"def play_game\n puts \"Would you like to play\"\n puts \"Rock-Paper-Scissor (RPS)\" \n puts \"OR\" \n puts \"Rock-Paper-Scissor-Lizard-Spock? (RPSLS)\"\n h_line\n rule_type = check_input([\"RPS\",\"RPSLS\"])\n rules = rule_type == \"RPS\" ? RPS_Rules.new : RPSLS_Rules.new\n puts \"Ok! Let's play \" + rules.prompt + \"!\"\n h_line\n p1 = create_player(1,rules)\n p2 = create_player(2,rules)\n h_line\n puts \"Great. How many points are you playing to? (1-5)\"\n valid = [\"1\",\"2\",\"3\",\"4\",\"5\"]\n length = check_input(valid).to_i\n this_game = Game.new(p1,p2,length,rules)\n h_line\n puts \"Ok!\"\n puts rules.prompt + \":\"\n puts this_game.p1.control + \":\" +this_game.p1.name + \" > VERSUS < \" + this_game.p2.name + \":\" + this_game.p2.control\n puts \"First to \" + length.to_s + \" points wins!\"\n pause\n this_game.run_game\nend",
"def its_a_tie game\n game.each do |team|\n team_standings = get_team_by_name(team)\n team_standings[:winnings] += 1\n end\nend",
"def find_game_id( title )\n\n\t\tend",
"def simple(title=Wep::Default_title,all_actors=1)\n # Check for upcase conversion\n if Wep::Upcase_titles\n title.upcase!\n end\n # Load mapinfo for map name\n mapinfos = load_data(\"Data/MapInfos.rxdata\")\n # Make the filename\n if Wep::Random_file_name and Wep::Modify_game_system\n filename = Wep::Game_version+\"-\"+$game_system.random_filename+\"-\"+Wep::File_name\n else\n filename = Wep::Game_version+\"-\"+Wep::File_name\n end\n \n estado = open(filename, \"a\")\n estado.write(\"------------------------------------------\\n\")\n estado.write(\"||||\"+title+\"||||\")\n estado.write(\"\\n------------------------------------------\\n\") \n # Writes System time\n date = \"\\nDate: \"\n \n date+= estado.mtime.to_s\n estado.write(date)\n # Write time\n @total_sec = Graphics.frame_count / Graphics.frame_rate\n hour = @total_sec / 60 / 60\n min = @total_sec / 60 % 60\n sec = @total_sec % 60\n text = sprintf(\"%02d:%02d:%02d\", hour, min, sec)\n tiempo = \"\\nPlaytime: \"\n tiempo+= text\n estado.write(tiempo)\n # If uses normal style\n if not Wep::Compact_style\n # Write money\n money = \"\\nMoney: \"\n money += $game_party.gold.to_s\n estado.write(money)\n # Write steps\n estado.write(\"\\nSteps: \"+$game_party.steps.to_s)\n # Write actual map(and name)\n estado.write(\".\\n Map: \"+$game_map.map_id.to_s+\" (\"+mapinfos[$game_map.map_id].name+\")\")\n # If uses compact style\n else\n # Write money\n money = \"\\nMoney: \"\n money += $game_party.gold.to_s\n estado.write(money)\n # Write steps\n estado.write(\". Steps: \"+$game_party.steps.to_s)\n # Write actual map(and name)\n estado.write(\". Map: \"+$game_map.map_id.to_s+\" (\"+mapinfos[$game_map.map_id].name+\")\")\n end\n # Write actors\n estado.write (\"\\n\")\n # If its only for the actual group\n if all_actors == 1\n for actor in $game_party.actors\n # If uses normal style\n if not Wep::Compact_style\n estado.write (\"-----------------\\n\")\n estado.write(actor.name)\n estado.write (\"\\n---------------\\n\") \n estado.write($data_classes[actor.class_id].name)\n estado.write (\"\\nNv \")\n estado.write(actor.level)\n estado.write (\"\\n\") \n # If uses compact style\n else\n estado.write(\"\\n\"+actor.name+\" (\"+$data_classes[actor.class_id].name+\") Nv\"+actor.level.to_s+\"\\n\")\n end\n end\n \n # If its for all actors\n else\n for i in 1...$data_actors.size\n # If uses normal style\n if not Wep::Compact_style\n estado.write (\"-----------------\\n\")\n estado.write(actor.name)\n estado.write (\"\\n---------------\\n\") \n estado.write($data_classes[$game_actors[i].class_id].name)\n estado.write (\"\\nNv \")\n estado.write($game_actors[i].level)\n estado.write (\"\\n\") \n # If uses compact style\n else\n estado.write(\"\\n\"+$game_actors[i].name+\" (\"+$data_classes[$game_actors[i].class_id].name+\") Nv\"+$game_actors[i].level.to_s+\"\\n\")\n end\n end\n \n end\n estado.write (\"\\n\")\n estado.close\n end",
"def winter_olympics_sport; end",
"def playGame\n #start the opening of the game\n #introduce the rules, ask for human or computer etc\n self.opening()\n\n end",
"def game_meta_data\n @game_meta_data\n end",
"def game(name)\n\t\t\traise ArgumentError, 'BGGPlays::game Argument is not string' unless name.is_a? String \n\t\t\t#validates string\n\t\t\tname.to_s\n\t\t\tselect(:bg_name, name)\n\t\tend",
"def game_params\n params[:game]\n end",
"def game_params\n params[:game]\n end",
"def player_stats(name)\nhome = game_hash[:home][:players][name]\naway = game_hash[:away][:players][name]\n\nif home != nil\n home\n else\n away\nend\nend",
"def player_of_game(game)\n game.player(self)\n end",
"def load_supported_games\r\n @supported_game_map = InfoAvailableGames.info_supported_games(@log)\r\n #p @supported_game_map\r\n SETTINGS_DEFAULT_APPGUI[:games_opt] = {}\r\n @supported_game_map.each do |k, game_item|\r\n if game_item[:enabled] == true\r\n require game_item[:file_req]\r\n @log.debug(\"Game #{game_item[:name]} is enabled\")\r\n SETTINGS_DEFAULT_APPGUI[:games_opt][k] = game_item[:opt]\r\n end\r\n end\r\n end",
"def turn_report(game)\n \"your move: #{game.gamestate.your_moves.last}, \" +\n \"opponents move: #{game.gamestate.opponent_move}, \" +\n \"total score: #{game.gamestate.total_score}, \" +\n \"moves remaining: #{game.gamestate.moves_remaining}\"\n end",
"def game_name\n fetch('sword_art_online.game_name')\n end",
"def set_game\n @game = Game.includes(\n :brand, :characters, :appearances, :creators, :subgenres, :categories\n ).find(params[:id])\n end",
"def game_params\n {\n line_diff: line_diff,\n over_under_diff: over_under_diff,\n team_to_bet: find_team_to_bet,\n over_under_pick: pick_over_under,\n processed: true\n }\n end",
"def winning_team\n points_home = 0\n points_away = 0\n result = \"\"\n\n game_hash.each do |side,team|\n team.each do |specs,info|\n if specs == :players\n info.each do |player|\n if side = :home\n points_home += player[:points]\n else\n points_away += player[:points]\n end\n end\n end\n end\n end\n if points_home > points_away\n result = game_hash[:home][:team_name]\n else\n result = game_hash[:away][:team_name]\n end\n result\nend",
"def game_settings\n\t\t# ring = ['one', 'two', 'three']\n\t\tgame = Game.where(name: 'test_game').first\n\t\t@ring = game.get_ring_from_assignments\n\n\n\tend",
"def new_game(game)\n @game = game\n\t@p1 = game.getP1\n\t@p2 = game.getP2\n\t@flag = game.getFlag\n\t@map = @game.get_map\n\tupdate_background\n\tdraw_all_objects\n end",
"def selected_game\n game_type = params['neural_network_data']['game_type']\n return LottoGame if game_type == 'lotto_game'\n return MultiGame if game_type == 'multi_game'\n end",
"def player_stats(player_name)\nplayer_stats = {}\n game_hash.each do |location, attributes|\n attributes[:players].each do |player, stats|\n if player == player_name\n player_stats = stats\n end\n end\n end\n player_stats\nend",
"def currentgamemode\r\n\t\t\t@gamemode\r\n\t\tend",
"def winning_play\n {paper: [:rock, :spock], rock: [:lizard, :scissors], scissors: [:paper, :lizard], lizard: [:spock, :paper], spock: [:rock, :scissors], scratch: [:scratch]}\n end",
"def update_record game\n @wins += 1 if game.game_result == 'W'\n @losses += 1 if game.game_result == 'L'\n @ties += 1 if game.game_result == 'T'\n end",
"def player_stats(name)\n hash = game_hash\n hash.each do |location, attributes| \n attributes.each do |attribute, info| \n if info.include?(name) \n return hash[location][attribute][name]\n end\n end\n end\nend",
"def set_game_info\n @game_info = GameInfo.find(params[:id])\n end",
"def set_game\n @game = Game.find(params[:id])\n get_team_players\n @player_game_statistic=PlayerGameStatistic.new({:game_id => @game.id,:player_id=>Player.all.first.id})\n get_opponent_players\n end",
"def game_options\n @games.inject({}) do |memo, game|\n memo.merge(game.name => game.id)\n end\n end",
"def game_hash\n\tgame_hash = {\n\t\t:home => {\n\t\t\t:team_name => \"Brooklyn Nets\",\n\t\t\t:colors => [\"Black\", \"White\"],\n\t\t\t:players => {\n\t\t\t\t\"Alan Anderson\" => {:number => 0, \n\t\t\t\t\t\t\t\t\t:shoe => 16, \n\t\t\t\t\t\t\t\t\t:points => 22,\n\t\t\t\t\t\t\t\t\t:rebounds => 12,\n\t\t\t\t\t\t\t\t\t:assists => 12,\n\t\t\t\t\t\t\t\t\t:steals => 3,\n\t\t\t\t\t\t\t\t\t:blocks => 1,\n\t\t\t\t\t\t\t\t\t:slam_dunks => 1\n\t\t\t\t},\n\t\t\t\t\"Reggie Evans\" =>{:number => 30,\n\t\t\t\t\t\t\t\t :shoe => 14,\n\t\t\t\t\t\t\t\t :points => 12,\n\t\t\t\t\t\t\t\t :rebounds => 12,\n\t\t\t\t\t\t\t\t :assists => 12,\n\t\t\t\t\t\t\t\t :steals => 12,\n\t\t\t\t\t\t\t\t :blocks => 12,\n\t\t\t\t\t\t\t\t :slam_dunks => 7\n\n\t\t\t\t},\n\t\t\t\t\"Brook Lopez\" => {:number => 11,\n\t\t\t\t\t\t\t\t :shoe => 17,\n\t\t\t\t\t\t\t :points => 17,\n\t\t\t\t\t\t\t :rebounds => 19,\n\t\t\t\t\t\t\t\t :assists => 10,\n\t\t\t\t\t\t\t :steals => 3,\n\t\t\t\t\t\t\t\t :blocks => 1,\n\t\t\t\t\t\t\t\t :slam_dunks => 15\n\n\t\t\t\t},\n\t\t\t\t\"Mason Plumlee\" => {:number => 1,\n\t\t\t\t\t\t\t\t\t:shoe => 19,\n\t\t\t\t\t\t\t\t\t:points => 26,\n\t\t\t\t\t\t\t\t\t:rebounds => 12,\n\t\t\t\t\t\t\t\t\t:assists => 6,\n\t\t\t\t\t\t\t :steals => 3,\n\t\t\t\t\t\t\t\t :blocks => 8,\n\t\t\t\t\t\t\t\t :slam_dunks => 5\n\t\t\t\t},\n\t\t\t\t\"Jason Terry\" => {:number => 31,\n\t\t\t\t\t\t\t\t :shoe => 15,\n\t\t\t\t\t\t\t\t :points => 19,\n\t\t\t\t\t\t\t\t :rebounds => 2,\n\t\t\t\t\t\t\t\t :assists => 2,\n\t\t\t\t\t\t\t :steals => 4,\n\t\t\t\t\t\t\t\t :blocks => 11,\n\t\t\t\t\t\t\t\t :slam_dunks => 1\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t:away => {\n\t\t\t:team_name => \"Charlotte Hornets\",\n\t\t\t:colors => [\"Turquoise\", \"Purple\"],\n\t\t\t:players => {\n\t\t\t\t\"Jeff Adrien\" => {:number => 4,\n\t\t\t\t\t\t\t\t :shoe => 18,\n\t\t\t\t\t\t\t\t :points => 10,\n\t\t\t\t\t\t\t\t :rebounds => 1,\n\t\t\t\t\t\t\t\t :assists => 1,\n\t\t\t\t\t\t\t :steals => 2,\n\t\t\t\t\t\t\t\t :blocks => 7,\n\t\t\t\t\t\t\t\t :slam_dunks => 2\n\t\t\t\t},\n\t\t\t\t\"Bismak Biyombo\" => {:number => 0,\n\t\t\t\t\t\t\t\t\t :shoe => 16,\n\t\t\t\t\t\t\t\t\t :points => 12,\n\t\t\t\t\t\t\t\t\t :rebounds => 4,\n\t\t\t\t\t\t\t\t\t :assists => 7,\n\t\t\t\t\t\t\t :steals => 7,\n\t\t\t\t\t\t\t\t :blocks => 15,\n\t\t\t\t\t\t\t\t :slam_dunks => 10\n\t\t\t\t},\n\t\t\t\t\"DeSagna Diop\" => {:number => 2,\n\t\t\t\t\t\t\t\t :shoe => 14,\n\t\t\t\t\t\t\t\t :points => 24,\n\t\t\t\t\t\t\t\t :rebounds => 12,\n\t\t\t\t\t\t\t\t :assists => 12,\n\t\t\t\t\t\t\t :steals => 4, \n\t\t\t\t\t\t\t\t :blocks => 5,\n\t\t\t\t\t\t\t\t :slam_dunks => 5\n\t\t\t\t},\n\t\t\t\t\"Ben Gordon\" => {:number => 8,\n\t\t\t\t\t\t\t\t :shoe => 15,\n\t\t\t\t\t\t\t\t :points => 33,\n\t\t\t\t\t\t\t\t :rebounds => 3,\n\t\t\t\t\t\t\t\t :assists => 2,\n\t\t\t\t\t\t\t :steals => 1,\n\t\t\t\t\t\t\t\t :blocks => 1,\n\t\t\t\t\t\t\t\t :slam_dunks => 0\n\t\t\t\t},\n\t\t\t\t\"Brendan Haywood\" => {:number => 33,\n\t\t\t\t\t\t\t\t\t :shoe => 15,\n\t\t\t\t\t\t\t\t\t :points => 6,\n\t\t\t\t\t\t\t\t\t :rebounds => 12,\n\t\t\t\t\t\t\t\t\t :assists => 12,\n\t\t\t\t\t\t\t \t :steals => 22,\n\t\t\t\t\t\t\t\t \t :blocks => 5,\n\t\t\t\t\t\t\t\t \t :slam_dunks => 12\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\nend",
"def play\n #calls to all the methods that produce game!\n end",
"def mafia_won?(game)\n game[:win] === \"m\"\nend",
"def process\n finish_games\n level_up\n warn_level_up\n start_games\n end",
"def run(strategy, game)\n strategy.newGame\n while game.gameStatus == :KEEP_GUESSING\n #puts game\n guess = strategy.nextGuess(game)\n #puts guess\n guess.makeGuess(game)\n end\n puts game\n game.currentScore\nend",
"def player_stats(player_name, hashketball)\r\n player_name.capitalize!\r\n if hashketball[:home][:players].include?(player_name)\r\n hashketball[:home][:players][player_name][:stats]\r\n elsif hashketball[:away][:players].include?(player_name)\r\n hashketball[:away][:players][player_name][:stats]\r\n else\r\n \"No player found.\"\r\n end\r\nend",
"def winning_team\n home_score = 0\n away_score = 0\n game_hash[:home][:players].keys.each do |name|\n home_score += game_hash[:home][:players][name][:points]\n end\n game_hash[:away][:players].keys.each do |name|\n away_score += game_hash[:away][:players][name][:points]\n end\n home_score > away_score ? game_hash[:home][:team_name] : game_hash[:away][:team_name]\nend",
"def team_colors(team_name)\n if team_name == \"Brooklyn Nets\"\n game_hash[:home][:colors]\n else\n game_hash[:away][:colors]\n end\nend",
"def store_new_match(players, options, game_name)\r\n @info_match = {}\r\n pl_names = []\r\n players.each {|pl| pl_names << pl.name}\r\n @info_match[:players] = pl_names\r\n @info_match[:date] = Time.now\r\n @info_match[:giocate] = [ ] # items like { :deck => [], :first_plx => 0, :actions => [] }\r\n @info_match[:game] = {:name => \"#{game_name}\", :opt => {}\r\n }\r\n # set options of the match\r\n options.each do |k,v|\r\n @info_match[:game][:opt][k] = v\r\n end\r\n \r\n end",
"def game_info(year, input)\r\n x = get_games(year, input).sort.to_h\r\n\r\n #determine if the team did not exist during the given year\r\n if x == {}\r\n puts \"The #{self.chosen_team_full_name} did not play any games in #{year}.\"\r\n end\r\n\r\n if self.chosen_team_full_name != nil\r\n self.chosen_team_nickname = self.chosen_team_full_name.split(\" \").last\r\n end\r\n\r\n counter = 0\r\n x.each do |key, value|\r\n counter += 1\r\n if value[\"home_team\"] == @chosen_team_full_name && value[\"home_team_score\"] > value[\"visitor_team_score\"]\r\n puts \"#{value[\"date\"]} -- #{value[\"visitor_team\"]}: #{self.chosen_team_nickname} win #{value[\"home_team_score\"]} to #{value[\"visitor_team_score\"]}.\".green\r\n sleep(0.2)\r\n elsif value[\"home_team\"] == @chosen_team_full_name && value[\"home_team_score\"] < value[\"visitor_team_score\"]\r\n puts \"#{value[\"date\"]} -- #{value[\"visitor_team\"]}: #{self.chosen_team_nickname} lose #{value[\"visitor_team_score\"]} to #{value[\"home_team_score\"]}.\".colorize(:red)\r\n sleep(0.2)\r\n elsif value[\"visitor_team\"] == @chosen_team_full_name && value[\"home_team_score\"] > value[\"visitor_team_score\"]\r\n puts \"#{value[\"date\"]} -- @#{value[\"home_team\"]}: #{self.chosen_team_nickname} lose #{value[\"home_team_score\"]} to #{value[\"visitor_team_score\"]}.\".colorize(:red)\r\n sleep(0.2)\r\n elsif value[\"visitor_team\"] == @chosen_team_full_name && value[\"home_team_score\"] < value[\"visitor_team_score\"]\r\n puts \"#{value[\"date\"]} -- @#{value[\"home_team\"]}: #{self.chosen_team_nickname} win #{value[\"visitor_team_score\"]} to #{value[\"home_team_score\"]}.\".colorize(:green)\r\n sleep(0.2)\r\n end\r\n \r\n if counter % 20 == 0\r\n puts \"Type 'n' if you do not want to see more games. Otherwise press 'Enter'\"\r\n input = gets.chomp \r\n\r\n if input == \"n\"\r\n break\r\n end\r\n\r\n end\r\n\r\n end\r\n end",
"def games\n self.results.map {|r|;r.game}\n end",
"def game?\n marc_leader_06_o_r_match = %w[o r].include?(record.leader.byteslice(6))\n marc_008_33_g_match = record.fields('008').find do |field|\n field.value.byteslice(33) == 'g'\n end\n\n marc_leader_06_m_match = record.leader.byteslice(6) == 'm'\n marc_008_26_g_match = record.fields('008').find do |field|\n field.value.byteslice(26) == 'g'\n end\n\n marc_leader_06_e_f_match = %w[e f].include?(record.leader.byteslice(6))\n marc_008_33_34_n_match = record.fields('008').find do |field|\n (field.value.byteslice(33..34) || '').scrub(' ').split('').include?('n')\n end\n\n\n marc_006_match = record.fields('006').find do |field|\n (%w[o r].include?(field.value.byteslice(0)) && field.value.byteslice(16) == 'g') ||\n (field.value.byteslice(0) == 'm' && (field.value.byteslice(9) == 'g' ||\n (field.value.byteslice(16..17) || '').scrub(' ').split('').include?('n')))\n end\n\n return true if (marc_leader_06_o_r_match && marc_008_33_g_match) ||\n (marc_leader_06_m_match && marc_008_26_g_match) ||\n (marc_leader_06_e_f_match && marc_008_33_34_n_match) ||\n marc_006_match\n end",
"def onalg_new_match(players)\n #name_arr = [\"#{@name_core_game}\"]\n name_arr = []\n players.each do |pl|\n name_arr << pl.name\n end\n #str = name_arr.join(\",\")\n # options exported to the network are managed from game_inprogress instance\n # game_in_pro is hols in connection\n game_option = @nal_srv.get_options_fornewmatch \n \n str_cmd = JSON.generate([@name_core_game, name_arr, game_option])\n @player_conn.send_data( @player_conn.build_cmd(:onalg_new_match, str_cmd) )\n # notify also game in progress\n @game_inprog.onalg_new_match \n end",
"def winning_team\n home_points = 0\n away_points = 0\n result = \"\"\n i = 0\n game_hash.each do |team, about|\n about[:players].each do |name , stats|\n if i == 0\n home_points += stats[:points]\n else\n away_points += stats[:points]\n end\n end\n i += 1\n end\n home_points > away_points ? result = game_hash[:home][:team_name] : result = game_hash[:away][:team_name]\nend",
"def game_state\n\n if @A1.content == \"o\" && @A2.content == \"o\" && @A3.content == \"o\" || @A1.content == \"x\" && @A2.content == \"x\" && @A3.content == \"x\"\n @game_state_variable = true\n end\n\n # On test la 2ème ligne\n if @B1.content == \"o\" && @B2.content == \"o\" && @B3.content == \"o\" || @B1.content == \"x\" && @B2.content == \"x\" && @B3.content == \"x\"\n @game_state_variable = true\n end\n\n # On test la 3eme ligne\n if @C1.content == \"o\" && @C2.content == \"o\" && @C3.content == \"o\" || @C1.content == \"x\" && @C2.content == \"x\" && @C3.content == \"x\"\n @game_state_variable = true\n end\n\n # On test la première colone\n if @A1.content == \"o\" && @B1.content == \"o\" && @C1.content == \"o\" || @A1.content == \"x\" && @B1.content == \"x\" && @C1.content == \"x\"\n @game_state_variable = true\n end\n\n # On test le deuxième colone\n if @A2.content == \"o\" && @B2.content == \"o\" && @C2.content == \"o\" || @A2.content == \"x\" && @B2.content == \"x\" && @C2.content == \"x\"\n @game_state_variable = true\n end\n\n # On test la 3eme colone\n if @A3.content == \"o\" && @B3.content == \"o\" && @C3.content == \"o\" || @A3.content == \"x\" && @B3.content == \"x\" && @C3.content == \"x\"\n @game_state_variable = true\n end\n\n # On test la dagonale gauche\n if @A1.content == \"o\" && @B2.content == \"o\" && @C3.content == \"o\" || @A1.content == \"x\" && @B2.content == \"x\" && @C3.content == \"x\"\n @game_state_variable = true\n end\n\n # On test la diagonle droite\n if @A3.content == \"o\" && @B2.content == \"o\" && @C1.content == \"o\" || @A3.content == \"x\" && @B2.content == \"x\" && @C1.content == \"x\"\n @game_state_variable = true\n end\n\n end",
"def game_over\n @game_over\n end",
"def main()\n name_game(\"Lincoln\")\nend",
"def game_over(player)\n if @@tab[0][0].status == player && @@tab[0][1].status == player && @@tab[0][2].status == player # verifie si des points sont alignés au 1er lignes\n true\n elsif @@tab[1][0].status == player && @@tab[1][1].status == player && @@tab[1][2].status == player # verifie si des points sont alignés au 2é lignes\n true\n elsif @@tab[2][0].status == player && @@tab[2][1].status == player && @@tab[2][2].status == player # verifie si des points sont alignés au 3é lignes\n true\n elsif @@tab[0][0].status == player && @@tab[1][1].status == player && @@tab[2][2].status == player # verifie si des points sont alignés en oblique\n true\n elsif @@tab[0][2].status == player && @@tab[1][1].status == player && @@tab[2][0].status == player # verifie si des points sont alignés en oblique\n true\n elsif @@tab[0][0].status == player && @@tab[1][0].status == player && @@tab[2][0].status == player # verifie si des points sont alignés en vertical sur la colonne 1\n true\n elsif @@tab[0][1].status == player && @@tab[1][1].status == player && @@tab[2][1].status == player # verifie si des points sont alignés en vertical sur la colonne 2\n true\n elsif @@tab[0][2].status == player && @@tab[1][2].status == player && @@tab[2][2].status == player # verifie si des points sont alignés en vertical sur la colonne 3\n true\n else\n false\n end\n end",
"def game_over(player)\n if @@tab[0][0].status == player && @@tab[0][1].status == player && @@tab[0][2].status == player # verifie si des points sont alignés au 1er lignes\n true\n elsif @@tab[1][0].status == player && @@tab[1][1].status == player && @@tab[1][2].status == player # verifie si des points sont alignés au 2é lignes\n true\n elsif @@tab[2][0].status == player && @@tab[2][1].status == player && @@tab[2][2].status == player # verifie si des points sont alignés au 3é lignes\n true\n elsif @@tab[0][0].status == player && @@tab[1][1].status == player && @@tab[2][2].status == player # verifie si des points sont alignés en oblique\n true\n elsif @@tab[0][2].status == player && @@tab[1][1].status == player && @@tab[2][0].status == player # verifie si des points sont alignés en oblique\n true\n elsif @@tab[0][0].status == player && @@tab[1][0].status == player && @@tab[2][0].status == player # verifie si des points sont alignés en vertical sur la colonne 1\n true\n elsif @@tab[0][1].status == player && @@tab[1][1].status == player && @@tab[2][1].status == player # verifie si des points sont alignés en vertical sur la colonne 2\n true\n elsif @@tab[0][2].status == player && @@tab[1][2].status == player && @@tab[2][2].status == player # verifie si des points sont alignés en vertical sur la colonne 3\n true\n else\n false\n end\n end",
"def home_team_players\n home_team_players = game_hash[:home][:players]\nend",
"def load_game\n\tsettings.game_data = Ben::Game.load\n\tgame_json\nend"
] | [
"0.69384867",
"0.68055534",
"0.669947",
"0.6691355",
"0.6691355",
"0.6691355",
"0.6691355",
"0.6691355",
"0.66896605",
"0.66896605",
"0.6588429",
"0.6346782",
"0.62634933",
"0.61646825",
"0.6110487",
"0.61006546",
"0.6049994",
"0.6047262",
"0.60256773",
"0.6024613",
"0.602279",
"0.6019234",
"0.5991061",
"0.5969765",
"0.59527206",
"0.59342235",
"0.5930188",
"0.59241724",
"0.5901522",
"0.58859116",
"0.5878675",
"0.5871375",
"0.5865579",
"0.58643234",
"0.586326",
"0.5843762",
"0.5840129",
"0.5807872",
"0.5807585",
"0.5807142",
"0.57943",
"0.57600105",
"0.5732869",
"0.5710425",
"0.57039875",
"0.5693137",
"0.56925935",
"0.56858695",
"0.5683476",
"0.56794095",
"0.56729275",
"0.5672138",
"0.5671948",
"0.5670644",
"0.5660919",
"0.5660872",
"0.5659756",
"0.5646169",
"0.5643909",
"0.5643909",
"0.5635793",
"0.56326956",
"0.5632146",
"0.56200445",
"0.56194365",
"0.5612755",
"0.56101865",
"0.5587486",
"0.55841076",
"0.557794",
"0.5577358",
"0.55736154",
"0.55684185",
"0.5560097",
"0.5558466",
"0.5555809",
"0.5555627",
"0.5554633",
"0.55471325",
"0.5545994",
"0.5537628",
"0.5532879",
"0.55325943",
"0.5523577",
"0.55199635",
"0.55192983",
"0.5515833",
"0.55143666",
"0.5510881",
"0.55090326",
"0.55069155",
"0.5506721",
"0.5496687",
"0.5495121",
"0.5492595",
"0.5486818",
"0.5484822",
"0.5484822",
"0.54846776",
"0.5484108"
] | 0.5650816 | 57 |
Compare the given other quantile. | def <=>(other)
self.quantile <=> other.quantile && self.inaccuracy <=> other.inaccuracy
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compare(x,y)\n a = CachedProduct.find_by_product_id(x['product_id'].to_s)\n b = CachedProduct.find_by_product_id(y['product_id'].to_s)\n return a.max_small <=> b.max_small\n end",
"def <=>(other_bid)\n self.estimate <=> other_bid.estimate\n end",
"def >= other\n #This is a stub, used for indexing\n end",
"def compare(other)\n ::GD2::GD2FFI.send(:gdImageCompare, image_ptr, other.image_ptr)\n end",
"def <=>(other)\n # If both elements are either nil or have content, compare by quality\n # value. Otherwise, rank the element with non-nil content higher than\n # +other+.\n if [ self, other ].select{ |x| x.content.nil? }.size % 2 == 0\n self.quality_val <=> other.quality_val\n else\n self.content.nil? ? -1 : 1\n end\n end",
"def par_compare(a, b)\n if a.par_price.price > b.par_price.price\n -1\n elsif a.par_price.price < b.par_price.price\n 1\n else\n @formed.find_index(a) < @formed.find_index(b) ? -1 : 1\n end\n end",
"def <=>(other_painting)\n self.price <=> other_painting.price\n end",
"def compare(x, y); end",
"def compare(one, other)\n other_rem = other.remaining_same_calls\n one_rem = one.remaining_same_calls\n if one_rem == other_rem\n # Note: the line below is correctly reversing the operands\n # This is done to have the larger period ordered before the\n # shorter ones when the remaining hits are the same.\n other.period.granularity <=> one.period.granularity\n elsif other_rem == -1 || one_rem < other_rem\n -1\n else\n 1\n end\n end",
"def compare_method(other, val)\n # if !self.nan? and other.respond_to?(:nan?) and other.nan?\n # raise ArgumentError, \"Can't compare #{self} to NaN\", caller\n # else\n result = (self <=> other)\n return result.nil? ? nil : result == val\n # end\n end",
"def compare_f(f1, f2)\n\t\t(self.floor_number(f1) - self.floor_number(f2))\n\tend",
"def <=>(other)\n if (other.is_a?(Numeric))\n @value <=> other\n elsif(other.is_a?(Quantity) && measures == other.measures)\n @reference_value <=> other.reference_value\n else\n nil\n end\n end",
"def <=>(other)\n lcm_div = @div.lcm(other.div)\n (@val * (lcm_div / @div)) <=> (other.val * (lcm_div / other.div))\n end",
"def comparePrice(x,y)\n if x.price < y.price\n result = -1\n elsif x.price > y.price\n result = 1\n elsif x.price == y.price\n result = 0\n end\n \n # Switch when in descendant order\n case @order\n when 1\n result *= -1 \n end\n \n return result\n end",
"def eql?(other)\n return false unless other.respond_to?(:coords)\n equal = true\n self.coords.each_with_index do |c, i|\n if (c - other.coords.to_a[i])**2 > PRECISION\n equal = false\n break\n end\n end\n equal\n end",
"def quick_compare(another)\n self == another || (self.kind_of?(File) && another.kind_of?(File) && self.path == another.path)\n end",
"def >(other)\n compare_method(other, 1)\n end",
"def square_comparison(other)\n compare_on_methods(other, :square?) do\n cards_in_squares.first.rank <=> other.cards_in_squares.first.rank\n end\n end",
"def <=>(another_currency)\n\n #converts the given instance in the actual currency and compares the amounts\n @amount_bigdecimal <=> another_currency.convert_to(@currency).amount_bigdecimal\n\n end",
"def <=> other\n if other.class == HD::Ratio\n return self[0].to_f / self[1] <=> other[0].to_f / other[1]\n elsif other.is_a? Numeric\n return self.to_f <=> other\n end\n end",
"def compare( tuples, i, j )\n a, x = tuples[i][0], tuples[i][1]\n b, y = tuples[j][0], tuples[j][1]\n\n a, x, b, y, i, j = b, y, a, x, j, i if x > y\n a / b.to_f > b**((y - x) / x.to_f) ? i : j\n end",
"def ==(other)\n lcm_div = @div.lcm(other.div)\n (@val * (lcm_div / @div)) == (other.val * (lcm_div / other.div))\n end",
"def ==(other)\n a, b = self.to_f, other.to_f\n a == b\n end",
"def compare(a, b)\n if getCookie(a.getProducts).getAmount - getCookie(b.getProducts).getAmount == 0\n return (b.getId - a.getId)\n else\n return (getCookie(a.getProducts).getAmount - getCookie(b.getProducts).getAmount)\n end\nend",
"def <=>(other)\n other.fitness <=> self.fitness\n end",
"def <=>(other)\n return 0 if self.equal?(other)\n enum1, enum2 = self.to_enum, other.to_enum\n loop do\n item1 = enum1.next\n item2 = enum2.next\n comp = (item1 <=> item2)\n return comp if comp != 0\n end\n size1, size2 = self.size, other.size\n return 0 if size1 == size2\n size1 > size2 ? 1 : -1\n end",
"def >=(other); end",
"def <=>(other)\n # if SUBJECT_POINTS[self.name] > SUBJECT_POINTS[other.name]\n # return 1\n # elsif SUBJECT_POINTS[self.name] < SUBJECT_POINTS[other.name]\n # return -1\n # else\n # return 0\n # end\n # shorter way to do this :O WOW! just tell which\n # things(quantities) to compare, and rubys comparable does it for you\n # so as long as the quantities you want to compare are builtin ones,\n # just call <=> straight instead of doing the if..elsif..else\n SUBJECT_POINTS[self.name] <=> SUBJECT_POINTS[other.name]\n end",
"def <=>(other)\n NAMES.each do |name|\n result = send(name).to_i <=> other.send(name).to_i\n return result unless result.zero?\n end\n 0\n end",
"def <=>(other)\n NAMES.each do |name|\n result = send(name).to_i <=> other.send(name).to_i\n return result unless result.zero?\n end\n\n 0\n end",
"def <=>(other)\n self.comparison_criteria <=> other.comparison_criteria\n end",
"def <=>(other)\n case other\n when ::Net::FTP::List::Entry\n return filesize <=> other.filesize\n when Numeric\n return filesize <=> other\n end\n\n raise ArgumentError, format('comparison of %<self>s with %<other>s failed!', self: self.class, other: other.class)\n end",
"def <=>(other)\n if to_f < other.to_f\n -1\n elsif to_f > other.to_f\n 1\n else\n 0\n end\n end",
"def >(other)\n if other.nil?\n return true\n end\n\n [:pm, :notifications, :invitations].each do |prop|\n if send(prop) > other.send(prop) then\n return true\n end\n end\n\n return false\n end",
"def <=>(other_home)\n price <=> other_home.price\n end",
"def compare_kickers(other)\n kicker_cards.each_with_index do |kicker, i|\n other_kicker = other.kicker_cards[i]\n compared_by_kicker = kicker <=> other_kicker\n return compared_by_kicker unless compared_by_kicker == 0\n end\n 0\n end",
"def <=>(other)\n\t\t\tcomparando = [self.calculo_valor_energetico, self.gei, self.terreno]\n\t\t\tcomparador = [other.calculo_valor_energetico, other.gei, other.terreno]\n\t\t\tcomparando <=> comparador\n\t\tend",
"def <=> other\n high_place, low_place = *Player.find(self.players)\n .map { |ply| ply.place }.sort\n high_other, low_other = *Player.find(other.players)\n .map { |ply| ply.place }.sort\n cmp = low_place <=> low_other\n return cmp if cmp != 0\n cmp = high_place <=> high_other\n return cmp if cmp != 0\n return self.round <=> other.round\n end",
"def custom_compare(a, b)\n\t\[email protected] do |criterion|\n\t\t\tcomparison = apply_criterion(criterion,a,b)\n\t\t\treturn comparison unless comparison.zero?\n\t\tend\n\t\t# None of the criteria resulted in non-zero. Attempt default comparison.\n\t\tbegin\n\t\t\ttie_breaker = { :expression => :itself, :options => make_options({}) }\n\t\t\treturn apply_criterion(tie_breaker,a,b)\n\t\trescue\n\t\t\treturn 0\n\t\tend\n\tend",
"def eql(other)\n\t\traise TypeError if other.class != Player\n\t\treturn 1 if self.points > other.points\n\t\treturn -1 if self.points < other.points\n\t\treturn 0 if self.points == other.points\n\tend",
"def <=>(other)\n return super if self.class != other.class\n @pair.each_with_index do |card, i|\n compare = (other.pair[i].rank_compare card)\n return compare if compare != 0\n end\n compare_kickers(@kickers, other.kickers)\n end",
"def <=>(other)\n fitness <=> other.fitness\n end",
"def <= (object)\n if(self.to_float <= object.to_float)\n true\n end\n end",
"def <=>(other)\n if comparable_attrs.all? { |attr| send(attr) == other.send(attr) }\n if premium_tuples.to_a == other.premium_tuples.to_a\n 0\n else\n premium_tuples.to_a <=> other.premium_tuples.to_a\n end\n else\n other.updated_at.blank? || (updated_at < other.updated_at) ? -1 : 1\n end\n end",
"def greater_balance_than(other)\r\n\t\treturn @cleared_balance > other.cleared_balance\r\n\tend",
"def <=>(other)\n return if self.class != other.class\n return if self.d.nil? || other.d.nil?\n (self.b <=> other.b).nonzero? ||\n (Rational(self.n, self.d) <=> Rational(other.n, other.d))\n end",
"def approx_same_values_as?(other)\n delta = s_copy.sub(other).to_a.inject(0.0) do |result, element|\n result + element**2.0\n end\n delta < EPSILON\n end",
"def > other\n #This is a stub, used for indexing\n end",
"def <=>(other)\n (0..(self.dimension_count-1)).each do |d|\n cmp = self.value(d) <=> other.value(d)\n return cmp unless cmp == 0\n end\n self.object_id <=> other.object_id\n end",
"def >=(other)\n cmp = self.<=>(other)\n cmp == 1 || cmp.zero?\n end",
"def > (object)\n if(self.to_float>object.to_float)\n true\n end\n end",
"def <=>(other)\n cmp_x = (@x <=> other.x)\n return cmp_x unless cmp_x.zero?\n\n @y <=> other.y\n end",
"def < (object)\n if(self.to_float<object.to_float)\n true\n end\n end",
"def quick_compare(another)\n self == another || (\n (self.kind_of?(File) || self.kind_of?(Tempfile)) && \n (another.kind_of?(File) || another.kind_of?(Tempfile)) && \n self.path == another.path)\n end",
"def ==(other)\n\t\ttemp = other.convert_to(self.currency)\n\t\treturn self.amount.round(2) == temp.amount.round(2)\n\tend",
"def <=>(other) \n return nil unless other.kind_of? Energia\n @valor_ener <=> other.valor_ener\n end",
"def > (other)\n return false if other.nil?\n return false if self.equal? other\n return false if self.size < other.size\n \n return true if ( (self.name.eql? other.name) &&\n (self.size > other.size) )\n\n return true if ( (self.size == other.size) &&\n (self.cpu > other.cpu) &&\n (self.mem > other.mem) &&\n (self.category == other.category))\n\n return false\n end",
"def <=>(other)\n yDifference = (self.bottom - other.bottom).abs\n if yDifference < 0.1 ||\n (other.bottom >= self.top && other.bottom <= self.bottom) ||\n (self.bottom >= other.top && self.bottom <= other.bottom)\n self.left <=> other.left\n else\n self.bottom <=> other.bottom\n end\n end",
"def <=>(other)\n suit_order = [0,1,3,2]\n suit_compare = suit_order.index(@suit) <=> suit_order.index(other.suit)\n if suit_compare == 0\n return @value <=> other.value\n else\n return suit_compare\n end\n end",
"def greater_balance_than(other)\n return @cleared_balance > other.cleared_balance\n end",
"def <=>(other) \n return nil unless other.kind_of? Energia\n #get_valor_energetico <=> other.get_valor_energetico\n @valor_ener <=> other.valor_ener\n end",
"def compare_kickers(other)\n @kickers.zip(other.kickers) do |a_kicker, b_kicker|\n return 1 if a_kicker.index > b_kicker.index\n return -1 if a_kicker.index < b_kicker.index\n end\n return 0\n end",
"def <=>(other)\n return 0 if x == other.x && y == other.y\n\n 1\n end",
"def ==(other)\n return false unless other.is_a?(Decimal128)\n @high == other.instance_variable_get(:@high) &&\n @low == other.instance_variable_get(:@low)\n end",
"def <=>(other_money)\n if currency == other_money.currency\n self.in_cents <=> other_money.in_cents\n else\n self.in_cents <=> other_money.exchange_to(currency).in_cents\n end\n end",
"def compare_same_rank(other)\n raise NotImplementedError 'Provide an implementation of #compare_same_rank method in ancestors'\n end",
"def greater_balance_than?(other)\r\n\t\t@cleared_balance > other.cleared_balance\r\n\tend",
"def <=>(other)\n raise TypeError unless other.is_a?(Money)\n if self.base_currency != other.base_currency\n other = other.convert_to(self.base_currency)\n end\n self.amount <=> other.amount\n end",
"def <=> other\n gasto_total <=> other.gasto_total\n end",
"def <=>(other)\n cmp = self.x <=> other.x\n cmp = self.y <=> other.y if cmp == 0\n cmp = self.object_id <=> other.object_id if cmp == 0\n return cmp\n end",
"def <=>(other_currency)\n self.priority <=> other_currency.priority\n end",
"def <=>(other)\n @logger = Logger.new(\"#{Rails.root}/log/cache_read.log\")\n @logger.debug \"--sort: comparing: #{other.match_rate} vs #{@match_rate}\"\n return (other.match_rate <=> @match_rate)\n end",
"def greater_than?(other)\n # returns a boolean\n\n RANKS.index(self.rank) > RANKS.index(other.rank)\n # compares player's hand to dealer's hand\n end",
"def <=>(other)\n cmp = compare_with_height(other) \n cmp.zero? ? compare_with_width(other) : cmp\n end",
"def <=>(other)\n @total_nutricional <=> other.total_nutricional\n end",
"def <=>(other)\n self.close <=> other.close\n end",
"def <=>(other)\n self.volume <=> other.volume\n end",
"def <=>(other)\n Comparator.new.compare(left: self, right: other)\n end",
"def >= (object)\n if(self.to_float >= object.to_float)\n true\n end\n end",
"def <=>(other)\n a = [@comment ? 0 : 1, @domain, @type, @item]\n b = [other.comment ? 0 : 1, other.domain, other.type, other.item]\n\n # iterate over each pair for comparison\n [a, b].transpose.each do |cmp_a, cmp_b|\n val = cmp_a <=> cmp_b\n return val unless val == 0 || val.nil?\n end\n\n 0 # entries are equivalent\n end",
"def greater_equal(input_a, input_b, name: nil)\n input_a, input_b = check_data_types(input_a, input_b)\n _op(:greater_equal, input_a, input_b, name: name)\n end",
"def similarity(another)\n return 0.0 if @type != another.type\n similarity = Resource.compare(before, another.after) * 0.8\n similarity += @name == another.name ? 0.2 : 0\n similarity\n end",
"def <=>(other_menu)\n @price <=> other_menu.price\n end",
"def compare(pair1, pair2) # each pair in the form [base, exponent]\n Math.log(pair1[0]) * pair1[1] > Math.log(pair2[0]) * pair2[1]\nend",
"def compare(a, b)\n comparator.call a, b\n end",
"def <=>(other)\n energetic_value_Kcal <=> other.energetic_value_Kcal\n end",
"def <=> (other)\n\t\treturn nil unless other.is_a?MatrizDensa\n\t\tc1=0\n\t\tc2=0\n\t\tfor i in ([email protected]_i)\n\t\t\tfor j in ([email protected]_i)\n\t\t\t\tif(self.mat[i][j] > other.mat[i][j])\n\t\t\t\t\tc1+=1\n\t\t\t\telsif(self.mat[i][j] < other.mat[i][j])\n\t\t\t\t\tc2+=1\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\t(c1)<=>(c2)\n\tend",
"def <=>(other)\n RANKS.find_index(rank) <=> RANKS.find_index(other.rank)\n end",
"def <=>(other)\n self.rank <=> other.rank\n end",
"def <=>(other)\n return nil unless self.class === other\n return 1 unless other\n mine, theirs = balance(self.parts.dup, other.parts.dup)\n mine <=> theirs\n end",
"def compare(other)\n score = 0.0\n firstname_dist = Levenshtein.distance(normalized_firstname, other.normalized_firstname)\n lastname_dist = Levenshtein.distance(normalized_lastname, other.normalized_lastname)\n\n mod = 1.0\n if lastname_found?\n if normalized_firstname[0] == other.normalized_firstname[0]\n mod += 3.0\n if normalized_firstname.length < 3 or other.normalized_firstname.length < 3\n mod += 3.0\n end\n if lastname_dist == 0\n mod += 4.0\n end\n end\n end\n\n if normalized_firstname.length > 0 and other.normalized_firstname.length > 0\n score += 0.25 * (firstname_dist / (normalized_firstname.length.to_f) + firstname_dist / (other.normalized_firstname.length.to_f)) / mod\n end\n if normalized_lastname.length > 0 and other.normalized_lastname.length > 0\n score += 0.25 * (lastname_dist / (normalized_lastname.length.to_f) + lastname_dist / (other.normalized_lastname.length.to_f))\n end\n\n score\n end",
"def compare_coords(x1, _y1, x2, _y2)\n return x1 > x2\n end",
"def quartiles(already_sorted=false)\n a = already_sorted ? self : sort\n [a.first_quartile(true), a.median(true), a.last_quartile(true)]\n end",
"def compare_by_points(other, break_ties = true)\n diff = other.points <=> points\n return diff if diff != 0 || !break_ties\n\n diff = compare_by_highest_place(other)\n return diff if diff != 0\n\n diff = compare_by_most_recent_place(other)\n return diff if diff != 0\n\n 0\n end",
"def greater_balance_than?(other)\n @cleared_balance > other.cleared_balance\n end",
"def compare(a, b)\n #YOUR WORK HERE\n end",
"def ==(other)\n other.respond_to?(:csmiles) && (csmiles == other.csmiles)\n end",
"def factor?(other)\n s = self.base.unit.map{ |u| [u.type] * u.power }.flatten\n o = other.base.unit.map{ |u| [u.type] * u.power }.faltten\n (s - o).empty?\n end",
"def eql?(other)\n\t if other.zero?\n\t\[email protected]?\n\t elsif other.respond_to?(:units)\n\t\tif other.respond_to? :value\n\t\t @units.eql?(other.units) and @value.eql?(other.value)\n\t\telse\n\t\t other == self\n\t\tend\n\t else\n\t\[email protected]? and @value.eql?(other)\n\t end\n\tend",
"def <=>(other)\n if other.is_a? Fraction \n return self.value <=> other.value\n else\n return self.value <=> other\n end\n end"
] | [
"0.672714",
"0.653636",
"0.6266369",
"0.62450737",
"0.6161021",
"0.6111681",
"0.6029919",
"0.6018348",
"0.5986716",
"0.59852314",
"0.59165037",
"0.5907251",
"0.5905221",
"0.5869129",
"0.5858638",
"0.58572346",
"0.58527356",
"0.58451885",
"0.5836544",
"0.58184415",
"0.58070314",
"0.58069915",
"0.57947695",
"0.57552177",
"0.57531327",
"0.57454497",
"0.5703337",
"0.5684117",
"0.56836104",
"0.56766003",
"0.56755745",
"0.5674855",
"0.567233",
"0.5667237",
"0.5666132",
"0.562516",
"0.5623513",
"0.5619699",
"0.5611628",
"0.5606875",
"0.558656",
"0.55837876",
"0.55764395",
"0.5571847",
"0.55699605",
"0.55665356",
"0.55664533",
"0.5564762",
"0.5564657",
"0.55628633",
"0.5556543",
"0.5551673",
"0.55455923",
"0.5544044",
"0.55309105",
"0.55140245",
"0.55088925",
"0.5497001",
"0.54888237",
"0.5487435",
"0.5487178",
"0.54808617",
"0.54760927",
"0.54665375",
"0.54623806",
"0.5449612",
"0.54492474",
"0.5445777",
"0.5443655",
"0.5441992",
"0.54390985",
"0.54389054",
"0.54347044",
"0.5433085",
"0.543216",
"0.5430387",
"0.54271466",
"0.54255736",
"0.5421637",
"0.54188746",
"0.5409229",
"0.5406793",
"0.53995967",
"0.5395674",
"0.5394609",
"0.538279",
"0.53817713",
"0.5373366",
"0.5373284",
"0.5372922",
"0.53709894",
"0.53601474",
"0.53594446",
"0.5356261",
"0.5354754",
"0.5347774",
"0.534663",
"0.5336358",
"0.53292143",
"0.5328898"
] | 0.7366779 | 0 |
def update user = User.find_by(id: params[:id]) if (params[:status]) user.update(status: true) else user.update(status: false) end end | def create
puts user_params
user = User.new(user_params)
if user.save
render json: { user: user, status: :success }
else
render json: { status: :failure, errors: user.errors.full_messages.join('') }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_user_status\n @user = User.find params[:id]\n @user.update(user_status: params[:status])\n end",
"def update\n @user = current_user\n @user.status = params[:user][:status]\n @user.save\n redirect_to :root\n end",
"def update_status\n @user = User.find(params[:id])\n if params[:status]==\"Activate\"\n @user.update_attribute(:status,\"Active\")\n elsif params[:status]==\"Deactivate\"\n @user.update_attribute(:status,\"Deactive\")\n end\n department_id= !params[:department_id].blank? || !params[:department_id].nil? ? params[:department_id] : nil\n redirect_to(users_path(:department_id=>department_id), :notice => 'User Status has been successfully changed.')\n end",
"def change_status\n @user = User.find(params[:data])\n\n respond_to do |format|\n if @user.update_attributes(status: params[:status])\n format.json { render json: @user }\n else\n format.json { render json: @user.errors.messages, status: :unprocessable_entity }\n end\n end\n end",
"def update_status\n update_params = {status: params[:status]}\n update_params[:password] = \"\" if params[:object] == \"User\"\n\n model = params[:object].constantize\n object = model.find(params[:status_id])\n if object.update_attributes(update_params)\n render json: {success:{msg: \"Updated #{params[:object]}\", id: object.id.to_s}}\n else \n render json: {failure:{msg: object.errors.full_messages.first}}\n end\n end",
"def update\n @user = User.find(params[:id])\n ####\n @user.status = params[:user][:status] if is_admin?\n params[:user].delete(:status )\n #pp = params[:user].merge(:password => '1' )\n \n logger.info(params[:user])\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\n #LA\n #@status = current_user.statuses.find(status_params)\n\n #if (status_params) && (status_params).has_key?(:user_id)\n # (status_params).delete(:user_id) \n #end\n\n respond_to do |format|\n if @status.update(status_params)\n format.html { redirect_to statuses_url, notice: 'Status was successfully updated.' }\n format.json { render :show, status: :ok, location: @status }\n else\n format.html { render action: 'edit' }\n format.json { render json: @status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_status\n \t update_user_book = UsersBook.find(params[:id])\n \t update_user_book.status = params[:status]\n\n \t render :json => {:status => \"success\"}\n end",
"def update_status(user_id:, status:)\n path = '/users/{userId}/status'\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 status.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"status\"')\n end\n\n params = {\n status: status,\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 conditionally_update\n return true unless params[:user]\n @user.update(user_params)\n end",
"def status\n if params[:deactivate_id]\n User.update(params[:deactivate_id],:status=>\"Deactive\")\n @user=User.all\n render :update do |page|\n page.replace_html 'userlist', :partial => 'home/status_change', :object=>@user, :layout => false\n end\n else\n User.update(params[:activate_id],:status=>\"Active\")\n @user=User.all\n render :update do |page|\n page.replace_html 'userlist', :partial => 'home/status_change', :object=>@user, :layout => false\n end\n end\n end",
"def set_status\n @id=params[:id]\n @client = User.find(@id)\n @status = @client.status\n if @status == true\n @client.update_attributes(status: 'false')\n flash[:success] = \"Status upadated In-Active\"\n else\n @client.update_attributes(status: 'true')\n flash[:success] = \"Status updated Active\"\n end\n redirect_to clients_path\n end",
"def update_status\n User.find(current_user.id).update_attributes(new_user: false) if current_user && params[:ajax]\n\n render text: 'ok'\n end",
"def custom_update\n user = User.find(params[:id])\n user.update_attributes(params[:user])\n render :text => true\n end",
"def update\n if @user.update(user_params)\n render status: :ok\n else \n render status: bad_request\n end\nend",
"def update \n if @user.update(user_params)\n respond_with @user,:status=> \"updated\" \n else\n respond_with @user.errors,:status=> \"failed\" \n end\n end",
"def update\n respond_to do |format|\n if @user\n @user.active = false\n @user.pending = false\n @user.save\n end\n format.json { render json: {:status => :ok}}\n end\n end",
"def update\n ticket = Ticket.find(params[:id])\n status = params[:status]\n\n if status and ticket.update_attributes(status: status)\n render json: {\"notice\"=>\"status updated successfully to '#{status}'\"}\n else\n render json: {\"alert\"=>\"status not updated. check params.\"}\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 set_status\n\t @id=params[:id]\n\t @state = State.find(@id)\n\t @status = @state.status\n if @status == true\n @state.update_attributes(status: 'false')\n flash[:success] = \"Status upadated In-Active\"\n else\n @state.update_attributes(status: 'true')\n flash[:success] = \"Status updated Active\"\n end\n redirect_to states_path\n end",
"def set_status\n @id=params[:id]\n\t @country = Country.find(@id)\n\t @status = @country.status\n if @status == true\n \[email protected]_attributes(status: 'false')\n flash[:success] = \"Status upadated In-Active\"\n else\n @country.update_attributes(status: 'true')\n flash[:success] = \"Status update Active\"\n end\n redirect_to countries_path\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_by_id(params[:id])\n if @user == @currentUser #only allow update if it is the current user editting\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = \"User #{@user.username} was updated successfully!\"\n format.html { redirect_to(:action => 'index') }\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 else\n redirect_to(:action => \"index\")\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 respond_to do |format|\n if @status_task_user.update(status_task_user_params)\n format.html { redirect_to @status_task_user, notice: 'Status task user was successfully updated.' }\n format.json { render :show, status: :ok, location: @status_task_user }\n else\n format.html { render :edit }\n format.json { render json: @status_task_user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if can? :update, @status\n respond_to do |format|\n\n if @status.update(status_params)\n\n format.html { redirect_to @status, notice: 'Status was successfully updated.' }\n format.json { render :show, status: :ok, location: @status }\n else\n format.html { render :edit }\n format.json { render json: @status.errors, status: :unprocessable_entity }\n end\n\n end\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 self_edit_only\n @user = User.find(params[:id])\n if @user.update(update_params)\n redirect_to user_url, :notice => \"Update successful!\"\n else\n render \"edit\"\n end\n end",
"def update_status(status)\n self.status = status\n self.save! validate: false\n end",
"def notification_status\n consumer = User.find_by_id(params[:user_id])\n if consumer.update_attributes(:notification_status => params[:status],\n :call_time => params[:call_time])\n render :json=> {:success=>true}, :status=>200\n else\n render :json=> {:success=>false, :message=>\"Something wrong\"}, :status=>401\n end\n end",
"def update\n @user = User.find(params[:id])\n\n params[:user].reject!{|key, _| key.to_sym != :profile_text } if !current_user_is_admin?\n raise \"admins only\" if current_user != @user and !current_user_is_admin?\n\n if @user.update_attributes(params[:user])\n @user.update_attribute :admin, true if params[:user][:admin] == \"1\" and current_user_is_admin?\n redirect_to(user_path(@user), :notice => 'Your changes were saved.')\n else\n render :action => \"edit\"\n end\n end",
"def toggle_notification\n if params[:status].present?\n @user.update(notification_status: params[:status])\n if @user.errors.any?\n render json: user.errors.messages, status: 400\n else\n render json: { message: 'Notification status updated successfully!' }, status: 200\n end\n else\n render json: { message: 'Please set status' }, status: 400\n end\n end",
"def update\n if params[:id]\n @user = User.find(params[:id])\n else\n @user = current_user\n end\n\n respond_to do |format|\n if @user.id == current_user.id and @user.update_attributes(User.from_params(params))\n format.json { head :no_content }\n else\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 if @user && @user == current_user\n respond_to do |format|\n if @user.update_attributes(user_params)\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { render :_user }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n else\n redirect_to_index\n end\n end",
"def update\n respond_to do |format|\n @levels = levels\n @ra = Reserva.where(user_id: params[:id], status: 1)\n @r = Reserva.where(entidade_id: @user.entidade_id, status: 1)\n\n if @user.update(user_params)\n format.html { redirect_to users_url, notice: 'Atualizado com sucesso.' }\n format.json { render :show, status: :ok, location: @user }\n else\n format.html { render :edit }\n format.json { render json: '{\"msg\":\"Este já tem cadastro!\"}', status: :unprocessable_entity }\n end\n end\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 # not_found unless @user\n # @user = User.get(params[:id]) || not_found\n\n respond_to do |format|\n if @user.update(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 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_user(id:, **args)\n params = parameters(args) do\n required_params :active_flag\n optional_params :active_flag\n end\n request(:put, \"users/#{id}\", params)\n end",
"def change_task_status\n @task_status = UserTask.update_task_status(params[:user_id],params[:task_id])\n end",
"def update!(**args)\n @status = args[:status] if args.key?(:status)\n end",
"def update!(**args)\n @status = args[:status] if args.key?(:status)\n end",
"def update!(**args)\n @status = args[:status] if args.key?(:status)\n end",
"def update!(**args)\n @status = args[:status] if args.key?(:status)\n end",
"def update!(**args)\n @status = args[:status] if args.key?(:status)\n end",
"def update!(**args)\n @status = args[:status] if args.key?(:status)\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 if @user.update(user_params)\n flash[:success] = \"Profile updated\"\n redirect_to :action => 'edit'\n else\n render 'edit'\n end \n \n end",
"def update\n respond_to do |format|\n if @master_user_status.update(master_user_status_params)\n format.html { redirect_to @master_user_status}\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @master_user_status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\t# no longer needed since the before_filter actions already\n\t# initialize this variable\n @user = User.find(params[:id])\n if @user.update_attributes(user_params)\n flash[:success] = \"Profile updated\"\n redirect_to @user\n else\n render 'edit'\n end\n end",
"def toggled_status\n @users = User.find(params[:id])\n @users.status = [email protected]?\n @users.update_column(:status,@users.status)\n @users.update_column(:updated_at,Time.zone.now)\n # Update Nominee status as well \n @nominee = Nominee.find_by_user_id(params[:id])\n unless @nominee.nil?\n @nominee.status = @users.status\n @nominee.updated_at = Time.zone.now\n @nominee.save\n end\n redirect_to :back\n UserMailer.user_status_mail(@users).deliver \n end",
"def update\n @user = User.shod(params[:id])\n if @user.update(user_params)\n flash[:notice] = t('user_update')\n redirect_to user_path(@user)\n else\n render 'edit'\n end\n end",
"def update\n @status = Status.find(params[:id])\n\n respond_to do |format|\n if @status.update_attributes(params[:status])\n format.html { redirect_to @status, notice: 'Status was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @status = Status.find(params[:id])\n\n respond_to do |format|\n if @status.update_attributes(params[:status])\n format.html { redirect_to @status, notice: 'Status was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @status = Status.find(params[:id])\n\n redirect_to @status, notice: 'Status was successfully updated.'\n end",
"def update\n UserComposite.new( user_params.merge(id: params[:id]) ).update!\n render json: StatusSerializer.new(:accepted), status: :accepted\n rescue ActiveRecord::RecordInvalid => ex\n render json: UserSerializer.new( ex.record ), status: :unprocessable_entity\n end",
"def update\n @user = User.find(params[:id])\n success = false\n if (session[:user] == @user || session[:user].admin == 1)\n success = @user.update_attributes(params[:user])\n if (success && session[:user].id == @user.id)\n session[:user] = @user\n end\n end\n \n respond_to do |format|\n if success\n flash[:notice] = \"User was successfully updated.\"\n if (session[:user] == @user)\n format.html { redirect_to (posts_url) }\n else\n format.html { redirect_to (users_url) }\n end\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 if current_user.id == params[:id].to_i\n @user = User.find(params[:id])\n @user.update(user_params)\n redirect_to root_path\n else\n redirect_to :back\n end\n end",
"def update\n if (current_user?(User.find(params[:id])) || is_admin?)\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 => 'User was successfully updated.') }\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 else\n redirect_to user_path, notice: \"Access Denied\"\n end\n end",
"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_status(user)\n if user_exists?(user[:email])\n found_user = read_user(user[:email])\n raise \"Could not update user #{user[:email]}. User does not exist.\" if !found_user\n\n dn = get_DN(found_user[:cn])\n Net::LDAP.open(@ldap_conf) do |ldap|\n\n if !ldap.replace_attribute(dn, ENTITY_ATTR_MAPPING[:status], user[:status])\n raise ldap_ex(ldap, \"Could not update user status for user #{user[:email]}\")\n end\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n\n redirect_url = params.has_key?(\"admin_fxn\") ? ('/users/' + @user.id.to_s + '/edit') : '/profile'\n\n if params[\"commit\"]\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to redirect_url, notice: 'User successfully updated.' }\n format.json { head :no_content }\n else\n format.html {\n if params.has_key?(\"admin_fxn\")\n @admin_function = true\n @current_user = current_user\n render action: 'edit'\n else\n @admin_function = false\n @current_user = current_user\n render action: 'profile'\n end\n }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n else\n redirect_to redirect_url\n end\n end",
"def update\n\t\t@user = User.find(params(:id))\n\t\[email protected](user_params)\n\tend",
"def update\n @user = User.find(params[:id])\n if @user.update(user_params)\n redirect_to @user\n else\n render action: 'edit'\n end\n end",
"def update\n respond_to do |format|\n if @event_user_status.update(event_user_status_params)\n format.html { redirect_to @event_user_status, notice: 'Event user status was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event_user_status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def admin_update\n @user = User.get(params[:id])\n if @user.update(params[:user])\n flash[:success] = \"User updated\"\n else\n render 'edit'\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 setstatus!(status)\n if status == \"admin\"\n self.userstatus_id = 1\n elsif status == \"pro\"\n self.userstatus_id = 2\n elsif status == \"full\"\n self.userstatus_id = 3\n else\n self.userstatus_id = 4\n end\n end",
"def update\n if params[:id] != current_user.id && current_user.is_admin == false\n \traise \"You are not authorized to access this function\"\n end \n @user = current_user\n @user.update_attributes(params[:user])\n respond_with(@user)\n end",
"def update\n respond_to do |format|\n @user = User.where(id: params[:user][:id])[0]\n if @user.update(user_params)\n format.html { redirect_to @user, notice: 'Admin was successfully updated.' }\n format.json { render :show, status: :ok, location: @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\n @user = User.find(params[:id])\n redirect_to @user if @user.update(user_params)\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 @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 if not check_logged_in then\n return\n end\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 == current_user && @user.update_attributes(params[:user])\n flash[:notice] = '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\n if update_params[:status].to_i == 1\n Item.find_by_id(@trade.user1_item).update_attribute(:isavailable, false)\n Item.find_by_id(@trade.user2_item).update_attribute(:isavailable, false)\n end\n respond_to do |format|\n if @trade.update(update_params)\n format.html { redirect_to @trade, notice: \"Trade was successfully updated.\" }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @trade.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 render json: @user, status: :accepted, location: @user #sera? status accepted? \n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def update\n @tsp = Tsp.find(params[:id])\n if current_user.role.id == 7\n params[:tsp][:status] = 6\n end\n respond_to do |format|\n if @tsp.update_attributes(params[:tsp])\n format.html { redirect_to@tsp, notice: 'Tsp was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json:@tsp.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 if User.find_by_id(session[:user_id]).name == \"admin\"\n format.html { redirect_to(users_url, :alert => \"User #{@user.name} was successfully updated.\") }\n else\n format.html { redirect_to(admin_url, :alert => \"User #{@user.name} was successfully updated.\") }\n end\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 if @user.update(user_params)\n redirect_to @user\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 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\n if @current_user.id == params[:id].to_i && \\\n @current_user.update_attributes(params[:user])\n flash[:success] = \"profile was successfully updated\"\n redirect_to individual_path(@current_user.id)\n else\n flash[:error] = \"update error, please try again\"\n @user = @current_user\n render(:action => \"edit\")\n end\n end",
"def update_status!(user, status, in_reply_to_status_id = nil)\n self.twitagent(user.token, user.secret).update_status!(status, in_reply_to_status_id)\n\tend",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n if current_user.is_admin?\n format.html { redirect_to users_url, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { redirect_to orders_url, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n end\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 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 if current_user\n @user = User.find(params[:id])\n if (current_user.username == 'Administrator')||(current_user.username == @user.username)\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\telse\n \tredirect_to root_url, :notice => 'Uwaga! Nie masz uprawnień!'\n \tend\n else\n redirect_to :login, :notice => 'Informacja! Zaloguj się aby obejrzeć!'\n end\n end",
"def update\n user = User.find_by_id(params[:id])\n respond_to do |format|\n if user != nil\n if user.update(user_params)\n @user = user\n format.html { redirect_to user, notice: 'User was successfully updated.' }\n format.json { render :show, status: :ok, location: user }\n else\n format.html { render :edit }\n format.json { render json: user.errors, status: :unprocessable_entity }\n end\n else\n format.html { render :index }\n format.json { head :no_content, status: :bad_request }\n end\n end\n end",
"def update\n @user= User.find(params[:id])\n if @user.update_attributes(params[:user])\n flash[:notice] = \"Successfully updated abuser.\"\n redirect_to users_path\n else\n render :action => 'edit'\n end\nend",
"def update\n #finds the existing user by its params\n #@user = User.find(params[:id])\n #replced by the before_action at the top\n \n \n #updates user\n if @user.update(user_params)\n flash[:succes] = \"Your Account Was Updated Successfully\"\n redirect_to articles_path \n else\n render 'edit'\n end\n end",
"def update\n # find the user by the user id in the route params\n # (this will likely be moved to its own before method)\n @user = User.find(params[:id])\n \n if @user.update_attributes(user_params)\n flash[:success] = \"Profile updated\"\n redirect_to @user\n else\n # something went wrong, go back to the edit form with existing user info\n render 'edit'\n end # if\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",
"def update\n @user = User.find(params[:id])\n if @user.update_attributes(user_params)\n #perform the sucessful edit \n redirect_to user_path(@user)\n else\n render 'edit'\n end\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 @user = User.find_by_username(params[:id])\n\n # Only allow users to update themselves\n unless @user.id == @current_user.id\n redirect_to @user\n end\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 respond_to do |format|\n if @status.update(status_params)\n format.html { redirect_to @status, notice: 'Status was successfully updated.' }\n format.json { render :show, status: :ok, location: @status }\n else\n format.html { render :edit }\n format.json { render json: @status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @status.update(status_params)\n format.html { redirect_to @status, notice: 'Status was successfully updated.' }\n format.json { render :show, status: :ok, location: @status }\n else\n format.html { render :edit }\n format.json { render json: @status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_user\n @user = User.find_by_id(user_params[:id])\n respond_to do |format|\n if @user.update(user_params)\n format.html { redirect_to settings_url, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { redirect_to settings_url, notice: 'Failed to update user' }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.8929619",
"0.8308182",
"0.8257215",
"0.8062934",
"0.8051349",
"0.8029836",
"0.80071944",
"0.77803713",
"0.7777881",
"0.76620126",
"0.76508826",
"0.7615377",
"0.7595614",
"0.75456935",
"0.74501306",
"0.74280185",
"0.74228966",
"0.72843003",
"0.72725",
"0.7267696",
"0.72650456",
"0.72186893",
"0.717547",
"0.71735865",
"0.71348596",
"0.71316177",
"0.7122252",
"0.7122252",
"0.71212274",
"0.7116248",
"0.7112915",
"0.7104876",
"0.7103586",
"0.7100873",
"0.7100171",
"0.7099652",
"0.7099377",
"0.70981836",
"0.7096621",
"0.70934254",
"0.7089997",
"0.70846516",
"0.70846516",
"0.70846516",
"0.70846516",
"0.70846516",
"0.70846516",
"0.70762277",
"0.7075489",
"0.70753163",
"0.7067324",
"0.7058628",
"0.70532405",
"0.70495266",
"0.70495266",
"0.70483184",
"0.70474416",
"0.7043481",
"0.70397174",
"0.703758",
"0.7029853",
"0.70290494",
"0.7027047",
"0.7018936",
"0.7018594",
"0.70164716",
"0.701621",
"0.7011217",
"0.70083153",
"0.7008132",
"0.7004414",
"0.69956964",
"0.69928557",
"0.69928557",
"0.69902456",
"0.69876844",
"0.6987314",
"0.69845605",
"0.69830954",
"0.6981911",
"0.6971019",
"0.6968219",
"0.69665563",
"0.6962528",
"0.69615066",
"0.6955549",
"0.69535",
"0.69523126",
"0.69523126",
"0.6951864",
"0.69499165",
"0.6945934",
"0.6945016",
"0.6943586",
"0.693812",
"0.6936524",
"0.6931817",
"0.69261104",
"0.6923694",
"0.6923694",
"0.6919471"
] | 0.0 | -1 |
Get our sort_order. Use value from params if !nil, otherwise attempt to use session data. | def _get_sort_order
if !params[:sort_order].nil?
return params[:sort_order]
end
if !session[:sort_order].nil?
@redirect_required = true
order = session[:sort_order]
session.delete(:sort_order)
order
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_sort_order\n if flash[:sort_order]\n return flash[:sort_order]\n else\n return Hash.new()\n end\n end",
"def load_order\n\t\tparams[:order_param] ||= session[:order_param]\n\t\tsession[:order_param] = params[:order_param]\n\tend",
"def sort_for_fields(sortable)\n key = [:controller, :action].map {|k| request.path_parameters[k]}.join('/')\n session[key] ||= {}\n\n if params[:sort_by] and sortable.include? params[:sort_by].to_s\n session[key][:sort_by] = params[:sort_by]\n end\n session[key][:sort_by] ||= sortable[0]\n\n session[key][:sort_by]\n end",
"def order\n @order ||= detect_order(params[:order]) || default_order\n end",
"def sort_column\n session[:sort] = Stock.column_names.include?(params[:sort]) ? params[:sort] : session[:sort] || \"id\"\n end",
"def sort_by\n unless params[:sort].blank?\n params[:sort] if params[:sort] == 'created_at' || 'vote_score' || 'replies'\n else\n 'created_at'\n end\n end",
"def ordering\n if params[:order]\n Hash[params[:order].values.map{ |ordering|\n [COLUMNS_TO_ORDER_FIELD[ordering[\"column\"].to_i], ordering[\"dir\"].to_sym]\n }]\n elsif params[:sort]\n params[:sort]\n else\n {_score: :desc}\n end\n end",
"def sortable(default_order: {})\n # get the parameter\n sort_by = params[:sort] || params[:sort_by]\n\n if sort_by.is_a?(String)\n # split it\n sort_by_attrs = sort_by.gsub(/[^a-zA-Z0-9\\-_,]/, '').split(',')\n\n # save it\n @sortable_sort = {}\n sort_by_attrs.each do |attrb|\n if attrb.match(/^-/)\n @sortable_sort[attrb.gsub(/^-/, '')] = :desc\n else\n @sortable_sort[attrb] = :asc\n end\n end\n else\n @sortable_sort = default_order\n end\n end",
"def sort_products\n # defaults to \"name\"\n params[:sort] || \"name\"\n end",
"def sort_by\n session[:name_of_search] = nil\n\t\tif params['search'] && params['search']['result_sort']\n sort_param = params['search']['result_sort']\n\t\t\tsession[:search_sort_by] = sort_param\n\t\tend\n\t\tif params['search'] && params['search']['result_sort_direction']\n sort_param = params['search']['result_sort_direction']\n\t\t\tsession[:search_sort_by_direction] = sort_param\n\t\tend\n redirect_to :action => 'browse', :phrs => params[:phrs]\n\tend",
"def set_order( params )\n return 'desc' if (params[:order]=='asc')\n return 'asc'\n end",
"def sort_direction\n params[:direction] || \"asc\"\n end",
"def order_params\n params.has_key?(:ordering) ? get_order_params( params.require(:ordering) ) : {}\n end",
"def get_orders\n if params['order_by'].nil?\n return nil\n else\n @orderer = {params['order_by'] => params['asc']}\n orders = params['order_by']\n if !params['asc']\n orders = orders + \" desc\"\n end\n return orders\n end\n end",
"def sort\n (@params[:sort] || :created_at).to_sym\n end",
"def sort_direction\n %w[asc desc].include?(params[:sort]) ? params[:sort] : nil\n end",
"def sort_direction\n %w[asc desc].include?(params[:sort]) ? params[:sort] : nil\n end",
"def resolve_sort\n return if %w[search upload].include?(params[:controller].to_s.downcase)\n\n changed = false\n\n # Remember current search parameters.\n ss = session_section\n keys = SEARCH_KEYS\n keys += SEARCH_SORT_KEYS if params[:sort].blank?\n keys.each do |key|\n ss_key = key.to_s\n if params[key].present?\n ss[ss_key] = params[key]\n else\n ss.delete(ss_key)\n end\n end\n\n # Process the menu-generated :sort parameter.\n if (sort = params.delete(:sort))\n set_sort_params(sort)\n changed = true\n end\n\n will_redirect if changed\n end",
"def get_sorting (default_sort_key)\n \n # Allowed sort fields, can sort by only these fields (are indexed) \n sort_keys = ['name', 'a_id', 'pub_id' , 'popularity_weight', 'category', \n 'sub_category', 'interests', 'release_date', \n 'total_ratings_count', 'total_average_rating',\n 'current_ratings_count', 'current_average_rating',\n 'new_apps', 'new_free_apps', 'new_paid_apps', \n 'top_free_apps_iphone', 'top_paid_apps_iphone',\n 'top_gros_apps_iphone', 'top_free_apps_ipad',\n 'top_paid_apps_ipad', 'top_gros_apps_ipad', 'amount',\n 'pub_name']\n \n # Get the sort_by parameter if it exists, otherwise use the default\n sort_param = request.query_parameters['sort_by'] || default_sort_key\n \n # Make sure the sort parameter is in our allowed list \n sort_key = sort_param if sort_keys.include?sort_param \n return sort_key\n \n end",
"def sort_params\n @_sort_params ||=\n if params[:sort].present?\n params[:sort].split(',').each_with_object({}) do |field, hash|\n unformatted_field = @request.unformat_key(field)\n desc, field = unformatted_field.to_s.match(/^([-_])?(\\w+)$/i)[1..2]\n hash[field.to_sym] = desc.present? ? :desc : :asc\n end\n end\n end",
"def set_order\n sort = params[:sort].present? ? params[:sort] : 'id'\n # FIXME cambiar puntos por guiones para tener automagia\n if sort == 'terceros_nombre'\n sort = 'terceros.nombre'\n end\n ord = params[:order].present? ? params[:order].upcase() : 'ASC'\n @order = sort + ' ' + ord\n end",
"def sort\n @sort ||= if order_by_primary_key?\n # Default order is by id DESC\n :desc\n else\n # API defaults to DESC order if param `sort` not present\n request_context.params[:sort]&.to_sym || :desc\n end\n end",
"def sort_order\n if @sort_order\n @sort_order.upcase!\n return @sort_order if SORT_ORDERS.include?(@sort_order)\n end\n default_sort_order\n end",
"def sort_col\n params[:sort] || \"name\"\n end",
"def calc_order\n @order_by = (['name', 'popularity'].include?(params[:order_by]) ? params[:order_by] : 'popularity')\n\n order = (params[:order_name] or '').upcase\n @order_name = (!order.blank? and ['ASC', 'DESC'].include?(order)) ? order : 'ASC'\n\n order = (params[:order_popularity] or '').upcase\n @order_popularity = (!order.blank? and ['ASC', 'DESC'].include?(order)) ? order : 'ASC'\n end",
"def sort_order\n sort_string = params[:sort]\n if sort_string\n split = sort_string.split '_'\n sort_field = split[0]\n sort_dir = split[1]\n return {sort_field.to_sym => sort_dir}\n end\n return {text: :asc}\n end",
"def set_order\n unless params[:order_by]\n @order = @model.typus_order_by\n else\n @order = \"#{params[:order_by]} #{params[:sort_order]}\"\n end\n end",
"def sorting_value\n respond_to?(:ordering) ? ordering : 0\n end",
"def get_ordering_string(params)\n if not params.key?(:sort)\n ordering_string = 'created_at ASC'\n elsif params[:sort] == 'created_at'\n ordering_string = 'created_at ASC'\n elsif params[:sort] == 'rating'\n ordering_string = 'rating DESC'\n end\n return ordering_string\n end",
"def order_params\n if params[:order_by]\n order_from_params\n else\n { created_at: Sortable::DIRECTION_DESC }\n end\n end",
"def sort_params\n return [] unless params['sort_by']\n\n orders = (params['sort_order'] ? params['sort_order'].split(\",\") : [\"\"])\n sort_order = params['sort_by'].split(\",\").zip(orders).collect do |attr, order|\n next if attr.blank?\n sort_item = attr\n sort_item << \" ASC\" if order && order.downcase.start_with?(\"asc\")\n sort_item << \" DESC\" if order && order.downcase.start_with?(\"desc\")\n sort_item\n end\n sort_order.compact\n end",
"def order\n order = single_param(\"order\")\n if order.nil?\n return nil\n end\n if order.start_with?('-')\n field = order[1..-1]\n dir = \"desc\"\n else\n field = order\n dir = \"asc\"\n end\n unless ALLOWED_SORT_FIELDS.include?(field)\n @errors << %{\"#{field}\" is not a valid sort field}\n return nil\n end\n return [SORT_MAPPINGS.fetch(field, field), dir]\n end",
"def do_params_sort scope\n if self.class.custom_sort_fields[sort_column].present?\n scope = self.class.custom_sort_fields[sort_column].call scope, sort_direction\n elsif resource_class.column_names.include? sort_column\n scope.reorder(resource_class.table_name+\".\"+sort_column + \" \" + sort_direction)\n end\n end",
"def ordering_params(params)\n ordering = {}\n if params[:sort]\n sort_order = { '-' => :asc, '+' => :desc }\n\n sorted_params = params[:sort].split(',')\n sorted_params.each do |attr|\n sort_sign = attr.match?(/\\A[+-]/) ? attr.slice!(0) : '+'\n model = controller_name.classify.constantize\n if model.attribute_names.include?(attr)\n ordering[attr] = sort_order[sort_sign]\n end\n end\n end\n ordering\n end",
"def sort_order(order)\n \"#{(params[:order] || order.to_s).gsub(/[\\s;'\\\"]/,'')} #{params[:direction] == 'up' ? 'ASC' : 'DESC'}\"\n end",
"def sort_order(default)\n if params[:c].blank? && default == \"created_at\"\n \"created_at DESC\"\n elsif params[:c].blank? && default == \"total\"\n \"total DESC\"\n else\n \"#{(params[:c] || default.to_s).gsub(/[\\s;'\\\"]/,'')} #{params[:d] == 'down' ? 'DESC' : 'ASC'}\"\n end\n end",
"def set_sort_order(opts)\n opts = check_params(opts,[:orders])\n super(opts)\n end",
"def order_params\n params[:order]\n end",
"def order_params\n params[:order]\n end",
"def order\n @order ||= Order.find_by(id: session[:order_id]) if session[:order_id]\n end",
"def order(order)\n params[:sort] = if order.is_a?(Hash) then\n order.reduce([]) do |memo, obj|\n key, value = obj\n\n if (value.to_s != \"asc\" && value.to_s != \"desc\") then\n raise ArgumentError, \"Order must be either :asc or :desc\"\n end\n\n key = \"-#{key}\" if value.to_s == \"desc\"\n memo.push(key)\n end.join(\",\")\n elsif order.is_a?(String) then\n order\n end\n\n self\n end",
"def set_sort_params(sort_value)\n no_reverse = current_menu_config(:sort).dig(:reverse, :except)\n if Array.wrap(no_reverse).include?(sort_value&.to_sym)\n params.delete(:direction)\n else\n params[:direction] = is_reverse?(sort_value) ? 'desc' : 'asc'\n end\n params[:sortOrder] = ascending_sort(sort_value)\n end",
"def sort_order(default)\n\n \"#{(params[:c] || default.to_s).gsub(/[\\s;'\\\"]/,'')} #{params[:d] == 'down' ? 'DESC' : 'ASC'}\"\n\n end",
"def check_sort_options() #:nodoc:\r\n table_name = @tables.first[1]\r\n old_sort = session[table_name][:sort].to_s\r\n sort, direction = old_sort.split(' ')\r\n# sort is requested\r\n if params['sort']\r\n # reverse sort if same selected\r\n if params['sort'] == sort\r\n direction = (direction == '1') ? '-1' : '1'\r\n end\r\n direction ||= 1\r\n sort = params[:sort]\r\n session[table_name][:sort] = \"#{params['sort']} #{direction}\"\r\n session[table_name][:page] = 1\r\n end\r\n @records.sort( sort => direction.to_i ) if session[table_name][:sort]\r\n params['sort'] = nil # otherwise there is problem with other links\r\nend",
"def order_params\n params.fetch(:order, {})\n end",
"def order_params\n params.fetch(:order, {})\n end",
"def order_params\n params.fetch(:order, {})\n end",
"def order_params\n params.fetch(:order, {})\n end",
"def order_params\n params.fetch(:order, {})\n end",
"def order_params\n params.fetch(:order, {})\n end",
"def order_params\n params.fetch(:order, {})\n end",
"def default_order\n (sort_order if sort_order.present?) ||\n (sort_orders.try(:first) if sort_orders.present?) ||\n SortOrder::DEFAULT\n end",
"def validate_sort(params, default = \"\")\n return default unless valid_sort_param?(params)\n \n params[:sort].blank? ? default : params[:sort]\n end",
"def get_sort_col\n unless params[:sortby].nil?\n @sortdir = if @sortcol == params[:sortby].to_i # if same column was selected\n flip_sort_direction(@sortdir)\n else\n \"ASC\"\n end\n @sortcol = params[:sortby].to_i\n end\n # in case sort column is not set, set the defaults\n if @sortcol.nil?\n @sortcol = 0\n @sortdir = \"ASC\"\n end\n params[:is_ascending] = @sortdir.to_s.downcase != \"desc\"\n @sortdir = params[:is_ascending] ? 'ASC' : 'DESC'\n @sortcol\n end",
"def getSortingOrder #:doc:\n sorting = @default_sorting.dup\n ordering = [\"DESC\", \"ASC\", \"ASC\", \"ASC\"] # default ordering\n \n if @queryparams[:sort_by]\n # get given sort_by-values\n sorts = @queryparams[:sort_by].split(\" \")\n # get given order-values and make sure sorts.size == orders.size\n orders = Array.new(sorts.size, \"DESC\")\n if @queryparams[:order]\n orders = @queryparams[:order].split(\" \")\n if orders.size < sorts.size\n orders += Array.new(sorts.size - orders.size, \"DESC\")\n elsif orders.size > sorts.size\n orders = orders.slice(0, sorts.size)\n end\n orders.each do |o|\n if not (o.upcase == \"ASC\" or o.upcase == \"DESC\") then o = \"ASC\" end\n end \n end\n \n # first sort_by-value has to be processed last (so it gets first on the list)\n sorts = sorts.reverse\n orders = orders.reverse\n \n # check sort_by-values\n sorts.each_index do |i|\n if @sort_by.has_key?(sorts[i])\n # move the sort-attribute to first\n sort_value = @sort_by[sorts[i]]\n ind = sorting.index(\"LOWER(\" + @sort_by[sorts[i]] + \")\")\n if ind != nil\n sorting.delete_at(ind)\n ordering.delete_at(ind)\n sort_value = \"LOWER(\" + sort_value + \")\"\n end\n sorting.unshift(sort_value)\n ordering.unshift(orders[i].upcase)\n end\n end\n end\n \n #combine everything together\n returnable = sorting[0] + \" \" + ordering[0]\n sorting.each_index do |i|\n next if i == 0\n returnable += \", \" + sorting[i] + \" \" + ordering[i]\n end\n return returnable\n end",
"def user_sort_options(model) #:nodoc:\r\n table_name = (model.class == String ? model : model.to_s).underscore\r\n return nil unless session[table_name][:sort]\r\n\r\n field, direction = session[table_name][:sort].split(' ')\r\n { field.to_sym => direction.to_i }\r\nend",
"def current_sort_state(params)\n @sortable && sort_pairs(params).detect{|pair| pair[0]==self.name.to_s} || []\n end",
"def set_listing_sort_order(search_object, default_val)\n if params[:sort]\n sort_order = params[:sort].downcase\n case sort_order\n when \"manu\"\n search_object.sort_order = SortOrder::SORT_BY_MANU_ASC\n when \"manud\"\n search_object.sort_order = SortOrder::SORT_BY_MANU_DESC\n when \"size\"\n search_object.sort_order = SortOrder::SORT_BY_SIZE_ASC\n when \"sized\"\n search_object.sort_order = SortOrder::SORT_BY_SIZE_DESC\n when \"upd\"\n search_object.sort_order = SortOrder::SORT_BY_UPDATED_ASC\n when \"updd\"\n search_object.sort_order = SortOrder::SORT_BY_UPDATED_DESC\n when \"qty\"\n search_object.sort_order = SortOrder::SORT_BY_QTY_ASC\n when \"type\"\n search_object.sort_order = SortOrder::SORT_BY_TYPE_ASC\n when \"treadd\"\n search_object.sort_order = SortOrder::SORT_BY_TREADLIFE_DESC\n when \"distance\"\n search_object.sort_order = SortOrder::SORT_BY_DISTANCE_ASC\n when \"cost\"\n search_object.sort_order = SortOrder::SORT_BY_COST_PER_TIRE_ASC\n when \"costd\"\n search_object.sort_order = SortOrder::SORT_BY_COST_PER_TIRE_DESC\n when \"name\"\n search_object.sort_order = SortOrder::SORT_BY_MODEL_NAME_ASC\n when \"named\"\n search_object.sort_order = SortOrder::SORT_BY_MODEL_NAME_DESC\n when \"store\"\n search_object.sort_order = SortOrder::SORT_BY_STORE_NAME_ASC\n when \"stored\"\n search_object.sort_order = SortOrder::SORT_BY_STORE_NAME_DESC\n else\n search_object.sort_order = default_val\n end\n else\n search_object.sort_order = default_val\n end\n end",
"def order(ordering=nil)\n @options[:order] = ordering if ordering.kind_of?(String)\n end",
"def ordering_params(params)\n # For example it retrieves a list of experiences in descending order of price.\n # Within a specific price, older experiences are ordered first\n #\n # GET /api/v1/experiences?sort=-price,created_at\n # ordering_params(params) # => \"price desc, created_at asc\"\n # Experience.order(\"price desc, created_at asc\")\n #\n ordering = []\n return join_params(ordering) unless params[:sort]\n\n ordering = params[:sort].split(',').each_with_object(ordering) do |attr, memo|\n sort_sign = (attr =~ /\\A[+-]/) ? attr.slice!(0) : \"+\"\n memo << \"#{attr} #{SIGN_OPDERS[sort_sign]}\"\n end\n join_params(ordering)\n end",
"def sort_param(field_order, params_key = 'sort')\n params_key = params_key.to_s\n params_field_order = params[params_key]\n order_hash = {}\n\n if params_field_order.present?\n *fields, order = field_order.to_s.split('_')\n *params_fields, params_order = params_field_order.to_s.split('_')\n\n field = fields.join('_')\n params_field = params_fields.join('_')\n\n if field == params_field && order == params_order\n if order == 'asc'\n new_order = \"#{field}_desc\"\n else\n new_order = \"#{field}_asc\"\n end\n\n order_hash = { params_key => new_order }\n end\n end\n\n order_hash = { params_key => field_order } if order_hash.empty?\n new_params = params.deep_merge(order_hash)\n url = \"?#{new_params.to_query}\"\n url\n end",
"def parse_sorting(params, default_order_by, default_direction)\n # qsp\n order_by = params[:order_by]\n direction = params[:direction]\n\n # POST body\n order_by = params[:sorting][:order_by] if order_by.blank? && !params[:sorting].blank?\n direction = params[:sorting][:direction] if direction.blank? && !params[:sorting].blank?\n\n # set defaults if necessary\n order_by = default_order_by if order_by.blank?\n direction = default_direction if direction.blank?\n\n # ensure symbols\n order_by = CleanParams.clean(order_by) unless order_by.blank?\n direction = CleanParams.clean(direction) unless direction.blank?\n\n { order_by: order_by, direction: direction }\n end",
"def order\n unless @order\n raise \"'order' must be one of [ASC,DESC]\" if !%w(ASC DESC).include?(@config['order'].to_s.upcase)\n end\n @order ||= @config['order']\n end",
"def current_sort_field_selected\n sort_field_from_response || # as in original\n sort_field_from_params || # sort param specified\n sort_field_from_list || # sort param not specified\n default_sort_field # falls back on 'relevance'\n end",
"def ordering(order)\n ensure_valid_parameter('ordering', order, %w(ascending descending))\n @request[:ordering] = order.to_s\n self\n end",
"def sort_column\n params[:sort] || \"last_name\"\n end",
"def sort_column\n Order.column_names.include?(params[:sort]) ? params[:sort] : \"updated_at\"\n end",
"def sort_direction\n # karakter kontrol yapiliyor security icin \n %w[asc desc].include?(params[:direction]) ? params[:direction] : \"asc\" \n end",
"def sort_direction\n # karakter kontrol yapiliyor security icin \n %w[asc desc].include?(params[:direction]) ? params[:direction] : \"asc\" \n end",
"def sort_direction\n # karakter kontrol yapiliyor security icin \n %w[asc desc].include?(params[:direction]) ? params[:direction] : \"asc\" \n end",
"def sort_direction\n # karakter kontrol yapiliyor security icin \n %w[asc desc].include?(params[:direction]) ? params[:direction] : \"asc\" \n end",
"def sort_direction\n # karakter kontrol yapiliyor security icin \n %w[asc desc].include?(params[:direction]) ? params[:direction] : \"asc\" \n end",
"def sort_direction\n # karakter kontrol yapiliyor security icin \n %w[asc desc].include?(params[:direction]) ? params[:direction] : \"asc\" \n end",
"def sort_dir\n params[:sort_dir] == 'desc' ? 'desc' : 'asc'\n end",
"def sort_params(params)\n Hash[params.sort]\n end",
"def sort_params; end",
"def sort_params; end",
"def order(value)\n\t\t\tparam(\"order\", value)\n\t\tend",
"def get_sort_query\n c = get_cookie 'sort'\n if c.blank?\n if @default_sort.blank?\n c = @columns.first.id\n else\n c = @default_sort\n end\n end\n sp = c.split ' '\n ord = sp.second.blank? ? 'asc' : sp.second.downcase\n col = col_by_id sp.first\n @sort = @columns.first\n return nil if c.nil? or col.nil? or !col.sortable?\n @sort = col\n order = (ord == 'desc' ? 'DESC' : 'ASC')\n col.sort_order = order\n return col.db_fullname + \" \" + order\n end",
"def search_get_order_by(params, default)\n order_by = []\n if params[:order_by].present? && params[:order_by].is_a?(String)\n params[:order_by] = [ params[:order_by] ]\n elsif params[:order_by].blank?\n params[:order_by] = []\n end\n\n # check order\n params[:order_by].each do |value|\n raise \"Found invalid order by value #{value}. Please use 'asc' or 'desc'.\" if !value.match?(/\\A(asc|desc)\\z/i)\n\n order_by.push(value.downcase)\n end\n\n if order_by.blank?\n if default.is_a?(Array)\n order_by = default\n else\n order_by.push(default)\n end\n end\n\n order_by\n end",
"def default_sort_order\n ::Mincer.config.sorting.order_attribute\n end",
"def sort_column\n params[:sort] ? params[:sort] : \"title\"\n end",
"def get_sort_order (get_param, column_name)\r\n\t\tif params[get_param] && !params[get_param].empty?\r\n\t\t\tif params[get_param].downcase == \"asc\"\r\n\t\t\t\tif column_name.kind_of?(Array)\r\n\t\t\t\t\t\"#{column_name.join(' ASC, ')} ASC\"\r\n\t\t\t\telse\r\n\t\t\t\t\t\"#{column_name} ASC\"\r\n\t\t\t\tend\r\n\t\t\telse\r\n\t\t\t\tif column_name.kind_of?(Array)\r\n\t\t\t\t\t\"#{column_name.join(' DESC, ')} DESC\"\r\n\t\t\t\telse\r\n\t\t\t\t\t\"#{column_name} DESC\"\r\n\t\t\t\tend\r\n\t\t\tend\r\n\t\tend\r\n\tend",
"def set_sorting_cookies(oldest, newest, more_progress, less_progress)\n if oldest\n cookies.permanent[:sort_param] = 'oldest'\n elsif newest\n cookies.permanent[:sort_param] = 'newest'\n elsif more_progress\n cookies.permanent[:sort_param] = 'more_progress'\n elsif less_progress\n cookies.permanent[:sort_param] = 'less_progress' \n else\n cookies.permanent[:sort_param] = 'newest' \n end\n end",
"def sort_direction\n params[\"order\"][\"0\"][\"dir\"] == \"desc\" ? \"desc\" : \"asc\"\n end",
"def index_sort_order\n @query = {}\n @query['sort_key'] = params['sort_key'] unless params['sort_key'].blank?\n\n if @query['sort_key']&.starts_with?('-')\n \"#{@query['sort_key'].delete_prefix('-')} DESC\"\n elsif @query['sort_key'].present?\n \"#{@query['sort_key']} ASC\"\n else\n 'updated_at DESC'\n end\n end",
"def order\n @order || \"99_99\"\n end",
"def order()\n @options[:order] || DEF_LAST_ORDER\n end",
"def order_string\n \"#{params[:sort]} #{params[:direction]}\"\n end",
"def set_SortOrder(value)\n set_input(\"SortOrder\", value)\n end",
"def set_SortOrder(value)\n set_input(\"SortOrder\", value)\n end",
"def set_SortOrder(value)\n set_input(\"SortOrder\", value)\n end",
"def set_SortOrder(value)\n set_input(\"SortOrder\", value)\n end",
"def set_SortOrder(value)\n set_input(\"SortOrder\", value)\n end",
"def set_SortOrder(value)\n set_input(\"SortOrder\", value)\n end",
"def set_SortOrder(value)\n set_input(\"SortOrder\", value)\n end",
"def set_SortOrder(value)\n set_input(\"SortOrder\", value)\n end",
"def set_SortOrder(value)\n set_input(\"SortOrder\", value)\n end",
"def set_SortOrder(value)\n set_input(\"SortOrder\", value)\n end",
"def set_SortOrder(value)\n set_input(\"SortOrder\", value)\n end"
] | [
"0.7083558",
"0.7067402",
"0.6892127",
"0.6848392",
"0.67269206",
"0.650365",
"0.6478131",
"0.64460665",
"0.6431029",
"0.63801336",
"0.63588035",
"0.63559407",
"0.6354081",
"0.63501525",
"0.63417166",
"0.63299966",
"0.63299966",
"0.63255507",
"0.6297142",
"0.62957454",
"0.6279151",
"0.6275859",
"0.62420547",
"0.6229027",
"0.62182367",
"0.62070143",
"0.6205722",
"0.6203133",
"0.61755854",
"0.61170167",
"0.61144644",
"0.60896146",
"0.60643595",
"0.60572314",
"0.6052696",
"0.6043577",
"0.60281485",
"0.6023755",
"0.6023755",
"0.6018788",
"0.6001886",
"0.59872633",
"0.59722304",
"0.5962336",
"0.5929893",
"0.5929893",
"0.5929893",
"0.5929893",
"0.5929893",
"0.5929893",
"0.5929893",
"0.5918714",
"0.59043956",
"0.5901235",
"0.58980024",
"0.58753693",
"0.5867782",
"0.58149135",
"0.5813504",
"0.5812678",
"0.5790853",
"0.5777388",
"0.5774478",
"0.57637215",
"0.57607037",
"0.574267",
"0.5733936",
"0.5719811",
"0.5719811",
"0.5719811",
"0.5719811",
"0.5719811",
"0.5719811",
"0.571182",
"0.5710374",
"0.5694655",
"0.5694655",
"0.56727177",
"0.56598026",
"0.5655336",
"0.5654462",
"0.56444216",
"0.562362",
"0.5622391",
"0.56074697",
"0.5596755",
"0.5596142",
"0.5593748",
"0.558662",
"0.55827713",
"0.55827713",
"0.55827713",
"0.55827713",
"0.55827713",
"0.55827713",
"0.55827713",
"0.55827713",
"0.55827713",
"0.55827713",
"0.55827713"
] | 0.84520775 | 0 |
Get our selected_ratings. Use value from params if !nil, otherwise attempt to use session data. | def _get_selected_ratings
if !params[:ratings].nil?
return params[:ratings]
end
if !session[:ratings].nil?
@redirect_required = true
ratings = session[:ratings]
session.delete(:ratings)
ratings
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def checked_ratings\n if params[:ratings]\n params[:ratings].keys\n else\n @all_ratings\n end\n end",
"def chosen_rating?(rating)\n chosen_ratings = session[:ratings]\n return true if chosen_ratings.nil?\n chosen_ratings.include? rating\nend",
"def saved_ratings\n if params[:ratings].nil?\n if session[:saved_ratings].nil?\n @saved_ratings = all_ratings\n else\n @saved_ratings = session[:saved_ratings]\n end\n else\n @saved_ratings = []\n params[:ratings].each_key {|key| @saved_ratings.push(key)}\n end\n session[:saved_ratings] = @saved_ratings\n @saved_ratings\n end",
"def rating_params\n params[:rating]\n end",
"def rating_params\n params.fetch(:rating, {})\n end",
"def current_rating(user)\n rating = ratings.find_by(user_id: user.id)\n rating ? rating.value : 0\n end",
"def rating\n if average_rating?\n # Integerize it for now -- no fractional average ratings\n (the_ratings = ratings.average(:rating)) ? the_ratings.round : 0.0\n else\n self.old_rating.nil? ? nil : self.old_rating.rating\n end\n end",
"def rating\n return nil unless ratings.length > 0\n (ratings.average(:value) / 0.25).round * 0.25\n end",
"def show\n @movie = Movie.find(params[:id])\n @current_users_rating ||= @movie.ratings.where(user: current_user).pick(:rating)\n \n if @movie.ratings.any?\n @average_rating = @movie.ratings.average(:rating).round(2) \n @ratings_count = @movie.ratings.count(:rating)\n end\n end",
"def update_rating\n @rating = params[:value]\n @rated_user = params[:rated_user]\n @previous_rating = Rating.find_by rated_user_id: @rated_user, rating_user_id: @current_user.id\n if @previous_rating.blank?\n Rating.create(rated_user_id: @rated_user, rating_user_id: @current_user.id, value: @rating)\n else\n @previous_rating.value = @rating\n @previous_rating.save\n end\n render nothing: true, status: :ok and return\n end",
"def rating_by(user)\n\t\tratings.select{ |rating| rating.rater_id == user.id }.first if user.try(:id)\n\tend",
"def checked(rating)\n if @checked_ratings.nil?\n @checked_ratings = Movie.all_ratings\n end\n return @checked_ratings.include?(rating)\n end",
"def set_rating\n @rating = Rating.find(params[:id])\n end",
"def set_rating\n @rating = Rating.find(params[:id])\n end",
"def set_rating\n @rating = Rating.find(params[:id])\n end",
"def set_rating\n @rating = Rating.find(params[:id])\n end",
"def set_rating\n @rating = Rating.find(params[:id])\n end",
"def set_rating\n @rating = Rating.find(params[:id])\n end",
"def set_rating\n @rating = Rating.find(params[:id])\n end",
"def set_rating\n @rating = Rating.find(params[:id])\n end",
"def set_rating\n @rating = Rating.find(params[:id])\n end",
"def set_rating\n @rating = Rating.find(params[:id])\n end",
"def set_rating\n @rating = Rating.find(params[:id])\n end",
"def set_rating\n @rating = Rating.find(params[:id])\n end",
"def set_rating\n @rating = Rating.find(params[:id])\n end",
"def set_rating\n @rating = Rating.find_by_name(params[:id])\n end",
"def set_rating\n @rating = Rating.find(params[:id])\n end",
"def set_rating\n @rating = Rating.find(params[:id])\n end",
"def getAvgUserStarRating(u)\n return (getAvgUserNumberRating(u) != \"None\") ? reviewRating(getAvgUserNumberRating(u)) : \"No ratings\".html_safe\n end",
"def find_by_rating(ratings, options={})\n find_all_by_rating(ratings, options.update(:limit => 1)).first || nil\n end",
"def rating(options = { })\n if @acts_as_rateable_average_rating.nil? or options[:force_reload]\n @acts_as_rateable_average_rating = Rating.send(:with_exclusive_scope) {\n Rating.find(:first, \n # :select => \"AVG(rating) AS average_rating\", \n :select => \"(SUM(rating * weight) / SUM(weight)) AS average_rating\",\n :conditions => rateable_conditions).average_rating.to_f\n }\n\n end\n @acts_as_rateable_average_rating\n end",
"def users_rating\n @rating = Rating.find(params[:id])\n redirect_to skate_spot_path(@skate_spot) unless @rating.user_id == current_user.id\n end",
"def getUserStarRating(u, e)\n return (getUserRating(u, e) != \"None\") ? reviewRating(getUserRating(u, e)) : \"None\".html_safe\n end",
"def rating_by(user_id, opts = {})\n rating = ratings.find_by_user_id(user_id, :conditions => opts)\n rating ? rating.score : nil\n end",
"def rating\r\n\t\t@rating\r\n\tend",
"def index\n #### first call: /movies ####\n #if params[:id] == nil and params[:ratings] == nil and session == nil\n # parametros = Movie.allratingvalues\n # sortorder = \"rating\"\n #end\n #### from show ####\n if (params[:id] == nil) and (params[:ratings] == nil) and ((session[:ratings] != nil) or (session[:order] != nil))then\n session[:message] = \"from show\"\n if session[:ratings] != nil then\n parametros = session[:ratings].each_key\n end\n if session[:order] != nil then\n sortorder = session[:order]\n end\n end\n ###### call from sort: choose stored ratings otherwise \n if (params[:ratings] != nil)\n parametros = params[:ratings].each_key\n end\n #### copy params ratings to session\n if params[:ratings] != nil then\n session.delete(:ratings)\n session[:ratings] = {}\n params[:ratings].each do |pr|\n session[:ratings].store(pr[0],pr[1])\n end\n end\n if params[:id] != nil\n sortorder = params[:id]\n session[:order] = sortorder\n end\n if (params[:id] == nil) and (params[:ratings] == nil)\n sortorder = session[:order]\n end\n if parametros == nil\n parametros = Movie.allratingvalues.each\n end\n if sortorder == nil\n if (session[:order] != nil)\n sortorder = session[:order]\n else\n sortorder = \"rating\"\n end\n end\n session[:order] = sortorder\n #@movies = Movie.find(:all,:conditions => [\"rating IN (?)\", parametros],:order => \"#{params[:id]}\")\n @movies = Movie.find(:all,:conditions => [\"rating IN (?)\", parametros],:order => sortorder)\n end",
"def rating\n return @rating\n end",
"def rating_by(user)\n user_rating = rating && rating.user_ratings.find_by_user_id(user.id)\n user_rating ? user_rating.score : nil\n end",
"def getAvgStarRating(e)\n return (getAvgRating(e) != \"None\") ? reviewRating(getAvgRating(e)) : \"No ratings\".html_safe\n end",
"def rating\n @rating\n end",
"def index\n @all_ratings = Movie.ratingsVar\n\n #The set of ifs that will handle the ratings tags from the index.html. Will filter accordingly.\n if params[:ratings]\n @ratings = params[:ratings]\n session[:ratings] = params[:ratings].keys #set session keys\n @movies = Movie.where(rating: params[:ratings].keys) #filtering\n else\n @ratings = session[:ratings] #load the session keys.\n @movies = Movie.where(rating: @ratings)\n end\n \n #The set of ifs that will handle sorting. If a hyperlink is clicked, it will sent :sort tags to tell us what to do.\n if params[:sort] == 'title'\n @movies = @movies.order('title ASC')\n @title_hilighter = 'hilite'\n session[:sort] = params[:sort]\n elsif params[:sort] == 'release_date'\n @movies = @movies.order('release_date ASC') \n @rdate_hilighter = 'hilite'\n session[:sort] = params[:sort]\n elsif session[:sort] == 'title' #Load session keys\n @movies = @movies.order('title ASC')\n @title_hilighter = 'hilite'\n elsif session[:sort] == 'release_date' #Load session keys\n @movies = @movies.order('release_date ASC')\n @rdate_hilighter = 'hilite'\n end\n \n #if params[:sort] == 'title'\n # @movies = @trimmed_movies.order('title ASC')\n # @title_hilighter = 'hilite'\n #elsif params[:sort] == 'release_date'\n # @movies = @trimmed_movies.order('release_date ASC')\n # @rdate_hilighter = 'hilite'\n #else\n # @movies = @trimmed_movies\n #end\n \n \n #session[:sort] = params[:sort]\n #session[:rating] = params[:ratings]\n \n end",
"def rating\n return @rating if @rating\n result = PublicEarth::Db::Collection.one.rating(self.id)\n @rating = { :average_rating => result['average_rating'].to_f, :rating_count => result['rating_count'].to_i } rescue nil\n end",
"def index\n #Get from session if params is not set\n if !params.key?(:sort) and session.key?(:sort)\n params[:sort] = session[:sort]\n end\n if !params.key?(:ratings) and session.key?(:ratings)\n params[:ratings] = session[:ratings]\n end\n \n if params.key?(:sort) and params.key?(:ratings)\n selectRatingsWithSort(params[:sort], params[:ratings])\n \n elsif params.key?(:sort) \n sortMovies(params[:sort])\n \n elsif params.key?(:ratings)\n selectRatings(params[:ratings])\n \n else\n @movies = Movie.all\n end\n #update the session\n if params.key?(:ratings); session[:ratings] = params[:ratings] end\n if params.key?(:sort); session[:sort] = params[:sort] end\n \n #set all_rating member\n listRating\n end",
"def rating\n # review = Review.where(user_id: user.id, video_id: video.id).first\n #review = Review.find_by(user_id: user.id, video_id: video.id)\n review.rating if review\n end",
"def get_random_rating\n ratings = [\n ['Low Unsatisfactory', 2], \n ['High Unsatisfactory', 3], \n ['Low Satisfactory', 10], \n ['Mid Satisfactory', 15], \n ['High Satisfactory', 20], \n ['Low Advanced', 25], \n ['High Advanced', 25]\n ]\n wChooseUsingRand(@rand, ratings)\n end",
"def default_values\n rating = 0\n if user_id.nil?\n user_id = User.find(1)\n end\n end",
"def rating\n cached_rating\n end",
"def set_game_rating\n @game_rating = GameRating.find(params[:id])\n end",
"def rating\n r = Rating.create_from_database(rating_id.to_i)\n r.rating\n end",
"def ratings\n Birdman::Requester.get(\"movies/#{id}/ratings\")\n end",
"def rating_checked?(rating)\n @selected_ratings.has_key?(rating)\n end",
"def rating #Getter\n @rating\n end",
"def user_rating(user_id)\n if user_rated?(user_id)\n @user_ratings.select { |user_rating| user_rating.user_id == user_id }.first.rating\n else\n 0\n end\n end",
"def rating\n rating_calculator.rate(raters)\n end",
"def rating_params\n params.require(:rating).permit(:value)\n end",
"def show\r\n rating = Rating.where(rater_id: current_user.id, ratee_id: params[:id]).first\r\n render json: rating\r\n end",
"def show\n @current_selection = params[:current_selection] or \"activities\"\n end",
"def rating_params\n params.require(:rating).permit(:value1, :value2, :value3, :value4, :value5, :user_id, :place_id)\n end",
"def set_rating_score\n @rating_score = RatingScore.find(params[:id])\n end",
"def reviews_and_rating_params\n params.fetch(:reviews_and_rating, {})\n end",
"def show\n @recipe = Recipe.find(params[:id])\n @page_title = \"#{@recipe.name}\"\n session[:recipe_id] = @recipe.id\n @rating = @recipe.ratings.find_by(user_id: session[:user_id])\n end",
"def show\n @recipe = Recipe.find(params[:id])\n @page_title = \"#{@recipe.name}\"\n session[:recipe_id] = @recipe.id\n @rating = @recipe.ratings.find_by(user_id: session[:user_id])\n end",
"def rating\n response[\"rating\"]\n end",
"def rating_params\n params.require(:rating).permit(:user_id, :rate, :answer_id)\n end",
"def show\n @rating = UserRating.where(movie_id: @movie.id).average(:rating)\n if @rating\n @rating = @rating.round(1)\n else\n @rating = 0\n end\n end",
"def show\n @dev = User.find(params[:id])\n @ratings = RatingService::get_ratings(@dev)\n end",
"def set_player_session_load\n player_session_load = @player_rpe_rating * @participated_in_full_practice\n return player_session_load\n end",
"def rating(m)\n return @rating_list[m].rating unless @rating_list[m] == nil\n return 0\n end",
"def box_checked?(rating)\n if(session[:ratings] == nil) # All boxes checked initially\n return true\n else\n return session[:ratings].include?(rating)\n end\n end",
"def rating(user_id, movie_id) \n movie_list = reviews_hash[user_id.to_i].transpose\n index = movie_list[0].index(movie_id.to_i)\n if index.nil?\n return 0\n else\n return movie_list[1][index]\n end\n end",
"def index\n if params[:show_only]\n @movies = current_user.ratings.where(value: params[:show_only]).map{|r| r.movie}\n else\n @movies = Movie.all\n end\n end",
"def rating_params\n params.require(:rating).permit(\"food\", \"drinks\", \"talks\", \"vibe\")\n end",
"def review_stars(review)\n {\n active: review.rating,\n blank: Review::RATINGS.last - review.rating\n }\n end",
"def rating_params\n params.require(:rating).permit(:rating, :user_id, :post_id)\n end",
"def user_drink_rating(drink_id)\n @user_drink_rating = UserBeerRating.where(user_id: self.id, beer_id: drink_id)\n if !@user_drink_rating.blank?\n @user_average_rating = (@user_drink_rating.average(:user_beer_rating).to_f).round(1)\n if @user_average_rating >= 10.0\n @final_rating = 10\n else\n @final_rating = @user_average_rating\n end\n else\n @final_rating = nil\n end\n @final_rating\n end",
"def rating\n review.rating if review\n end",
"def rating\n rating_id.get_object.name\n end",
"def rating(user_id, movie_id)\n training_set.usr_map[user_id][movie_id].nil? ? 0 : training_set.usr_map[user_id][movie_id]\n end",
"def getUserRating(u, e)\n if !hasReviewed(u, e)\n return \"None\"\n else\n return Event.find_by(id: e).reviews.find_by(user_id: u).rating\n end\n end",
"def rating (user, movie)\n\t\tif @train_data.has_key?(user) && @train_data[user].return_rating(movie)\n\t\t\treturn @train_data[user].return_rating(movie)\n\t\telse\n\t\t\treturn 0\n\t\tend\n\tend",
"def show\n @product = Product.find(params[:id])\n if current_user.present?\n if current_user.rating_reviews.where(product_id: @product.id).any?\n @rating_review = current_user.rating_reviews.where(product_id: @product.id).first\n else\n @rating_review = RatingReview.new\n end\n else\n @rating_review = RatingReview.new\n end\n\n end",
"def ratings\n @ratings.collect do |rating|\n rating = rating.to_s.downcase\n rv = nil\n Kijkwijzer::POSSIBLE_RATINGS.each do |pr|\n rv = pr[:value] if (rating == pr[:value] or rating == pr[:code])\n end\n rv\n end.compact\n end",
"def user_question_rate_params\n params[:user_question_rate]\n end",
"def user_rating(book_id)\n user_rating = Rating.where(\"book_id = ? AND user_id = ?\",book_id,current_user.id)\n if user_rating.empty?\n return 0\n end\n return user_rating[0].stars\n end",
"def current_originality_rating\n if self.get_upvotes(:vote_scope => 'rate_originality').size > 0\n self.get_likes(:vote_scope => 'rate_originality').sum(:vote_weight) / self.get_upvotes(:vote_scope => 'rate_originality').size\n else\n \"no ratings yet\"\n end\n end",
"def average_rating\n rating && rating.average_rating || 0.0\n end",
"def set_movie_user_recommendation\n @recommendation ||= MovieUserRecommendation.find(params[:id])\n end",
"def rating(user_id, movie_id) \n \tmovie_list = reviews_hash[user_id.to_i]\n \tif movie_list.nil?\n \t\tputs \"No such user\"\n \t\texit(0)\n \tend\n \tmovie_list = movie_list.transpose\n\n \tindex = movie_list[0].index(movie_id.to_i)\n\n \tif index.nil?\n \t\treturn 0.0\n \telse\n \t\treturn movie_list[1][index]\n \tend\n end",
"def rate\n if Rating.find(:first, :conditions =>{:user_id => current_user.id, :rateable_id => current_object.id, :rateable_type => current_object.class.to_s})\n #TODO TRANSLATE AND DISPLAY CORRECT MESSAGE IN blank.js\n message = \"Already Rated\"\n else\n current_object.add_rating(Rating.new(:rating => params[:rated].to_i,:user_id => current_user.id))\n current_object.update_attributes(:rates_average => Rating.average(:rating, :conditions =>{:rateable_id => current_object.id, :rateable_type => current_object.class.to_s}).to_i)\n message = \"Rated Successfully\"\n end\n\t\t\t\t# TODO : refresh the rate box ...\n render :text => message\n end",
"def apply_voter_specific\n if @voter_id.present?\n user = User.find(@voter_id) if @voter_id.present?\n @query = @query.approved unless user.moderator?\n @votings = Voting.where(user: user, votable: @query).pluck(:votable_id, :value).to_h\n else\n @query = @query.approved\n @votings = []\n end\n end",
"def update\n if logged_in?\n @user = current_user\n @rating = Rating.where(user_id: @user.id, movie_id: params[:movie_id]).first\n respond_to do |format|\n if @rating.update(user_id: @user.id, movie_id: params[:movie_id], rating: params[:rating])\n format.json { render json: @rating }\n else\n format.json { render json: @rating.errors, status: :unprocessable_entity }\n end\n end\n else\n format.json { head :no_content }\n end\n end",
"def overall_rating\n overall_rating = 0.0\n rparams = params[:review]\n if rparams # sometimes ajax calls come in before dom is ready, it seems\n rparams = review_params(params).reject{|key,val| [\"excerpts_attributes\"].include?(key)}\n # For mini-reviews, since we don't display the trust question, we cannot use\n # the source rating value in computing the overall rating!\n if rparams[:form_version] =~ /mini/ && params[:source_ratings]\n rparams[:source_review] = SourceReview.new(:rating_attributes => params[:source_ratings]) \n end\n temp_review = Review.new(rparams)\n new_processed_ratings = Ratings::process(temp_review, true, nil)\n overall_rating = new_processed_ratings[0]['overall'] || 0.0\n end\n render :inline => {:rating => (\"%.1f\" % overall_rating), :percent => ((overall_rating.to_f / 5) * 100).to_i}.to_json\n end",
"def set_reviews_and_rating\n @reviews_and_rating = ReviewsAndRating.find(params[:id])\n end",
"def rating_params\n params.require(:rating).permit(:rank, :fragrance_id, :user_id)\n end",
"def sanitize_rating\n params[:rating].to_s.dup.sub!(/\\s*[^0-9]*\\z/, '') unless params[:feedback_review] && params[:feedback_review][:rating].blank?\n end",
"def rating(user_id, movie_id)\n\t\t@all_users[user_id].rating movie_id\n\tend",
"def place_rating_params\n params.fetch(:place_rating, {})\n end",
"def avg_ratings_for(rateable, *args)\n\n if !flash[:jqstar_js]\n flash[:jqstar_js] = \"\"\n end\n\n options = args.extract_options!\n\n flash[:jqstar_js] += avg_ratings_js(rateable, options)\n\n out = content_tag(:span, \"\", {:id=>\"stars-cap-avg-#{options[:dimension].to_s}\"})\n\n divon = content_tag(:div, \"\", {:id=>\"stars-cap-avg-on-#{options[:dimension].to_s}\",\n :class=>\"stars-on\"\n })\n\n out += content_tag(:div, divon, {:id=>\"stars-cap-avg-off-#{options[:dimension].to_s}\",\n :class=>\"stars-off\",\n :style=>\"width:#{options[:width]}\"\n })\n end",
"def rating(user, movie)\n\t\tif @user_info[user].has_key?(movie)\n\t\t\treturn @user_info[user][movie]\n\t\telse\n\t\t\treturn 0\n\t\tend\n\tend",
"def rating(picpost)\n picture_rating = PictureRating.find_by_user_id_and_picpost_id(self.id, picpost.id)\n return picture_rating.nil? ? nil : picture_rating.rating\n end"
] | [
"0.6881069",
"0.67163396",
"0.6652119",
"0.62522113",
"0.61347204",
"0.5864441",
"0.57380277",
"0.567731",
"0.56674206",
"0.5629044",
"0.55183303",
"0.55139434",
"0.55000854",
"0.55000854",
"0.55000854",
"0.5490598",
"0.5490598",
"0.5490598",
"0.5490598",
"0.5490598",
"0.5490598",
"0.5490598",
"0.5490598",
"0.5490598",
"0.5490598",
"0.5473722",
"0.547317",
"0.54259783",
"0.542586",
"0.54080886",
"0.540418",
"0.53792495",
"0.5374003",
"0.5373136",
"0.53685606",
"0.53593093",
"0.5307763",
"0.52650875",
"0.52366936",
"0.5236416",
"0.5212345",
"0.5201385",
"0.5192684",
"0.51912385",
"0.5161956",
"0.5156404",
"0.51525575",
"0.5133958",
"0.51327384",
"0.512022",
"0.51042724",
"0.51014346",
"0.50995725",
"0.50941396",
"0.5089528",
"0.5087885",
"0.50749815",
"0.5063009",
"0.5056408",
"0.5047756",
"0.5043844",
"0.5043844",
"0.5034824",
"0.50315017",
"0.50288826",
"0.50256234",
"0.5021656",
"0.5018738",
"0.50056416",
"0.49855334",
"0.49831763",
"0.49629897",
"0.49614412",
"0.4960673",
"0.4958088",
"0.49573708",
"0.49458954",
"0.49456808",
"0.49290726",
"0.4920898",
"0.49195796",
"0.49004203",
"0.48997208",
"0.4899507",
"0.48960027",
"0.48891035",
"0.4876583",
"0.48508793",
"0.48489588",
"0.48487508",
"0.48370272",
"0.48284325",
"0.48246688",
"0.48223758",
"0.48183766",
"0.4818081",
"0.4817866",
"0.4795285",
"0.4792353",
"0.47893593"
] | 0.9041133 | 0 |
this finds both the precincts that explicitly use this ballot drop location and the precincts that use it implicitly, because they are in the same locality and do not specify a ballot drop location | def precincts
precs = precincts_builtin + Precinct.find(:all,
:joins => "LEFT JOIN ballot_drop_locations_precincts jointable
ON jointable.precinct_id = precincts.id",
:conditions => ["jointable.ballot_drop_location_id IS NULL AND
precincts.locality_id = ?", self.locality_id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def onsite_holdings\n holdings.select do |holding|\n !is_offsite_location_code?(holding[:location_code])\n # !LOCATIONS['offsite_locations'].include? holding[:location_code]\n end\n end",
"def pickup_locations\n # Borrow Direct requests need to provide a library-specific BD code, provided here\n bd_codes = {\n '7c5abc9f-f3d7-4856-b8d7-6712462ca007' => 'F', # Africana\n 'ab1fce49-e832-41a4-8afc-7179a62332e2' => 'I', # Catherwood ILR\n 'b232d619-3441-4fd0-b94c-210002e1fbec' => 'G', # Annex\n '041d6c8d-20a1-4fd7-8588-458286782aea' => 'B', # Law\n '4752a822-380b-446c-860f-bccf641d7118' => 'C', # Mann\n '1a072083-330f-4e1b-afa6-1ef15e24e3c3' => 'Q', # Math\n 'e2f7ad76-ef2a-454f-8fd4-712caaa0f72b' => 'O', # Uris\n '23b28dd9-cd7b-4ac1-a19a-6f4d3fce77d8' => 'E', # Vet\n '86932cca-3b71-4d29-b0e9-0680b1fffabf' => 'H', # Fine Arts\n '8eba8e43-90ae-4be5-b786-1282474301b0' => 'A', # Geneva\n 'f4b8e9e3-831b-44eb-aafe-20f583c555a1' => 'K', # Management\n 'd6756e21-b828-4a0f-9346-2a10633c3b7a' => 'J', # Math\n '1eb3510f-c403-44bf-b3ce-cf693b20ba56' => 'L', # Music\n '760beccd-362d-45b6-bfae-639565a877f2' => 'D', # Olin\n 'debc685c-e905-48d3-9571-bff4742e7249' => 'M', # Ornithology\n '4752a822-380b-446c-860f-bccf641d7118' => 'P', # Contactless pickup - Mann (?)\n '1a072083-330f-4e1b-afa6-1ef15e24e3c3' => 'Q' # Contactless pickup - Math (?)\n }\n\n # Retrieve a list of service points from FOLIO\n url = \"#{ENV['OKAPI_URL']}/service-points?limit=1000\"\n begin\n token = CUL::FOLIO::Edge.authenticate(ENV['OKAPI_URL'], ENV['OKAPI_TENANT'], ENV['OKAPI_USER'], ENV['OKAPI_PW'])[:token]\n headers = {\n 'X-Okapi-Tenant' => ENV['OKAPI_TENANT'],\n 'x-okapi-token' => token,\n :accept => 'application/json',\n }\n response = RestClient.get(url, headers)\n if response.code == 200\n points = JSON.parse(response.body)['servicepoints']\n points.sort_by! { |p| p['discoveryDisplayName'] }\n # As per discussion with Andy Horbal (1/12/22), the criteria to display a service\n # point to the user as a pickup location are:\n # 1. pickupLocation == true\n # 2. discoveryDisplayName != 'Staff Use Only' (used to indicate internal SPs for request routing)\n # 3. discoveryDisplayName doesn't start with 'Special Program Delivery'\n points.select! do |p|\n p['pickupLocation'] &&\n p['discoveryDisplayName'] != 'Staff Use Only' &&\n !(p['discoveryDisplayName'] =~ /^Special Program Delivery/)\n end\n result = points.map do |p|\n {\n name: p['discoveryDisplayName'],\n id: p['id'],\n bd_code: bd_codes[p['id']]\n }\n end\n Rails.logger.debug \"mjc12test6: results: #{result}\"\n return result\n end\n rescue RestClient::ExceptionWithResponse => err\n Rails.logger.debug \"Requests: Couldn't retrieve list of service points (#{err})\"\n return []\n end\n\n # [\n # { name: 'Africana', id: '7c5abc9f-f3d7-4856-b8d7-6712462ca007', bd_code: 'F' },\n # # { name: 'Annex Reading Room Use Only', id: '91f726ff-cbb1-4d60-821e-543ec1e91cc5', bd_code: ''},\n # { name: 'Catherwood ILR', id: 'ab1fce49-e832-41a4-8afc-7179a62332e2', bd_code: 'I'},\n # { name: 'Contactless Pickup - Annex', id: 'b232d619-3441-4fd0-b94c-210002e1fbec', bd_code: 'G'},\n # # { name: 'Contactless Pickup - Law', id: '041d6c8d-20a1-4fd7-8588-458286782aea', bd_code: 'B'},\n # { name: 'Contactless Pickup - Mann', id: '4752a822-380b-446c-860f-bccf641d7118', bd_code: 'P'},\n # { name: 'Contactless Pickup - Math', id: '1a072083-330f-4e1b-afa6-1ef15e24e3c3', bd_code: 'Q'},\n # # { name: 'Contactless Pickup - Ornithology', id: 'd2248b50-9388-4b40-83e2-b2d1200e112c', bd_code: ''},\n # { name: 'Contactless Pickup - Uris Tower', id: 'e2f7ad76-ef2a-454f-8fd4-712caaa0f72b', bd_code: 'O'},\n # { name: 'Contactless Pickup - Vet College community only', id: '23b28dd9-cd7b-4ac1-a19a-6f4d3fce77d8', bd_code: 'E'},\n # # { name: 'Faculty Department Office', id: 'a27d5cda-4810-4b58-874c-1fe1955829e3', bd_code: ''},\n # # { name: 'Fine Arts', id: '86932cca-3b71-4d29-b0e9-0680b1fffabf', bd_code: 'H'},\n # #{ name: 'Geneva Circulation', id: '8eba8e43-90ae-4be5-b786-1282474301b0', bd_code: 'A'},\n # { name: 'Law Circulation', id: '8d40f52a-02cf-4753-b423-0615d4c98479', bd_code: ''},\n # # { name: 'Management', id: 'f4b8e9e3-831b-44eb-aafe-20f583c555a1', bd_code: 'K'},\n # { name: 'Mann', id: '872beba0-1bdf-4870-95f3-8781baddc02e', bd_code: 'C'},\n # { name: 'Math', id: 'd6756e21-b828-4a0f-9346-2a10633c3b7a', bd_code: 'J'},\n # { name: 'Music', id: '1eb3510f-c403-44bf-b3ce-cf693b20ba56', bd_code: 'L'},\n # # { name: 'Nestlé', id: '8e4f5d73-2f77-4906-8d6a-329fc79c5994', bd_code: 'L'},\n # # { name: 'Olin', id: '760beccd-362d-45b6-bfae-639565a877f2', bd_code: 'D'},\n # # { name: 'Ornithology Circulation Desk', id: 'debc685c-e905-48d3-9571-bff4742e7249', bd_code: 'M'},\n # #{ name: 'Uris Clock Tower', id: 'cce94bc5-bb31-4054-96d2-260ba832ef2a'}\n # ]\n end",
"def based_near\n descMetadata.has_location #.map(&:location_name).flatten\n end",
"def checkout_locations\n locations = kits.collect { |k| k.location }\n locations.uniq!\n locations.select { |l| l.business_hours.count > 0 }\n end",
"def filter_locations_bu(points)\n filter_locations(points, 16.06.within(0.07), 50.41.within(0.1))\nend",
"def list_dubious_locations # :nologin:\n query = create_query(:Location, :all, :by => :name)\n show_selected_locations(query, :link_all_sorts => true,\n :action => :list_dubious_locations, :num_per_page => 1000)\n end",
"def locations_around\n locations_within_proximity.where.not(id: id)\n end",
"def location_of_bay(bay)\n location = WAREHOUSE.select{ |item| item[:product_name] == bay }\n return location[0][:rack_bay_position]\nend",
"def symbols_places_unlocked\n @known_places ||= MapConfig.default_place\n @known_places\n end",
"def locate_ballot\n \n topmarks = locate_marks(:top, :ballot, TopExtent)\n leftmarks = locate_marks(:left, :ballot, LeftExtent)\n rightmarks = locate_marks(:right, :ballot, RightExtent)\n\n# The angle of the ballot is simply the average of the non-nil angles returned from the three marks (note that )\n# the returned angle will be nil if locate_marks can't figure it out'\n angles = [topmarks.angle, leftmarks.angle, rightmarks.angle].compact\n self.angle = angles.inject {|total, x| total+x}/angles.length\n \n# Determimne the 4 corners of the ballot. Some info is redundant, so if it's not found in one place, we try other places. \n# We create a list of all the candidates for each one, in order of preference, and then in a \n# separate pass we decide which one is the best match\n\n top_left_x = [] << topmarks.firstmark.x << leftmarks.firstmark.x\n top_left_y = [] << topmarks.firstmark.y << leftmarks.firstmark.y\n bottom_left_x = [] << leftmarks.lastmark.x << leftmarks.firstmark.x << topmarks.firstmark.x\n bottom_left_y = [] << leftmarks.lastmark.y << rightmarks.lastmark.y\n top_right_x = [] << topmarks.lastmark.x << rightmarks.firstmark.x\n top_right_y = [] << topmarks.lastmark.y << rightmarks.firstmark.y << topmarks.firstmark.y << leftmarks.firstmark.y\n bottom_right_x = [] << rightmarks.lastmark.x << topmarks.lastmark.x\n bottom_right_y = [] << rightmarks.lastmark.y << leftmarks.lastmark.y\n \n self.top_left = BPoint.new(top_left_x.detect {|x| !x.nil?}, top_left_y.detect {|x| !x.nil?})\n self.bottom_left = BPoint.new(bottom_left_x.detect {|x| !x.nil?}, bottom_left_y.detect {|x| !x.nil?})\n self.top_right= BPoint.new(top_right_x.detect {|x| !x.nil?}, top_right_y.detect {|x| !x.nil?} )\n self.bottom_right = BPoint.new(bottom_right_x.detect {|x| !x.nil?}, bottom_right_y.detect {|x| !x.nil?})\n \n @upstream.ann_point(self.top_left.x, self.top_left.y, 10)\n @upstream.ann_point(self.top_right.x, self.top_right.y, 10)\n @upstream.ann_point(self.bottom_left.x, self.bottom_left.y, 10)\n @upstream.ann_point(self.bottom_right.x, self.bottom_right.y, 10)\n\n end",
"def likely_qda_in_hubzones\n @hubzone_results[:other_information][:alerts][:likely_qda_designations].map do |qda|\n qda if likely_hubzone_qda_ids.include?(unique_qda(qda))\n end\n end",
"def multiple_locations?(holdings)\n locations = holdings.reject { |_k, h| h['library'] == 'Online' }.map { |_k, h| h['location'] }.uniq\n locations.length > 1\n end",
"def adjacencies\n same_geo_adjacencies_quantity_max = 5\n return self.same_tag_bigger_geo.concat(self.same_geo_adjacencies(same_geo_adjacencies_quantity_max))\n end",
"def favorite_place_coords\n res = []\n stories.includes(:places => [{:place_categories => :parent}, :location]).each do |s|\n s.places.each do |p|\n next unless p.name.present?\n base_cat = p.get_parent_categories.first ? p.get_parent_categories.first.name : 'other'\n res << {name: p.name, base_category: base_cat, place_url: '/places/' + p.id.to_s, lat: p.location.lat, lng: p.location.lng}\n # binding.pry\n end\n end\n res\n end",
"def prune_using_preferences(matching_elements, opts = {})\n fail Error, \"Not suppurting explicit_preferences\" if opts[:explicit_preferences]\n # prefer element with lower number; 1 - means assembly instance, 2 means its parent, ...\n closest_depth = matching_elements.map(&:depth).min\n matching_elements.select { |element| element.depth == closest_depth }.map(&:aug_component)\n end",
"def sanity_check_ballot_coords\n \n end",
"def filtered_holdings\n holdings.filter_map do |holding|\n no_holding_statements = (holding.fetch('holdingsStatements') +\n holding.fetch('holdingsStatementsForIndexes') +\n holding.fetch('holdingsStatementsForSupplements')).compact.empty?\n next if no_holding_statements || holding['suppressFromDiscovery'] ||\n (holding.dig('holdingsType', 'name') ||\n holding.dig('location', 'effectiveLocation', 'details', 'holdingsTypeName')) == 'Electronic'\n\n note = holding.fetch('holdingsStatements').compact.find { |statement| statement.key?('note') && !statement.key?('statement') }&.fetch('note')\n\n library_has_for_holding(holding).map do |library_has|\n {\n id: holding.fetch('id'),\n location: holding.dig('location', 'effectiveLocation'),\n note:,\n library_has:\n }\n end\n end\n end",
"def same_tag_bigger_geo\n above = self.geography.geography\n return [] if above.nil?\n match = Filter.where(\"geography_id = ? and has_tag_id = ?\",above.id,self.has_tag_id)\n return match if match\n return []\n end",
"def unique_distance_to_point?\n # ALL_POINTS.sort_by { |obj| obj.distance_to_main }.first\n @distances = ALL_POINTS.map(&:distance_to_main)\n @sorted_distances = @distances.sort\n @closest = @sorted_distances.first\n @distances.one?(@closest)\nend",
"def suppress_holding?(holding)\n # there are way too many collection codes involved, so we actually\n # filter based on display label -- many times one display label\n # has a dozen or more collection codes. \n ! ([\"Welch Online Journal\", \"Internet\", \"Internet resource\", \"Electronic Resources -- Welch Medical Library\", \"Welch Online Journals\", \"Gibson - Electronic Journals\", \"Gibson-Electronic Books or Documents\", \"Internet resource\", \"Online Book\", \"Friedheim -- Electronic Access\", \"OCLC Electronic Collections Online\", /Electronic Resource/i, /Online Book/i ].find {|test| test === holding.collection.display_label }).nil?\n end",
"def exclude_locations\n return @exclude_locations\n end",
"def displayable_sorted_locations\n\t\tsorted_locations.select { |location| location.display_address.present? }\n\tend",
"def prune\r\n NavLocationLens.new @nav, @locs.uniq\r\n end",
"def find_unseen\n unseen.replace(full_deck)\n (my_hand + op_hand + my_lands.values +\n op_lands.values + discards.values).flatten.each do |c|\n i = unseen.index(c) or next\n unseen.delete_at(i)\n end\n end",
"def my_drop_orders\n return Order.where(:status => 'washed', :dropper_id => self.id) if self.pickup_boy?\n end",
"def ships\n MyShip.where(\"location ~= POINT(?)\", self.location)\n end",
"def taken_dots\n @placements.map {|p| placement_dots(p) }.flatten(1)\n end",
"def bobcat_breadcrumb_alias\n if institutions_included?\n current_institution.try(:bobcat_alias) || institution_views.try(:[], \"dir\") || default_institution_data[\"bobcat_alias\"]\n else\n default_institution_data[\"bobcat_alias\"]\n end\n end",
"def allow_package_level_reference_numbers(shipment)\n origin, destination = shipment.origin.country.code, shipment.destination.country.code\n [['US', 'US'], ['PR', 'PR']].include?([origin, destination])\n end",
"def get_neighbors_pins_coordinates(item)\n item.set_default_neighbors_settings\n by_distance = item.neighbors_ids_by_distance\n by_choice = item.neighbors_ids_by_choice\n by_property = item.neighbors_ids_by_property\n union = by_choice\n if by_property\n union = union | by_distance & by_property\n else\n union = union | by_distance\n end\n list = []\n Spree::Location.where(:id => union).each do |location|\n product = location.locatable\n next if product.nil?\n list << {\n :latitude => location.latitude,\n :longitude => location.longitude,\n :distance => item.distance_from([location.latitude, location.longitude]),\n :locatable_id => location.id\n }\n end\n\n sorted = list\n if item.neighbors_settings\n case item.neighbors_settings.sort\n when 2 then sorted = list.sort_by { |neighbor| Spree::Location.find(neighbor[:locatable_id]).locatable.name }\n when 1 then sorted = list.sort_by { |neighbor| neighbor[:distance] }\n end\n end\n sorted = sorted[0,item.neighbors_settings.count] if item.neighbors_settings && item.neighbors_settings.count > 0\n sorted\n end",
"def places_unlocked\n @known_places ||= MapConfig.default_place\n @known_places.collect { |place|\n Map_Location.new(MapConfig::PLACES[place], place)\n }\n end",
"def locations_surrounding_coordinates(location)\n\n possible_coordinates = possible_offsets.map do |offset|\n [(location.x_coordinate+offset[0]),(location.y_coordinate+offset[1])]\n end\n\n possible_coordinates.select do |coordinate|\n coordinate[0] > -1 && coordinate[0] < @field.height && coordinate[1] > -1 && coordinate[1] < @field.width\n end\n\n end",
"def get_ead_places\n @get_ead_places ||= clean_facets_array(search(\"//geogname\").map(&:text))\n end",
"def valid_drop_spot(x,y)\n return true\n end",
"def countries_blocked_for_minors\n return @countries_blocked_for_minors\n end",
"def receive_tipped_bins\n search_bins_tipped_hierarchy\n end",
"def bound_with_holdings\n @bound_with_holdings ||= holdings.select { |holding| holding['boundWith'].present? || (holding.dig('holdingsType', 'name') || holding.dig('location', 'effectiveLocation', 'details', 'holdingsTypeName')) == 'Bound-with' }.map do |holding|\n parent_item = holding.dig('boundWith', 'item') || {}\n parent_holding = holding.dig('boundWith', 'holding')\n parent_holding ||= holding\n\n item_location_code = parent_item.dig('location', 'temporaryLocation', 'code') if parent_item.dig('location', 'temporaryLocation', 'details', 'searchworksTreatTemporaryLocationAsPermanentLocation') == 'true'\n item_location_code ||= parent_item.dig('location', 'permanentLocation', 'code')\n item_location_code ||= parent_holding.dig('location', 'effectiveLocation', 'code')\n\n library_code, home_location_code = LocationsMap.for(item_location_code)\n _current_library, current_location = LocationsMap.for(parent_item.dig('location', 'temporaryLocation', 'code'))\n current_location ||= Folio::StatusCurrentLocation.new(parent_item).current_location\n\n SirsiHolding.new(\n id: parent_item['id'],\n call_number: holding['callNumber'],\n scheme: call_number_type_map(holding.dig('callNumberType', 'name')),\n # parent item's barcode\n barcode: parent_item['barcode'] || \"#{hrid.sub(/^a/, '')}-#{(all_holdings.index(holding) + 1).to_s.ljust(3, '0')}1\",\n # parent item's current location or SEE-OTHER (SAL3)\n # For the SAL3 logic, see https://consul.stanford.edu/display/MD/Bound+withs\n # When the bound-with item is in SAL3, both the Home and Current Locations on the child records should always be SEE-OTHER.\n current_location: library_code == 'SAL3' ? nil : (current_location unless current_location == home_location_code).presence,\n # parent item's permanent location or SEE-OTHER (SAL3)\n home_location: library_code == 'SAL3' ? 'SEE-OTHER' : home_location_code,\n # parent item's library\n library: library_code\n )\n end\n end",
"def find_banner\n values = {\n left_border: @place.longitude-0.2,\n right_border: @place.longitude+0.2,\n top_border: @place.latitude+0.2,\n bottom_border: @place.latitude-0.2,\n self_id: @place.id\n }\n\n Banner.where(place_id: Place.where('latitude > :bottom_border and latitude < :top_border\n and longitude > :left_border and longitude < :right_border\n and id != :self_id and display_my_banners = true',\n values)).sample\n end",
"def drop_orders\n return Order.where(:status => 'washed', :dropper_id => nil).where.not(:picker_id => nil) if self.pickup_boy?\n end",
"def missed_destinations(chosen_road)\n # An array of all the roads left behind\n roads_left_behind = roads_available.reject {|road| road == chosen_road }\n # collect the destination left behind with those roads \n roads_left_behind.map { |road| road.the_city_opposite(@current_city)}\n\n end",
"def oxygen_fill\n discover_map\n\n # Location + level\n oxygen_locations = [[@map.oxygen_location, 0]]\n visited = Set.new(@map.oxygen_location)\n\n max_level = -1\n\n until oxygen_locations.empty?\n loc, level = oxygen_locations.shift\n max_level = [max_level, level].max\n\n @map.points[loc] = :oxygen\n @map.display if @display\n\n @map.valid_neighbours(loc).each do |neighbour_loc|\n next if visited.include?(neighbour_loc)\n\n oxygen_locations << [neighbour_loc, level + 1]\n visited << neighbour_loc\n end\n end\n\n max_level\n end",
"def is_greedy?(location)\n !@fixed_cost.include? location\n end",
"def primary_pool_picks\n picks.where(:week_id => Week.closed_week_ids).where(:is_second_chance => nil).order(:week_id)\n end",
"def filter_locations_tu(points)\n filter_locations(points, 15.9.within(0.07), 50.57.within(0.1))\nend",
"def collect_hotspots(map, min_score, loc, hotspots=Set.new)\n hotspots << loc\n REGION_SEARCH_VECTORS.each do |offset|\n neighbor = moveBy(loc, offset)\n if !hotspots.include?(neighbor) then\n if !map[neighbor].nil? && map[neighbor][:score] >= min_score then\n hotspots.merge(collect_hotspots(map, min_score, neighbor, hotspots))\n end\n end\n end\n return hotspots\nend",
"def taggable_world_locations_container\n Rails.cache.fetch(taggable_world_locations_cache_digest, expires_in: 1.day) do\n WorldLocation.ordered_by_name.where(active: true).map { |w| [w.name, w.id] }\n end\n end",
"def search_buddies_by_location\n buddy_data = []\n if latitude.blank? || longitude.blank?\n location = [requested_user.current_latitude, requested_user.current_longitude] \n else\n location = [latitude.to_f, longitude.to_f]\n end\n if location_lock == \"true\"\n if search.blank?\n users = User.page(page).per(10).joins(:feeds).includes(:feeds).within(proximity, :origin => location)\n else\n users = User.page(page).per(10).joins(:feeds).includes(:feeds).where(\"name like '%#{search}%'\").within(proximity, :origin => location)\n end\n else\n if search.blank?\n render :status=>401,\n :json=>{:Message=>\"The search cannot be blank for universal search.\",\n :Response => \"Fail\",\n :Data => nil} \n end\n users = User.page(page).per(10).joins(:feeds).includes(:feeds).where(\"name like '%#{search}%'\") unless search.blank?\n end\n users.collect {|user| buddy_data.push(Hashie::Mash.new(:User => user, :Feeds => user.feeds))}\n render :status=>200,\n :json=>{:Message=>\"Here are the buddies near you!\",\n :Response => \"Success\",\n :Data => buddy_data} \n end",
"def location_of_bays(item1, item2, item3)\n location_bays = WAREHOUSE.select{ |bays| bays[:product_name] == item1 || bays[:product_name] == item2 || bays[:product_name] == item3 }\n location_bays.map{ |bays| bays[:rack_bay_position] }.join(\", \")\nend",
"def find_destinations(unit)\n @units\n .select { |u| u.alive? && u.type != unit.type }\n .flat_map { |u| neighbors(u.pos).to_a }\n .reject { |p| occupied?(p) }\n end",
"def pieces_per_location\n @pieces_per_location ||= pieces.group_by { |piece| holdings_by_id[piece['holdingId']]&.dig('location', 'effectiveLocation', 'code') }\n end",
"def noncached_lookup(lng, lat)\n res = dstk.coordinates2politics([lat, lng])\n nbh = res[0]['politics'] ? res[0]['politics'].select { |r| r['friendly_type'] == 'neighborhood' } : nil\n nbh = nbh.first['name'] if nbh && !nbh.empty?\n nbh = 'N/A' if nbh.nil?\n {\n lng: lng,\n lat: lat,\n neighborhood: nbh\n }\n end",
"def item_at_bays(loc1, loc2, loc3)\n product_bays = WAREHOUSE.select{ |bays| bays[:rack_bay_position] == loc1 || bays[:rack_bay_position] == loc2 || bays[:rack_bay_position] == loc3 }\n product_bays.map{ |bays| bays[:product_name] }.join(\", \")\nend",
"def not_in_position(party)\n for battler in party\n next unless battler.exist?\n return true if battler.actual_x != battler.base_x\n return true if battler.actual_y != battler.base_y\n end\n return false\n end",
"def blunder_appropriate_by code\n code = code.to_s\n unless blunder_drop_points[blunder_current_drop_point].include? code\n warn \"No such code '#{code}' for the drop point '#{blunder_current_drop_point}' for object '#{blunder_object_name(self)}'. Trying to find appropriate...\"\n unless blunder_fine_errors\n possible_dp = blunder_drop_points.find { |dp| dp.include? code }\n self.blunder_current_drop_point = possible_dp if possible_dp\n end\n end\n begin\n #by some reason that method did not get saved the object\n #blunders_model.send(\"find_#{'or_create_' if blunder_errors_on_fly}by_drop_point_and_code\", blunder_current_drop_point, code)\n blunder = blunders_model.find_by_drop_point_and_code blunder_current_drop_point.to_s, code\n blunder ||= blunders_model.create!( :drop_point => blunder_current_drop_point.to_s, :code => code)\n rescue\n nil\n end\n end",
"def labelPlaces\n return unless waypoints_changed?\n Place.find_by_radius(averageLatitude, averageLongitude, 50, 0).each do |place|\n minDistance = 400#km\n closestPoint = waypoints.first\n waypoints_minus_removed.each do |waypoint|\n\tdistance = place.dist waypoint.latitude, waypoint.longitude\n\tif minDistance > distance\n\t minDistance = distance\n\t closestPoint = waypoint\n\tend\n end\n # Someone entered a point on the place. If a mountain then replace the height\n # with the correct value and adjust the height change to reflect the new value.\n # If the waypoint isn't labelled then give it the places title and icon.\n if minDistance < 0.3 && !closestPoint.height.nil?\n\tparent = waypoints_minus_removed[closestPoint.parent_index]\n if place.class == Mountain && parent.present?\n heightChange = closestPoint.height - parent.height\n self.height_gain -= heightChange > 0 ? heightChange : 0 unless self.height_gain.nil?\n self.height_loss -= heightChange < 0 ? -heightChange : 0 unless self.height_loss.nil?\n end\n\tclosestPoint.height = place.height if place.class == Mountain\n\tclosestPoint.icon = place.class::MARKER_ICON[0..-5] if closestPoint.icon.nil?\n\tclosestPoint.title = place.name if closestPoint.title.nil?\n if place.class == Mountain && parent.present?\n heightChange = closestPoint.height - parent.height\n self.height_gain += heightChange > 0 ? heightChange : 0 unless self.height_gain.nil?\n self.height_loss += heightChange < 0 ? -heightChange : 0 unless self.height_loss.nil?\n end\n end\n end\n end",
"def get_bipolar()\n\t\tbipolar_patients = [225852588, 1523189252, 598856733, 608962592, 296166433, 16284706, 1956375589, 1107458226, 973227060, 2534848567, 22551612, 2634699844, 3362598982, 418408523, 240034893, 999428179, 826747988, 2873332822, 468366424, 116822107, 2997792101, 21092452, 2521396327, 1965159528, 236269677, 612987752, 80409724, 1472446590, 1369611404, 275718291, 3044144277, 537878682, 3071585439, 18064547, 2808969381, 1040789676, 1419858097, 2480699582, 1344779467, 1566058700, 2871874765, 586255574, 245219549, 2879552746, 997584109, 890409216, 2302976264, 2687654158, 1104536850, 1087659283, 1147083032, 1223074080, 384487714, 2699715876, 1941395749, 3301098796, 478091568, 2997538097, 2754306367, 259181892, 2950023496, 779130192, 312914266, 1096422758, 3353686378, 13009262, 311756151, 2711712128, 1431297410, 16081286, 221353356, 964256144, 2976785207, 2827170195, 108637252, 3293205915, 47967647, 2351302048, 1287172507, 951487916, 85176749, 51012014, 605200816, 149463624, 404322747, 20557244, 851091902, 2195611076, 449616665, 1352465874, 1434508758, 2659042212, 590388700, 1695357414, 2787124722, 1499293171, 222047488, 34318852, 955956744, 2357181962, 2337393168, 135964180, 2830685717, 60524054, 1599439393, 275984930, 2253016615, 92502577, 78240308, 859243062, 1689516600, 2925223485, 2933232196, 236482117, 3196047943, 2179200584, 545525516, 3047890520, 3178041952, 2975297152, 20194945, 761451138, 53754646, 523597454, 942202136, 493569687, 35486369, 270461605, 2325477030, 1171197608, 2531639068, 89842347, 3027488429, 562501294, 749849264, 1157997235, 3375417016, 1680938684, 45728445, 844221126, 28910279, 3283787468, 501824802, 1974223567, 2773499605, 1074974424, 620017370, 335988448, 2914552553, 220497652, 598213371, 2402038525, 561379072, 21823233, 464961283, 1615874822, 439179905, 1198315274, 139908880, 2173474581, 123687707, 2424064796, 546805534, 67405445, 995198754, 2874378024, 60079580, 30621487, 859332414, 1112651587, 1357902660, 2775696182, 3231349576, 23874379, 2347690564, 630949721, 143616860, 2844949343, 2320312174, 1257706351, 2200418160, 184095624, 581988233, 2767717274, 977449884, 1045167511, 386464679, 240864176, 1222900213, 325980108, 1435697101, 3254195151, 496109521, 2732336092, 134246394, 3049541599, 35887077, 2515279847, 55588847, 451615743]\n\t\tbipolar_patients.sample\n\tend",
"def detect_closest_food\n @food_within_scope = []\n $food.each { |food|\n @food_within_scope << food if (distance_from(food.location) <= @scope and !food.exhausted)\n }\n if @food_within_scope.empty?\n xrand = rand(10) * (rand(2) == 0? -1 : 1)\n yrand = rand(10) * (rand(2) == 0? -1 : 1) \n return [@location[0] + xrand, @location[1] + yrand]\n else\n @food_within_scope.sort!{|x,y| distance_from(x.location) <=> distance_from(y.location)}\n return @food_within_scope.first.location\n end\n \n end",
"def supplies_with_default_tax\n self.supplies_including_tax + self.supplies_excluding_tax.select{|s| [\"CAD\",\"USD\"].include?(s[:currency])}\n end",
"def coin_available_after_sweep_needs\n available = {}\n\n # Make the assumption that if hidden irregulars exist in Locations\n # with hidden pavn, the hidden irregulars will be activated to sweep:\n modified_hidden_guerrilla_count = hidden_guerrilla_count\n if us_irregular_count > 0 && hidden_guerrilla_count > 0\n modified_hidden_guerrilla_count = hidden_guerrilla_count - us_irregular_count\n end\n\n if us_troop > modified_hidden_guerrilla_count && us_troop <= coin_control_excess\n available[:us_troop] = us_troop - modified_hidden_guerrilla_count\n end\n\n if us_irregular_count > 0\n if coin_control_excess - us_troop > 0\n available[:us_irregular_hidden] = us_irregular_hidden\n available[:us_irregular_activated] = us_irregular_activated\n end\n end\n available\n end",
"def nearestLocationWithDubbing _args\n \"nearestLocationWithDubbing _args;\" \n end",
"def has_onsite_holdings?\n return false unless self[:location_facet].present?\n\n # consider each location for this record....\n self[:location_facet].each do |location_facet|\n # skip over anything that's offsite...\n next if location_facet =~ /^Offsite/\n next if location_facet =~ /ReCAP/i\n\n # skip over Online locations (e.g., just links)\n next if location_facet =~ /Online/i\n\n # If we got here, we found somthing that's onsite!\n return true\n end\n\n # If we dropped down to here, we only found offsite locations.\n false\n end",
"def filterHotDogStandsByDistanceFromReferenceLocation(httpRequestParameters)\n # Use this array to store the stands that will have their data be returned to the frontend for processing.\n hotDogStandsWithFavourablePositions = []\n\n @searchQuery.each do |currentHotDogStand|\n if httpRequestParameters[\"distanceUnit\"] == \"KM\" and httpRequestParameters[\"distanceRange\"] != \"0\"\n # If the user has specified a range in kilometers, check to see that the distance between the user's current position\n # and the hot dog stand is less than the range the user specified in kilometers.\n if distanceBetweenTwoPointsLatAndLongInKM(httpRequestParameters[\"latitude\"].to_f, httpRequestParameters[\"longitude\"].to_f, \\\n currentHotDogStand.latitude, currentHotDogStand.longitude) < httpRequestParameters[\"distanceRange\"].to_f\n hotDogStandsWithFavourablePositions.push(currentHotDogStand)\n end\n elsif httpRequestParameters[\"distanceUnit\"] == \"MI\" and httpRequestParameters[\"distanceRange\"] != \"0\"\n # If the user has specified a range in miles, check to see that the distance between the user's current position\n # and the hot dog stand is less than the range the user specified in miles.\n if distanceBetweenTwoPointsLatAndLongInKM(httpRequestParameters[\"latitude\"].to_f, httpRequestParameters[\"longitude\"].to_f, \\\n currentHotDogStand.latitude, currentHotDogStand.longitude) < httpRequestParameters[\"distanceRange\"].to_f\n hotDogStandsWithFavourablePositions.push(currentHotDogStand)\n end\n else\n # Otherwise, put all of the existing stands into the array.\n hotDogStandsWithFavourablePositions.push(currentHotDogStand)\n end\n end\n return hotDogStandsWithFavourablePositions\n end",
"def same_geo_adjacencies(quantity_max = 5)\n possibles = Filter.where(\"geography_id = ?\",self.geography.id).to_a #will always return at least self\n possibles = possibles.delete_if{|filter| filter.id == self.id}\n return possibles.take(quantity_max)\n end",
"def smallest_area\n has_area = 0\n has_area = $postings.select{|p| p[1][/\\d+(?=ft)/].to_i >= 1}\n tiny_post = has_area.min{|a,b| a[1][/\\d+(?=ft)/].to_i <=> b[1][/\\d+(?=ft)/].to_i}\n tiny_area = tiny_post[1][/\\d+(?=ft)/].to_i\n tiny_ads = has_area.select{|i| i[1][/\\d+(?=ft)/].to_i == tiny_area}\n list_apt(tiny_ads)\nend",
"def collapse_locs(condensed)\n\t supl = ['orders','summary_holdings','supplements','indexes','notes','reproduction_note','current_issues']\n\t cond2 = []\n\t lstat = istat = []\n\t count_cond2 = {}\n\t condensed.each do |loc|\n\t ##Rails.logger.debug \"\\nes287_debug #{__FILE__} line(#{__LINE__}) location=#{loc['location_name']} #{loc['call_number']}\\n\"\n\t if count_cond2[\"#{loc['location_name']} #{loc['call_number']}\"].blank?\n\t\tcount_cond2[\"#{loc['location_name']} #{loc['call_number']}\"] = {}\n\t\tcount_cond2[\"#{loc['location_name']} #{loc['call_number']}\"][\"count\"] = 1\n\t\tcount_cond2[\"#{loc['location_name']} #{loc['call_number']}\"][\"holdings\"] = [loc]\n\t else\n\t\tcount_cond2[\"#{loc['location_name']} #{loc['call_number']}\"][\"count\"] += 1\n\t\tcount_cond2[\"#{loc['location_name']} #{loc['call_number']}\"][\"holdings\"] << loc\n\t end\n\t end\n\t ##Rails.logger.debug \"\\nes287_debug #{__FILE__} line(#{__LINE__}) count_cond2=#{count_cond2.inspect}\"\n\t count_cond2.each do |key,loc|\n\t for i in 0..(loc['holdings'].size-1) do\n\t\t##Rails.logger.debug \"\\nes287_debug #{__FILE__} line(#{__LINE__}) i=#{i} loc holdings i =#{loc['holdings'][i].inspect}\"\n\t\t# first one just copy data.\n\t\tif i == 0\n\t\t cond2 << loc['holdings'][i]\n\t\t next\n\t\telse\n\t\t # update copies data -- items counts and statuses\n\t\t istat = cond2[cond2.size-1]['copies'][0]['items'].keys\n\t\t lstat = loc['holdings'][i]['copies'][0]['items'].keys\n\t\t bstat = (istat | lstat)\n\t\t ##Rails.logger.debug \"\\nes287_debug #{__FILE__} line(#{__LINE__}) bstat=#{bstat.inspect}\"\n\t\t bstat.each do |s|\n\t\t if (!cond2[cond2.size-1]['copies'][0]['items'][s].blank? && !loc['holdings'][i]['copies'][0]['items'][s].blank? )\n\t\t cond2[cond2.size-1]['copies'][0]['items'][s]['count'] += loc['holdings'][i]['copies'][0]['items'][s]['count']\n\t\t end\n\t\t if (cond2[cond2.size-1]['copies'][0]['items'][s].blank? && !loc['holdings'][i]['copies'][0]['items'][s].blank?)\n\t\t cond2[cond2.size-1]['copies'][0]['items'][s] = loc['holdings'][i]['copies'][0]['items'][s]\n\t\t end\n\t\t end #bstat.each\n\t\t # copy or add to supplementary data\n\t\t supl.each do |type|\n\t\t if type == 'current_issues'\n\t\t ##Rails.logger.debug \"\\nes287_debug #{__FILE__} line(#{__LINE__}) type = 'current issues '@@@@ loc[holdings[i][type] =\" + loc['holdings'][i][type].inspect\n\t\t ##Rails.logger.debug \"\\nes287_debug #{__FILE__} line(#{__LINE__}) @@@@ loc[holdings[i] =\" + loc['holdings'][i].inspect\n\t\t end\n\t\t if !loc['holdings'][i][type].blank? && !cond2[cond2.size-1]['copies'][0][type].blank?\n\t\t if type == 'current_issues'\n\t\t\t##Rails.logger.debug \"\\nes287_debug #{__FILE__} line(#{__LINE__}) @@@@ copying current issues to \" + cond2[cond2.size-1]['copies'][0][type].inspect\n\t\t end\n\t\t if type == 'summary_holdings'\n\t\t\tdiv = ';'\n\t\t else\n\t\t\tdiv = ';'\n\t\t end\n\t\t if !cond2[cond2.size-1]['copies'][0][type].include?(loc['holdings'][i][type])\n\t\t\tcond2[cond2.size-1]['copies'][0][type] << div + loc['holdings'][i][type]\n\t\t\tif type == 'indexes'\n\t\t\t ##Rails.logger.debug \"\\nes287_debug #{__FILE__} line(#{__LINE__}) @@@@ copying #{type} \" + cond2[cond2.size-1]['copies'][0][type].inspect\n\t\t\t t1str = (cond2[cond2.size-1]['copies'][0][type]).gsub('Indexes: ','')\n\t\t\t t1str.gsub!('; ',';')\n\t\t\t t2str = t1str.split(';')\n\t\t\t ##Rails.logger.debug \"\\nes287_debug #{__FILE__} line(#{__LINE__}) @@@@ t2str = \" + t2str.inspect\n\t\t\t t2str.sort!\n\t\t\t ##Rails.logger.debug \"\\nes287_debug #{__FILE__} line(#{__LINE__}) @@@@ t2str = \" + t2str.inspect\n\t\t\t cond2[cond2.size-1]['copies'][0][type] = 'Indexes: ' + t2str.join(';')\n\t\t\tend\n\t\t\tif type == 'summary_holdings'\n\t\t\t ##Rails.logger.debug \"\\nes287_debug #{__FILE__} line(#{__LINE__}) @@@@ copying #{type} \" + cond2[cond2.size-1]['copies'][0][type].inspect\n\t\t\t t1str = (cond2[cond2.size-1]['copies'][0][type]).gsub('Library has: ','')\n\t\t\t t1str.gsub!('<br/>','')\n\t\t\t t1str.gsub!(' ','')\n\t\t\t t1str.gsub!('; ',';')\n\t\t\t #t2str = t1str.split(';')\n\t\t\t t2str = t1str.split(div)\n\t\t\t ##Rails.logger.debug \"\\nes287_debug #{__FILE__} line(#{__LINE__}) @@@@ t2str = \" + t2str.inspect\n\t\t\t t2str.sort!\n\t\t\t ##Rails.logger.debug \"\\nes287_debug #{__FILE__} line(#{__LINE__}) @@@@ t2str = \" + t2str.inspect\n\t\t\t #cond2[cond2.size-1]['copies'][0][type] = ('Library has: ' + t2str.join(';')).html_safe\n\t\t\t cond2[cond2.size-1]['copies'][0][type] = ('Library has: ' + t2str.join(';<br/> ')).html_safe\n\t\t\tend\n\t\t end\n\t\t end\n\t\t if !loc['holdings'][i][type].blank? && cond2[cond2.size-1]['copies'][0][type].blank?\n\t\t if type == 'current_issues'\n\t\t\t##Rails.logger.debug \"\\nes287_debug #{__FILE__} line(#{__LINE__}) @@@@ copying current issues to \" + cond2[cond2.size-1]['copies'][0][type].inspect\n\t\t end\n\t\t cond2[cond2.size-1]['copies'][0][type] = loc['holdings'][i][type]\n\t\t end\n\t\t end #supl.each do\n\n\t\tend #if i == 0\n\t end #for i in 0 .. loc\n\t end #count_cond2\n\t ##Rails.logger.debug \"\\nes287_debug line(#{__LINE__}) count_cond2=#{count_cond2.inspect}\"\n\t ##Rails.logger.debug \"\\nes287_debug line(#{__LINE__}) cond2=#{cond2.inspect}\"\n\t #condensed\n\t if false\n\t cond2.each do |loc|\n\t if loc['copies'][0]['items']['Available'] && loc['copies'][0]['items']['Available'].size > 0\n\t loc['copies'][0]['items'][' Available'] = loc['copies'][0]['items']['Available']\n\t end\n\t loc['copies'][0]['items'].delete('Available')\n\n\t end\n\t end\n\t cond2\n\t end",
"def lat_long_dubious?\n lat && location && !location.lat_long_close?(lat, long)\n end",
"def find_my_ballots\n round = 1\n self.candidates.each do |cand|\n binding.pry\n puts\" __________________________________________________________________ \"\n puts\"| |\"\n puts\"| Round ##{round} |\"\n puts\"| #{cand.level_of_governments} |\"\n puts\"|__________________________________________________________________|\"\n puts\" __________________________________________________________________ \"\n puts\" \"\n puts\" You Voted For: \"\n puts\" \"\n puts\" #{cand.name} \"\n puts\" \"\n puts\" State: #{cand.state} \"\n puts\" Party: #{cand.party} \"\n puts\" Age: #{cand.age} \"\n puts\" Level of Government: #{cand.level_of_governments} \"\n puts\"__________________________________________________________________\"\n round += 1\n end\n end",
"def fix_if_cddt_is_uniq\n axes = [@row, @col, @block]\n axes.each{|axis|\n @cddts.each{|cddt|\n other_cell_cddts = []\n axis.map{|elm|\n next if elm == self\n other_cell_cddts.push(elm.cddts)\n }\n unless other_cell_cddts.flatten.include?(cddt)\n @cddts = [cddt]\n# if ProgramConfig[:debug]\n# print \"DEBUG: [#{i}, #{j}] = #{cddts.first}\\n\" unless @fixed\n# end\n @fixed = true\n end\n }\n }\n end",
"def next_location_cadidates(location, key)\n [\n location[key.symbol],\n Searcher.fallback? && key.fallback && location[key.fallback],\n Searcher.skip? && key.skippable && location\n ].compact\n end",
"def districts\n self.projects.collect do |proj|\n proj.locations\n end.flatten.uniq\n end",
"def excluded_brands(object)\n obs = order_brands(object)\n invalid_brand_sets.collect{|ibs| ibs if (ibs & obs).count == ibs.count}.flatten.compact\n end",
"def items_near_location(long, lat)\n long = long.to_f\n lat = lat.to_f\n nearby_items = self.items.not_deleted.limit(64).with_long_lat_and_radius(long, lat, 0.000025)\n nearby_items = self.items.not_deleted.limit(64).with_long_lat_and_radius(long, lat, 0.00006) if nearby_items.empty?\n nearby_items = self.items.not_deleted.limit(64).with_long_lat_and_radius(long, lat, 0.002) if nearby_items.empty?\n nearby_items = self.items.not_deleted.limit(64).with_long_lat_and_radius(long, lat, 10.0) if nearby_items.empty?\n return nearby_items\n end",
"def distinctions_offered\n\t\tfind_related_frbr_objects( :presents, :which_distinctions?) \n\t end",
"def check_if_business_location_is_set\n lookup_business_location unless business_location\n end",
"def locate_pins(location); end",
"def find_wild_pokemon\n Pokemon.all.where(location_id: self.user_current_location.id).sample\n end",
"def candidates_included_in_all_the_others(candidates_in_correct_position)\n\tcandidates_in_correct_position.each do |small|\n\t\tok = true\n\t\tcandidates_in_correct_position.each do |big|\n\t\t\tif small!=big\n\t\t\t\tunless big.source.position.include?(small.source.position)\n\t\t\t\t\tok = false\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\treturn small if ok\n\tend\n\tnil\nend",
"def filter_locations(points, lon_deg_range, lat_deg_range)\n points.select do |p|\n lon_deg_range.include?(p[0]) && lat_deg_range.include?(p[1])\n end\nend",
"def shipping_categories\n\t self.line_items.collect {|l| l.product.shipping_category_id}.uniq\n end",
"def places_nearby_without_title_photos radius=15\n Place.find_by_radius(centerLatitude,centerLongitude,radius).where(\"places.id != ?\", id).where(\"places.name_status != 'unnamed' and places.id not in (select distinct photos.place_id from photos where photos.place_id is not null)\").order(\"places.type != 'Mountain', power(places.latitude - #{centerLatitude.to_f},2)+power(places.longitude - #{centerLongitude.to_f},2)\")\n end",
"def free_countries\r\n\t\t\tCountry.countries.values - ShippingZone.find(:all, :include => :countries).collect { |zone| zone.countries.values.collect { |country| country.name } }.flatten\r\n\t\tend",
"def free_spot_coords(galaxy_id)\n x_range, y_range = ranges\n\n possible = Set.new\n each_coord { |coords| possible.add(coords) }\n\n without_locking do\n SolarSystem.\n select(\"x, y\").\n where(galaxy_id: galaxy_id, x: x_range, y: y_range).\n c_select_all\n end.each { |row| possible.delete([row['x'], row['y']]) }\n\n if possible.blank?\n raise \"No possible spaces for #{self} in galaxy #{galaxy_id}!\"\n else\n possible.to_a.random_element\n end\n end",
"def possible_worker_positions(world)\n relative_locations.reject { |loc| world.out_of_bounds?(*loc) }\n end",
"def item_at_bays_more(loc1, loc2, loc3, loc4)\n product_bays_more = WAREHOUSE.select{ |bays| bays[:rack_bay_position] == loc1 || bays[:rack_bay_position] == loc2 || bays[:rack_bay_position] == loc3 || bays[:rack_bay_position] == loc4 }\n product_bays_more.map{ |bays| bays[:product_name] }.join(\", \")\nend",
"def similar_trips\n Trip.where(destination_city: destination_city).where.not(id: id)\n end",
"def get_target(map, loc)\n owned = nil\n owned_min = 1000\n GameMap::CARDINALS.each do |l|\n new_loc = map.find_location(loc, l)\n site = map.site(new_loc)\n if site.owner != $tag && site.strength < owned_min\n owned_min = site.strength\n owned = l\n end\n end\n owned\nend",
"def prune(items)\n wants = []\n # owners = []\n items.each do |item|\n # owners << item.user\n item.user.wants.each do |want|\n if want.possession.trade_id == self.id\n wants << want.possession\n end\n end\n end\n # wants = []\n # owners.each do |owner|\n # owner.wants.each do |want|\n # if want.possession.trade_id == self.id\n # wants << want.possession\n # end\n # end\n # end\n items.each do |item|\n if !wants.include?(item)\n items.delete(item)\n end\n end\n items\n end",
"def unused_nodes\n s = []\n (0..7).each do |i|\n if position[i] && !position[i].used\n s << i\n end\n end\n s\n end",
"def referenced_by\n received_pings.pluck('DISTINCT source')\n end",
"def find_gold_bags!\n # Find the set of bags that can directly contain a SHINY_GOLD bag.\n gold_bags = Set.new @rules.values.filter { |e| e.contents.include?(SHINY_GOLD) }.map(&:color)\n\n # Do a transitive closure, finding all bags that can contain a bag which\n # contains a bag which ...\n stabilized = false\n until stabilized\n initial_size = gold_bags.length\n\n @rules.each do |color, contents|\n color_contents = contents.contained_colors\n\n # If any of the contained colors are in the set of bags we know can\n # contain a gold bag\n if color_contents.intersect? gold_bags\n # add in the new parent color\n gold_bags << color\n end\n end\n\n stabilized = gold_bags.length == initial_size\n end\n\n gold_bags\n end",
"def mark_using(using, used, uncertain)\n used[using] = true\n neighbor_sets = uncertain.delete(using).tap{|ns| ns && ns.each{|n| n && n.delete(using) }}\n neighbor_sets && neighbor_sets.each do |neighbors|\n using = (neighbors && neighbors.length == 1) ? neighbors.first : nil\n mark_using(using, used, uncertain)\n end\nend",
"def can_drop_second?(carrying_unit, direction)\n if @first_drop_unit == carrying_unit.holding_units[0]\n second_unit = carrying_unit.holding_units[1]\n else\n second_unit = carrying_unit.holding_units[0]\n end\n # Saves this location for when the second unit has an available drop off spot\n @first_drop_spot = [cursor.x, cursor.y]\n # Reset cursor location\n case direction\n when [2] #down\n cursor.y -= 1\n when [4] #left\n cursor.x += 1\n when [6] #right\n cursor.x -= 1\n when [8] #up\n cursor.y += 1\n end\n # Determine if available spot to drop\n units_nearby = $game_map.get_nearby_units(cursor.x, cursor.y)\n tiles_nearby = $game_map.get_nearby_tiles(cursor.x, cursor.y)\n for i in 0...units_nearby.size\n # Removes the first dropped unit's position as being an available drop spot\n # for the second unit.\n case direction\n when [8]\n next if i == 0\n when [6]\n next if i == 1\n when [2]\n next if i == 2\n when [4]\n break if i == 3\n end\n # If the space is empty or if the unit in question is the same as the one\n # being given orders right now\n if units_nearby[i].nil? or units_nearby[i] == carrying_unit\n if carrying_unit.test_drop_tile(tiles_nearby[i], second_unit) == true\n return true\n end\n end\n end\n return false\n end",
"def locations; end",
"def without_impossible_coordinates\n collection = clone\n collection.coordinates.reject! { |c| impossible_coordinate?(c) }\n collection\n end",
"def reachable_from(name)\n unresolved = Set.new\n rs = reachable_set(by_name(name)) { |f|\n callees = []\n f.callsites.each { |cs|\n cs.callees.each { |n|\n if(f = by_label_or_name(n,false))\n callees.push(f)\n else\n unresolved.add(cs)\n end\n }\n }\n callees\n }\n [rs, unresolved]\n end",
"def available_departments\n (active_departments + active_units.collect(&:parent)).uniq\n end",
"def fix_location\n self.location = self.location.map(&:to_f)\n end",
"def by_name(name)\n Digitalocean::Droplet.all.droplets.find do |droplet|\n droplet.name == name\n end\nend",
"def direct_duplicates\n\t\tself.class.unscope.where(archetype: self)\n\tend",
"def remove_p_bubbles\n visited = Set.new\n segment_names.each do |sn|\n next if visited.include?(sn)\n if connectivity(sn) == [1,1]\n s1 = neighbours([sn, :B])[0]\n s2 = neighbours([sn, :E])[0]\n n1 = neighbours(s1).sort\n n2 = neighbours(s2).sort\n n1.each {|se| visited << se[0].name}\n if n1 == n2.map{|se| se.invert_end_type}\n remove_proven_p_bubble(s1, s2, n1)\n end\n end\n end\n return self\n end"
] | [
"0.538128",
"0.5286698",
"0.52640563",
"0.51731384",
"0.51404375",
"0.50940275",
"0.50786614",
"0.4945028",
"0.49234504",
"0.49208042",
"0.49035388",
"0.48954877",
"0.48739508",
"0.48683634",
"0.4864085",
"0.48428077",
"0.4831716",
"0.48199928",
"0.48179698",
"0.4808689",
"0.47736505",
"0.47717878",
"0.47548872",
"0.47485217",
"0.4739763",
"0.472777",
"0.4727228",
"0.47232005",
"0.47173053",
"0.47096997",
"0.4706028",
"0.47038698",
"0.47037053",
"0.47019982",
"0.46970206",
"0.4683895",
"0.4675963",
"0.46730036",
"0.46715522",
"0.4671174",
"0.467067",
"0.46662003",
"0.46637037",
"0.46515334",
"0.4632857",
"0.46311584",
"0.46301857",
"0.46297184",
"0.46201944",
"0.46176428",
"0.46089512",
"0.459539",
"0.45812973",
"0.45795187",
"0.45731345",
"0.45650974",
"0.4564506",
"0.45636174",
"0.4563357",
"0.4561216",
"0.45578048",
"0.4540842",
"0.45383096",
"0.45381367",
"0.45274046",
"0.45264193",
"0.45197362",
"0.4512251",
"0.4496132",
"0.44926435",
"0.4487474",
"0.44820157",
"0.44814342",
"0.4476808",
"0.44753256",
"0.44715202",
"0.44707167",
"0.44685715",
"0.44674897",
"0.44596928",
"0.44580713",
"0.4453589",
"0.44513124",
"0.44498503",
"0.44440252",
"0.4442442",
"0.44376922",
"0.44319162",
"0.44301832",
"0.44288394",
"0.4425624",
"0.4425072",
"0.44235444",
"0.44231045",
"0.44203833",
"0.4415281",
"0.44145614",
"0.4412103",
"0.4410738",
"0.44104943"
] | 0.57110375 | 0 |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.